Skip to content

Conversation

@upupming
Copy link
Collaborator

@upupming upupming commented Oct 28, 2025

Summary by CodeRabbit

  • Breaking Changes

    • Snapshot initialization now occurs at construction time; integrations relying on prior eager initialization may need updates.
  • New Features

    • Added a public registry for lazy snapshot creators to enable on-demand snapshot instantiation.
    • DEV tooling registers snapshot creators to reduce initial patch size and improve initial render performance.
  • Tests / Chores

    • Test snapshots updated to remove a redundant namespace prefix from emitted identifiers.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@upupming upupming requested review from gaoachao and hzy as code owners October 28, 2025 02:53
@changeset-bot
Copy link

changeset-bot bot commented Oct 28, 2025

🦋 Changeset detected

Latest commit: a0ca8ef

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

This PR includes changesets to release 3 packages
Name Type
@lynx-js/react Minor
@lynx-js/react-alias-rsbuild-plugin Major
@lynx-js/react-rsbuild-plugin Major

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 Oct 28, 2025

📝 Walkthrough

Walkthrough

Adds a public snapshotCreatorMap and moves snapshot instantiation from eager inline calls to lazy, registry-driven creators; runtime Snapshot/BackgroundSnapshot consult the map for on-demand creation; transform outputs register creators into that map; tests and patch formats updated to the new shape.

Changes

Cohort / File(s) Summary
Runtime core
\packages/react/runtime/src/snapshot.ts`, `packages/react/runtime/src/internal.ts`, `packages/react/runtime/src/backgroundSnapshot.ts``
Add and export snapshotCreatorMap; SnapshotInstance/BackgroundSnapshotInstance lazily resolve/create snapshot definitions from the map (throw if missing); remove entryUniqID usage.
Lifecycle / Patch
\packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts`, `packages/react/runtime/src/lifecycle/patch/snapshotPatch.ts``
DEV_ONLY_AddSnapshot parameter shape changed to ['uniqID','snapshotCreator']; producers now register creators into snapshotCreatorMap instead of calling createSnapshot inline; update serialization/params.
Transforms / Generated output
\packages/react/transform/crates/swc_plugin_snapshot/lib.rs`, `packages/react/transform/crates/swc_plugin_list/...`, `packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/`, `packages/react/transform/test/css/snapshots/*``, ...
Compiler/plugin now emits string snapshot id constants and registers factory thunks into snapshotCreatorMap (e.g., const __snapshot_x = "__snapshot_x"; ReactLynx.snapshotCreatorMap[__snapshot_x]=()=>createSnapshot(...)), converting many inline createSnapshot calls to registry-based lazy creators.
Internal exports / lazy runtime
\packages/react/runtime/src/internal.ts`, `packages/react/runtime/lazy/internal.js``
Re-export and surface snapshotCreatorMap so generated bundles and lazy runtimes can register creators at runtime.
Tests & expectations
\packages/react/runtime/test/`, `packages/react/testing-library/src/tests/`, `packages/webpack/**/test/hotCases/`, `packages/react/transform/test/``, ...
Update many inline snapshot expectations and tests: remove __Card__: prefixes, adapt to wrapper-based creator shape, import/use snapshotCreatorMap in tests, and replace direct createSnapshot usages with registrations.
Test harness / small fixes
\packages/react/runtime/test/css/scoped-lazy-bundle.test.jsx`, `packages/react/runtime/test/css/remove-scoped-lazy-bundle.test.jsx`, `packages/react/runtime/test/element.test.jsx`, `packages/webpack/react-webpack-plugin/test/cases/.../index.jsx`, `.changeset/full-brooms-care.md`, `packages/react/runtime/test/snapshotPatch.test.jsx``
Use beforeEach/afterEach for global setup, adjust BackgroundSnapshotInstance constructor args (null), add imports/exports for SnapshotInstance and snapshotCreatorMap, update tests to register creators and to expect the new DEV_ONLY_AddSnapshot shape; changeset documents breaking change.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas to pay extra attention:
    • packages/react/transform/crates/swc_plugin_snapshot/lib.rs — emitted wrapper argument ordering, dynamic entry-name formation, and insertion order of generated defs.
    • packages/react/runtime/src/snapshot.ts & backgroundSnapshot.ts — lazy-creation semantics, missing-creator error paths, and concurrent instantiation/race concerns.
    • packages/react/runtime/src/lifecycle/patch/snapshotPatch.ts & snapshotPatchApply.ts — ensure DEV_ONLY_AddSnapshot shape matches producers/consumers and tests.
    • Representative generated snapshots/tests — confirm registration vs lookup and that final arguments align between transform output and runtime.

Possibly related issues

Possibly related PRs

Suggested reviewers

  • hzy
  • colinaaa
  • gaoachao

Poem

🐰 I hid my snapshots in a tidy map,

Keys wait quiet till someone asks their name.
I hop to build the scene on gentle tap,
No eager snaps, just lazy, nimble game.
Hooray — creators stored, and life’s the same! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: delay the createSnapshot operation' clearly describes the main change: implementing delayed snapshot creation for improved IFR performance.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/lazy-snapshot-create

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Oct 28, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
3518 1 3517 387
View the top 2 failed test(s) by shortest run time
swc_plugin_snapshot::tests::should_create_raw_text_node_for_text_node
Stack Traces | 0.105s run time
thread 'tests::should_create_raw_text_node_for_text_node' panicked at .../home/runner/.cargo.../registry/src/index.crates.io-1949cf8c6b5b557f/testing-15.0.0/src/output.rs:186:13:
assertion failed: `(left == right)`: Actual:
import * as ReactLynx from "@lynx-js/react";
const __snapshot_da39a_test_2 = "__snapshot_da39a_test_2";
ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_2] = (__snapshot_da39a_test_2)=>ReactLynx.createSnapshot(__snapshot_da39a_test_2, function() {
        const pageId = ReactLynx.__pageId;
        const el = __CreateText(pageId);
        return [
            el
        ];
    }, null, ReactLynx.__DynamicPartChildren_0, undefined, globDynamicComponentEntry, null);
const __snapshot_da39a_test_1 = "__snapshot_da39a_test_1";
ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (__snapshot_da39a_test_1)=>ReactLynx.createSnapshot(__snapshot_da39a_test_1, function() {
        const pageId = ReactLynx.__pageId;
        const el = __CreateView(pageId);
        const el1 = __CreateText(pageId);
        __AppendElement(el, el1);
        const el2 = __CreateWrapperElement(pageId);
        __AppendElement(el1, el2);
        const el3 = __CreateRawText(", ReactLynx 1");
        __AppendElement(el1, el3);
        const el4 = __CreateWrapperElement(pageId);
        __AppendElement(el, el4);
        const el5 = __CreateText(pageId);
        __AppendElement(el, el5);
        const el6 = __CreateRawText("Hello");
        __AppendElement(el5, el6);
        const el7 = __CreateText(pageId);
        __SetAttribute(el7, "text", "ReactLynx 2");
        __AppendElement(el5, el7);
        const el8 = __CreateElement("x-text", pageId);
        __AppendElement(el, el8);
        const el9 = __CreateRawText("Hello, ReactLynx 3");
        __AppendElement(el8, el9);
        return [
            el,
            el1,
            el2,
            el3,
            el4,
            el5,
            el6,
            el7,
            el8,
            el9
        ];
    }, null, [
        [
            ReactLynx.__DynamicPartSlot,
            2
        ],
        [
            ReactLynx.__DynamicPartSlot,
            4
        ]
    ], undefined, globDynamicComponentEntry, null);
<__snapshot_da39a_test_1><wrapper>{hello}</wrapper><__snapshot_da39a_test_2>{hello}</__snapshot_da39a_test_2></__snapshot_da39a_test_1>;


Diff < left / right > :
 import * as ReactLynx from "@lynx-js/react";
<const __snapshot_da39a_test_2 = ReactLynx.createSnapshot("__snapshot_da39a_test_2", function() {
<    const pageId = ReactLynx.__pageId;
<    const el = __CreateText(pageId);
<    return [
<        el
<    ];
<}, null, ReactLynx.__DynamicPartChildren_0, undefined, globDynamicComponentEntry, null);
<const __snapshot_da39a_test_1 = ReactLynx.createSnapshot("__snapshot_da39a_test_1", function() {
<    const pageId = ReactLynx.__pageId;
<    const el = __CreateView(pageId);
<    const el1 = __CreateText(pageId);
<    __AppendElement(el, el1);
<    const el2 = __CreateWrapperElement(pageId);
<    __AppendElement(el1, el2);
<    const el3 = __CreateRawText(", ReactLynx 1");
<    __AppendElement(el1, el3);
<    const el4 = __CreateWrapperElement(pageId);
<    __AppendElement(el, el4);
<    const el5 = __CreateText(pageId);
<    __AppendElement(el, el5);
<    const el6 = __CreateRawText("Hello");
<    __AppendElement(el5, el6);
<    const el7 = __CreateText(pageId);
<    __SetAttribute(el7, "text", "ReactLynx 2");
<    __AppendElement(el5, el7);
<    const el8 = __CreateElement("x-text", pageId);
<    __AppendElement(el, el8);
<    const el9 = __CreateRawText("Hello, ReactLynx 3");
<    __AppendElement(el8, el9);
<    return [
<        el,
<        el1,
<        el2,
<        el3,
<        el4,
<        el5,
<        el6,
<        el7,
<        el8,
<        el9
<    ];
<}, null, [
<    [
<        ReactLynx.__DynamicPartSlot,
<        2
<    ],
<    [
<        ReactLynx.__DynamicPartSlot,
<        4
<    ]
<], undefined, globDynamicComponentEntry, null);
>const __snapshot_da39a_test_2 = "__snapshot_da39a_test_2";
>ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_2] = (__snapshot_da39a_test_2)=>ReactLynx.createSnapshot(__snapshot_da39a_test_2, function() {
>        const pageId = ReactLynx.__pageId;
>        const el = __CreateText(pageId);
>        return [
>            el
>        ];
>    }, null, ReactLynx.__DynamicPartChildren_0, undefined, globDynamicComponentEntry, null);
>const __snapshot_da39a_test_1 = "__snapshot_da39a_test_1";
>ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (__snapshot_da39a_test_1)=>ReactLynx.createSnapshot(__snapshot_da39a_test_1, function() {
>        const pageId = ReactLynx.__pageId;
>        const el = __CreateView(pageId);
>        const el1 = __CreateText(pageId);
>        __AppendElement(el, el1);
>        const el2 = __CreateWrapperElement(pageId);
>        __AppendElement(el1, el2);
>        const el3 = __CreateRawText(", ReactLynx 1");
>        __AppendElement(el1, el3);
>        const el4 = __CreateWrapperElement(pageId);
>        __AppendElement(el, el4);
>        const el5 = __CreateText(pageId);
>        __AppendElement(el, el5);
>        const el6 = __CreateRawText("Hello");
>        __AppendElement(el5, el6);
>        const el7 = __CreateText(pageId);
>        __SetAttribute(el7, "text", "ReactLynx 2");
>        __AppendElement(el5, el7);
>        const el8 = __CreateElement("x-text", pageId);
>        __AppendElement(el, el8);
>        const el9 = __CreateRawText("Hello, ReactLynx 3");
>        __AppendElement(el8, el9);
>        return [
>            el,
>            el1,
>            el2,
>            el3,
>            el4,
>            el5,
>            el6,
>            el7,
>            el8,
>            el9
>        ];
>    }, null, [
>        [
>            ReactLynx.__DynamicPartSlot,
>            2
>        ],
>        [
>            ReactLynx.__DynamicPartSlot,
>            4
>        ]
>    ], undefined, globDynamicComponentEntry, null);
 <__snapshot_da39a_test_1><wrapper>{hello}</wrapper><__snapshot_da39a_test_2>{hello}</__snapshot_da39a_test_2></__snapshot_da39a_test_1>;
 


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
web-elements.spec.ts::web-elements test suite › x-foldview-ng › x-foldview-ng/basic-toolbar-in-lynx-wrapper
Stack Traces | 14s run time
web-elements.spec.ts:850:5 x-foldview-ng/basic-toolbar-in-lynx-wrapper

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/react/transform/crates/swc_plugin_snapshot/lib.rs (1)

1435-1442: Outdated comment about CSS ID skip

Comment mentions “skip when cssId === undefined && entryName === undefined”, but entryName is always emitted as globDynamicComponentEntry here. Please update the comment to avoid confusion.

packages/react/runtime/src/snapshot.ts (1)

203-247: Normalize slot to an empty array to tolerate older/new emitters.

Transformer currently emits null in some tests. Runtime assumes array semantics (length, indexing). Normalize here defensively.

 export function createSnapshot(
   uniqID: string,
   create: Snapshot['create'] | null,
   update: Snapshot['update'] | null,
   slot: Snapshot['slot'],
   cssId: number | undefined,
   entryName: string | undefined,
   refAndSpreadIndexes: number[] | null,
   entryUniqID: string | undefined,
 ): string {
   entryUniqID ??= calcEntryUniqID(uniqID, entryName);
+  // Defensive: some legacy emitters may pass `null`
+  // Ensure downstream code can safely call `.length`/index.
+  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+  // @ts-ignore
+  slot = (slot ?? []) as Snapshot['slot'];
 
   if (
     __DEV__ && __JS__
@@
   const s: Snapshot = { create, update, slot, cssId, entryName, refAndSpreadIndexes };
   snapshotManager.values.set(entryUniqID, s);
@@
   return entryUniqID;
 }
🧹 Nitpick comments (9)
.changeset/full-brooms-care.md (1)

2-5: Consider MINOR bump and add API notes.

You’re adding a new public API (snapshotCreatorMap via internal) and extending createSnapshot’s signature (optional). That’s more than a patch. Suggest minor and expand the notes for consumers.

Apply:

 ---
-"@lynx-js/react": patch
+"@lynx-js/react": minor
 ---
 
-Delay the `createSnapshot` operation to speed up IFR
+Delay the `createSnapshot` operation to speed up IFR.
+
+- New: `snapshotCreatorMap` (exposed via `@lynx-js/react/internal`) for lazy per-snapshot factory registration.
+- Update: `createSnapshot` accepts an optional `entryUniqID` (backward‑compatible).
+- Behavior: Snapshots are created on first use; no migration expected for app code. Transform plugin emits registrations automatically.
packages/react/transform/crates/swc_plugin_snapshot/lib.rs (2)

1464-1466: I need to verify there are no reads of this field. Let me search for usage patterns:

Let me search the codebase more specifically for any reads or usages of this field:

Let me search more precisely in the codebase for any reads of this field:

Based on the initial ripgrep output showing only 3 matches for current_snapshot_id (at lines 1018, 1050, and 1464), which are all writes (declaration, initialization, and assignment), and no other references appearing in the context output, the review comment's assertion is correct. The field is declared, initialized, and assigned at line 1464, but there are no reads of this field anywhere in the codebase.

The review comment is valid—self.current_snapshot_id = Some(snapshot_id.clone()); can be safely removed as an optional refactoring since the field is never read after being assigned. Removing this assignment would eliminate unnecessary state management and a redundant clone operation.

Remove unused current_snapshot_id state

The assignment self.current_snapshot_id = Some(snapshot_id.clone()); at line 1464 sets a field that is never read. Remove this assignment to simplify the code and eliminate the unnecessary clone.


1447-1458: Add comment tying the two mechanisms together to prevent future drift.

The review correctly identifies that entry key logic is duplicated across the transform and runtime. The transform precomputes entry_snapshot_uid (combining globDynamicComponentEntry and snapshot_uid for dynamic components), then passes both globDynamicComponentEntry as entryName and the precomputed key as entryUniqID to the runtime's createSnapshot(). The runtime then has calcEntryUniqID() logic that could recompute this from entryName.

Since both entryName and the composed key are being passed, add a clarifying comment at lines 1447-1450 documenting the relationship to calcEntryUniqID() to prevent these two implementations from drifting apart during future maintenance.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js (1)

3-3: Guard against duplicate registrations (HMR/re-evaluation).

Optional: avoid clobbering an existing entry to be safer under HMR.

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = ()=>ReactLynx.createSnapshot(/*…*/, __snapshot_da39a_test_1);
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] ||= () => ReactLynx.createSnapshot(/*…*/, __snapshot_da39a_test_1);
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (1)

4-66: Optional: avoid overwriting existing entries (HMR-safe).

Same recommendation as elsewhere—use ||= to prevent re-registering factories during HMR/module re-evals.

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = ()=>ReactLynx.createSnapshot("__snapshot_da39a_test_1", /*…*/, __snapshot_da39a_test_1);
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] ||= () => ReactLynx.createSnapshot("__snapshot_da39a_test_1", /*…*/, __snapshot_da39a_test_1);
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js (1)

2-10: Creators are correct; tiny micro-optimizations optional in style updaters.

  • All creators pass the key as the last parameter; good.
  • Optional: in the generated updater functions, early-return when !ctx.__elements to avoid nesting.

Also applies to: 12-25, 29-42, 51-63

packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)

2-38: All snapshot creators are correctly wired with keys as final arguments; optional refactoring suggested.

Verification confirms:

  • All 7 snapshot creator registrations (__snapshot_da39a_test_1 through __snapshot_da39a_test_7) pass their snapshot keys as the final argument to createSnapshot().
  • Optional refactoring opportunity: hoisting the repeated require('@lynx-js/react/internal') calls into a single binding would reduce generated code repetition and improve maintainability.
packages/react/runtime/src/snapshot.ts (2)

138-139: Harden snapshotCreatorMap against prototype collisions.

Use a dictionary with null-prototype to avoid edge-key collisions while keeping bracket assignment compatible with emitted code.

-export const snapshotCreatorMap: Record<string, () => string> = {};
+export const snapshotCreatorMap: Record<string, () => string> =
+  Object.create(null) as Record<string, () => string>;

202-211: API surface changed — document and add a changeset.

createSnapshot adds entryUniqID, and calcEntryUniqID is new. Please update docs and include a changeset marking the signature change (even if internal).

I can draft the changeset and a short doc blurb for snapshotCreatorMap, calcEntryUniqID, and the new createSnapshot param. Want me to open a follow-up?

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4296178 and 1e1c79f.

📒 Files selected for processing (44)
  • .changeset/full-brooms-care.md (1 hunks)
  • packages/react/runtime/src/backgroundSnapshot.ts (1 hunks)
  • packages/react/runtime/src/internal.ts (1 hunks)
  • packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts (3 hunks)
  • packages/react/runtime/src/snapshot.ts (5 hunks)
  • packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (2 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/lib.rs (2 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx_dev.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract_it.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_map_jsx.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/mode_development_spread.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_escape_newline_character.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_inject_implicit_flatten.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/full-brooms-care.md
🧠 Learnings (6)
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
PR: lynx-family/lynx-stack#1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_escape_newline_character.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/lib.rs
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_map_jsx.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/mode_development_spread.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_inject_implicit_flatten.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract_it.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
PR: lynx-family/lynx-stack#1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_escape_newline_character.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_map_jsx.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/mode_development_spread.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_inject_implicit_flatten.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract_it.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_map_jsx.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/mode_development_spread.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js
  • packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract_it.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_map_jsx.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js
🧬 Code graph analysis (40)
packages/react/runtime/src/backgroundSnapshot.ts (1)
packages/react/runtime/src/snapshot.ts (2)
  • snapshotManager (58-123)
  • snapshotCreatorMap (138-138)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_escape_newline_character.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js (2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts (1)
packages/react/runtime/src/snapshot.ts (2)
  • calcEntryUniqID (198-200)
  • snapshotManager (58-123)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (16)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
  • __snapshot_da39a_test_2 (15-15)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (1)
  • __snapshot_da39a_test_2 (14-14)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js (1)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (3)
  • __snapshot_da39a_test_2 (14-14)
  • __snapshot_da39a_test_3 (31-31)
  • __snapshot_da39a_test_4 (52-52)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js (3)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js (2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/mode_development_spread.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js (1)
  • __snapshot_da39a_test_1 (3-3)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (16)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
  • __snapshot_da39a_test_2 (15-15)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_inject_implicit_flatten.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (2)
  • __snapshot_da39a_test_2 (15-15)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (2)
  • __snapshot_da39a_test_2 (12-12)
  • __snapshot_da39a_test_1 (33-33)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (1)
  • __snapshot_da39a_test_2 (14-14)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js (4)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx_dev.js (2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (6)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
  • el3 (10-10)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (3)
  • __snapshot_da39a_test_2 (15-15)
  • __snapshot_da39a_test_3 (23-23)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (3)
  • __snapshot_da39a_test_2 (12-12)
  • __snapshot_da39a_test_3 (2-2)
  • __snapshot_da39a_test_1 (33-33)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js (3)
  • __snapshot_da39a_test_2 (12-12)
  • __snapshot_da39a_test_3 (29-29)
  • __snapshot_da39a_test_4 (50-50)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal.js (1)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (4)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js (6)
  • __snapshot_da39a_test_1 (3-3)
  • pageId (5-5)
  • el (6-6)
  • el1 (7-7)
  • el2 (9-9)
  • el3 (11-11)
packages/react/runtime/src/snapshot.ts (2)
packages/react/runtime/src/internal.ts (2)
  • snapshotCreatorMap (21-21)
  • snapshotManager (21-21)
packages/react/runtime/src/lifecycle/patch/snapshotPatch.ts (1)
  • __globalSnapshotPatch (53-53)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (4)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (10)
  • __snapshot_da39a_test_3 (23-23)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
  • __snapshot_da39a_test_2 (15-15)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js (3)
  • __snapshot_da39a_test_3 (13-13)
  • __snapshot_da39a_test_2 (2-2)
  • __snapshot_da39a_test_1 (24-24)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (2)
  • __snapshot_da39a_test_3 (31-31)
  • __snapshot_da39a_test_2 (14-14)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (2)
  • el (5-5)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js (1)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (16)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
  • __snapshot_da39a_test_2 (15-15)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (1)
  • __snapshot_da39a_test_2 (14-14)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js (4)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract_it.js (2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract.js (2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js (1)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js (4)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx_dev.js (1)
  • __snapshot_da39a_test_1 (3-3)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (3)
  • __snapshot_da39a_test_2 (15-15)
  • __snapshot_da39a_test_3 (23-23)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (3)
  • __snapshot_da39a_test_2 (12-12)
  • __snapshot_da39a_test_3 (2-2)
  • __snapshot_da39a_test_1 (33-33)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (2)
  • __snapshot_da39a_test_2 (14-14)
  • __snapshot_da39a_test_3 (31-31)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js (1)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_3 (23-23)
🪛 GitHub Actions: Test
packages/react/runtime/src/backgroundSnapshot.ts

[error] 28-37: dprint: Found 2 not formatted files.

packages/react/runtime/src/internal.ts

[error] 18-29: dprint: Found 2 not formatted files.

Copy link
Collaborator

@hzy hzy left a comment

Choose a reason for hiding this comment

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

Pls fix the "4 failing checks"

@upupming upupming force-pushed the feat/lazy-snapshot-create branch from 2ec11ac to 7952387 Compare October 28, 2025 05:23
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

♻️ Duplicate comments (2)
packages/react/runtime/src/snapshot.ts (1)

286-289: Guard missing creators to avoid TypeError; throw clear error.

Calling snapshotCreatorMap[type]!() will crash when unregistered. Guard and fail gracefully.

Apply this diff:

   constructor(public type: string, id?: number) {
-    if (!snapshotManager.values.has(type)) {
-      snapshotCreatorMap[type]!();
-    }
-    this.__snapshot_def = snapshotManager.values.get(type)!;
-    // Suspense uses 'div'
-    if (!this.__snapshot_def && type !== 'div') {
-      throw new Error('Snapshot not found: ' + type);
-    }
+    if (!snapshotManager.values.has(type)) {
+      const creator = snapshotCreatorMap[type];
+      if (creator) {
+        creator();
+      }
+    }
+    this.__snapshot_def = snapshotManager.values.get(type)!;
+    // Suspense uses 'div'
+    if (!this.__snapshot_def && type !== 'div') {
+      throw new Error(`Snapshot not found or not registered: ${type}`);
+    }
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js (1)

27-34: Slot must not be null (runtime expects an array).

Runtime uses slot.length and indexing; null will crash. Emit [] instead.

Apply:

-    ], null, undefined, globDynamicComponentEntry, [
+    ], [], undefined, globDynamicComponentEntry, [

Based on learnings.

🧹 Nitpick comments (9)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (1)

33-55: Verify slot indices remain stable if structure changes.

DynamicPartSlot targets indices 1 and 2, consistent with return [el, el1, el2]. If wrappers are reordered later, remember to update these indices.

Consider named constants for slot positions to avoid off-by-one drift in future refactors.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js (1)

14-27: Small resilience tweak (optional).

If multiple values are expected later, consider early-return when ctx.__values is missing/empty to avoid silent no-ops.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract_it.js (1)

2-15: Avoid cross-test leakage from global registry.

Since ReactLynx.snapshotCreatorMap is global, ensure tests reset it between cases to prevent stale entries from previous specs.

You can add a beforeEach/afterEach in the test harness to clear only the keys created in a spec.

packages/react/runtime/src/snapshot.ts (1)

138-139: Harden the registry against prototype pollution.

Use a null‑prototype object to avoid __proto__ collisions and accidental inherited props.

Apply this diff:

-export const snapshotCreatorMap: Record<string, () => string> = {};
+export const snapshotCreatorMap = Object.create(null) as Record<string, () => string>;
packages/react/transform/crates/swc_plugin_snapshot/lib.rs (1)

1416-1443: Registration logic looks good; small robustness nit on undefined.

Use void 0 instead of an undefined identifier to avoid rare shadowing.

Apply:

-        css_id: Expr = match &self.css_id_value {
-          Some(css_id_expr) => css_id_expr.clone(),
-          // We use `undefined` here since runtime will skip `__SetCSSId` when `cssId === undefined && entryName === undefined`
-          None => Expr::Ident("undefined".into()),
-        },
+        css_id: Expr = match &self.css_id_value {
+          Some(css_id_expr) => css_id_expr.clone(),
+          // Use `void 0` to avoid potential shadowing of `undefined`
+          None => quote!("void 0" as Expr),
+        },
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js (1)

25-34: Optional: avoid mixed ESM+CJS in generated snapshots.

If snapshots are ever executed (not just string-compared), prefer a consistent module style (all ESM or all CJS) to reduce runtime friction. Here, consider importing the internal API via ESM for consistency with the _jsx import.

packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)

3-14: Cut repeated require()s; ensure factories run at most once.

  • Cache require('@lynx-js/react/internal') locally to avoid repeated lookups.
  • Confirm snapshotCreatorMap entries are replaced/cached after first invocation to prevent duplicate createSnapshot calls if accessed multiple times.

Example refactor:

- require('@lynx-js/react/internal').snapshotCreatorMap[__snapshot_da39a_test_1] = ()=>require('@lynx-js/react/internal').createSnapshot(
+ const ReactInternal = require('@lynx-js/react/internal');
+ ReactInternal.snapshotCreatorMap[__snapshot_da39a_test_1] = () => ReactInternal.createSnapshot(

Optional: if not already in runtime, wrap factories with a once() so the first call memoizes the created snapshot.

Also applies to: 16-38, 50-61, 63-69, 77-88

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js (1)

3-9: Minor: cache internal module locally for readability.

Reduce repetition and improve readability by caching require('@lynx-js/react/internal') to a local const before use.

- require('@lynx-js/react/internal').snapshotCreatorMap[__snapshot_da39a_test_1] = ()=>require('@lynx-js/react/internal').createSnapshot(
+ const ReactInternal = require('@lynx-js/react/internal');
+ ReactInternal.snapshotCreatorMap[__snapshot_da39a_test_1] = () => ReactInternal.createSnapshot(
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)

3-9: Ensure public export mirrors internal registry instance.

This registers via ReactLynx.snapshotCreatorMap; other files use internal.snapshotCreatorMap. Please confirm both resolve to the same underlying object to avoid split registries.

If not identical, standardize registration to one module.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e1c79f and 7952387.

📒 Files selected for processing (44)
  • .changeset/full-brooms-care.md (1 hunks)
  • packages/react/runtime/src/backgroundSnapshot.ts (1 hunks)
  • packages/react/runtime/src/internal.ts (1 hunks)
  • packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts (2 hunks)
  • packages/react/runtime/src/snapshot.ts (3 hunks)
  • packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (2 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/lib.rs (3 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx_dev.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract_it.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_map_jsx.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/mode_development_spread.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_escape_newline_character.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_inject_implicit_flatten.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (14)
  • packages/react/runtime/src/backgroundSnapshot.ts
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/basic_component_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/should_extract_css_id_without_css_id.js
  • packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/should_escape_newline_character.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/basic_full_static_snapshot_extract.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/basic_full_static.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/basic_component_with_static_sibling_jsx.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/full_static_children_map_jsx.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/basic_event.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/basic_component_with_static_sibling_jsx_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/full_static_children_comments.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/inline_style_literal.js
  • .changeset/full-brooms-care.md
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
PR: lynx-family/lynx-stack#1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_inject_implicit_flatten.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js
  • packages/react/transform/crates/swc_plugin_snapshot/lib.rs
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract_it.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/mode_development_spread.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js
  • packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
PR: lynx-family/lynx-stack#1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_inject_implicit_flatten.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract_it.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/mode_development_spread.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js
  • packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract_it.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js
  • packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js
🧬 Code graph analysis (26)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_inject_implicit_flatten.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_2 (15-15)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (1)
  • __snapshot_da39a_test_2 (12-12)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (4)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (9)
  • __snapshot_da39a_test_3 (23-23)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js (2)
  • __snapshot_da39a_test_3 (13-13)
  • __snapshot_da39a_test_1 (24-24)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js (2)
  • __snapshot_da39a_test_3 (2-2)
  • __snapshot_da39a_test_1 (39-39)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (2)
  • el (5-5)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js (2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (2)
  • __snapshot_da39a_test_2 (14-14)
  • __snapshot_da39a_test_3 (31-31)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js (1)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (3)
  • __snapshot_da39a_test_2 (14-14)
  • __snapshot_da39a_test_3 (31-31)
  • __snapshot_da39a_test_4 (52-52)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (3)
  • __snapshot_da39a_test_2 (15-15)
  • __snapshot_da39a_test_3 (23-23)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (3)
  • __snapshot_da39a_test_2 (12-12)
  • __snapshot_da39a_test_3 (2-2)
  • __snapshot_da39a_test_1 (33-33)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (4)
  • __snapshot_da39a_test_3 (23-23)
  • __snapshot_da39a_test_4 (31-31)
  • __snapshot_da39a_test_2 (15-15)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (4)
  • __snapshot_da39a_test_3 (2-2)
  • __snapshot_da39a_test_4 (25-25)
  • __snapshot_da39a_test_2 (12-12)
  • __snapshot_da39a_test_1 (33-33)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (4)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract_it.js (2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js (1)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (4)
  • __snapshot_da39a_test_1 (2-2)
  • __snapshot_da39a_test_2 (15-15)
  • __snapshot_da39a_test_3 (23-23)
  • __snapshot_da39a_test_4 (31-31)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (3)
  • __snapshot_da39a_test_2 (14-14)
  • __snapshot_da39a_test_3 (31-31)
  • __snapshot_da39a_test_4 (52-52)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/mode_development_spread.js (1)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (16)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
  • __snapshot_da39a_test_2 (15-15)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (1)
  • __snapshot_da39a_test_2 (14-14)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (1)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js (3)
  • __snapshot_da39a_test_2 (12-12)
  • __snapshot_da39a_test_3 (29-29)
  • __snapshot_da39a_test_4 (50-50)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js (2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js (1)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (4)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (2)
  • __snapshot_da39a_test_1 (33-33)
  • __snapshot_da39a_test_2 (12-12)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (1)
  • __snapshot_da39a_test_2 (14-14)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js (3)
  • __snapshot_da39a_test_1 (3-3)
  • pageId (5-5)
  • el (6-6)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js (1)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: build / Build (Windows)
🔇 Additional comments (34)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js (3)

2-12: Registry wiring looks correct.

Key → factory mapping matches the new lazy pattern; arguments to createSnapshot preserve the original semantics.


24-36: List children dynamic-part indexing matches JSX usage.

Using ReactLynx.__DynamicPartListChildren at index 0 aligns with the array passed as children to <__snapshot_da39a_test_1>. Good.


2-36: Ensure snapshotCreatorMap is initialized before assignment.

If ReactLynx.snapshotCreatorMap isn’t pre-initialized, property writes will throw. Please confirm runtime exports it as an object by module eval time.

Run to verify:

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (2)

2-11: LGTM: factory registration with updates callback is consistent.

The updates array preserves platform info via ReactLynx.updateListItemPlatformInfo; params order looks right.


12-24: Dynamic list children wiring is correct.

Using ReactLynx.snapshotCreateList(snapshotInstance) with DynamicPartListChildren at index 0 matches downstream JSX.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js (2)

2-10: LGTM: inline-style extraction preserved.

createSnapshot factory mirrors original semantics; css string applies before return.


12-20: Consistent lazy registration across snapshots.

Both keys are registered; usage remains <_snapshot…/>. No issues spotted.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js (1)

4-12: CSS ID correctly propagated (100).

All factories pass 100 to createSnapshot per @jsxCSSId. The style update functions are guarded and safe.

Also applies to: 14-27, 31-44, 53-66

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (3)

4-12: Dynamic key composition matches runtime expectations.

Using ${globDynamicComponentEntry}:<id> as the registry key and passing globDynamicComponentEntry into createSnapshot keeps type resolution consistent.


4-66: Note on PURE comments (FYI).

PURE comment handling for createSnapshot is a separate path from wrapWithLynxComponent; this lazy pattern no longer needs PURE on the call site since execution is deferred. Based on learnings.


15-27: Guard against undefined globDynamicComponentEntry at load time.

If this module loads before globDynamicComponentEntry is set, the keys may be malformed (e.g., ":__snapshot…") and diverge from lookup keys.

Add a quick check in the test harness, or ensure transform guarantees declaration ordering.

Also applies to: 32-44, 53-66

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js (1)

2-17: LGTM: registration-based snapshot wiring is correct.

Creator is registered before first render; matches lazy init via runtime. No issues.

packages/react/runtime/src/internal.ts (1)

17-17: Public export of snapshotCreatorMap: confirm API and docs.

Export looks fine. Please update internal API docs and migration notes to mention the new registry and expected usage.

Would you like me to draft the doc blurb for CONTRIBUTING/README?

Also applies to: 21-28

packages/react/runtime/src/snapshot.ts (1)

212-213: LGTM: DEV patch gating on uniqID presence.

This matches the “uniqID as content hash” model and avoids redundant DEV patches.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js (1)

2-18: LGTM: static snapshot now registered lazily.

Registration and usage are consistent; no functional differences expected.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js (1)

2-54: LGTM: registry wiring for dynamic-key variants is correct.

Creators, slots, and render shape look consistent.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js (1)

3-10: LGTM: snapshot registered via factory; JSX now resolves through registry.

Args preserved; lazy creation achieved.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js (1)

2-10: LGTM: registry-based wiring keeps inline-style behavior intact.

No functional change beyond deferred creation.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js (1)

2-11: LGTM: dynamic-component keys and default cssId(0) handled correctly.

Keys incorporate globDynamicComponentEntry; dynamic parts/slots unchanged; creation deferred.

If helpful, confirm globDynamicComponentEntry is guaranteed at module init in all runtimes using this transform.

Also applies to: 12-26, 29-43, 50-64

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/mode_development_spread.js (1)

1-12: LGTM: dev-mode path uses internal runtime and preserves spread updater.

Factory defers work; parameters unchanged.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_inject_implicit_flatten.js (1)

2-10: LGTM: implicit-flatten case preserved with lazy snapshot registration.

Dynamic parts, slots, and child wrappers retained.

Also applies to: 11-58

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js (1)

2-18: LGTM: full-static self-closing snapshot registered correctly.

Creation moved behind a factory; structure unchanged.

packages/react/transform/crates/swc_plugin_snapshot/lib.rs (2)

1463-1464: Emission order: defs before usage.

Pushing entry_snapshot_uid_def before snapshot_def ensures the key exists prior to JSX usage.


1445-1456: Dynamic key templating for components: OK.

${globDynamicComponentEntry}:${uid} composition matches emitted tests and keeps keys unique per entry.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js (2)

3-20: Lazy registration pattern looks correct; confirm createSnapshot trailing args and globals.

Registration precedes usage and keeps original builder logic intact. Please confirm:

  • The final argument [0] matches the current createSnapshot(...) signature/semantics for this case.
  • globDynamicComponentEntry is defined in the test harness scope.

21-30: Verify updateSpread contract with new values payload shape.

values now passes a single object with __spread: true, preserving key order "before", ...obj, "after". Confirm ReactLynx.updateSpread(...) decodes this shape and order correctly under the lazy snapshot flow.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js (1)

2-24: Worklet wiring and indices look right; double‑check internal API exposure.

updateWorkletEvent(..., 1, ...) and updateWorkletRef(..., 3, ...) align with the returned node array. Please confirm snapshotCreatorMap is intentionally exposed on @lynx-js/react/internal for this path and kept in sync with the public export used elsewhere.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js (1)

2-9: LGTM; confirm children dynamic part mapping remains stable.

Registration defers creation as intended. Please verify ReactLynx.__DynamicPartChildren_0 still maps the wrapper’s children correctly with the lazy registry.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js (1)

2-9: Registration looks good; PURE handling is not required here.

Deferring the call inside a factory makes prior PURE annotations for direct createSnapshot unnecessary in this path, which aligns with how PURE handling is separated for snapshot creation.

Based on learnings

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js (1)

2-9: Multi‑snapshot wiring reads correct; validate list/slot index contracts.

  • __DynamicPartListChildren, 0 for the list snapshot and slot indices [1]/[2] for the wrapper match the builder return shapes.
  • Please confirm these indices and helpers remain unchanged with the lazy registry to avoid off‑by‑one regressions in list and slot updates.

Also applies to: 10-17, 18-30, 31-38, 39-61

packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)

39-48: Verify test harness identifiers exist.

This uses noop and globDynamicComponentEntry. Ensure both are in scope in the test harness to avoid ReferenceError at runtime.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js (1)

3-23: Confirm registry identity: ReactLynx.snapshotCreatorMap vs internal.snapshotCreatorMap.

Some files register via ReactLynx (public), others via require('@lynx-js/react/internal'). Mixing is safe only if both references point to the same object instance.

Run to check for mixed usage and ensure aliasing is intentional:

If they are different objects, standardize on internal or re-export the same instance from the public entry.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js (1)

3-10: Verify missing final snapshot ID parameter in all snapshot definitions.

All four snapshot creator registrations appear to be missing the snapshot ID as the final parameter to createSnapshot, based on the AI-generated summary. Each createSnapshot call ends with null instead of the respective snapshot ID constant.

Expected pattern for each:

  • Line 10: }, null, null, undefined, globDynamicComponentEntry, null, __snapshot_da39a_test_1);
  • Line 25: }, null, undefined, globDynamicComponentEntry, null, __snapshot_da39a_test_2);
  • Line 42: }, null, undefined, globDynamicComponentEntry, null, __snapshot_da39a_test_3);
  • Line 63: }, null, undefined, globDynamicComponentEntry, null, __snapshot_da39a_test_4);

Actual pattern (all end with null instead):

  • Lines 10, 25, 42, 63: All end with globDynamicComponentEntry, null);

This affects all snapshot definitions uniformly. Please verify whether the transform logic is correctly emitting the final snapshot ID parameter, or if the test expectations need updating.

Also applies to: 13-25, 30-42, 51-63

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js (1)

3-21: The review comment is incorrect and should be dismissed.

The createSnapshot function signature accepts 7 parameters: uniqID, create, update, slot, cssId, entryName, and refAndSpreadIndexes. The generated code in basic_timing_flag.js correctly passes all 7 arguments and does not require a duplicate snapshot ID as a final parameter. This pattern is consistent across all snapshot test files in the codebase.

Likely an incorrect or invalid review comment.

@upupming upupming force-pushed the feat/lazy-snapshot-create branch from 7952387 to 62038ad Compare October 28, 2025 09:09
PupilTong
PupilTong previously approved these changes Oct 28, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 28, 2025

CodSpeed Performance Report

Merging #1899 will degrade performances by 6.55%

Comparing feat/lazy-snapshot-create (a0ca8ef) with main (04f2c39)

Summary

⚡ 1 improvement
❌ 1 regression
✅ 60 untouched
⏩ 3 skipped1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
basic-performance-div-100 5.9 ms 6.3 ms -6.55%
basic-performance-nest-level-100 6.7 ms 5.8 ms +14.97%

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@relativeci
Copy link

relativeci bot commented Oct 28, 2025

React Example

#6111 Bundle Size — 237.8KiB (+0.15%).

a0ca8ef(current) vs 04f2c39 main#6104(baseline)

Bundle metrics  Change 2 changes
                 Current
#6111
     Baseline
#6104
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
Change  Cache Invalidation 38.62% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 165 165
No change  Duplicate Modules 67 67
Change  Duplicate Code 46.79%(+0.04%) 46.77%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  Change 1 change Regression 1 regression
                 Current
#6111
     Baseline
#6104
No change  IMG 145.76KiB 145.76KiB
Regression  Other 92.04KiB (+0.38%) 91.69KiB

Bundle analysis reportBranch feat/lazy-snapshot-createProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link

relativeci bot commented Oct 28, 2025

Web Explorer

#6107 Bundle Size — 366.7KiB (0%).

a0ca8ef(current) vs 04f2c39 main#6100(baseline)

Bundle metrics  Change 1 change
                 Current
#6107
     Baseline
#6100
No change  Initial JS 146.2KiB 146.2KiB
No change  Initial CSS 32.22KiB 32.22KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 220(-0.45%) 221
No change  Duplicate Modules 16 16
No change  Duplicate Code 3.21% 3.21%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#6107
     Baseline
#6100
No change  JS 240.68KiB 240.68KiB
No change  Other 93.8KiB 93.8KiB
No change  CSS 32.22KiB 32.22KiB

Bundle analysis reportBranch feat/lazy-snapshot-createProject dashboard


Generated by RelativeCIDocumentationReport issue

@upupming upupming force-pushed the feat/lazy-snapshot-create branch from 909a542 to 212cc5c Compare October 28, 2025 14:33
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

♻️ Duplicate comments (3)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js (1)

2-18: Consistent registry-based snapshot registration.

Looks good; same DCE/registry export considerations as noted in transform-imports-css-scoped-modules.js.

packages/react/runtime/src/snapshot.ts (1)

287-294: Verify that creator actually registers the snapshot.

After invoking snapshotCreatorMap[type](), there's no guarantee the creator successfully registered the snapshot in snapshotManager.values. The subsequent get(type)! on line 294 could still return undefined, leading to runtime errors later when accessing this.__snapshot_def.

Consider adding verification after the creator call:

   if (!snapshotManager.values.has(type) && type !== 'div') {
     if (snapshotCreatorMap[type]) {
       snapshotCreatorMap[type]();
+      // Verify creator actually registered the snapshot
+      if (!snapshotManager.values.has(type)) {
+        throw new Error(`Snapshot creator for '${type}' did not register the snapshot`);
+      }
     } else {
       throw new Error('Snapshot not found: ' + type);
     }
   }
   this.__snapshot_def = snapshotManager.values.get(type)!;
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js (1)

31-31: Verify that the null slot argument was actually fixed.

A previous critical review flagged this null slot argument, stating that the runtime expects an array and will crash on slot.length. That comment was marked as addressed in commit 2ec11ac, but the test snapshot still shows null here.

Please verify whether:

  1. The fix was reverted or the snapshot needs regeneration, or
  2. The runtime was updated to handle null slots safely

Run this script to check how the runtime handles null slots:

#!/bin/bash
# Description: Check runtime handling of null slot arguments

# Search for slot.length or slot indexing in the runtime
rg -n -A3 -B3 --type ts 'slot\.length|slot\[' packages/react/runtime/src/

# Search for createSnapshot implementation to see parameter handling
ast-grep --pattern 'function createSnapshot($$$) {
  $$$
}'
🧹 Nitpick comments (2)
packages/react/runtime/__test__/css/scoped-lazy-bundle.test.jsx (1)

12-19: Good setup/teardown for global mutation.

Restoring globDynamicComponentEntry avoids cross-test leakage.

You can simplify with Vitest globals:

-import { expect, it, beforeEach, afterEach } from 'vitest';
+import { expect, it, beforeEach, afterEach, vi } from 'vitest';

-let prevEntryName;
-beforeEach(() => {
-  prevEntryName = globalThis.globDynamicComponentEntry;
-  globalThis.globDynamicComponentEntry = 'FOO';
-});
-afterEach(() => {
-  globalThis.globDynamicComponentEntry = prevEntryName;
-});
+beforeEach(() => {
+  vi.stubGlobal('globDynamicComponentEntry', 'FOO');
+});
+afterEach(() => {
+  vi.unstubAllGlobals();
+});
packages/react/transform/__test__/css/__snapshots__/transform-imports-css-scoped-modules.js (1)

7-18: Code migration is correct; runtime contract verified.

The snapshotCreatorMap is correctly exported as a plain object (Record<string, () => string>), so bracket assignment works as intended. No .set() method calls are used, confirming the pattern is consistent throughout the codebase.

Consider the optional refactor to improve tree-shaking behavior:

-ReactLynx.snapshotCreatorMap[__snapshot_2d408_test_1] = ()=>ReactLynx.createSnapshot(/*...*/);
+/*#__PURE__*/ ReactLynx.registerSnapshot(__snapshot_2d408_test_1, () => ReactLynx.createSnapshot(/*...*/));

This helper function would reduce side-effect footprint for bundler optimization.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62038ad and 212cc5c.

⛔ Files ignored due to path filters (1)
  • packages/web-platform/web-tests/tests/__snapshots__/server.vitest.spec.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (94)
  • .changeset/full-brooms-care.md (1 hunks)
  • packages/react/runtime/__test__/basic.test.jsx (1 hunks)
  • packages/react/runtime/__test__/css/remove-scoped-lazy-bundle.test.jsx (1 hunks)
  • packages/react/runtime/__test__/css/scoped-lazy-bundle.test.jsx (1 hunks)
  • packages/react/runtime/__test__/debug/jsx-twice.test.jsx (1 hunks)
  • packages/react/runtime/__test__/debug/printSnapshot.test.jsx (1 hunks)
  • packages/react/runtime/__test__/delayed-lifecycle-events.test.jsx (2 hunks)
  • packages/react/runtime/__test__/element.test.jsx (1 hunks)
  • packages/react/runtime/__test__/hydrate.test.jsx (4 hunks)
  • packages/react/runtime/__test__/lifecycle.test.jsx (3 hunks)
  • packages/react/runtime/__test__/lifecycle/reload.test.jsx (15 hunks)
  • packages/react/runtime/__test__/list.test.jsx (61 hunks)
  • packages/react/runtime/__test__/lynx/suspense.test.jsx (2 hunks)
  • packages/react/runtime/__test__/lynx/timing.test.jsx (4 hunks)
  • packages/react/runtime/__test__/preact.test.jsx (12 hunks)
  • packages/react/runtime/__test__/renderToOpcodes.test.jsx (13 hunks)
  • packages/react/runtime/__test__/snapshot/event.test.jsx (4 hunks)
  • packages/react/runtime/__test__/snapshot/ref.test.jsx (10 hunks)
  • packages/react/runtime/__test__/snapshot/workletEvent.test.jsx (4 hunks)
  • packages/react/runtime/__test__/snapshot/workletRef.test.jsx (1 hunks)
  • packages/react/runtime/__test__/snapshotPatch.test.jsx (15 hunks)
  • packages/react/runtime/__test__/ssr.test.jsx (10 hunks)
  • packages/react/runtime/lazy/internal.js (1 hunks)
  • packages/react/runtime/src/backgroundSnapshot.ts (1 hunks)
  • packages/react/runtime/src/internal.ts (1 hunks)
  • packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts (2 hunks)
  • packages/react/runtime/src/snapshot.ts (3 hunks)
  • packages/react/testing-library/src/__tests__/act.test.jsx (4 hunks)
  • packages/react/testing-library/src/__tests__/alog.test.jsx (2 hunks)
  • packages/react/testing-library/src/__tests__/end-to-end.test.jsx (4 hunks)
  • packages/react/testing-library/src/__tests__/lazy-bundle/index.test.jsx (2 hunks)
  • packages/react/testing-library/src/__tests__/list.test.jsx (15 hunks)
  • packages/react/testing-library/src/__tests__/lynx.test.jsx (1 hunks)
  • packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-all.js (1 hunks)
  • packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-modules.js (1 hunks)
  • packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-none.js (1 hunks)
  • packages/react/transform/__test__/css/__snapshots__/transform-imports-css-scoped-all.js (1 hunks)
  • packages/react/transform/__test__/css/__snapshots__/transform-imports-css-scoped-modules.js (1 hunks)
  • packages/react/transform/__test__/css/__snapshots__/transform-imports-css-scoped-none.js (1 hunks)
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-all-lazy-bundle.js (1 hunks)
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-all.js (1 hunks)
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-modules-lazy-bundle.js (1 hunks)
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-modules.js (1 hunks)
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-none-lazy-bundle.js (1 hunks)
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-none.js (1 hunks)
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-defaults.js (1 hunks)
  • packages/react/transform/__test__/fixture.spec.js (6 hunks)
  • packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (2 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/lib.rs (3 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx_dev.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract_it.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_map_jsx.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/mode_development_spread.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_escape_newline_character.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_inject_implicit_flatten.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js (1 hunks)
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js (1 hunks)
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/hook/useContext/__snapshot__/rspack/1.snap.txt (2 hunks)
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/hook/useState/__snapshot__/rspack/1.snap.txt (2 hunks)
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/basic/__snapshot__/rspack/1.snap.txt (2 hunks)
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/basic/__snapshot__/rspack/2.snap.txt (2 hunks)
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/recovery/__snapshot__/rspack/2.snap.txt (2 hunks)
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/value/__snapshot__/rspack/1.snap.txt (2 hunks)
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/value/__snapshot__/rspack/2.snap.txt (2 hunks)
  • packages/webpack/react-webpack-plugin/test/cases/code-splitting/amd-runtime-lazy-bundle-production/index.jsx (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/react/runtime/test/element.test.jsx
  • packages/react/runtime/test/list.test.jsx
🚧 Files skipped from review as they are similar to previous changes (33)
  • packages/react/runtime/test/delayed-lifecycle-events.test.jsx
  • packages/react/testing-library/src/tests/alog.test.jsx
  • packages/react/testing-library/src/tests/list.test.jsx
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/hook/useContext/snapshot/rspack/1.snap.txt
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/should_escape_newline_character.js
  • packages/react/transform/test/css/snapshots/transform-jsx-css-scoped-all.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/basic_list_toplevel.js
  • packages/react/testing-library/src/tests/end-to-end.test.jsx
  • packages/react/runtime/test/debug/printSnapshot.test.jsx
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/basic_full_static_snapshot_extract_it.js
  • packages/react/transform/test/fixture.spec.js
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/basic/snapshot/rspack/1.snap.txt
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/basic_full_static_snapshot_extract.js
  • packages/react/runtime/test/hydrate.test.jsx
  • packages/react/transform/test/css/snapshots/transform-jsx-css-scoped-all-lazy-bundle.js
  • packages/react/runtime/test/lynx/timing.test.jsx
  • packages/react/runtime/test/lifecycle/reload.test.jsx
  • packages/react/runtime/test/basic.test.jsx
  • packages/react/runtime/test/css/remove-scoped-lazy-bundle.test.jsx
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/should_inject_implicit_flatten.js
  • packages/react/transform/test/css/snapshots/transform-imports-css-scoped-none.js
  • packages/react/runtime/test/snapshotPatch.test.jsx
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/full_static_children_map_jsx.js
  • packages/react/runtime/test/snapshot/workletEvent.test.jsx
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/basic_full_static.js
  • packages/webpack/react-webpack-plugin/test/cases/code-splitting/amd-runtime-lazy-bundle-production/index.jsx
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/mode_development_spread.js
  • packages/react/transform/test/css/snapshots/transform-imports-css-scoped-all.js
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/recovery/snapshot/rspack/2.snap.txt
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/basic/snapshot/rspack/2.snap.txt
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/basic_expr_container_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/swc_snapshots/lib.rs/basic_component_with_static_sibling_jsx.js
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/full-brooms-care.md
🧠 Learnings (6)
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
PR: lynx-family/lynx-stack#1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-none.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/hook/useState/__snapshot__/rspack/1.snap.txt
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-defaults.js
  • packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-all.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js
  • packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-modules.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js
  • packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-none.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-modules.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-none-lazy-bundle.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-modules-lazy-bundle.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/value/__snapshot__/rspack/2.snap.txt
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js
  • packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/value/__snapshot__/rspack/1.snap.txt
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.

Applied to files:

  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-none.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/hook/useState/__snapshot__/rspack/1.snap.txt
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-defaults.js
  • packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-all.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js
  • packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-modules.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js
  • packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-none.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-modules.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-none-lazy-bundle.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js
  • packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-modules-lazy-bundle.js
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/value/__snapshot__/rspack/2.snap.txt
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js
  • packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/value/__snapshot__/rspack/1.snap.txt
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
PR: lynx-family/lynx-stack#1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/lib.rs
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx_dev.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js
  • packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/hook/useState/__snapshot__/rspack/1.snap.txt
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/value/__snapshot__/rspack/2.snap.txt
  • packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/value/__snapshot__/rspack/1.snap.txt
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js
  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js
🧬 Code graph analysis (39)
packages/react/runtime/src/backgroundSnapshot.ts (1)
packages/react/runtime/src/snapshot.ts (2)
  • snapshotManager (58-123)
  • snapshotCreatorMap (138-138)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-none.js (3)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-all-lazy-bundle.js (1)
  • __snapshot_2d408_test_1 (3-3)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-all.js (1)
  • __snapshot_2d408_test_1 (3-3)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-modules.js (1)
  • __snapshot_2d408_test_1 (3-3)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js (6)
  • __snapshot_da39a_test_1 (3-3)
  • pageId (5-5)
  • el (6-6)
  • el1 (7-7)
  • el2 (9-9)
  • el3 (11-11)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js (1)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_timing_flag.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_self_close.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-all.js (3)
packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-modules.js (1)
  • __snapshot_2d408_test_1 (5-5)
packages/react/transform/__test__/css/__snapshots__/transform-imports-css-scoped-all.js (1)
  • __snapshot_2d408_test_1 (7-7)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-all.js (1)
  • __snapshot_2d408_test_1 (3-3)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_expr_container_with_static_sibling.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts (1)
packages/react/runtime/src/snapshot.ts (1)
  • snapshotManager (58-123)
packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-modules.js (2)
packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-all.js (3)
  • __snapshot_2d408_test_1 (5-5)
  • pageId (7-7)
  • el (8-8)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-modules.js (1)
  • __snapshot_2d408_test_1 (3-3)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-none.js (3)
packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-all.js (3)
  • __snapshot_2d408_test_1 (5-5)
  • pageId (7-7)
  • el (8-8)
packages/react/transform/__test__/css/__snapshots__/transform-imports-css-scoped-all.js (3)
  • __snapshot_2d408_test_1 (7-7)
  • pageId (9-9)
  • el (10-10)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-all.js (9)
  • __snapshot_2d408_test_1 (3-3)
  • pageId (5-5)
  • pageId (14-14)
  • pageId (26-26)
  • pageId (39-39)
  • el (6-6)
  • el (15-15)
  • el (27-27)
  • el (40-40)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (1)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component_without_css_id.js (3)
  • __snapshot_da39a_test_2 (12-12)
  • __snapshot_da39a_test_3 (29-29)
  • __snapshot_da39a_test_4 (50-50)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/runtime/src/snapshot.ts (1)
packages/react/runtime/src/internal.ts (2)
  • snapshotCreatorMap (27-27)
  • snapshotManager (26-26)
packages/react/transform/__test__/css/__snapshots__/transform-imports-css-scoped-modules.js (1)
packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-all.js (3)
  • __snapshot_2d408_test_1 (5-5)
  • pageId (7-7)
  • el (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element_dev.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-modules.js (4)
packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-all.js (3)
  • __snapshot_2d408_test_1 (5-5)
  • pageId (7-7)
  • el (8-8)
packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-modules.js (3)
  • __snapshot_2d408_test_1 (5-5)
  • pageId (7-7)
  • el (8-8)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-all-lazy-bundle.js (11)
  • __snapshot_2d408_test_1 (3-3)
  • pageId (5-5)
  • pageId (14-14)
  • pageId (26-26)
  • pageId (39-39)
  • el (6-6)
  • el (15-15)
  • el (27-27)
  • el (40-40)
  • __snapshot_2d408_test_2 (12-12)
  • el1 (16-16)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-none.js (3)
  • __snapshot_2d408_test_1 (3-3)
  • __snapshot_2d408_test_2 (12-12)
  • el1 (16-16)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js (1)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (8)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-none-lazy-bundle.js (1)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-all-lazy-bundle.js (13)
  • __snapshot_2d408_test_1 (3-3)
  • pageId (5-5)
  • pageId (14-14)
  • pageId (26-26)
  • pageId (39-39)
  • el (6-6)
  • el (15-15)
  • el (27-27)
  • el (40-40)
  • __snapshot_2d408_test_2 (12-12)
  • el1 (16-16)
  • __snapshot_2d408_test_3 (24-24)
  • __snapshot_2d408_test_4 (37-37)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_without_css_id.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (16)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
  • __snapshot_da39a_test_2 (15-15)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (1)
  • __snapshot_da39a_test_2 (14-14)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_spread.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js (1)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js (1)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (5)
  • __snapshot_da39a_test_3 (23-23)
  • __snapshot_da39a_test_4 (31-31)
  • __snapshot_da39a_test_2 (15-15)
  • __snapshot_da39a_test_5 (49-49)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx_dev.js (4)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (1)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js (1)
  • __snapshot_da39a_test_1 (3-3)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling_jsx.js (3)
  • __snapshot_da39a_test_1 (3-3)
  • pageId (5-5)
  • el (6-6)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-modules-lazy-bundle.js (2)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-all-lazy-bundle.js (13)
  • __snapshot_2d408_test_1 (3-3)
  • pageId (5-5)
  • pageId (14-14)
  • pageId (26-26)
  • pageId (39-39)
  • el (6-6)
  • el (15-15)
  • el (27-27)
  • el (40-40)
  • __snapshot_2d408_test_2 (12-12)
  • el1 (16-16)
  • __snapshot_2d408_test_3 (24-24)
  • __snapshot_2d408_test_4 (37-37)
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-modules.js (9)
  • __snapshot_2d408_test_1 (3-3)
  • pageId (5-5)
  • pageId (14-14)
  • el (6-6)
  • el (15-15)
  • __snapshot_2d408_test_2 (12-12)
  • el1 (16-16)
  • __snapshot_2d408_test_3 (24-24)
  • __snapshot_2d408_test_4 (37-37)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id.js (4)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (18)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
  • __snapshot_da39a_test_2 (15-15)
  • __snapshot_da39a_test_3 (23-23)
  • __snapshot_da39a_test_4 (31-31)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component_with_static_sibling.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_extract_css_id_dynamic_component.js (3)
  • __snapshot_da39a_test_2 (14-14)
  • __snapshot_da39a_test_3 (31-31)
  • __snapshot_da39a_test_4 (52-52)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_wrap_dynamic_key.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (1)
  • __snapshot_da39a_test_2 (15-15)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (1)
  • __snapshot_da39a_test_2 (12-12)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (3)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (9)
  • __snapshot_da39a_test_1 (33-33)
  • pageId (4-4)
  • pageId (14-14)
  • pageId (27-27)
  • pageId (35-35)
  • el (5-5)
  • el (15-15)
  • el (28-28)
  • el (36-36)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/worklet.js (2)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/runtime/__test__/css/scoped-lazy-bundle.test.jsx (1)
packages/react/runtime/__test__/css/remove-scoped-lazy-bundle.test.jsx (1)
  • prevEntryName (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (15)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • pageId (17-17)
  • pageId (25-25)
  • pageId (33-33)
  • pageId (51-51)
  • pageId (64-64)
  • pageId (78-78)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_component.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static.js (3)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/gesture.js (1)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_event.js (5)
  • __snapshot_da39a_test_1 (2-2)
  • pageId (4-4)
  • el (5-5)
  • el1 (6-6)
  • el2 (8-8)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (3)
packages/react/transform/crates/swc_plugin_list/tests/__swc_snapshots__/lib.rs/should_transform_list_item_deferred_with_children_with_snapshot.js (11)
  • __snapshot_da39a_test_3 (23-23)
  • el (5-5)
  • el (18-18)
  • el (26-26)
  • el (34-34)
  • el (52-52)
  • el (65-65)
  • el (79-79)
  • __snapshot_da39a_test_2 (15-15)
  • __snapshot_da39a_test_4 (31-31)
  • __snapshot_da39a_test_1 (2-2)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_toplevel.js (3)
  • __snapshot_da39a_test_3 (13-13)
  • __snapshot_da39a_test_2 (2-2)
  • __snapshot_da39a_test_1 (24-24)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js (4)
  • __snapshot_da39a_test_3 (2-2)
  • __snapshot_da39a_test_2 (18-18)
  • __snapshot_da39a_test_4 (10-10)
  • __snapshot_da39a_test_1 (39-39)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: test-rust / Test (Ubuntu)
  • GitHub Check: test-rust / clippy

@upupming
Copy link
Collaborator Author

@hzy Sorry for that, tests are passed now!

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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/react/transform/__test__/css/__snapshots__/transform-imports-css-scoped-all.js (1)

7-23: Fix source fixture: styles2 is undefined and never imported in css-scope.spec.js line 75.

The snapshot correctly reflects the broken source input. Either import/define styles2 in the test fixture or remove the reference.

Location: packages/react/transform/__test__/css/css-scope.spec.js line 75.

♻️ Duplicate comments (2)
packages/react/runtime/src/snapshot.ts (1)

281-289: Add a second guard after invoking creator to avoid undefined __snapshot_def.

If a creator exists but fails to register, snapshotManager.values.get(type)! becomes undefined and later logic crashes. Re-check and throw a clear error.

-    if (!snapshotManager.values.has(type) && type !== 'div') {
-      if (snapshotCreatorMap[type]) {
-        snapshotCreatorMap[type](type);
-      } else {
-        throw new Error('Snapshot not found: ' + type);
-      }
-    }
-    this.__snapshot_def = snapshotManager.values.get(type)!;
+    if (!snapshotManager.values.has(type) && type !== 'div') {
+      const creator = snapshotCreatorMap[type];
+      if (creator) {
+        creator(type);
+      } else {
+        throw new Error(`Snapshot not found or not registered: ${type}`);
+      }
+    }
+    const def = snapshotManager.values.get(type);
+    if (!def && type !== 'div') {
+      throw new Error(`Snapshot not found or not registered: ${type}`);
+    }
+    this.__snapshot_def = def!;
packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-all-lazy-bundle.js (1)

50-50: Same trailing comma expression as in transform-jsx-css-scoped-none-lazy-bundle.js.

This file has the identical Foo, App; expression that appears to be dead code. Please verify its purpose across these test snapshots.

🧹 Nitpick comments (16)
packages/webpack/react-refresh-webpack-plugin/test/hotCases/jsx/recovery/__snapshot__/rspack/2.snap.txt (1)

50-63: Registry wiring LGTM; consider avoiding param shadowing in codegen.
The factory parameter name equals the outer const (e.g., __snapshot_4953c_b7a87_1). It’s valid but mildly confusing. Prefer a neutral name like uniqId in the generated code.

packages/react/runtime/__test__/snapshot/ref.test.jsx (1)

120-121: Inline snapshots updated for lazy snapshot keys.
Updates look consistent with the registry-based approach. Consider adding one negative test to assert the dev error when a snapshot key is referenced without a registered factory (ensures BackgroundSnapshotInstance path remains descriptive).

Also applies to: 205-206, 500-500, 941-942, 1019-1019, 1444-1454, 1526-1536, 1581-1591, 1684-1684, 1962-1964

packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-none.js (1)

5-12: Transform output matches registry pattern; optional param rename.
Looks good. For clarity in generated code, consider using a neutral parameter name (e.g., uniqId) instead of shadowing the outer constant.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_component.js (1)

2-9: Looks good; rename param to avoid shadowing.

Shadowing the const with the arrow param impairs readability. Prefer uniqId for the parameter.

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (__snapshot_da39a_test_1)=>ReactLynx.createSnapshot(__snapshot_da39a_test_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (uniqId)=>ReactLynx.createSnapshot(uniqId, function() {

Note: PURE comments are not required here; createSnapshot’s PURE handling is separate from wrapWithLynxComponent. Based on learnings.

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_new_line.js (1)

2-18: Static snapshot wiring LGTM; minor naming nit.

Registration is correct (static create, no updates/slots). Rename param for clarity.

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (__snapshot_da39a_test_1)=>ReactLynx.createSnapshot(__snapshot_da39a_test_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (uniqId)=>ReactLynx.createSnapshot(uniqId, function() {
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/page_element.js (1)

3-10: Registration correct; rename param for readability.

Slot choice and args look right. Avoid shadowing by renaming the parameter.

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (__snapshot_da39a_test_1)=>ReactLynx.createSnapshot(__snapshot_da39a_test_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (uniqId)=>ReactLynx.createSnapshot(uniqId, function() {
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js (1)

2-10: LGTM; keep param names clear.

Wiring matches intent for the style test. Rename arrow param for clarity.

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (__snapshot_da39a_test_1)=>ReactLynx.createSnapshot(__snapshot_da39a_test_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (uniqId)=>ReactLynx.createSnapshot(uniqId, function() {
packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts (1)

19-19: Consider a safer registry type for creators (Map or null-prototype object)

snapshotCreatorMap is a plain object (per snapshot.ts). While keys are controlled, prefer:

  • Map<string, (uniqId: string) => string>, or
  • Object.create(null) for a prototype-less record.

This reduces accidental collisions with inherited props and clarifies intent.

Proposed in snapshot.ts:

-export let snapshotCreatorMap: Record<string, (uniqId: string) => string> = {};
+export const snapshotCreatorMap: Map<string, (uniqId: string) => string> = new Map();

And here:

- snapshotCreatorMap[uniqID] = evaluate(...);
+ snapshotCreatorMap.set(uniqID, evaluate(...));

If changing to Map is too broad for now, initialize with Object.create(null):

-export let snapshotCreatorMap: Record<string, (uniqId: string) => string> = {};
+export let snapshotCreatorMap: Record<string, (uniqId: string) => string> = Object.create(null);
packages/react/transform/__test__/css/__snapshots__/transform-all-css-scoped-all.js (1)

5-12: Rename the factory param to uniqId for clarity

Same shadowing pattern; prefer a distinct param and forward it.

-ReactLynx.snapshotCreatorMap[__snapshot_2d408_test_1] = (__snapshot_2d408_test_1)=>ReactLynx.createSnapshot(__snapshot_2d408_test_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_2d408_test_1] = (uniqId)=>ReactLynx.createSnapshot(uniqId, function() {
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_inline_style.js (2)

2-10: Use uniqId instead of a shadowed param name

Rename the param to avoid shadowing the outer const.

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (__snapshot_da39a_test_1)=>ReactLynx.createSnapshot(__snapshot_da39a_test_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (uniqId)=>ReactLynx.createSnapshot(uniqId, function() {

12-20: Same here: avoid shadowing for consistency

Apply the same param rename in this block.

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_2] = (__snapshot_da39a_test_2)=>ReactLynx.createSnapshot(__snapshot_da39a_test_2, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_2] = (uniqId)=>ReactLynx.createSnapshot(uniqId, function() {
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/full_static_children_comments.js (1)

2-18: Avoid param/const name collision in creator registration

Rename param to uniqId for readability/debuggability.

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (__snapshot_da39a_test_1)=>ReactLynx.createSnapshot(__snapshot_da39a_test_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (uniqId)=>ReactLynx.createSnapshot(uniqId, function() {
packages/react/runtime/__test__/snapshotPatch.test.jsx (3)

33-35: Tidy up globals set in tests

Attach createSnapshot and DynamicPartType to globalThis only for test scope and restore afterward to avoid cross‑test bleed.

Example:

 beforeAll(() => {
   // ...
-  globalThis.createSnapshot = createSnapshot;
-  globalThis.DynamicPartType = DynamicPartType;
+  const prev = {
+    createSnapshot: globalThis.createSnapshot,
+    DynamicPartType: globalThis.DynamicPartType,
+  };
+  globalThis.createSnapshot = createSnapshot;
+  globalThis.DynamicPartType = DynamicPartType;
+  vi.stubGlobal('__prevGlobals__', prev);
 });
 
 afterEach(() => {
   elementTree.clear();
   vi.clearAllMocks();
 });
+
+afterAll(() => {
+  const prev = globalThis.__prevGlobals__;
+  if (prev) {
+    globalThis.createSnapshot = prev.createSnapshot;
+    globalThis.DynamicPartType = prev.DynamicPartType;
+    delete globalThis.__prevGlobals__;
+  }
+})

797-800: No‑op assertion

expect(si.ensureElements()) doesn’t assert anything; prefer explicit non‑throw or remove.

Examples:

- expect(si.ensureElements());
+ expect(() => si.ensureElements()).not.toThrow();

or

- expect(si.ensureElements());

Also applies to: 876-879


1137-1163: entryName global should be restored

Global entryName is set but not cleaned up; restore or delete to prevent leakage across tests.

Example:

- globalThis.entryName = 'FOO';
+ const prevEntry = globalThis.entryName;
+ globalThis.entryName = 'FOO';
  // …
+ globalThis.entryName = prevEntry;

Also applies to: 1230-1257

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_full_static_snapshot_extract.js (1)

2-15: Lazy registration shape looks correct

Registry wiring and factory body match runtime expectations. One note: factories return void; align runtime type to void for snapshotCreatorMap to reflect usage (see runtime comment).

@upupming upupming force-pushed the feat/lazy-snapshot-create branch from 17eb8ad to b78f386 Compare October 29, 2025 07:06
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: 2

♻️ Duplicate comments (4)
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_ref.js (1)

27-34: Slot must not be null (regression). Use empty array.

null will crash when runtime reads slot.length. Emit [].

Apply:

-    ], null, undefined, globDynamicComponentEntry, [
+    ], [],  undefined, globDynamicComponentEntry, [
packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts (1)

85-93: LGTM! Direct assignment enables HMR updates.

The implementation correctly uses direct assignment (=) instead of nullish-coalescing assignment (??=), ensuring that HMR updates replace previous snapshot creators. This properly addresses the concern raised in previous reviews.

packages/react/runtime/src/snapshot.ts (1)

279-288: Verify snapshot creation completed before non-null assertion.

The code checks for a creator before invoking it, but Line 288 uses a non-null assertion (!) on snapshotManager.values.get(type) without verifying the creator actually populated the map. If the creator fails silently or doesn't register the snapshot, this could throw a confusing error.

Consider guarding the assignment:

     if (!snapshotManager.values.has(type) && type !== 'div') {
       if (snapshotCreatorMap[type]) {
         snapshotCreatorMap[type](type);
       } else {
         throw new Error('Snapshot not found: ' + type);
       }
     }
-    this.__snapshot_def = snapshotManager.values.get(type)!;
+    const snapshot_def = snapshotManager.values.get(type);
+    if (!snapshot_def && type !== 'div') {
+      throw new Error(`Snapshot creation failed for type: ${type}`);
+    }
+    this.__snapshot_def = snapshot_def!;
packages/react/runtime/__test__/snapshotPatch.test.jsx (1)

1463-1467: Inconsistent error message in BackgroundSnapshotInstance test.

The test on Line 1464 expects 'Snapshot not found: missing-snapshot' for BackgroundSnapshotInstance, but according to packages/react/runtime/src/backgroundSnapshot.ts:48, it should throw 'BackgroundSnapshot not found: missing-snapshot'. Line 1467 correctly expects 'Snapshot not found:' for SnapshotInstance.

Apply this diff to fix the assertion:

-    expect(() => new BackgroundSnapshotInstance('missing-snapshot')).toThrowError(
-      'Snapshot not found: missing-snapshot',
-    );
+    expect(() => new BackgroundSnapshotInstance('missing-snapshot')).toThrowError(
+      'BackgroundSnapshot not found: missing-snapshot',
+    );
🧹 Nitpick comments (12)
packages/react/transform/__test__/css/__snapshots__/transform-imports-css-scoped-modules.js (1)

8-18: Lazy snapshot creation pattern implemented correctly.

The registry-based approach successfully defers snapshot creation to runtime. All original arguments (factory, updaters, cssId, etc.) are preserved correctly.

Note: The arrow function parameter shadows the constant from line 7. While this works correctly (the runtime will pass the same key value), it adds slight cognitive overhead. Since this appears to be generated code and follows a consistent pattern across the codebase, this is acceptable.

packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-all.js (2)

11-11: Add PURE to top-level JSX for consistent DCE.

Line 11 emits a bare _jsx without /*#__PURE__*/ while line 23 includes it. Align both to enable reliable tree‑shaking of unused top-level JSX.

Apply at line 11:

-_jsx(__snapshot_2d408_test_1, {});
+/*#__PURE__*/ _jsx(__snapshot_2d408_test_1, {});

Based on learnings.

Also applies to: 23-23


4-10: Optional: avoid parameter shadowing in registry factories.

The arrow-param name equals the outer const (e.g., __snapshot_2d408_test_1), which reads awkwardly. Consider id for clarity in emitted code.

Example:

-ReactLynx.snapshotCreatorMap[__snapshot_2d408_test_1] = (__snapshot_2d408_test_1)=>ReactLynx.createSnapshot(__snapshot_2d408_test_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_2d408_test_1] = (id)=>ReactLynx.createSnapshot(id, function() {

Also applies to: 13-22, 25-31, 38-44

packages/react/transform/__test__/css/__snapshots__/transform-jsx-defaults.js (2)

11-11: Add PURE to top-level JSX for consistent DCE.

Line 11 should mirror line 23 and include /*#__PURE__*/ to allow tree‑shaking.

-_jsx(__snapshot_da39a_4683e_1, {});
+/*#__PURE__*/ _jsx(__snapshot_da39a_4683e_1, {});

Based on learnings.

Also applies to: 23-23


4-10: Optional: rename factory param to avoid shadowing.

Use id instead of repeating the const name for readability.

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_4683e_1] = (__snapshot_da39a_4683e_1)=>ReactLynx.createSnapshot(__snapshot_da39a_4683e_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_4683e_1] = (id)=>ReactLynx.createSnapshot(id, function() {

Also applies to: 13-22, 25-31, 38-44

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list_with_fragment.js (1)

3-3: Avoid parameter shadowing; use a descriptive name (e.g., uniqId).

Shadowing the constant with an identically named parameter harms readability and confuses stack traces. Rename the parameter and its usage.

Example for one site (apply similarly to others):

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_3] = (__snapshot_da39a_test_3)=>ReactLynx.createSnapshot(__snapshot_da39a_test_3, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_3] = (uniqId)=>ReactLynx.createSnapshot(uniqId, function() {

Also applies to: 11-11, 19-19, 32-32, 40-40

packages/react/transform/__test__/css/__snapshots__/transform-jsx-css-scoped-none-lazy-bundle.js (1)

4-4: Rename the snapshot factory parameter to uniqId for clarity.

Avoids shadowing and clarifies intent.

Example:

-ReactLynx.snapshotCreatorMap[__snapshot_2d408_test_1] = (__snapshot_2d408_test_1)=>ReactLynx.createSnapshot(__snapshot_2d408_test_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_2d408_test_1] = (uniqId)=>ReactLynx.createSnapshot(uniqId, function() {

Also applies to: 13-13, 25-25, 38-38

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js (1)

3-3: Rename the snapshot factory parameter to uniqId.

Improves readability; avoids ident shadowing.

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (__snapshot_da39a_test_1)=>ReactLynx.createSnapshot(__snapshot_da39a_test_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (uniqId)=>ReactLynx.createSnapshot(uniqId, function() {

Also applies to: 13-13, 30-30, 51-51

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/inline_style_literal_unknown_property.js (1)

2-10: Param name shadowing the key

Rename the factory parameter to avoid shadowing.

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (__snapshot_da39a_test_1)=>ReactLynx.createSnapshot(__snapshot_da39a_test_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (key)=>ReactLynx.createSnapshot(key, function() {
packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/basic_list.js (1)

3-11: De-shadow factory params across all registrations

Use a neutral parameter name for all creators.

-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_3] = (__snapshot_da39a_test_3)=>ReactLynx.createSnapshot(__snapshot_da39a_test_3, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_3] = (key)=>ReactLynx.createSnapshot(key, function() {
@@
-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_2] = (__snapshot_da39a_test_2)=>ReactLynx.createSnapshot(__snapshot_da39a_test_2, function(snapshotInstance) {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_2] = (key)=>ReactLynx.createSnapshot(key, function(snapshotInstance) {
@@
-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_4] = (__snapshot_da39a_test_4)=>ReactLynx.createSnapshot(__snapshot_da39a_test_4, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_4] = (key)=>ReactLynx.createSnapshot(key, function() {
@@
-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (__snapshot_da39a_test_1)=>ReactLynx.createSnapshot(__snapshot_da39a_test_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (key)=>ReactLynx.createSnapshot(key, function() {

Consider unifying dynamic-part representation (symbol vs array form) in generator output to reduce surface variance, unless test coverage depends on both forms.

Also applies to: 13-24, 26-33, 34-55

packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_escape_newline_character.js (1)

2-50: Rename factory param; verify updater index alignment

  • Parameter __snapshot_da39a_test_1 shadows the const declaration on line 2. Rename for clarity.
  • Updater targets element index 8; matches returned array (9 elements: el through el8). Index alignment is correct.
-ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (__snapshot_da39a_test_1)=>ReactLynx.createSnapshot(__snapshot_da39a_test_1, function() {
+ReactLynx.snapshotCreatorMap[__snapshot_da39a_test_1] = (key)=>ReactLynx.createSnapshot(key, function() {
packages/react/transform/__test__/fixture.spec.js (1)

82-90: Improve factory parameter naming to reduce shadowing (optional refactor)

The snapshot factory generator unnecessarily shadows the outer snapshot_id variable. Update the template to use a generic parameter name like key or snapshotInstance for clarity and to align with the runtime type signature (uniqId: string) => string.

Location:
packages/react/transform/crates/swc_plugin_snapshot/lib.rs, line 1416

Change:
Replace the template pattern from:

($snapshot_id) => $runtime_id.createSnapshot($snapshot_id, ...

to:

(key) => $runtime_id.createSnapshot(key, ...

All snapshot expectations will regenerate automatically. No functional impact; this improves code readability by avoiding variable shadowing and making it explicit that the parameter receives a value (the snapshot ID) rather than relying on outer scope.

Note: swc_plugin_list uses a different codepath and does not generate this pattern.

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: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b78f386 and 9b2489f.

📒 Files selected for processing (1)
  • packages/react/runtime/__test__/snapshotPatch.test.jsx (23 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-29T10:28:27.497Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.497Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.

Applied to files:

  • packages/react/runtime/__test__/snapshotPatch.test.jsx
🧬 Code graph analysis (1)
packages/react/runtime/__test__/snapshotPatch.test.jsx (3)
packages/react/runtime/src/snapshot.ts (4)
  • createSnapshot (218-233)
  • snapshotCreatorMap (138-138)
  • SnapshotInstance (268-652)
  • snapshotManager (58-123)
packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts (1)
  • snapshotPatchApply (26-108)
packages/react/runtime/src/backgroundSnapshot.ts (1)
  • BackgroundSnapshotInstance (41-375)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (2)
packages/react/runtime/__test__/snapshotPatch.test.jsx (2)

33-34: LGTM: Global bindings for lazy snapshot creation

Exposing createSnapshot and DynamicPartType on globalThis is appropriate for the test harness to support the new wrapper-based snapshot creator pattern.


1463-1467: LGTM: Error messages now match runtime behavior

The test assertions correctly expect 'BackgroundSnapshot not found: missing-snapshot' for BackgroundSnapshotInstance and 'Snapshot not found: missing-snapshot' for SnapshotInstance, matching the error messages thrown by the runtime code. The issue flagged in the previous review has been addressed.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Yiming Li <yimingli.cs@gmail.com>
@upupming upupming requested a review from hzy October 29, 2025 16:24
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

♻️ Duplicate comments (3)
packages/react/runtime/__test__/snapshotPatch.test.jsx (3)

1463-1466: Updated error message matches runtime

Assertion now expects 'BackgroundSnapshot not found: …', consistent with backgroundSnapshot.ts.


726-726: Fix comment typo: "is can be" → "it can be"

Apply consistently in all occurrences.

-// We have to use `snapshotCreatorMap[uniqID1] =` so that is can be created after `initGlobalSnapshotPatch`
+// We have to use `snapshotCreatorMap[uniqID1] =` so that it can be created after `initGlobalSnapshotPatch`

Also update lines 806, 1051, 1139, 1232 similarly.

Also applies to: 806-806, 1051-1051, 1139-1139, 1232-1232


1083-1106: Inline snapshot uses hardcoded ID instead of the function parameter

This snapshot still shows globalThis.createSnapshot("with-cssId-0", ...) instead of passing the wrapper's parameter (e.g., uniqID12). Other tests (basic/with-update/with-slot/with-list/with-entryName) correctly use the parameter. This likely reflects a generator inconsistency for the "cssId only" path.

Proposed expectation after fixing the generator:

-              "with-cssId-0",
+              uniqID12,

Please fix the generator so the uniqID is not inlined for the cssId-only case, then update this inline snapshot. Based on learnings.

🧹 Nitpick comments (4)
packages/react/runtime/__test__/snapshotPatch.test.jsx (4)

33-35: Global hooks set for tests; consider explicit teardown

Setting globalThis.createSnapshot and globalThis.DynamicPartType in beforeAll is fine. Add an afterAll to restore/undefine if other suites share the environment, to avoid cross-suite pollution.

 afterEach(() => {
   elementTree.clear();
   vi.clearAllMocks();
 });
+
+afterAll(() => {
+  // Optional: avoid leaking globals across suites
+  try { delete (globalThis as any).createSnapshot; } catch {}
+  try { delete (globalThis as any).DynamicPartType; } catch {}
+})

1136-1164: Clean up entryName set in tests to avoid cross-test leakage

These tests set globalThis.entryName. Add a local cleanup or an afterEach in this describe to delete it.

 describe('DEV_ONLY_addSnapshot', () => {
   beforeEach(() => {
     globalEnvManager.switchToBackground();
     initGlobalSnapshotPatch();
   });
+
+  afterEach(() => {
+    try { delete (globalThis as any).entryName; } catch {}
+  });

Also applies to: 1229-1257


752-780: HMR semantics covered; consider adding an explicit override test

You validate registration via patch and instantiation. Add a small test that registers an initial creator, applies a patch with a different creator for the same id, and asserts the new behavior to prevent regressing to coalescing semantics.

I can draft a minimal test if you want.

Also applies to: 833-859, 995-1025, 1341-1361


782-801: Remove no-op expectations on ensureElements

expect(si.ensureElements()); has no matcher and is a no-op. Call the method, then assert on resulting state (which you already do).

-    const si = new SnapshotInstance(uniqID1);
-    expect(si.ensureElements());
+    const si = new SnapshotInstance(uniqID1);
+    si.ensureElements();

Apply at lines 798 and 877 (basic and with update blocks).

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b2489f and 875ad05.

📒 Files selected for processing (1)
  • packages/react/runtime/__test__/snapshotPatch.test.jsx (23 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-29T10:28:27.497Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.497Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.

Applied to files:

  • packages/react/runtime/__test__/snapshotPatch.test.jsx
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
PR: lynx-family/lynx-stack#1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/react/runtime/__test__/snapshotPatch.test.jsx
🧬 Code graph analysis (1)
packages/react/runtime/__test__/snapshotPatch.test.jsx (3)
packages/react/runtime/src/snapshot.ts (4)
  • createSnapshot (218-233)
  • snapshotCreatorMap (138-138)
  • SnapshotInstance (268-652)
  • snapshotManager (58-123)
packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts (1)
  • snapshotPatchApply (26-108)
packages/react/runtime/src/backgroundSnapshot.ts (1)
  • BackgroundSnapshotInstance (41-375)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (2)
packages/react/runtime/__test__/snapshotPatch.test.jsx (2)

17-23: Imports look correct and are all used

The added imports are necessary for the new lazy-creator tests and are referenced below.


885-911: Slot and list tests reflect the new lazy creator flow

Good coverage for slot and list, including isListHolder.

Also applies to: 967-991

Comment on lines 725 to 749
const uniqID1 = 'basic-0';
// We have to use `snapshotCreatorMap[uniqID1] =` so that is can be created after `initGlobalSnapshotPatch`
snapshotCreatorMap[uniqID1] = (uniqID1) => {
globalThis.createSnapshot(
uniqID1,
// The `create` function is stringified and called by `new Function()`
/* v8 ignore start */
() => {
const pageId = 0;
const el = __CreateView(pageId);
const el1 = __CreateText(pageId);
__AppendElement(el, el1);
const el2 = __CreateRawText('Hello, ReactLynx x Fast Refresh');
__AppendElement(el1, el2);
return [
el,
el1,
el2,
];
},
/* v8 ignore stop */
null,
null,
);
};
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 29, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

snapshotCreatorMap creator returns void here; align runtime type or return the id

Tests register creators that don't return anything, but runtime typing still suggests (uniqId: string) => string. Either change runtime typing to void (preferred) or return uniqID1 from these lambdas.

If not already updated, consider these diffs outside this file:

-// packages/react/runtime/src/snapshot.ts
-export let snapshotCreatorMap: Record<string, (uniqId: string) => string> = {};
+export let snapshotCreatorMap: Record<string, (uniqId: string) => void> = {};
-// packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts
- snapshotCreatorMap[uniqID] = evaluate<(uniqId: string) => string>(snapshotCreator);
+ snapshotCreatorMap[uniqID] = evaluate<(uniqId: string) => void>(snapshotCreator);

To confirm current state:


🏁 Script executed:

#!/bin/bash
rg -nP -C2 'snapshotCreatorMap\s*:\s*Record<\s*string,\s*\(uniqId:\s*string\)\s*=>\s*\w+\s*>' packages/react/runtime/src
rg -nP -C2 'evaluate<\s*\(uniqId:\s*string\)\s*=>\s*\w+\s*>' packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts

Length of output: 536


I need to verify where snapshotCreatorMap values are called and whether their return values are used.

I need to find where snapshotCreatorMap functions are actually invoked in the codebase to see if return values are used.


🏁 Script executed:

#!/bin/bash
# Find all places where snapshotCreatorMap functions are called/invoked
rg -nP 'snapshotCreatorMap\s*\[' packages/react/runtime/src -A2 -B2
# Also search for any assignment of the result
rg -nP '=.*snapshotCreatorMap' packages/react/runtime/src -A1 -B1

Length of output: 1876


Update type signature for snapshotCreatorMap from string to void return

The review comment is accurate. Call sites in snapshot.ts:283 and backgroundSnapshot.ts:46 invoke the creators but discard return values. The type signature should match the actual behavior.

Changes needed:

  1. packages/react/runtime/src/snapshot.ts:138 — Change Record<string, (uniqId: string) => string> to Record<string, (uniqId: string) => void>

  2. packages/react/runtime/src/snapshot.ts:142 — Update Proxy type from (uniqId: string) => string to (uniqId: string) => void

  3. packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts:92 — Change evaluate<(uniqId: string) => string> to evaluate<(uniqId: string) => void>

🤖 Prompt for AI Agents
In packages/react/runtime/src/snapshot.ts around lines 138 and 142 and in
packages/react/runtime/src/lifecycle/patch/snapshotPatchApply.ts around line 92,
update the creator type signatures from returning string to returning void:
change Record<string, (uniqId: string) => string> to Record<string, (uniqId:
string) => void>, update the Proxy type from (uniqId: string) => string to
(uniqId: string) => void, and change evaluate<(uniqId: string) => string> to
evaluate<(uniqId: string) => void>; this aligns the types with call sites that
invoke creators for side effects and discard return values.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We keep this for the compatibility with loading old version lazy bundles, they will still use const snapshot_xxx = createSnapshot(...) directly.

Copy link
Contributor

Choose a reason for hiding this comment

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

@upupming, thank you for the clarification! That makes perfect sense. Maintaining backward compatibility with existing lazy bundles that use the direct const snapshot_xxx = createSnapshot(...) pattern is a valid reason to keep the return type as string. The type signature correctly accommodates both the legacy pattern (where the return value is used) and the new pattern (where it may be discarded).

I've noted this for future reference.


✏️ Learnings added
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/runtime/__test__/snapshotPatch.test.jsx:725-749
Timestamp: 2025-11-04T10:15:14.916Z
Learning: In packages/react/runtime/src/snapshot.ts, the snapshotCreatorMap type signature uses `Record<string, (uniqId: string) => string>` (returning string) rather than void for backward compatibility. Old lazy bundles still use the pattern `const snapshot_xxx = createSnapshot(...)` directly, which requires createSnapshot to return a value. The snapshotCreatorMap creators that wrap createSnapshot calls must maintain the same return type to support these legacy bundles.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.519Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.

Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1820
File: packages/web-platform/web-tests/tests/react.spec.ts:834-856
Timestamp: 2025-10-11T06:16:12.517Z
Learning: In packages/web-platform/web-tests/tests/react.spec.ts, the tests `basic-bindmouse` and `basic-mts-bindtouchstart` are NOT duplicates despite having similar test structures. They test different event types: `basic-bindmouse` validates mouse events (mousedown, mouseup, mousemove) with mouse-specific properties (button, buttons, x, y, pageX, pageY, clientX, clientY), while `basic-mts-bindtouchstart` validates touch events (touchstart) with touch arrays (touches, targetTouches, changedTouches). The similar test structure is coincidental and follows testing conventions.

Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.

Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.

Learnt from: f0rdream
Repo: lynx-family/lynx-stack PR: 1835
File: packages/react/worklet-runtime/src/workletRuntime.ts:52-55
Timestamp: 2025-09-28T08:46:43.177Z
Learning: The legacy worklet path with `_lepusWorkletHash` in `packages/react/worklet-runtime/src/workletRuntime.ts` is preserved for compatibility with MTS (Mini-app Threading Service) that doesn't support Initial Frame Rendering. This path will not be touched in current implementations.

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)
packages/react/transform/crates/swc_plugin_snapshot/lib.rs (1)

1415-1443: Consider renaming the creator function parameter to avoid shadowing.

At line 1417, the lambda function parameter is named $snapshot_id, which shadows the outer snapshot_id identifier used as the map key. While this is functionally correct (the outer value is the entry UID constant, while the parameter receives the runtime UID when called), the shadowing can be confusing.

Consider using a distinct parameter name for clarity:

-    r#"$runtime_id.snapshotCreatorMap[$snapshot_id] = ($snapshot_id) => $runtime_id.createSnapshot(
-         $snapshot_id,
+    r#"$runtime_id.snapshotCreatorMap[$snapshot_id] = (uniqId) => $runtime_id.createSnapshot(
+         uniqId,

This would make it clearer that the creator function receives a runtime ID that may differ from the entry UID stored in the outer snapshot_id constant.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ac99e0 and a0ca8ef.

📒 Files selected for processing (1)
  • packages/react/transform/crates/swc_plugin_snapshot/lib.rs (3 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/runtime/__test__/snapshotPatch.test.jsx:725-749
Timestamp: 2025-11-04T10:15:14.916Z
Learning: In packages/react/runtime/src/snapshot.ts, the snapshotCreatorMap type signature uses `Record<string, (uniqId: string) => string>` (returning string) rather than void for backward compatibility. Old lazy bundles still use the pattern `const snapshot_xxx = createSnapshot(...)` directly, which requires createSnapshot to return a value. The snapshotCreatorMap creators that wrap createSnapshot calls must maintain the same return type to support these legacy bundles.
📚 Learning: 2025-10-29T10:28:27.519Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.519Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/lib.rs
📚 Learning: 2025-11-04T10:15:14.916Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/runtime/__test__/snapshotPatch.test.jsx:725-749
Timestamp: 2025-11-04T10:15:14.916Z
Learning: In packages/react/runtime/src/snapshot.ts, the snapshotCreatorMap type signature uses `Record<string, (uniqId: string) => string>` (returning string) rather than void for backward compatibility. Old lazy bundles still use the pattern `const snapshot_xxx = createSnapshot(...)` directly, which requires createSnapshot to return a value. The snapshotCreatorMap creators that wrap createSnapshot calls must maintain the same return type to support these legacy bundles.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/lib.rs
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at lines 478-482 is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs. These are two distinct code paths that should be treated differently.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/lib.rs
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/lib.rs
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.

Applied to files:

  • packages/react/transform/crates/swc_plugin_snapshot/lib.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (3)
packages/react/transform/crates/swc_plugin_snapshot/lib.rs (3)

1524-1526: LGTM! Dynamic component CSS ID initialization is correct.

The logic properly initializes css_id_value to 0 for dynamic components when no explicit @jsxCSSId directive is present. This ensures dynamic components always have a numeric CSS ID, which aligns with the dynamic component entry naming pattern and the runtime's expectations.


1450-1464: LGTM! Correct ordering of snapshot definitions.

The code correctly pushes entry_snapshot_uid_def (line 1463) before snapshot_def (line 1464), ensuring the snapshot_id constant is defined before it's used as the map key in the creator registration. This maintains proper JavaScript execution order in the generated code.


1415-1443: No issues found. The review comment is incorrect.

globDynamicComponentEntry is properly defined at runtime through webpack's BannerPlugin injection mechanism. Rather than being undefined, this variable is intentionally left as a bare identifier in the quote! macro because it's injected into the generated bundle by build tooling:

  • Webpack injects it as a global variable via BannerPlugin: 'use strict';var globDynamicComponentEntry=globDynamicComponentEntry||'__Card__';'
  • It's also passed as an IIFE parameter in wrapper code: (function (globDynamicComponentEntry)
  • Test environments explicitly set it on the global object: target.globDynamicComponentEntry = '__Card__'

The variable will be in scope when the generated JavaScript code executes, making its use as a bare identifier correct and intentional.

Likely an incorrect or invalid review comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants