Skip to content

Commit

Permalink
fix(ext/node): register node:wasi built-in (denoland#25134)
Browse files Browse the repository at this point in the history
  • Loading branch information
littledivy authored Aug 22, 2024
1 parent 3314a0c commit 2531204
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ext/node/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,6 @@ deno_core::extension!(deno_node,
"path/mod.ts",
"path/separator.ts",
"readline/promises.ts",
"wasi.ts",
"node:assert" = "assert.ts",
"node:assert/strict" = "assert/strict.ts",
"node:async_hooks" = "async_hooks.ts",
Expand Down Expand Up @@ -645,6 +644,7 @@ deno_core::extension!(deno_node,
"node:util/types" = "util/types.ts",
"node:v8" = "v8.ts",
"node:vm" = "vm.js",
"node:wasi" = "wasi.ts",
"node:worker_threads" = "worker_threads.ts",
"node:zlib" = "zlib.ts",
],
Expand Down
1 change: 1 addition & 0 deletions ext/node/polyfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ generate_builtin_node_module_lists! {
"util/types",
"v8",
"vm",
"wasi",
"worker_threads",
"zlib",
}
2 changes: 1 addition & 1 deletion ext/node/polyfills/01_require.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ import util from "node:util";
import v8 from "node:v8";
import vm from "node:vm";
import workerThreads from "node:worker_threads";
import wasi from "ext:deno_node/wasi.ts";
import wasi from "node:wasi";
import zlib from "node:zlib";

const nativeModuleExports = ObjectCreate(null);
Expand Down
1 change: 1 addition & 0 deletions tests/integration/lsp_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7663,6 +7663,7 @@ fn lsp_completions_node_specifier() {
"node:util/types",
"node:v8",
"node:vm",
"node:wasi",
"node:worker_threads",
"node:zlib",
],
Expand Down
1 change: 1 addition & 0 deletions tests/integration/node_unit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ util::unit_test_factory!(
util_test,
v8_test,
vm_test,
wasi_test,
worker_threads_test,
zlib_test
]
Expand Down
7 changes: 7 additions & 0 deletions tests/unit_node/wasi_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import wasi from "node:wasi";
import { assertThrows } from "@std/assert";

Deno.test("[node/wasi] - WASI should throw (not implemented)", () => {
assertThrows(() => new wasi.WASI());
});
2 changes: 1 addition & 1 deletion tools/core_import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
"node:util/types": "../ext/node/polyfills/util/types.ts",
"node:v8": "../ext/node/polyfills/v8.ts",
"node:vm": "../ext/node/polyfills/vm.js",
"ext:deno_node/wasi.ts": "../ext/node/polyfills/wasi.ts",
"node:wasi": "../ext/node/polyfills/wasi.ts",
"node:worker_threads": "../ext/node/polyfills/worker_threads.ts",
"node:zlib": "../ext/node/polyfills/zlib.ts",
"ext:deno_url/00_url.js": "../ext/url/00_url.js",
Expand Down

0 comments on commit 2531204

Please sign in to comment.