mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 21:50:00 -05:00
refactor: remove Deno.core (#16881)
This commit removes "Deno.core" namespace. It is strictly private API that has no stability guarantees, we were supposed to remove it long time ago. Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
This commit is contained in:
parent
1084027d50
commit
abd9610530
43 changed files with 104 additions and 89 deletions
|
@ -16,5 +16,5 @@ async function bench(fun) {
|
|||
if (--total) queueMicrotask(() => bench(fun));
|
||||
}
|
||||
|
||||
const { ops } = Deno.core;
|
||||
const { ops } = Deno[Deno.internal].core;
|
||||
bench(() => ops.op_void_async());
|
||||
|
|
|
@ -8,7 +8,7 @@ Deno.bench("date_now", { n: 5e5 }, () => {
|
|||
// Fast API calls
|
||||
{
|
||||
// deno-lint-ignore camelcase
|
||||
const { op_add } = Deno.core.ops;
|
||||
const { op_add } = Deno[Deno.internal].core.ops;
|
||||
// deno-lint-ignore no-inner-declarations
|
||||
function add(a, b) {
|
||||
return op_add(a, b);
|
||||
|
@ -22,7 +22,7 @@ Deno.bench("date_now", { n: 5e5 }, () => {
|
|||
}
|
||||
|
||||
// deno-lint-ignore camelcase
|
||||
const { op_void_sync } = Deno.core.ops;
|
||||
const { op_void_sync } = Deno[Deno.internal].core.ops;
|
||||
function sync() {
|
||||
return op_void_sync();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ Deno.bench("op_void_sync", () => sync());
|
|||
Deno.bench(
|
||||
"op_void_async",
|
||||
{ n: 1e6 },
|
||||
() => Deno.core.opAsync("op_void_async"),
|
||||
() => Deno[Deno.internal].core.opAsync("op_void_async"),
|
||||
);
|
||||
|
||||
// A very lightweight op, that should be highly optimizable
|
||||
|
|
|
@ -3,12 +3,10 @@
|
|||
// deno-lint-ignore-file
|
||||
|
||||
const {
|
||||
core: {
|
||||
opAsync,
|
||||
ops: { op_flash_make_request, op_flash_serve },
|
||||
encode,
|
||||
},
|
||||
} = Deno;
|
||||
opAsync,
|
||||
ops: { op_flash_make_request, op_flash_serve },
|
||||
encode,
|
||||
} = Deno[Deno.internal].core;
|
||||
const addr = Deno.args[0] || "127.0.0.1:4500";
|
||||
const [hostname, port] = addr.split(":");
|
||||
const serverId = op_flash_serve({ hostname, port, reuseport: true });
|
||||
|
|
|
@ -13,7 +13,10 @@ class Http {
|
|||
[Symbol.asyncIterator]() {
|
||||
return {
|
||||
next: async () => {
|
||||
const reqEvt = await Deno.core.opAsync("op_http_accept", this.id);
|
||||
const reqEvt = await Deno[Deno.internal].core.opAsync(
|
||||
"op_http_accept",
|
||||
this.id,
|
||||
);
|
||||
return { value: reqEvt ?? undefined, done: reqEvt === null };
|
||||
},
|
||||
};
|
||||
|
@ -21,20 +24,20 @@ class Http {
|
|||
}
|
||||
|
||||
for await (const conn of tcp) {
|
||||
const id = Deno.core.ops.op_http_start(conn.rid);
|
||||
const id = Deno[Deno.internal].core.ops.op_http_start(conn.rid);
|
||||
const http = new Http(id);
|
||||
(async () => {
|
||||
for await (const req of http) {
|
||||
if (req == null) continue;
|
||||
const { 0: stream } = req;
|
||||
await Deno.core.opAsync(
|
||||
await Deno[Deno.internal].core.opAsync(
|
||||
"op_http_write_headers",
|
||||
stream,
|
||||
200,
|
||||
[],
|
||||
"Hello World",
|
||||
);
|
||||
Deno.core.close(stream);
|
||||
Deno[Deno.internal].core.close(stream);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
|
4
cli/bench/testdata/deno_upgrade_http.js
vendored
4
cli/bench/testdata/deno_upgrade_http.js
vendored
|
@ -1,5 +1,7 @@
|
|||
const { serve, upgradeHttpRaw } = Deno;
|
||||
const u8 = Deno.core.encode("HTTP/1.1 101 Switching Protocols\r\n\r\n");
|
||||
const u8 = Deno[Deno.internal].core.encode(
|
||||
"HTTP/1.1 101 Switching Protocols\r\n\r\n",
|
||||
);
|
||||
|
||||
async function handler(req) {
|
||||
const [conn, _firstPacket] = upgradeHttpRaw(req);
|
||||
|
|
|
@ -318,7 +318,7 @@ async fn inspector_break_on_first_line() {
|
|||
"id":4,
|
||||
"method":"Runtime.evaluate",
|
||||
"params":{
|
||||
"expression":"Deno.core.print(\"hello from the inspector\\n\")",
|
||||
"expression":"Deno[Deno.internal].core.print(\"hello from the inspector\\n\")",
|
||||
"contextId":1,
|
||||
"includeCommandLineAPI":true,
|
||||
"silent":false,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Deno.core.ops.op_pledge_test_permissions(
|
||||
Deno[Deno.internal].core.ops.op_pledge_test_permissions(
|
||||
"none",
|
||||
);
|
||||
Deno.core.ops.op_pledge_test_permissions(
|
||||
Deno[Deno.internal].core.ops.op_pledge_test_permissions(
|
||||
"inherit",
|
||||
);
|
||||
|
|
|
@ -4,7 +4,7 @@ function childProcessFork(path) {
|
|||
const p = Deno.run({
|
||||
cmd: [Deno.execPath(), "run", "--unstable", "-A", path],
|
||||
env: {
|
||||
"DENO_DONT_USE_INTERNAL_NODE_COMPAT_STATE": Deno.core.ops.op_npm_process_state(),
|
||||
"DENO_DONT_USE_INTERNAL_NODE_COMPAT_STATE": Deno[Deno.internal].core.ops.op_npm_process_state(),
|
||||
}
|
||||
});
|
||||
p.status().then(() => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// @ts-expect-error "Deno.core" is not a public interface
|
||||
Deno.core.evalContext(
|
||||
// @ts-expect-error "Deno[Deno.internal].core" is not a public interface
|
||||
Deno[Deno.internal].core.evalContext(
|
||||
"(async () => console.log(await import('./subdir/mod4.js')))()",
|
||||
);
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
const [, errorInfo] = Deno.core.evalContext('throw new DOMException("foo")');
|
||||
const [, errorInfo] = Deno[Deno.internal].core.evalContext(
|
||||
'throw new DOMException("foo")',
|
||||
);
|
||||
console.log(errorInfo);
|
||||
|
|
|
@ -4,9 +4,9 @@ addEventListener("foo", () => {
|
|||
throw new Error("bar");
|
||||
});
|
||||
console.log(1);
|
||||
// @ts-ignore Deno.core
|
||||
Deno.core.setNextTickCallback(() => console.log("nextTick"));
|
||||
// @ts-ignore Deno.core
|
||||
Deno.core.setHasTickScheduled(true);
|
||||
// @ts-ignore Deno[Deno.internal].core
|
||||
Deno[Deno.internal].core.setNextTickCallback(() => console.log("nextTick"));
|
||||
// @ts-ignore Deno[Deno.internal].core
|
||||
Deno[Deno.internal].core.setHasTickScheduled(true);
|
||||
dispatchEvent(new CustomEvent("foo"));
|
||||
console.log(2);
|
||||
|
|
2
cli/tests/testdata/run/ffi/unstable_ffi_1.js
vendored
2
cli/tests/testdata/run/ffi/unstable_ffi_1.js
vendored
|
@ -1 +1 @@
|
|||
Deno.core.ops.op_ffi_load({ path: "", symbols: {} });
|
||||
Deno[Deno.internal].core.ops.op_ffi_load({ path: "", symbols: {} });
|
||||
|
|
|
@ -1 +1 @@
|
|||
Deno.core.ops.op_ffi_read_i16(0n, 0);
|
||||
Deno[Deno.internal].core.ops.op_ffi_read_i16(0n, 0);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Deno.core.ops.op_ffi_read_u32(0n, 0);
|
||||
Deno[Deno.internal].core.ops.op_ffi_read_u32(0n, 0);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Deno.core.ops.op_ffi_read_i32(0n, 0);
|
||||
Deno[Deno.internal].core.ops.op_ffi_read_i32(0n, 0);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Deno.core.ops.op_ffi_read_u64(0n, 0, new Uint32Array(2));
|
||||
Deno[Deno.internal].core.ops.op_ffi_read_u64(0n, 0, new Uint32Array(2));
|
||||
|
|
|
@ -1 +1 @@
|
|||
Deno.core.ops.op_ffi_read_f32(0n, 0);
|
||||
Deno[Deno.internal].core.ops.op_ffi_read_f32(0n, 0);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Deno.core.ops.op_ffi_read_f64(0n, 0);
|
||||
Deno[Deno.internal].core.ops.op_ffi_read_f64(0n, 0);
|
||||
|
|
2
cli/tests/testdata/run/ffi/unstable_ffi_2.js
vendored
2
cli/tests/testdata/run/ffi/unstable_ffi_2.js
vendored
|
@ -1,4 +1,4 @@
|
|||
Deno.core.ops.op_ffi_call_ptr(0n, {
|
||||
Deno[Deno.internal].core.ops.op_ffi_call_ptr(0n, {
|
||||
name: null,
|
||||
parameters: [],
|
||||
result: "void",
|
||||
|
|
2
cli/tests/testdata/run/ffi/unstable_ffi_3.js
vendored
2
cli/tests/testdata/run/ffi/unstable_ffi_3.js
vendored
|
@ -1,4 +1,4 @@
|
|||
Deno.core.opAsync("op_ffi_call_ptr_nonblocking", 0n, {
|
||||
Deno[Deno.internal].core.opAsync("op_ffi_call_ptr_nonblocking", 0n, {
|
||||
name: null,
|
||||
parameters: [],
|
||||
result: "void",
|
||||
|
|
5
cli/tests/testdata/run/ffi/unstable_ffi_4.js
vendored
5
cli/tests/testdata/run/ffi/unstable_ffi_4.js
vendored
|
@ -1 +1,4 @@
|
|||
Deno.core.ops.op_ffi_ptr_of(new Uint8Array(0), new Uint32Array(2));
|
||||
Deno[Deno.internal].core.ops.op_ffi_ptr_of(
|
||||
new Uint8Array(0),
|
||||
new Uint32Array(2),
|
||||
);
|
||||
|
|
2
cli/tests/testdata/run/ffi/unstable_ffi_5.js
vendored
2
cli/tests/testdata/run/ffi/unstable_ffi_5.js
vendored
|
@ -1 +1 @@
|
|||
Deno.core.ops.op_ffi_buf_copy_into(0n, 0, new Uint8Array(0), 0);
|
||||
Deno[Deno.internal].core.ops.op_ffi_buf_copy_into(0n, 0, new Uint8Array(0), 0);
|
||||
|
|
2
cli/tests/testdata/run/ffi/unstable_ffi_6.js
vendored
2
cli/tests/testdata/run/ffi/unstable_ffi_6.js
vendored
|
@ -1 +1 @@
|
|||
Deno.core.ops.op_ffi_cstr_read(0n, 0);
|
||||
Deno[Deno.internal].core.ops.op_ffi_cstr_read(0n, 0);
|
||||
|
|
2
cli/tests/testdata/run/ffi/unstable_ffi_7.js
vendored
2
cli/tests/testdata/run/ffi/unstable_ffi_7.js
vendored
|
@ -1 +1 @@
|
|||
Deno.core.ops.op_ffi_read_u8(0n, 0);
|
||||
Deno[Deno.internal].core.ops.op_ffi_read_u8(0n, 0);
|
||||
|
|
2
cli/tests/testdata/run/ffi/unstable_ffi_8.js
vendored
2
cli/tests/testdata/run/ffi/unstable_ffi_8.js
vendored
|
@ -1 +1 @@
|
|||
Deno.core.ops.op_ffi_read_i8(0n, 0);
|
||||
Deno[Deno.internal].core.ops.op_ffi_read_i8(0n, 0);
|
||||
|
|
2
cli/tests/testdata/run/ffi/unstable_ffi_9.js
vendored
2
cli/tests/testdata/run/ffi/unstable_ffi_9.js
vendored
|
@ -1 +1 @@
|
|||
Deno.core.ops.op_ffi_read_u16(0n, 0);
|
||||
Deno[Deno.internal].core.ops.op_ffi_read_u16(0n, 0);
|
||||
|
|
|
@ -8,7 +8,7 @@ function assertEquals(a, b) {
|
|||
|
||||
const registry = new FinalizationRegistry((value) => {
|
||||
assertEquals(value, "called!");
|
||||
Deno.core.print("FinalizationRegistry called!\n");
|
||||
Deno[Deno.internal].core.print("FinalizationRegistry called!\n");
|
||||
});
|
||||
|
||||
(function () {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// setting exit code in worker context is a no-op and is an alias for
|
||||
// `self.close()`.
|
||||
|
||||
// @ts-ignore Deno.core doesn't have type-defs
|
||||
Deno.core.ops.op_set_exit_code(21);
|
||||
// @ts-ignore Deno[Deno.internal].core doesn't have type-defs
|
||||
Deno[Deno.internal].core.ops.op_set_exit_code(21);
|
||||
|
||||
const worker = new Worker(
|
||||
import.meta.resolve("./op_exit_op_set_exit_code_worker.js"),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
self.onmessage = () => {
|
||||
Deno.core.ops.op_set_exit_code(42);
|
||||
Deno[Deno.internal].core.ops.op_set_exit_code(42);
|
||||
Deno.exit();
|
||||
};
|
||||
|
|
2
cli/tests/testdata/run/set_exit_code_0.ts
vendored
2
cli/tests/testdata/run/set_exit_code_0.ts
vendored
|
@ -1,2 +1,2 @@
|
|||
Deno.core.ops.op_set_exit_code(42);
|
||||
Deno[Deno.internal].core.ops.op_set_exit_code(42);
|
||||
Deno.exit(0); // Takes precedence.
|
||||
|
|
2
cli/tests/testdata/run/set_exit_code_1.ts
vendored
2
cli/tests/testdata/run/set_exit_code_1.ts
vendored
|
@ -1,2 +1,2 @@
|
|||
Deno.core.ops.op_set_exit_code(42);
|
||||
Deno[Deno.internal].core.ops.op_set_exit_code(42);
|
||||
Deno.exit();
|
||||
|
|
2
cli/tests/testdata/run/set_exit_code_2.ts
vendored
2
cli/tests/testdata/run/set_exit_code_2.ts
vendored
|
@ -1,2 +1,2 @@
|
|||
Deno.core.ops.op_set_exit_code(42);
|
||||
Deno[Deno.internal].core.ops.op_set_exit_code(42);
|
||||
// Exits naturally.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Deno.core.ops.op_pledge_test_permissions(
|
||||
Deno[Deno.internal].core.ops.op_pledge_test_permissions(
|
||||
"none",
|
||||
);
|
||||
Deno.core.ops.op_pledge_test_permissions(
|
||||
Deno[Deno.internal].core.ops.op_pledge_test_permissions(
|
||||
"inherit",
|
||||
);
|
||||
|
|
|
@ -71,12 +71,8 @@ Deno.test(function webAssemblyExists() {
|
|||
assert(typeof WebAssembly.compile === "function");
|
||||
});
|
||||
|
||||
declare global {
|
||||
namespace Deno {
|
||||
// deno-lint-ignore no-explicit-any, no-var
|
||||
var core: any;
|
||||
}
|
||||
}
|
||||
// @ts-ignore This is not publicly typed namespace, but it's there for sure.
|
||||
const core = Deno[Deno.internal].core;
|
||||
|
||||
Deno.test(function DenoNamespaceConfigurable() {
|
||||
const desc = Object.getOwnPropertyDescriptor(globalThis, "Deno");
|
||||
|
@ -86,19 +82,19 @@ Deno.test(function DenoNamespaceConfigurable() {
|
|||
});
|
||||
|
||||
Deno.test(function DenoCoreNamespaceIsImmutable() {
|
||||
const { print } = Deno.core;
|
||||
const { print } = core;
|
||||
try {
|
||||
Deno.core.print = 1;
|
||||
core.print = 1;
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
assert(print === Deno.core.print);
|
||||
assert(print === core.print);
|
||||
try {
|
||||
delete Deno.core.print;
|
||||
delete core.print;
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
assert(print === Deno.core.print);
|
||||
assert(print === core.print);
|
||||
});
|
||||
|
||||
Deno.test(async function windowQueueMicrotask() {
|
||||
|
|
|
@ -77,13 +77,15 @@ Deno.test(function metricsForOpCrates() {
|
|||
assert(m1.opsCompleted > 0);
|
||||
});
|
||||
|
||||
// Test that op_names == Objects.keys(Deno.core.ops)
|
||||
// Test that op_names == Objects.keys(Deno[Deno.internal].core.ops)
|
||||
// since building the per-op metrics depends on op_names being complete
|
||||
Deno.test(function opNamesMatch() {
|
||||
assertEquals(
|
||||
// @ts-ignore: Deno.core allowed
|
||||
Deno.core.opNames().sort(),
|
||||
// @ts-ignore: Deno.core allowed
|
||||
Object.keys(Deno.core.ops).sort().filter((name) => name !== "asyncOpsInfo"),
|
||||
// @ts-ignore: Deno[Deno.internal].core allowed
|
||||
Deno[Deno.internal].core.opNames().sort(),
|
||||
// @ts-ignore: Deno[Deno.internal].core allowed
|
||||
Object.keys(Deno[Deno.internal].core.ops).sort().filter((name) =>
|
||||
name !== "asyncOpsInfo"
|
||||
),
|
||||
);
|
||||
});
|
||||
|
|
|
@ -22,17 +22,13 @@ Deno.test(async function sendAsyncStackTrace() {
|
|||
}
|
||||
});
|
||||
|
||||
declare global {
|
||||
namespace Deno {
|
||||
// deno-lint-ignore no-explicit-any, no-var
|
||||
var core: any;
|
||||
}
|
||||
}
|
||||
// @ts-ignore This is not publicly typed namespace, but it's there for sure.
|
||||
const core = Deno[Deno.internal].core;
|
||||
|
||||
Deno.test(async function opsAsyncBadResource() {
|
||||
try {
|
||||
const nonExistingRid = 9999;
|
||||
await Deno.core.read(
|
||||
await core.read(
|
||||
nonExistingRid,
|
||||
new Uint8Array(0),
|
||||
);
|
||||
|
@ -46,7 +42,10 @@ Deno.test(async function opsAsyncBadResource() {
|
|||
Deno.test(function opsSyncBadResource() {
|
||||
try {
|
||||
const nonExistingRid = 9999;
|
||||
Deno.core.ops.op_read_sync(nonExistingRid, new Uint8Array(0));
|
||||
core.ops.op_read_sync(
|
||||
nonExistingRid,
|
||||
new Uint8Array(0),
|
||||
);
|
||||
} catch (e) {
|
||||
if (!(e instanceof Deno.errors.BadResource)) {
|
||||
throw e;
|
||||
|
|
|
@ -12,8 +12,8 @@ function monitorPromises(outputArray: string[]) {
|
|||
return promiseIds.get(promise);
|
||||
}
|
||||
|
||||
// @ts-ignore: Deno.core allowed
|
||||
Deno.core.setPromiseHooks(
|
||||
// @ts-ignore: Deno[Deno.internal].core allowed
|
||||
Deno[Deno.internal].core.setPromiseHooks(
|
||||
(promise: Promise<unknown>, parentPromise?: Promise<unknown>) => {
|
||||
outputArray.push(
|
||||
`init ${identify(promise)}` +
|
||||
|
|
|
@ -4,7 +4,7 @@ import { assertNotEquals, execCode } from "./test_util.ts";
|
|||
|
||||
Deno.test("[unrefOp] unref'ing invalid ops does not have effects", async () => {
|
||||
const [statusCode, _] = await execCode(`
|
||||
Deno.core.unrefOp(-1);
|
||||
Deno[Deno.internal].core.unrefOp(-1);
|
||||
setTimeout(() => { throw new Error() }, 10)
|
||||
`);
|
||||
// Invalid unrefOp call doesn't affect exit condition of event loop
|
||||
|
|
|
@ -264,8 +264,8 @@ Deno.test(function textEncoderShouldCoerceToString() {
|
|||
});
|
||||
|
||||
Deno.test(function binaryEncode() {
|
||||
// @ts-ignore: Deno.core allowed
|
||||
const ops = Deno.core.ops;
|
||||
// @ts-ignore: Deno[Deno.internal].core allowed
|
||||
const ops = Deno[Deno.internal].core.ops;
|
||||
function asBinaryString(bytes: Uint8Array): string {
|
||||
return Array.from(bytes).map(
|
||||
(v: number) => String.fromCodePoint(v),
|
||||
|
|
|
@ -186,7 +186,7 @@ impl CliMainWorker {
|
|||
if self.ps.options.trace_ops() {
|
||||
self.worker.js_runtime.execute_script(
|
||||
&located_script_name!(),
|
||||
"Deno.core.enableOpCallTracing();",
|
||||
"Deno[Deno.internal].core.enableOpCallTracing();",
|
||||
)?;
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ impl CliMainWorker {
|
|||
|
||||
self.worker.execute_script(
|
||||
&located_script_name!(),
|
||||
"Deno.core.enableOpCallTracing();",
|
||||
"Deno[Deno.internal].core.enableOpCallTracing();",
|
||||
)?;
|
||||
|
||||
if mode != TestMode::Documentation {
|
||||
|
|
|
@ -485,8 +485,14 @@ delete Intl.v8BreakIterator;
|
|||
},
|
||||
});
|
||||
|
||||
const finalDenoNs = {
|
||||
// FIXME(bartlomieju): temporarily add whole `Deno.core` to
|
||||
// `Deno[Deno.internal]` namespace. It should be removed and only necessary
|
||||
// methods should be left there.
|
||||
ObjectAssign(internals, {
|
||||
core,
|
||||
});
|
||||
|
||||
const finalDenoNs = {
|
||||
internal: internalSymbol,
|
||||
[internalSymbol]: internals,
|
||||
resources: core.resources,
|
||||
|
@ -524,7 +530,6 @@ delete Intl.v8BreakIterator;
|
|||
// Setup `Deno` global - we're actually overriding already existing global
|
||||
// `Deno` with `Deno` namespace from "./deno.ts".
|
||||
ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));
|
||||
ObjectFreeze(globalThis.Deno.core);
|
||||
|
||||
util.log("args", runtimeOptions.args);
|
||||
}
|
||||
|
@ -625,8 +630,14 @@ delete Intl.v8BreakIterator;
|
|||
},
|
||||
});
|
||||
|
||||
const finalDenoNs = {
|
||||
// FIXME(bartlomieju): temporarily add whole `Deno.core` to
|
||||
// `Deno[Deno.internal]` namespace. It should be removed and only necessary
|
||||
// methods should be left there.
|
||||
ObjectAssign(internals, {
|
||||
core,
|
||||
});
|
||||
|
||||
const finalDenoNs = {
|
||||
internal: internalSymbol,
|
||||
[internalSymbol]: internals,
|
||||
resources: core.resources,
|
||||
|
@ -660,7 +671,6 @@ delete Intl.v8BreakIterator;
|
|||
// Setup `Deno` global - we're actually overriding already
|
||||
// existing global `Deno` with `Deno` namespace from "./deno.ts".
|
||||
ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));
|
||||
ObjectFreeze(globalThis.Deno.core);
|
||||
}
|
||||
|
||||
ObjectDefineProperties(globalThis, {
|
||||
|
|
|
@ -17,5 +17,5 @@ const [libPrefix, libSuffix] = {
|
|||
|
||||
export function loadTestLibrary() {
|
||||
const specifier = `${targetDir}/${libPrefix}test_napi.${libSuffix}`;
|
||||
return Deno.core.ops.op_napi_open(specifier); // Internal, used in ext/node
|
||||
return Deno[Deno.internal].core.ops.op_napi_open(specifier); // Internal, used in ext/node
|
||||
}
|
||||
|
|
|
@ -185,9 +185,9 @@ async function generateBundle(location: URL): Promise<string> {
|
|||
|
||||
return scriptContents.map(([url, contents]) => `
|
||||
(function() {
|
||||
const [_,err] = Deno.core.evalContext(${JSON.stringify(contents)}, ${
|
||||
JSON.stringify(url)
|
||||
});
|
||||
const [_,err] = Deno[Deno.internal].core.evalContext(${
|
||||
JSON.stringify(contents)
|
||||
}, ${JSON.stringify(url)});
|
||||
if (err !== null) {
|
||||
throw err?.thrown;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue