refactor: use canonical implementations and types directly

Remove forwarding wrappers and shadow aliases, migrate callers and verification scripts to their owners, and share one exhaustive semantic resource-bound projection.
This commit is contained in:
morluto
2026-10-09 23:17:17 +08:00
parent 3283a45d09
commit 765e809e36
119 changed files with 577 additions and 629 deletions
@@ -6,7 +6,7 @@ import {
collectJavaScriptExports,
fingerprintJavaScriptAst,
} from "./javascriptAstFingerprint.js";
import { compareCodePoints } from "../canonicalOrdering.js";
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
import { addFindingOnce } from "./javascriptStaticAnalysisFindings.js";
import {
argumentValue,
@@ -66,7 +66,7 @@ export const inspectBundlerRegistration = (
unknown_async_chunk_keys:
runtimeValue.unknownAsyncChunkKeys + recovered.unknownAsyncChunkKeys,
modules: recovered.modules.sort((left, right) =>
compareCodePoints(left.module_key, right.module_key),
compareUnicodeCodePoints(left.module_key, right.module_key),
),
location: range(call),
};
@@ -107,7 +107,7 @@ export const inspectEsbuildWrapper = (
async_chunk_keys: recovered.asyncChunkKeys,
unknown_async_chunk_keys: recovered.unknownAsyncChunkKeys,
modules: recovered.modules.sort((left, right) =>
compareCodePoints(left.module_key, right.module_key),
compareUnicodeCodePoints(left.module_key, right.module_key),
),
location: range(call),
};
@@ -225,7 +225,7 @@ const runtimeMetadata = (node: t.Node | null | undefined): RuntimeMetadata => {
asyncChunkKeys: [],
unknownAsyncChunkKeys: 0,
};
const entries = collectBundlerEntryModuleKeys(node, requireName);
const entries = collectBundlerCallArgumentValues(node, requireName);
const asyncChunks = collectBundlerAsyncChunkKeys(node, requireName);
return {
requireName,
@@ -236,11 +236,6 @@ const runtimeMetadata = (node: t.Node | null | undefined): RuntimeMetadata => {
};
};
const collectBundlerEntryModuleKeys = (
factory: BundlerFunction,
requireName: string,
): StaticValues => collectBundlerCallArgumentValues(factory, requireName);
const collectBundlerAsyncChunkKeys = (
factory: BundlerFunction,
requireName: string | null,
@@ -277,7 +272,7 @@ const isBundlerFunction = (
t.isObjectMethod(node);
const uniqueValues = (values: readonly string[], unknown = 0): StaticValues => {
const unique = [...new Set(values)].sort(compareCodePoints);
const unique = [...new Set(values)].sort(compareUnicodeCodePoints);
return {
values: unique,
unknown,