Skip to content

chore(runtime): remove unused runtime/index.js#10302

Merged
graphite-app[bot] merged 1 commit into
mainfrom
chore/remove-unused-runtime-index-js
Jul 15, 2026
Merged

chore(runtime): remove unused runtime/index.js#10302
graphite-app[bot] merged 1 commit into
mainfrom
chore/remove-unused-runtime-index-js

Conversation

@IWANABETHATGUY

Copy link
Copy Markdown
Member

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 from exactly four include_str!ed files:

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

@netlify

netlify Bot commented Jul 15, 2026

Copy link
Copy Markdown

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 2e98842
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6a57a4eb1789f40008c852d2

hyfdev commented Jul 15, 2026

Copy link
Copy Markdown
Member

Merge activity

  • Jul 15, 3:17 PM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jul 15, 3:17 PM UTC: hyfdev added this pull request to the Graphite merge queue.
  • Jul 15, 3:24 PM UTC: Merged by the Graphite merge queue.

### 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
@graphite-app
graphite-app Bot force-pushed the chore/remove-unused-runtime-index-js branch from 42e25ed to 2e98842 Compare July 15, 2026 15:19
@graphite-app
graphite-app Bot merged commit 2e98842 into main Jul 15, 2026
32 of 33 checks passed
@graphite-app
graphite-app Bot deleted the chore/remove-unused-runtime-index-js branch July 15, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants