@stll/oxlint-config 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/dist/consumer-node-support.cjs +2 -2
- package/dist/consumer-node-support.mjs +1 -1
- package/dist/dependabot.d.cts +8 -0
- package/dist/dependabot.d.mts +8 -0
- package/dist/git-tracked-output.cjs +1 -1
- package/dist/git-tracked-output.mjs +1 -1
- package/dist/publish-contract-cli.cjs +2 -2
- package/dist/publish-contract-cli.cjs.map +1 -1
- package/dist/publish-contract-cli.mjs +2 -2
- package/dist/publish-contract-cli.mjs.map +1 -1
- package/dist/quarantine-cli.cjs +1 -1
- package/dist/quarantine-cli.mjs +1 -1
- package/dist/quarantine-policy2.cjs +2 -2
- package/dist/quarantine-policy2.mjs +2 -2
- package/dist/rust-policy-cli.cjs +481 -0
- package/dist/rust-policy-cli.cjs.map +1 -0
- package/dist/rust-policy-cli.d.cts +1 -0
- package/dist/rust-policy-cli.d.mts +1 -0
- package/dist/rust-policy-cli.mjs +479 -0
- package/dist/rust-policy-cli.mjs.map +1 -0
- package/dist/toolchain-changed-cli.cjs +1 -1
- package/dist/toolchain-changed-cli.mjs +1 -1
- package/dist/toolchain-dependabot.cjs +1 -1
- package/dist/toolchain-dependabot.mjs +2 -2
- package/dist/toolchain-dependabot.mjs.map +1 -1
- package/dist/toolchain-guard.cjs +5 -5
- package/dist/toolchain-guard.mjs +4 -4
- package/dist/toolchain-inputs.cjs +96 -17
- package/dist/toolchain-inputs.cjs.map +1 -1
- package/dist/toolchain-inputs.mjs +90 -17
- package/dist/toolchain-inputs.mjs.map +1 -1
- package/dist/toolchain-schema.cjs +6 -2
- package/dist/toolchain-schema.cjs.map +1 -1
- package/dist/toolchain-schema.mjs +6 -2
- package/dist/toolchain-schema.mjs.map +1 -1
- package/package.json +4 -3
- package/toolchain.json +12 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { parse } from "smol-toml";
|
|
3
|
+
import picomatch from "picomatch";
|
|
3
4
|
import { createHash } from "node:crypto";
|
|
4
5
|
import { subset, valid, validRange } from "semver";
|
|
5
6
|
import { isDeepStrictEqual } from "node:util";
|
|
6
7
|
import { parseDocument } from "yaml";
|
|
7
|
-
import picomatch from "picomatch";
|
|
8
8
|
//#region src/cloud-setup-install.ts
|
|
9
9
|
const packageInstall = String.raw`
|
|
10
10
|
# Prevent package maintainer scripts from starting unmanaged system services.
|
|
@@ -39,20 +39,20 @@ apt_install() (
|
|
|
39
39
|
policy_state=installed
|
|
40
40
|
printf '%s\n' '#!/bin/sh' 'exit 101' > /usr/sbin/policy-rc.d
|
|
41
41
|
chmod 755 /usr/sbin/policy-rc.d
|
|
42
|
-
|
|
42
|
+
# The network deadline covers downloads only; unpacking and maintainer scripts
|
|
43
|
+
# (for example locale generation or cluster creation) run offline afterwards.
|
|
44
|
+
DEBIAN_FRONTEND=noninteractive apt_network install -y --no-install-recommends --download-only "$@"
|
|
45
|
+
local package pending
|
|
43
46
|
for package in "$@"; do
|
|
44
47
|
if [[ "$package" == */* ]]; then
|
|
45
|
-
# apt
|
|
46
|
-
#
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
# apt rejects --no-download for local archives, so prove instead that
|
|
49
|
+
# only local file: archives remain; --print-uris reads local state only.
|
|
50
|
+
pending="$(set -o pipefail; DEBIAN_FRONTEND=noninteractive apt-get --print-uris -qq -y --no-install-recommends install "$@" | awk '$1 !~ /^\047file:/')"
|
|
51
|
+
[[ -z "$pending" ]] || fail "Package downloads remain after the bounded download step: $pending"
|
|
52
|
+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends "$@"
|
|
50
53
|
return
|
|
51
54
|
fi
|
|
52
55
|
done
|
|
53
|
-
# The network deadline covers downloads only; unpacking and maintainer scripts
|
|
54
|
-
# (for example locale generation or cluster creation) run offline afterwards.
|
|
55
|
-
DEBIAN_FRONTEND=noninteractive apt_network install -y --no-install-recommends --download-only "$@"
|
|
56
56
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-download "$@"
|
|
57
57
|
)
|
|
58
58
|
|
|
@@ -334,6 +334,28 @@ apt_refresh_for() {
|
|
|
334
334
|
}
|
|
335
335
|
`;
|
|
336
336
|
//#endregion
|
|
337
|
+
//#region src/archive-pins.ts
|
|
338
|
+
const record$3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
339
|
+
/** Parse a map from exact releases to their amd64 and arm64 archive SHA256 values. */
|
|
340
|
+
const parseArchiveSha256 = (input, label) => {
|
|
341
|
+
if (input === void 0) return {};
|
|
342
|
+
if (!record$3(input)) throw new Error(`${label} must be a version map`);
|
|
343
|
+
const releases = {};
|
|
344
|
+
for (const [version, value] of Object.entries(input)) {
|
|
345
|
+
if (valid(version) !== version || !record$3(value)) throw new Error(`${label} requires exact release keys`);
|
|
346
|
+
const keys = Object.keys(value);
|
|
347
|
+
if (keys.length !== 2 || !keys.includes("amd64") || !keys.includes("arm64")) throw new Error(`${label} ${version} requires amd64 and arm64 pins`);
|
|
348
|
+
const amd64 = value["amd64"];
|
|
349
|
+
const arm64 = value["arm64"];
|
|
350
|
+
if (typeof amd64 !== "string" || typeof arm64 !== "string" || !/^[a-f0-9]{64}$/.test(amd64) || !/^[a-f0-9]{64}$/.test(arm64)) throw new Error(`${label} ${version} requires lowercase SHA256 pins`);
|
|
351
|
+
releases[version] = {
|
|
352
|
+
amd64,
|
|
353
|
+
arm64
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
return releases;
|
|
357
|
+
};
|
|
358
|
+
//#endregion
|
|
337
359
|
//#region src/cloud-setup-artifacts.ts
|
|
338
360
|
const wasmBindgen0126 = {
|
|
339
361
|
version: "0.2.126",
|
|
@@ -547,6 +569,20 @@ const parseTools = (input) => {
|
|
|
547
569
|
}
|
|
548
570
|
return result;
|
|
549
571
|
};
|
|
572
|
+
const cloudRuntimes = ["node", "bun"];
|
|
573
|
+
const parseRuntimeArchives = (input) => {
|
|
574
|
+
if (input === void 0) return void 0;
|
|
575
|
+
if (!object(input) || Object.keys(input).some((key) => !cloudRuntimes.some((runtime) => runtime === key))) throw new Error("cloud.runtimeArchiveSha256 accepts only node and bun");
|
|
576
|
+
const result = {};
|
|
577
|
+
for (const runtime of cloudRuntimes) {
|
|
578
|
+
if (!Object.hasOwn(input, runtime)) continue;
|
|
579
|
+
const label = `cloud.runtimeArchiveSha256.${runtime}`;
|
|
580
|
+
const pins = parseArchiveSha256(input[runtime], label);
|
|
581
|
+
if (Object.keys(pins).length !== 1) throw new Error(`${label} pins exactly one release`);
|
|
582
|
+
result[runtime] = pins;
|
|
583
|
+
}
|
|
584
|
+
return result;
|
|
585
|
+
};
|
|
550
586
|
const cloudInstallCommand = "bun install --frozen-lockfile";
|
|
551
587
|
const cloudInstallCommands = [cloudInstallCommand, `${cloudInstallCommand} --ignore-scripts`];
|
|
552
588
|
const cloudInstall = (value) => cloudInstallCommands.some((command) => value === command);
|
|
@@ -575,16 +611,18 @@ const parsePrepare = (input) => {
|
|
|
575
611
|
const parseCloudSetup = (input) => {
|
|
576
612
|
if (input === void 0) return void 0;
|
|
577
613
|
if (typeof input !== "object" || input === null || Array.isArray(input)) throw new Error("cloud must be an object");
|
|
578
|
-
for (const key of Object.keys(input)) if (key !== "services" && key !== "install" && key !== "envFile" && key !== "rust" && key !== "tools" && key !== "prepare" && key !== "submodules") throw new Error(`unsupported cloud key: ${key}`);
|
|
614
|
+
for (const key of Object.keys(input)) if (key !== "services" && key !== "install" && key !== "envFile" && key !== "rust" && key !== "tools" && key !== "prepare" && key !== "submodules" && key !== "runtimeArchiveSha256") throw new Error(`unsupported cloud key: ${key}`);
|
|
579
615
|
const rust = parseRust("rust" in input ? input.rust : void 0);
|
|
580
616
|
const tools = parseTools("tools" in input ? input.tools : void 0);
|
|
581
617
|
const prepare = parsePrepare("prepare" in input ? input.prepare : void 0);
|
|
618
|
+
const runtimeArchiveSha256 = parseRuntimeArchives("runtimeArchiveSha256" in input ? input.runtimeArchiveSha256 : void 0);
|
|
582
619
|
const submodules = "submodules" in input ? input.submodules : false;
|
|
583
620
|
if (typeof submodules !== "boolean") throw new Error("cloud.submodules must be a boolean when provided");
|
|
584
621
|
const extensions = {
|
|
585
622
|
...rust === void 0 ? {} : { rust },
|
|
586
623
|
...tools === void 0 ? {} : { tools },
|
|
587
|
-
...prepare === void 0 ? {} : { prepare }
|
|
624
|
+
...prepare === void 0 ? {} : { prepare },
|
|
625
|
+
...runtimeArchiveSha256 === void 0 ? {} : { runtimeArchiveSha256 }
|
|
588
626
|
};
|
|
589
627
|
const selected = "services" in input ? input.services : [];
|
|
590
628
|
if (!Array.isArray(selected)) throw new Error("cloud.services must be an array when provided");
|
|
@@ -1152,8 +1190,8 @@ BUN_CACHE="/var/cache/stll-cloud/bun/$OUTPUT_UID"
|
|
|
1152
1190
|
[[ "$(awk 'NF { if (++count > 1 || NF != 1) exit 1; value=$1 } END { if (count != 1) exit 1; print value }' "$REPO_ROOT/.node-version")" == "$NODE_VERSION" ]] || fail 'Node selector changed; regenerate cloud-setup.sh'
|
|
1153
1191
|
cd -- "$REPO_ROOT"
|
|
1154
1192
|
case "$(uname -m)" in
|
|
1155
|
-
x86_64) ARCH=amd64; NODE_ARCH=x64; BUN_ARCH=x64 ;;
|
|
1156
|
-
aarch64|arm64) ARCH=arm64; NODE_ARCH=arm64; BUN_ARCH=aarch64 ;;
|
|
1193
|
+
x86_64) ARCH=amd64; NODE_ARCH=x64; BUN_ARCH=x64; NODE_SHA256='@NODE_AMD64_SHA@'; BUN_SHA256='@BUN_AMD64_SHA@' ;;
|
|
1194
|
+
aarch64|arm64) ARCH=arm64; NODE_ARCH=arm64; BUN_ARCH=aarch64; NODE_SHA256='@NODE_ARM64_SHA@'; BUN_SHA256='@BUN_ARM64_SHA@' ;;
|
|
1157
1195
|
*) fail 'Only amd64 and arm64 are supported' ;;
|
|
1158
1196
|
esac
|
|
1159
1197
|
|
|
@@ -1247,6 +1285,7 @@ install_runtimes() (
|
|
|
1247
1285
|
if ! node_ready; then
|
|
1248
1286
|
node_archive="node-v$NODE_VERSION-linux-$NODE_ARCH.tar.xz"
|
|
1249
1287
|
download_file "https://nodejs.org/dist/v$NODE_VERSION/$node_archive" "$scratch/$node_archive" 120
|
|
1288
|
+
(cd "$scratch"; printf '%s %s\n' "$NODE_SHA256" "$node_archive" | sha256sum --strict -c -)
|
|
1250
1289
|
download_file "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt" "$scratch/node-sums" 45
|
|
1251
1290
|
(cd "$scratch"; awk -v name="$node_archive" '$2 == name { print; count++ } END { if (count != 1) exit 1 }' node-sums | sha256sum --strict -c -)
|
|
1252
1291
|
install -d -m 755 "$NODE_DIR"
|
|
@@ -1256,6 +1295,7 @@ install_runtimes() (
|
|
|
1256
1295
|
bun_folder="bun-linux-$BUN_ARCH"
|
|
1257
1296
|
bun_archive="$bun_folder.zip"
|
|
1258
1297
|
download_file "https://github.com/oven-sh/bun/releases/download/bun-v$BUN_VERSION/$bun_archive" "$scratch/$bun_archive" 120
|
|
1298
|
+
(cd "$scratch"; printf '%s %s\n' "$BUN_SHA256" "$bun_archive" | sha256sum --strict -c -)
|
|
1259
1299
|
download_file "https://github.com/oven-sh/bun/releases/download/bun-v$BUN_VERSION/SHASUMS256.txt" "$scratch/bun-sums" 45
|
|
1260
1300
|
(cd "$scratch"; awk -v name="$bun_archive" '$2 == name || $2 == "*" name { print $1 " " name; count++ } END { if (count != 1) exit 1 }' bun-sums | sha256sum --strict -c -)
|
|
1261
1301
|
unzip -q "$scratch/$bun_archive" -d "$scratch/bun"
|
|
@@ -1459,11 +1499,40 @@ const renderPrepare = (prepare, files) => {
|
|
|
1459
1499
|
"}"
|
|
1460
1500
|
].join("\n");
|
|
1461
1501
|
};
|
|
1502
|
+
const runtimeArchiveManifests = {
|
|
1503
|
+
node: (version) => `https://nodejs.org/dist/v${version}/SHASUMS256.txt`,
|
|
1504
|
+
bun: (version) => `https://github.com/oven-sh/bun/releases/download/bun-v${version}/SHASUMS256.txt`
|
|
1505
|
+
};
|
|
1506
|
+
const runtimeArchivePins = ({ runtime, version, shared, declared }) => {
|
|
1507
|
+
const key = `cloud.runtimeArchiveSha256.${runtime}`;
|
|
1508
|
+
const sharedPins = shared[version];
|
|
1509
|
+
if (declared !== void 0) {
|
|
1510
|
+
if (sharedPins !== void 0) throw new Error(`the shared policy pins ${runtime} ${version} archives; remove ${key}`);
|
|
1511
|
+
const pins = declared[version];
|
|
1512
|
+
if (pins === void 0) throw new Error(`${key} pins ${Object.keys(declared).join(", ")}, but the repository selects ${runtime} ${version}; update it with the amd64 and arm64 values from ${runtimeArchiveManifests[runtime](version)}`);
|
|
1513
|
+
return pins;
|
|
1514
|
+
}
|
|
1515
|
+
if (sharedPins === void 0) throw new Error(`the shared policy has no ${runtime} ${version} archive SHA256 pins; declare ${key} for ${version} with the amd64 and arm64 values from ${runtimeArchiveManifests[runtime](version)}`);
|
|
1516
|
+
return sharedPins;
|
|
1517
|
+
};
|
|
1462
1518
|
const generateCloudSetup = ({ policy, cloud, nodeVersion, files = {}, rustExceptions = [] }) => {
|
|
1463
1519
|
const selected = parseCloudSetup(cloud);
|
|
1464
1520
|
if (selected === void 0) throw new Error("cloud declaration is required");
|
|
1465
1521
|
const exactNode = nodeVersion.trim();
|
|
1466
1522
|
if (valid(exactNode) !== exactNode || !nodeSelectorMatches(exactNode, policy.node)) throw new Error("cloud requires a tracked exact .node-version within the shared Node series");
|
|
1523
|
+
const bunVersion = policy.bun;
|
|
1524
|
+
const nodeArchiveSha256 = runtimeArchivePins({
|
|
1525
|
+
runtime: "node",
|
|
1526
|
+
version: exactNode,
|
|
1527
|
+
shared: policy.nodeArchiveSha256,
|
|
1528
|
+
declared: selected.runtimeArchiveSha256?.node
|
|
1529
|
+
});
|
|
1530
|
+
const bunArchiveSha256 = runtimeArchivePins({
|
|
1531
|
+
runtime: "bun",
|
|
1532
|
+
version: bunVersion,
|
|
1533
|
+
shared: policy.bunArchiveSha256,
|
|
1534
|
+
declared: selected.runtimeArchiveSha256?.bun
|
|
1535
|
+
});
|
|
1467
1536
|
const toolchains = resolveCloudToolchains({
|
|
1468
1537
|
cloud: selected,
|
|
1469
1538
|
files,
|
|
@@ -1476,7 +1545,7 @@ const generateCloudSetup = ({ policy, cloud, nodeVersion, files = {}, rustExcept
|
|
|
1476
1545
|
["@NETWORK@", renderCloudNetwork()],
|
|
1477
1546
|
["@TOOL_INSTALL@", renderCloudToolInstall(toolchains) + renderCloudShellInstall({
|
|
1478
1547
|
nodeVersion: exactNode,
|
|
1479
|
-
bunVersion
|
|
1548
|
+
bunVersion,
|
|
1480
1549
|
rust: toolchains.rust
|
|
1481
1550
|
})],
|
|
1482
1551
|
["@INPUT_VALIDATION@", ["rust-toolchain.toml", "rust-toolchain"].flatMap((file) => {
|
|
@@ -1485,8 +1554,12 @@ const generateCloudSetup = ({ policy, cloud, nodeVersion, files = {}, rustExcept
|
|
|
1485
1554
|
const hash = createHash("sha256").update(content).digest("hex");
|
|
1486
1555
|
return [`[[ -f ${shellQuote(file)} && ! -L ${shellQuote(file)} ]] && [[ "$(sha256sum -- ${shellQuote(file)} | cut -d ' ' -f1)" == ${shellQuote(hash)} ]] || fail ${shellQuote(`${file} changed; regenerate cloud-setup.sh`)}`];
|
|
1487
1556
|
}).concat(selected.tools?.["wasm-bindgen-cli"] === void 0 ? [] : [renderWasmBindgenLockValidation(selected.tools["wasm-bindgen-cli"])]).join("\n")],
|
|
1488
|
-
["@BUN@",
|
|
1557
|
+
["@BUN@", bunVersion],
|
|
1489
1558
|
["@NODE@", exactNode],
|
|
1559
|
+
["@NODE_AMD64_SHA@", nodeArchiveSha256.amd64],
|
|
1560
|
+
["@NODE_ARM64_SHA@", nodeArchiveSha256.arm64],
|
|
1561
|
+
["@BUN_AMD64_SHA@", bunArchiveSha256.amd64],
|
|
1562
|
+
["@BUN_ARM64_SHA@", bunArchiveSha256.arm64],
|
|
1490
1563
|
["@ENV_ASSIGNMENTS@", selected.envFile === void 0 ? "" : `ENV_FILE=${shellQuote(selected.envFile)}\nENV_MARKER=${shellQuote(cloudEnvironmentMarker)}`],
|
|
1491
1564
|
["@ENV_FUNCTIONS@", selected.envFile === void 0 ? "" : environmentFunctions],
|
|
1492
1565
|
["@ENVIRONMENT_VALUES@", selected.services.length === 0 ? "" : environmentValuesFunction],
|
|
@@ -1948,6 +2021,6 @@ const toolchainInputKind = (file, text = "") => {
|
|
|
1948
2021
|
if (githubAutomationFileKind(file) !== void 0 || isShellScript(file, text) || /(?:^|\/)ci-service-images\.json$/.test(file) || isMiseConfigPath(file) || isPythonDependencyManifest(file) || isDockerDefinitionPath(file) || isComposeDefinitionPath(file) || isKubernetesDefinitionPath(file) || /(?:^|\/)(?:package\.json|consumer-compat\.json|pnpm-workspace\.yaml|stll-toolchain\.json|\.bun-version|\.node-version|\.nvmrc|\.python-version|rust-toolchain(?:\.toml)?|\.tool-versions|\.?mise\.toml|uv\.toml|\.uv\.toml|\.github\/dependabot\.ya?ml|Cargo\.toml)$/.test(file)) return "config";
|
|
1949
2022
|
};
|
|
1950
2023
|
//#endregion
|
|
1951
|
-
export { cloudSetupPath as C, nodeSupportRangeMatches as D, nodeSelectorMatches as E, parseCloudSetup as O, mergeCloudClaudeSettings as S, nodePolicyValid as T, cloudAttributionFix as _, isFormatterConfigPath as a, hasCloudAttribution as b, isPythonDependencyManifest as c, pythonDependencyManifestKind as d, toolchainInputKind as f, workspaceContains as g, isKubernetesDefinitionPath as h, isDockerDefinitionPath as i, isShellScript as l, isComposeDefinitionPath as m, githubAutomationFileKind as n, isLefthookConfigPath as o, containerDocumentImages as p, isDependabotGithubActionsPath as r, isMiseConfigPath as s, dependabotManifestEcosystem as t, javascriptDependencyLockfiles as u, cloudClaudeSettingsPath as v, generateCloudSetup as w, hasCloudSessionStartHook as x, cloudSessionStartFix as y };
|
|
2024
|
+
export { cloudSetupPath as C, nodeSupportRangeMatches as D, nodeSelectorMatches as E, parseCloudSetup as O, mergeCloudClaudeSettings as S, nodePolicyValid as T, cloudAttributionFix as _, isFormatterConfigPath as a, hasCloudAttribution as b, isPythonDependencyManifest as c, pythonDependencyManifestKind as d, toolchainInputKind as f, workspaceContains as g, isKubernetesDefinitionPath as h, isDockerDefinitionPath as i, parseArchiveSha256 as k, isShellScript as l, isComposeDefinitionPath as m, githubAutomationFileKind as n, isLefthookConfigPath as o, containerDocumentImages as p, isDependabotGithubActionsPath as r, isMiseConfigPath as s, dependabotManifestEcosystem as t, javascriptDependencyLockfiles as u, cloudClaudeSettingsPath as v, generateCloudSetup as w, hasCloudSessionStartHook as x, cloudSessionStartFix as y };
|
|
1952
2025
|
|
|
1953
2026
|
//# sourceMappingURL=toolchain-inputs.mjs.map
|