@intentius/chant 0.124.31 → 0.124.32
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/bin/chant +7 -2
- package/dist/cli/commands/check-lexicon-plugin.d.ts +7 -4
- package/dist/cli/commands/check-lexicon-plugin.d.ts.map +1 -1
- package/dist/cli/commands/check-lexicon-plugin.js +10 -7
- package/dist/cli/commands/check-lexicon.d.ts.map +1 -1
- package/dist/cli/commands/check-lexicon.js +18 -12
- package/dist/cli/commands/import.d.ts +10 -0
- package/dist/cli/commands/import.d.ts.map +1 -1
- package/dist/cli/commands/import.js +37 -0
- package/dist/cli/commands/init-lexicon/templates/project.d.ts.map +1 -1
- package/dist/cli/commands/init-lexicon/templates/project.js +4 -3
- package/dist/cli/commands/onboard.d.ts.map +1 -1
- package/dist/cli/commands/onboard.js +8 -4
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +2 -1
- package/dist/cli/dependencies.d.ts +18 -0
- package/dist/cli/dependencies.d.ts.map +1 -0
- package/dist/cli/dependencies.js +120 -0
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +23 -4
- package/dist/cli/handlers/fan-out.d.ts.map +1 -1
- package/dist/cli/handlers/fan-out.js +12 -4
- package/dist/cli/handlers/graph.d.ts.map +1 -1
- package/dist/cli/handlers/graph.js +16 -6
- package/dist/cli/handlers/lint.d.ts.map +1 -1
- package/dist/cli/handlers/lint.js +6 -0
- package/dist/cli/handlers/operator.d.ts +2 -2
- package/dist/cli/handlers/operator.js +3 -3
- package/dist/cli/handlers/pr.d.ts +14 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +488 -32
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +3 -1
- package/dist/cli/handlers/run.d.ts +13 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +38 -15
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +44 -16
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +15 -0
- package/dist/cli/registry.d.ts +13 -4
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/cli/registry.js +6 -2
- package/dist/codegen/generate-post-synth-barrel.js +2 -2
- package/dist/codegen/lexicon-regen.d.ts +4 -0
- package/dist/codegen/lexicon-regen.d.ts.map +1 -1
- package/dist/codegen/lexicon-regen.js +1 -1
- package/dist/codegen/pinned-upgrade.js +2 -2
- package/dist/components/capability.d.ts +44 -3
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/capability.js +21 -0
- package/dist/components/changed-files.d.ts +7 -1
- package/dist/components/changed-files.d.ts.map +1 -1
- package/dist/components/changed-files.js +9 -1
- package/dist/components/driver.d.ts +38 -0
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +47 -6
- package/dist/components/fan-out-record.d.ts +6 -1
- package/dist/components/fan-out-record.d.ts.map +1 -1
- package/dist/components/fan-out-record.js +24 -0
- package/dist/components/fan-out-run.d.ts +20 -0
- package/dist/components/fan-out-run.d.ts.map +1 -1
- package/dist/components/fan-out-run.js +21 -1
- package/dist/components/pr-pipeline.d.ts +65 -2
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +107 -15
- package/dist/components/pr-run.d.ts +127 -29
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +290 -70
- package/dist/components/wave-plan.d.ts +5 -2
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +12 -1
- package/dist/discovery/fold-import.d.ts.map +1 -1
- package/dist/discovery/fold-import.js +16 -6
- package/dist/discovery/sandbox/bundle.d.ts.map +1 -1
- package/dist/discovery/sandbox/bundle.js +6 -0
- package/dist/discovery/specifier-resolve.d.ts.map +1 -1
- package/dist/discovery/specifier-resolve.js +8 -2
- package/dist/fold/fold.d.ts.map +1 -1
- package/dist/fold/fold.js +68 -1
- package/dist/fold/subset.d.ts +37 -0
- package/dist/fold/subset.d.ts.map +1 -1
- package/dist/fold/subset.js +88 -0
- package/dist/lexicon-module.d.ts +10 -0
- package/dist/lexicon-module.d.ts.map +1 -1
- package/dist/lexicon-module.js +53 -8
- package/dist/lexicon-plugin-helpers.d.ts.map +1 -1
- package/dist/lexicon-plugin-helpers.js +6 -4
- package/dist/lexicon.d.ts +2 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/affected.d.ts.map +1 -1
- package/dist/lifecycle/affected.js +7 -1
- package/dist/lifecycle/release-ledger.d.ts +21 -0
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +24 -0
- package/dist/lifecycle/work-dir.d.ts +45 -0
- package/dist/lifecycle/work-dir.d.ts.map +1 -0
- package/dist/lifecycle/work-dir.js +78 -0
- package/dist/lint/discover.d.ts +17 -9
- package/dist/lint/discover.d.ts.map +1 -1
- package/dist/lint/discover.js +62 -54
- package/dist/module-source.d.ts +57 -0
- package/dist/module-source.d.ts.map +1 -0
- package/dist/module-source.js +104 -0
- package/dist/op/activities/factory.js +1 -1
- package/dist/op/discover.d.ts.map +1 -1
- package/dist/op/discover.js +13 -3
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +3 -0
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +20 -5
- package/dist/op/operator.d.ts +2 -2
- package/dist/op/operator.js +2 -2
- package/dist/op/steward.d.ts +6 -4
- package/dist/op/steward.d.ts.map +1 -1
- package/dist/op/steward.js +5 -3
- package/dist/op/work-lease-run.d.ts +20 -7
- package/dist/op/work-lease-run.d.ts.map +1 -1
- package/dist/op/work-lease-run.js +56 -12
- package/dist/pr-forge.d.ts +10 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +39 -0
- package/dist/pr-loop.d.ts +141 -4
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +122 -6
- package/dist/pr-report-url.d.ts +2 -2
- package/dist/pr-report-url.d.ts.map +1 -1
- package/dist/pr-report-url.js +5 -5
- package/dist/ts-loader.d.ts +38 -4
- package/dist/ts-loader.d.ts.map +1 -1
- package/dist/ts-loader.js +190 -16
- package/dist/wave-runtime.mjs +208 -208
- package/dist/workspace/chant-migrations/fountain-retired-kinds.d.ts +34 -0
- package/dist/workspace/chant-migrations/fountain-retired-kinds.d.ts.map +1 -0
- package/dist/workspace/chant-migrations/fountain-retired-kinds.js +176 -0
- package/dist/workspace/chant-migrations.d.ts.map +1 -1
- package/dist/workspace/chant-migrations.js +2 -0
- package/dist/workspace/checks/boxes.d.ts +6 -6
- package/dist/workspace/checks/boxes.js +9 -9
- package/dist/workspace/ci-green-forge.d.ts +6 -4
- package/dist/workspace/ci-green-forge.d.ts.map +1 -1
- package/dist/workspace/ci-green.d.ts +28 -12
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +49 -21
- package/dist/workspace/ci-list.schema.json +12 -6
- package/dist/workspace/ci-report-url.d.ts +18 -0
- package/dist/workspace/ci-report-url.d.ts.map +1 -0
- package/dist/workspace/ci-report-url.js +33 -0
- package/dist/workspace/ci-run-index.d.ts +12 -0
- package/dist/workspace/ci-run-index.d.ts.map +1 -1
- package/dist/workspace/ci-run-index.js +6 -4
- package/dist/workspace/ci-run-index.schema.json +5 -3
- package/dist/workspace/ci-run.d.ts +75 -2
- package/dist/workspace/ci-run.d.ts.map +1 -1
- package/dist/workspace/ci-run.js +195 -53
- package/dist/workspace/ci-runner-key.d.ts +16 -3
- package/dist/workspace/ci-runner-key.d.ts.map +1 -1
- package/dist/workspace/ci-runner-key.js +30 -10
- package/dist/workspace/ci-serve.d.ts +54 -4
- package/dist/workspace/ci-serve.d.ts.map +1 -1
- package/dist/workspace/ci-serve.js +175 -26
- package/dist/workspace/declaration.d.ts +8 -0
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +11 -2
- package/dist/workspace/declaration.schema.json +7 -2
- package/dist/workspace/export.d.ts +1 -1
- package/dist/workspace/export.d.ts.map +1 -1
- package/dist/workspace/export.js +7 -3
- package/dist/workspace/ls.d.ts +6 -1
- package/dist/workspace/ls.d.ts.map +1 -1
- package/dist/workspace/ls.js +1 -0
- package/dist/workspace/ls.schema.json +7 -1
- package/dist/workspace/pin-integrity.d.ts.map +1 -1
- package/dist/workspace/pin-integrity.js +3 -2
- package/dist/workspace/pr-report.schema.json +74 -7
- package/dist/workspace/reason-codes.d.ts +1 -1
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +2 -2
- package/dist/workspace/run-event.schema.json +3 -1
- package/dist/workspace/status.schema.json +3 -1
- package/dist/workspace/write-scope.d.ts +9 -0
- package/dist/workspace/write-scope.d.ts.map +1 -1
- package/dist/workspace/write-scope.js +11 -1
- package/package.json +1 -1
- package/src/__fixtures__/pr-loop/pr-apply-wave-waiting.note.golden.md +48 -0
- package/src/cli/commands/__fixtures__/init-lexicon-output/package.json +3 -3
- package/src/cli/commands/audit.test.ts +2 -2
- package/src/cli/commands/check-lexicon-plugin.test.ts +9 -0
- package/src/cli/commands/check-lexicon-plugin.ts +11 -8
- package/src/cli/commands/check-lexicon.test.ts +1 -1
- package/src/cli/commands/check-lexicon.ts +16 -11
- package/src/cli/commands/import.ts +40 -0
- package/src/cli/commands/init-lexicon/templates/project.ts +4 -3
- package/src/cli/commands/init-lexicon.test.ts +8 -5
- package/src/cli/commands/onboard.test.ts +45 -0
- package/src/cli/commands/onboard.ts +8 -4
- package/src/cli/commands/update.test.ts +6 -0
- package/src/cli/commands/update.ts +4 -1
- package/src/cli/compiled-cli.e2e.test.ts +76 -11
- package/src/cli/dependencies.e2e.test.ts +101 -0
- package/src/cli/dependencies.test.ts +93 -0
- package/src/cli/dependencies.ts +122 -0
- package/src/cli/handlers/build.test.ts +69 -0
- package/src/cli/handlers/build.ts +20 -4
- package/src/cli/handlers/fan-out.test.ts +73 -0
- package/src/cli/handlers/fan-out.ts +11 -4
- package/src/cli/handlers/graph.test.ts +76 -0
- package/src/cli/handlers/graph.ts +19 -12
- package/src/cli/handlers/lint.test.ts +42 -0
- package/src/cli/handlers/lint.ts +6 -0
- package/src/cli/handlers/operator.ts +3 -3
- package/src/cli/handlers/pr-waves.test.ts +449 -0
- package/src/cli/handlers/pr.test.ts +134 -0
- package/src/cli/handlers/pr.ts +523 -31
- package/src/cli/handlers/promote.test.ts +26 -1
- package/src/cli/handlers/promote.ts +3 -2
- package/src/cli/handlers/run-components-exit.test.ts +99 -0
- package/src/cli/handlers/run-signer.test.ts +79 -0
- package/src/cli/handlers/run.ts +34 -16
- package/src/cli/main.test.ts +18 -0
- package/src/cli/main.ts +43 -16
- package/src/cli/parse-args.ts +12 -0
- package/src/cli/registry.ts +19 -6
- package/src/codegen/generate-post-synth-barrel.ts +2 -2
- package/src/codegen/lexicon-regen.ts +1 -1
- package/src/codegen/pinned-upgrade.ts +2 -2
- package/src/codegen/post-synth-barrel-guards.test.ts +6 -11
- package/src/components/capability.ts +51 -3
- package/src/components/changed-files.test.ts +16 -1
- package/src/components/changed-files.ts +9 -1
- package/src/components/driver.test.ts +36 -1
- package/src/components/driver.ts +76 -4
- package/src/components/fan-out-record.ts +29 -1
- package/src/components/fan-out-run.test.ts +35 -0
- package/src/components/fan-out-run.ts +40 -1
- package/src/components/pr-pipeline.test.ts +100 -0
- package/src/components/pr-pipeline.ts +132 -17
- package/src/components/pr-run.test.ts +323 -18
- package/src/components/pr-run.ts +354 -75
- package/src/components/wave-plan.ts +16 -4
- package/src/discovery/fold-host-method.test.ts +87 -0
- package/src/discovery/fold-import.ts +15 -5
- package/src/discovery/fold-package-composite.test.ts +27 -0
- package/src/discovery/fold-specifiers.test.ts +8 -0
- package/src/discovery/sandbox/bundle.ts +6 -0
- package/src/discovery/specifier-resolve.ts +8 -2
- package/src/fold/fold.test.ts +72 -0
- package/src/fold/fold.ts +71 -0
- package/src/fold/subset.test.ts +31 -0
- package/src/fold/subset.ts +99 -0
- package/src/lexicon-dist.e2e.test.ts +254 -0
- package/src/lexicon-module.test.ts +47 -0
- package/src/lexicon-module.ts +49 -7
- package/src/lexicon-plugin-helpers.ts +6 -4
- package/src/lexicon.ts +2 -0
- package/src/lifecycle/affected.test.ts +7 -0
- package/src/lifecycle/affected.ts +6 -1
- package/src/lifecycle/release-ledger.ts +34 -0
- package/src/lifecycle/work-dir.test.ts +77 -0
- package/src/lifecycle/work-dir.ts +82 -0
- package/src/lint/discover.test.ts +46 -2
- package/src/lint/discover.ts +55 -49
- package/src/module-source.test.ts +85 -0
- package/src/module-source.ts +112 -0
- package/src/op/activities/factory.ts +1 -1
- package/src/op/discover-root.test.ts +31 -2
- package/src/op/discover.ts +14 -4
- package/src/op/gate.test.ts +30 -0
- package/src/op/gate.ts +3 -0
- package/src/op/op-waves-run.ts +20 -5
- package/src/op/op-waves.test.ts +49 -0
- package/src/op/operator.ts +2 -2
- package/src/op/steward.ts +6 -4
- package/src/op/work-lease-run.test.ts +88 -2
- package/src/op/work-lease-run.ts +52 -12
- package/src/pr-forge-bundle.test.ts +2 -2
- package/src/pr-forge.test.ts +42 -0
- package/src/pr-forge.ts +40 -0
- package/src/pr-loop-bundle.test.ts +2 -1
- package/src/pr-loop.test.ts +117 -1
- package/src/pr-loop.ts +252 -10
- package/src/pr-report-url.ts +5 -5
- package/src/terraform/__fixtures__/advise.test.ts +21 -2
- package/src/ts-loader.test.ts +89 -1
- package/src/ts-loader.ts +180 -13
- package/src/workspace/changes.test.ts +1 -1
- package/src/workspace/chant-migrations/fountain-retired-kinds.test.ts +33 -0
- package/src/workspace/chant-migrations/fountain-retired-kinds.ts +190 -0
- package/src/workspace/chant-migrations.e2e.test.ts +5 -0
- package/src/workspace/chant-migrations.ts +2 -0
- package/src/workspace/checks/boxes.ts +9 -9
- package/src/workspace/ci-green-forge.ts +6 -4
- package/src/workspace/ci-green-runs.test.ts +53 -11
- package/src/workspace/ci-green.test.ts +1 -1
- package/src/workspace/ci-green.ts +50 -22
- package/src/workspace/ci-list.schema.json +12 -6
- package/src/workspace/ci-report-url.test.ts +220 -0
- package/src/workspace/ci-report-url.ts +33 -0
- package/src/workspace/ci-run-index.schema.json +5 -3
- package/src/workspace/ci-run-index.test.ts +42 -3
- package/src/workspace/ci-run-index.ts +18 -4
- package/src/workspace/ci-run.test.ts +185 -7
- package/src/workspace/ci-run.ts +224 -54
- package/src/workspace/ci-runner-key.test.ts +55 -17
- package/src/workspace/ci-runner-key.ts +36 -11
- package/src/workspace/ci-serve.test.ts +150 -6
- package/src/workspace/ci-serve.ts +169 -25
- package/src/workspace/declaration.schema.json +7 -2
- package/src/workspace/declaration.test.ts +23 -0
- package/src/workspace/declaration.ts +19 -3
- package/src/workspace/export.ts +6 -3
- package/src/workspace/ls.schema.json +7 -1
- package/src/workspace/ls.ts +7 -2
- package/src/workspace/pin-integrity.test.ts +5 -0
- package/src/workspace/pin-integrity.ts +3 -2
- package/src/workspace/pr-report.schema.json +74 -7
- package/src/workspace/reason-codes.ts +2 -2
- package/src/workspace/run-event.schema.json +3 -1
- package/src/workspace/status.schema.json +3 -1
- package/src/workspace/write-scope.test.ts +29 -1
- package/src/workspace/write-scope.ts +12 -1
package/bin/chant
CHANGED
|
@@ -22,6 +22,11 @@ if [ -f "$MAIN_JS" ] && [ ! -f "$SCRIPT_DIR/../tsconfig.build.json" ]; then
|
|
|
22
22
|
exec node "$MAIN_JS" "$@"
|
|
23
23
|
fi
|
|
24
24
|
|
|
25
|
+
# From source, every chant package resolves through its `development` export
|
|
26
|
+
# condition to src/*.ts (#3981). A lexicon's `default` is the dist/*.js it
|
|
27
|
+
# publishes, which a checkout may not have built or may have built from older
|
|
28
|
+
# source. Child processes that reuse process.execArgv inherit the flag.
|
|
29
|
+
#
|
|
25
30
|
# tsx is our own dependency, so register its hooks in this node process rather
|
|
26
31
|
# than shelling `npx tsx`, which resolves a bin and then spawns a second node.
|
|
27
32
|
# Worth ~30% of startup (#2481). Nested install first, then hoisted; npx stays
|
|
@@ -31,8 +36,8 @@ for CANDIDATE in \
|
|
|
31
36
|
"$SCRIPT_DIR/../../../tsx/dist/loader.mjs"
|
|
32
37
|
do
|
|
33
38
|
if [ -f "$CANDIDATE" ]; then
|
|
34
|
-
exec node --import "file://$CANDIDATE" "$MAIN_TS" "$@"
|
|
39
|
+
exec node --conditions=development --import "file://$CANDIDATE" "$MAIN_TS" "$@"
|
|
35
40
|
fi
|
|
36
41
|
done
|
|
37
42
|
|
|
38
|
-
exec npx tsx "$MAIN_TS" "$@"
|
|
43
|
+
exec npx tsx --conditions=development "$MAIN_TS" "$@"
|
|
@@ -28,11 +28,14 @@ export interface LoadedLexicon {
|
|
|
28
28
|
entry?: string;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* The module a lexicon package presents to consumers.
|
|
31
|
+
* The module a lexicon package presents to consumers, as its source.
|
|
32
32
|
*
|
|
33
|
-
* Tier 1 requires `exports["."].
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* Tier 1 requires `exports["."].development` to be `./src/index.ts` and
|
|
34
|
+
* `default` to be its compiled `./dist/index.js` (#3981). The check reads the
|
|
35
|
+
* lexicon's source, so `development` is the first choice: a `dist/` may be
|
|
36
|
+
* missing or older than the source. `default` and `main` come next, and the
|
|
37
|
+
* conventional paths keep this usable on a lexicon that has not reached that
|
|
38
|
+
* check yet.
|
|
36
39
|
*/
|
|
37
40
|
export declare function pluginEntryFor(dir: string): string | undefined;
|
|
38
41
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-lexicon-plugin.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/check-lexicon-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAIpE,MAAM,WAAW,aAAa;IAC5B,iDAAiD;IACjD,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED
|
|
1
|
+
{"version":3,"file":"check-lexicon-plugin.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/check-lexicon-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAIpE,MAAM,WAAW,aAAa;IAC5B,iDAAiD;IACjD,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAoB9D;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAyB5E;AAED,iEAAiE;AACjE,wBAAgB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,aAAa,GAAG,OAAO,CAE/F;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,SAAS,GAAG;IAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAOvF"}
|
|
@@ -22,20 +22,23 @@ import { existsSync, readFileSync } from "fs";
|
|
|
22
22
|
import { isAbsolute, join, resolve } from "path";
|
|
23
23
|
import { pathToFileURL } from "url";
|
|
24
24
|
import { isLexiconPlugin } from "../../lexicon.js";
|
|
25
|
-
import {
|
|
25
|
+
import { ensureTypeScriptLoaderFor } from "../../ts-loader.js";
|
|
26
26
|
import { esModuleNamespace } from "../../module-interop.js";
|
|
27
27
|
/**
|
|
28
|
-
* The module a lexicon package presents to consumers.
|
|
28
|
+
* The module a lexicon package presents to consumers, as its source.
|
|
29
29
|
*
|
|
30
|
-
* Tier 1 requires `exports["."].
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
* Tier 1 requires `exports["."].development` to be `./src/index.ts` and
|
|
31
|
+
* `default` to be its compiled `./dist/index.js` (#3981). The check reads the
|
|
32
|
+
* lexicon's source, so `development` is the first choice: a `dist/` may be
|
|
33
|
+
* missing or older than the source. `default` and `main` come next, and the
|
|
34
|
+
* conventional paths keep this usable on a lexicon that has not reached that
|
|
35
|
+
* check yet.
|
|
33
36
|
*/
|
|
34
37
|
export function pluginEntryFor(dir) {
|
|
35
38
|
const candidates = [];
|
|
36
39
|
try {
|
|
37
40
|
const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf-8"));
|
|
38
|
-
for (const declared of [pkg.exports?.["."]?.default, pkg.main]) {
|
|
41
|
+
for (const declared of [pkg.exports?.["."]?.development, pkg.exports?.["."]?.default, pkg.main]) {
|
|
39
42
|
if (typeof declared === "string")
|
|
40
43
|
candidates.push(declared);
|
|
41
44
|
}
|
|
@@ -64,7 +67,7 @@ export async function loadLexiconFromDir(dir) {
|
|
|
64
67
|
}
|
|
65
68
|
let mod;
|
|
66
69
|
try {
|
|
67
|
-
|
|
70
|
+
ensureTypeScriptLoaderFor(entry);
|
|
68
71
|
mod = esModuleNamespace((await import(pathToFileURL(entry).href)));
|
|
69
72
|
}
|
|
70
73
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-lexicon.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/check-lexicon.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,MAAM,WAAW,SAAS;IACxB,IAAI,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CAAC;CACpB;AAyBD,gEAAgE;AAChE;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAIlE;AAuBD;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAyB/F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,aAAa,GAAG,SAAS,EACjC,GAAG,EAAE,MAAM,GACV;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAanC;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAazE;AAID;;GAEG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAinBpE;AAqBD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAmDzE"}
|
|
@@ -272,26 +272,32 @@ export async function checkLexicon(dir) {
|
|
|
272
272
|
pass: chantVersionOk,
|
|
273
273
|
detail: chantVersionDetail,
|
|
274
274
|
});
|
|
275
|
-
// chant #1067 — packaging shape
|
|
276
|
-
//
|
|
277
|
-
//
|
|
278
|
-
//
|
|
275
|
+
// chant #1067 — packaging shape, real but unenforced before: a lexicon
|
|
276
|
+
// shipping differently would break consumers silently. Cheap structural
|
|
277
|
+
// check on package.json, not a build execution. #3981 — lexicons ship
|
|
278
|
+
// compiled JS: `default` is ./dist/index.js, `development` stays on
|
|
279
|
+
// ./src/index.ts for the repository's tools, and the build keeps the JS tsc
|
|
280
|
+
// emits (it used to delete it).
|
|
279
281
|
const packageJsonRaw = readOr(join(dir, "package.json"));
|
|
280
282
|
let packagingOk = false;
|
|
281
283
|
let packagingDetail;
|
|
282
284
|
if (packageJsonRaw) {
|
|
283
285
|
try {
|
|
284
286
|
const pkg = JSON.parse(packageJsonRaw);
|
|
287
|
+
const developmentExport = pkg.exports?.["."]?.development;
|
|
285
288
|
const defaultExport = pkg.exports?.["."]?.default;
|
|
286
289
|
const buildScript = pkg.scripts?.build ?? "";
|
|
287
|
-
const
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
+
const developmentOk = developmentExport === "./src/index.ts";
|
|
291
|
+
const defaultOk = defaultExport === "./dist/index.js";
|
|
292
|
+
const keepsEmittedJs = /tsconfig\.build\.json/.test(buildScript) && !/-delete/.test(buildScript);
|
|
293
|
+
packagingOk = developmentOk && defaultOk && keepsEmittedJs;
|
|
290
294
|
const problems = [];
|
|
291
|
-
if (!
|
|
292
|
-
problems.push(`exports["."].
|
|
293
|
-
if (!
|
|
294
|
-
problems.push(`
|
|
295
|
+
if (!developmentOk)
|
|
296
|
+
problems.push(`exports["."].development is ${JSON.stringify(developmentExport)}, expected "./src/index.ts"`);
|
|
297
|
+
if (!defaultOk)
|
|
298
|
+
problems.push(`exports["."].default is ${JSON.stringify(defaultExport)}, expected "./dist/index.js"`);
|
|
299
|
+
if (!keepsEmittedJs)
|
|
300
|
+
problems.push(`build script must compile tsconfig.build.json and keep the emitted .js in dist/: ${JSON.stringify(buildScript)}`);
|
|
295
301
|
packagingDetail = problems.length > 0 ? problems.join("; ") : undefined;
|
|
296
302
|
}
|
|
297
303
|
catch {
|
|
@@ -302,7 +308,7 @@ export async function checkLexicon(dir) {
|
|
|
302
308
|
packagingDetail = "package.json missing or unreadable";
|
|
303
309
|
}
|
|
304
310
|
items.push({
|
|
305
|
-
name: 'package.json routes exports["."]
|
|
311
|
+
name: 'package.json routes exports["."] development at ./src/index.ts and default at ./dist/index.js, and build keeps emitted JS',
|
|
306
312
|
tier: 1,
|
|
307
313
|
pass: packagingOk,
|
|
308
314
|
detail: packagingDetail,
|
|
@@ -116,6 +116,16 @@ export interface ContentImportOptions {
|
|
|
116
116
|
parserOptions?: string[];
|
|
117
117
|
}
|
|
118
118
|
export declare function importFromContent(options: ContentImportOptions): Promise<ImportResult>;
|
|
119
|
+
/**
|
|
120
|
+
* Build the source import wrote and name each error-severity post-synth
|
|
121
|
+
* finding that would stop `chant build` (#3605). The findings go through the
|
|
122
|
+
* same `lint.presets` and `lint.rules` filtering build applies, against the
|
|
123
|
+
* project config above `outputDir`, so a check the project turns off is not
|
|
124
|
+
* named. When the source does not build here (the lexicon is not installed
|
|
125
|
+
* beside it, or embedded content needs another lexicon's serializer), nothing
|
|
126
|
+
* is said: import reports what build would refuse, not why it cannot run.
|
|
127
|
+
*/
|
|
128
|
+
export declare function buildErrorWarnings(plugin: LexiconPlugin, outputDir: string): Promise<string[]>;
|
|
119
129
|
/**
|
|
120
130
|
* Live import options — read from a running cloud/cluster instead of a file.
|
|
121
131
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/import.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAyC,MAAM,qBAAqB,CAAC;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAEjF,OAAO,KAAK,EAAoB,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAMvF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,sBAA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B;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,+EAA+E;IAC/E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+GAA+G;IAC/G,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAkBD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAatF;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,QAAQ,CAAC,EACpD,MAAM,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,GAC3C,OAAO,CAAC,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,CAAC,CAAC,CAezD;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,aAAa,EAAE,EACxB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,YAAY,CAAC,CAgHvB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAsB5D"}
|
|
@@ -395,6 +395,41 @@ async function parseWithEmbedded(parses, loaded, projectDir) {
|
|
|
395
395
|
const embedded = new EmbeddedImports(importers);
|
|
396
396
|
return { irs: parses.map((parse) => parse({ embedded })), embedded };
|
|
397
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* Build the source import wrote and name each error-severity post-synth
|
|
400
|
+
* finding that would stop `chant build` (#3605). The findings go through the
|
|
401
|
+
* same `lint.presets` and `lint.rules` filtering build applies, against the
|
|
402
|
+
* project config above `outputDir`, so a check the project turns off is not
|
|
403
|
+
* named. When the source does not build here (the lexicon is not installed
|
|
404
|
+
* beside it, or embedded content needs another lexicon's serializer), nothing
|
|
405
|
+
* is said: import reports what build would refuse, not why it cannot run.
|
|
406
|
+
*/
|
|
407
|
+
export async function buildErrorWarnings(plugin, outputDir) {
|
|
408
|
+
try {
|
|
409
|
+
const checks = plugin.postSynthChecks?.() ?? [];
|
|
410
|
+
if (checks.length === 0)
|
|
411
|
+
return [];
|
|
412
|
+
const [{ build }, { runPostSynthChecks }, { applyConfiguredPreset, applyConfiguredSeverity, resolvePresetIds }, { loadChantConfigUpward }] = await Promise.all([import("../../build.js"), import("../../lint/post-synth.js"), import("../../lint/config.js"), import("../../config.js")]);
|
|
413
|
+
const result = await build(outputDir, [plugin.serializer]);
|
|
414
|
+
if (result.errors.length > 0)
|
|
415
|
+
return [];
|
|
416
|
+
const { config } = await loadChantConfigUpward(outputDir);
|
|
417
|
+
const rules = config.lint?.rules;
|
|
418
|
+
// As build.ts runLexiconPostSynthChecks does: the plugin sees its own output only.
|
|
419
|
+
const output = result.outputs.get(plugin.serializer.name);
|
|
420
|
+
const outputs = new Map(output === undefined ? [] : [[plugin.serializer.name, output]]);
|
|
421
|
+
const diagnostics = runPostSynthChecks(checks, { ...result, outputs });
|
|
422
|
+
const presetIds = resolvePresetIds(plugin.lintPresets?.(), config.lint?.presets?.[plugin.name] ?? "recommended");
|
|
423
|
+
const afterPreset = applyConfiguredPreset(diagnostics, presetIds, rules).diagnostics;
|
|
424
|
+
return applyConfiguredSeverity(afterPreset, rules)
|
|
425
|
+
.diagnostics.filter((diag) => diag.severity === "error")
|
|
426
|
+
.map((diag) => `${diag.checkId}: ${diag.message.replace(/\.$/, "")}. chant build stops on this error; ` +
|
|
427
|
+
`change the generated source, or set lint.rules.${diag.checkId} to "off" in chant.config.ts.`);
|
|
428
|
+
}
|
|
429
|
+
catch {
|
|
430
|
+
return [];
|
|
431
|
+
}
|
|
432
|
+
}
|
|
398
433
|
/** The shared tail of every template import: parse → generate → write. */
|
|
399
434
|
async function parseAndWrite(plugin, content, outputDir, force, warnings, generatedFiles, lexicon, projectDir, parserOptionEntries) {
|
|
400
435
|
// A lexicon can recognize a template (detectTemplate) without being able to
|
|
@@ -470,6 +505,8 @@ async function parseAndWrite(plugin, content, outputDir, force, warnings, genera
|
|
|
470
505
|
writeFileSync(filePath, file.content);
|
|
471
506
|
generatedFiles.push(file.path);
|
|
472
507
|
}
|
|
508
|
+
// What `chant build` will refuse, said now rather than at the first build (#3605).
|
|
509
|
+
warnings.push(...(await buildErrorWarnings(plugin, outputDir)));
|
|
473
510
|
return {
|
|
474
511
|
success: true,
|
|
475
512
|
generatedFiles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/init-lexicon/templates/project.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/init-lexicon/templates/project.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAyCxF;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAWzC;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAmB9C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA4BrD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAK1C;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CA4BnF;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CA0BnH;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA8BvD;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAO9C;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAuB7C"}
|
|
@@ -12,12 +12,12 @@ export function generatePackageJson(name, names) {
|
|
|
12
12
|
".": {
|
|
13
13
|
development: "./src/index.ts",
|
|
14
14
|
types: "./dist/index.d.ts",
|
|
15
|
-
default: "./
|
|
15
|
+
default: "./dist/index.js",
|
|
16
16
|
},
|
|
17
17
|
"./*": {
|
|
18
18
|
development: "./src/*.ts",
|
|
19
19
|
types: "./dist/*.d.ts",
|
|
20
|
-
default: "./
|
|
20
|
+
default: "./dist/*.js",
|
|
21
21
|
},
|
|
22
22
|
"./manifest": "./dist/manifest.json",
|
|
23
23
|
"./meta": "./dist/meta.json",
|
|
@@ -27,7 +27,8 @@ export function generatePackageJson(name, names) {
|
|
|
27
27
|
generate: "npx tsx src/codegen/generate-cli.ts",
|
|
28
28
|
validate: "npx tsx src/validate-cli.ts",
|
|
29
29
|
docs: "npx tsx src/codegen/docs-cli.ts",
|
|
30
|
-
|
|
30
|
+
// #3981 — the package ships the compiled dist/*.js its exports' `default` names.
|
|
31
|
+
build: "tsc -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json",
|
|
31
32
|
prepack: "npm run generate && npm run bundle && npm run validate && npm run build",
|
|
32
33
|
bundle: "tsx src/package-cli.ts",
|
|
33
34
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboard.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/onboard.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,0FAA0F;IAC1F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"onboard.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/onboard.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,0FAA0F;IAC1F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAyFD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAyB9E;AAuDD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAoB7E;AA4FD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAqB3E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAU5E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,aAAa,CA2DrE;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8C3F"}
|
|
@@ -9,13 +9,14 @@ function findRepoRoot() {
|
|
|
9
9
|
return dirname(dirname(dirname(dirname(dirname(here))))); // -> root
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* A real prepack invocation line: a Dockerfile `RUN`, a workflow `- run
|
|
13
|
-
*
|
|
12
|
+
* A real prepack invocation line: a Dockerfile `RUN`, a workflow `- run:` or
|
|
13
|
+
* `run:` step key (a named step puts `run:` on its own line, #2877), or a bare
|
|
14
|
+
* line inside a `run: |` block. Comments, `echo` messages and
|
|
14
15
|
* `$lex` / `<lex>` placeholders do not match. Matching those placeholder
|
|
15
16
|
* substrings was how onboard appended duplicates to Dockerfile.smoke on
|
|
16
17
|
* every run (#1678).
|
|
17
18
|
*/
|
|
18
|
-
const PREPACK_LINE = /^\s*(?:RUN\s
|
|
19
|
+
const PREPACK_LINE = /^\s*(?:RUN\s+|(?:-\s*)?run:\s*)?npm run --prefix lexicons\/[a-z0-9-]+ prepack\s*$/i;
|
|
19
20
|
function isPrepackLine(line) {
|
|
20
21
|
return PREPACK_LINE.test(line);
|
|
21
22
|
}
|
|
@@ -212,7 +213,10 @@ function patchCiWorkflow(root, name) {
|
|
|
212
213
|
// 2. Add a named validate step after the last "Generate and validate" step
|
|
213
214
|
const displayName = name.charAt(0).toUpperCase() + name.slice(1);
|
|
214
215
|
const validateStepName = `Generate and validate ${displayName} lexicon`;
|
|
215
|
-
|
|
216
|
+
// Case-insensitive: the name is built from the directory ("Github"), and an
|
|
217
|
+
// existing step may spell the product its own way ("GitHub", #2877).
|
|
218
|
+
const stepNameLower = validateStepName.toLowerCase();
|
|
219
|
+
if (!lines.some((l) => l.toLowerCase().includes(stepNameLower))) {
|
|
216
220
|
let lastValidateRunIdx = -1;
|
|
217
221
|
for (let i = 0; i < lines.length; i++) {
|
|
218
222
|
if (lines[i].includes("Generate and validate")) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/update.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,mBAAmB;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,uBAAuB;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAqED;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/update.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,mBAAmB;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,uBAAuB;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAqED;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAoGjF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAkB5D"}
|
|
@@ -120,7 +120,8 @@ export async function updateCommand(options) {
|
|
|
120
120
|
const pkgName = `@intentius/chant-lexicon-${lexicon}`;
|
|
121
121
|
const pkgPath = resolvePackagePath(pkgName, projectDir);
|
|
122
122
|
if (!pkgPath) {
|
|
123
|
-
|
|
123
|
+
// chant #3988 — update copies from node_modules and never installs.
|
|
124
|
+
warnings.push(`${pkgName} not found in node_modules. chant update does not install lexicons: run "npm install --save-dev ${pkgName}" first.`);
|
|
124
125
|
continue;
|
|
125
126
|
}
|
|
126
127
|
const lexiconDestDir = join(typesDir, `lexicon-${lexicon}`);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** A package that a failure could not import and that is not installed for the project. */
|
|
2
|
+
export interface UninstalledDependency {
|
|
3
|
+
package: string;
|
|
4
|
+
/** The project directory it does not resolve from. */
|
|
5
|
+
dir: string;
|
|
6
|
+
}
|
|
7
|
+
/** The uninstalled package `message` reports, or `undefined` when it reports none. */
|
|
8
|
+
export declare function uninstalledDependencyIn(message: string, projectDir: string): UninstalledDependency | undefined;
|
|
9
|
+
/** The dependencies message, formatted as an error with the install hint. */
|
|
10
|
+
export declare function formatDependenciesNotInstalled(dep: UninstalledDependency): string;
|
|
11
|
+
/**
|
|
12
|
+
* Print the dependencies message, naming the first uninstalled package, when
|
|
13
|
+
* any of a failure's `messages` reports one. Prints nothing and returns
|
|
14
|
+
* `undefined` when none does. Returns `"all"` when every message reports one,
|
|
15
|
+
* so a caller can drop its own wording when that wording blames the source.
|
|
16
|
+
*/
|
|
17
|
+
export declare function reportUninstalledDependencies(messages: readonly string[], projectDir: string): "all" | "some" | undefined;
|
|
18
|
+
//# sourceMappingURL=dependencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/cli/dependencies.ts"],"names":[],"mappings":"AA0BA,2FAA2F;AAC3F,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAC;CACb;AA2CD,sFAAsF;AACtF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAgB9G;AAED,6EAA6E;AAC7E,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,qBAAqB,GAAG,MAAM,CAKjF;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,UAAU,EAAE,MAAM,GACjB,KAAK,GAAG,MAAM,GAAG,SAAS,CAW5B"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chant #4116: a failure caused by a project whose dependencies are not installed.
|
|
3
|
+
*
|
|
4
|
+
* In a clone with no node_modules, every project file that imports
|
|
5
|
+
* `@intentius/chant` or a lexicon package fails to load. Lint reports each one
|
|
6
|
+
* (LEX002, COMP000), the graph's lint gate then says the source has lint
|
|
7
|
+
* errors, and build prints node's own "Cannot find package" per file. The
|
|
8
|
+
* source is fine; the install is missing.
|
|
9
|
+
*
|
|
10
|
+
* This runs only after something has already failed, on that failure's
|
|
11
|
+
* messages. A project chant builds today never reaches it, whatever its
|
|
12
|
+
* node_modules looks like: chant resolves a lexicon from its own install first,
|
|
13
|
+
* and a project that imports only what it has installed loads fine. That is why
|
|
14
|
+
* the check is not made up front (#4118, reverted in #4125).
|
|
15
|
+
*
|
|
16
|
+
* A message counts when it is node's "Cannot find package|module '<spec>'",
|
|
17
|
+
* `<spec>` names a package that is `@intentius/*` or declared in the project's
|
|
18
|
+
* package.json, and no node_modules from the project directory up holds it. A
|
|
19
|
+
* typo in an import of an undeclared package keeps its message as it is.
|
|
20
|
+
*/
|
|
21
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
22
|
+
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
23
|
+
import { fileURLToPath } from "node:url";
|
|
24
|
+
import { packageNameOf } from "../lexicon-module.js";
|
|
25
|
+
import { formatError } from "./format.js";
|
|
26
|
+
const NOT_FOUND = /Cannot find (?:package|module) '([^']+)'(?: imported from (\S+))?/g;
|
|
27
|
+
/** True when a node_modules at `dir` or above holds `pkg`. */
|
|
28
|
+
function installedFrom(pkg, dir) {
|
|
29
|
+
for (let d = resolve(dir);; d = dirname(d)) {
|
|
30
|
+
if (existsSync(join(d, "node_modules", ...pkg.split("/"))))
|
|
31
|
+
return true;
|
|
32
|
+
if (dirname(d) === d)
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** The packages the nearest package.json at `dir` or above declares, in any dependency field. */
|
|
37
|
+
function declaredPackages(dir) {
|
|
38
|
+
for (let d = resolve(dir);; d = dirname(d)) {
|
|
39
|
+
const file = join(d, "package.json");
|
|
40
|
+
if (existsSync(file)) {
|
|
41
|
+
try {
|
|
42
|
+
const json = JSON.parse(readFileSync(file, "utf-8"));
|
|
43
|
+
const names = new Set();
|
|
44
|
+
for (const field of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
|
|
45
|
+
const deps = json[field];
|
|
46
|
+
if (deps && typeof deps === "object")
|
|
47
|
+
for (const name of Object.keys(deps))
|
|
48
|
+
names.add(name);
|
|
49
|
+
}
|
|
50
|
+
return names;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return new Set();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (dirname(d) === d)
|
|
57
|
+
return new Set();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function importerDir(importer) {
|
|
61
|
+
if (!importer)
|
|
62
|
+
return undefined;
|
|
63
|
+
try {
|
|
64
|
+
const path = importer.startsWith("file:") ? fileURLToPath(importer) : importer;
|
|
65
|
+
return isAbsolute(path) ? dirname(path) : undefined;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** The uninstalled package `message` reports, or `undefined` when it reports none. */
|
|
72
|
+
export function uninstalledDependencyIn(message, projectDir) {
|
|
73
|
+
const dir = resolve(projectDir);
|
|
74
|
+
let declared;
|
|
75
|
+
for (const match of message.matchAll(NOT_FOUND)) {
|
|
76
|
+
const pkg = packageNameOf(match[1]);
|
|
77
|
+
if (pkg === undefined)
|
|
78
|
+
continue;
|
|
79
|
+
if (!pkg.startsWith("@intentius/")) {
|
|
80
|
+
declared ?? (declared = declaredPackages(dir));
|
|
81
|
+
if (!declared.has(pkg))
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (installedFrom(pkg, dir))
|
|
85
|
+
continue;
|
|
86
|
+
const from = importerDir(match[2]);
|
|
87
|
+
if (from !== undefined && installedFrom(pkg, from))
|
|
88
|
+
continue;
|
|
89
|
+
return { package: pkg, dir };
|
|
90
|
+
}
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
/** The dependencies message, formatted as an error with the install hint. */
|
|
94
|
+
export function formatDependenciesNotInstalled(dep) {
|
|
95
|
+
return formatError({
|
|
96
|
+
message: `dependencies not installed: ${dep.package} does not resolve from ${dep.dir}`,
|
|
97
|
+
hint: "run npm install (or the project's package manager)",
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Print the dependencies message, naming the first uninstalled package, when
|
|
102
|
+
* any of a failure's `messages` reports one. Prints nothing and returns
|
|
103
|
+
* `undefined` when none does. Returns `"all"` when every message reports one,
|
|
104
|
+
* so a caller can drop its own wording when that wording blames the source.
|
|
105
|
+
*/
|
|
106
|
+
export function reportUninstalledDependencies(messages, projectDir) {
|
|
107
|
+
let first;
|
|
108
|
+
let all = messages.length > 0;
|
|
109
|
+
for (const message of messages) {
|
|
110
|
+
const dep = uninstalledDependencyIn(message, projectDir);
|
|
111
|
+
if (dep)
|
|
112
|
+
first ?? (first = dep);
|
|
113
|
+
else
|
|
114
|
+
all = false;
|
|
115
|
+
}
|
|
116
|
+
if (!first)
|
|
117
|
+
return undefined;
|
|
118
|
+
console.error(formatDependenciesNotInstalled(first));
|
|
119
|
+
return all ? "all" : "some";
|
|
120
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAuMlD,wBAAsB,QAAQ,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsJnE"}
|
|
@@ -2,6 +2,7 @@ import { writeFileSync, mkdirSync } from "node:fs";
|
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
3
|
import { buildCommand, buildCommandWatch, printErrors, printWarnings, resolveBuildFormat } from "../commands/build.js";
|
|
4
4
|
import { formatError, formatInfo, formatSuccess, formatBold } from "../format.js";
|
|
5
|
+
import { reportUninstalledDependencies } from "../dependencies.js";
|
|
5
6
|
import { generateComponentsPipeline } from "../../components/cli-support.js";
|
|
6
7
|
import { loadChantConfigUpward } from "../../config.js";
|
|
7
8
|
import { resolveCliBuildParams, parseParamFlags } from "../build-params-cli.js";
|
|
@@ -12,13 +13,14 @@ import { resolvePromotionSource } from "../../components/promote-order.js";
|
|
|
12
13
|
* and the branch, and with `--events-json` and `--report-url` (#4007) the
|
|
13
14
|
* flags the generated jobs pass to pr-plan and pr-apply. `--pr-build` and
|
|
14
15
|
* `--pr-build-command` (#4088) add the build and lint steps before both.
|
|
16
|
+
* `reportUrl` is `--report-url`, else the workspace's `ci.reportUrl` (#4160).
|
|
15
17
|
*/
|
|
16
|
-
function prLoopOption(args) {
|
|
18
|
+
function prLoopOption(args, reportUrl) {
|
|
17
19
|
return {
|
|
18
20
|
...(args.gate ? { gate: args.gate } : {}),
|
|
19
21
|
...(args.branch ? { branch: args.branch } : {}),
|
|
20
22
|
...(args.eventsJson ? { events: true } : {}),
|
|
21
|
-
...(
|
|
23
|
+
...(reportUrl ? { reportUrl } : {}),
|
|
22
24
|
...(args.prBuild ? { build: true } : {}),
|
|
23
25
|
...(args.prBuildCommand ? { buildCommand: args.prBuildCommand } : {}),
|
|
24
26
|
};
|
|
@@ -84,6 +86,17 @@ async function runGenerateComponents(ctx) {
|
|
|
84
86
|
const found = findWorkspaceRoot(resolve(args.path));
|
|
85
87
|
let plan;
|
|
86
88
|
let memberPipeline;
|
|
89
|
+
// #4160: without --report-url, the declaration's ci.reportUrl. Read only inside a workspace.
|
|
90
|
+
let reportUrl = args.reportUrl;
|
|
91
|
+
if (found && args.prLoop && !reportUrl) {
|
|
92
|
+
try {
|
|
93
|
+
reportUrl = await (await import("../../workspace/ci-report-url.js")).declaredReportUrl(resolve(args.path));
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
console.error(formatError({ message: err instanceof Error ? err.message : String(err) }));
|
|
97
|
+
return 1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
87
100
|
if (found) {
|
|
88
101
|
memberPipeline = await import("../../workspace/member-pipeline.js");
|
|
89
102
|
try {
|
|
@@ -98,7 +111,7 @@ async function runGenerateComponents(ctx) {
|
|
|
98
111
|
params: args.param,
|
|
99
112
|
paramsFile: args.paramsFile,
|
|
100
113
|
...(args.waveGate ? { waveGate: { gate: args.waveGate, ...(args.canary?.length ? { canary: args.canary } : {}), ...(args.base ? { base: args.base } : {}) } } : {}),
|
|
101
|
-
...(args.prLoop ? { prLoop: prLoopOption(args) } : {}),
|
|
114
|
+
...(args.prLoop ? { prLoop: prLoopOption(args, reportUrl) } : {}),
|
|
102
115
|
...(args.image ? { image: args.image } : {}),
|
|
103
116
|
...(args.beforeScript?.length ? { beforeScript: args.beforeScript } : {}),
|
|
104
117
|
});
|
|
@@ -125,7 +138,7 @@ async function runGenerateComponents(ctx) {
|
|
|
125
138
|
? { gatedWaves: { gate: args.waveGate, ...(args.canary?.length ? { canary: args.canary } : {}), ...(args.base ? { base: args.base } : {}) } }
|
|
126
139
|
: {}),
|
|
127
140
|
// #3183: a plan job per pull request and an apply job per merge.
|
|
128
|
-
...(args.prLoop ? { prLoop: prLoopOption(args) } : {}),
|
|
141
|
+
...(args.prLoop ? { prLoop: prLoopOption(args, reportUrl) } : {}),
|
|
129
142
|
// #4002: the job image and the lines that install what it lacks, chant itself included.
|
|
130
143
|
...(args.image ? { image: args.image } : {}),
|
|
131
144
|
...(args.beforeScript?.length ? { beforeScript: args.beforeScript } : {}),
|
|
@@ -257,6 +270,9 @@ export async function runBuild(ctx) {
|
|
|
257
270
|
for (const w of own)
|
|
258
271
|
seenWarnings.add(w);
|
|
259
272
|
printWarnings(own);
|
|
273
|
+
// #4116: once, before the first failing group's errors.
|
|
274
|
+
if (!result.success && !failed)
|
|
275
|
+
reportUninstalledDependencies(result.errors, resolve(args.path));
|
|
260
276
|
printErrors(result.errors);
|
|
261
277
|
if (!result.success)
|
|
262
278
|
failed = true;
|
|
@@ -304,6 +320,9 @@ export async function runBuild(ctx) {
|
|
|
304
320
|
warnings = warnings.filter((w) => !w.includes('No serializer found for lexicon'));
|
|
305
321
|
}
|
|
306
322
|
printWarnings(warnings);
|
|
323
|
+
// #4116: errors that are imports of uninstalled packages are led by the dependencies message.
|
|
324
|
+
if (!result.success)
|
|
325
|
+
reportUninstalledDependencies(result.errors, resolve(args.path));
|
|
307
326
|
printErrors(result.errors);
|
|
308
327
|
return result.success ? 0 : 1;
|
|
309
328
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fan-out.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/fan-out.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAIH,OAAO,EAA+C,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAe7F,OAAO,EAAmB,KAAK,YAAY,EAAuB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"fan-out.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/fan-out.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAIH,OAAO,EAA+C,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAe7F,OAAO,EAAmB,KAAK,YAAY,EAAuB,MAAM,0BAA0B,CAAC;AASnG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,WAAW,EACnB,IAAI,GAAE;IACJ,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,UAAU,CAAC,EAAE,OAAO,CAAC;CACjB,GACL,OAAO,CAAC;IAAE,KAAK,EAAE,YAAY,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA+ErE;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAyV9E"}
|
|
@@ -67,9 +67,10 @@ import { approveCommand, gateIsSealed } from "../../op/gate.js";
|
|
|
67
67
|
import { getHeadCommit } from "../../lifecycle/git.js";
|
|
68
68
|
import { remainingFanOut } from "../../components/fan-out.js";
|
|
69
69
|
import { readDeployedOutputs } from "../../components/wave-plan.js";
|
|
70
|
-
import { deployContext } from "../../components/driver.js";
|
|
70
|
+
import { deployContext, failedRunExitCode } from "../../components/driver.js";
|
|
71
71
|
import { resolveCliBuildParams, parseParamFlags } from "../build-params-cli.js";
|
|
72
72
|
import { formatError, formatInfo, formatWarning } from "../format.js";
|
|
73
|
+
import { reportUninstalledDependencies } from "../dependencies.js";
|
|
73
74
|
import { FAN_OUT_GATE_OP } from "../../op/gate-name.js";
|
|
74
75
|
import { resolveBuildRoot } from "./lifecycle.js";
|
|
75
76
|
import { GATED_EXIT_CODE, autoReleaseRun, recordAutoReleasesForRun } from "./run.js";
|
|
@@ -220,10 +221,15 @@ export async function runComponentsFanOut(ctx) {
|
|
|
220
221
|
catch (err) {
|
|
221
222
|
// A cycle or an unknown `dependsOn` refuses here, over the whole graph and
|
|
222
223
|
// before anything is selected (#2417). The message names the members.
|
|
223
|
-
|
|
224
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
225
|
+
reportUninstalledDependencies([message], projectPath); // #4116
|
|
226
|
+
console.error(formatError({ message }));
|
|
224
227
|
return 1;
|
|
225
228
|
}
|
|
226
229
|
if (!derived.success) {
|
|
230
|
+
// #4116: component files that import packages the project has not installed.
|
|
231
|
+
if (derived.error)
|
|
232
|
+
reportUninstalledDependencies([derived.error], projectPath);
|
|
227
233
|
console.error(formatError({ message: derived.error ?? "Could not discover components" }));
|
|
228
234
|
return 1;
|
|
229
235
|
}
|
|
@@ -486,7 +492,9 @@ export async function runComponentsFanOut(ctx) {
|
|
|
486
492
|
...(await summaryLedgerPrefix()),
|
|
487
493
|
...(pending.environment ? { environment: pending.environment } : {}),
|
|
488
494
|
});
|
|
489
|
-
return result.status === "gated" ? GATED_EXIT_CODE :
|
|
495
|
+
return result.status === "gated" ? GATED_EXIT_CODE : failedRunExitCode(result.results);
|
|
490
496
|
}
|
|
491
|
-
|
|
497
|
+
// A step that refused the wave's plan because its target moved since the
|
|
498
|
+
// approval exits 3, the code of a wave whose plan changed (#3997).
|
|
499
|
+
return result.status === "ok" ? 0 : failedRunExitCode(result.results);
|
|
492
500
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/graph.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/graph.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,aAAa,CAAC;AA+H9D;;;;;;;;;GASG;AACH;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAE7D"}
|