@intentius/chant 0.71.1 → 0.72.1
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/discovery/fold-import.d.ts +28 -1
- package/dist/discovery/fold-import.d.ts.map +1 -1
- package/dist/fold/fold.d.ts +29 -0
- package/dist/fold/fold.d.ts.map +1 -1
- package/dist/fold/subset.d.ts +34 -1
- package/dist/fold/subset.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cli/commands/lint.test.ts +38 -4
- package/src/discovery/fold-host-composite.test.ts +115 -0
- package/src/discovery/fold-host-packages.test.ts +89 -0
- package/src/discovery/fold-import.ts +68 -60
- package/src/fold/fold.test.ts +99 -6
- package/src/fold/fold.ts +139 -0
- package/src/fold/subset.test.ts +161 -20
- package/src/fold/subset.ts +136 -1
- package/src/index.ts +1 -1
|
@@ -252,7 +252,20 @@ export declare function lexiconPackageName(lexiconName: string): string;
|
|
|
252
252
|
* fold may not import or invoke anything outside the trusted allowlist —
|
|
253
253
|
* see {@link FoldSession.sandbox}.
|
|
254
254
|
*/
|
|
255
|
-
export declare function createFoldSession(intrinsics?: readonly IntrinsicDef[], buildParams?: Readonly<Record<string, BuildParamValue>>, lexicons?: readonly string[], sandbox?: boolean
|
|
255
|
+
export declare function createFoldSession(intrinsics?: readonly IntrinsicDef[], buildParams?: Readonly<Record<string, BuildParamValue>>, lexicons?: readonly string[], sandbox?: boolean,
|
|
256
|
+
/**
|
|
257
|
+
* chant#2438 — package specifiers to allow verbatim, alongside the ones
|
|
258
|
+
* derived from `lexicons`.
|
|
259
|
+
*
|
|
260
|
+
* A chant build's active packages are always `@intentius/chant-lexicon-*`,
|
|
261
|
+
* so naming lexicons is the whole story there. A caller embedding the fold
|
|
262
|
+
* path against a host that is not a chant lexicon has packages the naming
|
|
263
|
+
* convention cannot express: the specification's conformance harness supplies
|
|
264
|
+
* `@tsad/shapes`, which is its host's own specifier. The boundary is
|
|
265
|
+
* unchanged, an explicitly named package of this build, only now it can be
|
|
266
|
+
* named as a specifier rather than only as a lexicon.
|
|
267
|
+
*/
|
|
268
|
+
lexiconPackages?: readonly string[]): FoldSession;
|
|
256
269
|
/**
|
|
257
270
|
* What the fold pass actually EXECUTED, and what it interpreted instead — the
|
|
258
271
|
* number chant #1023 is measured by, and the one the #1093/#1111
|
|
@@ -515,6 +528,20 @@ export interface FoldProjectOptions {
|
|
|
515
528
|
readonly buildParams?: Readonly<Record<string, BuildParamValue>>;
|
|
516
529
|
/** chant #1093: this build asked for the sandbox, so fold may not reach outside the trusted allowlist. */
|
|
517
530
|
readonly sandbox?: boolean;
|
|
531
|
+
/**
|
|
532
|
+
* chant#2438 — package specifiers to follow a bare import into, verbatim,
|
|
533
|
+
* alongside whatever `lexicons` names.
|
|
534
|
+
*
|
|
535
|
+
* For a chant project this is never needed: an active package is always
|
|
536
|
+
* `@intentius/chant-lexicon-<name>`, which `lexicons` already expresses. It
|
|
537
|
+
* is here for a caller driving the fold path against a host of its own, where
|
|
538
|
+
* the package has a name chant's convention cannot spell. The specification's
|
|
539
|
+
* conformance harness is the first such caller, with `@tsad/shapes`.
|
|
540
|
+
*
|
|
541
|
+
* The boundary does not move. This is still an allowlist the caller states
|
|
542
|
+
* outright, matched by text, and absent it nothing bare resolves at all.
|
|
543
|
+
*/
|
|
544
|
+
readonly lexiconPackages?: readonly string[];
|
|
518
545
|
}
|
|
519
546
|
/** One file's place in a whole-build fold, as {@link foldProject} reports it. */
|
|
520
547
|
export interface FoldProjectVerdict {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold-import.d.ts","sourceRoot":"","sources":["../../src/discovery/fold-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAMjC,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAkC,KAAK,iBAAiB,EAAyB,MA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S,MAAM,EAAE,CAAC;IACtC,qFAAqF;IACrF,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;IACjE,0GAA0G;IAC1G,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C;AAED,iFAAiF;AACjF,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;IACjC,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC;IACnC,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,aAAa,CAAA;KAAE,CAAC;IAC3D,mFAAmF;IACnF,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,UAAU,GAAE,SAAS,YAAY,EAAO,EACxC,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAoC1C"}
|
package/dist/fold/fold.d.ts
CHANGED
|
@@ -411,6 +411,35 @@ export declare class FoldableFunction {
|
|
|
411
411
|
*/
|
|
412
412
|
leakedIdentity: boolean;
|
|
413
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* True when a module-level `const` is (transitively) bound to a `new Type(...)`.
|
|
416
|
+
* Follows an identifier chain (`const a = new T(); const b = a;`) so aliasing
|
|
417
|
+
* cannot smuggle a module-level resource into a function body.
|
|
418
|
+
*
|
|
419
|
+
* chant#2436 moved this here from ../discovery/fold-import.ts so the two places
|
|
420
|
+
* that build {@link FoldableFunction}s share one implementation rather than two
|
|
421
|
+
* that can drift.
|
|
422
|
+
*/
|
|
423
|
+
export declare function constResolvesToResource(consts: ReadonlyMap<string, ts.Expression>, name: string, seen?: Set<string>): boolean;
|
|
424
|
+
/**
|
|
425
|
+
* Every top-level function a file declares, exported or not, as a
|
|
426
|
+
* {@link FoldableFunction}: `function f(...) {...}` and `const f = (...) => …`.
|
|
427
|
+
*
|
|
428
|
+
* The markers carry `externals` BY REFERENCE, so the caller may keep filling it
|
|
429
|
+
* after this returns (which is how a sibling function, or a resource built
|
|
430
|
+
* later, becomes reachable from a body).
|
|
431
|
+
*
|
|
432
|
+
* `consts` drops every `new`-bound const, transitively through aliases: a body
|
|
433
|
+
* that mentions one must read the live instance out of `externals`, the same
|
|
434
|
+
* object the module's own fold registered, never re-fold the initializer and
|
|
435
|
+
* construct a duplicate of a resource discovery already has.
|
|
436
|
+
*
|
|
437
|
+
* chant#2436 — one implementation, called both by ../discovery/fold-import.ts
|
|
438
|
+
* during a build and by {@link fold} when a unit-level fold has no externals of
|
|
439
|
+
* its own. Getting the `new`-bound stripping wrong yields a wrong value rather
|
|
440
|
+
* than a fallback to run, which is why there is only one copy of it.
|
|
441
|
+
*/
|
|
442
|
+
export declare function collectSameFileFunctions(sourceFile: ts.SourceFile, consts: ReadonlyMap<string, ts.Expression>, file: string, externals: ReadonlyMap<string, unknown>, failures?: ReadonlyMap<string, string>): Map<string, FoldableFunction>;
|
|
414
443
|
export declare function isFoldableFunction(value: unknown): value is FoldableFunction;
|
|
415
444
|
/**
|
|
416
445
|
* The SHAPE half of what makes a project-local function foldable (chant
|
package/dist/fold/fold.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold.d.ts","sourceRoot":"","sources":["../../src/fold/fold.ts"],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AM,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAItE;AAOD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,CAYnF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,GAAG,MAAM,CAGtD;AAgRD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,IAAI,CAClB,IAAI,EAAE,EAAE,CAAC,UAAU,EACnB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,EAClC,UAAU,GAAE,SAAS,YAAY,EAAO,EACxC,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,WAAW,CAmeb;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,EAAE,CAAC,aAAa,EACtB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,EAClC,UAAU,GAAE,SAAS,YAAY,EAAO,EACxC,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,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"}
|
package/dist/fold/subset.d.ts
CHANGED
|
@@ -46,7 +46,16 @@ import { type IntrinsicDef } from "../lexicon.js";
|
|
|
46
46
|
* expression, its operator, and (for keys) its literal-ness. It
|
|
47
47
|
* deliberately does NOT resolve bindings or perform any evaluation, because
|
|
48
48
|
* three things a full fold needs are inherently environment-dependent and
|
|
49
|
-
* cannot be recovered from shape alone
|
|
49
|
+
* cannot be recovered from shape alone.
|
|
50
|
+
*
|
|
51
|
+
* One thing it does read beyond the expression itself, since chant#2435: the
|
|
52
|
+
* enclosing file's top-level bindings, for `S-CallLocal`. A call to a
|
|
53
|
+
* project-local function is admitted by NAME (see
|
|
54
|
+
* {@link collectLocalCallables}), which is decidable from that file's syntax
|
|
55
|
+
* and needs no resolution. Before that, this module rejected all four shapes
|
|
56
|
+
* the build folds, which is the one direction `F-Direction` forbids, and it
|
|
57
|
+
* made `chant lint` report EVL001 on a file `chant build --fold` folds
|
|
58
|
+
* cleanly. The three genuinely environment-dependent cases are:
|
|
50
59
|
*
|
|
51
60
|
* 1. Identifier *resolution* — is a bare name actually a local `const`,
|
|
52
61
|
* vs. an unbound name? That needs the file's `consts` map. Both
|
|
@@ -196,6 +205,30 @@ export declare function isLiteralElementKey(node: ts.Expression): node is ts.Str
|
|
|
196
205
|
* one-line reason either.
|
|
197
206
|
*/
|
|
198
207
|
export declare function briefNodeText(node: ts.Node, maxLength?: number): string;
|
|
208
|
+
/**
|
|
209
|
+
* Every name a file binds to something a project-local call can reach.
|
|
210
|
+
*
|
|
211
|
+
* Two bindings, both of which the specification's `S-LocalFunction` names and
|
|
212
|
+
* both decidable from this file's own syntax, which is all a shape classifier
|
|
213
|
+
* has:
|
|
214
|
+
*
|
|
215
|
+
* - a top-level `function f(...) {...}`, or a `const f = (...) => ...`
|
|
216
|
+
* (a function expression counts, and parentheses / `as` / `satisfies`
|
|
217
|
+
* wrappers are unwrapped), exported or not;
|
|
218
|
+
* - a name imported from a *project* specifier, one starting `./` or `../`.
|
|
219
|
+
* A bare specifier is a package, and a package's function is not
|
|
220
|
+
* project-local.
|
|
221
|
+
*
|
|
222
|
+
* Deliberately syntax-only, and deliberately not a judgment about the callee's
|
|
223
|
+
* body. Whether the body is admissible is `S-FnBody`'s question and the fold's
|
|
224
|
+
* to answer, exactly as it already is for a call this classifier admits by
|
|
225
|
+
* name (a registered authoring helper, an opted-in intrinsic).
|
|
226
|
+
*
|
|
227
|
+
* Mirrors `collectLocalFunctions` in ../discovery/fold-import.ts, which builds
|
|
228
|
+
* the real `FoldableFunction` for each of these during a build. This one only
|
|
229
|
+
* needs the names.
|
|
230
|
+
*/
|
|
231
|
+
export declare function collectLocalCallables(sourceFile: ts.SourceFile): ReadonlySet<string>;
|
|
199
232
|
export declare function computedPropertyNameMessage(node: ts.PropertyName): string;
|
|
200
233
|
export declare function dynamicElementAccessMessage(keyNode: ts.Expression): string;
|
|
201
234
|
export declare const UNSUPPORTED_OBJECT_MEMBER_MESSAGE = "unsupported object member";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subset.d.ts","sourceRoot":"","sources":["../../src/fold/subset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAiD,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE9F
|
|
1
|
+
{"version":3,"file":"subset.d.ts","sourceRoot":"","sources":["../../src/fold/subset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAiD,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwKG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,QAAQ,CAAC;AAElC,mEAAmE;AACnE,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE/C,uGAAuG;AACvG,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,EAAE,CAAC,IAAI,CAA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AA4B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,CAElE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,EAAE,CAAC,wBAAwB,EACjC,UAAU,CAAC,EAAE,SAAS,YAAY,EAAE,GACnC,eAAe,GAAG,SAAS,CAc7B;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,UAAU,CAAC,EAAE,SAAS,YAAY,EAAE,GACnC,eAAe,GAAG,SAAS,CAkO7B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export * from "./graph-layout.js";
|
|
|
38
38
|
export * from "./graph-lens.js";
|
|
39
39
|
export * from "./detectLexicon.js";
|
|
40
40
|
export * from "./fold/fold.js";
|
|
41
|
-
export { findSubsetViolation, checkObjectMember, type SubsetViolation, type SubsetRuleId } from "./fold/subset.js";
|
|
41
|
+
export { findSubsetViolation, checkObjectMember, collectLocalCallables, type SubsetViolation, type SubsetRuleId } from "./fold/subset.js";
|
|
42
42
|
export { SPEC_VERSION } from "./fold/subset.js";
|
|
43
43
|
export { foldProject, planFoldTaintWithEdges, type FoldProjectOptions, type FoldProjectVerdict, type TaintPlan, type TaintEdgeKind, } from "./discovery/fold-import.js";
|
|
44
44
|
export * from "./lint/parser.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,a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C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAClE,cAAc,EAAE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC5F,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -494,10 +494,42 @@ export const queue = new Queue({ name: Ref(environment) });
|
|
|
494
494
|
|
|
495
495
|
test("an unregistered call is still flagged as EVL001 in the same project", async () => {
|
|
496
496
|
await writeFile(join(testDir, "chant.config.json"), JSON.stringify({ lexicons: ["aws"] }));
|
|
497
|
+
// The call is to a name imported from a PACKAGE, which is what "unregistered"
|
|
498
|
+
// has to mean for this test to be about the registry. It used to be a
|
|
499
|
+
// same-file `function makeName()`, which chant#2435 established is
|
|
500
|
+
// `S-CallLocal` and admissible — the build folds that shape, so flagging it
|
|
501
|
+
// was the divergence, not the point being asserted here.
|
|
497
502
|
await writeFile(
|
|
498
503
|
join(testDir, "index.ts"),
|
|
499
504
|
`
|
|
500
505
|
import { Ref } from "@intentius/chant-lexicon-aws";
|
|
506
|
+
import { randomUUID } from "node:crypto";
|
|
507
|
+
|
|
508
|
+
class Queue {
|
|
509
|
+
constructor(_props: Record<string, unknown>) {}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
export const queue = new Queue({ name: randomUUID() });
|
|
513
|
+
`,
|
|
514
|
+
);
|
|
515
|
+
|
|
516
|
+
const result = await lintCommand({ path: testDir, format: "stylish" });
|
|
517
|
+
|
|
518
|
+
const evl001 = result.diagnostics.filter((d) => d.ruleId === "EVL001");
|
|
519
|
+
expect(evl001).toHaveLength(1);
|
|
520
|
+
expect(evl001[0].message).toContain("statically evaluable");
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
test("a call to a project-local function is not flagged (chant#2435)", async () => {
|
|
524
|
+
await writeFile(join(testDir, "chant.config.json"), JSON.stringify({ lexicons: ["aws"] }));
|
|
525
|
+
// All three `S-LocalFunction` bindings in one file: a top-level function
|
|
526
|
+
// declaration, an arrow const, and a name imported from a project
|
|
527
|
+
// specifier. A build folds a call to each, so EVL001 must not flag one.
|
|
528
|
+
await writeFile(join(testDir, "helpers.ts"), `export function suffix(s: string): string { return s + "-x"; }\n`);
|
|
529
|
+
await writeFile(
|
|
530
|
+
join(testDir, "index.ts"),
|
|
531
|
+
`
|
|
532
|
+
import { suffix } from "./helpers";
|
|
501
533
|
|
|
502
534
|
class Queue {
|
|
503
535
|
constructor(_props: Record<string, unknown>) {}
|
|
@@ -507,15 +539,17 @@ function makeName(): string {
|
|
|
507
539
|
return "generated";
|
|
508
540
|
}
|
|
509
541
|
|
|
510
|
-
|
|
542
|
+
const label = (s: string): string => s.toUpperCase();
|
|
543
|
+
|
|
544
|
+
export const a = new Queue({ name: makeName() });
|
|
545
|
+
export const b = new Queue({ name: label("k") });
|
|
546
|
+
export const c = new Queue({ name: suffix("q") });
|
|
511
547
|
`,
|
|
512
548
|
);
|
|
513
549
|
|
|
514
550
|
const result = await lintCommand({ path: testDir, format: "stylish" });
|
|
515
551
|
|
|
516
|
-
|
|
517
|
-
expect(evl001).toHaveLength(1);
|
|
518
|
-
expect(evl001[0].message).toContain("statically evaluable");
|
|
552
|
+
expect(result.diagnostics.filter((d) => d.ruleId === "EVL001")).toHaveLength(0);
|
|
519
553
|
});
|
|
520
554
|
});
|
|
521
555
|
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { describe, test, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
+
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { foldProject } from "../index";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* chant#2442 — a host may supply the composite registration form.
|
|
9
|
+
*
|
|
10
|
+
* `findCompositeDefinition` required `Composite` to be chant's own, which is
|
|
11
|
+
* right for a chant project and is the provenance question #1082 settled: a
|
|
12
|
+
* project-local `function Composite(...)` shadowing the name is not chant's,
|
|
13
|
+
* and a call to it is not a registered composite.
|
|
14
|
+
*
|
|
15
|
+
* It had never had to consider a HOST supplying the form
|
|
16
|
+
* (`F-Host-Composite`), because a chant project's active packages are always
|
|
17
|
+
* lexicons and no lexicon exports a `Composite`. Reaching it at all requires a
|
|
18
|
+
* caller that named its own host packages
|
|
19
|
+
* (`FoldProjectOptions.lexiconPackages`, chant#2438), so nothing about a chant
|
|
20
|
+
* build changes.
|
|
21
|
+
*
|
|
22
|
+
* Two halves, and the second is the one with teeth. Recognising the form gets
|
|
23
|
+
* interpretation started; the members it produces are then the HOST's, and
|
|
24
|
+
* wrapping them in chant's `Composite` would run chant's member validation,
|
|
25
|
+
* which asks for chant's own `Declarable` and rejects an entity carrying a
|
|
26
|
+
* different marker — rejecting it for not being chant's rather than for being
|
|
27
|
+
* malformed.
|
|
28
|
+
*/
|
|
29
|
+
describe("a host's composite registration form (chant#2442)", () => {
|
|
30
|
+
let root: string;
|
|
31
|
+
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
root = mkdtempSync(join(tmpdir(), "chant-host-composite-"));
|
|
34
|
+
const pkg = join(root, "node_modules", "@tsad", "shapes");
|
|
35
|
+
mkdirSync(pkg, { recursive: true });
|
|
36
|
+
writeFileSync(
|
|
37
|
+
join(pkg, "package.json"),
|
|
38
|
+
JSON.stringify({ name: "@tsad/shapes", version: "0.0.0", type: "module", main: "index.js" }),
|
|
39
|
+
);
|
|
40
|
+
// An entity carrying its OWN marker, not chant's, and the host's own
|
|
41
|
+
// registration form. This is the shape the specification's `shapes` host
|
|
42
|
+
// has and the reason chant's member validation refused it.
|
|
43
|
+
writeFileSync(
|
|
44
|
+
join(pkg, "index.js"),
|
|
45
|
+
[
|
|
46
|
+
"const MARK = Symbol.for('tsad.conformance.declarable');",
|
|
47
|
+
"export class Bucket {",
|
|
48
|
+
" constructor(props = {}) {",
|
|
49
|
+
" this.entityType = 'Bucket'; this.lexicon = 'shapes'; this.props = props;",
|
|
50
|
+
" Object.defineProperty(this, MARK, { value: true, enumerable: false });",
|
|
51
|
+
" }",
|
|
52
|
+
"}",
|
|
53
|
+
"export function Composite(factory, name) {",
|
|
54
|
+
" const d = (props) => factory(props); d.compositeName = name; return d;",
|
|
55
|
+
"}",
|
|
56
|
+
].join("\n") + "\n",
|
|
57
|
+
);
|
|
58
|
+
writeFileSync(
|
|
59
|
+
join(root, "shapes.ts"),
|
|
60
|
+
'import { Bucket, Composite } from "@tsad/shapes";\n' +
|
|
61
|
+
'export const Store = Composite(({ name }) => ({ bucket: new Bucket({ name }) }), "Store");\n',
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
afterEach(() => rmSync(root, { recursive: true, force: true }));
|
|
66
|
+
|
|
67
|
+
const app = (source: string): string => {
|
|
68
|
+
const file = join(root, "app.ts");
|
|
69
|
+
writeFileSync(file, source);
|
|
70
|
+
return file;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
test("a call to the host's composite folds to the host's own members", async () => {
|
|
74
|
+
const file = app('import { Store } from "./shapes";\nexport const s = Store({ name: "a" });\n');
|
|
75
|
+
|
|
76
|
+
// `--sandbox` is what the specification calls isolated, and it is the
|
|
77
|
+
// setting that proves interpretation rather than invocation: invoking would
|
|
78
|
+
// import a project module, which the sandbox refuses.
|
|
79
|
+
const verdict = (
|
|
80
|
+
await foldProject([file], [], { lexiconPackages: ["@tsad/shapes"], sandbox: true })
|
|
81
|
+
).get(file)!;
|
|
82
|
+
|
|
83
|
+
expect(verdict.verdict).toBe("fold");
|
|
84
|
+
expect(JSON.parse(JSON.stringify(Object.fromEntries(verdict.exports!)))).toEqual({
|
|
85
|
+
s: { bucket: { entityType: "Bucket", lexicon: "shapes", props: { name: "a" } } },
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("a factory outside the subset is still refused rather than invoked", async () => {
|
|
90
|
+
// `S-FactoryParams`: two parameters is outside it, so interpretation
|
|
91
|
+
// declines and the invocation arm refuses under the sandbox.
|
|
92
|
+
writeFileSync(
|
|
93
|
+
join(root, "shapes.ts"),
|
|
94
|
+
'import { Bucket, Composite } from "@tsad/shapes";\n' +
|
|
95
|
+
'export const Two = Composite((a, b) => ({ bucket: new Bucket({ name: a.name + b }) }), "Two");\n',
|
|
96
|
+
);
|
|
97
|
+
const file = app('import { Two } from "./shapes";\nexport const s = Two({ name: "a" }, "b");\n');
|
|
98
|
+
|
|
99
|
+
const verdict = (
|
|
100
|
+
await foldProject([file], [], { lexiconPackages: ["@tsad/shapes"], sandbox: true })
|
|
101
|
+
).get(file)!;
|
|
102
|
+
|
|
103
|
+
expect(verdict.verdict).toBe("run");
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test("the form is only recognised when the caller named the package", async () => {
|
|
107
|
+
const file = app('import { Store } from "./shapes";\nexport const s = Store({ name: "a" });\n');
|
|
108
|
+
|
|
109
|
+
// Unnamed, the host package is not resolvable, so nothing about the
|
|
110
|
+
// registration form is reached and the sandbox refuses the invocation arm.
|
|
111
|
+
const verdict = (await foldProject([file], [], { sandbox: true })).get(file)!;
|
|
112
|
+
|
|
113
|
+
expect(verdict.verdict).toBe("run");
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { describe, test, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
+
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { foldProject } from "../index";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* chant#2438 — a host package that is not a chant lexicon.
|
|
9
|
+
*
|
|
10
|
+
* `FoldSession.lexiconPackages` is the entire allowlist a bare import is
|
|
11
|
+
* followed into, matched by text, and it has only ever been built from
|
|
12
|
+
* `@intentius/chant-lexicon-<name>`. That covers every chant project, because
|
|
13
|
+
* a chant project's active packages are exactly that.
|
|
14
|
+
*
|
|
15
|
+
* It does not cover a caller driving the fold path against a host of its own.
|
|
16
|
+
* The specification's conformance harness is the first: its `shapes` host owns
|
|
17
|
+
* `@tsad/shapes`, a name the convention cannot spell, so all twenty-five of its
|
|
18
|
+
* hosted whole-build fixtures were unanswerable at chant and reported skipped.
|
|
19
|
+
*
|
|
20
|
+
* `FoldProjectOptions.lexiconPackages` names such a package outright. The
|
|
21
|
+
* boundary is unchanged: still an allowlist the caller states, still matched by
|
|
22
|
+
* text, still empty by default.
|
|
23
|
+
*/
|
|
24
|
+
describe("foldProject — a host package outside the lexicon convention (chant#2438)", () => {
|
|
25
|
+
let root: string;
|
|
26
|
+
|
|
27
|
+
/** A project with a real `@tsad/shapes` in its own `node_modules`. */
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
root = mkdtempSync(join(tmpdir(), "chant-host-pkg-"));
|
|
30
|
+
const pkg = join(root, "node_modules", "@tsad", "shapes");
|
|
31
|
+
mkdirSync(pkg, { recursive: true });
|
|
32
|
+
writeFileSync(
|
|
33
|
+
join(pkg, "package.json"),
|
|
34
|
+
JSON.stringify({ name: "@tsad/shapes", version: "1.0.0", type: "module", main: "index.js" }),
|
|
35
|
+
);
|
|
36
|
+
writeFileSync(join(pkg, "index.js"), "export const SIZES = { small: 1, large: 3 };\n");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
afterEach(() => rmSync(root, { recursive: true, force: true }));
|
|
40
|
+
|
|
41
|
+
const app = (source: string): string => {
|
|
42
|
+
const file = join(root, "app.ts");
|
|
43
|
+
writeFileSync(file, source);
|
|
44
|
+
return file;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
test("is not followed without being named, which is the pre-#2438 answer", async () => {
|
|
48
|
+
const file = app('import { SIZES } from "@tsad/shapes";\nexport const s = SIZES.large;\n');
|
|
49
|
+
const verdict = (await foldProject([file])).get(file)!;
|
|
50
|
+
|
|
51
|
+
expect(verdict.verdict).toBe("run");
|
|
52
|
+
expect(verdict.reason).toContain("unresolved identifier: SIZES");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("is followed when named, and the data export folds as a value", async () => {
|
|
56
|
+
const file = app('import { SIZES } from "@tsad/shapes";\nexport const s = SIZES.large;\n');
|
|
57
|
+
const verdict = (await foldProject([file], [], { lexiconPackages: ["@tsad/shapes"] })).get(file)!;
|
|
58
|
+
|
|
59
|
+
// The specification's `F-Host-DataExports/plain-data-export` fixture, and
|
|
60
|
+
// its `expect.json`, are exactly this.
|
|
61
|
+
expect(verdict.verdict).toBe("fold");
|
|
62
|
+
expect(Object.fromEntries(verdict.exports!)).toEqual({ s: 3 });
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test("naming one package does not open any other", async () => {
|
|
66
|
+
const other = join(root, "node_modules", "@tsad", "elsewhere");
|
|
67
|
+
mkdirSync(other, { recursive: true });
|
|
68
|
+
writeFileSync(
|
|
69
|
+
join(other, "package.json"),
|
|
70
|
+
JSON.stringify({ name: "@tsad/elsewhere", version: "1.0.0", type: "module", main: "index.js" }),
|
|
71
|
+
);
|
|
72
|
+
writeFileSync(join(other, "index.js"), "export const OTHER = 9;\n");
|
|
73
|
+
|
|
74
|
+
const file = app('import { OTHER } from "@tsad/elsewhere";\nexport const s = OTHER;\n');
|
|
75
|
+
const verdict = (await foldProject([file], [], { lexiconPackages: ["@tsad/shapes"] })).get(file)!;
|
|
76
|
+
|
|
77
|
+
expect(verdict.verdict).toBe("run");
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test("sits alongside `lexicons`, rather than replacing it", async () => {
|
|
81
|
+
const file = app('import { SIZES } from "@tsad/shapes";\nexport const s = SIZES.small;\n');
|
|
82
|
+
const verdict = (
|
|
83
|
+
await foldProject([file], [], { lexicons: ["aws"], lexiconPackages: ["@tsad/shapes"] })
|
|
84
|
+
).get(file)!;
|
|
85
|
+
|
|
86
|
+
expect(verdict.verdict).toBe("fold");
|
|
87
|
+
expect(Object.fromEntries(verdict.exports!)).toEqual({ s: 1 });
|
|
88
|
+
});
|
|
89
|
+
});
|