Skip to content

ReactLynx: Guide for library authors #184

@Huxpro

Description

@Huxpro

ReactLynx introduce new paradigms that library authors must consider when developing and distributing packages:

1. Source visibility for static compilation

ReactLynx performs static analysis over JSX to fold the static portions of the JSX trees into an internal representation called Snapshot. Some libraries that define only "element-less components" (e.g. <Router> in React Router, and in fact the whole package since there are no <Link> for Lynx) do not expose any foldable structure. There can still be safely prebuilt into transformed _jsx calls.

However, most components libraries that render to built-in elements requires source-level visibility to be preserved in order to be properly pre-compiled.

This conceptually imposed the same challenges like React Compiler’s impact on library build and deliver strategies.

2. Threading-aware directives and bundling

ReactLynx operates across the Main Thread and the Background threads. Libraries therefore are required to include threading directives in the code; And/or to be imported with specialized "import meta"; And the prebuilt artifacts are required to be bundled and configured with thread-specific entrypoints for independent distribution.

This is similar to how React Server Components has introduced new compatibility requirements, along with new bundling-level practices e.g. preventing environment poisoning


We need to document these expectation clearly under the https://lynxjs.org/react, presumably under the "Architecting" sections.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions