@intentius/chant 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/build-params.d.ts +108 -0
  2. package/dist/build-params.d.ts.map +1 -0
  3. package/dist/build.d.ts +79 -1
  4. package/dist/build.d.ts.map +1 -1
  5. package/dist/cli/commands/build.d.ts +31 -0
  6. package/dist/cli/commands/build.d.ts.map +1 -1
  7. package/dist/cli/commands/check-lexicon-examples.d.ts +41 -0
  8. package/dist/cli/commands/check-lexicon-examples.d.ts.map +1 -0
  9. package/dist/cli/commands/check-lexicon-intrinsics.d.ts +54 -0
  10. package/dist/cli/commands/check-lexicon-intrinsics.d.ts.map +1 -0
  11. package/dist/cli/commands/check-lexicon.d.ts +1 -1
  12. package/dist/cli/commands/check-lexicon.d.ts.map +1 -1
  13. package/dist/cli/commands/lint.d.ts +27 -0
  14. package/dist/cli/commands/lint.d.ts.map +1 -1
  15. package/dist/cli/handlers/build.d.ts.map +1 -1
  16. package/dist/cli/handlers/components.d.ts.map +1 -1
  17. package/dist/cli/handlers/lint.d.ts.map +1 -1
  18. package/dist/cli/handlers/run-client.d.ts +1 -1
  19. package/dist/cli/handlers/run-client.d.ts.map +1 -1
  20. package/dist/cli/handlers/run.d.ts.map +1 -1
  21. package/dist/cli/main.d.ts.map +1 -1
  22. package/dist/cli/plugins.d.ts +16 -0
  23. package/dist/cli/plugins.d.ts.map +1 -1
  24. package/dist/cli/registry.d.ts +10 -0
  25. package/dist/cli/registry.d.ts.map +1 -1
  26. package/dist/codegen/docs-sections.d.ts.map +1 -1
  27. package/dist/components/cli-support.d.ts +12 -5
  28. package/dist/components/cli-support.d.ts.map +1 -1
  29. package/dist/components/discover.d.ts +62 -7
  30. package/dist/components/discover.d.ts.map +1 -1
  31. package/dist/components/sandbox/driver.d.ts +12 -0
  32. package/dist/components/sandbox/driver.d.ts.map +1 -0
  33. package/dist/components/sandbox/run.d.ts +42 -0
  34. package/dist/components/sandbox/run.d.ts.map +1 -0
  35. package/dist/composite.d.ts +5 -0
  36. package/dist/composite.d.ts.map +1 -1
  37. package/dist/config.d.ts +71 -0
  38. package/dist/config.d.ts.map +1 -1
  39. package/dist/discovery/collect.d.ts.map +1 -1
  40. package/dist/discovery/entity-wire-codec.d.ts +166 -0
  41. package/dist/discovery/entity-wire-codec.d.ts.map +1 -0
  42. package/dist/discovery/entity-wire.d.ts +50 -0
  43. package/dist/discovery/entity-wire.d.ts.map +1 -0
  44. package/dist/discovery/fold-import.d.ts +210 -0
  45. package/dist/discovery/fold-import.d.ts.map +1 -0
  46. package/dist/discovery/index.d.ts +74 -1
  47. package/dist/discovery/index.d.ts.map +1 -1
  48. package/dist/discovery/sandbox/bundle.d.ts +18 -0
  49. package/dist/discovery/sandbox/bundle.d.ts.map +1 -0
  50. package/dist/discovery/sandbox/child-errors.d.ts +15 -0
  51. package/dist/discovery/sandbox/child-errors.d.ts.map +1 -0
  52. package/dist/discovery/sandbox/driver.d.ts +13 -0
  53. package/dist/discovery/sandbox/driver.d.ts.map +1 -0
  54. package/dist/discovery/sandbox/run.d.ts +69 -0
  55. package/dist/discovery/sandbox/run.d.ts.map +1 -0
  56. package/dist/errors.d.ts +9 -1
  57. package/dist/errors.d.ts.map +1 -1
  58. package/dist/fold/fold.d.ts +226 -0
  59. package/dist/fold/fold.d.ts.map +1 -0
  60. package/dist/fold/subset.d.ts +102 -0
  61. package/dist/fold/subset.d.ts.map +1 -0
  62. package/dist/index.d.ts +2 -0
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/lexicon-output.d.ts +7 -2
  65. package/dist/lexicon-output.d.ts.map +1 -1
  66. package/dist/lexicon-schema.d.ts +2 -2
  67. package/dist/lexicon-schema.d.ts.map +1 -1
  68. package/dist/lexicon.d.ts +81 -1
  69. package/dist/lexicon.d.ts.map +1 -1
  70. package/dist/lifecycle/release-ledger.d.ts +11 -0
  71. package/dist/lifecycle/release-ledger.d.ts.map +1 -1
  72. package/dist/lint/component-checks.d.ts +7 -1
  73. package/dist/lint/component-checks.d.ts.map +1 -1
  74. package/dist/lint/rules/evl001-non-literal-expression.d.ts.map +1 -1
  75. package/dist/lint/rules/evl003-dynamic-property-access.d.ts.map +1 -1
  76. package/dist/params.d.ts +60 -0
  77. package/dist/params.d.ts.map +1 -0
  78. package/dist/provenance.d.ts +21 -0
  79. package/dist/provenance.d.ts.map +1 -1
  80. package/dist/terraform/aws-resources.d.ts.map +1 -1
  81. package/package.json +2 -1
  82. package/src/build-params.test.ts +144 -0
  83. package/src/build-params.ts +207 -0
  84. package/src/build.test.ts +38 -0
  85. package/src/build.ts +144 -7
  86. package/src/cli/commands/build.test.ts +220 -2
  87. package/src/cli/commands/build.ts +111 -3
  88. package/src/cli/commands/check-lexicon-examples.test.ts +92 -0
  89. package/src/cli/commands/check-lexicon-examples.ts +103 -0
  90. package/src/cli/commands/check-lexicon-intrinsics.test.ts +145 -0
  91. package/src/cli/commands/check-lexicon-intrinsics.ts +312 -0
  92. package/src/cli/commands/check-lexicon.test.ts +34 -0
  93. package/src/cli/commands/check-lexicon.ts +119 -1
  94. package/src/cli/commands/lint.ts +31 -3
  95. package/src/cli/commands/onboard.ts +1 -1
  96. package/src/cli/component-security-boundary.test.ts +170 -0
  97. package/src/cli/handlers/build.ts +24 -3
  98. package/src/cli/handlers/components.ts +9 -2
  99. package/src/cli/handlers/dev.ts +1 -1
  100. package/src/cli/handlers/graph.ts +7 -5
  101. package/src/cli/handlers/lifecycle.ts +2 -2
  102. package/src/cli/handlers/lint.ts +2 -0
  103. package/src/cli/handlers/misc.ts +2 -2
  104. package/src/cli/handlers/run-client.ts +1 -1
  105. package/src/cli/handlers/run.ts +20 -5
  106. package/src/cli/main.test.ts +22 -0
  107. package/src/cli/main.ts +39 -0
  108. package/src/cli/plugins.ts +20 -4
  109. package/src/cli/registry.ts +10 -0
  110. package/src/cli/security-boundary.test.ts +135 -0
  111. package/src/codegen/docs-sections.test.ts +61 -0
  112. package/src/codegen/docs-sections.ts +7 -3
  113. package/src/components/cli-support.ts +22 -10
  114. package/src/components/discover.ts +127 -25
  115. package/src/components/sandbox/driver.ts +114 -0
  116. package/src/components/sandbox/run.test.ts +185 -0
  117. package/src/components/sandbox/run.ts +177 -0
  118. package/src/composite.test.ts +21 -0
  119. package/src/composite.ts +20 -1
  120. package/src/config.ts +81 -0
  121. package/src/discovery/collect.ts +17 -3
  122. package/src/discovery/entity-wire-codec.ts +485 -0
  123. package/src/discovery/entity-wire.test.ts +240 -0
  124. package/src/discovery/entity-wire.ts +67 -0
  125. package/src/discovery/fold-import.test.ts +1026 -0
  126. package/src/discovery/fold-import.ts +1805 -0
  127. package/src/discovery/index.test.ts +191 -1
  128. package/src/discovery/index.ts +233 -1
  129. package/src/discovery/sandbox/bundle.ts +218 -0
  130. package/src/discovery/sandbox/child-errors.ts +65 -0
  131. package/src/discovery/sandbox/driver.ts +147 -0
  132. package/src/discovery/sandbox/run.test.ts +179 -0
  133. package/src/discovery/sandbox/run.ts +196 -0
  134. package/src/errors.ts +9 -1
  135. package/src/fold/fold.test.ts +535 -0
  136. package/src/fold/fold.ts +648 -0
  137. package/src/fold/subset-doc-parity.test.ts +183 -0
  138. package/src/fold/subset.test.ts +241 -0
  139. package/src/fold/subset.ts +302 -0
  140. package/src/index.ts +2 -0
  141. package/src/lexicon-output.ts +7 -2
  142. package/src/lexicon-schema.test.ts +14 -0
  143. package/src/lexicon-schema.ts +3 -1
  144. package/src/lexicon.ts +82 -1
  145. package/src/lifecycle/git.test.ts +10 -5
  146. package/src/lifecycle/release-ledger.test.ts +28 -0
  147. package/src/lifecycle/release-ledger.ts +11 -0
  148. package/src/lint/component-checks.ts +8 -1
  149. package/src/lint/rules/evl001-non-literal-expression.ts +26 -110
  150. package/src/lint/rules/evl003-dynamic-property-access.ts +11 -2
  151. package/src/params.test.ts +22 -0
  152. package/src/params.ts +66 -0
  153. package/src/provenance.ts +22 -0
  154. package/src/terraform/adopt-state.test.ts +1 -1
  155. package/src/terraform/aws-resources.test.ts +11 -4
  156. package/src/terraform/aws-resources.ts +60 -0
@@ -42,7 +42,7 @@ export interface ListComponentsResult {
42
42
  errors: string[];
43
43
  }
44
44
  /** Discover components under `path` and shape them for `chant list --components`. */
45
- export declare function listComponents(path: string): Promise<ListComponentsResult>;
45
+ export declare function listComponents(path: string, sandbox?: boolean): Promise<ListComponentsResult>;
46
46
  /** One component's full JSON contract projection, for `chant describe <name> --components`. */
47
47
  export interface DescribedComponent {
48
48
  name: string;
@@ -57,7 +57,7 @@ export interface DescribeComponentResult {
57
57
  output: string;
58
58
  }
59
59
  /** Find and project one named component, for `chant describe <name> --components`. */
60
- export declare function describeComponent(path: string, name: string): Promise<DescribeComponentResult>;
60
+ export declare function describeComponent(path: string, name: string, sandbox?: boolean): Promise<DescribeComponentResult>;
61
61
  /** Dependency order/waves for `chant graph --components`, from every discovered component's `dependsOn`. */
62
62
  export interface ComponentGraphResult {
63
63
  success: boolean;
@@ -74,7 +74,7 @@ export interface ComponentGraphResult {
74
74
  error?: string;
75
75
  }
76
76
  /** Compute the components' dependency graph under `path`, for `chant graph --components`. */
77
- export declare function computeComponentGraph(path: string): Promise<ComponentGraphResult>;
77
+ export declare function computeComponentGraph(path: string, sandbox?: boolean): Promise<ComponentGraphResult>;
78
78
  /** A generate-mode target lexicon name — any lexicon whose plugin implements `generateComponentPipeline` (gitlab, github, and forgejo today). */
79
79
  export type GenerateLexicon = string;
80
80
  /** Result of `chant build --components --generate <lexicon>`. */
@@ -103,7 +103,7 @@ export interface GenerateComponentsResult {
103
103
  * the target lexicon's `generateComponentPipeline` (#688); core owns only the
104
104
  * generic discovery + graph.
105
105
  */
106
- export declare function generateComponentsPipeline(path: string, lexicon: GenerateLexicon, options?: ComponentPipelineOptions): Promise<GenerateComponentsResult>;
106
+ export declare function generateComponentsPipeline(path: string, lexicon: GenerateLexicon, options?: ComponentPipelineOptions, sandbox?: boolean): Promise<GenerateComponentsResult>;
107
107
  /**
108
108
  * Find the first `gate` step anywhere in a component's `deploy`/`rollback`
109
109
  * composition (including nested fan-out phases), mirroring
@@ -119,6 +119,13 @@ export declare function findComponentGate(component: DriverComponent): {
119
119
  export interface RunComponentsOptions {
120
120
  /** Target environment name, threaded into every capability's `DeployContext.env` (default: "local"). */
121
121
  env?: string;
122
+ /**
123
+ * chant #1051 — opt-in: discover `*.component.ts` files in a sandboxed
124
+ * child process (`chant run --components <name|all> --sandbox`) instead of
125
+ * in the CLI's own process. See `discoverComponents`'s `sandbox` option
126
+ * (../discover.ts).
127
+ */
128
+ sandbox?: boolean;
122
129
  /** Additional capability plugin package names to load on top of the built-in starter set (see `buildCapabilityRegistry`). */
123
130
  capabilityPlugins?: string[];
124
131
  /**
@@ -216,6 +223,6 @@ export interface ResolvedComponentTargets {
216
223
  * without also inheriting the local executor's pre-flight gate rejection
217
224
  * (gates are exactly what the durable path exists to support).
218
225
  */
219
- export declare function resolveComponentTargets(path: string, selector: string): Promise<ResolvedComponentTargets>;
226
+ export declare function resolveComponentTargets(path: string, selector: string, sandbox?: boolean): Promise<ResolvedComponentTargets>;
220
227
  export declare function runComponents(path: string, selector: string, options?: RunComponentsOptions): Promise<RunComponentsResult>;
221
228
  //# sourceMappingURL=cli-support.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-support.d.ts","sourceRoot":"","sources":["../../src/components/cli-support.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAQL,KAAK,eAAe,EAEpB,KAAK,eAAe,EACrB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAuC,KAAK,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAChG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAmB,K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AAO,GAChB,OAAO,CAAC,wBAAwB,CAAC,CAsBnC;AAED,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,mBAAmB,CAAC,CAuG9B"}
@@ -27,6 +27,17 @@
27
27
  * components the same way it can for `*.op.ts` files, and so discovery does
28
28
  * not have to import (and risk side-effecting) every `.ts` file in the
29
29
  * project looking for stray `Component`-shaped objects.
30
+ *
31
+ * chant #1051 — `discoverComponents` unconditionally `await import()`s every
32
+ * discovered file in the CLI's own process, the same exposure #1045 Phase 2
33
+ * closed for lexicon-resource discovery (`../discovery/index.ts`'s
34
+ * `discover({ sandbox: true })`). `{ sandbox: true }` here runs that import
35
+ * (and the duplicate-name collection below) together, isolated, in one
36
+ * sandboxed child process instead — see `./sandbox/driver.ts`/`./sandbox/
37
+ * run.ts`. Materially simpler than the entity path: a `Component` is plain
38
+ * JSON (no `AttrRef` cross-references), so the child can hand back its result
39
+ * with a bare `JSON.stringify` — no entity-wire codec needed (`projectToJson`,
40
+ * `./component.ts`, already proves the plain-JSON round-trip).
30
41
  */
31
42
  import { DiscoveryError } from "../errors.js";
32
43
  import { type Component } from "./component.js";
@@ -44,17 +55,61 @@ export interface ComponentDiscoveryResult {
44
55
  sourceFiles: string[];
45
56
  errors: DiscoveryError[];
46
57
  }
58
+ /** Options for {@link discoverComponents}. */
59
+ export interface ComponentDiscoveryOptions {
60
+ /**
61
+ * chant #1051 — opt-in: import every discovered `*.component.ts` file
62
+ * together, isolated, in one sandboxed child process (`./sandbox/run.ts`)
63
+ * instead of in this (the CLI's own) process. Mirrors `discover({ sandbox:
64
+ * true })` (`../discovery/index.ts`, chant #1045 Phase 2) for the parallel
65
+ * `*.component.ts` convention. Default `false` — behavior, including
66
+ * performance (no bundling, no child process, no IPC), is unchanged unless
67
+ * requested.
68
+ */
69
+ sandbox?: boolean;
70
+ }
71
+ /** One already-imported `*.component.ts` module — the input to {@link collectComponents}. */
72
+ export interface ImportedComponentModule {
73
+ file: string;
74
+ exports: Record<string, unknown>;
75
+ }
76
+ /**
77
+ * Collect every `Component`-shaped export from already-imported `modules`,
78
+ * enforcing the duplicate-`component.name` rule (across files, or within one
79
+ * file): a discovery error, matching `collectEntities`'s duplicate-export
80
+ * handling and `discoverOps`'s duplicate-Op-name handling — except the
81
+ * identity compared is the schema-level `name` field, since two different
82
+ * export bindings could otherwise declare the same component name and
83
+ * silently collide at deploy time. `existing.component !== value` — object
84
+ * identity, not deep equality — is what lets the SAME component re-exported
85
+ * under several bindings pass through without tripping the duplicate check.
86
+ *
87
+ * Split out from {@link discoverComponents} (#1051) precisely because that
88
+ * identity check has to run on the LIVE, still-in-memory export values —
89
+ * identity does not survive a process boundary. That means this function
90
+ * must run wherever `modules` were actually imported: in this process for
91
+ * the default (unsandboxed) path below, or inside the sandboxed child for
92
+ * `{ sandbox: true }` (`./sandbox/driver.ts`, which bundles and calls this
93
+ * same function), mirroring how `collectEntities` runs inside `../discovery/
94
+ * sandbox/driver.ts` for the lexicon-resource run-fallback set (chant #1045
95
+ * Phase 2).
96
+ */
97
+ export declare function collectComponents(modules: readonly ImportedComponentModule[]): {
98
+ components: Map<string, DiscoveredComponent>;
99
+ errors: DiscoveryError[];
100
+ };
47
101
  /**
48
102
  * Discover every `Component` declared under `path`: scan for `*.component.ts`
49
103
  * files, import each, and collect every export whose value satisfies
50
104
  * `isComponent` (any export name — not just `default` — so a file may
51
105
  * declare several related components, matching how a resource file can
52
- * export several `Declarable`s). Duplicate `component.name` across files (or
53
- * within one file) is a discovery error, matching `collectEntities`'s
54
- * duplicate-export handling and `discoverOps`'s duplicate-Op-name handling —
55
- * except the identity compared is the schema-level `name` field, since two
56
- * different export bindings could otherwise declare the same component name
57
- * and silently collide at deploy time.
106
+ * export several `Declarable`s). See {@link collectComponents} for the
107
+ * duplicate-name rule.
108
+ *
109
+ * `{ sandbox: true }` (#1051) imports every file together, isolated, in one
110
+ * sandboxed child process instead (`./sandbox/run.ts`) the same isolation
111
+ * `discover({ sandbox: true })` (`../discovery/index.ts`) gives lexicon
112
+ * resources, chant #1045 Phase 2.
58
113
  */
59
- export declare function discoverComponents(path: string): Promise<ComponentDiscoveryResult>;
114
+ export declare function discoverComponents(path: string, options?: ComponentDiscoveryOptions): Promise<ComponentDiscoveryResult>;
60
115
  //# sourceMappingURL=discover.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/components/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAMH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE1D,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,SAAS,CAAC;IACrB,0HAA0H;IAC1H,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC,0GAA0G;IAC1G,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC7C,oDAAoD;IACpD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B;AAuDD;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA+CxF"}
1
+ {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/components/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAMH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE1D,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,SAAS,CAAC;IACrB,0HAA0H;IAC1H,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC,0GAA0G;IAC1G,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC7C,oDAAoD;IACpD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B;AAED,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,6FAA6F;AAC7F,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAuDD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,uBAAuB,EAAE,GAAG;IAC9E,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC7C,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B,CAkCA;AA6BD;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,wBAAwB,CAAC,CA2BnC"}
@@ -0,0 +1,12 @@
1
+ export interface GenerateComponentDriverOptions {
2
+ /** Absolute paths to every discovered `*.component.ts` file for this build. */
3
+ files: readonly string[];
4
+ }
5
+ /**
6
+ * Generate the component driver module's full TypeScript source. Written to
7
+ * a tmp file and bundled (`../../discovery/sandbox/bundle.ts`'s `bundleDriver`
8
+ * — generic, reused as-is) before being handed to a sandboxed child — never
9
+ * executed directly by the parent process.
10
+ */
11
+ export declare function generateComponentDriverSource(options: GenerateComponentDriverOptions): string;
12
+ //# sourceMappingURL=driver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../../src/components/sandbox/driver.ts"],"names":[],"mappings":"AAgCA,MAAM,WAAW,8BAA8B;IAC7C,+EAA+E;IAC/E,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAOD;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,8BAA8B,GAAG,MAAM,CAiE7F"}
@@ -0,0 +1,42 @@
1
+ import { DiscoveryError } from "../../errors.js";
2
+ import type { DiscoveredComponent } from "../discover.js";
3
+ /**
4
+ * chant #1051 — imports every discovered `*.component.ts` file for a build
5
+ * TOGETHER, as one bundled module graph, inside one sandboxed child process,
6
+ * and returns the same shape `discoverComponents`'s own in-process import
7
+ * loop would have produced: named components plus any errors.
8
+ *
9
+ * Isolation mechanics are identical to `../../discovery/sandbox/run.ts`'s
10
+ * `runFallbackFilesSandboxed` (chant #1045 Phase 2 — see that module's doc
11
+ * for the full write-up, verified on Node v24.13.1): `--permission
12
+ * --allow-fs-read=<bundle dir>,<project dir>[,<trusted external package
13
+ * dirs>]`, a spawn-time-scrubbed `env`, and a bounded wait before the child
14
+ * is treated as hung. `bundleDriver` (`../../discovery/sandbox/bundle.ts`) is
15
+ * reused as-is — it is generic over what the driver does, so the same
16
+ * esbuild bundling (and the same `typescript`-stays-external carve-out) that
17
+ * serves the entity path serves this one too.
18
+ */
19
+ export interface ComponentSandboxRunResult {
20
+ /** Discovered components from this sandboxed import, keyed by `component.name` — functionally indistinguishable from what `discoverComponents`'s in-process path would have produced for this same file set. */
21
+ components: Map<string, DiscoveredComponent>;
22
+ /** Import/collection/permission errors, already chant-shaped (`../../discovery/sandbox/child-errors.ts` — a permission denial names the file and the operation, never a raw `ERR_ACCESS_DENIED`). */
23
+ errors: DiscoveryError[];
24
+ /** esbuild bundling wall-clock time. */
25
+ bundleMs: number;
26
+ /** Bundle size in bytes. */
27
+ bundleBytes: number;
28
+ }
29
+ /**
30
+ * Import `files` (every discovered `*.component.ts` file) together, isolated,
31
+ * in one sandboxed child process, and collect their `Component`-shaped
32
+ * exports — including the duplicate-name check, which runs INSIDE the child
33
+ * over live objects before anything is serialized (`../discover.ts`'s
34
+ * `collectComponents`, bundled into the driver).
35
+ *
36
+ * @param files - Absolute paths to every discovered `*.component.ts` file.
37
+ * @param buildRoot - The directory `discoverComponents` was pointed at — used
38
+ * to compute the project-directory read allowance, mirroring `../../
39
+ * discovery/sandbox/run.ts`.
40
+ */
41
+ export declare function discoverComponentsSandboxed(files: readonly string[], buildRoot: string): Promise<ComponentSandboxRunResult>;
42
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/components/sandbox/run.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAA2B,MAAM,cAAc,CAAC;AAEvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,yBAAyB;IACxC,gNAAgN;IAChN,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC7C,qMAAqM;IACrM,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;CACrB;AAsBD;;;;;;;;;;;GAWG;AACH,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,yBAAyB,CAAC,CA0CpC"}
@@ -77,6 +77,11 @@ export declare function withDefaults<P, M extends CompositeMembers, D extends Pa
77
77
  * Symbol key for shared props attached by propagate().
78
78
  */
79
79
  export declare const SHARED_PROPS: unique symbol;
80
+ /**
81
+ * Symbol key stashing a member's original (pre-merge) props, so expandComposite()
82
+ * is idempotent across repeated expansions of the same singleton instance (#1032).
83
+ */
84
+ export declare const ORIGINAL_PROPS: unique symbol;
80
85
  /**
81
86
  * Attaches shared properties to a composite instance.
82
87
  * During expandComposite(), shared props are merged into every member's props.
@@ -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;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB;IAC9E,QAAQ,CAAC,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAEpB,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;CACnD;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,EAAE,CAAC,SAAS,gBAAgB,GAAG,gBAAgB;IACnF,CAAC,KAAK,EAAE,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAO9E;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,WAAW,CAAmD;IAE7E,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC,OAAO,CAAC,GAAG,IAAI;IAI/D,MAAM,CAAC,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AAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7D,IAAI,EAAE,CAAC,EACP,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GACrB,CAAC,CAqBH"}
package/dist/config.d.ts CHANGED
@@ -4,6 +4,7 @@ import type { OwnershipMarker } from "./ownership.js";
4
4
  import { type SbomFormat } from "./components/verbs/sbom-generator.js";
5
5
  import type { Severity } from "./components/verbs/vuln-scan.js";
6
6
  import type { VulnPolicy } from "./components/verbs/vuln-gate.js";
7
+ import type { BuildParamsConfig } from "./build-params.js";
7
8
  /**
8
9
  * Zod schema for ChantConfig validation.
9
10
  */
@@ -18,6 +19,21 @@ export declare const ChantConfigSchema: z.ZodObject<{
18
19
  env: z.ZodOptional<z.ZodString>;
19
20
  enabled: z.ZodOptional<z.ZodBoolean>;
20
21
  }, z.core.$strip>>;
22
+ build: z.ZodOptional<z.ZodObject<{
23
+ fold: z.ZodOptional<z.ZodBoolean>;
24
+ }, z.core.$strip>>;
25
+ buildParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
26
+ type: z.ZodEnum<{
27
+ string: "string";
28
+ number: "number";
29
+ boolean: "boolean";
30
+ }>;
31
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
32
+ enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
33
+ env: z.ZodOptional<z.ZodString>;
34
+ required: z.ZodOptional<z.ZodBoolean>;
35
+ description: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strip>>>;
21
37
  release: z.ZodOptional<z.ZodObject<{
22
38
  autoRecord: z.ZodOptional<z.ZodBoolean>;
23
39
  }, z.core.$strip>>;
@@ -126,6 +142,42 @@ export interface ChantConfig {
126
142
  /** Set false to disable stamping even when `stack` is present. */
127
143
  enabled?: boolean;
128
144
  };
145
+ /**
146
+ * `chant build` behavior toggles (#1022, epic #1019).
147
+ */
148
+ build?: {
149
+ /**
150
+ * Opt-in: fold source modules statically instead of importing/running
151
+ * them, falling back to run per-file for anything the folder can't
152
+ * represent (composite factory calls, non-`new` exports, …). Default
153
+ * `false`. The `--fold` CLI flag overrides this per-invocation (a flag
154
+ * of `true` always wins; the flag cannot force fold *off* when this is
155
+ * `true`). See {@link resolveFoldEnabled}.
156
+ */
157
+ fold?: boolean;
158
+ /**
159
+ * chant #1045 Phase 2 — opt-in: run-fallback source files (or, when
160
+ * `fold` above isn't set, every file) execute together, isolated, in one
161
+ * sandboxed child process instead of in-process. Default `false`. The
162
+ * `--sandbox` CLI flag overrides this per-invocation (a flag of `true`
163
+ * always wins; the flag cannot force sandboxing *off* when this is
164
+ * `true`). See {@link resolveSandboxEnabled}.
165
+ */
166
+ sandbox?: boolean;
167
+ };
168
+ /**
169
+ * Build-time parameters (#1064) — values supplied to `chant build` (a
170
+ * `--param name=value` flag, a `--params-file` JSON file, or a declared
171
+ * `env` var mapping) and bound to `params.<name>` (`@intentius/chant/params`)
172
+ * for source to reference, instead of reading `process.env` at module
173
+ * scope. Distinct from the deploy-time `Parameter` class
174
+ * (`lexicons/aws/src/parameter.ts`, a CloudFormation `Parameters:` entry
175
+ * that resolves at stack deploy) — a build-time parameter resolves before
176
+ * the template is even synthesized, so it can change which resources are
177
+ * produced at all (e.g. a tier selecting `light` vs `production`). See
178
+ * {@link resolveBuildParams} in `./build-params.ts`.
179
+ */
180
+ buildParams?: BuildParamsConfig;
129
181
  /**
130
182
  * Release-ledger recording behavior (#597, epic #551). Auto-emitting a
131
183
  * release record on a successful `chant run --components <name> --env
@@ -241,6 +293,25 @@ export declare function resolveOwnershipMarker(config: ChantConfig): OwnershipMa
241
293
  * flag always wins for that one invocation, regardless of config.
242
294
  */
243
295
  export declare function resolveAutoReleaseDisabled(config: ChantConfig, cliFlag?: boolean): boolean;
296
+ /**
297
+ * Whether `chant build` should use the fold path (#1022, epic #1019)
298
+ * instead of running each source module. Opt-in: off unless the CLI's
299
+ * `--fold` flag was passed (`cliFlag`) or the project config sets
300
+ * `build.fold: true` — the flag always wins for that one invocation,
301
+ * regardless of config.
302
+ */
303
+ export declare function resolveFoldEnabled(config: ChantConfig, cliFlag?: boolean): boolean;
304
+ /**
305
+ * Whether `chant build` should run its run-fallback files (or, without
306
+ * `--fold`, every file) in an isolated sandboxed child process rather than
307
+ * in-process (chant #1045 Phase 2). Opt-in: off unless the CLI's `--sandbox`
308
+ * flag was passed (`cliFlag`) or the project config sets `build.sandbox:
309
+ * true` — the flag always wins for that one invocation, regardless of
310
+ * config. Independent of {@link resolveFoldEnabled}: sandboxing without
311
+ * folding isolates every discovered file; sandboxing with folding isolates
312
+ * only the per-file run-fallback remainder.
313
+ */
314
+ export declare function resolveSandboxEnabled(config: ChantConfig, cliFlag?: boolean): boolean;
244
315
  /**
245
316
  * Resolve which SBOM format a `generate-sbom` step should request (#606),
246
317
  * given the project's `chant.config.ts` `sbom.format` and an optional
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACzF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCd,CAAC;AAEjB;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAA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AC,CAiEzB"}
1
+ {"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/discovery/collect.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAgH9D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;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"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * chant #1045 (Phase 1) — the JSON wire format for a discovered, named,
3
+ * ref-resolved entity set. Split out of `./entity-wire.ts` in Phase 2 so this
4
+ * codec (`encodeEntitySet`/`decodeEntitySet`, no dependency on `discover()`
5
+ * or anything that pulls in the `typescript` compiler package) can be
6
+ * bundled ALONE into the sandboxed child's driver (`./sandbox/driver.ts`)
7
+ * without dragging in `discover()`'s whole fold/import graph — `entity-
8
+ * wire.ts` re-exports everything here unchanged, so nothing outside this
9
+ * pair of files needs to know about the split.
10
+ *
11
+ * `discover()` (./index.ts) produces a `Map<string, Declarable>` whose cross-
12
+ * entity references are live object identity: an `AttrRef.parent` is a
13
+ * `WeakRef<object>`, and a resource can embed ANOTHER resource directly as a
14
+ * prop value (e.g. `DependsOn: [otherResource]`) — the lexicon serializers
15
+ * detect this by looking the embedded object up (by identity) in a
16
+ * `Map<Declarable, string>` built from the very same entities map
17
+ * (`serializer-walker.ts`'s `resourceRef` dispatch; see also
18
+ * `resource-attributes.ts`'s `resolveDependsOn`). Neither a `WeakRef` nor bare
19
+ * object identity survives a process boundary.
20
+ *
21
+ * {@link encodeEntitySet} converts that live map into plain, JSON-safe data:
22
+ * every identity-based reference (an `AttrRef`, or a whole entity embedded by
23
+ * value) becomes a name-keyed marker instead. {@link decodeEntitySet} is the
24
+ * inverse — it rebuilds a live `Map<string, Declarable>` whose entities are
25
+ * BEHAVIORALLY indistinguishable from what `discover()` would have produced
26
+ * in-process: real `AttrRef` instances (several call sites downstream key off
27
+ * `instanceof AttrRef`, not just duck typing — `intrinsic-interpolation.ts`'s
28
+ * `defaultInterpolationSerializer`, `discovery/graph.ts`'s
29
+ * `buildDependencyGraph`, `build.ts`'s `detectCrossLexiconRefs`/
30
+ * `computeStackGraph` — so a plain `{__attrRef}` envelope alone is not
31
+ * enough), and whole-entity embeds restored to the SAME object reference
32
+ * (not a structurally-equal clone), so `entityNames.get(decl)` keeps working
33
+ * by identity exactly as it does today.
34
+ *
35
+ * `serializer-walker.ts`'s `walkValue` needs NO changes for this: it already
36
+ * falls back to reading a plain `{__attrRef}` envelope (added for intrinsics
37
+ * whose own `toJSON()` embeds one). `decodeEntitySet` goes further and
38
+ * reconstructs the real class so every OTHER `instanceof AttrRef` call site
39
+ * keeps working too, not just the walker.
40
+ *
41
+ * Naming happens exactly once, inside the boundary — `resolveAttrRefs`
42
+ * (./resolve.ts) runs as part of `discover()`, before `encodeEntitySet` is
43
+ * ever called (in-process), or inside the sandboxed child, over just the
44
+ * run-fallback subset (chant #1045 Phase 2, `./sandbox/run.ts`). This module
45
+ * does not re-derive names; it only carries already-resolved ones across.
46
+ *
47
+ * Scope (see the chant#1045 PR description for the full list): resource and
48
+ * property `Declarable`s, `StackOutput` (itself a marked `Declarable`), and
49
+ * `LexiconOutput` (not a `Declarable` — it is carried as its own wire form)
50
+ * all round-trip. A `ChildProjectInstance` (`nestedStack()`) does not — its
51
+ * `outputs` field is a lazy `Proxy`, not data — and {@link encodeEntitySet}
52
+ * throws rather than silently mis-encoding it. No corpus entry under
53
+ * `examples/` or any lexicon's `examples/` directory uses `nestedStack()`
54
+ * today.
55
+ */
56
+ import { type Declarable } from "../declarable.js";
57
+ /**
58
+ * A JSON-safe value tree: primitives, arrays/objects, and four marker shapes
59
+ * that stand in for what can't cross a process boundary by identity:
60
+ *
61
+ * - `__attrRef` — an `AttrRef` (attribute reference), keyed by the parent
62
+ * entity's already-resolved logical name.
63
+ * - `__entityRef` — a WHOLE entity embedded by value (e.g. `DependsOn:
64
+ * [otherResource]`), keyed by that entity's logical name.
65
+ * - `__property` — a nested, unnamed property-kind `Declarable` (not tracked
66
+ * in the entities map, so it carries its own `lexicon`/`entityType`/`props`
67
+ * inline rather than by reference).
68
+ * - `__intrinsic` — a lexicon intrinsic (`Sub`, `Join`, `Ref`, a pseudo-
69
+ * parameter, gitlab's `!reference`, github's `${{ }}` `Expression`, …).
70
+ * `value` is its already-called `toJSON()` output (Phase 0 confirmed every
71
+ * intrinsic in this codebase implements `toJSON` and holds no
72
+ * function/closure fields, so this is lossless). `yaml` is present only
73
+ * when the intrinsic ALSO implements the optional `toYAML()` method the
74
+ * gitlab and github serializers duck-type (`"toYAML" in value`) ahead of
75
+ * the generic `toJSON` dispatch, for a YAML-native form that differs from
76
+ * the JSON one (gitlab's `!reference [a, b]` tag vs. its plain `["a","b"]`
77
+ * JSON array) — capturing only `toJSON()` would silently lose that native
78
+ * form. `refs` additionally captures any `AttrRef`/whole-entity reference
79
+ * found while walking the intrinsic's OWN fields (not through `toJSON()`)
80
+ * — `buildDependencyGraph` and `detectCrossLexiconRefs`/`computeStackGraph`
81
+ * walk raw entity property trees looking for `instanceof AttrRef`/a
82
+ * tracked `Declarable`, not through `toJSON()`, so a ref nested inside e.g.
83
+ * a `Sub` template needs to still be discoverable post-decode for
84
+ * cross-lexicon output auto-detection and dependency ordering to keep
85
+ * working.
86
+ */
87
+ export type WireValue = null | string | number | boolean | WireValue[] | {
88
+ __attrRef: {
89
+ entity: string;
90
+ attribute: string;
91
+ };
92
+ } | {
93
+ __entityRef: {
94
+ entity: string;
95
+ };
96
+ } | {
97
+ __property: {
98
+ lexicon: string;
99
+ entityType: string;
100
+ props?: WireValue;
101
+ };
102
+ } | {
103
+ __intrinsic: {
104
+ value: WireValue;
105
+ yaml?: WireValue;
106
+ refs: WireValue[];
107
+ };
108
+ } | {
109
+ [key: string]: WireValue;
110
+ };
111
+ /** Wire form of one named, top-level `Declarable` entity (resource, property, or marked-Declarable output like `StackOutput`). */
112
+ export interface WireDeclarableEntity {
113
+ form: "declarable";
114
+ name: string;
115
+ lexicon: string;
116
+ entityType: string;
117
+ kind?: "resource" | "property" | "output";
118
+ props?: WireValue;
119
+ attributes?: WireValue;
120
+ /**
121
+ * `.description` of every truthy own marker symbol on the entity (e.g.
122
+ * `"chant.declarable"`, `"chant.stackOutput"`, a lexicon-specific one like
123
+ * `"chant.aws.defaultTags"`). Every marker symbol in this codebase is
124
+ * created with `Symbol.for(...)`, so `Symbol.for(description)` on decode
125
+ * reliably recovers the SAME symbol a `X_MARKER in value` check looks for —
126
+ * core doesn't need to know what any lexicon-specific marker means.
127
+ */
128
+ markers: string[];
129
+ /**
130
+ * Every other own enumerable field, beyond the fixed `lexicon`/`entityType`/
131
+ * `kind`/`props`/`attributes` shape — covers both a resource's per-attribute
132
+ * `AttrRef` fields (`vpcId`, `arn`, …) and plain-data fields on marker-
133
+ * Declarables that aren't built via `createResource`/`createProperty`
134
+ * (`StackOutput.sourceRef`/`description`, `DefaultTags.tags`,
135
+ * `Parameter.parameterType`/`description`/`defaultValue`, …).
136
+ */
137
+ extra?: Record<string, WireValue>;
138
+ }
139
+ /** Wire form of one named `LexiconOutput` entity — not a `Declarable`, so it's carried as its own shape rather than forced into {@link WireDeclarableEntity}. */
140
+ export interface WireLexiconOutputEntity {
141
+ form: "lexiconOutput";
142
+ name: string;
143
+ outputName: string;
144
+ /** The wrapped `AttrRef` or `Intrinsic` — encodes to `{__attrRef}` or `{__intrinsic}` respectively (see {@link WireValue}). */
145
+ ref: WireValue;
146
+ }
147
+ export type WireEntity = WireDeclarableEntity | WireLexiconOutputEntity;
148
+ /** A discovered, named, ref-resolved entity set, as pure JSON. */
149
+ export interface EntitySetWire {
150
+ entities: WireEntity[];
151
+ }
152
+ /**
153
+ * Encode a discovered, named, ref-resolved entities map into pure JSON.
154
+ *
155
+ * @throws if any entity is a `ChildProjectInstance` (`nestedStack()`) — its
156
+ * `outputs` field is a lazy `Proxy`, not representable as data. No corpus
157
+ * entry uses it today (chant#1045 Phase 1).
158
+ */
159
+ export declare function encodeEntitySet(entities: Map<string, Declarable>): EntitySetWire;
160
+ /**
161
+ * Decode a JSON entity set (see {@link encodeEntitySet}) back into a live
162
+ * `Map<string, Declarable>`, functionally indistinguishable from what
163
+ * `discover()` would have produced in-process.
164
+ */
165
+ export declare function decodeEntitySet(wire: EntitySetWire): Map<string, Declarable>;
166
+ //# sourceMappingURL=entity-wire-codec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-wire-codec.d.ts","sourceRoot":"","sources":["../../src/discovery/entity-wire-codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAOnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,SAAS,GACjB,IAAI,GACJ,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,EAAE,GACX;IAAE,SAAS,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACpD;IAAE,WAAW,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACnC;IAAE,UAAU,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,SAAS,CAAA;KAAE,CAAA;CAAE,GAC1E;IAAE,WAAW,EAAE;QAAE,KAAK,EAAE,SAAS,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAC;QAAC,IAAI,EAAE,SAAS,EAAE,CAAA;KAAE,CAAA;CAAE,GAC1E;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEjC,kIAAkI;AAClI,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;;;;;OAOG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACnC;AAED,iKAAiK;AACjK,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,+HAA+H;IAC/H,GAAG,EAAE,SAAS,CAAC;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,oBAAoB,GAAG,uBAAuB,CAAC;AAExE,kEAAkE;AAClE,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAiKD;;;;;;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"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * chant #1045 (Phase 1) — the JSON wire format for a discovered, named,
3
+ * ref-resolved entity set, plus (below) the standalone `discover()` +
4
+ * encode entry point.
5
+ *
6
+ * The codec itself — {@link WireValue}, {@link EntitySetWire},
7
+ * {@link encodeEntitySet}, {@link decodeEntitySet}, and friends — lives in
8
+ * `./entity-wire-codec.ts` (chant #1045 Phase 2 split this out) and is
9
+ * re-exported here unchanged. That file has NO dependency on `discover()` (or
10
+ * anything that pulls in the `typescript` compiler package), which matters
11
+ * because chant #1045 Phase 2's sandboxed child bundles JUST the codec —
12
+ * bundling this file, `discoverEntitySetJson` and all, would drag `discover`
13
+ * → `fold-import` → `typescript` (a multi-megabyte CJS package that doesn't
14
+ * survive ESM bundling on its own) into a driver that only ever needs to
15
+ * encode, never to discover. See `./sandbox/driver.ts`.
16
+ */
17
+ export type { WireValue, WireDeclarableEntity, WireLexiconOutputEntity, WireEntity, EntitySetWire, } from "./entity-wire-codec.js";
18
+ export { encodeEntitySet, decodeEntitySet } from "./entity-wire-codec.js";
19
+ import type { FoldDecision } from "./index.js";
20
+ import { type DiscoveryOptions } from "./index.js";
21
+ import { type EntitySetWire } from "./entity-wire-codec.js";
22
+ /** A discovery run's full result as pure JSON — {@link encodeEntitySet} plus the already-JSON-safe rest of {@link DiscoveryResult} (`./index.ts`). */
23
+ export interface DiscoveredEntitiesJson {
24
+ entitySet: EntitySetWire;
25
+ sourceFiles: string[];
26
+ /** `DiscoveryError.toJSON()` output — see `../errors.ts`. */
27
+ errors: Array<{
28
+ name: string;
29
+ file: string;
30
+ message: string;
31
+ type: string;
32
+ }>;
33
+ foldDecisions: FoldDecision[];
34
+ }
35
+ /**
36
+ * Run discovery over `path` — scanning files, importing/folding modules,
37
+ * naming entities, and resolving `AttrRef`s (all unchanged, reusing
38
+ * `discover()` as-is) — and return the result as pure JSON via
39
+ * {@link encodeEntitySet}. This is the boundary chant#1045 Phase 2 moved into
40
+ * a sandboxed child process for the run-fallback subset — see
41
+ * `./sandbox/run.ts` — Phase 1 only proved the data can cross it losslessly
42
+ * (see the fold-vs-JSON differential in `examples/`).
43
+ *
44
+ * Reuses `discover()` unchanged, so the fold/run-fallback split and the
45
+ * `planFoldTaint` identity-taint invariant (`./fold-import.ts`) are exactly
46
+ * what they are today — this function only serializes whatever `discover()`
47
+ * already decided to produce.
48
+ */
49
+ export declare function discoverEntitySetJson(path: string, options?: DiscoveryOptions): Promise<DiscoveredEntitiesJson>;
50
+ //# sourceMappingURL=entity-wire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-wire.d.ts","sourceRoot":"","sources":["../../src/discovery/entity-wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,YAAY,EACV,SAAS,EACT,oBAAoB,EACpB,uBAAuB,EACvB,UAAU,EACV,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAY,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAO1E,sJAAsJ;AACtJ,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,aAAa,CAAC;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,6DAA6D;IAC7D,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7E,aAAa,EAAE,YAAY,EAAE,CAAC;CAC/B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAQrH"}