API reference
Every export of @sigx/lynx-plugin — the Rspack / Rspeedy plugin for SignalX Lynx dual-thread rendering.
The package is ESM-only with a single entry point. Everything below is reachable from @sigx/lynx-plugin:
import { pluginSigxLynx, LAYERS, applyEntry } from '@sigx/lynx-plugin';
import type { PluginSigxLynxOptions } from '@sigx/lynx-plugin';
pluginSigxLynx is the default API. LAYERS and applyEntry are low-level escapes for custom build setups.
Functions
pluginSigxLynx
Creates the Rspack / Rspeedy plugin that wires SignalX into Lynx's dual-thread (Background + Main Thread) build pipeline. This is the only export most projects use.
export function pluginSigxLynx(options?: PluginSigxLynxOptions): RsbuildPlugin
Parameters
options— optional. APluginSigxLynxOptionsobject controlling CSS selector / inheritance behavior and debug-info placement. Omit it to use the defaults.
Returns
An RsbuildPlugin — the plugin object you place in your config's plugins array. The returned plugin is named lynx:sigx and declares pre: ['lynx:rsbuild:plugin-api', 'lynx:config', 'lynx:rsbuild:dev'], so it runs after Rspeedy's own config and dev plugins.
Platform: build-time, both iOS and Android. This is not a native module; it produces the dual-thread bundles that the native runtime consumes.
// lynx.config.ts
import { defineConfig } from '@lynx-js/rspeedy';
import { pluginSigxLynx } from '@sigx/lynx-plugin';
export default defineConfig({
plugins: [pluginSigxLynx()],
});
applyEntry
Low-level helper that performs the dual-thread entry splitting directly. For each user entry it creates a <name>__main-thread entry in the main-thread layer and a <name> entry in the background layer, then registers the template-webpack-plugin to stitch them into one .lynx template. pluginSigxLynx calls this for you; reach for it only when building a custom plugin or bypassing the standard pipeline.
export declare function applyEntry(
api: RsbuildPluginAPI,
opts?: ApplyEntryOptions,
): Promise<void>
Parameters
api— theRsbuildPluginAPIhanded to a plugin'ssetupfunction.opts— optional. AnApplyEntryOptionsobject with the same CSS / debug fields asPluginSigxLynxOptions. Note that theApplyEntryOptionstype itself is not re-exported from the package root (see Types below).
Returns
A Promise<void> that resolves once the entries and template plugin are registered.
Platform: build-time, both iOS and Android.
Constants
LAYERS
Webpack module-layer name constants used to separate the dual-thread bundles — background JS versus main-thread Lepus. Use these when writing custom rules that need to target one layer.
export const LAYERS = {
BACKGROUND: 'sigx:background',
MAIN_THREAD: 'sigx:main-thread',
} as const;
Members
LAYERS.BACKGROUND—'sigx:background'. The layer for the background-thread JS bundle.LAYERS.MAIN_THREAD—'sigx:main-thread'. The layer for the main-thread (Lepus) bundle.
Platform: build-time, both iOS and Android.
Types
PluginSigxLynxOptions
Configuration options accepted by pluginSigxLynx. All fields are optional.
export interface PluginSigxLynxOptions {
/** Whether to enable CSS selector support in the Lynx template. @defaultValue true */
enableCSSSelector?: boolean;
/** Whether to enable CSS inheritance in the Lynx engine. @defaultValue false */
enableCSSInheritance?: boolean;
/** A list of additional CSS properties to inherit beyond the engine defaults. Only effective when enableCSSInheritance is true. */
customCSSInheritanceList?: string[];
/** Whether themes and safe-area may ride inline CSS custom properties (requires Lynx ≥ 3.9). @defaultValue true */
enableCSSInlineVariables?: boolean;
/** Whether to place debug info outside the template bundle. @defaultValue true */
debugInfoOutside?: boolean;
}
Fields
enableCSSSelector?: boolean— enable CSS selector support in the Lynx template. Defaulttrue.enableCSSInheritance?: boolean— enable CSS inheritance in the Lynx engine. Defaultfalse.customCSSInheritanceList?: string[]— additional CSS properties to inherit beyond the engine defaults. Only effective whenenableCSSInheritanceistrue.enableCSSInlineVariables?: boolean— let themes (@sigx/lynx-zeroThemeProvider) and safe-area publish inline CSS custom properties for first-frame-perfect runtime theming. Defaulttrue; requires Lynx ≥ 3.9 on native hosts. A kill switch for hosts that can't run 3.9.debugInfoOutside?: boolean— place debug info outside the template bundle. Defaulttrue.
ApplyEntryOptions
Parameter type of applyEntry. It carries the same fields as PluginSigxLynxOptions.
export interface ApplyEntryOptions {
enableCSSSelector?: boolean; // default true
enableCSSInheritance?: boolean; // default false
customCSSInheritanceList?: string[];
debugInfoOutside?: boolean; // default true
}
Note: ApplyEntryOptions is declared in the plugin's internal entry module but is not re-exported through the package root — only the applyEntry function symbol is. Consumers importing from @sigx/lynx-plugin get applyEntry but cannot name ApplyEntryOptions via the public entry. Pass an inline object literal, or use PluginSigxLynxOptions, which has the same shape.
RsbuildPlugin
Return type of pluginSigxLynx. Imported as a type from @rsbuild/core. The returned object has name: 'lynx:sigx' and pre: ['lynx:rsbuild:plugin-api', 'lynx:config', 'lynx:rsbuild:dev'].
