deno
a7fb5efb - fix(ext/node): add v8.startupSnapshot API polyfill (#34189)

Commit
164 days ago
fix(ext/node): add v8.startupSnapshot API polyfill (#34189) ## Summary Adds an API-surface polyfill for `v8.startupSnapshot` on `node:v8` so that modules destructuring `setDeserializeMainFunction`, `addSerializeCallback`, `addDeserializeCallback`, or `isBuildingSnapshot` load without throwing. Deno does not implement `--build-snapshot` / `--snapshot-blob`, so this is not a real snapshot lifecycle: - `isBuildingSnapshot()` returns `false`. - `setDeserializeMainFunction(fn, data)` invokes `fn(data)` synchronously so scripts written for snapshot deserialization still execute their entry point in plain Deno runs. - `addSerializeCallback` / `addDeserializeCallback` store the callbacks but never invoke them (there is no serialize/deserialize phase). The two node_compat tests that exercise the full snapshot lifecycle (`parallel/test-snapshot-console.js`, `parallel/test-snapshot-stack-trace-limit.js`) are marked `ignore: true` with the same reason as the other `test-snapshot-*` entries because they need actual `--build-snapshot` / `--snapshot-blob` support to pass. The minimum required by the issue — exposing `startupSnapshot` so the destructure no longer throws — is in place. Closes denoland/orchid#127 ## Test plan - [x] `deno fmt` clean - [x] `deno lint` clean on changed files - [x] Manual smoke test: `require('node:v8').startupSnapshot` exposes the 4 methods, `isBuildingSnapshot()` returns `false`, and `setDeserializeMainFunction(fn)` invokes `fn` - [x] New unit tests in `tests/unit_node/v8_test.ts` cover the API surface - [x] `cargo test --test node_compat -- test-snapshot-console.js` now reports `ignored` instead of failing - [x] `cargo test --test node_compat -- snapshot-stack-trace-limit.` now reports `ignored` instead of failing Co-authored-by: divybot <divybot@users.noreply.github.com> Co-authored-by: Divy Srivastava <me@littledivy.com>
Author
Parents
Loading