summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/bench/deno_common.js6
-rw-r--r--cli/bench/http/deno_http_ops.js2
-rw-r--r--cli/tests/testdata/bench/recursive_permissions_pledge.js6
-rw-r--r--cli/tests/testdata/op_exit_op_set_exit_code_in_worker.ts2
-rw-r--r--cli/tests/testdata/op_exit_op_set_exit_code_worker.js2
-rw-r--r--cli/tests/testdata/set_exit_code_0.ts2
-rw-r--r--cli/tests/testdata/set_exit_code_1.ts2
-rw-r--r--cli/tests/testdata/set_exit_code_2.ts2
-rw-r--r--cli/tests/testdata/test/recursive_permissions_pledge.js6
-rw-r--r--cli/tests/testdata/unstable_ffi_1.js2
-rw-r--r--cli/tests/testdata/unstable_ffi_10.js2
-rw-r--r--cli/tests/testdata/unstable_ffi_11.js2
-rw-r--r--cli/tests/testdata/unstable_ffi_12.js2
-rw-r--r--cli/tests/testdata/unstable_ffi_13.js2
-rw-r--r--cli/tests/testdata/unstable_ffi_14.js2
-rw-r--r--cli/tests/testdata/unstable_ffi_15.js2
-rw-r--r--cli/tests/testdata/unstable_ffi_2.js2
-rw-r--r--cli/tests/testdata/unstable_ffi_4.js2
-rw-r--r--cli/tests/testdata/unstable_ffi_5.js2
-rw-r--r--cli/tests/testdata/unstable_ffi_6.js2
-rw-r--r--cli/tests/testdata/unstable_ffi_7.js2
-rw-r--r--cli/tests/testdata/unstable_ffi_8.js2
-rw-r--r--cli/tests/testdata/unstable_ffi_9.js2
-rw-r--r--cli/tests/unit/opcall_test.ts2
-rw-r--r--cli/tsc/99_main_compiler.js32
-rw-r--r--cli/tsc/compiler.d.ts5
26 files changed, 48 insertions, 49 deletions
diff --git a/cli/bench/deno_common.js b/cli/bench/deno_common.js
index c31ccd981..abafdc519 100644
--- a/cli/bench/deno_common.js
+++ b/cli/bench/deno_common.js
@@ -6,7 +6,11 @@ Deno.bench("date_now", { n: 5e5 }, () => {
});
// Void ops measure op-overhead
-Deno.bench("op_void_sync", { n: 1e7 }, () => Deno.core.opSync("op_void_sync"));
+Deno.bench(
+ "op_void_sync",
+ { n: 1e7 },
+ () => Deno.core.ops.op_void_sync(),
+);
Deno.bench(
"op_void_async",
diff --git a/cli/bench/http/deno_http_ops.js b/cli/bench/http/deno_http_ops.js
index aac5cea72..f65b32170 100644
--- a/cli/bench/http/deno_http_ops.js
+++ b/cli/bench/http/deno_http_ops.js
@@ -19,7 +19,7 @@ class Http {
}
for await (const conn of tcp) {
- const id = Deno.core.opSync("op_http_start", conn.rid);
+ const id = Deno.core.ops.op_http_start(conn.rid);
const http = new Http(id);
(async () => {
for await (const req of http) {
diff --git a/cli/tests/testdata/bench/recursive_permissions_pledge.js b/cli/tests/testdata/bench/recursive_permissions_pledge.js
index dcdcbf574..dbba96f26 100644
--- a/cli/tests/testdata/bench/recursive_permissions_pledge.js
+++ b/cli/tests/testdata/bench/recursive_permissions_pledge.js
@@ -1,8 +1,6 @@
-Deno.core.opSync(
- "op_pledge_test_permissions",
+Deno.core.ops.op_pledge_test_permissions(
"none",
);
-Deno.core.opSync(
- "op_pledge_test_permissions",
+Deno.core.ops.op_pledge_test_permissions(
"inherit",
);
diff --git a/cli/tests/testdata/op_exit_op_set_exit_code_in_worker.ts b/cli/tests/testdata/op_exit_op_set_exit_code_in_worker.ts
index ddc0781eb..b2ed912de 100644
--- a/cli/tests/testdata/op_exit_op_set_exit_code_in_worker.ts
+++ b/cli/tests/testdata/op_exit_op_set_exit_code_in_worker.ts
@@ -3,7 +3,7 @@
// `self.close()`.
// @ts-ignore Deno.core doesn't have type-defs
-Deno.core.opSync("op_set_exit_code", 21);
+Deno.core.ops.op_set_exit_code(21);
const worker = new Worker(
import.meta.resolve("./op_exit_op_set_exit_code_worker.js"),
diff --git a/cli/tests/testdata/op_exit_op_set_exit_code_worker.js b/cli/tests/testdata/op_exit_op_set_exit_code_worker.js
index 54e5cd562..3e6055747 100644
--- a/cli/tests/testdata/op_exit_op_set_exit_code_worker.js
+++ b/cli/tests/testdata/op_exit_op_set_exit_code_worker.js
@@ -1,4 +1,4 @@
self.onmessage = () => {
- Deno.core.opSync("op_set_exit_code", 42);
+ Deno.core.ops.op_set_exit_code(42);
Deno.exit();
};
diff --git a/cli/tests/testdata/set_exit_code_0.ts b/cli/tests/testdata/set_exit_code_0.ts
index 7eb14fa3c..362a9f28a 100644
--- a/cli/tests/testdata/set_exit_code_0.ts
+++ b/cli/tests/testdata/set_exit_code_0.ts
@@ -1,2 +1,2 @@
-Deno.core.opSync("op_set_exit_code", 42);
+Deno.core.ops.op_set_exit_code(42);
Deno.exit(0); // Takes precedence.
diff --git a/cli/tests/testdata/set_exit_code_1.ts b/cli/tests/testdata/set_exit_code_1.ts
index 96ec9889c..b10863568 100644
--- a/cli/tests/testdata/set_exit_code_1.ts
+++ b/cli/tests/testdata/set_exit_code_1.ts
@@ -1,2 +1,2 @@
-Deno.core.opSync("op_set_exit_code", 42);
+Deno.core.ops.op_set_exit_code(42);
Deno.exit();
diff --git a/cli/tests/testdata/set_exit_code_2.ts b/cli/tests/testdata/set_exit_code_2.ts
index a1f2b5d3c..d68812cae 100644
--- a/cli/tests/testdata/set_exit_code_2.ts
+++ b/cli/tests/testdata/set_exit_code_2.ts
@@ -1,2 +1,2 @@
-Deno.core.opSync("op_set_exit_code", 42);
+Deno.core.ops.op_set_exit_code(42);
// Exits naturally.
diff --git a/cli/tests/testdata/test/recursive_permissions_pledge.js b/cli/tests/testdata/test/recursive_permissions_pledge.js
index dcdcbf574..dbba96f26 100644
--- a/cli/tests/testdata/test/recursive_permissions_pledge.js
+++ b/cli/tests/testdata/test/recursive_permissions_pledge.js
@@ -1,8 +1,6 @@
-Deno.core.opSync(
- "op_pledge_test_permissions",
+Deno.core.ops.op_pledge_test_permissions(
"none",
);
-Deno.core.opSync(
- "op_pledge_test_permissions",
+Deno.core.ops.op_pledge_test_permissions(
"inherit",
);
diff --git a/cli/tests/testdata/unstable_ffi_1.js b/cli/tests/testdata/unstable_ffi_1.js
index a24a00238..8ca6c3a60 100644
--- a/cli/tests/testdata/unstable_ffi_1.js
+++ b/cli/tests/testdata/unstable_ffi_1.js
@@ -1 +1 @@
-Deno.core.opSync("op_ffi_load", { path: "", symbols: {} });
+Deno.core.ops.op_ffi_load({ path: "", symbols: {} });
diff --git a/cli/tests/testdata/unstable_ffi_10.js b/cli/tests/testdata/unstable_ffi_10.js
index e8fc9b3f0..83687c584 100644
--- a/cli/tests/testdata/unstable_ffi_10.js
+++ b/cli/tests/testdata/unstable_ffi_10.js
@@ -1 +1 @@
-Deno.core.opSync("op_ffi_read_i16", 0n);
+Deno.core.ops.op_ffi_read_i16(0n);
diff --git a/cli/tests/testdata/unstable_ffi_11.js b/cli/tests/testdata/unstable_ffi_11.js
index 77c86109a..5538753be 100644
--- a/cli/tests/testdata/unstable_ffi_11.js
+++ b/cli/tests/testdata/unstable_ffi_11.js
@@ -1 +1 @@
-Deno.core.opSync("op_ffi_read_u32", 0n);
+Deno.core.ops.op_ffi_read_u32(0n);
diff --git a/cli/tests/testdata/unstable_ffi_12.js b/cli/tests/testdata/unstable_ffi_12.js
index 65934a82f..089c9b5b1 100644
--- a/cli/tests/testdata/unstable_ffi_12.js
+++ b/cli/tests/testdata/unstable_ffi_12.js
@@ -1 +1 @@
-Deno.core.opSync("op_ffi_read_i32", 0n);
+Deno.core.ops.op_ffi_read_i32(0n);
diff --git a/cli/tests/testdata/unstable_ffi_13.js b/cli/tests/testdata/unstable_ffi_13.js
index 0ab43781b..630be2e6d 100644
--- a/cli/tests/testdata/unstable_ffi_13.js
+++ b/cli/tests/testdata/unstable_ffi_13.js
@@ -1 +1 @@
-Deno.core.opSync("op_ffi_read_u64", 0n);
+Deno.core.ops.op_ffi_read_u64(0n);
diff --git a/cli/tests/testdata/unstable_ffi_14.js b/cli/tests/testdata/unstable_ffi_14.js
index b65a50a20..b04c7865e 100644
--- a/cli/tests/testdata/unstable_ffi_14.js
+++ b/cli/tests/testdata/unstable_ffi_14.js
@@ -1 +1 @@
-Deno.core.opSync("op_ffi_read_f32", 0n);
+Deno.core.ops.op_ffi_read_f32(0n);
diff --git a/cli/tests/testdata/unstable_ffi_15.js b/cli/tests/testdata/unstable_ffi_15.js
index de9f29168..865f63c75 100644
--- a/cli/tests/testdata/unstable_ffi_15.js
+++ b/cli/tests/testdata/unstable_ffi_15.js
@@ -1 +1 @@
-Deno.core.opSync("op_ffi_read_f64", 0n);
+Deno.core.ops.op_ffi_read_f64(0n);
diff --git a/cli/tests/testdata/unstable_ffi_2.js b/cli/tests/testdata/unstable_ffi_2.js
index fe3d9d709..7f3f34f37 100644
--- a/cli/tests/testdata/unstable_ffi_2.js
+++ b/cli/tests/testdata/unstable_ffi_2.js
@@ -1,4 +1,4 @@
-Deno.core.opSync("op_ffi_call_ptr", 0n, {
+Deno.core.ops.op_ffi_call_ptr(0n, {
name: null,
parameters: [],
result: "void",
diff --git a/cli/tests/testdata/unstable_ffi_4.js b/cli/tests/testdata/unstable_ffi_4.js
index 3e05bbf42..8b4f3d75a 100644
--- a/cli/tests/testdata/unstable_ffi_4.js
+++ b/cli/tests/testdata/unstable_ffi_4.js
@@ -1 +1 @@
-Deno.core.opSync("op_ffi_ptr_of", new Uint8Array(0));
+Deno.core.ops.op_ffi_ptr_of(new Uint8Array(0));
diff --git a/cli/tests/testdata/unstable_ffi_5.js b/cli/tests/testdata/unstable_ffi_5.js
index dc494023d..d08d8eaa4 100644
--- a/cli/tests/testdata/unstable_ffi_5.js
+++ b/cli/tests/testdata/unstable_ffi_5.js
@@ -1 +1 @@
-Deno.core.opSync("op_ffi_buf_copy_into", 0n, new Uint8Array(0), 0);
+Deno.core.ops.op_ffi_buf_copy_into(0n, new Uint8Array(0), 0);
diff --git a/cli/tests/testdata/unstable_ffi_6.js b/cli/tests/testdata/unstable_ffi_6.js
index c66681225..9e4f1c761 100644
--- a/cli/tests/testdata/unstable_ffi_6.js
+++ b/cli/tests/testdata/unstable_ffi_6.js
@@ -1 +1 @@
-Deno.core.opSync("op_ffi_cstr_read", 0n);
+Deno.core.ops.op_ffi_cstr_read(0n);
diff --git a/cli/tests/testdata/unstable_ffi_7.js b/cli/tests/testdata/unstable_ffi_7.js
index a0c27a71c..96e60f377 100644
--- a/cli/tests/testdata/unstable_ffi_7.js
+++ b/cli/tests/testdata/unstable_ffi_7.js
@@ -1 +1 @@
-Deno.core.opSync("op_ffi_read_u8", 0n);
+Deno.core.ops.op_ffi_read_u8(0n);
diff --git a/cli/tests/testdata/unstable_ffi_8.js b/cli/tests/testdata/unstable_ffi_8.js
index 7c51f8aa3..187b83891 100644
--- a/cli/tests/testdata/unstable_ffi_8.js
+++ b/cli/tests/testdata/unstable_ffi_8.js
@@ -1 +1 @@
-Deno.core.opSync("op_ffi_read_i8", 0n);
+Deno.core.ops.op_ffi_read_i8(0n);
diff --git a/cli/tests/testdata/unstable_ffi_9.js b/cli/tests/testdata/unstable_ffi_9.js
index 7798e4d2c..e968e534c 100644
--- a/cli/tests/testdata/unstable_ffi_9.js
+++ b/cli/tests/testdata/unstable_ffi_9.js
@@ -1 +1 @@
-Deno.core.opSync("op_ffi_read_u16", 0n);
+Deno.core.ops.op_ffi_read_u16(0n);
diff --git a/cli/tests/unit/opcall_test.ts b/cli/tests/unit/opcall_test.ts
index 5e783efc8..970731855 100644
--- a/cli/tests/unit/opcall_test.ts
+++ b/cli/tests/unit/opcall_test.ts
@@ -44,7 +44,7 @@ Deno.test(async function opsAsyncBadResource() {
Deno.test(function opsSyncBadResource() {
try {
const nonExistingRid = 9999;
- Deno.core.opSync("op_read_sync", nonExistingRid, new Uint8Array(0));
+ Deno.core.ops.op_read_sync(nonExistingRid, new Uint8Array(0));
} catch (e) {
if (!(e instanceof Deno.errors.BadResource)) {
throw e;
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js
index b1d62348b..ab43af38d 100644
--- a/cli/tsc/99_main_compiler.js
+++ b/cli/tsc/99_main_compiler.js
@@ -15,6 +15,7 @@ delete Object.prototype.__proto__;
((window) => {
/** @type {DenoCore} */
const core = window.Deno.core;
+ const ops = core.ops;
let logDebug = false;
let logSource = "JS";
@@ -250,7 +251,7 @@ delete Object.prototype.__proto__;
}
this.#lastCheckTimeMs = timeMs;
- return core.opSync("op_is_cancelled", {});
+ return ops.op_is_cancelled();
}
throwIfCancellationRequested() {
@@ -274,11 +275,11 @@ delete Object.prototype.__proto__;
fileExists(specifier) {
debug(`host.fileExists("${specifier}")`);
specifier = normalizedToOriginalMap.get(specifier) ?? specifier;
- return core.opSync("op_exists", { specifier });
+ return ops.op_exists({ specifier });
},
readFile(specifier) {
debug(`host.readFile("${specifier}")`);
- return core.opSync("op_load", { specifier }).data;
+ return ops.op_load({ specifier }).data;
},
getCancellationToken() {
// createLanguageService will call this immediately and cache it
@@ -309,8 +310,7 @@ delete Object.prototype.__proto__;
}
/** @type {{ data: string; scriptKind: ts.ScriptKind; version: string; }} */
- const { data, scriptKind, version } = core.opSync(
- "op_load",
+ const { data, scriptKind, version } = ops.op_load(
{ specifier },
);
assert(
@@ -338,14 +338,13 @@ delete Object.prototype.__proto__;
},
writeFile(fileName, data, _writeByteOrderMark, _onError, _sourceFiles) {
debug(`host.writeFile("${fileName}")`);
- return core.opSync(
- "op_emit",
+ return ops.op_emit(
{ fileName, data },
);
},
getCurrentDirectory() {
debug(`host.getCurrentDirectory()`);
- return cwd ?? core.opSync("op_cwd", null);
+ return cwd ?? ops.op_cwd();
},
getCanonicalFileName(fileName) {
return fileName;
@@ -361,7 +360,7 @@ delete Object.prototype.__proto__;
debug(` base: ${base}`);
debug(` specifiers: ${specifiers.join(", ")}`);
/** @type {Array<[string, ts.Extension] | undefined>} */
- const resolved = core.opSync("op_resolve", {
+ const resolved = ops.op_resolve({
specifiers,
base,
});
@@ -384,7 +383,7 @@ delete Object.prototype.__proto__;
}
},
createHash(data) {
- return core.opSync("op_create_hash", { data }).hash;
+ return ops.op_create_hash({ data }).hash;
},
// LanguageServiceHost
@@ -399,7 +398,7 @@ delete Object.prototype.__proto__;
if (scriptFileNamesCache) {
return scriptFileNamesCache;
}
- return scriptFileNamesCache = core.opSync("op_script_names", undefined);
+ return scriptFileNamesCache = ops.op_script_names();
},
getScriptVersion(specifier) {
debug(`host.getScriptVersion("${specifier}")`);
@@ -412,7 +411,7 @@ delete Object.prototype.__proto__;
if (scriptVersionCache.has(specifier)) {
return scriptVersionCache.get(specifier);
}
- const scriptVersion = core.opSync("op_script_version", { specifier });
+ const scriptVersion = ops.op_script_version({ specifier });
scriptVersionCache.set(specifier, scriptVersion);
return scriptVersion;
},
@@ -433,8 +432,7 @@ delete Object.prototype.__proto__;
};
}
- const fileInfo = core.opSync(
- "op_load",
+ const fileInfo = ops.op_load(
{ specifier },
);
if (fileInfo) {
@@ -567,7 +565,7 @@ delete Object.prototype.__proto__;
performanceProgram({ program });
- core.opSync("op_respond", {
+ ops.op_respond({
diagnostics: fromTypeScriptDiagnostic(diagnostics),
stats: performanceEnd(),
});
@@ -579,7 +577,7 @@ delete Object.prototype.__proto__;
* @param {any} data
*/
function respond(id, data = null) {
- core.opSync("op_respond", { id, data });
+ ops.op_respond({ id, data });
}
/**
@@ -942,7 +940,7 @@ delete Object.prototype.__proto__;
// ensure the snapshot is setup properly.
/** @type {{ buildSpecifier: string; libs: string[] }} */
- const { buildSpecifier, libs } = core.opSync("op_build_info", {});
+ const { buildSpecifier, libs } = ops.op_build_info();
for (const lib of libs) {
const specifier = `lib.${lib}.d.ts`;
// we are using internal APIs here to "inject" our custom libraries into
diff --git a/cli/tsc/compiler.d.ts b/cli/tsc/compiler.d.ts
index bf0660470..31c8b8c64 100644
--- a/cli/tsc/compiler.d.ts
+++ b/cli/tsc/compiler.d.ts
@@ -39,8 +39,9 @@ declare global {
encode(value: string): Uint8Array;
// deno-lint-ignore no-explicit-any
opSync<T>(name: string, params: T): any;
- ops(): void;
- print(msg: string, stderr: bool): void;
+ // deno-lint-ignore no-explicit-any
+ ops: Record<string, (...args: unknown[]) => any>;
+ print(msg: string, stderr: boolean): void;
registerErrorClass(
name: string,
Ctor: typeof Error,