mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-07 08:33:50 +08:00
Sort the runtime feature lists (#1569)
This commit is contained in:
@@ -32,95 +32,95 @@ export const DYN_BUFFER_NUM_METHODS: ReadonlySet<string> = new Set(
|
||||
|
||||
const DYN_ASYNC_LIB_FNS: ReadonlySet<IrLibFn> = new Set([
|
||||
// DEP0040 rides the dyn-async unit's warning machinery.
|
||||
"punycode.warn",
|
||||
"fs.callbackValue",
|
||||
"fs.callbackCall",
|
||||
"fs.callbackGlob",
|
||||
"async.awaitDyn",
|
||||
"timers.immediatePromise",
|
||||
"crypto.native",
|
||||
"dyn.promiseAll",
|
||||
"dyn.promiseAllSettled",
|
||||
"dyn.promiseAny",
|
||||
"dyn.promiseResolve",
|
||||
"process.onUncaughtException",
|
||||
"process.offUncaughtException",
|
||||
"process.onUnhandledRejection",
|
||||
"process.offUnhandledRejection",
|
||||
"process.onRejectionHandled",
|
||||
"process.offRejectionHandled",
|
||||
"process.onWarning",
|
||||
"process.offWarning",
|
||||
"fs.callbackCall",
|
||||
"fs.callbackGlob",
|
||||
"fs.callbackValue",
|
||||
"process.deprecationFlag",
|
||||
"process.emitWarning",
|
||||
"process.emitWarningText",
|
||||
"process.deprecationFlag",
|
||||
"process.offRejectionHandled",
|
||||
"process.offUncaughtException",
|
||||
"process.offUnhandledRejection",
|
||||
"process.offWarning",
|
||||
"process.onRejectionHandled",
|
||||
"process.onUncaughtException",
|
||||
"process.onUnhandledRejection",
|
||||
"process.onWarning",
|
||||
"process.setDeprecationFlag",
|
||||
"process.setEmitWarning",
|
||||
"punycode.warn",
|
||||
"timers.immediatePromise",
|
||||
// The performance timeline (scr_perf.c, linked with this unit for its
|
||||
// MaxPerformanceEntryBufferExceededWarning).
|
||||
"perf.mark",
|
||||
"perf.measure",
|
||||
"perf.entries",
|
||||
"perf.clearMarks",
|
||||
"perf.clearMeasures",
|
||||
"perf.entryName",
|
||||
"perf.entryType",
|
||||
"perf.entryStart",
|
||||
"perf.entryDuration",
|
||||
"perf.entries",
|
||||
"perf.entryDetail",
|
||||
"perf.entryDuration",
|
||||
"perf.entryKeep",
|
||||
"perf.entryName",
|
||||
"perf.entryRef",
|
||||
"perf.entryStart",
|
||||
"perf.entryType",
|
||||
"perf.mark",
|
||||
"perf.measure",
|
||||
// Blob and File (scr_blob.c, linked with this unit, which boxes their
|
||||
// reads as dyn promises).
|
||||
"blob.new",
|
||||
"als.disable",
|
||||
"als.enterWith",
|
||||
"als.exitRun",
|
||||
"als.get",
|
||||
"als.new",
|
||||
"als.run",
|
||||
"blob.arrayBuffer",
|
||||
"blob.bytes",
|
||||
"blob.fileNew",
|
||||
"blob.is",
|
||||
"blob.new",
|
||||
"blob.slice",
|
||||
"blob.text",
|
||||
"blob.bytes",
|
||||
"blob.arrayBuffer",
|
||||
"blob.is",
|
||||
"util.styleText",
|
||||
"util.inherits",
|
||||
"util.deprecate",
|
||||
"dc.chanBindStore",
|
||||
"dc.chanRunStores",
|
||||
"dc.chanUnbindStore",
|
||||
"util.callbackify",
|
||||
"util.debuglog",
|
||||
"als.new",
|
||||
"als.get",
|
||||
"als.run",
|
||||
"als.exitRun",
|
||||
"als.enterWith",
|
||||
"als.disable",
|
||||
"dc.chanBindStore",
|
||||
"dc.chanUnbindStore",
|
||||
"dc.chanRunStores",
|
||||
"util.deprecate",
|
||||
"util.inherits",
|
||||
"util.styleText",
|
||||
]);
|
||||
|
||||
/** The libCalls that enter AsyncLocalStorage stores (RuntimeFeatures
|
||||
* asyncContext). */
|
||||
const ASYNC_CONTEXT_LIB_FNS: ReadonlySet<IrLibFn> = new Set([
|
||||
"als.run",
|
||||
"als.exitRun",
|
||||
"als.enterWith",
|
||||
"als.exitRun",
|
||||
"als.run",
|
||||
"dc.chanBindStore",
|
||||
"dc.chanRunStores",
|
||||
// getTestContext() reads the test runner's entry in the same snapshot.
|
||||
"test.hasContext",
|
||||
"test.context",
|
||||
"test.hasContext",
|
||||
]);
|
||||
|
||||
const LEGACY_URL_LIB_FNS: ReadonlySet<IrLibFn> = new Set([
|
||||
"url.legacyParse",
|
||||
"url.legacyFormat",
|
||||
"url.legacyResolve",
|
||||
"url.domainToASCII",
|
||||
"url.domainToUnicode",
|
||||
"url.legacyFormat",
|
||||
"url.legacyParse",
|
||||
"url.legacyResolve",
|
||||
]);
|
||||
|
||||
const UTIL_CALLABLE_LIB_FNS: ReadonlySet<IrLibFn> = new Set([
|
||||
"util.inherits",
|
||||
"util.deprecate",
|
||||
"util.callbackify",
|
||||
"util.debuglog",
|
||||
"util.deprecate",
|
||||
"util.inherits",
|
||||
]);
|
||||
|
||||
/** Entry points that link the regex unit: the regex and glob matchers (fs.glob's walk compiles its patterns with the glob matcher), and readline's terminal unit (scr_readline_tty.c), which measures with the regex unit's stripVTControlCharacters. */
|
||||
@@ -188,14 +188,14 @@ const STREAM_LIB_FNS: ReadonlySet<IrLibFn> = new Set([
|
||||
"stream.addAbortSignalFn",
|
||||
"stream.destroy",
|
||||
"stream.destroyErr",
|
||||
"stream.errored",
|
||||
"stream.prop",
|
||||
"stream.dynNative",
|
||||
"stream.dynNativePipe",
|
||||
"stream.errored",
|
||||
"stream.pipeDyn",
|
||||
"stream.unpipeDyn",
|
||||
"stream.prop",
|
||||
"stream.stdioWritable",
|
||||
"stream.unboxDyn",
|
||||
"stream.unpipeDyn",
|
||||
"stream.workerStdio",
|
||||
]);
|
||||
|
||||
@@ -230,10 +230,6 @@ const READABLE_DYN_ASYNC_PREFIXES: readonly string[] = ["readable.fromGen", "rea
|
||||
|
||||
/** Entry points that link the dyn-invoke unit. */
|
||||
const DYN_INVOKE_LIB_FNS: ReadonlySet<IrLibFn> = new Set([
|
||||
"stream.dynNative",
|
||||
"stream.dynNativePipe",
|
||||
"stream.pipeDyn",
|
||||
"stream.unpipeDyn",
|
||||
"dyn.arrayProtoCall",
|
||||
"dyn.arrayPrototype",
|
||||
"dyn.builtinFunction",
|
||||
@@ -245,6 +241,10 @@ const DYN_INVOKE_LIB_FNS: ReadonlySet<IrLibFn> = new Set([
|
||||
"dyn.globalConstructor",
|
||||
"dyn.objCreateWithProperties",
|
||||
"dyn.objectTag",
|
||||
"stream.dynNative",
|
||||
"stream.dynNativePipe",
|
||||
"stream.pipeDyn",
|
||||
"stream.unpipeDyn",
|
||||
]);
|
||||
|
||||
/** Member names whose constant-key dynamic reads answer the inherited Object.prototype member through the dyn-invoke unit. Mirrors expr-dynamic.ts INHERITED_OBJECT_MEMBERS (the IR layer does not import the backend). */
|
||||
@@ -279,8 +279,8 @@ const CHILD_PROCESS_LIB_PREFIXES: readonly string[] = ["child.", "cp.", "spawnRe
|
||||
const BUILTIN_CLASS_LIB_FNS: readonly IrLibFn[] = [
|
||||
"dyn.builtinClass",
|
||||
// the stream classes, through scr_dyn_builtin_stream.c
|
||||
"dyn.builtinStreamClass",
|
||||
"dyn.builtinInstanceOf",
|
||||
"dyn.builtinStreamClass",
|
||||
"dyn.functionInstanceOf",
|
||||
];
|
||||
|
||||
@@ -408,64 +408,64 @@ function boxesPromise(t: IrType, tables: TypeTables, seen: Set<string>): boolean
|
||||
/** The libCall fns served by the OPTIONAL events unit (scr_events.c):
|
||||
* process signal/exit listeners and the piped-stdin surface. */
|
||||
const PROCESS_EVENT_LIB_FNS: ReadonlySet<IrLibFn> = new Set([
|
||||
"process.stdio",
|
||||
"process.onSignal",
|
||||
"process.offExit",
|
||||
"process.offSignal",
|
||||
"process.onExit",
|
||||
"process.offExit",
|
||||
"process.onSignal",
|
||||
"process.stdio",
|
||||
"stdin.nextChunk",
|
||||
"stdin.onData",
|
||||
"stdin.onEnd",
|
||||
"stdin.onError",
|
||||
"stdin.nextChunk",
|
||||
// node:readline rides the stdin unit (scr_readline.c links beside
|
||||
// scr_events.c under the same gate).
|
||||
"rl.checkCompleter",
|
||||
"rl.checkOptions",
|
||||
"rl.close",
|
||||
"rl.create",
|
||||
"rl.createSignal",
|
||||
"rl.question",
|
||||
"rl.questionAsync",
|
||||
"rl.questionAsyncSignal",
|
||||
"rl.questionDyn",
|
||||
"rl.questionAsyncDyn",
|
||||
"rl.questionAsyncSignalDyn",
|
||||
"rl.close",
|
||||
"rl.pause",
|
||||
"rl.resume",
|
||||
"rl.prompt",
|
||||
"rl.promptWith",
|
||||
"rl.setPrompt",
|
||||
"rl.setPromptDyn",
|
||||
"rl.getPrompt",
|
||||
"rl.write",
|
||||
"rl.writeKey",
|
||||
"rl.on",
|
||||
"rl.iterOpen",
|
||||
"rl.iterNext",
|
||||
"rl.iterReturn",
|
||||
"rl.checkOptions",
|
||||
"rl.checkCompleter",
|
||||
"rl.setOptions",
|
||||
"rl.setHistory",
|
||||
"rl.history",
|
||||
"rl.numProp",
|
||||
"rl.terminal",
|
||||
"rl.line",
|
||||
"rl.isTerminal",
|
||||
"rl.isPromises",
|
||||
"rl.cursor",
|
||||
"rl.seq",
|
||||
"rl.moves",
|
||||
"rl.cursorPos",
|
||||
"rl.getPrompt",
|
||||
"rl.history",
|
||||
"rl.isPromises",
|
||||
"rl.isTerminal",
|
||||
"rl.iterNext",
|
||||
"rl.iterOpen",
|
||||
"rl.iterReturn",
|
||||
"rl.keypressStdin",
|
||||
"rl.keypressStream",
|
||||
"stdin.onKeypress",
|
||||
"rl.uiOpen",
|
||||
"rl.uiOpenStream",
|
||||
"rl.uiCursorTo",
|
||||
"rl.uiMoveCursor",
|
||||
"rl.line",
|
||||
"rl.moves",
|
||||
"rl.numProp",
|
||||
"rl.on",
|
||||
"rl.pause",
|
||||
"rl.prompt",
|
||||
"rl.promptWith",
|
||||
"rl.question",
|
||||
"rl.questionAsync",
|
||||
"rl.questionAsyncDyn",
|
||||
"rl.questionAsyncSignal",
|
||||
"rl.questionAsyncSignalDyn",
|
||||
"rl.questionDyn",
|
||||
"rl.resume",
|
||||
"rl.seq",
|
||||
"rl.setHistory",
|
||||
"rl.setOptions",
|
||||
"rl.setPrompt",
|
||||
"rl.setPromptDyn",
|
||||
"rl.terminal",
|
||||
"rl.uiClearLine",
|
||||
"rl.uiClearScreenDown",
|
||||
"rl.uiRollback",
|
||||
"rl.uiCommit",
|
||||
"rl.uiCursorTo",
|
||||
"rl.uiMoveCursor",
|
||||
"rl.uiOpen",
|
||||
"rl.uiOpenStream",
|
||||
"rl.uiRollback",
|
||||
"rl.write",
|
||||
"rl.writeKey",
|
||||
"stdin.onKeypress",
|
||||
]);
|
||||
|
||||
/** The legacy http2.* libCalls implemented by scr_http.c/scr_tls.c (the
|
||||
@@ -506,7 +506,9 @@ const NET_PREFIXES: readonly string[] = ["net.", "http.", "tls.", "https.", "htt
|
||||
|
||||
/** One rule per runtime feature, sorted by name. A new feature is an
|
||||
* entry here and its line in noRuntimeFeatures; RuntimeFeatures, the scan
|
||||
* and its early exit derive from this table. */
|
||||
* and its early exit derive from this table. The lists above keep one
|
||||
* entry per line, sorted within each commented group, so changes that add
|
||||
* different entries touch different lines. */
|
||||
const RUNTIME_FEATURE_RULES = {
|
||||
assert: rule({ prefixes: ["assert."] }),
|
||||
/** The program enters AsyncLocalStorage stores (store.run, enterWith,
|
||||
@@ -765,13 +767,13 @@ function noRuntimeFeatures(): RuntimeFeatures {
|
||||
fetch: false,
|
||||
fileHandle: false,
|
||||
fsWatch: false,
|
||||
netLookup: false,
|
||||
http: false,
|
||||
http2: false,
|
||||
http: false,
|
||||
inspect: false,
|
||||
legacyTextDecoder: false,
|
||||
mockTimers: false,
|
||||
net: false,
|
||||
netLookup: false,
|
||||
nodeTest: false,
|
||||
parseArgs: false,
|
||||
perfLoop: false,
|
||||
|
||||
Reference in New Issue
Block a user