@stll/oxlint-config 0.12.2 → 0.15.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.
Files changed (88) hide show
  1. package/README.md +261 -1
  2. package/dist/cloud-setup-cli.cjs +6 -4
  3. package/dist/cloud-setup-cli.cjs.map +1 -1
  4. package/dist/cloud-setup-cli.mjs +3 -1
  5. package/dist/cloud-setup-cli.mjs.map +1 -1
  6. package/dist/compiler-packages.cjs +28 -0
  7. package/dist/compiler-packages.cjs.map +1 -0
  8. package/dist/compiler-packages.mjs +17 -0
  9. package/dist/compiler-packages.mjs.map +1 -0
  10. package/dist/consumer-compat-cli.cjs +1091 -0
  11. package/dist/consumer-compat-cli.cjs.map +1 -0
  12. package/dist/consumer-compat-cli.d.cts +1 -0
  13. package/dist/consumer-compat-cli.d.mts +1 -0
  14. package/dist/consumer-compat-cli.mjs +1089 -0
  15. package/dist/consumer-compat-cli.mjs.map +1 -0
  16. package/dist/index.cjs +50 -40
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +46 -41
  19. package/dist/index.d.mts +46 -41
  20. package/dist/index.mjs +50 -41
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/publish-build-target-nuxt-helper.cjs +71 -0
  23. package/dist/publish-build-target-nuxt-helper.cjs.map +1 -0
  24. package/dist/publish-build-target-nuxt-helper.d.cts +10 -0
  25. package/dist/publish-build-target-nuxt-helper.d.mts +10 -0
  26. package/dist/publish-build-target-nuxt-helper.mjs +68 -0
  27. package/dist/publish-build-target-nuxt-helper.mjs.map +1 -0
  28. package/dist/publish-build-target-vite-dts-helper.cjs +3 -0
  29. package/dist/publish-build-target-vite-dts-helper.d.cts +24 -0
  30. package/dist/publish-build-target-vite-dts-helper.d.mts +24 -0
  31. package/dist/publish-build-target-vite-dts-helper.mjs +2 -0
  32. package/dist/publish-build-target-vite-dts-helper2.cjs +372 -0
  33. package/dist/publish-build-target-vite-dts-helper2.cjs.map +1 -0
  34. package/dist/publish-build-target-vite-dts-helper2.mjs +359 -0
  35. package/dist/publish-build-target-vite-dts-helper2.mjs.map +1 -0
  36. package/dist/publish-contract-cli.cjs +983 -0
  37. package/dist/publish-contract-cli.cjs.map +1 -0
  38. package/dist/publish-contract-cli.d.cts +1 -0
  39. package/dist/publish-contract-cli.d.mts +1 -0
  40. package/dist/publish-contract-cli.mjs +981 -0
  41. package/dist/publish-contract-cli.mjs.map +1 -0
  42. package/dist/publish-contract.cjs +431 -0
  43. package/dist/publish-contract.cjs.map +1 -0
  44. package/dist/publish-contract.mjs +396 -0
  45. package/dist/publish-contract.mjs.map +1 -0
  46. package/dist/rolldown-runtime.cjs +28 -0
  47. package/dist/toolchain-changed-cli.cjs +34 -0
  48. package/dist/toolchain-changed-cli.cjs.map +1 -0
  49. package/dist/toolchain-changed-cli.d.cts +1 -0
  50. package/dist/toolchain-changed-cli.d.mts +1 -0
  51. package/dist/toolchain-changed-cli.mjs +34 -0
  52. package/dist/toolchain-changed-cli.mjs.map +1 -0
  53. package/dist/toolchain-changed.cjs +1470 -0
  54. package/dist/toolchain-changed.cjs.map +1 -0
  55. package/dist/toolchain-changed.mjs +1463 -0
  56. package/dist/toolchain-changed.mjs.map +1 -0
  57. package/dist/toolchain-check-cli.cjs +2 -1
  58. package/dist/toolchain-check-cli.cjs.map +1 -1
  59. package/dist/toolchain-check-cli.mjs +2 -1
  60. package/dist/toolchain-check-cli.mjs.map +1 -1
  61. package/dist/toolchain-guard.cjs +360 -1161
  62. package/dist/toolchain-guard.cjs.map +1 -1
  63. package/dist/toolchain-guard.mjs +338 -1100
  64. package/dist/toolchain-guard.mjs.map +1 -1
  65. package/dist/toolchain-inputs.cjs +926 -0
  66. package/dist/toolchain-inputs.cjs.map +1 -0
  67. package/dist/toolchain-inputs.mjs +816 -0
  68. package/dist/toolchain-inputs.mjs.map +1 -0
  69. package/dist/toolchain-schema.cjs +702 -0
  70. package/dist/toolchain-schema.cjs.map +1 -0
  71. package/dist/toolchain-schema.mjs +580 -0
  72. package/dist/toolchain-schema.mjs.map +1 -0
  73. package/dist/typecheck-parity-cli.cjs +38 -898
  74. package/dist/typecheck-parity-cli.cjs.map +1 -1
  75. package/dist/typecheck-parity-cli.mjs +39 -899
  76. package/dist/typecheck-parity-cli.mjs.map +1 -1
  77. package/dist/typecheck-parity.cjs +905 -0
  78. package/dist/typecheck-parity.cjs.map +1 -0
  79. package/dist/typecheck-parity.mjs +894 -0
  80. package/dist/typecheck-parity.mjs.map +1 -0
  81. package/dist/typecheck-probe-cli.cjs +176 -0
  82. package/dist/typecheck-probe-cli.cjs.map +1 -0
  83. package/dist/typecheck-probe-cli.d.cts +1 -0
  84. package/dist/typecheck-probe-cli.d.mts +1 -0
  85. package/dist/typecheck-probe-cli.mjs +174 -0
  86. package/dist/typecheck-probe-cli.mjs.map +1 -0
  87. package/package.json +43 -5
  88. package/toolchain.json +9 -1
package/README.md CHANGED
@@ -36,6 +36,33 @@ portable safety and route-query rules. See the
36
36
  [repository usage guide](https://github.com/stella/tooling#usage) for other
37
37
  presets, CommonJS configuration, and plugin composition.
38
38
 
39
+ `library()` is framework-neutral. Enable React and its actionable React Compiler
40
+ rules only for files owned by React:
41
+
42
+ ```ts
43
+ export default library({
44
+ react: {
45
+ files: ["packages/react/**/*.{ts,tsx}", "apps/web/src/**/*.{ts,tsx}"],
46
+ },
47
+ });
48
+ ```
49
+
50
+ Include `.ts` hooks as well as `.tsx` components. Keep Vue composables and other
51
+ frameworks outside these globs. Consumer `rules` take precedence over all preset
52
+ rules, including scoped presets. Consumer `overrides` are applied last and can
53
+ customize individual paths. React is activated only in the selected override.
54
+ Oxlint resolves later overrides against the base plugin list: when configuring
55
+ React rules in a consumer override, explicitly supply
56
+ `plugins: [...libraryPlugins, "react"]` (plus any other consumer plugins) and
57
+ select React-owned files. Framework-neutral
58
+ `jsx-a11y` configuration can continue to be supplied through `plugins` and `rules`.
59
+
60
+ When upgrading from a version that enabled React globally, add `react.files`
61
+ explicitly to preserve diagnostics in React packages. Direct composition is also
62
+ breaking: `libraryRules` and `libraryPlugins` are now framework-neutral. Import
63
+ `reactRules` and add `"react"` to the plugins of a file-scoped override to retain
64
+ React diagnostics.
65
+
39
66
  ## Shared toolchain and Bun
40
67
 
41
68
  `@stll/oxlint-config/toolchain.json` is a versioned policy for package pins,
@@ -80,7 +107,7 @@ its clean input. Checkout may clear a destination without a matching Git reposit
80
107
  even when clean is false. Unresolved clean values remain untrusted. Unknown
81
108
  selectors remain fail closed. Mixed literal/expression sparse
82
109
  configurations retain their literal paths: those paths must explicitly include a
83
- static selected manifest. A declaration acknowledges only expression additions;
110
+ static selected manifest. A declaration acknowledges only expression additions.
84
111
  For every static manifest selector from the inspected source, the manifest pin
85
112
  is validated after sparse acknowledgement, including fully dynamic sparse inputs.
86
113
  Other nonempty, nonconstant GitHub expression refs on same-repository checkouts
@@ -320,3 +347,236 @@ commands and repository adoption are separate configuration steps.
320
347
  Environments may cache filesystems without preserving service processes.
321
348
  Run `start` at every session start, including sessions that reuse installed files.
322
349
  The supported OS, privileges, and pinned runtime requirements are checked explicitly.
350
+
351
+ ## Published package contracts
352
+
353
+ Run `stll-publish-contract` in PR CI. Every published root or declared workspace
354
+ package commits `publish-contract.json`, recording engines, peer support ranges,
355
+ resolved JavaScript targets, and entry points. `stll-publish-contract --write`
356
+ records an explicit contract decision as a reviewable diff; it also validates
357
+ consumer support and cannot accept development-only requirements.
358
+
359
+ The consumer policy pins Node 22.23.3, npm 12.2.0, pnpm 12.9.1, and TypeScript
360
+ 6.0.3 independently of the development toolchain. Published engines and TypeScript
361
+ peers must support the consumer versions; ranges may include newer versions.
362
+ Bun runtime/compiler requirements are rejected. JSON and declaration-only packages
363
+ record `{"type":"types-only"}` explicitly.
364
+
365
+ The static guard follows the packer declared in the tracked release workflow.
366
+ With pnpm, it models `publishConfig` overrides for `exports`, `main`, `module`,
367
+ `types`, `typings`, `bin`, and `typesVersions`. npm does not apply these overrides,
368
+ so differing values fail; move the published entry into the source manifest.
369
+ `access` and `registry` are allowed publication metadata. Other overrides,
370
+ including `engines`, are rejected. Real npm and pnpm pack tests compare the
371
+ modeled contract with each tarball manifest.
372
+
373
+ Build adapters use the installed configuration loaders and bind their behavior to
374
+ tsdown 0.22.9, Vite 8.1.5, or @nuxt/module-builder 1.0.3 (unbuild 3.6.1 and
375
+ mkdist 2.4.1). They record final transform targets, including separate Nuxt module
376
+ and runtime entries. No syntax lowering records `esnext`.
377
+ Only exact single build invocations (`tsdown`, `vite build`, or
378
+ `nuxt-module-build build`) are supported. Shell composition, environment prefixes,
379
+ launchers, directory changes, workspace filters, CLI overrides, and pre/post build
380
+ lifecycle scripts fail.
381
+ Vite accepts its version-bound default plugin pipeline and the default
382
+ `@vitejs/plugin-vue` 6.0.8 factory; custom Vue compiler, template, script, and feature
383
+ options are unsupported. Nuxt accepts the version-bound builder and immutable target
384
+ marker; foreign branded callbacks are replaced with the installed canonical hook before execution. Unapproved plugins, output transforms, and execution-order changes fail. The static guard validates the supported configuration; the nightly runner validates the actual packed JavaScript. Add a reviewed adapter when adopting another build tool.
385
+
386
+ Vite libraries can generate declarations through the reviewed helper:
387
+
388
+ ```ts
389
+ import { declarationOnlyDts } from "@stll/oxlint-config/declaration-only-dts";
390
+
391
+ export default {
392
+ plugins: [
393
+ declarationOnlyDts({
394
+ directory: import.meta.dirname,
395
+ include: ["src/**/*"],
396
+ entryRoot: "src",
397
+ }),
398
+ ],
399
+ build: { target: "es2022", lib: { entry: "src/index.ts", formats: ["es"] } },
400
+ };
401
+ ```
402
+
403
+ This adapter requires consumer-installed `vite-plugin-dts` 5.0.3 and its
404
+ `unplugin-dts` 1.0.3 implementation. Its dependency scope must provide TypeScript
405
+ 6.0.3 as `typescript` or the plugin's `@typescript/typescript6` fallback.
406
+ Unsupported versions fail explicitly.
407
+ The resolver proves a direct helper import and call in a literal plugin array;
408
+ raw declaration plugins, opaque plugin arrays, and additional emitters fail.
409
+ Options are closed and static: include/exclude, entryRoot, pathsToAliases,
410
+ compilerOptions.declarationMap=false, strictOutput=true, and declarationOnly=false. Hooks may
411
+ emit only `.d.ts`, `.d.mts`, `.d.cts`, and their maps. Bundle and on-disk non-declaration
412
+ bytes must remain unchanged across each declaration hook; this is checked during
413
+ the actual build, without a comparison build.
414
+
415
+ Nuxt modules can set both emitted targets without replacing the builder's entries:
416
+
417
+ ```ts
418
+ import { nuxtModuleTarget } from "@stll/oxlint-config/build-target";
419
+
420
+ export default { hooks: { "build:before": nuxtModuleTarget("es2022") } };
421
+ ```
422
+
423
+ The Nuxt adapter recognizes the immutable marker across module formats without executing a foreign callback. It captures the normalized configuration before cleanup or output writes. The built
424
+ publish-contract CLI is also checked against a TypeScript configuration and relative
425
+ TypeScript import on the package's minimum supported Node release.
426
+
427
+ Packed-artifact checks run nightly, while the static contract check runs per PR.
428
+ Every packed `.js`, `.mjs`, and `.cjs` file is checked, including non-entry chunks
429
+ and executables. The actual packed manifest must match the committed contract.
430
+ Acorn 8.15.0 applies the strictest declared ECMAScript target (`es5`, `es2015`
431
+ through `es2025`); the provisioned consumer Node also parses every file with
432
+ `--check`, without executing artifact code. `esnext` and supported Node targets use the native consumer Node bound.
433
+ Node target identifiers follow the same grammar and compatibility rule as the
434
+ static contract; no older Node-to-ECMAScript mapping is inferred. Browser targets
435
+ are unsupported here: declare an explicit ECMAScript year. Types-only contracts reject any packed JavaScript. Nested
436
+ package manifests and explicit module extensions determine parsing mode.
437
+ Linked syntax inputs and unsafe archive paths fail before staging.
438
+
439
+ The reusable consumer job declares its exact scope in `stll-toolchain.json`:
440
+
441
+ ```json
442
+ {
443
+ "consumerChecks": [
444
+ {
445
+ "workflow": ".github/workflows/consumer-compat.yml",
446
+ "job": "consumer",
447
+ "packages": ["packages/library"],
448
+ "toolingVersion": "<installed tooling version>",
449
+ "fixturePath": "tests/consumer"
450
+ }
451
+ ]
452
+ }
453
+ ```
454
+
455
+ The reusable consumer job must be stand-alone and unconditional (no `needs`, `if`, or `strategy`), so a job condition
456
+ cannot skip its scheduled execution.
457
+ The declared workflow requires a nonempty `on.schedule` with validated five-field cron (field bounds, lists, ranges, and positive steps);
458
+ Day of week is 0–6 (SUN–SAT), matching the [GitHub Actions schedule contract](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#schedule); numeric 7 is unsupported. The combined schedules must cover every weekday with unrestricted month and date fields, so weekly or seasonal schedules cannot satisfy the daily contract. Public packages require a semver-valid version. Published workspace packages under a `vendor` directory are unsupported; the contract CLI reports them rather than omitting them. `bundleDependencies` and `bundledDependencies` are unsupported because artifact staging does not install a bundled dependency tree; remove these fields before declaring consumer checks.
459
+ `workflow_dispatch` may also be enabled. That job calls the shared
460
+ `package-consumer-compat.yml` workflow at its approved immutable policy pin, with
461
+ `packages` as the same JSON array and `consumer-node` equal to the consumer policy
462
+ pin. Required `tooling-version` and `fixture-path` inputs equal the declared exact
463
+ `toolingVersion` and repository-relative `fixturePath`; its `consumer-compat.json` must
464
+ be tracked, parse with the runner’s fixture schema, and select exactly the declared package set. Replace `<installed tooling version>` with the exact installed
465
+ `@stll/oxlint-config` release that provides the consumer runner; the guard binds the
466
+ declaration to that package version. Every named package and its transitive workspace closure must be tracked,
467
+ published, and have valid manifests. Each selected package must support that Node version.
468
+ Unknown jobs, stale entries, undeclared consumer calls, and inconsistent inputs fail.
469
+ This declaration applies to consumer checks; `engineFloors` retains its separate
470
+ minimum-supported-major contract.
471
+
472
+ `stll-consumer-compat --packages '["packages/library"]' --consumer-node 22.23.3
473
+ --fixture-path tests/consumer` tests final tarballs in isolated projects with both
474
+ npm and pnpm. The repository builds once with its development toolchain first.
475
+ The runner reads the exact packer version and pack flags from a single tracked
476
+ release workflow and packs directly with that manager. Missing, ambiguous, or
477
+ unsupported pack configuration fails. Both consumers install the same release
478
+ artifacts; the runner does not rewrite workspace or catalog protocols through a
479
+ different manager. Fixture installs disable scripts, reject reserved runtime/manager bins throughout nested lifecycle paths, then approve only directly declared dependencies at their resolved lock identities. npm rebuilds those identities; pnpm runs its built-in pending rebuild. Both use the pinned consumer runtime before typecheck, build and smoke. Undeclared transitive build scripts receive no approval. Catalog entries that resolve to a local workspace
480
+ package are unsupported: use `workspace:` for that dependency. Registry catalog declarations are staged intact; the release packer must resolve
481
+ publication protocols. pnpm workspace owners require an adjacent tracked
482
+ `package.json`; manifestless owners are unsupported. Public package names must be
483
+ canonical lowercase, URL-safe npm names (at most 214 characters), with no traversal components. The runner verifies
484
+ the official Node archive checksum and exact runtime/package-manager versions,
485
+ uses the oldest published React satisfying the package peer range and, when ReactDOM is required, its compatible renderer peer range, typechecks with
486
+ the consumer TypeScript, and runs each fixture's build and usage smoke.
487
+
488
+ The fixture directory contains `consumer-compat.json`:
489
+
490
+ ```json
491
+ {
492
+ "packages": [
493
+ {
494
+ "package": "packages/library",
495
+ "fixture": "library",
496
+ "kind": "node",
497
+ "build": ["npm", "run", "build"],
498
+ "smoke": ["npm", "run", "smoke"]
499
+ }
500
+ ]
501
+ }
502
+ ```
503
+
504
+ Each fixture is a standalone project with its own source, package manifest, and
505
+ TypeScript configuration. Use `react` for a React peer and a render smoke; use
506
+ `node` for an import and representative call. Dependency bindings, runtime tools,
507
+ and caches belong to the runner. A nightly failure must open or update one issue
508
+ in the consuming repository and use its existing failure notification.
509
+
510
+ ## Toolchain changes and typecheck probes
511
+
512
+ `stll-toolchain-changed --since <git-ref>` compares committed snapshots at the
513
+ reference and `HEAD`. Fetch the reference and its history before running it.
514
+ It prints one JSON object with `changed`, `tools`, and `status`; the detector
515
+ exits successfully even when history is unreadable, reporting `changed: true`
516
+ and `status: "unreadable"`. Use `changed` to force the full CI depth on both
517
+ pull requests and merge-queue runs. An unreadable snapshot never skips checks.
518
+
519
+ The comparison includes Bun declarations, Node selectors and support ranges,
520
+ resolved TypeScript compiler versions (including workspace and compatibility
521
+ aliases), oxlint, oxlint-tsgolint, oxfmt, and shared tooling pins. Lockfile
522
+ resolutions determine installed package versions; manifest ranges alone do not.
523
+ Resolution locations and importer bindings are retained: swapping compiler
524
+ versions between workspaces cannot look unchanged. Compiler specifier changes
525
+ run parity even when the resolved release version is unchanged. Unknown lock
526
+ shapes and ambiguous resolutions report an unreadable snapshot. Supported text
527
+ locks include Bun JSONC (schema 0/1), pnpm YAML (5.4/6/9), npm package-lock/
528
+ shrinkwrap (1/2/3), and bounded Yarn Classic/Berry shapes; a binary-only Bun lock
529
+ cannot be compared without executing Bun.
530
+ Workflow/action and Docker definition edits conservatively force full CI.
531
+ Unrelated application dependency changes do not force compiler parity.
532
+ Setup-action runtime selectors and their tracked version-file contents must
533
+ identify an exact stable release (or a dated Rust nightly). Floating selectors,
534
+ ranges, expressions, empty
535
+ values, or omitted runtime versions report an unreadable snapshot and run parity
536
+ even when their committed text is unchanged.
537
+
538
+ On pull requests, run the repository's ordinary Bun typecheck and the probe,
539
+ then select parity using the same detector:
540
+
541
+ ```sh
542
+ stll-typecheck-probe --project packages/api/tsconfig.json --seed-dir packages/api/src -- bun run typecheck
543
+ stll-typecheck-parity --changed-since origin/main --project packages/api/tsconfig.json
544
+ ```
545
+
546
+ The probe writes an exclusive temporary TypeScript file in the declared
547
+ project, requires the command to fail with TS2322 attributed to that file, removes
548
+ it, and requires the clean command to pass. Use `--seed-dir` to select a repository-relative directory inside the project;
549
+ the default is the config directory. The config must include the seed directory;
550
+ excluded seeds fail instead of producing a vacuous pass. Commands are argv,
551
+ not shell expressions. Cleanup also runs on failure and handled termination.
552
+ Repeat the probe for independently checked projects as needed.
553
+
554
+ Conditional parity runs when Bun, TypeScript, or shared declarations change;
555
+ otherwise it prints `parity skipped: toolchain unchanged since ...`. An unreadable
556
+ reference runs full parity. Nightly jobs omit `--changed-since` to run full parity.
557
+ Node and lint-tool changes still force full CI through the shared detector.
558
+
559
+ Workflow, composite-action, Docker, mise, and tool-version declarations are
560
+ conservatively fingerprinted for compiler parity, including referenced tracked
561
+ setup-action version files (Node, Bun, Python, Go, Java and other runtimes).
562
+ Rust toolchain-file selectors and conventional runtime files are included;
563
+ cache-dependency-path is not a runtime selector. Compose and Kubernetes image
564
+ definitions are conservatively fingerprinted alongside Dockerfiles. Catalog and unresolved declaration changes also force parity;
565
+ an unclassifiable reference runs full parity. This may run parity for unrelated
566
+ edits to these declaration files. Active installed compiler comparisons still
567
+ use the owning lockfile resolutions.
568
+
569
+ Compiler patch declarations, lockfile patch hashes, and their tracked patch files
570
+ are included even when the compiler version is unchanged. Compiler patch-package
571
+ files are included too. Missing referenced compiler patches fail closed; unrelated
572
+ package patches do not trigger compiler parity.
573
+
574
+ Compiler manifest specifiers and complete compiler lock entries form part of the
575
+ change identity, including resolved URLs, integrity, commits, checksums and patch
576
+ hashes. Changing a source at the same release version runs parity. Local compiler
577
+ sources without an immutable byte identity fail closed; a version alone does not
578
+ identify a local directory. Git compiler sources require a full commit identity.
579
+ Supported text locks include Bun, npm, pnpm and bounded
580
+ Yarn Classic/Berry shapes; unrecognized lock shapes run parity. Yarn compiler
581
+ `patch:` protocols are unsupported and run parity because their patch bytes are
582
+ not represented by the lock checksum alone.
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const require_toolchain_inputs = require("./toolchain-inputs.cjs");
3
4
  const require_toolchain_guard = require("./toolchain-guard.cjs");
5
+ const require_toolchain_schema = require("./toolchain-schema.cjs");
4
6
  let node_fs = require("node:fs");
5
7
  let node_path = require("node:path");
6
8
  let node_fs_promises = require("node:fs/promises");
@@ -30,12 +32,12 @@ const main = async () => {
30
32
  if (cloud === void 0) throw new Error("requires an explicit cloud declaration");
31
33
  const nodeVersion = files[".node-version"];
32
34
  if (nodeVersion === void 0) throw new Error("requires tracked root .node-version");
33
- const script = require_toolchain_guard.generateCloudSetup({
34
- policy: require_toolchain_guard.parseToolchainPolicy(JSON.parse(await (0, node_fs_promises.readFile)(new URL("../toolchain.json", require("url").pathToFileURL(__filename).href), "utf8"))),
35
+ const script = require_toolchain_inputs.generateCloudSetup({
36
+ policy: require_toolchain_schema.parseToolchainPolicy(JSON.parse(await (0, node_fs_promises.readFile)(new URL("../toolchain.json", require("url").pathToFileURL(__filename).href), "utf8"))),
35
37
  cloud,
36
38
  nodeVersion: nodeVersion.trim()
37
39
  });
38
- const destination = (0, node_path.join)(root, require_toolchain_guard.cloudSetupPath);
40
+ const destination = (0, node_path.join)(root, require_toolchain_inputs.cloudSetupPath);
39
41
  const parent = (0, node_path.dirname)(destination);
40
42
  const parentStat = await optionalStat(parent);
41
43
  if (parentStat === void 0) await (0, node_fs_promises.mkdir)(parent);
@@ -52,7 +54,7 @@ const main = async () => {
52
54
  } finally {
53
55
  await output.close();
54
56
  }
55
- process.stdout.write(`Generated ${require_toolchain_guard.cloudSetupPath}\n`);
57
+ process.stdout.write(`Generated ${require_toolchain_inputs.cloudSetupPath}\n`);
56
58
  };
57
59
  main().catch((error) => {
58
60
  process.stderr.write(`cloud-setup: ${error instanceof Error ? error.message : String(error)}\n`);
@@ -1 +1 @@
1
- {"version":3,"file":"cloud-setup-cli.cjs","names":["readToolchainInputs","parseToolchainConfiguration","generateCloudSetup","parseToolchainPolicy","cloudSetupPath","constants"],"sources":["../src/cloud-setup-cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { constants } from \"node:fs\";\nimport { lstat, mkdir, open, readFile, realpath } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\n\nimport { cloudSetupPath, generateCloudSetup } from \"./cloud-setup\";\nimport {\n parseToolchainConfiguration,\n readToolchainInputs,\n} from \"./toolchain-guard\";\nimport { parseToolchainPolicy } from \"./toolchain-schema\";\n\nconst usage =\n \"Usage: stll-cloud-setup (run from repository root)\\n stll-cloud-setup --help\";\nconst optionalStat = async (path: string) => {\n try {\n return await lstat(path);\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\")\n return undefined;\n throw error;\n }\n};\n\nconst main = async () => {\n const args = process.argv.slice(2);\n if (args.length === 1 && args.at(0) === \"--help\") {\n process.stdout.write(`${usage}\\n`);\n return;\n }\n if (args.length !== 0) throw new Error(usage);\n const root = await realpath(process.cwd());\n const { files, diagnostics } = readToolchainInputs(root);\n if (diagnostics.length > 0)\n throw new Error(\n diagnostics.map(({ path, message }) => `${path}: ${message}`).join(\"\\n\"),\n );\n const text = files[\"stll-toolchain.json\"];\n if (text === undefined)\n throw new Error(\"requires tracked stll-toolchain.json\");\n const { cloud } = parseToolchainConfiguration(JSON.parse(text));\n if (cloud === undefined)\n throw new Error(\"requires an explicit cloud declaration\");\n const nodeVersion = files[\".node-version\"];\n if (nodeVersion === undefined)\n throw new Error(\"requires tracked root .node-version\");\n const policy = parseToolchainPolicy(\n JSON.parse(\n await readFile(new URL(\"../toolchain.json\", import.meta.url), \"utf8\"),\n ),\n );\n const script = generateCloudSetup({\n policy,\n cloud,\n nodeVersion: nodeVersion.trim(),\n });\n const destination = join(root, cloudSetupPath);\n const parent = dirname(destination);\n const parentStat = await optionalStat(parent);\n if (parentStat === undefined) await mkdir(parent);\n else if (parentStat.isSymbolicLink() || !parentStat.isDirectory())\n throw new Error(\"cloud setup parent must be a real repository directory\");\n const destinationStat = await optionalStat(destination);\n if (\n destinationStat !== undefined &&\n (destinationStat.isSymbolicLink() ||\n !destinationStat.isFile() ||\n destinationStat.nlink !== 1)\n )\n throw new Error(\n \"cloud setup destination must be a single-link regular repository file\",\n );\n const output = await open(\n destination,\n constants.O_WRONLY | constants.O_CREAT | constants.O_NOFOLLOW,\n 0o755,\n );\n try {\n const opened = await output.stat();\n if (!opened.isFile() || opened.nlink !== 1)\n throw new Error(\n \"cloud setup destination must be a single-link regular repository file\",\n );\n await output.truncate(0);\n await output.writeFile(script, \"utf8\");\n await output.chmod(0o755);\n } finally {\n await output.close();\n }\n process.stdout.write(`Generated ${cloudSetupPath}\\n`);\n};\n\nmain().catch((error: unknown) => {\n process.stderr.write(\n `cloud-setup: ${error instanceof Error ? error.message : String(error)}\\n`,\n );\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;AAYA,MAAM,QACJ;AACF,MAAM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A,UAAA,KAAA,CAAmB,MAAMC,wBAAAA,cAAc;CAC7C,MAAM,UAAA,GAAA,UAAA,QAAA,CAAiB,WAAW;CAClC,MAAM,aAAa,MAAM,aAAa,MAAM;CAC5C,IAAI,eAAe,KAAA,GAAW,OAAA,GAAA,iBAAA,MAAA,CAAY,MAAM;MAC3C,IAAI,WAAW,eAAe,KAAK,CAAC,WAAW,YAAY,GAC9D,MAAM,IAAI,MAAM,wDAAwD;CAC1E,MAAM,kBAAkB,MAAM,aAAa,WAAW;CACtD,IACE,oBAAoB,KAAA,MACnB,gBAAgB,eAAe,KAC9B,CAAC,gBAAgB,OAAO,KACxB,gBAAgB,UAAU,IAE5B,MAAM,IAAI,MACR,uEACF;CACF,MAAM,SAAS,OAAA,GAAA,iBAAA,KAAA,CACb,aACAC,QAAAA,UAAU,WAAWA,QAAAA,UAAU,UAAUA,QAAAA,UAAU,YACnD,GACF;CACA,IAAI;EACF,MAAM,SAAS,MAAM,OAAO,KAAK;EACjC,IAAI,CAAC,OAAO,OAAO,KAAK,OAAO,UAAU,GACvC,MAAM,IAAI,MACR,uEACF;EACF,MAAM,OAAO,SAAS,CAAC;EACvB,MAAM,OAAO,UAAU,QAAQ,MAAM;EACrC,MAAM,OAAO,MAAM,GAAK;CAC1B,UAAU;EACR,MAAM,OAAO,MAAM;CACrB;CACA,QAAQ,OAAO,MAAM,aAAaD,wBAAAA,eAAe,GAAG;AACtD;AAEA,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,QAAQ,OAAO,MACb,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GACzE;CACA,QAAQ,WAAW;AACrB,CAAC"}
1
+ {"version":3,"file":"cloud-setup-cli.cjs","names":["readToolchainInputs","parseToolchainConfiguration","generateCloudSetup","parseToolchainPolicy","cloudSetupPath","constants"],"sources":["../src/cloud-setup-cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { constants } from \"node:fs\";\nimport { lstat, mkdir, open, readFile, realpath } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\n\nimport { cloudSetupPath, generateCloudSetup } from \"./cloud-setup\";\nimport {\n parseToolchainConfiguration,\n readToolchainInputs,\n} from \"./toolchain-guard\";\nimport { parseToolchainPolicy } from \"./toolchain-schema\";\n\nconst usage =\n \"Usage: stll-cloud-setup (run from repository root)\\n stll-cloud-setup --help\";\nconst optionalStat = async (path: string) => {\n try {\n return await lstat(path);\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\")\n return undefined;\n throw error;\n }\n};\n\nconst main = async () => {\n const args = process.argv.slice(2);\n if (args.length === 1 && args.at(0) === \"--help\") {\n process.stdout.write(`${usage}\\n`);\n return;\n }\n if (args.length !== 0) throw new Error(usage);\n const root = await realpath(process.cwd());\n const { files, diagnostics } = readToolchainInputs(root);\n if (diagnostics.length > 0)\n throw new Error(\n diagnostics.map(({ path, message }) => `${path}: ${message}`).join(\"\\n\"),\n );\n const text = files[\"stll-toolchain.json\"];\n if (text === undefined)\n throw new Error(\"requires tracked stll-toolchain.json\");\n const { cloud } = parseToolchainConfiguration(JSON.parse(text));\n if (cloud === undefined)\n throw new Error(\"requires an explicit cloud declaration\");\n const nodeVersion = files[\".node-version\"];\n if (nodeVersion === undefined)\n throw new Error(\"requires tracked root .node-version\");\n const policy = parseToolchainPolicy(\n JSON.parse(\n await readFile(new URL(\"../toolchain.json\", import.meta.url), \"utf8\"),\n ),\n );\n const script = generateCloudSetup({\n policy,\n cloud,\n nodeVersion: nodeVersion.trim(),\n });\n const destination = join(root, cloudSetupPath);\n const parent = dirname(destination);\n const parentStat = await optionalStat(parent);\n if (parentStat === undefined) await mkdir(parent);\n else if (parentStat.isSymbolicLink() || !parentStat.isDirectory())\n throw new Error(\"cloud setup parent must be a real repository directory\");\n const destinationStat = await optionalStat(destination);\n if (\n destinationStat !== undefined &&\n (destinationStat.isSymbolicLink() ||\n !destinationStat.isFile() ||\n destinationStat.nlink !== 1)\n )\n throw new Error(\n \"cloud setup destination must be a single-link regular repository file\",\n );\n const output = await open(\n destination,\n constants.O_WRONLY | constants.O_CREAT | constants.O_NOFOLLOW,\n 0o755,\n );\n try {\n const opened = await output.stat();\n if (!opened.isFile() || opened.nlink !== 1)\n throw new Error(\n \"cloud setup destination must be a single-link regular repository file\",\n );\n await output.truncate(0);\n await output.writeFile(script, \"utf8\");\n await output.chmod(0o755);\n } finally {\n await output.close();\n }\n process.stdout.write(`Generated ${cloudSetupPath}\\n`);\n};\n\nmain().catch((error: unknown) => {\n process.stderr.write(\n `cloud-setup: ${error instanceof Error ? error.message : String(error)}\\n`,\n );\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;;;AAYA,MAAM,QACJ;AACF,MAAM,eAAe,OAAO,SAAiB;CAC3C,IAAI;EACF,OAAO,OAAA,GAAA,iBAAA,MAAA,CAAY,IAAI;CACzB,SAAS,OAAO;EACd,IAAI,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS,UAC9D,OAAO,KAAA;EACT,MAAM;CACR;AACF;AAEA,MAAM,OAAO,YAAY;CACvB,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;CACjC,IAAI,KAAK,WAAW,KAAK,KAAK,GAAG,CAAC,MAAM,UAAU;EAChD,QAAQ,OAAO,MAAM,GAAG,MAAM,GAAG;EACjC;CACF;CACA,IAAI,KAAK,WAAW,GAAG,MAAM,IAAI,MAAM,KAAK;CAC5C,MAAM,OAAO,OAAA,GAAA,iBAAA,SAAA,CAAe,QAAQ,IAAI,CAAC;CACzC,MAAM,EAAE,OAAO,gBAAgBA,wBAAAA,oBAAoB,IAAI;CACvD,IAAI,YAAY,SAAS,GACvB,MAAM,IAAI,MACR,YAAY,KAAK,EAAE,MAAM,cAAc,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,KAAK,IAAI,CACzE;CACF,MAAM,OAAO,MAAM;CACnB,IAAI,SAAS,KAAA,GACX,MAAM,IAAI,MAAM,sCAAsC;CACxD,MAAM,EAAE,U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AK;CAC1B,UAAU;EACR,MAAM,OAAO,MAAM;CACrB;CACA,QAAQ,OAAO,MAAM,aAAaD,yBAAAA,eAAe,GAAG;AACtD;AAEA,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,QAAQ,OAAO,MACb,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GACzE;CACA,QAAQ,WAAW;AACrB,CAAC"}
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { a as cloudSetupPath, i as parseToolchainPolicy, n as parseToolchainConfiguration, o as generateCloudSetup, r as readToolchainInputs } from "./toolchain-guard.mjs";
2
+ import { m as generateCloudSetup, p as cloudSetupPath } from "./toolchain-inputs.mjs";
3
+ import { n as parseToolchainConfiguration, r as readToolchainInputs } from "./toolchain-guard.mjs";
4
+ import { t as parseToolchainPolicy } from "./toolchain-schema.mjs";
3
5
  import { constants } from "node:fs";
4
6
  import { dirname, join } from "node:path";
5
7
  import { lstat, mkdir, open, readFile, realpath } from "node:fs/promises";
@@ -1 +1 @@
1
- {"version":3,"file":"cloud-setup-cli.mjs","names":[],"sources":["../src/cloud-setup-cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { constants } from \"node:fs\";\nimport { lstat, mkdir, open, readFile, realpath } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\n\nimport { cloudSetupPath, generateCloudSetup } from \"./cloud-setup\";\nimport {\n parseToolchainConfiguration,\n readToolchainInputs,\n} from \"./toolchain-guard\";\nimport { parseToolchainPolicy } from \"./toolchain-schema\";\n\nconst usage =\n \"Usage: stll-cloud-setup (run from repository root)\\n stll-cloud-setup --help\";\nconst optionalStat = async (path: string) => {\n try {\n return await lstat(path);\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\")\n return undefined;\n throw error;\n }\n};\n\nconst main = async () => {\n const args = process.argv.slice(2);\n if (args.length === 1 && args.at(0) === \"--help\") {\n process.stdout.write(`${usage}\\n`);\n return;\n }\n if (args.length !== 0) throw new Error(usage);\n const root = await realpath(process.cwd());\n const { files, diagnostics } = readToolchainInputs(root);\n if (diagnostics.length > 0)\n throw new Error(\n diagnostics.map(({ path, message }) => `${path}: ${message}`).join(\"\\n\"),\n );\n const text = files[\"stll-toolchain.json\"];\n if (text === undefined)\n throw new Error(\"requires tracked stll-toolchain.json\");\n const { cloud } = parseToolchainConfiguration(JSON.parse(text));\n if (cloud === undefined)\n throw new Error(\"requires an explicit cloud declaration\");\n const nodeVersion = files[\".node-version\"];\n if (nodeVersion === undefined)\n throw new Error(\"requires tracked root .node-version\");\n const policy = parseToolchainPolicy(\n JSON.parse(\n await readFile(new URL(\"../toolchain.json\", import.meta.url), \"utf8\"),\n ),\n );\n const script = generateCloudSetup({\n policy,\n cloud,\n nodeVersion: nodeVersion.trim(),\n });\n const destination = join(root, cloudSetupPath);\n const parent = dirname(destination);\n const parentStat = await optionalStat(parent);\n if (parentStat === undefined) await mkdir(parent);\n else if (parentStat.isSymbolicLink() || !parentStat.isDirectory())\n throw new Error(\"cloud setup parent must be a real repository directory\");\n const destinationStat = await optionalStat(destination);\n if (\n destinationStat !== undefined &&\n (destinationStat.isSymbolicLink() ||\n !destinationStat.isFile() ||\n destinationStat.nlink !== 1)\n )\n throw new Error(\n \"cloud setup destination must be a single-link regular repository file\",\n );\n const output = await open(\n destination,\n constants.O_WRONLY | constants.O_CREAT | constants.O_NOFOLLOW,\n 0o755,\n );\n try {\n const opened = await output.stat();\n if (!opened.isFile() || opened.nlink !== 1)\n throw new Error(\n \"cloud setup destination must be a single-link regular repository file\",\n );\n await output.truncate(0);\n await output.writeFile(script, \"utf8\");\n await output.chmod(0o755);\n } finally {\n await output.close();\n }\n process.stdout.write(`Generated ${cloudSetupPath}\\n`);\n};\n\nmain().catch((error: unknown) => {\n process.stderr.write(\n `cloud-setup: ${error instanceof Error ? error.message : String(error)}\\n`,\n );\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;AAYA,MAAM,QACJ;AACF,MAA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M;MAC3C,IAAI,WAAW,eAAe,KAAK,CAAC,WAAW,YAAY,GAC9D,MAAM,IAAI,MAAM,wDAAwD;CAC1E,MAAM,kBAAkB,MAAM,aAAa,WAAW;CACtD,IACE,oBAAoB,KAAA,MACnB,gBAAgB,eAAe,KAC9B,CAAC,gBAAgB,OAAO,KACxB,gBAAgB,UAAU,IAE5B,MAAM,IAAI,MACR,uEACF;CACF,MAAM,SAAS,MAAM,KACnB,aACA,UAAU,WAAW,UAAU,UAAU,UAAU,YACnD,GACF;CACA,IAAI;EACF,MAAM,SAAS,MAAM,OAAO,KAAK;EACjC,IAAI,CAAC,OAAO,OAAO,KAAK,OAAO,UAAU,GACvC,MAAM,IAAI,MACR,uEACF;EACF,MAAM,OAAO,SAAS,CAAC;EACvB,MAAM,OAAO,UAAU,QAAQ,MAAM;EACrC,MAAM,OAAO,MAAM,GAAK;CAC1B,UAAU;EACR,MAAM,OAAO,MAAM;CACrB;CACA,QAAQ,OAAO,MAAM,aAAa,eAAe,GAAG;AACtD;AAEA,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,QAAQ,OAAO,MACb,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GACzE;CACA,QAAQ,WAAW;AACrB,CAAC"}
1
+ {"version":3,"file":"cloud-setup-cli.mjs","names":[],"sources":["../src/cloud-setup-cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { constants } from \"node:fs\";\nimport { lstat, mkdir, open, readFile, realpath } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\n\nimport { cloudSetupPath, generateCloudSetup } from \"./cloud-setup\";\nimport {\n parseToolchainConfiguration,\n readToolchainInputs,\n} from \"./toolchain-guard\";\nimport { parseToolchainPolicy } from \"./toolchain-schema\";\n\nconst usage =\n \"Usage: stll-cloud-setup (run from repository root)\\n stll-cloud-setup --help\";\nconst optionalStat = async (path: string) => {\n try {\n return await lstat(path);\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\")\n return undefined;\n throw error;\n }\n};\n\nconst main = async () => {\n const args = process.argv.slice(2);\n if (args.length === 1 && args.at(0) === \"--help\") {\n process.stdout.write(`${usage}\\n`);\n return;\n }\n if (args.length !== 0) throw new Error(usage);\n const root = await realpath(process.cwd());\n const { files, diagnostics } = readToolchainInputs(root);\n if (diagnostics.length > 0)\n throw new Error(\n diagnostics.map(({ path, message }) => `${path}: ${message}`).join(\"\\n\"),\n );\n const text = files[\"stll-toolchain.json\"];\n if (text === undefined)\n throw new Error(\"requires tracked stll-toolchain.json\");\n const { cloud } = parseToolchainConfiguration(JSON.parse(text));\n if (cloud === undefined)\n throw new Error(\"requires an explicit cloud declaration\");\n const nodeVersion = files[\".node-version\"];\n if (nodeVersion === undefined)\n throw new Error(\"requires tracked root .node-version\");\n const policy = parseToolchainPolicy(\n JSON.parse(\n await readFile(new URL(\"../toolchain.json\", import.meta.url), \"utf8\"),\n ),\n );\n const script = generateCloudSetup({\n policy,\n cloud,\n nodeVersion: nodeVersion.trim(),\n });\n const destination = join(root, cloudSetupPath);\n const parent = dirname(destination);\n const parentStat = await optionalStat(parent);\n if (parentStat === undefined) await mkdir(parent);\n else if (parentStat.isSymbolicLink() || !parentStat.isDirectory())\n throw new Error(\"cloud setup parent must be a real repository directory\");\n const destinationStat = await optionalStat(destination);\n if (\n destinationStat !== undefined &&\n (destinationStat.isSymbolicLink() ||\n !destinationStat.isFile() ||\n destinationStat.nlink !== 1)\n )\n throw new Error(\n \"cloud setup destination must be a single-link regular repository file\",\n );\n const output = await open(\n destination,\n constants.O_WRONLY | constants.O_CREAT | constants.O_NOFOLLOW,\n 0o755,\n );\n try {\n const opened = await output.stat();\n if (!opened.isFile() || opened.nlink !== 1)\n throw new Error(\n \"cloud setup destination must be a single-link regular repository file\",\n );\n await output.truncate(0);\n await output.writeFile(script, \"utf8\");\n await output.chmod(0o755);\n } finally {\n await output.close();\n }\n process.stdout.write(`Generated ${cloudSetupPath}\\n`);\n};\n\nmain().catch((error: unknown) => {\n process.stderr.write(\n `cloud-setup: ${error instanceof Error ? error.message : String(error)}\\n`,\n );\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;;AAYA,MAAM,QACJ;AACF,MAAM,eAAe,OAAO,SAAiB;CAC3C,IAAI;EACF,OAAO,MAAM,MAAM,IAAI;CACzB,SAAS,OAAO;EACd,IAAI,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS,UAC9D,OAAO,KAAA;EACT,MAAM;CACR;AACF;AAEA,MAAM,OAAO,YAAY;CACvB,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;CACjC,IAAI,KAAK,WAAW,KAAK,KAAK,GAAG,CAAC,MAAM,UAAU;EAChD,QAAQ,OAAO,MAAM,GAAG,MAAM,GAAG;EACjC;CACF;CACA,IAAI,KAAK,WAAW,GAAG,MAAM,IAAI,MAAM,KAAK;CAC5C,MAAM,OAAO,MAAM,SAAS,QAAQ,IAAI,CAAC;CACzC,MAAM,EAAE,OAAO,gBAAgB,oBAAoB,IAAI;CACvD,IAAI,YAAY,SAAS,GACvB,MAAM,IAAI,MACR,YAAY,KAAK,EAAE,MAAM,cAAc,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,KAAK,IAAI,CACzE;CACF,MAAM,OAAO,MAAM;CACnB,IAAI,SAAS,KAAA,GACX,MAAM,IAAI,MAAM,sCAAsC;CACxD,MAAM,EAAE,UAAU,4BAA4B,KAAK,MAAM,IAAI,CAAC;CAC9D,IAAI,UAAU,KAAA,GACZ,MAAM,IAAI,MAAM,wCAAwC;CAC1D,MAAM,cAAc,MAAM;CAC1B,IAAI,gBAAgB,KAAA,GAClB,MAAM,IAAI,MAAM,qCAAqC;CAMvD,MAAM,SAAS,mBAAmB;EAChC,QANa,qBACb,KAAK,MACH,MAAM,SAAS,IAAI,IAAI,qBAAqB,OAAO,KAAK,GAAG,GAAG,MAAM,CACtE,CAGK;EACL;EACA,aAAa,YAAY,KAAK;CAChC,CAAC;CACD,MAAM,cAAc,KAAK,MAAM,cAAc;CAC7C,MAAM,SAAS,QAAQ,WAAW;CAClC,MAAM,aAAa,MAAM,aAAa,MAAM;CAC5C,IAAI,eAAe,KAAA,GAAW,MAAM,MAAM,MAAM;MAC3C,IAAI,WAAW,eAAe,KAAK,CAAC,WAAW,YAAY,GAC9D,MAAM,IAAI,MAAM,wDAAwD;CAC1E,MAAM,kBAAkB,MAAM,aAAa,WAAW;CACtD,IACE,oBAAoB,KAAA,MACnB,gBAAgB,eAAe,KAC9B,CAAC,gBAAgB,OAAO,KACxB,gBAAgB,UAAU,IAE5B,MAAM,IAAI,MACR,uEACF;CACF,MAAM,SAAS,MAAM,KACnB,aACA,UAAU,WAAW,UAAU,UAAU,UAAU,YACnD,GACF;CACA,IAAI;EACF,MAAM,SAAS,MAAM,OAAO,KAAK;EACjC,IAAI,CAAC,OAAO,OAAO,KAAK,OAAO,UAAU,GACvC,MAAM,IAAI,MACR,uEACF;EACF,MAAM,OAAO,SAAS,CAAC;EACvB,MAAM,OAAO,UAAU,QAAQ,MAAM;EACrC,MAAM,OAAO,MAAM,GAAK;CAC1B,UAAU;EACR,MAAM,OAAO,MAAM;CACrB;CACA,QAAQ,OAAO,MAAM,aAAa,eAAe,GAAG;AACtD;AAEA,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,QAAQ,OAAO,MACb,gBAAgB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,GACzE;CACA,QAAQ,WAAW;AACrB,CAAC"}
@@ -0,0 +1,28 @@
1
+ //#region src/compiler-packages.ts
2
+ const compilerPackages = {
3
+ typescript: "typescript",
4
+ typescriptCompatibility: "@typescript/typescript6",
5
+ native: "@typescript/native",
6
+ nativePreview: "@typescript/native-preview",
7
+ typescriptCompatibilityAlias: "typescript-compat",
8
+ bunTypes: "bun-types",
9
+ typesBun: "@types/bun",
10
+ tsgo: "tsgo",
11
+ typescriptTsgo: "@typescript/tsgo"
12
+ };
13
+ const isCompilerPackage = (name) => Object.values(compilerPackages).some((identifier) => identifier === name) || name.startsWith("@typescript/native-");
14
+ //#endregion
15
+ Object.defineProperty(exports, "compilerPackages", {
16
+ enumerable: true,
17
+ get: function() {
18
+ return compilerPackages;
19
+ }
20
+ });
21
+ Object.defineProperty(exports, "isCompilerPackage", {
22
+ enumerable: true,
23
+ get: function() {
24
+ return isCompilerPackage;
25
+ }
26
+ });
27
+
28
+ //# sourceMappingURL=compiler-packages.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler-packages.cjs","names":[],"sources":["../src/compiler-packages.ts"],"sourcesContent":["export const compilerPackages = {\n typescript: \"typescript\",\n typescriptCompatibility: \"@typescript/typescript6\",\n native: \"@typescript/native\",\n nativePreview: \"@typescript/native-preview\",\n typescriptCompatibilityAlias: \"typescript-compat\",\n bunTypes: \"bun-types\",\n typesBun: \"@types/bun\",\n tsgo: \"tsgo\",\n typescriptTsgo: \"@typescript/tsgo\",\n} as const;\n\nexport const isCompilerPackage = (name: string) =>\n Object.values(compilerPackages).some((identifier) => identifier === name) ||\n name.startsWith(\"@typescript/native-\");\n"],"mappings":";AAAA,MAAa,mBAAmB;CAC9B,YAAY;CACZ,yBAAyB;CACzB,QAAQ;CACR,eAAe;CACf,8BAA8B;CAC9B,UAAU;CACV,UAAU;CACV,MAAM;CACN,gBAAgB;AAClB;AAEA,MAAa,qBAAqB,SAChC,OAAO,OAAO,gBAAgB,CAAC,CAAC,MAAM,eAAe,eAAe,IAAI,KACxE,KAAK,WAAW,qBAAqB"}
@@ -0,0 +1,17 @@
1
+ //#region src/compiler-packages.ts
2
+ const compilerPackages = {
3
+ typescript: "typescript",
4
+ typescriptCompatibility: "@typescript/typescript6",
5
+ native: "@typescript/native",
6
+ nativePreview: "@typescript/native-preview",
7
+ typescriptCompatibilityAlias: "typescript-compat",
8
+ bunTypes: "bun-types",
9
+ typesBun: "@types/bun",
10
+ tsgo: "tsgo",
11
+ typescriptTsgo: "@typescript/tsgo"
12
+ };
13
+ const isCompilerPackage = (name) => Object.values(compilerPackages).some((identifier) => identifier === name) || name.startsWith("@typescript/native-");
14
+ //#endregion
15
+ export { isCompilerPackage as n, compilerPackages as t };
16
+
17
+ //# sourceMappingURL=compiler-packages.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler-packages.mjs","names":[],"sources":["../src/compiler-packages.ts"],"sourcesContent":["export const compilerPackages = {\n typescript: \"typescript\",\n typescriptCompatibility: \"@typescript/typescript6\",\n native: \"@typescript/native\",\n nativePreview: \"@typescript/native-preview\",\n typescriptCompatibilityAlias: \"typescript-compat\",\n bunTypes: \"bun-types\",\n typesBun: \"@types/bun\",\n tsgo: \"tsgo\",\n typescriptTsgo: \"@typescript/tsgo\",\n} as const;\n\nexport const isCompilerPackage = (name: string) =>\n Object.values(compilerPackages).some((identifier) => identifier === name) ||\n name.startsWith(\"@typescript/native-\");\n"],"mappings":";AAAA,MAAa,mBAAmB;CAC9B,YAAY;CACZ,yBAAyB;CACzB,QAAQ;CACR,eAAe;CACf,8BAA8B;CAC9B,UAAU;CACV,UAAU;CACV,MAAM;CACN,gBAAgB;AAClB;AAEA,MAAa,qBAAqB,SAChC,OAAO,OAAO,gBAAgB,CAAC,CAAC,MAAM,eAAe,eAAe,IAAI,KACxE,KAAK,WAAW,qBAAqB"}