refactor(scripts): migrate JavaScript tools to TypeScript (#121005)

* refactor(scripts): migrate JavaScript tools to TypeScript

* fix(ci): keep changed-scope preflight zero-install

* fix(ci): preserve zero-install script owners

* fix(ci): complete script migration follow-through

* fix(release): keep stable closeout zero-install

* fix(scripts): preserve standalone execution boundaries

* fix(scripts): repair standalone loader boundaries

* fix(scripts): normalize gateway observation ids

* fix(scripts): keep Docker packager standalone

* test(scripts): preserve rebase cleanup helpers

* test(sessions): use tracked temp directory
This commit is contained in:
Peter Steinberger
2026-08-09 07:21:35 -07:00
committed by GitHub
parent 2433fa213c
commit c70aee247e
937 changed files with 48087 additions and 50044 deletions
+13 -2
View File
@@ -21,8 +21,19 @@ if (mode !== "lint" && mode !== "format") {
process.exit(2);
}
const lintExts = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"]);
const formatExts = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".md", ".mdx"]);
const lintExts = new Set([".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"]);
const formatExts = new Set([
".ts",
".tsx",
".mts",
".cts",
".js",
".jsx",
".mjs",
".cjs",
".md",
".mdx",
]);
const formatIgnoredPathPatterns = [/^extensions\/[^/]+\/src\/host\/.+\/[^/]+\.bundle\.js$/u];
const shouldSelect = (filePath) => {
-60
View File
@@ -1,60 +0,0 @@
#!/usr/bin/env node
export function stripVersionDecorators(reference: unknown): unknown;
export function parseSnapshotKey(snapshotKey: unknown): {
packageName: unknown;
reference: unknown;
version: unknown;
};
export function collectProdResolvedPackagesFromLockfile(
lockfileText: unknown,
): Map<unknown, unknown>;
export function collectAllResolvedPackagesFromLockfile(
lockfileText: unknown,
): Map<unknown, unknown>;
export function createBulkAdvisoryPayload(versionsByPackage: unknown): unknown;
export function filterFindingsBySeverity(
advisoriesByPackage: unknown,
minSeverity: unknown,
versionsByPackage?: unknown,
): {
packageName: string;
id: unknown;
severity: string;
title: unknown;
url: unknown;
vulnerableVersions: unknown;
}[];
export function readBoundedBulkAdvisoryErrorText(
response: unknown,
maxChars?: number,
options?: Record<string, unknown>,
): Promise<string>;
export function fetchBulkAdvisories({
payload,
fetchImpl,
registryBaseUrl,
responseBodyMaxBytes,
timeoutMs,
}: {
payload: unknown;
fetchImpl?: typeof fetch | undefined;
registryBaseUrl?: string | undefined;
responseBodyMaxBytes?: unknown;
timeoutMs?: number | undefined;
}): Promise<unknown>;
export function runPnpmAuditProd({
rootDir,
fetchImpl,
stdout,
stderr,
minSeverity,
}?: {
rootDir?: string | undefined;
fetchImpl?: typeof fetch | undefined;
stdout?: Pick<NodeJS.WriteStream, "write"> | undefined;
stderr?: Pick<NodeJS.WriteStream, "write"> | undefined;
minSeverity?: string | undefined;
}): Promise<0 | 1>;
export function parseArgs(argv: unknown): {
minSeverity: string;
};
+11
View File
@@ -43,6 +43,16 @@ const AUDIT_ADVISORY_VERSION_OVERRIDES = [
},
];
/** @typedef {{ write: (chunk: string) => boolean }} AuditOutput */
/**
* @typedef {object} PnpmAuditOptions
* @property {string} [rootDir]
* @property {typeof fetch} [fetchImpl]
* @property {AuditOutput} [stdout]
* @property {AuditOutput} [stderr]
* @property {string} [minSeverity]
*/
function normalizeAuditLevel(level) {
const normalized = String(level ?? "").toLowerCase();
if (normalized in SEVERITY_RANK) {
@@ -853,6 +863,7 @@ export async function fetchBulkAdvisories({
});
}
/** @param {PnpmAuditOptions} [options] */
export async function runPnpmAuditProd({
rootDir = process.cwd(),
fetchImpl = fetch,