@stll/oxlint-config 1.2.5 → 1.3.0

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 CHANGED
@@ -349,6 +349,15 @@ matching package is reused without network access.
349
349
  `wasm-bindgen-cli` requires the matching `wasm-bindgen` crate version in tracked
350
350
  root `Cargo.lock`. Regenerate after updating the lockfile or any tool pin.
351
351
 
352
+ `cloud.prepare` (optional) names one root `package.json` script and a time bound,
353
+ for example `{ "script": "generate:cloud", "seconds": 300 }`. The install phase
354
+ runs it once after dependencies, as the invoking user, with stdin closed. At the
355
+ bound (1 to 900 seconds) the script receives TERM and, 10 seconds later, KILL;
356
+ when it ends, anything still running in its process group is killed. Use it
357
+ for cheap derived sources that tasks need when `install` skips lifecycle scripts;
358
+ it gets no network allowance. Generation fails when the script is not in the
359
+ root `package.json`.
360
+
352
361
  Generation uses the installed policy's Bun, Node, PostgreSQL, and Valkey pins.
353
362
  PostgreSQL uses the PGDG major-version packages; minor updates within the pinned
354
363
  major are accepted for the disposable database. Before adding PGDG, provisioning
@@ -13,7 +13,7 @@ let picomatch = require("picomatch");
13
13
  picomatch = require_rolldown_runtime.__toESM(picomatch, 1);
14
14
  //#endregion
15
15
  //#region src/toolchain-consumer-checks.ts
16
- const consumerRunnerVersion = "1.2.5";
16
+ const consumerRunnerVersion = "1.3.0";
17
17
  const consumerCheckWorkflow = "stella/.github/.github/workflows/package-consumer-compat.yml";
18
18
  const record$7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
19
19
  const repositoryDirectory = (value) => typeof value === "string" && value !== "" && !value.includes("\\") && !value.includes("${{") && !value.split("").some((character) => {
@@ -10,7 +10,7 @@ import { LineCounter, isAlias, isMap, isNode, isScalar, isSeq, parseAllDocuments
10
10
  import picomatch from "picomatch";
11
11
  //#endregion
12
12
  //#region src/toolchain-consumer-checks.ts
13
- const consumerRunnerVersion = "1.2.5";
13
+ const consumerRunnerVersion = "1.3.0";
14
14
  const consumerCheckWorkflow = "stella/.github/.github/workflows/package-consumer-compat.yml";
15
15
  const record$7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
16
16
  const repositoryDirectory = (value) => typeof value === "string" && value !== "" && !value.includes("\\") && !value.includes("${{") && !value.split("").some((character) => {
@@ -301,7 +301,9 @@ network_run() (
301
301
  trap 'exit 143' TERM
302
302
  # Output goes to a file, never a pipe: package scripts may leave processes that keep
303
303
  # inherited descriptors open, and a pipe reader would wait for them past the command.
304
- timeout --signal=TERM --kill-after=5s "$seconds"s "$@" > "$network_log" 2>&1 || status=$?
304
+ # Input is never the terminal: timeout runs the command outside the foreground process
305
+ # group, where apt restoring terminal settings on a terminal stdin stops it for good.
306
+ timeout --signal=TERM --kill-after=5s "$seconds"s "$@" < /dev/null > "$network_log" 2>&1 || status=$?
305
307
  release_log_holders "$network_log"
306
308
  cat -- "$network_log" || fail 'Cannot capture network command output'
307
309
  [[ "$status" != 0 ]] || return 0
@@ -533,16 +535,32 @@ const parseEnvFile = (input) => {
533
535
  if (envFile.startsWith("/") || /^[A-Za-z]:/.test(envFile) || envFile.includes("\\") || /\p{Cc}/u.test(envFile) || envFile.split("/").some((part) => part === "" || part === "." || part === "..")) throw new Error("cloud.envFile must be a canonical repository-relative path");
534
536
  return envFile;
535
537
  };
538
+ const cloudPrepareScript = /^[a-z0-9][a-z0-9:._-]*$/;
539
+ const parsePrepare = (input) => {
540
+ if (input === void 0) return void 0;
541
+ if (typeof input !== "object" || input === null || Array.isArray(input)) throw new Error("cloud.prepare must be an object");
542
+ for (const key of Object.keys(input)) if (key !== "script" && key !== "seconds") throw new Error(`unsupported cloud.prepare key: ${key}`);
543
+ const script = "script" in input ? input.script : void 0;
544
+ if (typeof script !== "string" || !cloudPrepareScript.test(script)) throw new Error("cloud.prepare.script must name a package script");
545
+ const seconds = "seconds" in input ? input.seconds : void 0;
546
+ if (typeof seconds !== "number" || !Number.isInteger(seconds) || seconds < 1 || seconds > 900) throw new Error(`cloud.prepare.seconds must be an integer from 1 to 900`);
547
+ return {
548
+ script,
549
+ seconds
550
+ };
551
+ };
536
552
  /** Parse an explicit declaration without assuming services for undeclared repositories. */
537
553
  const parseCloudSetup = (input) => {
538
554
  if (input === void 0) return void 0;
539
555
  if (typeof input !== "object" || input === null || Array.isArray(input)) throw new Error("cloud must be an object");
540
- for (const key of Object.keys(input)) if (key !== "services" && key !== "install" && key !== "envFile" && key !== "rust" && key !== "tools") throw new Error(`unsupported cloud key: ${key}`);
556
+ for (const key of Object.keys(input)) if (key !== "services" && key !== "install" && key !== "envFile" && key !== "rust" && key !== "tools" && key !== "prepare") throw new Error(`unsupported cloud key: ${key}`);
541
557
  const rust = parseRust("rust" in input ? input.rust : void 0);
542
558
  const tools = parseTools("tools" in input ? input.tools : void 0);
559
+ const prepare = parsePrepare("prepare" in input ? input.prepare : void 0);
543
560
  const extensions = {
544
561
  ...rust === void 0 ? {} : { rust },
545
- ...tools === void 0 ? {} : { tools }
562
+ ...tools === void 0 ? {} : { tools },
563
+ ...prepare === void 0 ? {} : { prepare }
546
564
  };
547
565
  const selected = "services" in input ? input.services : [];
548
566
  if (!Array.isArray(selected)) throw new Error("cloud.services must be an array when provided");
@@ -597,7 +615,9 @@ service_process_matches() {
597
615
  owner="$(stat -c '%u' "/proc/$pid" 2>/dev/null)" || return 2
598
616
  [[ "$owner" =~ ^[0-9]+$ ]] || return 2
599
617
  [[ "$owner" == "$SERVICE_UID" ]] || return 1
600
- actual="$(readlink -f "/proc/$pid/exe" 2>/dev/null)" || return 2
618
+ # Read the executable link as its verified owner: container root may lack the ptrace
619
+ # capability that reading another user's /proc/<pid>/exe requires.
620
+ actual="$(service_run readlink -f "/proc/$pid/exe" 2>/dev/null)" || return 2
601
621
  expected="$(readlink -f "$executable")" || return 2
602
622
  [[ -n "$actual" && -n "$expected" && "$actual" != *' (deleted)' ]] || return 2
603
623
  [[ "$actual" == "$expected" ]]
@@ -1172,12 +1192,15 @@ process.stdout.write([...hosts].sort().join(","));
1172
1192
 
1173
1193
  @ENV_FUNCTIONS@
1174
1194
 
1195
+ @PREPARE_FUNCTION@
1196
+
1175
1197
  if [[ "$MODE" == install ]]; then
1176
1198
  step runtimes install_runtimes
1177
1199
  step services install_services
1178
1200
  step tools install_tools
1179
1201
  step shell install_shell_environment
1180
1202
  step dependencies dependency_install
1203
+ @PREPARE_STEP@
1181
1204
  exit 0
1182
1205
  fi
1183
1206
  step runtime-check runtime_ready
@@ -1218,6 +1241,24 @@ write_environment() {
1218
1241
  }
1219
1242
  `;
1220
1243
  const shellQuote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
1244
+ const renderPrepare = (prepare, files) => {
1245
+ if (prepare === void 0) return "";
1246
+ const manifest = files["package.json"];
1247
+ if (manifest === void 0) throw new Error("cloud.prepare requires a tracked root package.json");
1248
+ const parsed = JSON.parse(manifest);
1249
+ const scripts = typeof parsed === "object" && parsed !== null && "scripts" in parsed ? parsed.scripts : void 0;
1250
+ if (typeof scripts !== "object" || scripts === null || !Object.hasOwn(scripts, prepare.script) || typeof Reflect.get(scripts, prepare.script) !== "string") throw new Error(`cloud.prepare.script ${prepare.script} is not a root package script`);
1251
+ return [
1252
+ "prepare_sources() {",
1253
+ " local leader status=0",
1254
+ ` timeout --kill-after=10 ${prepare.seconds} runuser -u "$OUTPUT_USER" -- env HOME="$OUTPUT_HOME" PATH="$PATH" "$BUN_DIR/bun" run ${shellQuote(prepare.script)} </dev/null &`,
1255
+ " leader=$!",
1256
+ " wait \"$leader\" || status=$?",
1257
+ " kill -KILL -- \"-$leader\" 2>/dev/null || true",
1258
+ " return \"$status\"",
1259
+ "}"
1260
+ ].join("\n");
1261
+ };
1221
1262
  const generateCloudSetup = ({ policy, cloud, nodeVersion, files = {}, rustExceptions = [] }) => {
1222
1263
  const selected = parseCloudSetup(cloud);
1223
1264
  if (selected === void 0) throw new Error("cloud declaration is required");
@@ -1254,6 +1295,8 @@ const generateCloudSetup = ({ policy, cloud, nodeVersion, files = {}, rustExcept
1254
1295
  ["@ENV_FUNCTIONS@", selected.envFile === void 0 ? "" : environmentFunctions],
1255
1296
  ["@ENV_VALIDATE@", selected.envFile === void 0 ? "" : "DATABASE_URL=''\nREDIS_URL=''\nvalidate_environment"],
1256
1297
  ["@ENV_WRITE@", selected.envFile === void 0 ? "" : "write_environment"],
1298
+ ["@PREPARE_FUNCTION@", renderPrepare(selected.prepare, files)],
1299
+ ["@PREPARE_STEP@", selected.prepare === void 0 ? "" : " step prepare prepare_sources"],
1257
1300
  ["@SERVICE_INSTALL@", renderCloudServiceInstall({
1258
1301
  services,
1259
1302
  postgres: policy.postgres,