@intentius/tsad-conformance 1.4.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/README.md +59 -0
- package/dist/adapter.d.ts +65 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +2 -0
- package/dist/adapter.js.map +1 -0
- package/dist/bundled.d.ts +5 -0
- package/dist/bundled.d.ts.map +1 -0
- package/dist/bundled.js +28 -0
- package/dist/bundled.js.map +1 -0
- package/dist/fixture.d.ts +49 -0
- package/dist/fixture.d.ts.map +1 -0
- package/dist/fixture.js +95 -0
- package/dist/fixture.js.map +1 -0
- package/dist/host.d.ts +33 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +79 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/rules.d.ts +46 -0
- package/dist/rules.d.ts.map +1 -0
- package/dist/rules.js +135 -0
- package/dist/rules.js.map +1 -0
- package/dist/runner.d.ts +26 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +152 -0
- package/dist/runner.js.map +1 -0
- package/fixtures/F-CallLeak/a-call-returns-a-live-object/expect.json +8 -0
- package/fixtures/F-CallLeak/a-call-returns-a-live-object/project/caller.ts +5 -0
- package/fixtures/F-CallLeak/a-call-returns-a-live-object/project/leaky.ts +7 -0
- package/fixtures/F-CallLeak/a-call-returns-a-live-object/project/pure.ts +5 -0
- package/fixtures/F-Cycle/mutual-imports/expect.json +6 -0
- package/fixtures/F-Cycle/mutual-imports/project/a.ts +3 -0
- package/fixtures/F-Cycle/mutual-imports/project/b.ts +3 -0
- package/fixtures/F-Depth/exhaustion-is-a-fallback/expect.json +19 -0
- package/fixtures/F-Depth/exhaustion-is-a-fallback/project/deep.ts +3 -0
- package/fixtures/F-Depth/exhaustion-is-a-fallback/project/rec.ts +3 -0
- package/fixtures/F-Div-Depth/new-inside-function-body/expect.json +21 -0
- package/fixtures/F-Div-Depth/new-inside-function-body/project/app.ts +3 -0
- package/fixtures/F-Div-Depth/new-inside-function-body/project/fn.ts +3 -0
- package/fixtures/F-Div-Eager/referenced-not-called/expect.json +8 -0
- package/fixtures/F-Div-Eager/referenced-not-called/project/app.ts +3 -0
- package/fixtures/F-Div-NsNew/namespace-callee/expect.json +18 -0
- package/fixtures/F-Div-NsNew/namespace-callee/input.ts +3 -0
- package/fixtures/F-Div-Provenance/helper-name-from-project-import/expect.json +20 -0
- package/fixtures/F-Div-Provenance/helper-name-from-project-import/project/app.ts +3 -0
- package/fixtures/F-Div-Provenance/helper-name-from-project-import/project/local.ts +3 -0
- package/fixtures/F-Div-SameFileNew/no-module-graph/expect.json +8 -0
- package/fixtures/F-Div-SameFileNew/no-module-graph/input.ts +5 -0
- package/fixtures/F-Div-Tag/unregistered-tag/expect.json +15 -0
- package/fixtures/F-Div-Tag/unregistered-tag/input.ts +1 -0
- package/fixtures/F-Eval-Array/spread-string-rejected/expect.json +14 -0
- package/fixtures/F-Eval-Array/spread-string-rejected/input.ts +1 -0
- package/fixtures/F-Eval-Binary/division-and-float/expect.json +19 -0
- package/fixtures/F-Eval-Binary/division-and-float/input.ts +1 -0
- package/fixtures/F-Eval-Binary/logical-return-operand/expect.json +20 -0
- package/fixtures/F-Eval-Binary/logical-return-operand/input.ts +1 -0
- package/fixtures/F-Eval-Binary/plus-dispatch/expect.json +19 -0
- package/fixtures/F-Eval-Binary/plus-dispatch/input.ts +1 -0
- package/fixtures/F-Eval-Binary/relational-on-strings/expect.json +18 -0
- package/fixtures/F-Eval-Binary/relational-on-strings/input.ts +1 -0
- package/fixtures/F-Eval-CallEager/evaluated-at-fold-time/expect.json +8 -0
- package/fixtures/F-Eval-CallEager/evaluated-at-fold-time/project/app.ts +3 -0
- package/fixtures/F-Eval-CallEager/not-a-function/expect.json +22 -0
- package/fixtures/F-Eval-CallEager/not-a-function/project/app.ts +3 -0
- package/fixtures/F-Eval-CallEager/not-a-function/project/local.ts +1 -0
- package/fixtures/F-Eval-CallHelper/helper-folds/expect.json +8 -0
- package/fixtures/F-Eval-CallHelper/helper-folds/project/app.ts +3 -0
- package/fixtures/F-Eval-CallHelper/inside-function-body/expect.json +22 -0
- package/fixtures/F-Eval-CallHelper/inside-function-body/project/app.ts +3 -0
- package/fixtures/F-Eval-CallHelper/inside-function-body/project/fn.ts +5 -0
- package/fixtures/F-Eval-CallIntrinsic/call-form-folds/expect.json +8 -0
- package/fixtures/F-Eval-CallIntrinsic/call-form-folds/project/app.ts +3 -0
- package/fixtures/F-Eval-CallIntrinsic/inside-function-body/expect.json +22 -0
- package/fixtures/F-Eval-CallIntrinsic/inside-function-body/project/app.ts +3 -0
- package/fixtures/F-Eval-CallIntrinsic/inside-function-body/project/fn.ts +5 -0
- package/fixtures/F-Eval-CallLocal/local-function-folds/expect.json +7 -0
- package/fixtures/F-Eval-CallLocal/local-function-folds/project/app.ts +3 -0
- package/fixtures/F-Eval-CallLocal/local-function-folds/project/pure.ts +3 -0
- package/fixtures/F-Eval-CallLocal/recursion-folds/expect.json +17 -0
- package/fixtures/F-Eval-CallLocal/recursion-folds/project/rec.ts +3 -0
- package/fixtures/F-Eval-CallLocal/recursion-folds/project/shallow.ts +3 -0
- package/fixtures/F-Eval-CallLocal/spread-argument-rejected/expect.json +20 -0
- package/fixtures/F-Eval-CallLocal/spread-argument-rejected/project/app.ts +5 -0
- package/fixtures/F-Eval-CallLocal/spread-argument-rejected/project/pure.ts +3 -0
- package/fixtures/F-Eval-CallMethod/method-missing/expect.json +17 -0
- package/fixtures/F-Eval-CallMethod/method-missing/input.ts +1 -0
- package/fixtures/F-Eval-CallMethod/null-receiver-dot/expect.json +13 -0
- package/fixtures/F-Eval-CallMethod/null-receiver-dot/input.ts +2 -0
- package/fixtures/F-Eval-CallMethod/null-receiver-optional/expect.json +2 -0
- package/fixtures/F-Eval-CallMethod/null-receiver-optional/input.ts +2 -0
- package/fixtures/F-Eval-CallMethod/real-receiver/expect.json +2 -0
- package/fixtures/F-Eval-CallMethod/real-receiver/input.ts +1 -0
- package/fixtures/F-Eval-Template/number-formatting/expect.json +11 -0
- package/fixtures/F-Eval-Template/number-formatting/input.ts +1 -0
- package/fixtures/F-Eval-Template/tostring-of-non-numbers/expect.json +10 -0
- package/fixtures/F-Eval-Template/tostring-of-non-numbers/input.ts +1 -0
- package/fixtures/F-Eval-Unary/coercion/expect.json +19 -0
- package/fixtures/F-Eval-Unary/coercion/input.ts +1 -0
- package/fixtures/F-Eval-Undefined/bare-undefined/expect.json +2 -0
- package/fixtures/F-Eval-Undefined/bare-undefined/input.ts +1 -0
- package/fixtures/F-Exc-Registry/call-form-without-registry/expect.json +15 -0
- package/fixtures/F-Exc-Registry/call-form-without-registry/input.ts +1 -0
- package/fixtures/F-Host-Closed-vs-Open/package-call-is-closed/expect.json +9 -0
- package/fixtures/F-Host-Closed-vs-Open/package-call-is-closed/project/closed.ts +3 -0
- package/fixtures/F-Host-Closed-vs-Open/package-call-is-closed/project/open.ts +3 -0
- package/fixtures/F-Host-Closed-vs-Open/package-call-is-closed/project/pure.ts +3 -0
- package/fixtures/F-Host-DataExports/plain-data-export/expect.json +8 -0
- package/fixtures/F-Host-DataExports/plain-data-export/project/app.ts +3 -0
- package/fixtures/F-Host-Registry/tag-called-as-function/expect.json +8 -0
- package/fixtures/F-Host-Registry/tag-called-as-function/project/app.ts +3 -0
- package/fixtures/F-Host-Trust/unowned-package/expect.json +6 -0
- package/fixtures/F-Host-Trust/unowned-package/project/app.ts +3 -0
- package/fixtures/F-Namespace/synthetic-namespace-object/expect.json +7 -0
- package/fixtures/F-Namespace/synthetic-namespace-object/project/use.ts +3 -0
- package/fixtures/F-Namespace/synthetic-namespace-object/project/values.ts +2 -0
- package/fixtures/F-NoExports/nothing-to-produce/expect.json +7 -0
- package/fixtures/F-NoExports/nothing-to-produce/project/defaulted.ts +1 -0
- package/fixtures/F-NoExports/nothing-to-produce/project/empty.ts +3 -0
- package/fixtures/F-Prebuild/same-file-construction-shared/expect.json +19 -0
- package/fixtures/F-Prebuild/same-file-construction-shared/project/shared.ts +6 -0
- package/fixtures/F-Profile-DataHost/plain-data-across-files/expect.json +39 -0
- package/fixtures/F-Profile-DataHost/plain-data-across-files/project/defaults.ts +5 -0
- package/fixtures/F-Profile-DataHost/plain-data-across-files/project/service.ts +10 -0
- package/fixtures/F-Seed/seeded-by-its-own-body/expect.json +8 -0
- package/fixtures/F-Seed/seeded-by-its-own-body/project/app.ts +8 -0
- package/fixtures/F-Seed/seeded-by-its-own-body/project/lone.ts +1 -0
- package/fixtures/F-Succ/backward-along-captures/expect.json +26 -0
- package/fixtures/F-Succ/backward-along-captures/project/breaker.ts +10 -0
- package/fixtures/F-Succ/backward-along-captures/project/shared.ts +1 -0
- package/fixtures/F-Succ/backward-along-captures/project/sibling.ts +3 -0
- package/fixtures/F-Succ/forward-into-imports/expect.json +8 -0
- package/fixtures/F-Succ/forward-into-imports/project/app.ts +10 -0
- package/fixtures/F-Succ/forward-into-imports/project/config.ts +1 -0
- package/fixtures/F-Taint/independent-file-still-folds/expect.json +9 -0
- package/fixtures/F-Taint/independent-file-still-folds/project/alone.ts +1 -0
- package/fixtures/F-Taint/independent-file-still-folds/project/app.ts +8 -0
- package/fixtures/F-Total/one-bad-declarator-fails-the-file/expect.json +7 -0
- package/fixtures/F-Total/one-bad-declarator-fails-the-file/project/mixed.ts +3 -0
- package/fixtures/F-Val-Arity/props-attributes-and-spread/expect.json +14 -0
- package/fixtures/F-Val-Arity/props-attributes-and-spread/project/arities.ts +5 -0
- package/fixtures/F-Val-Callable/host-function-as-value/expect.json +16 -0
- package/fixtures/F-Val-Callable/host-function-as-value/project/app.ts +3 -0
- package/fixtures/F-Val-Fate/revive-every-envelope/expect.json +15 -0
- package/fixtures/F-Val-Fate/revive-every-envelope/project/entities.ts +6 -0
- package/fixtures/F-Val-Live/plain-data-is-not-live/expect.json +9 -0
- package/fixtures/F-Val-Live/plain-data-is-not-live/project/breaker.ts +10 -0
- package/fixtures/F-Val-Live/plain-data-is-not-live/project/quiet.ts +3 -0
- package/fixtures/F-Val-Live/plain-data-is-not-live/project/source.ts +5 -0
- package/fixtures/F-Val-Position/attrref-in-host-arguments/expect.json +8 -0
- package/fixtures/F-Val-Position/attrref-in-host-arguments/project/rejected.ts +4 -0
- package/fixtures/F-Val-Undefined/array-element-undefined/expect.json +15 -0
- package/fixtures/F-Val-Undefined/array-element-undefined/input.ts +1 -0
- package/fixtures/F-Val-Undefined/conditional-yields-undefined/expect.json +13 -0
- package/fixtures/F-Val-Undefined/conditional-yields-undefined/input.ts +2 -0
- package/fixtures/F-Val-Undefined/optional-chain-yields-undefined-property/expect.json +13 -0
- package/fixtures/F-Val-Undefined/optional-chain-yields-undefined-property/input.ts +2 -0
- package/fixtures/F-Val-Undefined/property-literal-undefined/expect.json +16 -0
- package/fixtures/F-Val-Undefined/property-literal-undefined/input.ts +1 -0
- package/fixtures/F-Val-Undefined/spread-carries-undefined/expect.json +14 -0
- package/fixtures/F-Val-Undefined/spread-carries-undefined/input.ts +2 -0
- package/fixtures/S-Array/spread/expect.json +1 -0
- package/fixtures/S-Array/spread/input.ts +1 -0
- package/fixtures/S-Binary/arithmetic-and-concat/expect.json +1 -0
- package/fixtures/S-Binary/arithmetic-and-concat/input.ts +1 -0
- package/fixtures/S-Binary/lazy-untaken-unfoldable/expect.json +1 -0
- package/fixtures/S-Binary/lazy-untaken-unfoldable/input.ts +1 -0
- package/fixtures/S-Binary/nullish-coalesce/expect.json +1 -0
- package/fixtures/S-Binary/nullish-coalesce/input.ts +1 -0
- package/fixtures/S-CallLocal/imported-callee-is-shape-valid/expect.json +10 -0
- package/fixtures/S-CallLocal/imported-callee-is-shape-valid/input.ts +3 -0
- package/fixtures/S-Conditional/taken-branch-only/expect.json +1 -0
- package/fixtures/S-Conditional/taken-branch-only/input.ts +1 -0
- package/fixtures/S-ExportDefault/imported-by-sibling/expect.json +30 -0
- package/fixtures/S-ExportDefault/imported-by-sibling/project/app.ts +3 -0
- package/fixtures/S-ExportDefault/imported-by-sibling/project/policy.ts +1 -0
- package/fixtures/S-ExportDefault/plain-object/expect.json +21 -0
- package/fixtures/S-ExportDefault/plain-object/input.ts +1 -0
- package/fixtures/S-Ident/const-chain/expect.json +1 -0
- package/fixtures/S-Ident/const-chain/input.ts +1 -0
- package/fixtures/S-Ident/process/expect.json +1 -0
- package/fixtures/S-Ident/process/input.ts +1 -0
- package/fixtures/S-Ident/unresolved/expect.json +1 -0
- package/fixtures/S-Ident/unresolved/input.ts +1 -0
- package/fixtures/S-Index/dynamic-key/expect.json +1 -0
- package/fixtures/S-Index/dynamic-key/input.ts +1 -0
- package/fixtures/S-Index/literal-key/expect.json +1 -0
- package/fixtures/S-Index/literal-key/input.ts +1 -0
- package/fixtures/S-Literal/null-and-booleans/expect.json +1 -0
- package/fixtures/S-Literal/null-and-booleans/input.ts +1 -0
- package/fixtures/S-Literal/numeric/expect.json +1 -0
- package/fixtures/S-Literal/numeric/input.ts +1 -0
- package/fixtures/S-LocalFunction/arrow-const-call/expect.json +21 -0
- package/fixtures/S-LocalFunction/arrow-const-call/project/label.ts +3 -0
- package/fixtures/S-LocalFunction/function-as-value-still-rejects/expect.json +11 -0
- package/fixtures/S-LocalFunction/function-as-value-still-rejects/input.ts +3 -0
- package/fixtures/S-LocalFunction/same-file-declaration-call/expect.json +19 -0
- package/fixtures/S-LocalFunction/same-file-declaration-call/project/twice.ts +5 -0
- package/fixtures/S-Member/nested/expect.json +1 -0
- package/fixtures/S-Member/nested/input.ts +1 -0
- package/fixtures/S-Member/nullish-plain-refuses/expect.json +1 -0
- package/fixtures/S-Member/nullish-plain-refuses/input.ts +1 -0
- package/fixtures/S-Member/optional-chain/expect.json +1 -0
- package/fixtures/S-Member/optional-chain/input.ts +1 -0
- package/fixtures/S-Object/spread-later-wins/expect.json +1 -0
- package/fixtures/S-Object/spread-later-wins/input.ts +1 -0
- package/fixtures/S-Object/spread-non-object/expect.json +1 -0
- package/fixtures/S-Object/spread-non-object/input.ts +1 -0
- package/fixtures/S-Reject/arrow-as-value/expect.json +1 -0
- package/fixtures/S-Reject/arrow-as-value/input.ts +1 -0
- package/fixtures/S-Reject/call-as-value/expect.json +1 -0
- package/fixtures/S-Reject/call-as-value/input.ts +1 -0
- package/fixtures/S-Template/coercion/expect.json +2 -0
- package/fixtures/S-Template/coercion/input.ts +2 -0
- package/fixtures/S-Template/composite-step-span/expect.json +2 -0
- package/fixtures/S-Template/composite-step-span/input.ts +1 -0
- package/fixtures/S-Template/const-span/expect.json +2 -0
- package/fixtures/S-Template/const-span/input.ts +2 -0
- package/fixtures/S-Template/envelope-span/expect.json +2 -0
- package/fixtures/S-Template/envelope-span/input.ts +2 -0
- package/fixtures/S-Template/nested-construction-span/expect.json +2 -0
- package/fixtures/S-Template/nested-construction-span/input.ts +1 -0
- package/fixtures/S-Template/no-substitution/expect.json +2 -0
- package/fixtures/S-Template/no-substitution/input.ts +1 -0
- package/fixtures/S-Template/unfoldable-span/expect.json +16 -0
- package/fixtures/S-Template/unfoldable-span/input.ts +1 -0
- package/fixtures/S-Unary/not-and-negate/expect.json +1 -0
- package/fixtures/S-Unary/not-and-negate/input.ts +1 -0
- package/fixtures/S-Unclaimed/composite-step/expect.json +3 -0
- package/fixtures/S-Unclaimed/composite-step/input.ts +1 -0
- package/fixtures/S-Unwrap/as-and-parens/expect.json +1 -0
- package/fixtures/S-Unwrap/as-and-parens/input.ts +1 -0
- package/fixtures/UNCOVERED.md +37 -0
- package/package.json +35 -0
- package/spec/VERSION +1 -0
- package/spec/divergence.md +129 -0
- package/spec/grammar.md +277 -0
- package/spec/hosts.md +175 -0
- package/spec/judgments.md +1049 -0
- package/spec/rules.md +102 -0
- package/spec/values.md +247 -0
- package/src/adapter.ts +52 -0
- package/src/adapters/chant.ts +125 -0
- package/src/bundled.ts +27 -0
- package/src/chant-agreement.test.ts +67 -0
- package/src/corpus.test.ts +66 -0
- package/src/corpus.ts +540 -0
- package/src/fixture.ts +117 -0
- package/src/host.ts +105 -0
- package/src/index.ts +6 -0
- package/src/rules.test.ts +50 -0
- package/src/rules.ts +140 -0
- package/src/runner.test.ts +46 -0
- package/src/runner.ts +119 -0
- package/src/version.test.ts +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# @intentius/tsad-conformance
|
|
2
|
+
|
|
3
|
+
The conformance suite of the typescript-as-data specification, as a package.
|
|
4
|
+
It carries the fixtures under `spec/fixtures/` at the version it declares,
|
|
5
|
+
the loader and runner that judge an implementation against them, and the
|
|
6
|
+
named hosts a whole-build fixture may ask for. It carries no implementation:
|
|
7
|
+
the reference implementation is `@intentius/tsad-reference`, a separate
|
|
8
|
+
package, so an implementation under test does not have to install a
|
|
9
|
+
competing one to get the harness.
|
|
10
|
+
|
|
11
|
+
## Running the suite against an implementation
|
|
12
|
+
|
|
13
|
+
Supply a `ConformanceAdapter` (`src/adapter.ts`): a name, the specification
|
|
14
|
+
version the implementation declares, a shape classifier, an expression
|
|
15
|
+
folder, and optionally a whole-build entry. Then:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { loadFixtures, runFixtures, bundledFixturesDir } from "@intentius/tsad-conformance";
|
|
19
|
+
|
|
20
|
+
const fixtures = loadFixtures(bundledFixturesDir());
|
|
21
|
+
const reports = await runFixtures(myAdapter, fixtures);
|
|
22
|
+
for (const r of reports) if (!r.pass) console.log(r.fixture, r.failures);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`compareAdapters(a, b, fixtures)` reports where two implementations disagree
|
|
26
|
+
with each other, independently of what the fixtures expect. The repository's
|
|
27
|
+
own use of it is in `src/chant-agreement.test.ts`.
|
|
28
|
+
|
|
29
|
+
## Versions
|
|
30
|
+
|
|
31
|
+
The package's major and minor are the specification version it carries
|
|
32
|
+
(`spec/VERSION`); the patch is the package's own. A `1.0.x` package holds the
|
|
33
|
+
fixtures of specification 1.0. An adapter's `specVersion` is compared against
|
|
34
|
+
the fixtures' version by whoever runs the suite, never assumed.
|
|
35
|
+
|
|
36
|
+
## Gating a document's citations (#34)
|
|
37
|
+
|
|
38
|
+
An implementation's documentation cites rule identifiers, and a subset change
|
|
39
|
+
here can leave that prose describing the old subset. `loadRules(bundledSpecDir())`
|
|
40
|
+
indexes every `S-*` and `F-*` with its text at the version the package
|
|
41
|
+
carries, and `checkCitations(document, index, declaredVersion)` reports an
|
|
42
|
+
identifier that is not a rule, a quote that is not the rule's text, and a
|
|
43
|
+
declared version that is not the index's. A document quotes a rule with a
|
|
44
|
+
marker line and a blockquote:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
{/* rule: F-Depth */}
|
|
48
|
+
> Each terminates a different recursion and each turns exhaustion into a fallback.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
A bare mention is held only to existing; a quote is held to being verbatim.
|
|
52
|
+
The repository runs this over chant's own docs in the corpus workflow, and
|
|
53
|
+
chant can run the same call in its CI against the published package.
|
|
54
|
+
|
|
55
|
+
## What is not in the package
|
|
56
|
+
|
|
57
|
+
The chant adapter and the corpus cross-check (`src/adapters/`, `src/corpus.ts`)
|
|
58
|
+
are excluded from the build: they import chant and the reference, and they
|
|
59
|
+
are the repository's own cross-checks rather than the harness.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The adapter an implementation under test provides. Deliberately narrow so a
|
|
3
|
+
* foreign implementation (chant, or one in another language behind a shim)
|
|
4
|
+
* can satisfy it without exposing internals: source in, verdict out.
|
|
5
|
+
*/
|
|
6
|
+
import type { ConformanceHost } from "./host.js";
|
|
7
|
+
export type ShapeResult = {
|
|
8
|
+
accepted: true;
|
|
9
|
+
} | {
|
|
10
|
+
accepted: false;
|
|
11
|
+
rule?: string;
|
|
12
|
+
line: number;
|
|
13
|
+
column: number;
|
|
14
|
+
message: string;
|
|
15
|
+
} | "unavailable";
|
|
16
|
+
export type FoldResult = {
|
|
17
|
+
ok: true;
|
|
18
|
+
value: unknown;
|
|
19
|
+
} | {
|
|
20
|
+
ok: false;
|
|
21
|
+
rule?: string;
|
|
22
|
+
line: number;
|
|
23
|
+
column: number;
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
/** A whole-build verdict (J2 + J3). `rule` and `reason` are diagnostic; only `kind` is compared. */
|
|
27
|
+
export type ProjectVerdict = {
|
|
28
|
+
kind: "fold";
|
|
29
|
+
exports: Record<string, unknown>;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "run";
|
|
32
|
+
rule?: string;
|
|
33
|
+
reason: string;
|
|
34
|
+
};
|
|
35
|
+
export interface ProjectResult {
|
|
36
|
+
verdicts: Record<string, ProjectVerdict>;
|
|
37
|
+
/** J2's proposal, before J3 disposed of it. Omitted by an implementation that cannot separate the two phases. */
|
|
38
|
+
tentative?: Record<string, "fold" | "run">;
|
|
39
|
+
/** For a file J3 tainted, the file whose taint reached it. */
|
|
40
|
+
taintedBy?: Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
export interface ConformanceAdapter {
|
|
43
|
+
readonly name: string;
|
|
44
|
+
/**
|
|
45
|
+
* The specification version this implementation declares it implements,
|
|
46
|
+
* as `spec/VERSION` spells it (`"1.0"`), or `"undeclared"`. Compared, never
|
|
47
|
+
* assumed: the suite checks the reference's declaration against `VERSION`,
|
|
48
|
+
* and reports an implementation that declares nothing as such (#18).
|
|
49
|
+
*/
|
|
50
|
+
readonly specVersion: string;
|
|
51
|
+
/** S-* verdict on the initializer of `exportName`. "unavailable" if the implementation exposes no shape classifier. */
|
|
52
|
+
shape(source: string, exportName: string): ShapeResult;
|
|
53
|
+
/** F-* verdict: fold the initializer of `exportName` to a JSON-comparable value, or a located rejection. */
|
|
54
|
+
foldExport(source: string, exportName: string): FoldResult;
|
|
55
|
+
/**
|
|
56
|
+
* J2 + J3 over a whole build: every file's final verdict. Optional, and
|
|
57
|
+
* "unavailable" when the implementation cannot answer — no whole-build
|
|
58
|
+
* entry at all, or a host it has no way to install. Such a fixture is
|
|
59
|
+
* reported skipped rather than silently passing.
|
|
60
|
+
*
|
|
61
|
+
* May be async: a real implementation resolves modules from a filesystem.
|
|
62
|
+
*/
|
|
63
|
+
foldProject?(files: Map<string, string>, host?: ConformanceHost): ProjectResult | "unavailable" | Promise<ProjectResult | "unavailable">;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,GAClB;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACjF,aAAa,CAAC;AAClB,MAAM,MAAM,UAAU,GAClB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC5B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAChF,oGAAoG;AACpG,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AACnD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACzC,iHAAiH;IACjH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC;IAC3C,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,uHAAuH;IACvH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,CAAC;IACvD,4GAA4G;IAC5G,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC;IAC3D;;;;;;;OAOG;IACH,WAAW,CAAC,CACV,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1B,IAAI,CAAC,EAAE,eAAe,GACrB,aAAa,GAAG,aAAa,GAAG,OAAO,CAAC,aAAa,GAAG,aAAa,CAAC,CAAC;CAC3E"}
|
package/dist/adapter.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The bundled rule files and `VERSION`, or the repository's own `spec/` when running from source. */
|
|
2
|
+
export declare function bundledSpecDir(): string;
|
|
3
|
+
/** The bundled fixtures directory, or the repository's own when running from source. */
|
|
4
|
+
export declare function bundledFixturesDir(): string;
|
|
5
|
+
//# sourceMappingURL=bundled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled.d.ts","sourceRoot":"","sources":["../src/bundled.ts"],"names":[],"mappings":"AAUA,sGAAsG;AACtG,wBAAgB,cAAc,IAAI,MAAM,CAMvC;AAED,wFAAwF;AACxF,wBAAgB,kBAAkB,IAAI,MAAM,CAM3C"}
|
package/dist/bundled.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the published package keeps the fixtures. `spec/fixtures/` is copied
|
|
3
|
+
* in at build time (see `package.json`'s build script), so an implementation
|
|
4
|
+
* that installed this package from npm has the same fixtures the repository
|
|
5
|
+
* gates on, at the version the package declares.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
8
|
+
import { dirname, join } from "node:path";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
/** The bundled rule files and `VERSION`, or the repository's own `spec/` when running from source. */
|
|
11
|
+
export function bundledSpecDir() {
|
|
12
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
for (const candidate of [join(here, "..", "spec"), join(here, "..", "..", "..", "spec")]) {
|
|
14
|
+
if (existsSync(join(candidate, "VERSION")))
|
|
15
|
+
return candidate;
|
|
16
|
+
}
|
|
17
|
+
throw new Error("no spec directory: the package was built without one, and this is not the repository");
|
|
18
|
+
}
|
|
19
|
+
/** The bundled fixtures directory, or the repository's own when running from source. */
|
|
20
|
+
export function bundledFixturesDir() {
|
|
21
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
22
|
+
for (const candidate of [join(here, "..", "fixtures"), join(here, "..", "..", "..", "spec", "fixtures")]) {
|
|
23
|
+
if (existsSync(join(candidate, "UNCOVERED.md")))
|
|
24
|
+
return candidate;
|
|
25
|
+
}
|
|
26
|
+
throw new Error("no fixtures directory: the package was built without one, and this is not the repository");
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=bundled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled.js","sourceRoot":"","sources":["../src/bundled.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,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input: string;
|
|
7
|
+
rules: string[];
|
|
8
|
+
exportName: string;
|
|
9
|
+
shape: "accept" | "reject";
|
|
10
|
+
fold: "fold" | "run";
|
|
11
|
+
value?: unknown;
|
|
12
|
+
rejectAt?: {
|
|
13
|
+
line: number;
|
|
14
|
+
column: number;
|
|
15
|
+
};
|
|
16
|
+
note?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ProjectFixture {
|
|
19
|
+
kind: "project";
|
|
20
|
+
profiles: Profile[];
|
|
21
|
+
id: string;
|
|
22
|
+
dir: string;
|
|
23
|
+
rules: string[];
|
|
24
|
+
/** Path relative to project/, to source. Paths use "/" on every platform. */
|
|
25
|
+
files: Map<string, string>;
|
|
26
|
+
verdicts: Record<string, "fold" | "run">;
|
|
27
|
+
tentative?: Record<string, "fold" | "run">;
|
|
28
|
+
taintedBy?: Record<string, string>;
|
|
29
|
+
exports?: Record<string, Record<string, unknown>>;
|
|
30
|
+
/** The rule a `run` verdict must name, per file. An adapter that reports no rule is not held to it. */
|
|
31
|
+
rejectRule?: Record<string, string>;
|
|
32
|
+
/** A named host from host.ts. Required for any fixture whose sources import one. */
|
|
33
|
+
host?: string;
|
|
34
|
+
note?: string;
|
|
35
|
+
}
|
|
36
|
+
export type Fixture = ExpressionFixture | ProjectFixture;
|
|
37
|
+
export type Profile = "full" | "data-host";
|
|
38
|
+
/**
|
|
39
|
+
* The profiles a fixture is judged in (F-Profile, #78). Explicit
|
|
40
|
+
* `"profiles"` wins. Otherwise: a fixture that names a host, asserts J3's
|
|
41
|
+
* tentative verdicts or taint edges, or constructs with `new` needs the
|
|
42
|
+
* runtime, so it is `full` only; anything else is data and belongs to both.
|
|
43
|
+
*/
|
|
44
|
+
export declare function profilesOf(f: Fixture, explicit?: string[]): Profile[];
|
|
45
|
+
/** Kept as the name the expression-only callers import; `kind` narrows. */
|
|
46
|
+
export declare const expressionFixtures: (all: Fixture[]) => ExpressionFixture[];
|
|
47
|
+
export declare const projectFixtures: (all: Fixture[]) => ProjectFixture[];
|
|
48
|
+
export declare function loadFixtures(root: string): Fixture[];
|
|
49
|
+
//# sourceMappingURL=fixture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../src/fixture.ts"],"names":[],"mappings":"AAmCA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IACvC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IACpC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IACjD,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CAC7E;AACD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzC,6EAA6E;IAC7E,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,uGAAuG;IACvG,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AACD,MAAM,MAAM,OAAO,GAAG,iBAAiB,GAAG,cAAc,CAAC;AAEzD,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAMrE;AAED,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,GAAI,KAAK,OAAO,EAAE,KAAG,iBAAiB,EAAwE,CAAC;AAC9I,eAAO,MAAM,eAAe,GAAI,KAAK,OAAO,EAAE,KAAG,cAAc,EAAkE,CAAC;AAelI,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAsBpD"}
|
package/dist/fixture.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixture format (#7, extended for projects by #24). A directory per fixture
|
|
3
|
+
* under spec/fixtures/<Rule>/<name>/. Two kinds, told apart by what the
|
|
4
|
+
* directory contains.
|
|
5
|
+
*
|
|
6
|
+
* An *expression* fixture judges one export of one file:
|
|
7
|
+
* input.ts — the module under test
|
|
8
|
+
* expect.json — { "rules": ["S-Template", "F-Eval-Template"], // identifiers this fixture exercises (#8 gate)
|
|
9
|
+
* "export": "x", // which export is judged
|
|
10
|
+
* "shape": "accept" | "reject", // S-* verdict
|
|
11
|
+
* "fold": "fold" | "run", // F-* verdict
|
|
12
|
+
* "value": <json> | "$undefined", // required when fold = "fold"; the sentinel, at the top or nested, means the fold yields undefined there, which JSON cannot write (#82)
|
|
13
|
+
* "rejectAt": { "line": n, "column": n }, // optional, when fold = "run": where the rejection must point
|
|
14
|
+
* "note": "why this fixture exists" }
|
|
15
|
+
*
|
|
16
|
+
* A *project* fixture judges every file of a small build, which is what J3
|
|
17
|
+
* needs: a taint edge cannot be seen in one file.
|
|
18
|
+
* project/ — the build's source, one or more .ts files, nested allowed
|
|
19
|
+
* expect.json — { "rules": ["F-Seed", "F-Succ"],
|
|
20
|
+
* "project": true,
|
|
21
|
+
* "verdicts": { "app.ts": "run", "config.ts": "run" }, // final, after J3
|
|
22
|
+
* "tentative": { "config.ts": "fold" }, // optional, J2 before J3 disposed
|
|
23
|
+
* "taintedBy": { "config.ts": "app.ts" }, // optional, the file whose taint reached it
|
|
24
|
+
* "exports": { "config.ts": { "port": 8080 } }, // optional, for files that finally fold
|
|
25
|
+
* "rejectRule": { "app.ts": "F-Eval-CallLocal" }, // optional, the rule a run verdict must name; checked when the adapter reports one
|
|
26
|
+
* "host": "shapes", // optional, a named host from host.ts; required if the sources import one
|
|
27
|
+
* "profiles": ["full"], // optional; see profilesOf for the default
|
|
28
|
+
* "note": "why this fixture exists" }
|
|
29
|
+
* `tentative` and `taintedBy` are what separate "folds because nothing
|
|
30
|
+
* reached it" from "would have folded, and an edge killed it" — without them
|
|
31
|
+
* a project fixture cannot tell F-Seed from F-Taint.
|
|
32
|
+
*/
|
|
33
|
+
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
34
|
+
import { join, relative } from "node:path";
|
|
35
|
+
/**
|
|
36
|
+
* The profiles a fixture is judged in (F-Profile, #78). Explicit
|
|
37
|
+
* `"profiles"` wins. Otherwise: a fixture that names a host, asserts J3's
|
|
38
|
+
* tentative verdicts or taint edges, or constructs with `new` needs the
|
|
39
|
+
* runtime, so it is `full` only; anything else is data and belongs to both.
|
|
40
|
+
*/
|
|
41
|
+
export function profilesOf(f, explicit) {
|
|
42
|
+
if (explicit)
|
|
43
|
+
return explicit;
|
|
44
|
+
const sources = f.kind === "expression" ? [f.input] : [...f.files.values()];
|
|
45
|
+
const usesNew = sources.some((s) => /\bnew\s+[A-Za-z_$]/.test(s));
|
|
46
|
+
if (f.kind === "project" && (f.host || f.tentative || f.taintedBy))
|
|
47
|
+
return ["full"];
|
|
48
|
+
return usesNew ? ["full"] : ["full", "data-host"];
|
|
49
|
+
}
|
|
50
|
+
/** Kept as the name the expression-only callers import; `kind` narrows. */
|
|
51
|
+
export const expressionFixtures = (all) => all.filter((f) => f.kind === "expression");
|
|
52
|
+
export const projectFixtures = (all) => all.filter((f) => f.kind === "project");
|
|
53
|
+
function readProject(dir) {
|
|
54
|
+
const files = new Map();
|
|
55
|
+
const walk = (d) => {
|
|
56
|
+
for (const name of readdirSync(d)) {
|
|
57
|
+
const p = join(d, name);
|
|
58
|
+
if (statSync(p).isDirectory())
|
|
59
|
+
walk(p);
|
|
60
|
+
else if (name.endsWith(".ts"))
|
|
61
|
+
files.set(relative(dir, p).split(/[\\/]/).join("/"), readFileSync(p, "utf8"));
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
walk(dir);
|
|
65
|
+
return files;
|
|
66
|
+
}
|
|
67
|
+
export function loadFixtures(root) {
|
|
68
|
+
const out = [];
|
|
69
|
+
for (const rule of readdirSync(root)) {
|
|
70
|
+
const rd = join(root, rule);
|
|
71
|
+
if (!statSync(rd).isDirectory())
|
|
72
|
+
continue;
|
|
73
|
+
for (const name of readdirSync(rd)) {
|
|
74
|
+
const d = join(rd, name);
|
|
75
|
+
if (!statSync(d).isDirectory())
|
|
76
|
+
continue;
|
|
77
|
+
const e = JSON.parse(readFileSync(join(d, "expect.json"), "utf8"));
|
|
78
|
+
const id = `${rule}/${name}`;
|
|
79
|
+
if (e.project) {
|
|
80
|
+
const fx = { kind: "project", id, dir: d, rules: e.rules, files: readProject(join(d, "project")), profiles: [],
|
|
81
|
+
verdicts: e.verdicts, tentative: e.tentative, taintedBy: e.taintedBy, exports: e.exports, rejectRule: e.rejectRule, host: e.host, note: e.note };
|
|
82
|
+
fx.profiles = profilesOf(fx, e.profiles);
|
|
83
|
+
out.push(fx);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const fx = { kind: "expression", id, dir: d, input: readFileSync(join(d, "input.ts"), "utf8"), profiles: [],
|
|
87
|
+
rules: e.rules, exportName: e.export, shape: e.shape, fold: e.fold, value: e.value, rejectAt: e.rejectAt, note: e.note };
|
|
88
|
+
fx.profiles = profilesOf(fx, e.profiles);
|
|
89
|
+
out.push(fx);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture.js","sourceRoot":"","sources":["../src/fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AA8B3C;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,CAAU,EAAE,QAAmB;IACxD,IAAI,QAAQ;QAAE,OAAO,QAAqB,CAAC;IAC3C,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5E,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,SAAS,CAAC;QAAE,O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AAC,CAAC;gBACzC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,CAAC;iBAAM,CAAC;gBACN,MAAM,EAAE,GAAsB,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE;oBAC5H,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;gBAC3H,EAAE,CAAC,QAAQ,GAAG,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;gBACzC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/host.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Named hosts a fixture may ask for (#61). A fixture is data — `.ts` sources
|
|
3
|
+
* and a JSON expectation — and F-Host-Interface item 1 requires real classes
|
|
4
|
+
* that revival can construct, so the classes live here, in code, and a fixture
|
|
5
|
+
* names the host it wants.
|
|
6
|
+
*
|
|
7
|
+
* Neutral by construction: nothing here imports an implementation. An adapter
|
|
8
|
+
* translates a `ConformanceHost` into whatever its own host interface is.
|
|
9
|
+
*/
|
|
10
|
+
/** An intrinsic registration, F-Host-Registry's shape. */
|
|
11
|
+
export interface HostIntrinsic {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly isTag: boolean;
|
|
14
|
+
readonly foldsAsCall?: boolean;
|
|
15
|
+
readonly foldsEagerly?: boolean;
|
|
16
|
+
readonly outputKey?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ConformanceHost {
|
|
19
|
+
readonly name: string;
|
|
20
|
+
/** F-Host-Trust arm 1: the specifiers this host owns. */
|
|
21
|
+
readonly ownedSpecifierPrefixes: readonly string[];
|
|
22
|
+
readonly intrinsics: readonly HostIntrinsic[];
|
|
23
|
+
readonly helpers: readonly {
|
|
24
|
+
name: string;
|
|
25
|
+
module: string;
|
|
26
|
+
note: string;
|
|
27
|
+
}[];
|
|
28
|
+
/** Specifier, then export name, to the real value. Revival calls these (F-Val-Fate). */
|
|
29
|
+
readonly values: ReadonlyMap<string, ReadonlyMap<string, unknown>>;
|
|
30
|
+
}
|
|
31
|
+
export declare const HOSTS: ReadonlyMap<string, ConformanceHost>;
|
|
32
|
+
export declare function requireHost(name: string): ConformanceHost;
|
|
33
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,0DAA0D;AAC1D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,sBAAsB,EAAE,SAAS,MAAM,EAAE,CAAC;IACnD,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5E,wFAAwF;IACxF,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACpE;AAuED,eAAO,MAAM,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAoC,CAAC;AAE5F,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAIzD"}
|
package/dist/host.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Named hosts a fixture may ask for (#61). A fixture is data — `.ts` sources
|
|
3
|
+
* and a JSON expectation — and F-Host-Interface item 1 requires real classes
|
|
4
|
+
* that revival can construct, so the classes live here, in code, and a fixture
|
|
5
|
+
* names the host it wants.
|
|
6
|
+
*
|
|
7
|
+
* Neutral by construction: nothing here imports an implementation. An adapter
|
|
8
|
+
* translates a `ConformanceHost` into whatever its own host interface is.
|
|
9
|
+
*/
|
|
10
|
+
const DECLARABLE = Symbol.for("tsad.conformance.declarable");
|
|
11
|
+
/** F-Host-Interface item 1's shape: `new (props, attributes?)`, carrying the markers an entity carries. */
|
|
12
|
+
class Bucket {
|
|
13
|
+
entityType = "Bucket";
|
|
14
|
+
lexicon = "shapes";
|
|
15
|
+
props;
|
|
16
|
+
attributes;
|
|
17
|
+
constructor(props = {}, attributes = {}) {
|
|
18
|
+
this.props = props;
|
|
19
|
+
this.attributes = attributes;
|
|
20
|
+
Object.defineProperty(this, DECLARABLE, { value: true, enumerable: false });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** Spread-`args` arity, the other arm of F-Val-Arity. */
|
|
24
|
+
class Pair {
|
|
25
|
+
left;
|
|
26
|
+
right;
|
|
27
|
+
entityType = "Pair";
|
|
28
|
+
lexicon = "shapes";
|
|
29
|
+
constructor(left, right) {
|
|
30
|
+
this.left = left;
|
|
31
|
+
this.right = right;
|
|
32
|
+
Object.defineProperty(this, DECLARABLE, { value: true, enumerable: false });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** A live object the host owns outright, for the F-CallLeak case: no construction involved. */
|
|
36
|
+
const registry = new Map([["one", "1"]]);
|
|
37
|
+
/** An intrinsic in tag form: revival invokes it as `Name(strings, ...values)`. */
|
|
38
|
+
const join = (strings, ...values) => strings.reduce((acc, s, i) => acc + s + (i < values.length ? String(values[i]) : ""), "");
|
|
39
|
+
/** An authoring helper: pure, deterministic, the same at fold time as at run time. */
|
|
40
|
+
const upper = (s) => s.toUpperCase();
|
|
41
|
+
/** An intrinsic in call form (F-Host-Registry `foldsAsCall`): revival invokes it with the folded arguments. */
|
|
42
|
+
const ref = (name) => ({ Ref: name });
|
|
43
|
+
/** An eager intrinsic (`foldsEagerly`): evaluated at fold time, and F-Host-Admission's third clause holds because it is a pure function of its arguments. */
|
|
44
|
+
const count = (items) => items.length;
|
|
45
|
+
/** A plain-data export (F-Host-DataExports): folds as a value through a named import. */
|
|
46
|
+
const SIZES = { small: 1, large: 3 };
|
|
47
|
+
const SHAPES = {
|
|
48
|
+
name: "shapes",
|
|
49
|
+
ownedSpecifierPrefixes: ["@tsad/shapes"],
|
|
50
|
+
intrinsics: [
|
|
51
|
+
{ name: "join", isTag: true },
|
|
52
|
+
{ name: "ref", isTag: false, foldsAsCall: true },
|
|
53
|
+
{ name: "count", isTag: false, foldsEagerly: true },
|
|
54
|
+
],
|
|
55
|
+
helpers: [{ name: "upper", module: "@tsad/shapes", note: "pure string transform, no environment read" }],
|
|
56
|
+
values: new Map([
|
|
57
|
+
[
|
|
58
|
+
"@tsad/shapes",
|
|
59
|
+
new Map([
|
|
60
|
+
["Bucket", Bucket],
|
|
61
|
+
["Pair", Pair],
|
|
62
|
+
["join", join],
|
|
63
|
+
["upper", upper],
|
|
64
|
+
["ref", ref],
|
|
65
|
+
["count", count],
|
|
66
|
+
["SIZES", SIZES],
|
|
67
|
+
["registry", registry],
|
|
68
|
+
]),
|
|
69
|
+
],
|
|
70
|
+
]),
|
|
71
|
+
};
|
|
72
|
+
export const HOSTS = new Map([[SHAPES.name, SHAPES]]);
|
|
73
|
+
export function requireHost(name) {
|
|
74
|
+
const h = HOSTS.get(name);
|
|
75
|
+
if (!h)
|
|
76
|
+
throw new Error(`no such conformance host: ${name}. Known: ${[...HOSTS.keys()].join(", ")}`);
|
|
77
|
+
return h;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=host.js.map
|
package/dist/host.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAqBH,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;AAE7D,2GAA2G;AAC3G,MAAM,MAAM;IACD,UAAU,GAAG,QAAQ,CAAC;IACtB,OAAO,GAAG,QAAQ,CAAC;IACnB,KAAK,CAA0B;IAC/B,UAAU,CAA0B;IAC7C,YAAY,QAAiC,EAAE,EAAE,aAAsC,EAAE;QACvF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9E,CAAC;CACF;AAED,yDAAyD;AACzD,MAAM,IAAI;IAGa;IAAwB;IAFpC,UAAU,GAAG,MAAM,CAAC;IACpB,OAAO,GAAG,QAAQ,CAAC;IAC5B,YAAqB,IAAa,EAAW,KAAc;QAAtC,SAAI,GAAJ,IAAI,CAAS;QAAW,UAAK,GAAL,KAAK,CAAS;QACzD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU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,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
package/dist/rules.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** The five files that define rules, in reading order. The same list `spec/fixtures.test.ts` gates on. */
|
|
2
|
+
export declare const RULE_FILES: readonly ["grammar.md", "judgments.md", "values.md", "divergence.md", "hosts.md", "rules.md"];
|
|
3
|
+
export interface Rule {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly file: string;
|
|
6
|
+
/** The rule's normative text: from its definition to the next definition or heading, whitespace collapsed. */
|
|
7
|
+
readonly text: string;
|
|
8
|
+
}
|
|
9
|
+
/** Every rule the specification defines, with its text. `specDir` holds the rule files and `VERSION`. */
|
|
10
|
+
export declare function loadRules(specDir: string): {
|
|
11
|
+
version: string;
|
|
12
|
+
rules: Map<string, Rule>;
|
|
13
|
+
};
|
|
14
|
+
export type CitationFinding = {
|
|
15
|
+
kind: "unknown-identifier";
|
|
16
|
+
id: string;
|
|
17
|
+
line: number;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "quote-not-in-rule";
|
|
20
|
+
id: string;
|
|
21
|
+
line: number;
|
|
22
|
+
quote: string;
|
|
23
|
+
} | {
|
|
24
|
+
kind: "marker-without-quote";
|
|
25
|
+
id: string;
|
|
26
|
+
line: number;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "version-mismatch";
|
|
29
|
+
declared: string;
|
|
30
|
+
spec: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Check one document's citations against the rule index.
|
|
34
|
+
*
|
|
35
|
+
* @param declared the specification version the document's implementation
|
|
36
|
+
* declares, compared against the index's; `undefined` skips the comparison
|
|
37
|
+
* and is reported as nothing, since an undeclared version is #18's concern
|
|
38
|
+
* and not this gate's.
|
|
39
|
+
*/
|
|
40
|
+
export declare function checkCitations(document: string, index: {
|
|
41
|
+
version: string;
|
|
42
|
+
rules: ReadonlyMap<string, Rule>;
|
|
43
|
+
}, declared?: string): CitationFinding[];
|
|
44
|
+
/** One line per finding, for a test's failure message. */
|
|
45
|
+
export declare function describeFinding(f: CitationFinding): string;
|
|
46
|
+
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AA8BA,0GAA0G;AAC1G,eAAO,MAAM,UAAU,+FAAgG,CAAC;AAExH,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8GAA8G;IAC9G,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAWD,yGAAyG;AACzG,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;CAAE,CAwBxF;AAED,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACtE;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,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