feat(rust): rendering runtime module in snapshot testing#375
Merged
underfin merged 3 commits intoNov 28, 2023
Merged
Conversation
This was referenced Nov 23, 2023
Merged
Member
Author
hyfdev
force-pushed
the
11-23-feat_rust_rendering_runtime_module_in_snapshot_testing
branch
from
November 23, 2023 08:44
5daaca2 to
bf15a55
Compare
Contributor
|
The runtime code is larger, it is difficult to review, maybe we can use another idea to exclude it. I see esbuild snapshot also hasn't runtime code. |
Member
Author
This tests the behaviors of treeshaking with runtime module. Feel free to open a team meeting to discuss this PR. |
This was referenced Nov 23, 2023
Contributor
|
Track here #390. |
Contributor
|
Other we need to add |
underfin
approved these changes
Nov 25, 2023
Member
Boshen
force-pushed
the
11-23-feat_improve_side-effect_detection_of_MemberExpression_
branch
from
November 27, 2023 03:34
76168f9 to
0e41b6a
Compare
Base automatically changed from
11-23-feat_improve_side-effect_detection_of_MemberExpression_
to
main
November 27, 2023 03:38
hyfdev
force-pushed
the
11-23-feat_rust_rendering_runtime_module_in_snapshot_testing
branch
from
November 27, 2023 05:15
193fd16 to
424651e
Compare
underfin
deleted the
11-23-feat_rust_rendering_runtime_module_in_snapshot_testing
branch
November 28, 2023 15:38
graphite-app Bot
pushed a commit
that referenced
this pull request
Jul 15, 2026
### Description `crates/rolldown/src/runtime/index.js` is not part of the build, and hasn''t been for a long time. This PR deletes it. The runtime module is assembled in [`runtime_module_task.rs`](https://github.com/rolldown/rolldown/blob/main/crates/rolldown/src/module_loader/runtime_module_task.rs#L33-L36) from exactly four `include_str!`ed files: ```rust const RUNTIME_BASE_JS: &str = include_str!("../runtime/runtime-base.js"); const RUNTIME_TAIL_JS: &str = include_str!("../runtime/runtime-tail.js"); const RUNTIME_HEAD_NODE_JS: &str = include_str!("../runtime/runtime-head-node.js"); const RUNTIME_TAIL_NODE_JS: &str = include_str!("../runtime/runtime-tail-node.js"); ``` `index.js` is not among them. Nothing else in the repo references it either — there''s no `build.rs` in the crate, and no path reference to it in Rust, JS, or `knip.jsonc`. Its only remaining coverage is incidental: the sibling `tsconfig.json` globs `./**/*`, so it gets type-checked and formatted alongside the files that actually ship. ### How it got here It''s the original esbuild runtime port from #37. #375 added `runtime-without-comments.js` as the copy actually fed to the bundler; that file was renamed to `runtime-base.js` in #2919 and later split with `runtime-tail.js`. `index.js` was never wired back up — it survived as a copy that edits were hand-mirrored into. ### Why delete rather than leave it The mirroring has fallen behind, so the file now actively misinforms: | | `runtime-base.js` (ships) | `index.js` (dead) | |---|---|---| | `cb = null` release in `__commonJS` (#9067) | present | **missing** | | `__exportAll` + `Symbol.toStringTag` | present | still the old `__export` | | `__require` error text | rewritten to link the rolldown docs (in `runtime-tail.js`) | still esbuild''s "Dynamic require of …" | Someone grepping for a runtime helper can land here and draw the wrong conclusion about what ships — the missing #9067 fix reads as a live memory leak. It isn''t, because the file is inert. Deleting it removes the trap and the ongoing cost of keeping a second copy in sync. ### Test Plan Deletion only; no shipped output changes, so no snapshots move. `include_str!` resolves at compile time, so a stale reference would break the build: - `cargo check -p rolldown --all-targets` — passes - `tsc --noEmit -p crates/rolldown/src/runtime/tsconfig.json` — passes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Test Plan