@intentius/chant 0.63.0 → 0.64.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/discovery/fold-import.d.ts +12 -0
- package/dist/discovery/fold-import.d.ts.map +1 -1
- package/dist/fold/fold.d.ts +10 -0
- package/dist/fold/fold.d.ts.map +1 -1
- package/dist/fold/subset.d.ts +26 -2
- package/dist/fold/subset.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/discovery/fold-import.ts +12 -0
- package/src/fold/fold.ts +10 -0
- package/src/fold/subset-public-export.test.ts +27 -0
- package/src/fold/subset.ts +26 -2
- package/src/index.ts +5 -0
|
@@ -4,6 +4,18 @@ import { type CompositeInstance } from "../composite.js";
|
|
|
4
4
|
import { type IntrinsicDef } from "../lexicon.js";
|
|
5
5
|
import type { BuildParamValue } from "../build-params.js";
|
|
6
6
|
/**
|
|
7
|
+
* Implements judgments J2 (the per-file verdict: F-Scan, F-NoExports, F-Bind,
|
|
8
|
+
* F-Import, F-Namespace, F-Declarator, F-Call, F-Total, F-Reason,
|
|
9
|
+
* F-IsolatedRefusal), J3 (the identity-taint fixpoint: F-Capture, F-CallLeak,
|
|
10
|
+
* F-Memo, F-Count, F-Seed, F-Succ, F-Taint, F-Fix, F-Cycle — see
|
|
11
|
+
* {@link planFoldTaint}), J4's observables (F-Obs-Counters via
|
|
12
|
+
* {@link foldExecutionCounts}, F-Obs-Report via the `[fold:*]` decision
|
|
13
|
+
* lines), and the trust rule F-Host-Trust of `spec/hosts.md` (see
|
|
14
|
+
* {@link isTrustedExecutableBinding}) of the TypeScript-as-Data specification
|
|
15
|
+
* at https://github.com/INTENTIUS/typescript-as-data, normative for the subset
|
|
16
|
+
* since INTENTIUS/typescript-as-data#33. Subset changes go spec-first; see
|
|
17
|
+
* ../fold/subset.ts's module doc for the process.
|
|
18
|
+
*
|
|
7
19
|
* Bridges the static folder ({@link ../fold/fold}, #1026) into discovery
|
|
8
20
|
* (#1022/#1023, epic #1019): attempts to fold one source file into real
|
|
9
21
|
* `Declarable`/`CompositeInstance` instances with zero execution of the
|
|
@@ -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,MAAM,cAAc,CAAC;AAuC7G,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD
|
|
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,MAAM,cAAc,CAAC;AAuC7G,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,mGAAmG;AACnG,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,iBAAiB,CAAC,CAAC;AAElF,MAAM,MAAM,cAAc,GACtB;IACE,EAAE,EAAE,IAAI,CAAC;IACT;;;;;;;;OAQG;IACH,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB;;;;;;;;;;;;;OAaG;IACH,cAAc,EAAE,GAAG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,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC,CAAC;CACxF;AA+KD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,EAAE,CAAC,aAAa,GAAG,EAAE,CAAC,kBAAkB,GAAG,MAAM,GAAG,SAAS,CA0D3G;AA4pDD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE,SAAS,YAAY,EAAO,EACxC,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,cAAc,CAAC,CAEzB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH;;;;;;;;;;;;GAYG;AACH,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAwCzG;AAED,wBAAsB,aAAa,CACjC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,GACrD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAoCtB"}
|
package/dist/fold/fold.d.ts
CHANGED
|
@@ -4,6 +4,16 @@ import { type SubsetRuleId } from "./subset.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* fold — static AST value reducer (chant #1026/#1021/#1024, part of epic #1019)
|
|
6
6
|
*
|
|
7
|
+
* Implements judgment J1 (`F-Eval-*`, `spec/judgments.md`) and the value domain
|
|
8
|
+
* (`F-Val-*`, `spec/values.md`) of the TypeScript-as-Data specification at
|
|
9
|
+
* https://github.com/INTENTIUS/typescript-as-data, which is normative for the
|
|
10
|
+
* subset since INTENTIUS/typescript-as-data#33. Each branch of {@link fold}
|
|
11
|
+
* below is one F-Eval rule — the identifier branch is F-Eval-Ident, the
|
|
12
|
+
* property-access branch F-Eval-Member (its numbered steps match), the call
|
|
13
|
+
* branch F-Eval-CallHelper / CallIntrinsic / CallLocal / CallEager / CallMethod
|
|
14
|
+
* in that order — and the envelope types here are F-Val-Domain's cases.
|
|
15
|
+
* Subset changes go spec-first; see subset.ts's module doc for the process.
|
|
16
|
+
*
|
|
7
17
|
* Reduces a single-file TypeScript expression AST to a value with NO
|
|
8
18
|
* module execution. The node-kind/operator/key subset it covers — literals,
|
|
9
19
|
* template interpolation, object/array literals (incl. spread), `const`
|
package/dist/fold/fold.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fold.d.ts","sourceRoot":"","sources":["../../src/fold/fold.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAoE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACjH,OAAO,EAaL,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAGlB
|
|
1
|
+
{"version":3,"file":"fold.d.ts","sourceRoot":"","sources":["../../src/fold/fold.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAoE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACjH,OAAO,EAaL,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAGlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkGG;AAEH;;;;GAIG;AACH,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,W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C,EAClC,UAAU,GAAE,SAAS,YAAY,EAAO,EACxC,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,WAAW,CAocb;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
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
2
|
import { type IntrinsicDef } from "../lexicon.js";
|
|
3
3
|
/**
|
|
4
|
-
* subset — the
|
|
5
|
-
*
|
|
4
|
+
* subset — chant's implementation of the SHAPE layer of the TypeScript-as-Data
|
|
5
|
+
* specification (chant #1024, epic #1019).
|
|
6
|
+
*
|
|
7
|
+
* ## The specification is normative; this file implements it
|
|
8
|
+
*
|
|
9
|
+
* Since INTENTIUS/typescript-as-data#33 (2026-09-10) the subset is defined by
|
|
10
|
+
* the specification at https://github.com/INTENTIUS/typescript-as-data, not by
|
|
11
|
+
* this file. The rules this module implements are the `S-*` productions of
|
|
12
|
+
* `spec/grammar.md` §2 — S-Unwrap, S-Literal, S-Ident, S-Template, S-Tagged,
|
|
13
|
+
* S-Object (S-Prop / S-Shorthand / S-SpreadProp), S-Array, S-Member, S-Index,
|
|
14
|
+
* S-Unary, S-Binary, S-Conditional, S-New, the S-Call forms (S-CallHelper,
|
|
15
|
+
* S-CallIntrinsic, S-CallEager, S-CallMethod, S-CompositeStep) and S-Reject —
|
|
16
|
+
* and the direction rule `F-Direction` of `spec/divergence.md`: this classifier
|
|
17
|
+
* may accept what `fold()` rejects, never the reverse, outside the two named
|
|
18
|
+
* exceptions F-Exc-Lazy and F-Exc-Registry. The "environment-dependent
|
|
19
|
+
* exceptions" enumerated below are `spec/divergence.md`'s F-Div-* rows, kept
|
|
20
|
+
* here as implementation notes on WHY each resolution is out of this module's
|
|
21
|
+
* reach.
|
|
22
|
+
*
|
|
23
|
+
* Changing the subset goes spec-first: propose and land the rule there (with a
|
|
24
|
+
* fixture), then implement it here citing the identifier, then release. The
|
|
25
|
+
* provisional path for a change needed before the rule can be written: land it
|
|
26
|
+
* with the affected rule marked PROVISIONAL in this doc naming the spec issue;
|
|
27
|
+
* a provisional marker may survive at most one release, and the docs may not
|
|
28
|
+
* describe the change as supported until the rule exists. See
|
|
29
|
+
* `spec/README.md` "Ownership" and chant #2354.
|
|
6
30
|
*
|
|
7
31
|
* `fold()` ({@link "./fold"}, the enforcement layer — a construct outside
|
|
8
32
|
* this subset simply has no case there) and EVL001/EVL003
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAAE,EAAE,CAAC,cAAc,GAAG,MAAM,CAErE;AAED,wBAAgB,4BAA4B,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,CA6M7B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +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
42
|
export * from "./lint/parser.js";
|
|
42
43
|
export * from "./lint/rule.js";
|
|
43
44
|
export * from "./lint/rules/index.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,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;A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sEagerly, type IntrinsicDef } from "../lexicon";
|
|
|
48
48
|
import type { BuildParamValue } from "../build-params";
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
+
* Implements judgments J2 (the per-file verdict: F-Scan, F-NoExports, F-Bind,
|
|
52
|
+
* F-Import, F-Namespace, F-Declarator, F-Call, F-Total, F-Reason,
|
|
53
|
+
* F-IsolatedRefusal), J3 (the identity-taint fixpoint: F-Capture, F-CallLeak,
|
|
54
|
+
* F-Memo, F-Count, F-Seed, F-Succ, F-Taint, F-Fix, F-Cycle — see
|
|
55
|
+
* {@link planFoldTaint}), J4's observables (F-Obs-Counters via
|
|
56
|
+
* {@link foldExecutionCounts}, F-Obs-Report via the `[fold:*]` decision
|
|
57
|
+
* lines), and the trust rule F-Host-Trust of `spec/hosts.md` (see
|
|
58
|
+
* {@link isTrustedExecutableBinding}) of the TypeScript-as-Data specification
|
|
59
|
+
* at https://github.com/INTENTIUS/typescript-as-data, normative for the subset
|
|
60
|
+
* since INTENTIUS/typescript-as-data#33. Subset changes go spec-first; see
|
|
61
|
+
* ../fold/subset.ts's module doc for the process.
|
|
62
|
+
*
|
|
51
63
|
* Bridges the static folder ({@link ../fold/fold}, #1026) into discovery
|
|
52
64
|
* (#1022/#1023, epic #1019): attempts to fold one source file into real
|
|
53
65
|
* `Declarable`/`CompositeInstance` instances with zero execution of the
|
package/src/fold/fold.ts
CHANGED
|
@@ -21,6 +21,16 @@ import { isFoldableHelperName } from "./foldable-helpers";
|
|
|
21
21
|
/**
|
|
22
22
|
* fold — static AST value reducer (chant #1026/#1021/#1024, part of epic #1019)
|
|
23
23
|
*
|
|
24
|
+
* Implements judgment J1 (`F-Eval-*`, `spec/judgments.md`) and the value domain
|
|
25
|
+
* (`F-Val-*`, `spec/values.md`) of the TypeScript-as-Data specification at
|
|
26
|
+
* https://github.com/INTENTIUS/typescript-as-data, which is normative for the
|
|
27
|
+
* subset since INTENTIUS/typescript-as-data#33. Each branch of {@link fold}
|
|
28
|
+
* below is one F-Eval rule — the identifier branch is F-Eval-Ident, the
|
|
29
|
+
* property-access branch F-Eval-Member (its numbered steps match), the call
|
|
30
|
+
* branch F-Eval-CallHelper / CallIntrinsic / CallLocal / CallEager / CallMethod
|
|
31
|
+
* in that order — and the envelope types here are F-Val-Domain's cases.
|
|
32
|
+
* Subset changes go spec-first; see subset.ts's module doc for the process.
|
|
33
|
+
*
|
|
24
34
|
* Reduces a single-file TypeScript expression AST to a value with NO
|
|
25
35
|
* module execution. The node-kind/operator/key subset it covers — literals,
|
|
26
36
|
* template interpolation, object/array literals (incl. spread), `const`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import * as ts from "typescript";
|
|
3
|
+
import * as chant from "../index";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The shape classifier is part of the public entry so a conformance adapter
|
|
7
|
+
* (INTENTIUS/typescript-as-data#11) and downstream tooling can ask "will this
|
|
8
|
+
* fold?" without running a fold. This pins the export and its two answers.
|
|
9
|
+
*/
|
|
10
|
+
describe("findSubsetViolation is exported from the package entry", () => {
|
|
11
|
+
const initializerOf = (src: string) => {
|
|
12
|
+
const sf = ts.createSourceFile("x.ts", src, ts.ScriptTarget.Latest, true);
|
|
13
|
+
return (sf.statements[0] as ts.VariableStatement).declarationList.declarations[0].initializer!;
|
|
14
|
+
};
|
|
15
|
+
test("is a function on the public namespace", () => {
|
|
16
|
+
expect(typeof chant.findSubsetViolation).toBe("function");
|
|
17
|
+
expect(typeof chant.checkObjectMember).toBe("function");
|
|
18
|
+
});
|
|
19
|
+
test("classifies a call as EVL001 and a literal as clean", () => {
|
|
20
|
+
const call = chant.findSubsetViolation(initializerOf("export const x = getId();"));
|
|
21
|
+
expect(call?.ruleId).toBe("EVL001");
|
|
22
|
+
expect(chant.findSubsetViolation(initializerOf('export const x = "ok";'))).toBeUndefined();
|
|
23
|
+
});
|
|
24
|
+
test("classifies a dynamic element-access key as EVL003", () => {
|
|
25
|
+
expect(chant.findSubsetViolation(initializerOf("export const x = cfg[key];"))?.ruleId).toBe("EVL003");
|
|
26
|
+
});
|
|
27
|
+
});
|
package/src/fold/subset.ts
CHANGED
|
@@ -3,8 +3,32 @@ import { isFoldableHelperName } from "./foldable-helpers";
|
|
|
3
3
|
import { intrinsicCallFolds, intrinsicCallFoldsEagerly, type IntrinsicDef } from "../lexicon";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* subset — the
|
|
7
|
-
*
|
|
6
|
+
* subset — chant's implementation of the SHAPE layer of the TypeScript-as-Data
|
|
7
|
+
* specification (chant #1024, epic #1019).
|
|
8
|
+
*
|
|
9
|
+
* ## The specification is normative; this file implements it
|
|
10
|
+
*
|
|
11
|
+
* Since INTENTIUS/typescript-as-data#33 (2026-09-10) the subset is defined by
|
|
12
|
+
* the specification at https://github.com/INTENTIUS/typescript-as-data, not by
|
|
13
|
+
* this file. The rules this module implements are the `S-*` productions of
|
|
14
|
+
* `spec/grammar.md` §2 — S-Unwrap, S-Literal, S-Ident, S-Template, S-Tagged,
|
|
15
|
+
* S-Object (S-Prop / S-Shorthand / S-SpreadProp), S-Array, S-Member, S-Index,
|
|
16
|
+
* S-Unary, S-Binary, S-Conditional, S-New, the S-Call forms (S-CallHelper,
|
|
17
|
+
* S-CallIntrinsic, S-CallEager, S-CallMethod, S-CompositeStep) and S-Reject —
|
|
18
|
+
* and the direction rule `F-Direction` of `spec/divergence.md`: this classifier
|
|
19
|
+
* may accept what `fold()` rejects, never the reverse, outside the two named
|
|
20
|
+
* exceptions F-Exc-Lazy and F-Exc-Registry. The "environment-dependent
|
|
21
|
+
* exceptions" enumerated below are `spec/divergence.md`'s F-Div-* rows, kept
|
|
22
|
+
* here as implementation notes on WHY each resolution is out of this module's
|
|
23
|
+
* reach.
|
|
24
|
+
*
|
|
25
|
+
* Changing the subset goes spec-first: propose and land the rule there (with a
|
|
26
|
+
* fixture), then implement it here citing the identifier, then release. The
|
|
27
|
+
* provisional path for a change needed before the rule can be written: land it
|
|
28
|
+
* with the affected rule marked PROVISIONAL in this doc naming the spec issue;
|
|
29
|
+
* a provisional marker may survive at most one release, and the docs may not
|
|
30
|
+
* describe the change as supported until the rule exists. See
|
|
31
|
+
* `spec/README.md` "Ownership" and chant #2354.
|
|
8
32
|
*
|
|
9
33
|
* `fold()` ({@link "./fold"}, the enforcement layer — a construct outside
|
|
10
34
|
* this subset simply has no case there) and EVL001/EVL003
|
package/src/index.ts
CHANGED
|
@@ -39,6 +39,11 @@ export * from "./graph-layout";
|
|
|
39
39
|
export * from "./graph-lens";
|
|
40
40
|
export * from "./detectLexicon";
|
|
41
41
|
export * from "./fold/fold";
|
|
42
|
+
// The shape classifier is the predicate downstream tooling asks "will this
|
|
43
|
+
// fold?" of without running a fold (subset.ts module doc, point 2c), and the
|
|
44
|
+
// half of the fold subset a conformance adapter needs that `fold()` alone
|
|
45
|
+
// does not expose. INTENTIUS/typescript-as-data#11.
|
|
46
|
+
export { findSubsetViolation, checkObjectMember, type SubsetViolation, type SubsetRuleId } from "./fold/subset";
|
|
42
47
|
export * from "./lint/parser";
|
|
43
48
|
export * from "./lint/rule";
|
|
44
49
|
export * from "./lint/rules";
|