-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove imported ops from Deno.core.ops (#22194)
This commit adds a list of ops to `runtime/99_main.js` that are currently relying on getting them from `Deno.core.ops`. All ops that are not present in the list are removed from `Deno.core.ops` on startup (they are imported from "virtual op module" - `ext:core/ops`) making them effectively inaccessible to user code. This change lowers the number of ops exposed to user code from 650 to around 260. This number should be gradually decreased in follow-up PRs.
- Loading branch information
1 parent
7b74dde
commit ec36e9f
Showing
3 changed files
with
202 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | ||
|
||
const EXPECTED_OP_COUNT = 157; | ||
|
||
Deno.test(function checkExposedOps() { | ||
// @ts-ignore TS doesn't allow to index with symbol | ||
const core = Deno[Deno.internal].core; | ||
const opNames = Object.keys(core.ops); | ||
|
||
if (opNames.length !== EXPECTED_OP_COUNT) { | ||
throw new Error( | ||
`Expected ${EXPECTED_OP_COUNT} ops, but got ${opNames.length}:\n${ | ||
opNames.join("\n") | ||
}`, | ||
); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters