@intentius/chant 0.24.0 → 0.25.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.map +1 -1
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/config-import.d.ts +33 -0
- package/dist/config-import.d.ts.map +1 -0
- package/dist/config-sandbox.d.ts +47 -0
- package/dist/config-sandbox.d.ts.map +1 -0
- package/dist/config.d.ts +11 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/discovery/entity-wire-codec.d.ts +1 -1
- package/dist/discovery/entity-wire-codec.d.ts.map +1 -1
- package/dist/discovery/sandbox/config-run.d.ts +24 -0
- package/dist/discovery/sandbox/config-run.d.ts.map +1 -0
- package/dist/discovery/sandbox/config-wire.d.ts +68 -0
- package/dist/discovery/sandbox/config-wire.d.ts.map +1 -0
- package/dist/discovery/sandbox/driver.d.ts +20 -0
- package/dist/discovery/sandbox/driver.d.ts.map +1 -1
- package/dist/discovery/sandbox/fork.d.ts +52 -0
- package/dist/discovery/sandbox/fork.d.ts.map +1 -0
- package/dist/discovery/sandbox/run.d.ts +10 -20
- package/dist/discovery/sandbox/run.d.ts.map +1 -1
- package/dist/lexicon-output.d.ts +62 -6
- package/dist/lexicon-output.d.ts.map +1 -1
- package/dist/lint/config.d.ts +6 -0
- package/dist/lint/config.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/build.test.ts +19 -0
- package/src/build.ts +21 -10
- package/src/cli/commands/build.ts +13 -0
- package/src/cli/main.ts +10 -0
- package/src/config-import.ts +43 -0
- package/src/config-sandbox.ts +138 -0
- package/src/config.ts +14 -5
- package/src/discovery/entity-wire-codec.ts +21 -12
- package/src/discovery/entity-wire.test.ts +26 -0
- package/src/discovery/sandbox/config-boundary.test.ts +239 -0
- package/src/discovery/sandbox/config-run.ts +130 -0
- package/src/discovery/sandbox/config-wire.test.ts +110 -0
- package/src/discovery/sandbox/config-wire.ts +174 -0
- package/src/discovery/sandbox/driver.ts +68 -0
- package/src/discovery/sandbox/fork.ts +110 -0
- package/src/discovery/sandbox/run.ts +28 -85
- package/src/lexicon-output.test.ts +137 -1
- package/src/lexicon-output.ts +112 -13
- package/src/lint/config.ts +8 -4
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,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,UAAU,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,cAAc,EAAiC,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,aAAa,EAAmB,MAAM,kBAAkB,CAAC;AAGlE,OAAO,EAAkC,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAmB,KAAK,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAKvF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,CACb,MAAM,EACN;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CACtD,CAAC;IACF,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,wEAAwE;IACxE,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,gDAAgD;IAChD,KAAK,EAAE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Z"}
|
package/dist/cli/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAMA,OAAO,EAAmC,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAMA,OAAO,EAAmC,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAuB9E;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CA+NpD;AAmaD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB5E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single place chant evaluates a project's `chant.config.ts` **in the CLI's
|
|
3
|
+
* own process**.
|
|
4
|
+
*
|
|
5
|
+
* This is the config-side analogue of `./discovery/import.ts`'s `importModule`
|
|
6
|
+
* — one narrow module whose only job is "execute project-authored code here",
|
|
7
|
+
* so that the question "did any project code run in this process?" has one
|
|
8
|
+
* place to look and one place to instrument (see
|
|
9
|
+
* `examples/sandbox-execution-boundary.test.ts`, which spies on both).
|
|
10
|
+
*
|
|
11
|
+
* Callers must not `import()` a config file directly. `./config-sandbox.ts`
|
|
12
|
+
* decides whether a given load is allowed to come through here at all: under
|
|
13
|
+
* `chant build --sandbox` it routes the evaluation into the sandboxed child
|
|
14
|
+
* instead (chant #1113), and these functions are never reached.
|
|
15
|
+
*
|
|
16
|
+
* `chant.config.json` is pure data and is parsed, not executed — it never goes
|
|
17
|
+
* through this module.
|
|
18
|
+
*/
|
|
19
|
+
/** The shape a config module evaluates to, before `default`/`config`/namespace selection. */
|
|
20
|
+
export type ConfigModuleNamespace = Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Import a `chant.config.ts` into THIS process and return its module namespace.
|
|
23
|
+
* Node's ESM registry caches it, so repeated loads within one CLI invocation
|
|
24
|
+
* evaluate the file once — the behavior `loadChantConfig` has always had.
|
|
25
|
+
*/
|
|
26
|
+
export declare function importConfigModule(configPath: string): Promise<ConfigModuleNamespace>;
|
|
27
|
+
/**
|
|
28
|
+
* `require()` a `chant.config.ts` into THIS process from `dir`'s resolution
|
|
29
|
+
* context — the synchronous path `./lint/config.ts`'s `loadConfig` has used
|
|
30
|
+
* since before the async loader existed (`chant lint` is a sync pipeline).
|
|
31
|
+
*/
|
|
32
|
+
export declare function requireConfigModule(configPath: string, dir: string): ConfigModuleNamespace;
|
|
33
|
+
//# sourceMappingURL=config-import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-import.d.ts","sourceRoot":"","sources":["../src/config-import.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AAEH,6FAA6F;AAC7F,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5D;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAE3F;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAG1F"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type ConfigModuleNamespace } from "./config-import.js";
|
|
2
|
+
/**
|
|
3
|
+
* Arm sandboxed config evaluation for the rest of this process. Called from
|
|
4
|
+
* `../cli/main.ts` immediately after `parseArgs`, when `--sandbox` was passed
|
|
5
|
+
* — before the first config load. Idempotent; there is deliberately no
|
|
6
|
+
* disarm, because a security mode that can be turned off partway through a
|
|
7
|
+
* process is not one.
|
|
8
|
+
*/
|
|
9
|
+
export declare function armSandboxConfigEvaluation(): void;
|
|
10
|
+
/** Whether {@link armSandboxConfigEvaluation} has been called. */
|
|
11
|
+
export declare function isSandboxConfigEvaluationArmed(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Test-only reset. Vitest gives each test file its own module registry, so
|
|
14
|
+
* this exists for suites that arm and disarm within one file.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resetSandboxConfigEvaluationForTests(): void;
|
|
17
|
+
/**
|
|
18
|
+
* The export a config module's configuration lives on: an explicit `default`,
|
|
19
|
+
* a named `config`, else the module namespace itself (a config authored as a
|
|
20
|
+
* set of top-level named exports). Applied identically on both sides of the
|
|
21
|
+
* boundary — in the child by `./discovery/sandbox/driver.ts`'s config driver,
|
|
22
|
+
* here for the in-process path — so `--sandbox` changes only where the file is
|
|
23
|
+
* evaluated, never how its result is read.
|
|
24
|
+
*/
|
|
25
|
+
export declare function selectConfigExport(namespace: ConfigModuleNamespace): unknown;
|
|
26
|
+
/**
|
|
27
|
+
* Evaluate a project's `chant.config.ts` and return its configuration object,
|
|
28
|
+
* pre-`normalizeConfig`. Sandboxed when armed, in-process otherwise.
|
|
29
|
+
*
|
|
30
|
+
* @param configPath - Absolute path to the config file.
|
|
31
|
+
* @param projectRoot - Directory to grant the sandboxed child read access to;
|
|
32
|
+
* defaults to the config file's own directory.
|
|
33
|
+
*/
|
|
34
|
+
export declare function evaluateProjectConfig(configPath: string, projectRoot?: string): Promise<unknown>;
|
|
35
|
+
/**
|
|
36
|
+
* Synchronous counterpart for `./lint/config.ts`'s `loadConfig` (`chant lint`
|
|
37
|
+
* is a sync pipeline and predates the async loader).
|
|
38
|
+
*
|
|
39
|
+
* When armed, this cannot spawn a child — so it uses the result of an earlier
|
|
40
|
+
* armed load of the same file, and refuses if there isn't one. In practice
|
|
41
|
+
* there always is: `../cli/main.ts` loads the project config before dispatching
|
|
42
|
+
* to any command. Refusing rather than falling back to an in-process `require`
|
|
43
|
+
* is the point — a sync call site is exactly where a boundary would otherwise
|
|
44
|
+
* be lost by accident.
|
|
45
|
+
*/
|
|
46
|
+
export declare function evaluateProjectConfigSync(configPath: string, dir: string): unknown;
|
|
47
|
+
//# sourceMappingURL=config-sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-sandbox.d.ts","sourceRoot":"","sources":["../src/config-sandbox.ts"],"names":[],"mappings":"AACA,OAAO,EAA2C,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAmDtG;;;;;;GAMG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAED,kEAAkE;AAClE,wBAAgB,8BAA8B,IAAI,OAAO,CAExD;AAED;;;GAGG;AACH,wBAAgB,oCAAoC,IAAI,IAAI,CAG3D;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,qBAAqB,GAAG,OAAO,CAE5E;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,MAAM,EAClB,WAAW,GAAE,MAA4B,GACxC,OAAO,CAAC,OAAO,CAAC,CAclB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAUlF"}
|
package/dist/config.d.ts
CHANGED
|
@@ -276,8 +276,17 @@ export declare const DEFAULT_CHANT_CONFIG: ChantConfig;
|
|
|
276
276
|
/**
|
|
277
277
|
* Load project configuration from a directory.
|
|
278
278
|
*
|
|
279
|
-
* Tries `chant.config.ts` first
|
|
280
|
-
*
|
|
279
|
+
* Tries `chant.config.ts` first, then `chant.config.json`. Returns default
|
|
280
|
+
* config if neither exists.
|
|
281
|
+
*
|
|
282
|
+
* chant #1113 — `chant.config.ts` is project-authored code, so *where* it is
|
|
283
|
+
* evaluated is a security question, and the answer is
|
|
284
|
+
* `./config-sandbox.ts`'s: in a sandboxed child when this process was armed by
|
|
285
|
+
* `chant build --sandbox`, in-process (exactly as before) otherwise. Either
|
|
286
|
+
* way the result is the same plain configuration object, and validation
|
|
287
|
+
* ({@link normalizeConfig}) happens here, in the trusted process.
|
|
288
|
+
* `chant.config.json` is data, not code — it is parsed in-process under
|
|
289
|
+
* `--sandbox` too, because there is nothing to execute.
|
|
281
290
|
*/
|
|
282
291
|
export declare function loadChantConfig(dir: string): Promise<ResolvedConfig>;
|
|
283
292
|
/**
|
package/dist/config.d.ts.map
CHANGED
|
@@ -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;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
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;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIxD;;GAEG;AACH,eAAO,MA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W1E"}
|
|
@@ -141,7 +141,7 @@ export interface WireLexiconOutputEntity {
|
|
|
141
141
|
form: "lexiconOutput";
|
|
142
142
|
name: string;
|
|
143
143
|
outputName: string;
|
|
144
|
-
/** The wrapped `AttrRef` or
|
|
144
|
+
/** The wrapped `AttrRef`, `Intrinsic`, or literal — encodes to `{__attrRef}`, `{__intrinsic}`, or a plain JSON primitive respectively (chant #1121; see {@link WireValue}). */
|
|
145
145
|
ref: WireValue;
|
|
146
146
|
}
|
|
147
147
|
export type WireEntity = WireDeclarableEntity | WireLexiconOutputEntity;
|
|
@@ -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,EAA2C,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAOzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,G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CAAC,CA0C5E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface SandboxConfigResult {
|
|
2
|
+
/** The evaluated configuration, as plain JSON. Interpreted (default/config/namespace selection already applied in the child; Zod validation still to come) by `../../config.ts`'s `normalizeConfig`, in the parent, unchanged. */
|
|
3
|
+
config: unknown;
|
|
4
|
+
/** esbuild bundling wall-clock time. */
|
|
5
|
+
bundleMs: number;
|
|
6
|
+
/** Bundle size in bytes. */
|
|
7
|
+
bundleBytes: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Evaluate `configPath` in a sandboxed child and return its configuration as
|
|
11
|
+
* plain data.
|
|
12
|
+
*
|
|
13
|
+
* Throws — rather than degrading to an in-process import or to defaults — when
|
|
14
|
+
* the config cannot be evaluated inside the boundary or cannot cross it as
|
|
15
|
+
* JSON. Under `--sandbox` a config that "almost" loaded is not a safe thing to
|
|
16
|
+
* proceed with, and quietly falling back would give away the property the flag
|
|
17
|
+
* exists to provide.
|
|
18
|
+
*
|
|
19
|
+
* @param configPath - Absolute path to the project's `chant.config.ts`.
|
|
20
|
+
* @param projectRoot - Directory the child is granted `--allow-fs-read` for
|
|
21
|
+
* (the config's own project root, i.e. `findProjectConfig`'s `dir`).
|
|
22
|
+
*/
|
|
23
|
+
export declare function evaluateConfigSandboxed(configPath: string, projectRoot: string): Promise<SandboxConfigResult>;
|
|
24
|
+
//# sourceMappingURL=config-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-run.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/config-run.ts"],"names":[],"mappings":"AA0DA,MAAM,WAAW,mBAAmB;IAClC,kOAAkO;IAClO,MAAM,EAAE,OAAO,CAAC;IAChB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,mBAAmB,CAAC,CA6C9B"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chant #1113 — what a `chant.config.ts` may contain if it is to be evaluated
|
|
3
|
+
* inside the sandbox boundary and handed back to the CLI as data.
|
|
4
|
+
*
|
|
5
|
+
* Under `--sandbox` the config file is evaluated in a child process (see
|
|
6
|
+
* `./config-run.ts`), so the only thing that can come back is what survives a
|
|
7
|
+
* process boundary: JSON. Node's IPC channel serializes with `JSON.stringify`
|
|
8
|
+
* by default, and `JSON.stringify` is *lossy without complaining* — a function
|
|
9
|
+
* property vanishes, a `Date` becomes a string, a `Map` becomes `{}`, `NaN`
|
|
10
|
+
* becomes `null`. Silently handing the CLI a config that differs from the one
|
|
11
|
+
* the project wrote is the worst available outcome for a security feature, so
|
|
12
|
+
* this module walks the value FIRST and reports every offending key path.
|
|
13
|
+
* `./config-run.ts` turns a non-empty report into a build error that names the
|
|
14
|
+
* keys; nothing is ever dropped quietly.
|
|
15
|
+
*
|
|
16
|
+
* This module is bundled INTO the generated config driver (`./driver.ts`'s
|
|
17
|
+
* `generateConfigDriverSource`) and runs inside the sandboxed child, next to
|
|
18
|
+
* the project code it is inspecting — so it must not import anything, and must
|
|
19
|
+
* not touch the filesystem, the environment or the process.
|
|
20
|
+
*
|
|
21
|
+
* ## What `ChantConfig` legally holds
|
|
22
|
+
*
|
|
23
|
+
* Every field of `ChantConfig` (`../../config.ts`) is JSON data: string arrays
|
|
24
|
+
* (`lexicons`, `capabilities`, `environments`), strings (`sourceDir`), nested
|
|
25
|
+
* plain objects of strings/booleans (`ownership`, `build`, `release`, `sbom`,
|
|
26
|
+
* `signing`, `vulnPolicy`), arrays of plain objects (`stacks`), and records of
|
|
27
|
+
* plain objects (`buildParams`). `lint` is a `LintConfig`, whose rule values
|
|
28
|
+
* are a severity string or a `[severity, options]` tuple, and whose `plugins`
|
|
29
|
+
* / `policies` are file *paths* — chant loads those modules itself, they are
|
|
30
|
+
* not functions embedded in the config. So the declared type admits nothing
|
|
31
|
+
* that fails the check below.
|
|
32
|
+
*
|
|
33
|
+
* The one way to get there is `ChantConfigSchema`'s `.passthrough()`, which
|
|
34
|
+
* accepts unknown extra keys of any type (that is how a lexicon extends the
|
|
35
|
+
* config — `temporal:` in the temporal lexicon's `TemporalChantConfig`, itself
|
|
36
|
+
* pure data). A project that parks a function under such a key gets a clear
|
|
37
|
+
* error naming it, rather than a config that silently lost it.
|
|
38
|
+
*
|
|
39
|
+
* ## The one accepted lossy case: `undefined` object properties
|
|
40
|
+
*
|
|
41
|
+
* `{ sourceDir: undefined }` and `{}` are indistinguishable to every reader of
|
|
42
|
+
* `ChantConfig` — each field is optional and every resolver tests
|
|
43
|
+
* `config.x === undefined` / `?.` — so an `undefined`-valued property is
|
|
44
|
+
* dropped rather than rejected, exactly as omitting the key would be. An
|
|
45
|
+
* `undefined` inside an ARRAY is a different story (`JSON.stringify` rewrites
|
|
46
|
+
* it to `null`, changing the element), and is reported.
|
|
47
|
+
*/
|
|
48
|
+
/** One value in the config that cannot cross the sandbox boundary as data. */
|
|
49
|
+
export interface ConfigWireOffender {
|
|
50
|
+
/** Dotted/bracketed path from the config root, e.g. `lint.rules.foo` or `stacks[0].name`. */
|
|
51
|
+
path: string;
|
|
52
|
+
/** What was found there, phrased for an error message (e.g. `a function`, `a Date`). */
|
|
53
|
+
found: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Report every value in `config` that cannot cross the sandbox boundary as
|
|
57
|
+
* JSON. An empty array means a `JSON.parse(JSON.stringify(config))` round-trip
|
|
58
|
+
* preserves the configuration exactly (modulo `undefined` object properties,
|
|
59
|
+
* which are dropped — see the module doc).
|
|
60
|
+
*
|
|
61
|
+
* `config` itself may be a module namespace object (`await import(...)` with
|
|
62
|
+
* no `default` export), which is not a plain object; its own enumerable keys
|
|
63
|
+
* are walked the same way rather than being reported wholesale.
|
|
64
|
+
*/
|
|
65
|
+
export declare function scanConfigWireSafety(config: unknown): ConfigWireOffender[];
|
|
66
|
+
/** Render a {@link ConfigWireOffender} list as the body of a build error — one line per offending key, most specific information first. */
|
|
67
|
+
export declare function formatConfigWireOffenders(configPath: string, offenders: readonly ConfigWireOffender[]): string;
|
|
68
|
+
//# sourceMappingURL=config-wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-wire.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/config-wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IACjC,6FAA6F;IAC7F,IAAI,EAAE,MAAM,CAAC;IACb,wFAAwF;IACxF,KAAK,EAAE,MAAM,CAAC;CACf;AAiFD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,kBAAkB,EAAE,CAe1E;AAED,2IAA2I;AAC3I,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,SAAS,kBAAkB,EAAE,GACvC,MAAM,CAOR"}
|
|
@@ -10,4 +10,24 @@ export interface GenerateDriverOptions {
|
|
|
10
10
|
* never executed directly by the parent process.
|
|
11
11
|
*/
|
|
12
12
|
export declare function generateDriverSource(options: GenerateDriverOptions): string;
|
|
13
|
+
/**
|
|
14
|
+
* chant #1113 — generate the driver module that evaluates a project's
|
|
15
|
+
* `chant.config.ts` INSIDE the sandboxed child and hands back plain JSON.
|
|
16
|
+
*
|
|
17
|
+
* Same machinery as {@link generateDriverSource} above, deliberately: one
|
|
18
|
+
* literal-specifier dynamic `import()` esbuild can trace and inline, one IPC
|
|
19
|
+
* message back, `./child-errors.ts` for classification so a permission denial
|
|
20
|
+
* names the config file rather than leaking `ERR_ACCESS_DENIED`. The only
|
|
21
|
+
* difference is what crosses — a config is data, not an entity graph, so there
|
|
22
|
+
* is no naming/`AttrRef` step and no `EntitySetWire`; the child instead runs
|
|
23
|
+
* `./config-wire.ts`'s serializability scan and refuses to hand back a config
|
|
24
|
+
* that `JSON.stringify` would silently mangle.
|
|
25
|
+
*
|
|
26
|
+
* The child returns the raw module namespace's chosen export as-is — the
|
|
27
|
+
* `default ?? config ?? namespace` selection and Zod validation
|
|
28
|
+
* (`normalizeConfig`) stay in the parent, where they were, so `--sandbox`
|
|
29
|
+
* changes where the file is *evaluated* and nothing about how its result is
|
|
30
|
+
* interpreted.
|
|
31
|
+
*/
|
|
32
|
+
export declare function generateConfigDriverSource(configPath: string): string;
|
|
13
33
|
//# sourceMappingURL=driver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/driver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/driver.ts"],"names":[],"mappings":"AA8CA,MAAM,WAAW,qBAAqB;IACpC,qIAAqI;IACrI,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,oNAAoN;IACpN,SAAS,EAAE,MAAM,CAAC;CACnB;AAOD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAqF3E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CA6CrE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place chant starts a sandboxed child process.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from `./run.ts` by chant #1113, which added a SECOND thing that
|
|
5
|
+
* has to run behind the same boundary (`chant.config.ts` evaluation, see
|
|
6
|
+
* `./config-run.ts`). Both callers must get the identical `--permission`
|
|
7
|
+
* profile and the identical environment scrub — if the two drifted, the
|
|
8
|
+
* weaker one would silently become the boundary. Keeping the spawn itself in
|
|
9
|
+
* one function is the cheapest way to make "same profile" a fact rather than
|
|
10
|
+
* a claim.
|
|
11
|
+
*
|
|
12
|
+
* Isolation mechanics (verified on Node v24.13.1 — see the chant#1045 PR
|
|
13
|
+
* description for the full write-up):
|
|
14
|
+
* - `--permission --allow-fs-read=<bundle dir>,<project dir>[,<trusted
|
|
15
|
+
* external package dirs>]` — no filesystem write, no child-process, no
|
|
16
|
+
* worker-thread access. Bundling with esbuild first (`./bundle.ts`) means
|
|
17
|
+
* the child needs NO TypeScript loader (no `tsx`, so no `--allow-worker`
|
|
18
|
+
* and no writable temp dir either).
|
|
19
|
+
* - The env is a spawn-time scrub, not `--permission`: Node's Permission
|
|
20
|
+
* Model does not gate `process.env` at all (confirmed: every key stays
|
|
21
|
+
* readable even under `--permission`). See {@link SandboxForkOptions.env}.
|
|
22
|
+
* - Network egress is NOT addressed — Node has no flag for it. See
|
|
23
|
+
* `docs/.../architecture/sandbox.mdx` for the residual-risk statement.
|
|
24
|
+
*/
|
|
25
|
+
export interface SandboxForkOptions {
|
|
26
|
+
/** Absolute, realpath'd path to the bundled ESM entry file to run. */
|
|
27
|
+
bundlePath: string;
|
|
28
|
+
/** Absolute, realpath'd directory holding {@link bundlePath} — granted `--allow-fs-read`. */
|
|
29
|
+
bundleDir: string;
|
|
30
|
+
/** Absolute, realpath'd project directory — granted `--allow-fs-read`. */
|
|
31
|
+
projectRealpath: string;
|
|
32
|
+
/** Additional directories to grant `--allow-fs-read` (the resolved locations of `./bundle.ts`'s deliberately-unbundled trusted packages). */
|
|
33
|
+
externalReadPaths: readonly string[];
|
|
34
|
+
/**
|
|
35
|
+
* The child's ENTIRE environment. Callers pass an explicit, closed set —
|
|
36
|
+
* never a spread of `process.env`. `./run.ts` passes `PATH` only;
|
|
37
|
+
* `./config-run.ts` adds `CHANT_ENV` (see its doc for why that one
|
|
38
|
+
* variable, and only that one, is forwarded).
|
|
39
|
+
*/
|
|
40
|
+
env: Record<string, string>;
|
|
41
|
+
/** How long to wait for the child's one IPC message before killing it. */
|
|
42
|
+
timeoutMs: number;
|
|
43
|
+
/** What timed out / exited early, for the error message (e.g. `"sandboxed run"`). */
|
|
44
|
+
label: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Fork `bundlePath` under `--permission` with a scrubbed environment, and
|
|
48
|
+
* resolve with the first IPC message that satisfies `isResponse` (or reject
|
|
49
|
+
* on crash / timeout / fork error).
|
|
50
|
+
*/
|
|
51
|
+
export declare function forkSandboxed<T>(options: SandboxForkOptions, isResponse: (value: unknown) => value is T): Promise<T>;
|
|
52
|
+
//# sourceMappingURL=fork.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fork.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/fork.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,eAAe,EAAE,MAAM,CAAC;IACxB,6IAA6I;IAC7I,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,GACzC,OAAO,CAAC,CAAC,CAAC,CAoDZ"}
|
|
@@ -6,26 +6,16 @@ import { DiscoveryError } from "../../errors.js";
|
|
|
6
6
|
* the same shape `discover()`'s own in-process run path would have produced:
|
|
7
7
|
* a named, ref-resolved entities map plus any errors.
|
|
8
8
|
*
|
|
9
|
-
* Isolation mechanics
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* unbundled and resolves them to their real, fixed location instead —
|
|
20
|
-
* project source never controls what's installed there.
|
|
21
|
-
* - The env is a spawn-time scrub (`env: {}` below, plus `PATH` — see the
|
|
22
|
-
* option below), not `--permission`: Node's Permission Model does not gate
|
|
23
|
-
* `process.env` at all (confirmed: every key stays readable even under
|
|
24
|
-
* `--permission`).
|
|
25
|
-
* - Network egress is NOT addressed here — Node has no flag for it. See the
|
|
26
|
-
* chant#1045 PR description / docs for the residual-risk statement and
|
|
27
|
-
* deployment guidance (a container with no egress, a network namespace).
|
|
28
|
-
* This function does not claim to close that gap.
|
|
9
|
+
* Isolation mechanics live in `./fork.ts` — the one function that spawns a
|
|
10
|
+
* sandboxed child, shared with chant #1113's config evaluation
|
|
11
|
+
* (`./config-run.ts`) so the two cannot drift apart. In short:
|
|
12
|
+
* `--permission --allow-fs-read=<bundle dir>,<project dir>[,<trusted external
|
|
13
|
+
* package dirs>]`, a spawn-time environment scrub, no writes, no spawning, no
|
|
14
|
+
* worker threads, and no network guarantee. The "trusted external package
|
|
15
|
+
* dirs" allowance is narrow and specific: `./bundle.ts` deliberately leaves a
|
|
16
|
+
* couple of chant/lexicon-internal dependencies (`typescript`) unbundled and
|
|
17
|
+
* resolves them to their real, fixed location instead — project source never
|
|
18
|
+
* controls what's installed there.
|
|
29
19
|
*
|
|
30
20
|
* What does NOT run inside the child: fold (`tryFoldFile`, `../fold-import`)
|
|
31
21
|
* stays exactly where it is today, in the parent, unsandboxed — fold already
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/discovery/sandbox/run.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,cAAc,EAA2B,MAAM,cAAc,CAAC;AAOvE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,2TAA2T;IAC3T,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAClC,8LAA8L;IAC9L,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,kGAAkG;IAClG,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;;;OAQG;IACH,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAgBD;;;;;;;;;;;GAWG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,gBAAgB,CAAC,CAsD3B"}
|
package/dist/lexicon-output.d.ts
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
import { INTRINSIC_MARKER, type Intrinsic } from "./intrinsic.js";
|
|
2
2
|
import { AttrRef } from "./attrref.js";
|
|
3
|
+
/** A value `output()` accepts that is already fully resolved — not a
|
|
4
|
+
* reference to anything, just data the author computed (a literal, a prop,
|
|
5
|
+
* a template string). See chant #1121. */
|
|
6
|
+
export type LexiconOutputLiteral = string | number | boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Marker symbol for LexiconOutput identification (chant #1122).
|
|
9
|
+
*
|
|
10
|
+
* A GLOBAL symbol (via `Symbol.for`), like every other chant-core brand
|
|
11
|
+
* check — `DECLARABLE_MARKER`, `STACK_OUTPUT_MARKER`, `INTRINSIC_MARKER` —
|
|
12
|
+
* holds across separately-loaded copies of chant-core the way `instanceof`
|
|
13
|
+
* does not. Two copies in one process is a plain npm-dedupe outcome: a
|
|
14
|
+
* lexicon pinned to a chant range that does not overlap the project's own
|
|
15
|
+
* gets a nested `node_modules/@intentius/chant`, and a project file
|
|
16
|
+
* importing `output` from that lexicon then holds a different `LexiconOutput`
|
|
17
|
+
* class than the CLI does. `instanceof LexiconOutput` returns false for a
|
|
18
|
+
* real output built by the other copy, and every `Outputs` entry vanishes
|
|
19
|
+
* silently.
|
|
20
|
+
*
|
|
21
|
+
* Installed non-enumerably in the constructor (not as a public class field)
|
|
22
|
+
* so a shallow spread/clone of a real instance — which would already lack
|
|
23
|
+
* its prototype methods (`getOutputValue()`, `_setSourceEntity()`, …) — does
|
|
24
|
+
* not silently pick up the marker and pass this guard too.
|
|
25
|
+
*/
|
|
26
|
+
export declare const LEXICON_OUTPUT_MARKER: unique symbol;
|
|
3
27
|
/**
|
|
4
28
|
* Sanitize auto-generated Output name parts into a valid CloudFormation
|
|
5
29
|
* logical id. Real CloudFormation logical ids (including `Outputs` keys)
|
|
@@ -21,11 +45,17 @@ export declare function sanitizeLogicalId(...parts: string[]): string;
|
|
|
21
45
|
*
|
|
22
46
|
* Implements Intrinsic so it can be used as Value<string> anywhere.
|
|
23
47
|
*
|
|
24
|
-
* Accepts
|
|
25
|
-
*
|
|
48
|
+
* Accepts an AttrRef (resource attribute reference), any Intrinsic (e.g. Sub,
|
|
49
|
+
* Join) for computed output values like constructed URLs, or an already-
|
|
50
|
+
* resolved literal (string/number/boolean) — a constant the author's code
|
|
51
|
+
* computed rather than a reference to anything (chant #1121).
|
|
26
52
|
*/
|
|
27
53
|
export declare class LexiconOutput implements Intrinsic {
|
|
28
54
|
readonly [INTRINSIC_MARKER]: true;
|
|
55
|
+
/** @internal Brand marker — see {@link LEXICON_OUTPUT_MARKER}. Declared
|
|
56
|
+
* here only for type purposes; the real, non-enumerable property is
|
|
57
|
+
* installed by the constructor. */
|
|
58
|
+
readonly [LEXICON_OUTPUT_MARKER]: true;
|
|
29
59
|
readonly sourceLexicon: string;
|
|
30
60
|
readonly sourceEntity: string;
|
|
31
61
|
readonly sourceAttribute: string | null;
|
|
@@ -39,7 +69,17 @@ export declare class LexiconOutput implements Intrinsic {
|
|
|
39
69
|
* checking on every field it reads (#1047).
|
|
40
70
|
*/
|
|
41
71
|
readonly _intrinsic: Intrinsic | null;
|
|
42
|
-
|
|
72
|
+
/**
|
|
73
|
+
* @internal The already-resolved literal (string/number/boolean) when
|
|
74
|
+
* constructed from neither an AttrRef nor an Intrinsic — non-null exactly
|
|
75
|
+
* when `_intrinsic` is null AND `sourceAttribute` is null. There is no
|
|
76
|
+
* source entity or attribute to reference, so `getOutputValue()` returns
|
|
77
|
+
* this value verbatim rather than fabricating a `Fn::GetAtt` out of an
|
|
78
|
+
* unset attribute (chant #1121). Readable outside the class for the same
|
|
79
|
+
* reason as `_intrinsic`/`_sourceParent` above.
|
|
80
|
+
*/
|
|
81
|
+
readonly _literalValue: LexiconOutputLiteral | null;
|
|
82
|
+
constructor(ref: AttrRef | Intrinsic | LexiconOutputLiteral, name: string);
|
|
43
83
|
/**
|
|
44
84
|
* Set the source entity logical name.
|
|
45
85
|
* Called during build when entity names are resolved.
|
|
@@ -48,6 +88,7 @@ export declare class LexiconOutput implements Intrinsic {
|
|
|
48
88
|
_setSourceEntity(name: string): void;
|
|
49
89
|
/**
|
|
50
90
|
* Returns the CloudFormation Output Value for this output.
|
|
91
|
+
* For a literal output: the resolved value itself, verbatim.
|
|
51
92
|
* For AttrRef-based outputs: emits Fn::GetAtt.
|
|
52
93
|
* For Intrinsic-based outputs: delegates to the intrinsic's toJSON().
|
|
53
94
|
*/
|
|
@@ -71,7 +112,8 @@ export declare class LexiconOutput implements Intrinsic {
|
|
|
71
112
|
};
|
|
72
113
|
}
|
|
73
114
|
/**
|
|
74
|
-
* Create a LexiconOutput from an AttrRef
|
|
115
|
+
* Create a LexiconOutput from an AttrRef, an Intrinsic, or an already-
|
|
116
|
+
* resolved literal, and a user-provided output name.
|
|
75
117
|
*
|
|
76
118
|
* Usage with AttrRef:
|
|
77
119
|
* ```ts
|
|
@@ -82,10 +124,24 @@ export declare class LexiconOutput implements Intrinsic {
|
|
|
82
124
|
* ```ts
|
|
83
125
|
* const solrUrl = output(Sub`http://${Ref(albDnsName)}/solr`, "solrUrl");
|
|
84
126
|
* ```
|
|
127
|
+
*
|
|
128
|
+
* Usage with a literal (chant #1121) — a real value the caller already
|
|
129
|
+
* computed, not a reference:
|
|
130
|
+
* ```ts
|
|
131
|
+
* const apiVersion = output("v1", "ApiVersion");
|
|
132
|
+
* ```
|
|
85
133
|
*/
|
|
86
|
-
export declare function output(ref: AttrRef | Intrinsic |
|
|
134
|
+
export declare function output(ref: AttrRef | Intrinsic | LexiconOutputLiteral, name: string): LexiconOutput;
|
|
87
135
|
/**
|
|
88
|
-
* Type guard to check if a value is a LexiconOutput
|
|
136
|
+
* Type guard to check if a value is a LexiconOutput.
|
|
137
|
+
*
|
|
138
|
+
* Structural, not `instanceof` (chant #1122) — keys off {@link
|
|
139
|
+
* LEXICON_OUTPUT_MARKER}, a global symbol, so it holds across separately-
|
|
140
|
+
* loaded copies of chant-core the way `instanceof` does not. Every caller
|
|
141
|
+
* (`collect.ts`, `build.ts`, `graph-ir.ts`, `entity-wire-codec.ts`) reads
|
|
142
|
+
* only own-prototype members off the result (`outputName`, `_sourceParent`,
|
|
143
|
+
* `_setSourceEntity()`, `getOutputValue()`), all of which work identically
|
|
144
|
+
* on a cross-copy instance.
|
|
89
145
|
*/
|
|
90
146
|
export declare function isLexiconOutput(value: unknown): value is LexiconOutput;
|
|
91
147
|
//# sourceMappingURL=lexicon-output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-output.d.ts","sourceRoot":"","sources":["../src/lexicon-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"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OAAO;IAUzB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,aAAa;IAO5D,MAAM,IAAI;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE;CAGtC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,GAAG,oBAAoB,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAEnG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAOtE"}
|
package/dist/lint/config.d.ts
CHANGED
|
@@ -83,6 +83,12 @@ export declare const DEFAULT_CONFIG: LintConfig;
|
|
|
83
83
|
* then falls back to `chant.config.json` (legacy LintConfig format).
|
|
84
84
|
* Returns default configuration if neither exists.
|
|
85
85
|
*
|
|
86
|
+
* chant #1113 — the `chant.config.ts` branch executes project-authored code,
|
|
87
|
+
* so it goes through `../config-sandbox.ts` like every other config load
|
|
88
|
+
* rather than `require`-ing the file itself. Unarmed (which is every `chant
|
|
89
|
+
* lint` invocation today — `lint` has no `--sandbox` flag) that is the
|
|
90
|
+
* identical `createRequire` path this used before, moved one module over.
|
|
91
|
+
*
|
|
86
92
|
* @param dir - Directory path to search for config file
|
|
87
93
|
* @returns Loaded and merged configuration, or default config if not found
|
|
88
94
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lint/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lint/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AASnD,OAAO,EAAE,eAAe,EAAE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|
|
467
467
|
expect(collected[0].getOutputValue()).toEqual({ "Fn::Sub": "http://example.com/path" });
|
|
468
468
|
});
|
|
469
469
|
|
|
470
|
+
// chant #1121 — `output(<already-resolved value>, name)`, exactly the
|
|
471
|
+
// shape of a top-level `export const oParamName = output(data.Name,
|
|
472
|
+
// "oParamName")`, must reach the serializer as a plain `Value`, never a
|
|
473
|
+
// `Fn::GetAtt` pointing at the output's own logical id.
|
|
474
|
+
test("literal-valued output() emits its value verbatim, not a self-referencing Fn::GetAtt", () => {
|
|
475
|
+
const literalOutput = output("fold-output-repro", "oParamName");
|
|
476
|
+
|
|
477
|
+
const entities = new Map<string, Declarable>([
|
|
478
|
+
["oParamName", literalOutput as unknown as Declarable],
|
|
479
|
+
]);
|
|
480
|
+
|
|
481
|
+
const collected = collectLexiconOutputs(entities);
|
|
482
|
+
expect(collected).toHaveLength(1);
|
|
483
|
+
expect(collected[0].outputName).toBe("oParamName");
|
|
484
|
+
expect(collected[0].sourceEntity).toBe("");
|
|
485
|
+
expect(collected[0].sourceAttribute).toBeNull();
|
|
486
|
+
expect(collected[0].getOutputValue()).toBe("fold-output-repro");
|
|
487
|
+
});
|
|
488
|
+
|
|
470
489
|
test("deduplicates when same cross-lexicon ref appears in multiple entities", () => {
|
|
471
490
|
const alphaBucket = {
|
|
472
491
|
lexicon: "alpha",
|