Skip to content

Conversation

@PupilTong
Copy link
Collaborator

@PupilTong PupilTong commented Jul 28, 2025

wasm-bindgen/wasm-bindgen#4211 (comment)

WebAssembly/binaryen#7358

The rust toolchain enables WASM feature reference types by default.

However this feature is not supported by chromium lower than version 96

Therefore we found a workaround for it.

In this implementation we detect if browser supports reference types first.

If user's browser supported it, we load the wasm file with reference types on, otherwise we load the wasm file with reference types off.

relies on #819

Summary by CodeRabbit

  • Bug Fixes
    • Fixed crashes on Chrome versions earlier than 96 by detecting WebAssembly reference type support and loading compatible modules accordingly.
  • New Features
    • Introduced a legacy WebAssembly module to support browsers without reference type support.
  • Chores
    • Enhanced build process with a new script to produce both standard and legacy WebAssembly modules.
    • Added runtime dependency for WebAssembly feature detection.

@changeset-bot
Copy link

changeset-bot bot commented Jul 28, 2025

🦋 Changeset detected

Latest commit: 17b9073

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@lynx-js/web-mainthread-apis Patch
@lynx-js/web-core Patch
@lynx-js/web-core-server Patch
@lynx-js/web-worker-runtime Patch
@lynx-js/web-constants Patch
@lynx-js/web-worker-rpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 28, 2025

📝 Walkthrough

Walkthrough

This change introduces conditional loading of WebAssembly modules in the web-style-transformer package based on browser support for WASM reference types. The build process now produces both "standard" and "legacy" WASM bundles, and runtime logic selects the appropriate one. Supporting scripts and dependencies were updated accordingly.

Changes

Cohort / File(s) Change Summary
Changelog and Patch Documentation
.changeset/tall-experts-take.md
Documents the patch for @lynx-js/web-mainthread-apis and @lynx-js/web-core to fix Chrome <96 WASM crash by conditionally loading WASM with or without reference types, based on browser capability detection.
Runtime WASM Loader and Feature Detection
packages/web-platform/web-style-transformer/index.js
Modifies initWasm to detect WASM reference type support using wasm-feature-detect, and conditionally imports either standard.js (with reference types) or legacy.js (without reference types) at runtime.
Legacy WASM Bundle Entry Point
packages/web-platform/web-style-transformer/legacy.js
Adds a new module re-exporting from ./dist/legacy.js and exporting the WASM memory object from ./dist/legacy_bg.wasm, providing a single import point for legacy environments.
Build Scripts and Dependencies
packages/web-platform/web-style-transformer/package.json
Updates build scripts to generate both "standard" and "legacy" WASM bundles using wasm-pack, adds the wasm-feature-detect dependency, and adjusts output artifact names and cleanup steps.
Standard WASM Bundle Entry Point
packages/web-platform/web-style-transformer/standard.js
Updates export paths to reference ./dist/standard.js and ./dist/standard_bg.wasm instead of the previous index-based paths; functionality unchanged.
Build Automation Script
packages/web-platform/web-style-transformer/scripts/build.js
Introduces a new Node.js build script that runs the wasm-pack build command twice with different environment settings to produce both standard and stripped WASM bundles, and removes .gitignore from the output directory.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • colinaaa
  • Sherry-hue

Poem

A bunny hopped through WASM land,
With bundles split by browser's hand.
If Chrome is old, don’t fret or lag,
The legacy path’s in the bag!
With sniff and switch, the code will run—
Two builds, one hop, and bugs are done.
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6be9cc7 and 17b9073.

📒 Files selected for processing (2)
  • packages/web-platform/web-style-transformer/package.json (1 hunks)
  • packages/web-platform/web-style-transformer/scripts/build.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/web-platform/web-style-transformer/scripts/build.js
  • packages/web-platform/web-style-transformer/package.json
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (6)
packages/web-platform/web-core-server/package.json (2)

14-16: Redundant "module" entry – prefer exports map or drop it

With "type": "module" already set, dist/index.js is unambiguously ESM.
Keeping both

"main": "dist/index.js",
"module": "dist/index.js"

doesn’t add value and occasionally confuses bundlers that treat "module" as “browser-optimised ESM”. Either:

  1. Remove the redundant "module" key, or
  2. Publish dual builds (CJS + ESM) and point "main" to *.cjs, "module" to *.js, plus an explicit "exports" map for forward-compatibility.

25-28: build/watch scripts look good but publishing may miss them

Nice to see dedicated build commands wired to rslib. Two quick checks:

  1. rslib is not declared in this package’s deps; ensure it’s provided by the root workspace so these scripts resolve in all environments (CI, local, npm pack).
  2. If this package is published to npm, add at least one of
"prepare": "npm run build"

or

"prepublishOnly": "npm run build"

so consumers always receive the compiled dist artefacts even when the tarball is built outside the monorepo pipeline.

.changeset/tall-experts-take.md (2)

8-8: Format the GitHub issue reference as a proper Markdown link.

The bare URL should be formatted as a proper Markdown link for better readability and standards compliance.

-https://github.com/wasm-bindgen/wasm-bindgen/issues/4211#issuecomment-2505965903
+[wasm-bindgen issue #4211](https://github.com/wasm-bindgen/wasm-bindgen/issues/4211#issuecomment-2505965903)

10-10: Format the GitHub issue reference as a proper Markdown link.

The bare URL should be formatted as a proper Markdown link for consistency and better readability.

-https://github.com/WebAssembly/binaryen/issues/7358
+[WebAssembly binaryen issue #7358](https://github.com/WebAssembly/binaryen/issues/7358)
packages/web-platform/web-style-transformer/index.js (1)

2-2: Consider making the wasm variable read-only after initialization.

The exported let variable allows external reassignment which could lead to unexpected behavior. Consider using a getter function or making it immutable after initialization.

-export let wasm;
+let _wasm;
+export const getWasm = () => _wasm;

Then update the assignment in initWasm:

-    wasm = await import(
+    _wasm = await import(
packages/web-platform/web-style-transformer/standard.d.ts (1)

1-40: Consider using more specific types for the parsed result array.

The type declarations are well-documented with appropriate safety warnings. However, Array<any> on line 30 could be more specific to improve type safety.

Based on the Rust implementation that pushes style tuples, consider defining a more specific type:

+export type StyleTuple = [string, string];
+export type ParsedStyleResult = [StyleTuple[], StyleTuple[]?];
+
 export function transform_raw_u16_inline_style_ptr_parsed(
   name_ptr: number,
   name_len: number,
   value_ptr: number,
   value_len: number,
-): Array<any> | undefined;
+): ParsedStyleResult | undefined;

This would provide better type safety for consumers of this API.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fcafd54 and 53ffd37.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • .changeset/mighty-readers-clean.md (1 hunks)
  • .changeset/tall-experts-take.md (1 hunks)
  • packages/web-platform/web-core-server/package.json (2 hunks)
  • packages/web-platform/web-core-server/rslib.config.ts (1 hunks)
  • packages/web-platform/web-core-server/src/utils/loadTemplate.ts (1 hunks)
  • packages/web-platform/web-core-server/tsconfig.json (1 hunks)
  • packages/web-platform/web-core-server/turbo.json (1 hunks)
  • packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts (2 hunks)
  • packages/web-platform/web-mainthread-apis/src/utils/tokenizer.ts (1 hunks)
  • packages/web-platform/web-style-transformer/index.d.ts (1 hunks)
  • packages/web-platform/web-style-transformer/index.js (1 hunks)
  • packages/web-platform/web-style-transformer/legacy.js (1 hunks)
  • packages/web-platform/web-style-transformer/package.json (1 hunks)
  • packages/web-platform/web-style-transformer/standard.d.ts (1 hunks)
  • packages/web-platform/web-style-transformer/standard.js (1 hunks)
  • packages/web-platform/web-tests/rspack.config.js (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: PupilTong
PR: lynx-family/lynx-stack#1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T05:57:29.837Z
Learning: In the lynx-stack codebase, PupilTong prefers avoiding regex for parsing in performance-critical code paths like SSR hydration, preferring simple string manipulation operations even if they're less robust, when the input format is predictable and controlled.
packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts (1)

Learnt from: PupilTong
PR: #1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.

.changeset/mighty-readers-clean.md (2)

Learnt from: colinaaa
PR: #1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.

Learnt from: colinaaa
PR: #1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.

packages/web-platform/web-style-transformer/package.json (3)

Learnt from: colinaaa
PR: #1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.

Learnt from: PupilTong
PR: #1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.

Learnt from: colinaaa
PR: #1238
File: packages/react/runtime/src/debug/component-stack.ts:70-90
Timestamp: 2025-07-18T04:27:18.291Z
Learning: The component-stack.ts file in packages/react/runtime/src/debug/component-stack.ts is a direct fork from https://github.com/preactjs/preact/blob/main/debug/src/component-stack.js. The team prefers to keep it aligned with the upstream Preact version and may contribute improvements back to Preact in the future.

.changeset/tall-experts-take.md (3)

Learnt from: colinaaa
PR: #1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.

Learnt from: colinaaa
PR: #1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.

Learnt from: PupilTong
PR: #1292
File: packages/web-platform/web-core-server/src/createLynxView.ts:144-151
Timestamp: 2025-07-15T10:00:56.154Z
Learning: In the lynx-stack codebase, PupilTong prefers the "let it crash" approach over defensive null safety checks when the condition should never occur in normal operation. This applies to cases like the element.getAttribute(lynxUniqueIdAttribute)! call in SSR event capture where the attribute is expected to always be present.

packages/web-platform/web-core-server/package.json (1)

Learnt from: colinaaa
PR: #1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.

🧬 Code Graph Analysis (3)
packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts (1)
packages/web-platform/web-style-transformer/index.js (1)
  • initWasm (3-23)
packages/web-platform/web-core-server/rslib.config.ts (2)
packages/web-platform/web-tests/rspack.config.js (1)
  • config (19-272)
packages/rspeedy/core/src/index.ts (1)
  • defineConfig (33-33)
packages/web-platform/web-style-transformer/standard.d.ts (1)
packages/web-platform/web-style-transformer/src/lib.rs (2)
  • transform_raw_u16_inline_style_ptr (13-31)
  • transform_raw_u16_inline_style_ptr_parsed (55-87)
🪛 markdownlint-cli2 (0.17.2)
.changeset/tall-experts-take.md

8-8: Bare URL used

(MD034, no-bare-urls)


10-10: Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (20)
packages/web-platform/web-tests/rspack.config.js (1)

270-270: Approved: futureDefaults enables required WebAssembly support

The futureDefaults: true flag not only activates native CSS but also enables asyncWebAssembly—the WebAssembly experiment needed to support asynchronous modules and reference types per the updated spec (critical for Chrome <96). No further changes are needed.

  • File: packages/web-platform/web-tests/rspack.config.js
  • Line: 270
packages/web-platform/web-core-server/src/utils/loadTemplate.ts (1)

8-15: Potential race condition in lazy initialization.

The lazy initialization pattern is good for performance, but there's a race condition if multiple concurrent calls to createJsModuleUrl occur before tmpDir is set. The second call could start executing before the first call finishes awaiting tmpDirPromise.

Consider this safer approach:

-let tmpDir: string | undefined;
-const tmpDirPromise = fs.mkdtemp(path.join(os.tmpdir(), 'lynx'));
+let tmpDirPromise: Promise<string> | undefined;

 async function createJsModuleUrl(content: string, filename: string) {
-  if (!tmpDir) {
-    tmpDir = await tmpDirPromise;
-  }
-  const fileUrl = path.join(tmpDir, filename);
+  if (!tmpDirPromise) {
+    tmpDirPromise = fs.mkdtemp(path.join(os.tmpdir(), 'lynx'));
+  }
+  const tmpDir = await tmpDirPromise;
+  const fileUrl = path.join(tmpDir, filename);

Likely an incorrect or invalid review comment.

.changeset/mighty-readers-clean.md (1)

1-6: LGTM! Changeset properly documents the refactoring work.

The changeset appropriately documents the refactoring and bundling improvements to the web-core-server package. This satisfies the CI requirement for changes to src/** files while clearly indicating the internal nature of the changes.

packages/web-platform/web-core-server/tsconfig.json (1)

9-10: LGTM! TypeScript configuration aligns with new build system.

The addition of noEmit: true and isolatedModules: true is appropriate for the new rslib-based build system. These options ensure TypeScript focuses on type checking while rslib handles compilation, and isolatedModules ensures better compatibility with bundlers.

packages/web-platform/web-core-server/rslib.config.ts (1)

4-18: LGTM! Configuration properly supports WASM compatibility objectives.

The rslib configuration is well-structured and directly supports the PR's objective of fixing WASM compatibility:

  • ESM format with TypeScript declarations enables modern module consumption
  • wasmLoading: 'async-node' aligns with the conditional WASM loading strategy to handle browser compatibility
  • Source maps support debugging
packages/web-platform/web-core-server/turbo.json (1)

1-18: LGTM! Turbo configuration follows best practices.

The build task configuration properly integrates the web-core-server package into the monorepo's build orchestration:

  • Correct dependency chain with root and dependency builds
  • Appropriate input/output specifications for caching
  • Standard Turbo configuration structure
packages/web-platform/web-style-transformer/standard.js (1)

1-2: LGTM! Clean proxy module pattern.

The re-export syntax and explicit memory export from the WASM binary follow best practices for WebAssembly module interfaces. This proxy pattern provides a clean abstraction layer for the conditional loading mechanism.

packages/web-platform/web-style-transformer/legacy.js (1)

1-2: LGTM! Consistent proxy module pattern.

The legacy module follows the same clean pattern as the standard module, maintaining consistency in the conditional loading architecture. The re-export and memory export structure is correct.

packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts (2)

34-35: LGTM! Correct integration with new WASM initialization.

The import and initialization logic have been properly updated to use the centralized initWasm function from @lynx-js/web-style-transformer. The naming change from initTokenizer to initWasm better reflects the broader WASM initialization scope.


88-88: LGTM! Proper async initialization sequencing.

The await call correctly ensures WASM initialization completes before proceeding with the main thread setup, maintaining the proper initialization order.

.changeset/tall-experts-take.md (1)

6-20: LGTM! Clear and accurate problem description.

The changeset provides a clear explanation of the Chrome <96 compatibility issue with WebAssembly reference types and the implemented workaround. The technical details accurately describe the conditional loading solution.

packages/web-platform/web-style-transformer/index.js (2)

1-1: LGTM! Appropriate feature detection dependency.

The wasm-feature-detect package is the right choice for detecting WebAssembly reference types support, providing a reliable way to determine browser capabilities.


4-22: LGTM! Excellent conditional loading strategy.

The webpack magic comments are well-chosen - eager loading with high priority for modern browsers that support reference types, and lazy loading for older browsers. This optimization strategy aligns perfectly with the performance characteristics needed for each browser tier.

packages/web-platform/web-mainthread-apis/src/utils/tokenizer.ts (3)

15-26: LGTM! Proper error handling and memory management.

The function correctly handles WASM memory allocation/deallocation with proper cleanup in both success and error cases.


28-67: LGTM! Robust implementation with proper fallback handling.

The function correctly manages memory for both property and value allocations, with appropriate error handling and fallback to original values when transformation fails.


1-1: WASM Initialization Order Verified – No Changes Required

We’ve confirmed that:

  • initWasm() is invoked immediately when prepareMainThreadAPIs.ts is imported:
    import { initWasm } from '@lynx-js/web-style-transformer';
    const initWasmPromise = initWasm();
  • Inside startMainThread, we await initWasmPromise at the very beginning (decode_start) before any user‐provided entry code or DOM‐style transformations run.
  • All calls to transformInlineStyleString/transformParsedStyles occur after await initWasmPromise, ensuring wasm is initialized.

The direct import of wasm in tokenizer.ts is safe under this flow—no runtime errors are introduced by accessing wasm in these utility functions.

packages/web-platform/web-style-transformer/package.json (3)

13-13: LGTM! Package structure updated for conditional WASM loading.

The main entry point and file patterns correctly reflect the new structure where root-level files handle conditional loading of WASM modules.

Also applies to: 18-19


32-34: LGTM! Required dependency for browser feature detection.

The wasm-feature-detect package is essential for the conditional loading mechanism that prevents crashes on Chrome < 96.


26-28: Dual WASM build & imports verified

Index.js correctly feature-detects and conditionally imports ./standard.js and ./legacy.js. Both module wrappers export the built artifacts from dist/standard.js and dist/legacy.js as expected, and the legacy build’s RUSTFLAGS=-Cstrip=symbols optimization is in place. No further changes required.

packages/web-platform/web-style-transformer/index.d.ts (1)

1-3: Conditional WASM loader interface verified for both modules

Both legacy.js and standard.js re-export the same API surface (wildcard exports from their respective dist/*.js files plus the memory export), so deriving WASMModule from import('./standard.js') safely covers both implementations. No changes needed.

@PupilTong PupilTong force-pushed the p/hw/wasm-feature-detect branch from 53ffd37 to 597a4ec Compare July 29, 2025 02:32
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
.changeset/tall-experts-take.md (2)

8-11: Replace bare URLs with Markdown links to satisfy markdownlint MD034

markdownlint flagged the two bare URLs. Wrapping them in Markdown links keeps CI happy and reads better.

-https://github.com/wasm-bindgen/wasm-bindgen/issues/4211#issuecomment-2505965903
+[wasm-bindgen issue #4211 (comment)](https://github.com/wasm-bindgen/wasm-bindgen/issues/4211#issuecomment-2505965903)

-https://github.com/WebAssembly/binaryen/issues/7358
+[binaryen issue #7358](https://github.com/WebAssembly/binaryen/issues/7358)

14-20: Tighten wording & casing for clarity

A few small edits improve readability and consistency:

-However this feature is not supported by chromium lower than version 96
+However, this feature is not supported by Chromium versions earlier than 96.

-Therefore we found a workaround for it.
+Therefore, we implemented a workaround.

-In this implementation we detect if browser supports `reference types` first.
+At runtime, we first detect whether the browser supports `reference types`.

-If user's browser supported it, we load the wasm file with `reference types` on, otherwise we load the wasm file with `reference types` off.
+If the browser supports the feature, we load the WASM module with `reference types` enabled; otherwise, we load a legacy module without it.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 53ffd37 and 597a4ec.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • .changeset/mighty-readers-clean.md (1 hunks)
  • .changeset/tall-experts-take.md (1 hunks)
  • packages/web-platform/web-core-server/package.json (2 hunks)
  • packages/web-platform/web-core-server/rslib.config.ts (1 hunks)
  • packages/web-platform/web-core-server/src/utils/loadTemplate.ts (1 hunks)
  • packages/web-platform/web-core-server/tsconfig.json (1 hunks)
  • packages/web-platform/web-core-server/turbo.json (1 hunks)
  • packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts (2 hunks)
  • packages/web-platform/web-mainthread-apis/src/utils/tokenizer.ts (1 hunks)
  • packages/web-platform/web-style-transformer/index.d.ts (1 hunks)
  • packages/web-platform/web-style-transformer/index.js (1 hunks)
  • packages/web-platform/web-style-transformer/legacy.js (1 hunks)
  • packages/web-platform/web-style-transformer/package.json (1 hunks)
  • packages/web-platform/web-style-transformer/standard.d.ts (1 hunks)
  • packages/web-platform/web-style-transformer/standard.js (1 hunks)
  • packages/web-platform/web-tests/rspack.config.js (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • packages/web-platform/web-core-server/rslib.config.ts
  • packages/web-platform/web-core-server/tsconfig.json
  • packages/web-platform/web-style-transformer/legacy.js
  • packages/web-platform/web-style-transformer/standard.d.ts
🚧 Files skipped from review as they are similar to previous changes (10)
  • .changeset/mighty-readers-clean.md
  • packages/web-platform/web-style-transformer/standard.js
  • packages/web-platform/web-tests/rspack.config.js
  • packages/web-platform/web-core-server/package.json
  • packages/web-platform/web-core-server/src/utils/loadTemplate.ts
  • packages/web-platform/web-core-server/turbo.json
  • packages/web-platform/web-mainthread-apis/src/utils/tokenizer.ts
  • packages/web-platform/web-style-transformer/package.json
  • packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts
  • packages/web-platform/web-style-transformer/index.js
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1238
File: packages/react/runtime/src/debug/component-stack.ts:70-90
Timestamp: 2025-07-18T04:27:18.291Z
Learning: The component-stack.ts file in packages/react/runtime/src/debug/component-stack.ts is a direct fork from https://github.com/preactjs/preact/blob/main/debug/src/component-stack.js. The team prefers to keep it aligned with the upstream Preact version and may contribute improvements back to Preact in the future.
Learnt from: PupilTong
PR: lynx-family/lynx-stack#1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T05:57:29.837Z
Learning: In the lynx-stack codebase, PupilTong prefers avoiding regex for parsing in performance-critical code paths like SSR hydration, preferring simple string manipulation operations even if they're less robust, when the input format is predictable and controlled.
.changeset/tall-experts-take.md (3)

Learnt from: colinaaa
PR: #1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.

Learnt from: colinaaa
PR: #1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.

Learnt from: PupilTong
PR: #1292
File: packages/web-platform/web-core-server/src/createLynxView.ts:144-151
Timestamp: 2025-07-15T10:00:56.154Z
Learning: In the lynx-stack codebase, PupilTong prefers the "let it crash" approach over defensive null safety checks when the condition should never occur in normal operation. This applies to cases like the element.getAttribute(lynxUniqueIdAttribute)! call in SSR event capture where the attribute is expected to always be present.

🧬 Code Graph Analysis (1)
packages/web-platform/web-style-transformer/index.d.ts (1)
packages/web-platform/web-style-transformer/index.js (3)
  • wasm (2-2)
  • wasm (2-2)
  • initWasm (3-23)
🪛 markdownlint-cli2 (0.17.2)
.changeset/tall-experts-take.md

8-8: Bare URL used

(MD034, no-bare-urls)


10-10: Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (3)
packages/web-platform/web-style-transformer/index.d.ts (3)

2-2: LGTM!

The variable declaration correctly uses let to allow conditional assignment and is properly typed with the WASMModule interface.


3-3: LGTM!

The function declaration correctly represents the async initialization function with appropriate return type Promise<void>.


1-1: Ensure legacy.js exports match the standard module’s API

The WASMModule type is derived from standard.js, but at runtime you may load legacy.js instead. Please confirm that the legacy build re-exports the same public API surface:

• memory
• transform_raw_u16_inline_style_ptr
• transform_raw_u16_inline_style_ptr_parsed
• malloc
• free

If any of these are missing or differ in signature, consider adjusting the declarations or introducing a shared interface.

wasm-bindgen/wasm-bindgen#4211 (comment)

WebAssembly/binaryen#7358

The rust toolchain enables WASM feature `reference types` by default.

However this feature is not supported by chromium lower than version 96

Therefore we found a workaround for it.

In this implementation we detect if browser supports `reference types` first.

If user's browser supported it, we load the wasm file with `reference types` on, otherwise we load the wasm file with `reference types` off.
@PupilTong PupilTong force-pushed the p/hw/wasm-feature-detect branch from 597a4ec to 9ffef20 Compare July 29, 2025 03:35
@PupilTong PupilTong requested a review from Sherry-hue July 29, 2025 03:36
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.changeset/tall-experts-take.md (1)

6-10: Polish summary line & wrap bare URLs

  1. Use a descriptive sentence instead of a “commit style” prefix for the first line—this becomes the changelog entry:
-fix: crash on chrome<96
+Prevent crash on Chrome < 96 by loading a legacy WASM build when reference-types are unsupported
  1. Wrap raw links in angle brackets to satisfy markdownlint and keep release notes tidy:
-https://github.com/wasm-bindgen/wasm-bindgen/issues/4211#issuecomment-2505965903
-
-https://github.com/WebAssembly/binaryen/issues/7358
+<https://github.com/wasm-bindgen/wasm-bindgen/issues/4211#issuecomment-2505965903>
+
+<https://github.com/WebAssembly/binaryen/issues/7358>
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 597a4ec and 9ffef20.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • .changeset/tall-experts-take.md (1 hunks)
  • packages/web-platform/web-style-transformer/index.js (1 hunks)
  • packages/web-platform/web-style-transformer/legacy.js (1 hunks)
  • packages/web-platform/web-style-transformer/package.json (1 hunks)
  • packages/web-platform/web-style-transformer/standard.js (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/web-platform/web-style-transformer/legacy.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/web-platform/web-style-transformer/index.js
  • packages/web-platform/web-style-transformer/standard.js
  • packages/web-platform/web-style-transformer/package.json
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: PupilTong
PR: lynx-family/lynx-stack#1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T05:57:29.837Z
Learning: In the lynx-stack codebase, PupilTong prefers avoiding regex for parsing in performance-critical code paths like SSR hydration, preferring simple string manipulation operations even if they're less robust, when the input format is predictable and controlled.
.changeset/tall-experts-take.md (3)

Learnt from: colinaaa
PR: #1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.

Learnt from: colinaaa
PR: #1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.

Learnt from: PupilTong
PR: #1292
File: packages/web-platform/web-core-server/src/createLynxView.ts:144-151
Timestamp: 2025-07-15T10:00:56.154Z
Learning: In the lynx-stack codebase, PupilTong prefers the "let it crash" approach over defensive null safety checks when the condition should never occur in normal operation. This applies to cases like the element.getAttribute(lynxUniqueIdAttribute)! call in SSR event capture where the attribute is expected to always be present.

🪛 markdownlint-cli2 (0.17.2)
.changeset/tall-experts-take.md

8-8: Bare URL used

(MD034, no-bare-urls)


10-10: Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (1)
.changeset/tall-experts-take.md (1)

1-4: Verify affected package list in front-matter

web-style-transformer appears to be the module that now ships the dual WASM bundles, yet it’s missing from the changeset header. Please double-check that every user-facing package touched by this PR is listed here; otherwise the release version bump will be skipped for that package.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9ffef20 and 6be9cc7.

📒 Files selected for processing (2)
  • packages/web-platform/web-style-transformer/package.json (1 hunks)
  • packages/web-platform/web-style-transformer/scripts/build.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/web-platform/web-style-transformer/package.json
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: PupilTong
PR: lynx-family/lynx-stack#1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T05:57:29.837Z
Learning: In the lynx-stack codebase, PupilTong prefers avoiding regex for parsing in performance-critical code paths like SSR hydration, preferring simple string manipulation operations even if they're less robust, when the input format is predictable and controlled.
🔇 Additional comments (1)
packages/web-platform/web-style-transformer/scripts/build.js (1)

1-7: LGTM - Clean ES module setup

The imports and directory setup are properly configured for an ES module build script.

@PupilTong PupilTong force-pushed the p/hw/wasm-feature-detect branch from 6be9cc7 to 17b9073 Compare July 29, 2025 04:09
@codspeed-hq
Copy link

codspeed-hq bot commented Jul 29, 2025

CodSpeed Performance Report

Merging #1361 will not alter performance

Comparing PupilTong:p/hw/wasm-feature-detect (17b9073) with main (a2c8e11)

Summary

✅ 10 untouched benchmarks

@relativeci
Copy link

relativeci bot commented Jul 29, 2025

React Example

#3413 Bundle Size — 235.18KiB (0%).

17b9073(current) vs a2c8e11 main#3408(baseline)

Bundle metrics  no changes
                 Current
#3413
     Baseline
#3408
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 156 156
No change  Duplicate Modules 63 63
No change  Duplicate Code 45.94% 45.94%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#3413
     Baseline
#3408
No change  IMG 145.76KiB 145.76KiB
No change  Other 89.42KiB 89.42KiB

Bundle analysis reportBranch PupilTong:p/hw/wasm-feature-dete...Project dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link

relativeci bot commented Jul 29, 2025

Web Explorer

#3403 Bundle Size — 352.53KiB (+14.91%).

17b9073(current) vs a2c8e11 main#3398(baseline)

Warning

Bundle introduced one new package: wasm-feature-detect – View changed packages

Bundle metrics  Change 7 changes Regression 2 regressions
                 Current
#3403
     Baseline
#3398
Regression  Initial JS 142.12KiB(+0.02%) 142.09KiB
No change  Initial CSS 31.83KiB 31.83KiB
Change  Cache Invalidation 86.38% 86.25%
Change  Chunks 7(+16.67%) 6
Change  Assets 7(+16.67%) 6
Change  Modules 215(+2.87%) 209
No change  Duplicate Modules 17 17
Change  Duplicate Code 3.94%(-6.86%) 4.23%
Regression  Packages 4(+33.33%) 3
No change  Duplicate Packages 0 0
Bundle size by type  Change 2 changes Regression 2 regressions
                 Current
#3403
     Baseline
#3398
Regression  JS 226.4KiB (+1.03%) 224.09KiB
Regression  Other 94.29KiB (+85.35%) 50.87KiB
No change  CSS 31.83KiB 31.83KiB

Bundle analysis reportBranch PupilTong:p/hw/wasm-feature-dete...Project dashboard


Generated by RelativeCIDocumentationReport issue

@PupilTong PupilTong added this pull request to the merge queue Jul 29, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 29, 2025
@PupilTong PupilTong added this pull request to the merge queue Jul 29, 2025
Merged via the queue into lynx-family:main with commit 143e481 Jul 29, 2025
49 of 50 checks passed
@PupilTong PupilTong deleted the p/hw/wasm-feature-detect branch July 29, 2025 07:01
colinaaa pushed a commit that referenced this pull request Aug 1, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @lynx-js/[email protected]

### Minor Changes

- Add support for Lynx UI plugin system with configurable options.
([#1363](#1363))

- Introduced `lynxUIPlugins` option in `createLynxPreset`, allowing
userland opt-in to Lynx UI specific plugins.

- Implemented `uiVariants` plugin as the first UI plugin, supporting
`ui-*` variant prefixes (e.g. `ui-checked`, `ui-open`) with customizable
mappings.

## @lynx-js/[email protected]

### Patch Changes

- Fix crash caused by not removing event listeners during destroy.
([#1379](#1379))

- Fix missing "type" in "update-list-info" in hydrate
([#1392](#1392))

## @lynx-js/[email protected]

### Patch Changes

- Bump Rsbuild v1.4.12 with Rspack v1.4.11.
([#1326](#1326))

## @lynx-js/[email protected]

### Patch Changes

- Updated dependencies
\[[`e9edca0`](e9edca0),
[`6f37db2`](6f37db2)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- feat: support `__ElementFromBinary`
([#1391](#1391))

-   Updated dependencies \[]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- feat: support `__ElementFromBinary`
([#1391](#1391))

- fix: crash on chrome&lt;96
([#1361](#1361))


<wasm-bindgen/wasm-bindgen#4211 (comment)>

    <WebAssembly/binaryen#7358>

The rust toolchain enables WASM feature `reference types` by default.

However this feature is not supported by chromium lower than version 96

    Therefore we found a workaround for it.

In this implementation we detect if browser supports `reference types`
first.

If user's browser supported it, we load the wasm file with `reference
types` on, otherwise we load the wasm file with `reference types` off.

- Updated dependencies
\[[`22ca433`](22ca433),
[`8645d12`](8645d12),
[`143e481`](143e481)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- refactor: bundle web-core-server
([#819](#819))

## @lynx-js/[email protected]

### Patch Changes

- feat: support color style for x-textarea
([#1382](#1382))

-   Updated dependencies \[]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- feat: support `__ElementFromBinary`
([#1391](#1391))

- fix: crash on chrome&lt;96
([#1361](#1361))


<wasm-bindgen/wasm-bindgen#4211 (comment)>

    <WebAssembly/binaryen#7358>

The rust toolchain enables WASM feature `reference types` by default.

However this feature is not supported by chromium lower than version 96

    Therefore we found a workaround for it.

In this implementation we detect if browser supports `reference types`
first.

If user's browser supported it, we load the wasm file with `reference
types` on, otherwise we load the wasm file with `reference types` off.

- Updated dependencies
\[[`22ca433`](22ca433)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- optimize IO for all-on-ui: make startMainThreadWorker async and defer
import ([#1385](#1385))

- Updated dependencies
\[[`22ca433`](22ca433),
[`143e481`](143e481)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- Support Rspack v1.4.9.
([#1351](#1351))

## @lynx-js/[email protected]

### Patch Changes

- feat: support elementTemplate for web
([#1374](#1374))

## [email protected]



## @lynx-js/[email protected]



## [email protected]



## @lynx-js/[email protected]



## @lynx-js/[email protected]



## @lynx-js/[email protected]

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants