@intentius/chant 0.124.14 → 0.124.16
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/dist/build.d.ts +6 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +1 -0
- package/dist/change-set.d.ts +24 -2
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +50 -1
- package/dist/ci-jobs.d.ts +227 -0
- package/dist/ci-jobs.d.ts.map +1 -0
- package/dist/ci-jobs.js +448 -0
- package/dist/cli/flush.d.ts +16 -0
- package/dist/cli/flush.d.ts.map +1 -0
- package/dist/cli/flush.js +42 -0
- package/dist/cli/handlers/approve.d.ts +98 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -0
- package/dist/cli/handlers/approve.js +495 -0
- package/dist/cli/handlers/operator.d.ts +1 -95
- package/dist/cli/handlers/operator.d.ts.map +1 -1
- package/dist/cli/handlers/operator.js +4 -488
- package/dist/cli/handlers/override-approve.js +1 -1
- package/dist/cli/main.d.ts +4 -15
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +4 -1062
- package/dist/cli/parse-args.d.ts +6 -0
- package/dist/cli/parse-args.d.ts.map +1 -0
- package/dist/cli/parse-args.js +1028 -0
- package/dist/components/fan-out-record.d.ts +1 -1
- package/dist/components/fan-out-record.d.ts.map +1 -1
- package/dist/components/fan-out-record.js +3 -7
- package/dist/components/fan-out-run.d.ts +5 -3
- package/dist/components/fan-out-run.d.ts.map +1 -1
- package/dist/components/fan-out-run.js +7 -5
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +3 -2
- package/dist/composite.d.ts +10 -2
- package/dist/composite.d.ts.map +1 -1
- package/dist/composite.js +8 -0
- package/dist/discovery/collect.d.ts +2 -1
- package/dist/discovery/collect.d.ts.map +1 -1
- package/dist/discovery/collect.js +16 -1
- package/dist/discovery/fold-import.d.ts.map +1 -1
- package/dist/discovery/fold-import.js +2 -107
- package/dist/discovery/host-composite.d.ts +35 -0
- package/dist/discovery/host-composite.d.ts.map +1 -0
- package/dist/discovery/host-composite.js +93 -0
- package/dist/discovery/index.d.ts +9 -0
- package/dist/discovery/index.d.ts.map +1 -1
- package/dist/discovery/index.js +1 -1
- package/dist/gate-decision.d.ts +20 -9
- package/dist/gate-decision.d.ts.map +1 -1
- package/dist/gate-decision.js +72 -19
- package/dist/gated-waves.d.ts +25 -6
- package/dist/gated-waves.d.ts.map +1 -1
- package/dist/gated-waves.js +21 -6
- package/dist/lifecycle/gate-audit.d.ts +69 -2
- package/dist/lifecycle/gate-audit.d.ts.map +1 -1
- package/dist/lifecycle/gate-audit.js +76 -2
- package/dist/lifecycle/gate-ledger.d.ts +24 -0
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.js +9 -1
- package/dist/op/activities/activity-contracts.d.ts +5 -5
- package/dist/op/activities/activity-contracts.js +1 -1
- package/dist/op/activities/change-set.d.ts +8 -3
- package/dist/op/activities/change-set.d.ts.map +1 -1
- package/dist/op/activities/change-set.js +5 -2
- package/dist/op/activities/reconcile.d.ts +28 -16
- package/dist/op/activities/reconcile.d.ts.map +1 -1
- package/dist/op/activities/reconcile.js +34 -20
- package/dist/op/builders.d.ts +1 -1
- package/dist/op/builders.d.ts.map +1 -1
- package/dist/op/builders.js +1 -1
- package/dist/op/op-waves-run.d.ts +2 -2
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +8 -9
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +4 -8
- package/dist/package-version.d.ts +2 -0
- package/dist/package-version.d.ts.map +1 -0
- package/dist/package-version.js +10 -0
- package/dist/wave-engine.d.ts +62 -0
- package/dist/wave-engine.d.ts.map +1 -0
- package/dist/wave-engine.js +59 -0
- package/dist/wave-layout.d.ts +29 -0
- package/dist/wave-layout.d.ts.map +1 -0
- package/dist/wave-layout.js +41 -0
- package/dist/wave-runtime.d.ts +29 -0
- package/dist/wave-runtime.d.ts.map +1 -0
- package/dist/wave-runtime.js +103 -0
- package/dist/wave-runtime.mjs +331 -0
- package/dist/workspace/__fixtures__/contract-repo.d.ts +7 -0
- package/dist/workspace/__fixtures__/contract-repo.d.ts.map +1 -1
- package/dist/workspace/__fixtures__/contract-repo.js +17 -1
- package/dist/workspace/__fixtures__/sessions.d.ts +1 -1
- package/dist/workspace/__fixtures__/sessions.d.ts.map +1 -1
- package/dist/workspace/__fixtures__/sessions.js +3 -3
- package/dist/workspace/ajv2020.d.ts +5 -0
- package/dist/workspace/ajv2020.d.ts.map +1 -0
- package/dist/workspace/ajv2020.js +14 -0
- package/dist/workspace/change-set.schema.json +5 -3
- package/dist/workspace/ci-green-workflow.d.ts +3 -1
- package/dist/workspace/ci-green-workflow.d.ts.map +1 -1
- package/dist/workspace/ci-green-workflow.js +5 -2
- package/dist/workspace/class-data.d.ts +84 -0
- package/dist/workspace/class-data.d.ts.map +1 -0
- package/dist/workspace/class-data.js +238 -0
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +4 -8
- package/dist/workspace/kinds.d.ts +3 -7
- package/dist/workspace/kinds.d.ts.map +1 -1
- package/dist/workspace/kinds.js +8 -45
- package/dist/workspace/points.d.ts.map +1 -1
- package/dist/workspace/points.js +2 -5
- package/dist/workspace/principal-classes.d.ts +4 -11
- package/dist/workspace/principal-classes.d.ts.map +1 -1
- package/dist/workspace/principal-classes.js +13 -99
- package/package.json +5 -3
- package/src/build.ts +8 -0
- package/src/change-set.test.ts +48 -0
- package/src/change-set.ts +52 -2
- package/src/ci-jobs.test.ts +49 -0
- package/src/ci-jobs.ts +515 -0
- package/src/cli/flush.ts +44 -0
- package/src/cli/handlers/approve.ts +618 -0
- package/src/cli/handlers/operator.ts +10 -608
- package/src/cli/handlers/override-approve.test.ts +1 -1
- package/src/cli/handlers/override-approve.ts +1 -1
- package/src/cli/main.ts +5 -816
- package/src/cli/parse-args.ts +781 -0
- package/src/components/fan-out-record.ts +3 -7
- package/src/components/fan-out-run.ts +7 -5
- package/src/components/pr-pipeline.ts +3 -2
- package/src/composite.ts +15 -3
- package/src/discovery/collect.ts +15 -1
- package/src/discovery/fold-build-parity.test.ts +71 -0
- package/src/discovery/fold-import.ts +2 -113
- package/src/discovery/fold-project-provenance.test.ts +21 -4
- package/src/discovery/host-composite.ts +101 -0
- package/src/discovery/index.ts +11 -1
- package/src/gate-decision-bundle.test.ts +6 -4
- package/src/gate-decision-identity.test.ts +59 -6
- package/src/gate-decision.ts +81 -21
- package/src/gated-waves.ts +28 -6
- package/src/lifecycle/gate-audit.test.ts +55 -1
- package/src/lifecycle/gate-audit.ts +116 -3
- package/src/lifecycle/gate-ledger.test.ts +20 -1
- package/src/lifecycle/gate-ledger.ts +33 -1
- package/src/op/activities/activity-contracts.ts +1 -1
- package/src/op/activities/change-set.ts +11 -3
- package/src/op/activities/lexicon-upgrade.test.ts +2 -0
- package/src/op/activities/reconcile.test.ts +62 -2
- package/src/op/activities/reconcile.ts +46 -22
- package/src/op/builders.ts +1 -1
- package/src/op/op-waves-run.ts +9 -9
- package/src/op/op-waves.test.ts +2 -0
- package/src/op/op-waves.ts +4 -8
- package/src/op/work-lease-run.test.ts +12 -4
- package/src/package-version.ts +11 -0
- package/src/wave-engine.test.ts +107 -0
- package/src/wave-engine.ts +98 -0
- package/src/wave-layout.ts +44 -0
- package/src/wave-runtime-bundle.test.ts +70 -0
- package/src/wave-runtime.e2e.test.ts +177 -0
- package/src/wave-runtime.ts +104 -0
- package/src/workspace/__fixtures__/contract-repo.ts +17 -1
- package/src/workspace/__fixtures__/sessions.ts +3 -3
- package/src/workspace/ajv2020.ts +17 -0
- package/src/workspace/change-set.schema.json +5 -3
- package/src/workspace/ci-green-workflow.test.ts +4 -4
- package/src/workspace/ci-green-workflow.ts +5 -2
- package/src/workspace/class-data.test.ts +64 -0
- package/src/workspace/class-data.ts +236 -0
- package/src/workspace/declaration.ts +4 -10
- package/src/workspace/kinds.ts +8 -40
- package/src/workspace/points.ts +2 -5
- package/src/workspace/principal-classes.ts +13 -99
- package/src/workspace/records-formats.test.ts +7 -2
- package/src/workspace/records-sessions-write.test.ts +3 -3
- package/src/workspace/status-contract.e2e.test.ts +37 -0
- package/src/workspace/status-contract.test.ts +23 -21
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* in the record rather than beside it because the record is the one file a
|
|
27
27
|
* per-wave CI job hands to the next.
|
|
28
28
|
*/
|
|
29
|
-
import { type WaveRecord } from "../
|
|
29
|
+
import { type WaveRecord } from "../wave-engine.js";
|
|
30
30
|
import type { ChangeSetDocument } from "../change-set.js";
|
|
31
31
|
import type { PrMember } from "../pr-loop.js";
|
|
32
32
|
/** What a pull request's apply approved, kept so a re-run can finish it (#3464). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fan-out-record.d.ts","sourceRoot":"","sources":["../../src/components/fan-out-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;
|
|
1
|
+
{"version":3,"file":"fan-out-record.d.ts","sourceRoot":"","sources":["../../src/components/fan-out-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAwC,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,oFAAoF;AACpF,MAAM,WAAW,aAAa;IAC5B,yFAAyF;IACzF,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,oDAAoD;IACpD,OAAO,EAAE,QAAQ,EAAE,CAAC;IACpB,qGAAqG;IACrG,SAAS,EAAE,iBAAiB,CAAC;IAC7B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD,wCAAwC;IACxC,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,2CAA2C;IAC3C,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AA+BD,wGAAwG;AACxG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAkBzE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAE7E"}
|
|
@@ -26,9 +26,8 @@
|
|
|
26
26
|
* in the record rather than beside it because the record is the one file a
|
|
27
27
|
* per-wave CI job hands to the next.
|
|
28
28
|
*/
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import { readWaveRecords } from "../gated-waves.js";
|
|
29
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
30
|
+
import { readWaveRecords, writeWaveRecordFile } from "../wave-engine.js";
|
|
32
31
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
33
32
|
const isStringArray = (value) => Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
34
33
|
/** The `prApply` entry, when it has every field a resume needs. Anything else reads as no entry. */
|
|
@@ -87,8 +86,5 @@ export function readFanOutAttempt(path) {
|
|
|
87
86
|
* write leaves the previous record whole rather than half a JSON document.
|
|
88
87
|
*/
|
|
89
88
|
export function writeFanOutAttempt(path, attempt) {
|
|
90
|
-
|
|
91
|
-
const temporary = `${path}.${process.pid}.tmp`;
|
|
92
|
-
writeFileSync(temporary, JSON.stringify(attempt, null, 2) + "\n");
|
|
93
|
-
renameSync(temporary, path);
|
|
89
|
+
writeWaveRecordFile(path, attempt);
|
|
94
90
|
}
|
|
@@ -31,8 +31,10 @@
|
|
|
31
31
|
* ## Or one approval per wave
|
|
32
32
|
*
|
|
33
33
|
* `waveGate` (#3049) is the other mode. Each wave is planned once the waves
|
|
34
|
-
* before it applied, and its gate binds that wave's set digest
|
|
35
|
-
*
|
|
34
|
+
* before it applied, and its gate binds that wave's set digest. Gate names,
|
|
35
|
+
* the digest and the gate decision come from the wave engine
|
|
36
|
+
* (`../wave-engine.ts`, #3766), which `chant run wave` uses too. See
|
|
37
|
+
* {@link runGatedWaves}.
|
|
36
38
|
*/
|
|
37
39
|
import { type DriverComponent, type DriverComponentResult } from "./driver.js";
|
|
38
40
|
import type { ReleaseIdentity } from "../telemetry-attribution.js";
|
|
@@ -43,7 +45,7 @@ import type { CapabilityRegistry } from "./capability.js";
|
|
|
43
45
|
import type { PendingGateRecord } from "../lifecycle/gate-ledger.js";
|
|
44
46
|
import type { DeployContext } from "./capability.js";
|
|
45
47
|
import { type WaveComponentPlan } from "./wave-plan.js";
|
|
46
|
-
import { type WaveRecord } from "../
|
|
48
|
+
import { type WaveRecord } from "../wave-engine.js";
|
|
47
49
|
/**
|
|
48
50
|
* One gate per wave (#3049), each bound to its wave's set digest. The other
|
|
49
51
|
* mode beside {@link FanOutGate}: that one approves the whole set once, this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fan-out-run.d.ts","sourceRoot":"","sources":["../../src/components/fan-out-run.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fan-out-run.d.ts","sourceRoot":"","sources":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H,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,4FAA4F;IAC5F,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,eAAe,GAAG,SAAS,CAAC;IACrE;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,KAAK,IAAI,CAAC;CAC5G;AAED,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC;IAChC,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,8EAA8E;IAC9E,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,2DAA2D;IAC3D,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,mFAAmF;IACnF,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1D,sEAAsE;IACtE,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,iGAAiG;IACjG,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,eAAe,EAAE,EAC7B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,CA2I1B"}
|
|
@@ -31,14 +31,16 @@
|
|
|
31
31
|
* ## Or one approval per wave
|
|
32
32
|
*
|
|
33
33
|
* `waveGate` (#3049) is the other mode. Each wave is planned once the waves
|
|
34
|
-
* before it applied, and its gate binds that wave's set digest
|
|
35
|
-
*
|
|
34
|
+
* before it applied, and its gate binds that wave's set digest. Gate names,
|
|
35
|
+
* the digest and the gate decision come from the wave engine
|
|
36
|
+
* (`../wave-engine.ts`, #3766), which `chant run wave` uses too. See
|
|
37
|
+
* {@link runGatedWaves}.
|
|
36
38
|
*/
|
|
37
39
|
import { deployContext, runComponentDeploy, } from "./driver.js";
|
|
38
40
|
import { downstreamWithin, remainingFanOut } from "./fan-out.js";
|
|
39
41
|
import { evaluateGate, gitGateLedgerPort } from "../op/gate.js";
|
|
40
42
|
import { planWaveComponent } from "./wave-plan.js";
|
|
41
|
-
import { waveGateName, waveSetDigest } from "../
|
|
43
|
+
import { decideWaveGate, waveGateName, waveSetDigest } from "../wave-engine.js";
|
|
42
44
|
/** Thrown when `FanOutWaveGate.only` names a wave whose predecessors have not all applied. */
|
|
43
45
|
export class EarlierWaveNotAppliedError extends Error {
|
|
44
46
|
constructor(wave, earlier, components) {
|
|
@@ -288,10 +290,10 @@ async function runGatedWaves(plan, active, components, registry, options, waveGa
|
|
|
288
290
|
options.onWaveSettled?.(record);
|
|
289
291
|
continue;
|
|
290
292
|
}
|
|
291
|
-
const check = await
|
|
293
|
+
const check = await decideWaveGate(gates.port, {
|
|
292
294
|
op: waveGate.op,
|
|
293
295
|
gate: gateName,
|
|
294
|
-
|
|
296
|
+
digest,
|
|
295
297
|
description: waveGate.description ?? `wave ${waveNum} of ${plan.waves.length}: ${toRun.join(", ")}`,
|
|
296
298
|
...(waveGate.timeout ? { timeout: waveGate.timeout } : {}),
|
|
297
299
|
...(options.now ? { now: options.now } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-pipeline.d.ts","sourceRoot":"","sources":["../../src/components/pr-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"pr-pipeline.d.ts","sourceRoot":"","s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AC,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAErF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAU1D"}
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
* that one of its units reaches selects that unit.
|
|
37
37
|
*/
|
|
38
38
|
import { PR_APPLY_GATE } from "../pr-loop.js";
|
|
39
|
+
import { CI_IMAGE, GITHUB_JOB_TOKEN } from "../ci-jobs.js";
|
|
39
40
|
/** Where both jobs write their reports, kept as a CI artifact. */
|
|
40
41
|
export const PR_LOOP_REPORT_DIR = ".chant/pr";
|
|
41
42
|
/**
|
|
@@ -50,7 +51,7 @@ export const PR_APPLY_RECORD = ".chant/pr-resume/pr-apply.json";
|
|
|
50
51
|
* `PR_LOOP_SETUP` adds OpenTofu on top of it. A caller who sets `image`
|
|
51
52
|
* brings both and gets no setup lines.
|
|
52
53
|
*/
|
|
53
|
-
export const PR_LOOP_IMAGE =
|
|
54
|
+
export const PR_LOOP_IMAGE = CI_IMAGE;
|
|
54
55
|
/** Installs OpenTofu into `PR_LOOP_IMAGE`. */
|
|
55
56
|
export const PR_LOOP_SETUP = [
|
|
56
57
|
"command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)",
|
|
@@ -71,7 +72,7 @@ export function prLoopJobs(forge, env, options = {}, member) {
|
|
|
71
72
|
...(member ? ["--member", member] : []),
|
|
72
73
|
];
|
|
73
74
|
const github = forge !== "gitlab";
|
|
74
|
-
const token = github ? { GITHUB_TOKEN:
|
|
75
|
+
const token = github ? { GITHUB_TOKEN: GITHUB_JOB_TOKEN } : {};
|
|
75
76
|
return [
|
|
76
77
|
{
|
|
77
78
|
jobName: "plan",
|
package/dist/composite.d.ts
CHANGED
|
@@ -74,8 +74,16 @@ export declare class CompositeRegistry {
|
|
|
74
74
|
* });
|
|
75
75
|
* export const storage = SecureStorage({ name: "data" });
|
|
76
76
|
* ```
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
*
|
|
78
|
+
* `D` (chant#3787) lets a lexicon give the definition a more precise call
|
|
79
|
+
* signature than `(props: P) => M`, such as a generic one whose members' types
|
|
80
|
+
* depend on the literal props it is called with. It is a type only: the value
|
|
81
|
+
* is the same definition, and `D` must still be a `CompositeDefinition<P, M>`,
|
|
82
|
+
* so an intersection with the precise signature first is the usual form. It
|
|
83
|
+
* is passed as a type argument rather than by casting the result, because the
|
|
84
|
+
* fold recognizes a composite by its `export const X = Composite(...)` shape.
|
|
85
|
+
*/
|
|
86
|
+
export declare function Composite<P, M extends CompositeFactoryMembers = CompositeMembers, D extends CompositeDefinition<P, M> = CompositeDefinition<P, M>>(factory: (props: P) => M, name?: string): D;
|
|
79
87
|
/**
|
|
80
88
|
* chant#3608 — the composite whose call built `entity`, or `undefined` for an
|
|
81
89
|
* entity no chant composite built.
|
package/dist/composite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composite.d.ts","sourceRoot":"","sources":["../src/composite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAG7D;;GAEG;AACH,eAAO,MAAM,gBAAgB,eAAgC,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,uBAAuB,GAE/B,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAO/D,iBAAiB,CAAC,GAAG,CAAC,CAAC;AAE3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AC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GACvC,mBAAmB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAc1D;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,eAAuC,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,cAAc,eAA0C,CAAC;AAEtE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,gBAAgB,EAClD,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,EAClC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAM1B;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,EAC9C,IAAI,EAAE,KAAK,KAAK,EAAE,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,EAC/D,KAAK,EAAE,CAAC,EACR,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,CAAC,CAEH;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7D,IAAI,EAAE,CAAC,EACP,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,GAC9B,CAAC,CAqBH"}
|
package/dist/composite.js
CHANGED
|
@@ -51,6 +51,14 @@ CompositeRegistry.definitions = new Map();
|
|
|
51
51
|
* });
|
|
52
52
|
* export const storage = SecureStorage({ name: "data" });
|
|
53
53
|
* ```
|
|
54
|
+
*
|
|
55
|
+
* `D` (chant#3787) lets a lexicon give the definition a more precise call
|
|
56
|
+
* signature than `(props: P) => M`, such as a generic one whose members' types
|
|
57
|
+
* depend on the literal props it is called with. It is a type only: the value
|
|
58
|
+
* is the same definition, and `D` must still be a `CompositeDefinition<P, M>`,
|
|
59
|
+
* so an intersection with the precise signature first is the usual form. It
|
|
60
|
+
* is passed as a type argument rather than by casting the result, because the
|
|
61
|
+
* fold recognizes a composite by its `export const X = Composite(...)` shape.
|
|
54
62
|
*/
|
|
55
63
|
export function Composite(factory, name) {
|
|
56
64
|
const id = Symbol();
|
|
@@ -2,7 +2,8 @@ import { type Declarable } from "../declarable.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Collects all declarable entities from imported modules.
|
|
4
4
|
* CompositeInstance exports are expanded into individual entities
|
|
5
|
-
* with `{exportName}_{memberName}` naming
|
|
5
|
+
* with `{exportName}_{memberName}` naming, and so are host composite
|
|
6
|
+
* instances the fold resolved (chant#3612, ./host-composite.ts).
|
|
6
7
|
* LexiconOutput exports are also collected so that build() can
|
|
7
8
|
* extract them and pass them to the serializer.
|
|
8
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/discovery/collect.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/discovery/collect.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAgJ9D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC,EAClE,SAAS,CAAC,EAAE,MAAM,GACjB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAiEzB"}
|
|
@@ -4,6 +4,7 @@ import { isCompositeInstance, expandComposite, compositeOfMember } from "../comp
|
|
|
4
4
|
import { isLexiconOutput } from "../lexicon-output.js";
|
|
5
5
|
import { DiscoveryError } from "../errors.js";
|
|
6
6
|
import { setProvenance } from "../provenance.js";
|
|
7
|
+
import { expandHostComposite, hostCompositeName } from "./host-composite.js";
|
|
7
8
|
/**
|
|
8
9
|
* The entity key for an export. `export default` is per-module — the `Op` pattern
|
|
9
10
|
* (`export default op`) uses it, and two op files must not collide on the literal
|
|
@@ -106,6 +107,19 @@ function enumerateEntries(modules) {
|
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
109
|
}
|
|
110
|
+
else if (hostCompositeName(value) !== undefined) {
|
|
111
|
+
// chant#3612 — a host composite instance the fold resolved, expanded
|
|
112
|
+
// here rather than by one caller, so `build()` and `foldProject`
|
|
113
|
+
// report the same entities for it. See ./host-composite.ts.
|
|
114
|
+
for (const [expandedName, entity] of expandHostComposite(name, value)) {
|
|
115
|
+
entries.push({
|
|
116
|
+
bareKey: expandedName,
|
|
117
|
+
value: entity,
|
|
118
|
+
file,
|
|
119
|
+
provenance: { sourceFile: file, compositeInstance: name },
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
109
123
|
else if (isLexiconOutput(value)) {
|
|
110
124
|
// LexiconOutput is not a Declarable but build() expects to find them in
|
|
111
125
|
// the entities map so it can collect and pass them to serializers.
|
|
@@ -118,7 +132,8 @@ function enumerateEntries(modules) {
|
|
|
118
132
|
/**
|
|
119
133
|
* Collects all declarable entities from imported modules.
|
|
120
134
|
* CompositeInstance exports are expanded into individual entities
|
|
121
|
-
* with `{exportName}_{memberName}` naming
|
|
135
|
+
* with `{exportName}_{memberName}` naming, and so are host composite
|
|
136
|
+
* instances the fold resolved (chant#3612, ./host-composite.ts).
|
|
122
137
|
* LexiconOutput exports are also collected so that build() can
|
|
123
138
|
* extract them and pass them to the serializer.
|
|
124
139
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold-import.d.ts","sourceRoot":"","sources":["../../src/discovery/fold-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAMjC,OAAO,EAAsC,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAkC,KAAK,iBAAiB,EAAyB,MAAM,cAAc,CAAC;AAqD7G,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"fold-import.d.ts","sourceRoot":"","sources":["../../src/discovery/fold-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAMjC,OAAO,EAAsC,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAkC,KAAK,iBAAiB,EAAyB,MAAM,cAAc,CAAC;AAqD7G,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGnF,OAAO,EAAgD,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,mGAAmG;AACnG,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,iBAAiB,CAAC,CAAC;AAElF,MAAM,MAAM,cAAc,GACtB;IACE,EAAE,EAAE,IAAI,CAAC;IACT;;;;;;;;OAQG;IACH,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB;;;;;;;;;;;;;OAaG;IACH,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC;;;;;;;;;;;;OAYG;IACH,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAClC,GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;C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EAA+E;IAC/E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,aAAa,CAAA;KAAE,CAAC;IAC3D,mFAAmF;IACnF,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChD;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,UAAU,GAAE,SAAS,YAAY,EAAO,EACxC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAkE1C"}
|
|
@@ -18,6 +18,7 @@ import { collectCompositeOrigins, collectParamDependencies, collectTagOrigins, s
|
|
|
18
18
|
import { getInterpolationFields, getProvenance, setPathProvenance, setProvenance } from "../provenance.js";
|
|
19
19
|
import { foldProvenanceOfEntities } from "../fold-provenance.js";
|
|
20
20
|
import { collectEntities } from "./collect.js";
|
|
21
|
+
import { hostCompositeName, markHostCompositeInstance } from "./host-composite.js";
|
|
21
22
|
import { intrinsicCallFoldsEagerly, intrinsicTagFolds } from "../lexicon.js";
|
|
22
23
|
/**
|
|
23
24
|
* chant #1063 — the package specifier a lexicon NAME (`"aws"`, `"gitlab"`)
|
|
@@ -2265,52 +2266,6 @@ async function interpretCompositeFactory(factory, args, ctx, call) {
|
|
|
2265
2266
|
return undefined;
|
|
2266
2267
|
}
|
|
2267
2268
|
}
|
|
2268
|
-
/**
|
|
2269
|
-
* chant#3598 — a host composite instance's own marker. Non-enumerable and
|
|
2270
|
-
* symbol-keyed, like provenance, so nothing that serializes or compares the
|
|
2271
|
-
* exports sees it. It carries the composite's name, which the members object
|
|
2272
|
-
* otherwise has no record of once it is returned.
|
|
2273
|
-
*/
|
|
2274
|
-
const HOST_COMPOSITE_INSTANCE = Symbol.for("chant.fold.hostCompositeInstance");
|
|
2275
|
-
/**
|
|
2276
|
-
* Mark `members` as the instance a host's composite produced, and return it
|
|
2277
|
-
* unchanged.
|
|
2278
|
-
*
|
|
2279
|
-
* chant#3608 — every declarable member, and every member of a nested host
|
|
2280
|
-
* instance, is also stamped with the composite, the way `expandComposite`
|
|
2281
|
-
* stamps a chant instance's members. A destructured member is never expanded,
|
|
2282
|
-
* so this is the only record it has that a composite wrote it, and without
|
|
2283
|
-
* it a path the fold did not attribute reads as authored and so `direct`.
|
|
2284
|
-
* `setProvenance` keeps the first writer, and a nested instance was marked
|
|
2285
|
-
* when its own call returned, so a member keeps its innermost composite.
|
|
2286
|
-
*/
|
|
2287
|
-
function markHostCompositeInstance(members, compositeName) {
|
|
2288
|
-
if (Object.isExtensible(members) && !Object.prototype.hasOwnProperty.call(members, HOST_COMPOSITE_INSTANCE)) {
|
|
2289
|
-
Object.defineProperty(members, HOST_COMPOSITE_INSTANCE, {
|
|
2290
|
-
value: compositeName,
|
|
2291
|
-
enumerable: false,
|
|
2292
|
-
configurable: true,
|
|
2293
|
-
});
|
|
2294
|
-
}
|
|
2295
|
-
stampHostCompositeMembers(members, compositeName);
|
|
2296
|
-
return members;
|
|
2297
|
-
}
|
|
2298
|
-
/** Stamp `composite` on each declarable member of a host instance, descending into nested host instances. */
|
|
2299
|
-
function stampHostCompositeMembers(members, compositeName) {
|
|
2300
|
-
for (const member of Object.values(members)) {
|
|
2301
|
-
if (isDeclarable(member))
|
|
2302
|
-
setProvenance(member, { composite: compositeName });
|
|
2303
|
-
else if (hostCompositeName(member) !== undefined)
|
|
2304
|
-
stampHostCompositeMembers(member, compositeName);
|
|
2305
|
-
}
|
|
2306
|
-
}
|
|
2307
|
-
/** The composite name a host composite instance was marked with, or `undefined` for any other value. */
|
|
2308
|
-
function hostCompositeName(value) {
|
|
2309
|
-
if (!isIndexableObject(value))
|
|
2310
|
-
return undefined;
|
|
2311
|
-
const name = value[HOST_COMPOSITE_INSTANCE];
|
|
2312
|
-
return typeof name === "string" ? name : undefined;
|
|
2313
|
-
}
|
|
2314
2269
|
/** Evaluate an admissible factory body's statements in order, binding each `const`, and return the `return` expression's value. */
|
|
2315
2270
|
async function interpretFactoryBody(fn, ctx, bind) {
|
|
2316
2271
|
if (!ts.isBlock(fn.body))
|
|
@@ -4036,7 +3991,7 @@ export async function foldProject(files, intrinsics = [], options = {}) {
|
|
|
4036
3991
|
const attempt = attempts.get(file);
|
|
4037
3992
|
return {
|
|
4038
3993
|
file,
|
|
4039
|
-
exports: attempt?.ok === true ?
|
|
3994
|
+
exports: attempt?.ok === true ? Object.fromEntries(attempt.exportedValues) : {},
|
|
4040
3995
|
};
|
|
4041
3996
|
}));
|
|
4042
3997
|
const out = new Map();
|
|
@@ -4103,66 +4058,6 @@ function foldProvenanceByFile(modules) {
|
|
|
4103
4058
|
}
|
|
4104
4059
|
return out;
|
|
4105
4060
|
}
|
|
4106
|
-
/**
|
|
4107
|
-
* chant#3598 — a file's exports with every host composite instance replaced by
|
|
4108
|
-
* its members, for {@link foldProvenanceByFile} only.
|
|
4109
|
-
*
|
|
4110
|
-
* A host's registration form (chant#2442) returns the members object the
|
|
4111
|
-
* factory built, not a chant `CompositeInstance`, because wrapping it would run
|
|
4112
|
-
* chant's member validation against the host's own entities. `collectEntities`
|
|
4113
|
-
* expands only chant's instances, so an instance exported whole
|
|
4114
|
-
* (`export const store = Store({...})`) contributed no entity and therefore no
|
|
4115
|
-
* record, while a destructured member, a plain declarable export, did.
|
|
4116
|
-
*
|
|
4117
|
-
* The members are named and stamped the way `expandComposite` names and stamps
|
|
4118
|
-
* a chant instance: `${exportName}${Member}`, with a whole-entity `composite`
|
|
4119
|
-
* origin under the paths the fold already attributed. That origin is written
|
|
4120
|
-
* before `collectEntities` adds its `authored` one, and the first writer wins,
|
|
4121
|
-
* so a path the fold did not attribute is `unknown` rather than `direct`.
|
|
4122
|
-
*
|
|
4123
|
-
* Only a top-level export is expanded. A host instance nested in another
|
|
4124
|
-
* composite's body or placed in an array does not fold today, so its file is
|
|
4125
|
-
* `run` and has no record to give.
|
|
4126
|
-
*
|
|
4127
|
-
* The exports a caller receives in the verdict are the originals.
|
|
4128
|
-
*/
|
|
4129
|
-
function expandHostCompositeExports(exports) {
|
|
4130
|
-
const out = {};
|
|
4131
|
-
for (const [name, value] of Object.entries(exports)) {
|
|
4132
|
-
if (hostCompositeName(value) === undefined) {
|
|
4133
|
-
out[name] = value;
|
|
4134
|
-
continue;
|
|
4135
|
-
}
|
|
4136
|
-
expandHostCompositeInstance(name, value, name, out);
|
|
4137
|
-
}
|
|
4138
|
-
return out;
|
|
4139
|
-
}
|
|
4140
|
-
/**
|
|
4141
|
-
* chant#3608 — one host instance's members into `out`, a nested host instance
|
|
4142
|
-
* expanded in place under its member's name (`siteMainBucket`), as
|
|
4143
|
-
* `expandComposite` expands a nested chant instance. Every member belongs to
|
|
4144
|
-
* the top-level `instance`; its composite is the innermost one, which
|
|
4145
|
-
* {@link markHostCompositeInstance} already stamped, so the whole-entity
|
|
4146
|
-
* origin names that composite too.
|
|
4147
|
-
*/
|
|
4148
|
-
function expandHostCompositeInstance(prefix, members, instance, out) {
|
|
4149
|
-
const compositeName = hostCompositeName(members);
|
|
4150
|
-
for (const [memberName, member] of Object.entries(members)) {
|
|
4151
|
-
if (memberName.length === 0)
|
|
4152
|
-
continue;
|
|
4153
|
-
const fullName = `${prefix}${memberName[0].toUpperCase()}${memberName.slice(1)}`;
|
|
4154
|
-
if (hostCompositeName(member) !== undefined) {
|
|
4155
|
-
expandHostCompositeInstance(fullName, member, instance, out);
|
|
4156
|
-
continue;
|
|
4157
|
-
}
|
|
4158
|
-
if (!isDeclarable(member))
|
|
4159
|
-
continue;
|
|
4160
|
-
setProvenance(member, { composite: compositeName, compositeInstance: instance });
|
|
4161
|
-
const composite = getProvenance(member)?.composite ?? compositeName;
|
|
4162
|
-
setPathProvenance(member, "", { kind: "composite", composite, instance });
|
|
4163
|
-
out[fullName] = member;
|
|
4164
|
-
}
|
|
4165
|
-
}
|
|
4166
4061
|
/** The deepest directory every one of `files` sits under. */
|
|
4167
4062
|
function commonDirectory(files) {
|
|
4168
4063
|
const split = files.map((file) => dirname(resolvePath(file)).split(sep));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Declarable } from "../declarable.js";
|
|
2
|
+
/**
|
|
3
|
+
* Mark `members` as the instance a host's composite produced, and return it
|
|
4
|
+
* unchanged.
|
|
5
|
+
*
|
|
6
|
+
* chant#3608 — every declarable member, and every member of a nested host
|
|
7
|
+
* instance, is also stamped with the composite, the way `expandComposite`
|
|
8
|
+
* stamps a chant instance's members. A destructured member is never expanded,
|
|
9
|
+
* so this is the only record it has that a composite wrote it, and without
|
|
10
|
+
* it a path the fold did not attribute reads as authored and so `direct`.
|
|
11
|
+
* `setProvenance` keeps the first writer, and a nested instance was marked
|
|
12
|
+
* when its own call returned, so a member keeps its innermost composite.
|
|
13
|
+
*/
|
|
14
|
+
export declare function markHostCompositeInstance(members: Record<string, unknown>, compositeName: string): Record<string, unknown>;
|
|
15
|
+
/** The composite name a host composite instance was marked with, or `undefined` for any other value. */
|
|
16
|
+
export declare function hostCompositeName(value: unknown): string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* chant#3598, chant#3612 — a host composite instance's members as entities,
|
|
19
|
+
* for `collectEntities`.
|
|
20
|
+
*
|
|
21
|
+
* `collectEntities` is the one place `build()` and `foldProject` turn exports
|
|
22
|
+
* into entities, so expanding here is what makes the two report the same set:
|
|
23
|
+
* `export const archive = Archive({...})` gives `archiveBucket` to both.
|
|
24
|
+
*
|
|
25
|
+
* The members are named and stamped the way `expandComposite` names and stamps
|
|
26
|
+
* a chant instance: `${exportName}${Member}`, a nested host instance expanded
|
|
27
|
+
* in place under its member's name (`siteMainBucket`), with a whole-entity
|
|
28
|
+
* `composite` origin under the paths the fold already attributed. That origin
|
|
29
|
+
* is written before `collectEntities` adds its own record, and the first
|
|
30
|
+
* writer wins, so a path the fold did not attribute is `unknown` rather than
|
|
31
|
+
* `direct`. Every member belongs to the top-level `instance`; its composite is
|
|
32
|
+
* the innermost one, which {@link markHostCompositeInstance} already stamped.
|
|
33
|
+
*/
|
|
34
|
+
export declare function expandHostComposite(prefix: string, members: Record<string, unknown>, instance?: string): Array<[string, Declarable]>;
|
|
35
|
+
//# sourceMappingURL=host-composite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-composite.d.ts","sourceRoot":"","sources":["../../src/discovery/host-composite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAoB9D;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,aAAa,EAAE,MAAM,GACpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUzB;AAUD,wGAAwG;AACxG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIpE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,QAAQ,GAAE,MAAe,GACxB,KAAK,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAiB7B"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { isDeclarable } from "../declarable.js";
|
|
2
|
+
import { getProvenance, setPathProvenance, setProvenance } from "../provenance.js";
|
|
3
|
+
/**
|
|
4
|
+
* chant#3598 — a host composite instance's own marker. Non-enumerable and
|
|
5
|
+
* symbol-keyed, like provenance, so nothing that serializes or compares the
|
|
6
|
+
* exports sees it. It carries the composite's name, which the members object
|
|
7
|
+
* otherwise has no record of once it is returned.
|
|
8
|
+
*
|
|
9
|
+
* Only the fold path sets it: a host's registration form (chant#2442) returns
|
|
10
|
+
* the members object the factory built, not a chant `CompositeInstance`, and
|
|
11
|
+
* chant knows the object came from a composite only because the fold resolved
|
|
12
|
+
* the call. A file that runs instead has no such knowledge.
|
|
13
|
+
*/
|
|
14
|
+
const HOST_COMPOSITE_INSTANCE = Symbol.for("chant.fold.hostCompositeInstance");
|
|
15
|
+
function isPlainIndexable(value) {
|
|
16
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Mark `members` as the instance a host's composite produced, and return it
|
|
20
|
+
* unchanged.
|
|
21
|
+
*
|
|
22
|
+
* chant#3608 — every declarable member, and every member of a nested host
|
|
23
|
+
* instance, is also stamped with the composite, the way `expandComposite`
|
|
24
|
+
* stamps a chant instance's members. A destructured member is never expanded,
|
|
25
|
+
* so this is the only record it has that a composite wrote it, and without
|
|
26
|
+
* it a path the fold did not attribute reads as authored and so `direct`.
|
|
27
|
+
* `setProvenance` keeps the first writer, and a nested instance was marked
|
|
28
|
+
* when its own call returned, so a member keeps its innermost composite.
|
|
29
|
+
*/
|
|
30
|
+
export function markHostCompositeInstance(members, compositeName) {
|
|
31
|
+
if (Object.isExtensible(members) && !Object.prototype.hasOwnProperty.call(members, HOST_COMPOSITE_INSTANCE)) {
|
|
32
|
+
Object.defineProperty(members, HOST_COMPOSITE_INSTANCE, {
|
|
33
|
+
value: compositeName,
|
|
34
|
+
enumerable: false,
|
|
35
|
+
configurable: true,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
stampHostCompositeMembers(members, compositeName);
|
|
39
|
+
return members;
|
|
40
|
+
}
|
|
41
|
+
/** Stamp `composite` on each declarable member of a host instance, descending into nested host instances. */
|
|
42
|
+
function stampHostCompositeMembers(members, compositeName) {
|
|
43
|
+
for (const member of Object.values(members)) {
|
|
44
|
+
if (isDeclarable(member))
|
|
45
|
+
setProvenance(member, { composite: compositeName });
|
|
46
|
+
else if (hostCompositeName(member) !== undefined)
|
|
47
|
+
stampHostCompositeMembers(member, compositeName);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** The composite name a host composite instance was marked with, or `undefined` for any other value. */
|
|
51
|
+
export function hostCompositeName(value) {
|
|
52
|
+
if (!isPlainIndexable(value))
|
|
53
|
+
return undefined;
|
|
54
|
+
const name = value[HOST_COMPOSITE_INSTANCE];
|
|
55
|
+
return typeof name === "string" ? name : undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* chant#3598, chant#3612 — a host composite instance's members as entities,
|
|
59
|
+
* for `collectEntities`.
|
|
60
|
+
*
|
|
61
|
+
* `collectEntities` is the one place `build()` and `foldProject` turn exports
|
|
62
|
+
* into entities, so expanding here is what makes the two report the same set:
|
|
63
|
+
* `export const archive = Archive({...})` gives `archiveBucket` to both.
|
|
64
|
+
*
|
|
65
|
+
* The members are named and stamped the way `expandComposite` names and stamps
|
|
66
|
+
* a chant instance: `${exportName}${Member}`, a nested host instance expanded
|
|
67
|
+
* in place under its member's name (`siteMainBucket`), with a whole-entity
|
|
68
|
+
* `composite` origin under the paths the fold already attributed. That origin
|
|
69
|
+
* is written before `collectEntities` adds its own record, and the first
|
|
70
|
+
* writer wins, so a path the fold did not attribute is `unknown` rather than
|
|
71
|
+
* `direct`. Every member belongs to the top-level `instance`; its composite is
|
|
72
|
+
* the innermost one, which {@link markHostCompositeInstance} already stamped.
|
|
73
|
+
*/
|
|
74
|
+
export function expandHostComposite(prefix, members, instance = prefix) {
|
|
75
|
+
const out = [];
|
|
76
|
+
const compositeName = hostCompositeName(members);
|
|
77
|
+
for (const [memberName, member] of Object.entries(members)) {
|
|
78
|
+
if (memberName.length === 0)
|
|
79
|
+
continue;
|
|
80
|
+
const fullName = `${prefix}${memberName[0].toUpperCase()}${memberName.slice(1)}`;
|
|
81
|
+
if (hostCompositeName(member) !== undefined) {
|
|
82
|
+
out.push(...expandHostComposite(fullName, member, instance));
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (!isDeclarable(member))
|
|
86
|
+
continue;
|
|
87
|
+
setProvenance(member, { composite: compositeName, compositeInstance: instance });
|
|
88
|
+
const composite = getProvenance(member)?.composite ?? compositeName;
|
|
89
|
+
setPathProvenance(member, "", { kind: "composite", composite, instance });
|
|
90
|
+
out.push([fullName, member]);
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
@@ -70,6 +70,15 @@ export interface DiscoveryOptions {
|
|
|
70
70
|
* at all, rather than a looser fallback.
|
|
71
71
|
*/
|
|
72
72
|
lexicons?: readonly string[];
|
|
73
|
+
/**
|
|
74
|
+
* chant#3612 — package specifiers to follow a bare import into, verbatim,
|
|
75
|
+
* alongside whatever {@link lexicons} names. The same allowlist
|
|
76
|
+
* `FoldProjectOptions.lexiconPackages` gives `foldProject` (chant#2438), so
|
|
77
|
+
* a build over a host of its own folds the files `foldProject` folds. A
|
|
78
|
+
* chant project never needs it: its packages are `lexicons`. Only
|
|
79
|
+
* meaningful when {@link fold} is set. Default: none.
|
|
80
|
+
*/
|
|
81
|
+
lexiconPackages?: readonly string[];
|
|
73
82
|
/**
|
|
74
83
|
* chant #1045 Phase 2 — opt-in: whatever would otherwise reach the
|
|
75
84
|
* in-process `importModule` step (every file, when {@link fold} isn't set;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/discovery/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAQ/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AA8D1D;;;;;GAKG;AACH,MAAM,WAAW,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AAY,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACvC,qDAAqD;IACrD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,mDAAmD;IACnD,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB;;;OAGG;IACH,aAAa,EAAE,YAAY,EAAE,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CA+SjG"}
|
package/dist/discovery/index.js
CHANGED
|
@@ -134,7 +134,7 @@ export async function discover(path, options) {
|
|
|
134
134
|
"project code and the second exists to invoke it. Pass one.");
|
|
135
135
|
}
|
|
136
136
|
const foldSession = options?.fold
|
|
137
|
-
? createFoldSession(options.intrinsics, buildParamValuesMap, options.lexicons, options.sandbox === true, [], options.executing === true, files)
|
|
137
|
+
? createFoldSession(options.intrinsics, buildParamValuesMap, options.lexicons, options.sandbox === true, options.lexiconPackages ?? [], options.executing === true, files)
|
|
138
138
|
: undefined;
|
|
139
139
|
if (options?.fold) {
|
|
140
140
|
for (const file of files) {
|