Skip to content

fix(ext/node): use core.loadExtScript for deno_web/deno_io polyfill deps#33798

Merged
littledivy merged 1 commit into
denoland:mainfrom
divybot:divybot/fix-snapshot-imports-tls
May 3, 2026
Merged

fix(ext/node): use core.loadExtScript for deno_web/deno_io polyfill deps#33798
littledivy merged 1 commit into
denoland:mainfrom
divybot:divybot/fix-snapshot-imports-tls

Conversation

@divybot

@divybot divybot commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Recent additions of import (rather than core.loadExtScript) for ext:deno_web/08_text_encoding.js and ext:deno_io/12_io.js in:

make the snapshot build fail on main:

thread 'main' panicked at libs/core/runtime/jsruntime.rs:2564:9:
Failed to initialize JsRuntime for snapshotting: ... "Specifier
\"ext:deno_web/08_text_encoding.js\" was not passed as an extension
module and was not included in the snapshot."

Those modules aren't snapshot deps for ext/node — every other polyfill that needs them loads via core.loadExtScript. Switch the two new imports to that pattern, and replace io.stderr.writeSync(new TextEncoder().encode(...)) in tls.ts with the existing core.print(..., true) helper already used in process.ts.

Verified locally with cargo build -p deno_snapshots.

Test plan

  • CI green on main rebuild

The static imports

  import { TextEncoder } from "ext:deno_web/08_text_encoding.js";
  import * as io from "ext:deno_io/12_io.js";
  import { TextDecoder } from "ext:deno_web/08_text_encoding.js";

added in denoland#33708 (tls.ts) and denoland#33731 (undici.js) make the snapshot build
fail with "Specifier ext:deno_web/08_text_encoding.js was not passed
as an extension module and was not included in the snapshot." Those
modules aren't snapshot deps for ext/node — every other polyfill in
this directory loads them at runtime via core.loadExtScript. Switch to
that pattern, and replace the io.stderr.writeSync debug write in tls.ts
with the existing core.print helper used elsewhere in node polyfills.

Co-authored-by: Divy Srivastava <[email protected]>
@littledivy

Copy link
Copy Markdown
Member

cc @bartlomieju merging to unblock CI on PRs

@littledivy
littledivy merged commit d4d2816 into denoland:main May 3, 2026
136 checks passed
bartlomieju added a commit that referenced this pull request May 3, 2026
Follow-up to #33784. Converts `ext/fs/30_fs.js` from ESM to
IIFE-wrapped lazy-loaded script (`lazy_loaded_js`), eliminating ESM
module resolution overhead.

Updates three consumers to use `core.loadExtScript()`:
- `ext/process/40_process.js` (`FsFile` import)
- `ext/node/polyfills/_process/process.ts` (`fs` namespace import)
- `runtime/js/90_deno_ns.js` (`fs` namespace import)

No cross-extension blockers -- `30_fs.js` already uses
`core.loadExtScript()` for its `ext:deno_io` and `ext:deno_web`
dependencies (converted in #33798).
littledivy added a commit to crowlKats/deno that referenced this pull request Jun 10, 2026
…eps (denoland#33798)

## Summary
Recent additions of `import` (rather than `core.loadExtScript`) for
`ext:deno_web/08_text_encoding.js` and `ext:deno_io/12_io.js` in:

- `ext/node/polyfills/tls.ts` (denoland#33708)
- `ext/node/polyfills/internal/deps/undici/undici.js` (denoland#33731)

make the snapshot build fail on `main`:

```
thread 'main' panicked at libs/core/runtime/jsruntime.rs:2564:9:
Failed to initialize JsRuntime for snapshotting: ... "Specifier
\"ext:deno_web/08_text_encoding.js\" was not passed as an extension
module and was not included in the snapshot."
```

Those modules aren't snapshot deps for ext/node — every other polyfill
that needs them loads via `core.loadExtScript`. Switch the two new
imports to that pattern, and replace `io.stderr.writeSync(new
TextEncoder().encode(...))` in `tls.ts` with the existing
`core.print(..., true)` helper already used in `process.ts`.

Verified locally with `cargo build -p deno_snapshots`.

Co-authored-by: Divy Srivastava <[email protected]>
littledivy pushed a commit to crowlKats/deno that referenced this pull request Jun 10, 2026
…d#33800)

Follow-up to denoland#33784. Converts `ext/fs/30_fs.js` from ESM to
IIFE-wrapped lazy-loaded script (`lazy_loaded_js`), eliminating ESM
module resolution overhead.

Updates three consumers to use `core.loadExtScript()`:
- `ext/process/40_process.js` (`FsFile` import)
- `ext/node/polyfills/_process/process.ts` (`fs` namespace import)
- `runtime/js/90_deno_ns.js` (`fs` namespace import)

No cross-extension blockers -- `30_fs.js` already uses
`core.loadExtScript()` for its `ext:deno_io` and `ext:deno_web`
dependencies (converted in denoland#33798).
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