@intentius/chant 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.d.ts +7 -0
- package/dist/build.d.ts.map +1 -1
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/check-lexicon-examples.d.ts.map +1 -1
- package/dist/cli/commands/check-lexicon-intrinsics.d.ts +17 -0
- package/dist/cli/commands/check-lexicon-intrinsics.d.ts.map +1 -1
- package/dist/cli/commands/check-lexicon.d.ts.map +1 -1
- package/dist/codegen/docs-types.d.ts +2 -0
- package/dist/codegen/docs-types.d.ts.map +1 -1
- package/dist/declarable.d.ts +16 -0
- package/dist/declarable.d.ts.map +1 -1
- package/dist/discovery/entity-wire-codec.d.ts.map +1 -1
- package/dist/discovery/fold-import.d.ts +64 -3
- package/dist/discovery/fold-import.d.ts.map +1 -1
- package/dist/discovery/index.d.ts +12 -0
- package/dist/discovery/index.d.ts.map +1 -1
- package/dist/fold/fold.d.ts +89 -16
- package/dist/fold/fold.d.ts.map +1 -1
- package/dist/fold/foldable-helpers.d.ts +121 -0
- package/dist/fold/foldable-helpers.d.ts.map +1 -0
- package/dist/fold/subset.d.ts +58 -3
- package/dist/fold/subset.d.ts.map +1 -1
- package/dist/lexicon-schema.d.ts +2 -0
- package/dist/lexicon-schema.d.ts.map +1 -1
- package/dist/lexicon.d.ts +73 -23
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/runtime.d.ts +10 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/serializer-walker.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/build.ts +9 -0
- package/src/cli/commands/build.ts +9 -0
- package/src/cli/commands/check-lexicon-examples.ts +16 -1
- package/src/cli/commands/check-lexicon-intrinsics.test.ts +35 -1
- package/src/cli/commands/check-lexicon-intrinsics.ts +38 -2
- package/src/cli/commands/check-lexicon.ts +18 -0
- package/src/codegen/docs-sections.test.ts +7 -1
- package/src/codegen/docs-sections.ts +1 -1
- package/src/codegen/docs-types.ts +2 -0
- package/src/declarable.ts +20 -0
- package/src/discovery/entity-wire-codec.ts +9 -7
- package/src/discovery/fold-import.test.ts +900 -1
- package/src/discovery/fold-import.ts +441 -47
- package/src/discovery/index.ts +25 -1
- package/src/fold/fold.test.ts +277 -0
- package/src/fold/fold.ts +219 -58
- package/src/fold/foldable-helpers.ts +171 -0
- package/src/fold/subset-doc-parity.test.ts +27 -0
- package/src/fold/subset.test.ts +177 -0
- package/src/fold/subset.ts +139 -31
- package/src/lexicon-schema.test.ts +43 -0
- package/src/lexicon-schema.ts +5 -0
- package/src/lexicon.ts +74 -24
- package/src/runtime.ts +11 -2
- package/src/serializer-walker.ts +14 -0
package/dist/build.d.ts
CHANGED
|
@@ -87,6 +87,13 @@ export interface BuildOptions {
|
|
|
87
87
|
* The CLI populates this from `options.plugins.flatMap(p => p.intrinsics?.() ?? [])`.
|
|
88
88
|
*/
|
|
89
89
|
intrinsics?: IntrinsicDef[];
|
|
90
|
+
/**
|
|
91
|
+
* chant #1063 — the lexicon names loaded for this build. Passed straight
|
|
92
|
+
* through to {@link DiscoveryOptions.lexicons} in `./discovery/index`;
|
|
93
|
+
* ignored unless {@link fold} is set. The CLI populates this from
|
|
94
|
+
* `options.plugins.map(p => p.name)`.
|
|
95
|
+
*/
|
|
96
|
+
lexicons?: readonly string[];
|
|
90
97
|
/**
|
|
91
98
|
* chant #1045 Phase 2 — opt-in: run-fallback files (or, when {@link fold}
|
|
92
99
|
* isn't set, every file) execute together, isolated, in one sandboxed
|
package/dist/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EAAE,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,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB;IAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAoB/C;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,uBAAuB;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,2JAA2J;IAC3J,WAAW,CAAC,EAAE,OAAO,kBAAkB,EAAE,oBAAoB,EAAE,CAAC;CACjE;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAoW9E;AAiDD;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAIlD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAItD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,YAAY,EACrB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,GACxC,MAAM,IAAI,CAmCZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-lexicon-examples.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/check-lexicon-examples.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;
|
|
1
|
+
{"version":3,"file":"check-lexicon-examples.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/check-lexicon-examples.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAUH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAoE1F"}
|
|
@@ -24,11 +24,20 @@
|
|
|
24
24
|
* tag (see ../../fold/fold.ts). Anything else (a plain function, a class,
|
|
25
25
|
* a const object/proxy) cannot be invoked as `` Name`...` `` and must be
|
|
26
26
|
* `isTag: false`.
|
|
27
|
+
*
|
|
28
|
+
* chant #1044 adds a third question, for the same reason the first two
|
|
29
|
+
* exist: `foldsAsCall` opts an intrinsic's PLAIN-CALL form into folding, so
|
|
30
|
+
* declaring it on something authored as a tagged template claims a form that
|
|
31
|
+
* cannot be called that way. The two flags are mutually exclusive, and a
|
|
32
|
+
* registration setting both is a failure here rather than a silently ignored
|
|
33
|
+
* field.
|
|
27
34
|
*/
|
|
28
35
|
export interface IntrinsicAuditItem {
|
|
29
36
|
name: string;
|
|
30
37
|
/** The `isTag` value as registered in `src/plugin.ts`'s `intrinsics()`. */
|
|
31
38
|
declaredIsTag: boolean | undefined;
|
|
39
|
+
/** The `foldsAsCall` opt-in as registered in `src/plugin.ts` (chant #1044); `undefined` when absent, which means "not opted in". */
|
|
40
|
+
declaredFoldsAsCall: boolean | undefined;
|
|
32
41
|
/** Whether `name` resolves to a real export of `src/index.ts`. */
|
|
33
42
|
exported: boolean;
|
|
34
43
|
/**
|
|
@@ -43,6 +52,14 @@ export interface IntrinsicAuditItem {
|
|
|
43
52
|
/** True only when exported AND the authored shape matches `declaredIsTag`. */
|
|
44
53
|
ok: boolean;
|
|
45
54
|
detail?: string;
|
|
55
|
+
/**
|
|
56
|
+
* chant #1044 — false only when `foldsAsCall: true` is registered on
|
|
57
|
+
* something authored as a tagged template. Tracked separately from
|
|
58
|
+
* {@link ok} so the two failures report as the two different registration
|
|
59
|
+
* mistakes they are, rather than one message covering both.
|
|
60
|
+
*/
|
|
61
|
+
callFormOk: boolean;
|
|
62
|
+
callFormDetail?: string;
|
|
46
63
|
}
|
|
47
64
|
/**
|
|
48
65
|
* Audit every intrinsic a lexicon registers in `src/plugin.ts` against
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-lexicon-intrinsics.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/check-lexicon-intrinsics.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"check-lexicon-intrinsics.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/check-lexicon-intrinsics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAQH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,aAAa,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,oIAAoI;IACpI,mBAAmB,EAAE,OAAO,GAAG,SAAS,CAAC;IACzC,kEAAkE;IAClE,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;;;;OAOG;IACH,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,8EAA8E;IAC9E,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AA2MD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAqExE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-lexicon.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/check-lexicon.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACpB;AAiDD;;GAEG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"check-lexicon.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/check-lexicon.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACpB;AAiDD;;GAEG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAuapE;AAqBD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAmDzE"}
|
|
@@ -61,6 +61,8 @@ export interface ManifestJSON {
|
|
|
61
61
|
description?: string;
|
|
62
62
|
outputKey?: string;
|
|
63
63
|
isTag?: boolean;
|
|
64
|
+
/** chant #1044 — the call-form fold opt-in, as published in the lexicon's manifest. Absent in any manifest built before #1044, which reads the same as "not opted in". */
|
|
65
|
+
foldsAsCall?: boolean;
|
|
64
66
|
}>;
|
|
65
67
|
pseudoParameters?: Record<string, string>;
|
|
66
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-types.d.ts","sourceRoot":"","sources":["../../src/codegen/docs-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,eAAe,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;IACnD,iDAAiD;IACjD,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1D,2DAA2D;IAC3D,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC9G,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,YAAY,CAAC,EAAE,KAAK,CAAC,MA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B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,YAAY,CAAC;CAC7B"}
|
package/dist/declarable.d.ts
CHANGED
|
@@ -11,6 +11,22 @@ export interface Declarable {
|
|
|
11
11
|
readonly kind?: "resource" | "property" | "output";
|
|
12
12
|
readonly [DECLARABLE_MARKER]: true;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* A `Declarable` that carries a resource payload — the `props`/`attributes`
|
|
16
|
+
* fields that most lexicon serializers read to produce output. Not every
|
|
17
|
+
* `Declarable` has one (outputs and parameters genuinely don't), so this is
|
|
18
|
+
* kept as a sub-interface rather than widening the base type. See chant #1049.
|
|
19
|
+
*/
|
|
20
|
+
export interface ResourceDeclarable extends Declarable {
|
|
21
|
+
readonly props: unknown;
|
|
22
|
+
readonly attributes?: unknown;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Type guard for `ResourceDeclarable` — replaces the ad-hoc `"props" in x`
|
|
26
|
+
* checks that were previously repeated (with an `as unknown as` cast) at every
|
|
27
|
+
* call site that reads `props`/`attributes` off a `Declarable`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isResourceDeclarable(value: Declarable): value is ResourceDeclarable;
|
|
14
30
|
/**
|
|
15
31
|
* Core parameter type for lexicon-agnostic parameters
|
|
16
32
|
*/
|
package/dist/declarable.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarable.d.ts","sourceRoot":"","sources":["../src/declarable.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,iBAAiB,eAAiC,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;IACnD,QAAQ,CAAC,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAOhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAE/D"}
|
|
1
|
+
{"version":3,"file":"declarable.d.ts","sourceRoot":"","sources":["../src/declarable.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,iBAAiB,eAAiC,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;IACnD,QAAQ,CAAC,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC;CACpC;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,IAAI,kBAAkB,CAEnF;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAOhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAE/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-wire-codec.d.ts","sourceRoot":"","sources":["../../src/discovery/entity-wire-codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"entity-wire-codec.d.ts","sourceRoot":"","sources":["../../src/discovery/entity-wire-codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,OAAO,EAA2C,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAOzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA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ChB;AAED,MAAM,MAAM,UAAU,GAAG,oBAAoB,GAAG,uBAAuB,CAAC;AAExE,kEAAkE;AAClE,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAmKD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,aAAa,CAoBhF;AAuGD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAwC5E"}
|
|
@@ -59,6 +59,20 @@ export type FoldFileResult = {
|
|
|
59
59
|
* exact same object every referencing file sees.
|
|
60
60
|
*/
|
|
61
61
|
exportedValues: Map<string, unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* chant #1044 — the OTHER project files whose exported OBJECTS this
|
|
64
|
+
* fold consumed (a cross-file `Declarable`, composite instance, or any
|
|
65
|
+
* other non-primitive reached through `buildExternals`/a re-export).
|
|
66
|
+
*
|
|
67
|
+
* Object identity is the thing that cannot survive one side of the
|
|
68
|
+
* build folding while the other runs, so `planFoldTaint` needs to know
|
|
69
|
+
* who consumed whose objects: if a file here is forced back to run, the
|
|
70
|
+
* instance THIS file already captured is not the instance discovery
|
|
71
|
+
* will collect, and serialization fails on an entity with no logical
|
|
72
|
+
* name. A primitive (string, number, boolean, null) is never recorded —
|
|
73
|
+
* it has no identity to disagree about.
|
|
74
|
+
*/
|
|
75
|
+
liveSources: ReadonlySet<string>;
|
|
62
76
|
} | {
|
|
63
77
|
ok: false;
|
|
64
78
|
reason: string;
|
|
@@ -133,9 +147,41 @@ export interface FoldSession {
|
|
|
133
147
|
* doesn't use build-time parameters pays nothing extra here.
|
|
134
148
|
*/
|
|
135
149
|
readonly buildParams?: Readonly<Record<string, BuildParamValue>>;
|
|
150
|
+
/**
|
|
151
|
+
* chant #1063 — the exact package specifiers of the lexicons LOADED for
|
|
152
|
+
* this build (`@intentius/chant-lexicon-aws`, …), derived from the lexicon
|
|
153
|
+
* names the build already resolved (`resolveProjectLexicons` ->
|
|
154
|
+
* `loadPlugins`, see ../cli/plugins.ts). This is the entire allowlist
|
|
155
|
+
* {@link buildExternals} will follow a bare import specifier into — see
|
|
156
|
+
* {@link activeLexiconPackage} for why the set is matched by TEXT and
|
|
157
|
+
* built from names the build already knows, rather than by resolving
|
|
158
|
+
* specifiers to find out what they are.
|
|
159
|
+
*
|
|
160
|
+
* Empty when the caller supplied no lexicon list, which disables
|
|
161
|
+
* lexicon-package resolution entirely rather than falling back to
|
|
162
|
+
* something more permissive: "an active lexicon of this build" is the
|
|
163
|
+
* boundary, and a build that can't say what its lexicons are hasn't
|
|
164
|
+
* established one.
|
|
165
|
+
*/
|
|
166
|
+
readonly lexiconPackages: ReadonlySet<string>;
|
|
136
167
|
}
|
|
137
|
-
/**
|
|
138
|
-
|
|
168
|
+
/**
|
|
169
|
+
* chant #1063 — the package specifier a lexicon NAME (`"aws"`, `"gitlab"`)
|
|
170
|
+
* is installed under. The one naming convention the whole CLI already
|
|
171
|
+
* depends on: `loadPlugin(name)` imports exactly this
|
|
172
|
+
* (../cli/plugins.ts), `detectLexicons` scans source for exactly this
|
|
173
|
+
* (../detectLexicon.ts), and `chant init` writes exactly this into
|
|
174
|
+
* package.json.
|
|
175
|
+
*/
|
|
176
|
+
export declare function lexiconPackageName(lexiconName: string): string;
|
|
177
|
+
/**
|
|
178
|
+
* Create a fresh, empty {@link FoldSession}.
|
|
179
|
+
*
|
|
180
|
+
* @param lexicons - chant #1063: the lexicon NAMES active for this build
|
|
181
|
+
* (`["aws", "k8s"]`). Converted to package specifiers via
|
|
182
|
+
* {@link lexiconPackageName}; see {@link FoldSession.lexiconPackages}.
|
|
183
|
+
*/
|
|
184
|
+
export declare function createFoldSession(intrinsics?: readonly IntrinsicDef[], buildParams?: Readonly<Record<string, BuildParamValue>>, lexicons?: readonly string[]): FoldSession;
|
|
139
185
|
/**
|
|
140
186
|
* Attempt to fold one source file with zero execution of its own top-level
|
|
141
187
|
* code. Returns the folded, instantiated entities on success, or a reason
|
|
@@ -194,6 +240,21 @@ export declare function tryFoldFile(file: string, intrinsics?: readonly Intrinsi
|
|
|
194
240
|
* the discovered files' relative-import graph, seeded from every file that
|
|
195
241
|
* doesn't fold on its own.
|
|
196
242
|
*
|
|
243
|
+
* chant #1044 adds the OTHER half of the same hazard, in the opposite
|
|
244
|
+
* direction along the same edges. Forward taint covers "a run file imports a
|
|
245
|
+
* folded file"; it does not cover "a FOLDED file consumed the objects of a
|
|
246
|
+
* file that later got forced to run". Once a plain-call intrinsic can fold,
|
|
247
|
+
* that second case is easy to reach: in `lexicons/aws/examples/lambda-api`,
|
|
248
|
+
* `health-api.ts` folds and captures `params.ts`'s real `Parameter` instance
|
|
249
|
+
* through `Ref(environment)`, while `params.ts` itself is forced to run
|
|
250
|
+
* because a DIFFERENT sibling (`data-bucket.ts`) imports it and falls back.
|
|
251
|
+
* Discovery then collects the run instance and serializes the folded one —
|
|
252
|
+
* the same "Logical name not set" crash described above, arriving from the
|
|
253
|
+
* other side. So `liveSources` (see {@link FoldFileResult}) contributes
|
|
254
|
+
* reverse edges here: a tainted file taints every folded file that captured
|
|
255
|
+
* one of its objects. Only object identity propagates — a file that imported
|
|
256
|
+
* a plain string from a tainted file has nothing to disagree about.
|
|
257
|
+
*
|
|
197
258
|
* chant #1020 changes the calculus but not this function: `alb.ts` can now
|
|
198
259
|
* often fold `network.vpc.VpcId` too (see `buildExternals`/`foldFileMemoized`
|
|
199
260
|
* above), by reusing THE EXACT SAME `tryFoldFile("network.ts")` call (memoized
|
|
@@ -206,5 +267,5 @@ export declare function tryFoldFile(file: string, intrinsics?: readonly Intrinsi
|
|
|
206
267
|
* so the exact same forced-taint safety net still applies to that remaining
|
|
207
268
|
* boundary, unchanged.
|
|
208
269
|
*/
|
|
209
|
-
export declare function planFoldTaint(files: readonly string[], wouldFold: ReadonlyMap<string, boolean
|
|
270
|
+
export declare function planFoldTaint(files: readonly string[], wouldFold: ReadonlyMap<string, boolean>, liveSources?: ReadonlyMap<string, ReadonlySet<string>>): Promise<Set<string>>;
|
|
210
271
|
//# sourceMappingURL=fold-import.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold-import.d.ts","sourceRoot":"","sources":["../../src/discovery/fold-import.ts"],"names":[],"mappings":"AAMA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"fold-import.d.ts","sourceRoot":"","sources":["../../src/discovery/fold-import.ts"],"names":[],"mappings":"AAMA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAkB3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;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,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB;;;;;;;;;OASG;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;CAAE,CAAC;AAElC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,W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;;;;;GA8DG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,GACrD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CA8EtB"}
|
|
@@ -43,6 +43,18 @@ export interface DiscoveryOptions {
|
|
|
43
43
|
* then falls back to run at the unregistered tag).
|
|
44
44
|
*/
|
|
45
45
|
intrinsics?: IntrinsicDef[];
|
|
46
|
+
/**
|
|
47
|
+
* chant #1063 — the lexicon NAMES loaded for this build (`["aws", "k8s"]`),
|
|
48
|
+
* i.e. what `resolveProjectLexicons()` returned and `loadPlugins()` then
|
|
49
|
+
* imported. Threaded into the fold session as the ALLOWLIST of packages a
|
|
50
|
+
* bare import specifier may be resolved into, so a lexicon's plain data
|
|
51
|
+
* exports (`Azure`/`GCP`'s pseudo-parameter namespaces, AWS's `S3Actions`,
|
|
52
|
+
* gitlab's `CI`) fold as identifier values instead of failing the file.
|
|
53
|
+
* Only meaningful when {@link fold} is set. Default: none — a caller that
|
|
54
|
+
* doesn't say which lexicons are active gets no bare-specifier resolution
|
|
55
|
+
* at all, rather than a looser fallback.
|
|
56
|
+
*/
|
|
57
|
+
lexicons?: readonly string[];
|
|
46
58
|
/**
|
|
47
59
|
* chant #1045 Phase 2 — opt-in: whatever would otherwise reach the
|
|
48
60
|
* 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":"AAAA,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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AG,OAAO,CAAC,eAAe,CAAC,CAsQjG"}
|
package/dist/fold/fold.d.ts
CHANGED
|
@@ -17,9 +17,22 @@ import { type SubsetRuleId } from "./subset.js";
|
|
|
17
17
|
* ({@link "../lint/rules/evl001-non-literal-expression"}), so the linted
|
|
18
18
|
* subset and the folded subset can never drift apart (#1024).
|
|
19
19
|
*
|
|
20
|
-
* A `CallExpression` has no case — a function call as a value is
|
|
20
|
+
* A `CallExpression` has almost no case — a function call as a value is
|
|
21
21
|
* structurally unrepresentable, not merely linted against. Composite
|
|
22
|
-
* factory calls are out of scope here (epic Phase 5, #1023).
|
|
22
|
+
* factory calls are out of scope here (epic Phase 5, #1023). There are
|
|
23
|
+
* exactly two exceptions, both closed allowlists of names declared
|
|
24
|
+
* somewhere a human had to write them down, and both reducing to a symbolic
|
|
25
|
+
* envelope that executes nothing here:
|
|
26
|
+
*
|
|
27
|
+
* - a call to a REGISTERED chant authoring helper
|
|
28
|
+
* ({@link "./foldable-helpers"}, chant #1082) → {@link FoldedHelperCall};
|
|
29
|
+
* - a call to a lexicon intrinsic whose lexicon registered it AND opted
|
|
30
|
+
* its call form in ({@link intrinsicCallFolds}, ../lexicon.ts, chant
|
|
31
|
+
* #1044) → {@link FoldedIntrinsicCall}, the same `{__intrinsic}` family
|
|
32
|
+
* the tagged-template form already reduces to.
|
|
33
|
+
*
|
|
34
|
+
* Everything else — a user's function, a method call, an array `.map`, a
|
|
35
|
+
* registered name shadowed by a local binding — still throws.
|
|
23
36
|
*
|
|
24
37
|
* Cross-file identifier resolution (chant #1020): `consts` alone is always
|
|
25
38
|
* this file's own top-level bindings — that part stays single-file, and
|
|
@@ -45,7 +58,7 @@ import { type SubsetRuleId } from "./subset.js";
|
|
|
45
58
|
*/
|
|
46
59
|
export type FoldedValue = string | number | boolean | null | undefined | FoldedValue[] | {
|
|
47
60
|
[key: string]: FoldedValue;
|
|
48
|
-
} | AttrRefValue | FoldedIntrinsic | SymbolicValue | FoldedResource;
|
|
61
|
+
} | AttrRefValue | FoldedIntrinsic | FoldedHelperCall | SymbolicValue | FoldedResource;
|
|
49
62
|
/**
|
|
50
63
|
* Symbolic reference produced when a property/element access resolves to an
|
|
51
64
|
* attribute of another `const`-declared resource in the same file, e.g.
|
|
@@ -72,11 +85,46 @@ export interface AttrRefValue {
|
|
|
72
85
|
* Mirrors the runtime call shape `Tag(strings, ...values)` so a later
|
|
73
86
|
* build path can replay it into the real intrinsic object (#1022).
|
|
74
87
|
*/
|
|
75
|
-
export
|
|
88
|
+
export type FoldedIntrinsic = FoldedIntrinsicTag | FoldedIntrinsicCall;
|
|
89
|
+
/** The tagged-template form: `Sub\`${x}-y\`` — see {@link FoldedIntrinsic}. */
|
|
90
|
+
export interface FoldedIntrinsicTag {
|
|
76
91
|
__intrinsic: string;
|
|
77
92
|
strings: string[];
|
|
78
93
|
values: FoldedValue[];
|
|
79
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* The plain-call form of a registered, opted-in lexicon intrinsic
|
|
97
|
+
* (chant #1044) — `Ref(bucket)`, `Concat("a", b)`, `GetAtt("Fn", "Arn")`.
|
|
98
|
+
* Same `__intrinsic` key as the tagged-template form, so the same revival
|
|
99
|
+
* branch handles both and nothing downstream learns a new envelope; the
|
|
100
|
+
* payload differs because the call shape does — positional `args` mirroring
|
|
101
|
+
* `Name(...args)`, where the tag form mirrors `Name(strings, ...values)`.
|
|
102
|
+
*
|
|
103
|
+
* Symbolic, exactly like the tag form: `fold()` executes nothing, it only
|
|
104
|
+
* records that a registered intrinsic was called and with what. The real
|
|
105
|
+
* function is resolved through the folding file's own imports and invoked by
|
|
106
|
+
* `../discovery/fold-import.ts`'s `reviveFoldedValue`.
|
|
107
|
+
*/
|
|
108
|
+
export interface FoldedIntrinsicCall {
|
|
109
|
+
__intrinsic: string;
|
|
110
|
+
args: FoldedValue[];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The result of folding a call to a registered chant authoring helper
|
|
114
|
+
* (chant #1082) — e.g. `phase("Apply", [...])`, `output(ref, "oX")`. Holds
|
|
115
|
+
* the helper's name and its folded arguments, in source order.
|
|
116
|
+
*
|
|
117
|
+
* Symbolic, exactly like {@link FoldedIntrinsic}: `fold()` executes nothing,
|
|
118
|
+
* it only records that a registered helper was called and with what. The real
|
|
119
|
+
* function is resolved through the folding file's own imports and invoked by
|
|
120
|
+
* `../discovery/fold-import.ts`'s `reviveFoldedValue`, which is also where
|
|
121
|
+
* the "is this name actually bound to chant's own helper" check lives. See
|
|
122
|
+
* {@link "./foldable-helpers"} for the allowlist and why it is closed.
|
|
123
|
+
*/
|
|
124
|
+
export interface FoldedHelperCall {
|
|
125
|
+
__helper: string;
|
|
126
|
+
args: FoldedValue[];
|
|
127
|
+
}
|
|
80
128
|
/**
|
|
81
129
|
* A sub-expression inside a folded intrinsic that fold could not reduce to
|
|
82
130
|
* a value without resolving an identifier from outside this file — e.g. an
|
|
@@ -107,6 +155,18 @@ export interface FoldedResource {
|
|
|
107
155
|
attributes?: {
|
|
108
156
|
[key: string]: FoldedValue;
|
|
109
157
|
};
|
|
158
|
+
/**
|
|
159
|
+
* chant #1082 — every constructor argument, folded, in source order. Present
|
|
160
|
+
* only when the argument list is NOT the classic `(props)` / `(props,
|
|
161
|
+
* attributes)` shape — most often because the props object isn't first
|
|
162
|
+
* (`new Parameter("String", {...})`, whose signature is `(type, props)`).
|
|
163
|
+
*
|
|
164
|
+
* When present this is authoritative: the entity is constructed by spreading
|
|
165
|
+
* it, so the constructor receives exactly what the source wrote. `props`
|
|
166
|
+
* alongside it is the first object-literal argument, reported for readers,
|
|
167
|
+
* never re-passed (which would double-count it).
|
|
168
|
+
*/
|
|
169
|
+
args?: FoldedValue[];
|
|
110
170
|
}
|
|
111
171
|
/**
|
|
112
172
|
* One entry per exported `const` resource declaration in {@link foldModule}'s
|
|
@@ -188,13 +248,15 @@ export declare function collectConsts(sourceFile: ts.SourceFile): Map<string, ts
|
|
|
188
248
|
/**
|
|
189
249
|
* Fold a single expression node to a value. Throws {@link FoldError} for
|
|
190
250
|
* anything outside the supported subset — including any `CallExpression`
|
|
191
|
-
* that
|
|
251
|
+
* that is neither a registered chant authoring helper nor a registered,
|
|
252
|
+
* call-form-opted-in lexicon intrinsic (see the module doc).
|
|
192
253
|
*
|
|
193
|
-
* @param intrinsics -
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
254
|
+
* @param intrinsics - The active lexicons' registered intrinsics. A tagged
|
|
255
|
+
* template whose tag isn't in this list, or is in it without
|
|
256
|
+
* {@link intrinsicTagFolds}, is rejected; a plain call is rejected unless
|
|
257
|
+
* its callee is in this list with {@link intrinsicCallFolds} (chant
|
|
258
|
+
* #1044). Defaults to none — pass the target lexicon's manifest
|
|
259
|
+
* `intrinsics` to recognize either form.
|
|
198
260
|
* @param externals - chant #1020: pre-resolved imported bindings, consulted
|
|
199
261
|
* only when an identifier isn't in `consts`. See the module doc above.
|
|
200
262
|
* `undefined` (the default) preserves the exact pre-#1020 single-file
|
|
@@ -202,12 +264,23 @@ export declare function collectConsts(sourceFile: ts.SourceFile): Map<string, ts
|
|
|
202
264
|
*/
|
|
203
265
|
export declare function fold(node: ts.Expression, consts: Map<string, ts.Expression>, intrinsics?: readonly IntrinsicDef[], externals?: ReadonlyMap<string, unknown>): FoldedValue;
|
|
204
266
|
/**
|
|
205
|
-
* Fold a resource constructor call
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* {
|
|
209
|
-
* `DependsOn`, `Condition`, `DeletionPolicy`, …)
|
|
210
|
-
* `
|
|
267
|
+
* Fold a resource constructor call to its spec.
|
|
268
|
+
*
|
|
269
|
+
* The common `createResource` shape (../runtime.ts) is `new Type({ ...props
|
|
270
|
+
* })` or `new Type({ ...props }, { ...attributes })` — CFN-style resource
|
|
271
|
+
* attributes (`DependsOn`, `Condition`, `DeletionPolicy`, …) second — and
|
|
272
|
+
* that shape reduces to `props` (+ `attributes`) exactly as before.
|
|
273
|
+
*
|
|
274
|
+
* chant #1082 — but that is a convention, not a rule every lexicon class
|
|
275
|
+
* follows. AWS's deploy-time `Parameter` is `(type, props)`
|
|
276
|
+
* (lexicons/aws/src/parameter.ts): the props object is the SECOND argument
|
|
277
|
+
* and the first is a plain string. `foldResource` used to require argument 0
|
|
278
|
+
* to be an object literal, so no `new Parameter(...)` anywhere could ever
|
|
279
|
+
* fold, whatever surrounded it. The general case now folds every argument in
|
|
280
|
+
* source order into {@link FoldedResource.args}, which the caller constructs
|
|
281
|
+
* the entity from verbatim — no positional assumption at all. `props` is
|
|
282
|
+
* still reported (the first object-literal argument, for callers that read
|
|
283
|
+
* it) but is a VIEW onto `args`, not the thing constructed from.
|
|
211
284
|
*/
|
|
212
285
|
export declare function foldResource(node: ts.NewExpression, consts: Map<string, ts.Expression>, intrinsics?: readonly IntrinsicDef[], externals?: ReadonlyMap<string, unknown>): FoldedResource;
|
|
213
286
|
/**
|
package/dist/fold/fold.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold.d.ts","sourceRoot":"","sources":["../../src/fold/fold.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"fold.d.ts","sourceRoot":"","sources":["../../src/fold/fold.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAyC,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACtF,OAAO,EAaL,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAGlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH;;;;GAIG;AACH,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,WAAW,EAAE,GACb;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAA;CAAE,GAC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AM,EAAE,OAAO,CAAC,GACvC,cAAc,CA6BhB;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,QAAQ,SAAc,EACtB,UAAU,GAAE,SAAS,YAAY,EAAO,GACvC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CA6BjC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* foldable-helpers — the closed, declared allowlist of chant's OWN authoring
|
|
3
|
+
* helpers that a call expression may fold through (chant #1082, epic #1019).
|
|
4
|
+
*
|
|
5
|
+
* ## Why this exists
|
|
6
|
+
*
|
|
7
|
+
* `fold()` has no general case for a `CallExpression`: a function call as a
|
|
8
|
+
* value is structurally unrepresentable there, because folding it would mean
|
|
9
|
+
* executing code, which is the one thing the fold path exists to avoid. That
|
|
10
|
+
* rule is right for user code and stays right — a user's own function, an
|
|
11
|
+
* arrow function, a method call (`naming.name(...)`) all keep failing exactly
|
|
12
|
+
* as before.
|
|
13
|
+
*
|
|
14
|
+
* But it also blocks chant's own documented authoring API. `phase("Apply",
|
|
15
|
+
* [...])` is how the component contract says to write a component; `output(ref,
|
|
16
|
+
* "oX")` is how a lexicon output is authored. An application cannot avoid them
|
|
17
|
+
* and still use components or outputs, so every file that uses one falls back
|
|
18
|
+
* to run no matter how statically evaluable the rest of it is.
|
|
19
|
+
*
|
|
20
|
+
* #1044 already settled the shape of the answer one level down, for lexicon
|
|
21
|
+
* intrinsics: a call-shaped thing may fold ONLY when it is registered, opt-in,
|
|
22
|
+
* per-helper — never because it merely looks like a call. This module is the
|
|
23
|
+
* same decision applied one level up, to chant's own helpers, with the
|
|
24
|
+
* registration written here by hand instead of coming from a lexicon manifest.
|
|
25
|
+
*
|
|
26
|
+
* ## What "registered" buys, and what still has to be true
|
|
27
|
+
*
|
|
28
|
+
* A name in this list is NOT permission to invoke whatever it happens to be
|
|
29
|
+
* bound to. Folding a helper call is a two-key operation:
|
|
30
|
+
*
|
|
31
|
+
* 1. **Shape + name** (here, and in `fold()`/`findSubsetViolation`): the
|
|
32
|
+
* callee is a bare identifier whose text is in {@link
|
|
33
|
+
* FOLDABLE_AUTHORING_HELPERS} and which is not shadowed by a local
|
|
34
|
+
* `const`. `fold()` reduces the call to a symbolic
|
|
35
|
+
* `{ __helper, args }` envelope — it still executes nothing.
|
|
36
|
+
* 2. **Provenance + invocation** (`../discovery/fold-import.ts`): the
|
|
37
|
+
* envelope is revived by resolving that name through the folding FILE'S
|
|
38
|
+
* OWN `import` bindings and checking the import actually comes from chant
|
|
39
|
+
* ({@link isChantOwnedSpecifier}, or a path inside chant-core's own tree
|
|
40
|
+
* for in-repo/absolute-specifier callers). Only then is the real function
|
|
41
|
+
* invoked, with the real folded arguments. A same-named helper imported
|
|
42
|
+
* from somewhere else, or declared in the file itself, resolves to
|
|
43
|
+
* nothing chant owns and the whole file falls back to run.
|
|
44
|
+
*
|
|
45
|
+
* So the function that runs is always the same function the run path would
|
|
46
|
+
* have called, from the same module the source itself imported — fold does not
|
|
47
|
+
* substitute its own reimplementation, which is why this list cannot drift
|
|
48
|
+
* from the helpers' real behavior.
|
|
49
|
+
*
|
|
50
|
+
* ## Admission criteria
|
|
51
|
+
*
|
|
52
|
+
* A helper belongs here only if all of these hold:
|
|
53
|
+
*
|
|
54
|
+
* - chant owns and documents it as authoring surface;
|
|
55
|
+
* - it is a pure function of its arguments — no I/O, no `process.env`, no
|
|
56
|
+
* module-level mutable state, no observable side effect;
|
|
57
|
+
* - calling it early (at fold time) is indistinguishable from calling it
|
|
58
|
+
* during a real run of the file.
|
|
59
|
+
*
|
|
60
|
+
* Deliberately NOT admitted — see this module's tests and the #1082 PR body:
|
|
61
|
+
*
|
|
62
|
+
* - `env()` (`../env.ts`) reads `process.env`. Folding it would bake one
|
|
63
|
+
* run's environment into a statically-derived value. It is exactly the
|
|
64
|
+
* kind of call fold must keep rejecting.
|
|
65
|
+
* - `Op()` (`../op/builders.ts`) constructs an `OpResource` — a `Declarable`.
|
|
66
|
+
* `fold()` already rejects a nested `new Type(...)` used as a value for a
|
|
67
|
+
* real, differential-caught reason (the envelope leaks into
|
|
68
|
+
* serialization); a factory that returns one is the same hazard wearing a
|
|
69
|
+
* call.
|
|
70
|
+
* - `propagate()`, `withDefaults()`, `resource()`, `mergeDefaults()`
|
|
71
|
+
* (`../composite.ts`) are composite *definition* helpers, not value-position
|
|
72
|
+
* helpers. `propagate()` in particular mutates its argument in place, and
|
|
73
|
+
* the composite spine in fold-import.ts already resolves it live.
|
|
74
|
+
* - `createResource()`/`createProperty()` (`../runtime.ts`) are used at a
|
|
75
|
+
* lexicon module's top level to build classes, never as a value inside a
|
|
76
|
+
* project file.
|
|
77
|
+
* - Lexicon intrinsics in CALL form (`Ref(...)`, `Join(...)`) are lexicon
|
|
78
|
+
* surface, not chant's own, and are #1044's registry (`IntrinsicDef`,
|
|
79
|
+
* `../lexicon.ts`) to admit — not this one. Only their tagged-template
|
|
80
|
+
* form folds today.
|
|
81
|
+
*/
|
|
82
|
+
/**
|
|
83
|
+
* One registered helper. `module` and `note` carry no runtime behavior — they
|
|
84
|
+
* are the audit trail for why this entry passed the admission criteria above,
|
|
85
|
+
* kept next to the name it justifies rather than in a comment that can drift
|
|
86
|
+
* away from the list.
|
|
87
|
+
*/
|
|
88
|
+
export interface FoldableHelperDef {
|
|
89
|
+
/** The exported name, matched against the callee identifier's text. */
|
|
90
|
+
readonly name: string;
|
|
91
|
+
/** Where chant defines it (a path under `packages/core/src`, for the audit trail). */
|
|
92
|
+
readonly module: string;
|
|
93
|
+
/** Why it qualifies — what it returns and why calling it at fold time is safe. */
|
|
94
|
+
readonly note: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The allowlist. Adding an entry is a deliberate act: it must satisfy every
|
|
98
|
+
* admission criterion in this module's doc, and it widens what `fold()` and
|
|
99
|
+
* `findSubsetViolation` accept for EVERY project, so it belongs in a PR that
|
|
100
|
+
* says so.
|
|
101
|
+
*
|
|
102
|
+
* Two names below are defined TWICE in chant, by different modules, with
|
|
103
|
+
* different return types (`phase`/`gate` by both the component contract and
|
|
104
|
+
* the Op builders; `stackOutput` by both the component contract and the
|
|
105
|
+
* cross-stack output primitive). That is fine and needs no disambiguation
|
|
106
|
+
* here: registration is by name, but the function actually invoked is the one
|
|
107
|
+
* the folding file itself imported (see step 2 in the module doc), so each
|
|
108
|
+
* file gets its own. Both definitions of each name independently satisfy the
|
|
109
|
+
* criteria, which is what makes registering the shared name safe.
|
|
110
|
+
*/
|
|
111
|
+
export declare const FOLDABLE_AUTHORING_HELPERS: readonly FoldableHelperDef[];
|
|
112
|
+
/**
|
|
113
|
+
* True when `name` is a registered foldable authoring helper. Name-only — this
|
|
114
|
+
* is the shape-level half of the check (step 1 in the module doc). It says
|
|
115
|
+
* nothing about where the name is bound; `../discovery/fold-import.ts` decides
|
|
116
|
+
* that before anything is invoked.
|
|
117
|
+
*/
|
|
118
|
+
export declare function isFoldableHelperName(name: string): boolean;
|
|
119
|
+
/** True for a bare specifier that names a chant-published package (or one of its subpaths). */
|
|
120
|
+
export declare function isChantOwnedSpecifier(specifier: string): boolean;
|
|
121
|
+
//# sourceMappingURL=foldable-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foldable-helpers.d.ts","sourceRoot":"","sources":["../../src/fold/foldable-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,iBAAiB,EA0BlE,CAAC;AAIF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAeD,+FAA+F;AAC/F,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAIhE"}
|