### Setup Lynx Examples Project Source: https://github.com/kwankong-git/lynx-examples/blob/main/CONTRIBUTING.md Instructions to clone the Lynx Examples repository from GitHub and install its dependencies using git and pnpm. This is the initial step to get the project running locally. ```sh git clone https://github.com/lynx-family/lynx-examples.git cd lynx-examples pnpm install ``` -------------------------------- ### Install Dependencies and Start Lynx Example Project Source: https://github.com/kwankong-git/lynx-examples/blob/main/README.md Steps to enable pnpm using corepack, install project dependencies, and start the development server for a chosen Lynx example. This allows you to view and interact with the example in your browser. ```bash # Use corepack to enable pnpm corepack enable pnpm i pnpm run dev ``` -------------------------------- ### Install Dependencies and Start Lynx Website Project Source: https://github.com/kwankong-git/lynx-examples/blob/main/README.md Commands to install dependencies and start the development server for the 'lynx-website' project after updating its package dependencies. This makes the newly added Lynx examples available on the website. ```bash pnpm i pnpm run dev ``` -------------------------------- ### Install project dependencies using pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/lazy-bundle/README.md This command installs all necessary project dependencies using pnpm, ensuring the project is ready for development. ```bash pnpm install ``` -------------------------------- ### Install Project Dependencies with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/performance-api/README.md This command installs all required project dependencies using the pnpm package manager. It's the first step to prepare the project environment after cloning or when new packages are introduced. ```bash pnpm install ``` -------------------------------- ### Run a Specific Lynx Example in Development Mode Source: https://github.com/kwankong-git/lynx-examples/blob/main/CONTRIBUTING.md Command to start a specific example project in development mode. This typically enables live reloading and other development-time features. Replace `` with the desired example. ```sh pnpm --filter run dev ``` -------------------------------- ### Run development server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/lazy-bundle/README.md This command starts the development server, allowing you to view the application. Scan the QR code in the terminal with your LynxExplorer App to see the result. ```bash pnpm run dev ``` -------------------------------- ### Install project dependencies with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/fetch/README.md This command installs all necessary project dependencies using pnpm, ensuring the project is ready for development. ```bash pnpm install ``` -------------------------------- ### Install project dependencies with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/action-sheet/README.md This command installs all necessary project dependencies using the pnpm package manager, preparing the project for development. ```bash pnpm install ``` -------------------------------- ### Install project dependencies with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/local-storage/README.md Installs all required project dependencies using the pnpm package manager, preparing the project for development. ```bash pnpm install ``` -------------------------------- ### Run development server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/action-sheet/README.md This command starts the development server. After execution, scan the QRCode displayed in the terminal with your LynxExplorer App to view the application. ```bash pnpm run dev ``` -------------------------------- ### Run the CSS Lynx Example Source: https://github.com/kwankong-git/lynx-examples/blob/main/CONTRIBUTING.md A concrete example demonstrating how to run the 'css' example project in development mode. This command will launch the CSS example for local development. ```sh pnpm --filter css run dev ``` -------------------------------- ### Run development server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/page/README.md Starts the development server for the ReactLynx project. After execution, scan the QRCode in the terminal with your LynxExplorer App to view the application. The page auto-updates as you edit `src/App.tsx`. ```bash pnpm run dev ``` -------------------------------- ### Run development server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/fetch/README.md This command starts the development server, allowing you to view the application. Scan the QR code in the terminal with your LynxExplorer App to see the result. ```bash pnpm run dev ``` -------------------------------- ### Install project dependencies with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/view/README.md Installs all required packages for the Rspeedy project using the pnpm package manager. ```bash pnpm install ``` -------------------------------- ### Run development server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/local-storage/README.md Starts the development server for the ReactLynx project. The page will auto-update as you edit files, and you can scan the QRCode in the terminal with LynxExplorer App to view the result. ```bash pnpm run dev ``` -------------------------------- ### Run development server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/image/README.md Starts the development server for the Rspeedy project. After execution, scan the QRCode in the terminal with your LynxExplorer App to view the application. ```bash pnpm run dev ``` -------------------------------- ### Install project dependencies with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/native-element/README.md Installs all required project dependencies using the pnpm package manager. This step is necessary before running the development server or building the project. ```bash pnpm install ``` -------------------------------- ### Install project dependencies with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/page/README.md Installs all required project dependencies using the pnpm package manager. This step is necessary before running the development server or building the project. ```bash pnpm install ``` -------------------------------- ### Run development server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/ifr/README.md Starts the development server for the ReactLynx project. The page will auto-update as you edit files, and you can scan the QRCode in the terminal with your LynxExplorer App to view the result. ```bash pnpm run dev ``` -------------------------------- ### Run development server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/native-element/README.md Starts the development server for the ReactLynx project. After running this command, you can scan the QRCode in the terminal with your LynxExplorer App to view the application. The page will auto-update as you edit source files. ```bash pnpm run dev ``` -------------------------------- ### Build a Specific Lynx Example Project Source: https://github.com/kwankong-git/lynx-examples/blob/main/CONTRIBUTING.md Command to build a single example project within the Lynx Examples workspace. Replace `` with the actual name of the example directory. ```sh pnpm --filter build ``` -------------------------------- ### Install project dependencies with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/image/README.md Installs all required packages for the Rspeedy project using pnpm. This step is crucial before running the development server. ```bash pnpm install ``` -------------------------------- ### Run Development Server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/performance-api/README.md This command initiates the development server for the ReactLynx application. Upon successful execution, a QRCode will be displayed in the terminal, which can be scanned with the LynxExplorer App to access the running application. ```bash pnpm run dev ``` -------------------------------- ### Install project dependencies with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/ifr/README.md Installs all required project dependencies using the pnpm package manager. This step is crucial before running the development server or building the project. ```bash pnpm install ``` -------------------------------- ### Install project dependencies with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/scroll-view/README.md Installs all required packages for the Rspeedy project using pnpm. This step is necessary before running the development server or building the project. ```bash pnpm install ``` -------------------------------- ### Run development server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/view/README.md Starts the development server for the Rspeedy project. Scan the QR code in the terminal with LynxExplorer App to view the application. The page auto-updates on file changes. ```bash pnpm run dev ``` -------------------------------- ### Clone Lynx Examples Repository Source: https://github.com/kwankong-git/lynx-examples/blob/main/README.md Instructions to clone the Lynx examples repository from GitHub to your local machine, allowing you to access and run the provided code examples. ```bash git clone git@github.com:lynx-family/lynx-examples.git ``` -------------------------------- ### Install project dependencies with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/hello-world/README.md Installs all required project dependencies using the pnpm package manager. This command should be run first to set up the development environment. ```bash pnpm install ``` -------------------------------- ### Start Rsbuild Development Server Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/web-platform/packages/react-container/README.md Starts the local development server for the Rsbuild project. This allows developers to see changes in real-time during development. ```bash pnpm dev ``` -------------------------------- ### Run development server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/scroll-view/README.md Starts the development server for the Rspeedy project. The page auto-updates as you edit files, and you can scan the QRCode in the terminal with LynxExplorer App to view the result. ```bash pnpm run dev ``` -------------------------------- ### Install Rsbuild Project Dependencies Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/web-platform/packages/react-container/README.md Installs all necessary project dependencies using pnpm. This command should be run after cloning the repository or when new dependencies are added to the project. ```bash pnpm install ``` -------------------------------- ### Run react-container development server Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/web-platform/README.md This command starts the development server for the 'react-container' package. It allows users to access the React application locally, typically at http://localhost:3000/. ```bash pnpm run dev ``` -------------------------------- ### Run development server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/hello-world/README.md Starts the development server for the ReactLynx project. After running, scan the QRCode in the terminal with your LynxExplorer App to view the result. The page auto-updates as you edit `src/App.tsx`. ```bash pnpm run dev ``` -------------------------------- ### Navigate to a Specific Lynx Example Directory Source: https://github.com/kwankong-git/lynx-examples/blob/main/README.md Command to change the current directory into a specific Lynx example, such as the 'image' example, after cloning the repository. This prepares the environment for running that particular example. ```bash cd examples/image ``` -------------------------------- ### Build All Lynx Workspace Projects Source: https://github.com/kwankong-git/lynx-examples/blob/main/CONTRIBUTING.md Command to build all projects within the Lynx Examples monorepo. This uses pnpm and turbo to efficiently compile all components. ```sh pnpm turbo build ``` -------------------------------- ### Embed Lynx Example in MDX File using Go Component Source: https://github.com/kwankong-git/lynx-examples/blob/main/README.md Example of how to use the '' component within an MDX file to embed and display a Lynx example, specifying the example name, default file, and a preview image. This component facilitates showcasing interactive examples on the Lynx website. ```jsx import { Go } from "@lynx"; ; ``` -------------------------------- ### Install pnpm workspace dependencies Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/web-platform/README.md This command installs all necessary dependencies for the pnpm workspace project. It should be run first to ensure all packages are available for building and development. ```bash pnpm install ``` -------------------------------- ### Building a Lynx Application Bundle Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/with-solidjs/README.md This shell command initiates the build process for a Lynx application. Upon successful execution, it generates a `.lynx.bundle` file in the designated output directory, which can then be run using LynxExplorer. ```sh $ npm run build ``` -------------------------------- ### Install project dependencies with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/accessibility/README.md Installs all necessary project dependencies using the pnpm package manager. This command should be run once after cloning the repository. ```bash pnpm install ``` -------------------------------- ### Update Lynx Website Package Dependencies Source: https://github.com/kwankong-git/lynx-examples/blob/main/README.md Example of how to update the 'package.json' dependencies in the 'packages/lynx-example-packages' directory of the 'lynx-website' to include a new Lynx example package. This step is necessary when publishing a new example to npm. ```json "dependencies": { "@lynx-example/xxx": "xxx" } ``` -------------------------------- ### Install project dependencies with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/composing-elements/README.md Installs all necessary project dependencies using the pnpm package manager. This command should be run first to prepare the development environment. ```bash pnpm install ``` -------------------------------- ### Run development server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/composing-elements/README.md Starts the development server for the ReactLynx project. After running, scan the QRCode in the terminal with your LynxExplorer App to view the application. The page will auto-update as you edit `src/App.tsx`. ```bash pnpm run dev ``` -------------------------------- ### Run development server with pnpm Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/accessibility/README.md Starts the development server for the ReactLynx project. After running, scan the QRCode in the terminal with your LynxExplorer App to view the application. The page will auto-update on file changes. ```bash pnpm run dev ``` -------------------------------- ### Importing SolidJS Components from Custom Lynx Renderer Package Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/with-solidjs/README.md This example shows how to import SolidJS functionalities, such as `createSignal`, from the custom `@lynx-js/solid` package. This package encapsulates the custom renderer, allowing developers to use SolidJS components that are compatible with the Lynx environment. ```tsx import { createSignal } from "@lynx-js/solid"; ... ``` -------------------------------- ### Marking Main Thread Assets in Rspack for Lynx Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/with-solidjs/README.md This snippet demonstrates how to use a custom `MarkMainThreadWebpackPlugin` within an rspack configuration. It modifies asset information, specifically for `main.js`, by adding a `"lynx:main-thread": true` flag, which is crucial for Lynx to identify main thread scripts. This plugin is part of the `@lynx-js/template-webpack-plugin` package. ```JavaScript /** * @param {import("@rspack/core").Compiler} compiler */ ((compiler) => { compiler.hooks.thisCompilation.tap( "MarkMainThreadWebpackPlugin", /** * @param {import("@rspack/core").Compilation} compilation */ (compilation) => { compilation.hooks.processAssets.tap( "MarkMainThreadWebpackPlugin", () => { const asset = compilation.getAsset(`main.js`); compilation.updateAsset(asset.name, asset.source, { ...asset.info, "lynx:main-thread": true, }); }, ); }, ); }); ``` -------------------------------- ### Configuring Babel Preset Solid for Custom Lynx Renderer Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/with-solidjs/README.md This JSON configuration snippet demonstrates how to set up `babel-preset-solid` to correctly utilize the custom SolidJS renderer provided by `@lynx-js/solid`. By specifying `"moduleName": "@lynx-js/solid"` and `"generate": "universal"`, Babel ensures that SolidJS components are compiled to work with the custom rendering environment. ```json { "presets": [ [ "@babel/preset-solid", { "moduleName": "@lynx-js/solid", "generate": "universal" } ] ] } ``` -------------------------------- ### Implementing a Custom SolidJS Renderer with Lynx Element PAPI Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/with-solidjs/README.md This code illustrates the core structure of a custom SolidJS renderer designed to interact with Lynx's Element PAPI. It overrides key SolidJS rendering functions like `createElement` and `createTextNode` to use Lynx-specific APIs (`__CreateElement`, `__CreateRawText`), enabling SolidJS to render directly into the Lynx environment. The full implementation can be found in `packages/solid/src/index.ts`. ```TypeScript export const { render: _render, effect, memo, createComponent, createElement, createTextNode, insertNode, insert, spread, setProp, mergeProps, } = createRenderer({ createElement(tag) { return __CreateElement(tag, pageId!); }, createTextNode(value) { return __CreateRawText(value); }, replaceText(textNode, value) { __SetAttribute(textNode, "text", value); __FlushElementTree(textNode); }, ... }); ``` -------------------------------- ### Preview Rsbuild Production Build Locally Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/web-platform/packages/react-container/README.md Serves the production-ready build locally for testing before deployment. This helps verify the built application's functionality and appearance. ```bash pnpm preview ``` -------------------------------- ### Build lynx-project in pnpm workspace Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/web-platform/README.md This command builds the 'lynx-project' package within the pnpm workspace. It compiles the ReactLynx application, preparing it for deployment or further development. ```bash pnpm run build ``` -------------------------------- ### Build Rsbuild Project for Production Source: https://github.com/kwankong-git/lynx-examples/blob/main/examples/web-platform/packages/react-container/README.md Compiles and optimizes the Rsbuild application for production deployment. This command generates the final static assets. ```bash pnpm build ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.