mirror of
https://github.com/denoland/deno.git
synced 2025-10-02 23:24:37 +00:00
refactor: rename built-in node modules from ext:deno_node/ to node: (#19680)
Closes https://github.com/denoland/deno/issues/19510
This commit is contained in:
parent
805497a9a5
commit
01f0d03ae8
99 changed files with 422 additions and 554 deletions
|
@ -38,10 +38,7 @@ mod ts {
|
|||
fn op_build_info(state: &mut OpState) -> Value {
|
||||
let build_specifier = "asset:///bootstrap.ts";
|
||||
|
||||
let node_built_in_module_names = SUPPORTED_BUILTIN_NODE_MODULES
|
||||
.iter()
|
||||
.map(|p| p.module_name())
|
||||
.collect::<Vec<&str>>();
|
||||
let node_built_in_module_names = SUPPORTED_BUILTIN_NODE_MODULES.to_vec();
|
||||
let build_libs = state.borrow::<Vec<&str>>();
|
||||
json!({
|
||||
"buildSpecifier": build_specifier,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
import { Module } from "node:module";
|
||||
import { createRequire, Module } from "node:module";
|
||||
import {
|
||||
assert,
|
||||
assertEquals,
|
||||
|
@ -58,3 +58,18 @@ Deno.test("[node/module _nodeModulePaths] prevents duplicate root /node_modules"
|
|||
"Missing root 'node_modules' directory",
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test("Built-in Node modules have `node:` prefix", () => {
|
||||
let thrown = false;
|
||||
try {
|
||||
// @ts-ignore We want to explicitly test wrong call signature
|
||||
createRequire();
|
||||
} catch (e) {
|
||||
thrown = true;
|
||||
const stackLines = e.stack.split("\n");
|
||||
// Assert that built-in node modules have `node:<mod_name>` specifiers.
|
||||
assert(stackLines.some((line: string) => line.includes("(node:module:")));
|
||||
}
|
||||
|
||||
assert(thrown);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue