@fougere/compiler 0.9.3-alpha.0 → 0.11.0-alpha.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/boot.d.ts.map +1 -1
- package/dist/boot.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/scan/Aliases.d.ts +16 -0
- package/dist/scan/Aliases.d.ts.map +1 -0
- package/dist/scan/Aliases.js +2 -0
- package/dist/scan/Aliases.js.map +1 -0
- package/dist/scan/FacadeOptions.d.ts +5 -0
- package/dist/scan/FacadeOptions.d.ts.map +1 -0
- package/dist/scan/FacadeOptions.js +2 -0
- package/dist/scan/FacadeOptions.js.map +1 -0
- package/dist/scan/{contract.d.ts → Live.d.ts} +2 -16
- package/dist/scan/Live.d.ts.map +1 -0
- package/dist/scan/{contract.js → Live.js} +5 -1
- package/dist/scan/Live.js.map +1 -0
- package/dist/scan/Served.d.ts +47 -0
- package/dist/scan/Served.d.ts.map +1 -0
- package/dist/scan/Served.js +111 -0
- package/dist/scan/Served.js.map +1 -0
- package/dist/scan/emit.d.ts.map +1 -1
- package/dist/scan/emit.js +1 -1
- package/dist/scan/emit.js.map +1 -1
- package/dist/scan/handler-parser.d.ts +8 -0
- package/dist/scan/handler-parser.d.ts.map +1 -1
- package/dist/scan/handler-parser.js +24 -6
- package/dist/scan/handler-parser.js.map +1 -1
- package/dist/scan/names.d.ts +7 -0
- package/dist/scan/names.d.ts.map +1 -0
- package/dist/scan/names.js +93 -0
- package/dist/scan/names.js.map +1 -0
- package/dist/scan/refusals.d.ts +33 -0
- package/dist/scan/refusals.d.ts.map +1 -0
- package/dist/scan/refusals.js +118 -0
- package/dist/scan/refusals.js.map +1 -0
- package/dist/scan/scanner.d.ts.map +1 -1
- package/dist/scan/scanner.js +38 -3
- package/dist/scan/scanner.js.map +1 -1
- package/dist/scan/statement.d.ts.map +1 -1
- package/dist/scan/statement.js +1 -1
- package/dist/scan/statement.js.map +1 -1
- package/package.json +6 -6
- package/src/boot.ts +1 -1
- package/src/index.ts +3 -0
- package/src/scan/Aliases.ts +16 -0
- package/src/scan/FacadeOptions.ts +4 -0
- package/src/scan/{contract.ts → Live.ts} +4 -16
- package/src/scan/Served.ts +135 -0
- package/src/scan/emit.ts +2 -1
- package/src/scan/handler-parser.ts +34 -7
- package/src/scan/names.ts +101 -0
- package/src/scan/refusals.ts +167 -0
- package/src/scan/scanner.ts +49 -7
- package/src/scan/statement.ts +2 -1
- package/dist/scan/contract.d.ts.map +0 -1
- package/dist/scan/contract.js.map +0 -1
package/dist/boot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,GAAG,EAAE,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAIpJ,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,UAAU,WAAW;IACnB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,mCAAmC;IACnC,eAAe,EAAE,MAAM,SAAS,CAAC;IACjC,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,8EAA8E;IAC9E,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,CAAC;IAC7C,qDAAqD;IACrD,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpC;;;OAGG;IACH,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK;QAC9B,EAAE,CAAC,EAAE,OAAO,CAAC;QACb,cAAc,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;QACnD,8FAA8F;QAC9F,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAC7C,oFAAoF;QACpF,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KAC7B,CAAC;IACF;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC;CACjD;AAED,iDAAiD;AACjD,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAwD7D"}
|
package/dist/boot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot.js","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"boot.js","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAuF,MAAM,eAAe,CAAC;AACpJ,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAyChD,iDAAiD;AACjD,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAoB;IAC7C,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IACpC,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAE/B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI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ACrF,SAAS,EAAE,OAAO,EAAE,KAAK;QACzB,wFAAwF;QACxF,8EAA8E;QAC9E,OAAO,EAAE,OAAO,EAAE,OAAO;QACzB,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;QACpC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,eAAe,EAAE,OAAO,CAAC,eAAe;KACzC,CAAC,CAAC;IAEH,GAAG,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC;IAE1E,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACtD,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,CAAC,MAAM,CAAC,MAAM,WAAW,CAAC,CAAC;IAE7D,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export { scanProject, frondAliases, watchPathsOf } from './scan/scanner.js';
|
|
|
4
4
|
export { RUNTIME_PACKAGES } from './scan/bundling.js';
|
|
5
5
|
export { emitScan } from './scan/emit.js';
|
|
6
6
|
export { emitStatement } from './scan/statement.js';
|
|
7
|
+
export { emitFacade, facadeModule, type Served } from './scan/Served.js';
|
|
8
|
+
export { emitNames, type NamesOptions } from './scan/names.js';
|
|
7
9
|
export { adaptersOf } from './scan/adapters.js';
|
|
8
10
|
export { crossFrondImports } from './imports.js';
|
|
9
11
|
export { handlerDeclarations } from './declarations.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,uFAAuF;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,9 @@ export { scanProject, frondAliases, watchPathsOf } from './scan/scanner.js';
|
|
|
4
4
|
export { RUNTIME_PACKAGES } from './scan/bundling.js';
|
|
5
5
|
export { emitScan } from './scan/emit.js';
|
|
6
6
|
export { emitStatement } from './scan/statement.js';
|
|
7
|
+
// The third projection of one scan: the facades as TYPES, so a client can narrow a refusal.
|
|
8
|
+
export { emitFacade, facadeModule } from './scan/Served.js';
|
|
9
|
+
export { emitNames } from './scan/names.js';
|
|
7
10
|
export { adaptersOf } from './scan/adapters.js';
|
|
8
11
|
export { crossFrondImports } from './imports.js';
|
|
9
12
|
export { handlerDeclarations } from './declarations.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,4FAA4F;AAC5F,OAAO,EAAE,UAAU,EAAE,YAAY,EAAe,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAqB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Live } from './Live.js';
|
|
2
|
+
/**
|
|
3
|
+
* What the writer needs of an emitter's imports, and nothing more.
|
|
4
|
+
*
|
|
5
|
+
* The two emitters index theirs differently — one by value against a relative path, one
|
|
6
|
+
* by file against the package specifier a project already uses — and neither is wrong for
|
|
7
|
+
* the module it writes. What they agree on is this: a value already imported has an
|
|
8
|
+
* alias, a class can be imported by name, and an entity can be found by its class name.
|
|
9
|
+
*/
|
|
10
|
+
export interface Aliases {
|
|
11
|
+
aliasOf(value: Live): string | undefined;
|
|
12
|
+
named(value: Live, filePath: string, name: string): string;
|
|
13
|
+
/** The entity class this name belongs to — what a `Partial<X>` names as its source. */
|
|
14
|
+
classNamed(name: string): Live | undefined;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=Aliases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Aliases.d.ts","sourceRoot":"","sources":["../../src/scan/Aliases.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACtB,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IACzC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3D,uFAAuF;IACvF,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Aliases.js","sourceRoot":"","sources":["../../src/scan/Aliases.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FacadeOptions.d.ts","sourceRoot":"","sources":["../../src/scan/FacadeOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,qFAAqF;IACrF,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FacadeOptions.js","sourceRoot":"","sources":["../../src/scan/FacadeOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
/** An operation contract, written down — the half two emitters say the same way. */
|
|
2
1
|
import { type OperationContract } from '@fougere/core/descriptor';
|
|
3
2
|
import { type SchemaView } from '@fougere/schema';
|
|
3
|
+
import type { Aliases } from './Aliases.js';
|
|
4
4
|
/** A value that ends up as an import in the module being written. */
|
|
5
5
|
export type Live = object;
|
|
6
|
-
/**
|
|
7
|
-
* What the writer needs of an emitter's imports, and nothing more.
|
|
8
|
-
*
|
|
9
|
-
* The two emitters index theirs differently — one by value against a relative path, one
|
|
10
|
-
* by file against the package specifier a project already uses — and neither is wrong for
|
|
11
|
-
* the module it writes. What they agree on is this: a value already imported has an
|
|
12
|
-
* alias, a class can be imported by name, and an entity can be found by its class name.
|
|
13
|
-
*/
|
|
14
|
-
export interface Aliases {
|
|
15
|
-
aliasOf(value: Live): string | undefined;
|
|
16
|
-
named(value: Live, filePath: string, name: string): string;
|
|
17
|
-
/** The entity class this name belongs to — what a `Partial<X>` names as its source. */
|
|
18
|
-
classNamed(name: string): Live | undefined;
|
|
19
|
-
}
|
|
20
6
|
export declare const lit: (value: unknown) => string;
|
|
21
7
|
/** What a schema slot becomes in the generated module. */
|
|
22
8
|
export declare function schemaRef(schema: SchemaView | undefined, declaredIn: string, imports: Aliases): string | undefined;
|
|
@@ -24,4 +10,4 @@ export declare function schemaRef(schema: SchemaView | undefined, declaredIn: st
|
|
|
24
10
|
export declare function contractOf(op: string, contract: OperationContract, declaredIn: string, imports: Aliases): string;
|
|
25
11
|
/** The operations of one handler, as the Map its reader builds. */
|
|
26
12
|
export declare function operationsOf(operations: ReadonlyMap<string, OperationContract>, declaredIn: string, imports: Aliases, indent: string): string;
|
|
27
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=Live.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Live.d.ts","sourceRoot":"","sources":["../../src/scan/Live.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAA+B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,qEAAqE;AACrE,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAE1B,eAAO,MAAM,GAAG,UAAW,OAAO,KAAG,MAAuC,CAAC;AAE7E,0DAA0D;AAC1D,wBAAgB,SAAS,CACvB,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,GACf,MAAM,GAAG,SAAS,CAiBpB;AAED,+DAA+D;AAC/D,wBAAgB,UAAU,CACxB,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,iBAAiB,EAC3B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,GACf,MAAM,CAeR;AAED,mEAAmE;AACnE,wBAAgB,YAAY,CAC1B,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAClD,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACb,MAAM,CAIR"}
|
|
@@ -35,6 +35,10 @@ export function contractOf(op, contract, declaredIn, imports) {
|
|
|
35
35
|
parts.push(`cardinality: ${lit(contract.cardinality)}`);
|
|
36
36
|
if (contract.signature !== undefined)
|
|
37
37
|
parts.push(`signature: ${lit(contract.signature)}`);
|
|
38
|
+
// Written down like every other member: a scan on disk is what an edge deployment reads, and
|
|
39
|
+
// a contract that loses a field there answers differently depending on how it was booted.
|
|
40
|
+
if (contract.errors !== undefined)
|
|
41
|
+
parts.push(`errors: ${lit(contract.errors)}`);
|
|
38
42
|
return `[${lit(op)}, { ${parts.join(', ')} }]`;
|
|
39
43
|
}
|
|
40
44
|
/** The operations of one handler, as the Map its reader builds. */
|
|
@@ -42,4 +46,4 @@ export function operationsOf(operations, declaredIn, imports, indent) {
|
|
|
42
46
|
const ops = [...operations].map((entry) => contractOf(entry[0], entry[1], declaredIn, imports));
|
|
43
47
|
return `new Map([\n${indent} ${ops.join(`,\n${indent} `)}\n${indent}])`;
|
|
44
48
|
}
|
|
45
|
-
//# sourceMappingURL=
|
|
49
|
+
//# sourceMappingURL=Live.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Live.js","sourceRoot":"","sources":["../../src/scan/Live.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAmB,MAAM,iBAAiB,CAAC;AAM/E,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,KAAc,EAAU,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;AAE7E,0DAA0D;AAC1D,MAAM,UAAU,SAAS,CACvB,MAA8B,EAC9B,UAAkB,EAClB,OAAgB;IAEhB,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAc,CAAC,CAAC;IAC9C,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IAExB,MAAM,IAAI,GAAI,MAA4B,CAAC,IAAI,CAAC;IAChD,IAAI,IAAI,IAAI,IAAI,KAAK,qBAAqB;QAAE,OAAO,OAAO,CAA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,CAAC,EAAE,CAAC,CAAC;IAChG,IAAI,QAAQ,CAAC,WAAW,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAChG,IAAI,QAAQ,CAAC,SAAS,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,cAAc,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC1F,6FAA6F;IAC7F,0FAA0F;IAC1F,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAEjF,OAAO,IAAI,GAAG,CAAC,EAAE,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;AACjD,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,YAAY,CAC1B,UAAkD,EAClD,UAAkB,EAClB,OAAgB,EAChB,MAAc;IAEd,MAAM,GAAG,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;IAEhG,OAAO,cAAc,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type ScanResult } from '@fougere/core';
|
|
2
|
+
import type { FacadeOptions } from './FacadeOptions.js';
|
|
3
|
+
/**
|
|
4
|
+
* An augmentation of `FougereOperations`, keyed the way a facade is ADDRESSED — `post.publish`, and
|
|
5
|
+
* `public:post.publish` for a named surface.
|
|
6
|
+
*
|
|
7
|
+
* It AUGMENTS rather than declares, so a page reaches the keys through the package it already
|
|
8
|
+
* imports: `useQuery('checkout', 'pay')` narrows against them without naming this file. The
|
|
9
|
+
* interface it fills is empty in `@fougere/core/contract` — the facade is addressed the same way
|
|
10
|
+
* on both sides of the wire, and a backend project builds without a front-end package.
|
|
11
|
+
*
|
|
12
|
+
* The prefix is `facadeKeyOf`'s own spelling, because it is the same distinction: a surface is a
|
|
13
|
+
* second facade in front of the same handler, serving a subset of its operations. What each op can
|
|
14
|
+
* refuse does not change with the surface — the code that throws is the same — but WHICH ops
|
|
15
|
+
* exist does, and a client pointed at `/_fougere/call/public` must not be offered the rest.
|
|
16
|
+
*
|
|
17
|
+
* A browser reaches the default surface unless it is handed another endpoint, which is why the
|
|
18
|
+
* unprefixed keys are the ones a composable narrows against.
|
|
19
|
+
*/
|
|
20
|
+
export declare function emitFacade(scan: ScanResult, options: FacadeOptions): string;
|
|
21
|
+
/** One address, who answers there, and what each of its operations can refuse. */
|
|
22
|
+
export interface Served {
|
|
23
|
+
at: string;
|
|
24
|
+
/**
|
|
25
|
+
* The TYPE EXPRESSION the handler is reached by, whole — `import('./x.js').default` for a
|
|
26
|
+
* scanned class, `import('./x.js').PostHandler` for the synthetic interface `sync` writes.
|
|
27
|
+
*
|
|
28
|
+
* The expression and not a specifier: a scan's handler is a default export and a synced one
|
|
29
|
+
* is named, and a producer that hands over only the path leaves the reader to guess which.
|
|
30
|
+
*/
|
|
31
|
+
handler: string;
|
|
32
|
+
ops: {
|
|
33
|
+
name: string;
|
|
34
|
+
codes: string;
|
|
35
|
+
}[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The module itself — written once, from a scan or from a card.
|
|
39
|
+
*
|
|
40
|
+
* `fougere sync` has the same three facts about a frond in ANOTHER repository: the card names
|
|
41
|
+
* the addresses, the operations, and what each one refuses. What it does not have is the
|
|
42
|
+
* handler's class, so it writes a synthetic interface and points here at that instead. Two
|
|
43
|
+
* producers, one spelling — a second copy of this format would drift the day one gained a
|
|
44
|
+
* member.
|
|
45
|
+
*/
|
|
46
|
+
export declare function facadeModule(served: readonly Served[], source: string): string;
|
|
47
|
+
//# sourceMappingURL=Served.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Served.d.ts","sourceRoot":"","sources":["../../src/scan/Served.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAgCxD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAmB3E;AAED,kFAAkF;AAClF,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAsC9E"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { dirname, relative } from 'node:path';
|
|
2
|
+
import { refusalsOf } from '@fougere/core';
|
|
3
|
+
import { servedSurfaces } from '@fougere/core/descriptor';
|
|
4
|
+
/**
|
|
5
|
+
* The specifier a handler is reached by, from where the generated file sits.
|
|
6
|
+
*
|
|
7
|
+
* The type is written WITHOUT `typeof`: that names the CONSTRUCTOR, whose `keyof` is
|
|
8
|
+
* `'prototype'`, and every operation would fail to compile against it.
|
|
9
|
+
*/
|
|
10
|
+
function specifierOf(filePath, outFile) {
|
|
11
|
+
const path = relative(dirname(outFile), filePath).replace(/\.tsx?$/, '.js');
|
|
12
|
+
return path.startsWith('.') ? path : `./${path}`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A union of enum MEMBERS — BOTH halves of what a call can come back refusing.
|
|
16
|
+
*
|
|
17
|
+
* `refusalsOf` is core's own table, read here rather than restated: what an op declares is
|
|
18
|
+
* walked from its throw sites, and what the framework adds follows from `kind` and `input`.
|
|
19
|
+
* Writing only the first half would tell a page that an op refuses nothing, when every op can
|
|
20
|
+
* meet a draining facade.
|
|
21
|
+
*
|
|
22
|
+
* `ErrorCode` is a string enum, so `'CONFLICT'` is not assignable to it — a literal would read
|
|
23
|
+
* as the right thing and refuse to narrow `FougereError<Code>`, which is the whole point.
|
|
24
|
+
*/
|
|
25
|
+
function codesOf(contract) {
|
|
26
|
+
const codes = refusalsOf(contract);
|
|
27
|
+
if (codes.length === 0)
|
|
28
|
+
return 'never';
|
|
29
|
+
return codes.map((code) => `ErrorCode.${code}`).join(' | ');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* An augmentation of `FougereOperations`, keyed the way a facade is ADDRESSED — `post.publish`, and
|
|
33
|
+
* `public:post.publish` for a named surface.
|
|
34
|
+
*
|
|
35
|
+
* It AUGMENTS rather than declares, so a page reaches the keys through the package it already
|
|
36
|
+
* imports: `useQuery('checkout', 'pay')` narrows against them without naming this file. The
|
|
37
|
+
* interface it fills is empty in `@fougere/core/contract` — the facade is addressed the same way
|
|
38
|
+
* on both sides of the wire, and a backend project builds without a front-end package.
|
|
39
|
+
*
|
|
40
|
+
* The prefix is `facadeKeyOf`'s own spelling, because it is the same distinction: a surface is a
|
|
41
|
+
* second facade in front of the same handler, serving a subset of its operations. What each op can
|
|
42
|
+
* refuse does not change with the surface — the code that throws is the same — but WHICH ops
|
|
43
|
+
* exist does, and a client pointed at `/_fougere/call/public` must not be offered the rest.
|
|
44
|
+
*
|
|
45
|
+
* A browser reaches the default surface unless it is handed another endpoint, which is why the
|
|
46
|
+
* unprefixed keys are the ones a composable narrows against.
|
|
47
|
+
*/
|
|
48
|
+
export function emitFacade(scan, options) {
|
|
49
|
+
const served = [];
|
|
50
|
+
for (const frond of scan.fronds) {
|
|
51
|
+
for (const handler of frond.handlers) {
|
|
52
|
+
// NOT `handler.surface`: a surface is also declared in `frond.config.ts`, which names an
|
|
53
|
+
// address without opening a directory for it. `servedSurfaces` is the one reader of both,
|
|
54
|
+
// and it answers `undefined` for the default the way `facadeKeyOf` spells it.
|
|
55
|
+
for (const surface of servedSurfaces(frond, handler)) {
|
|
56
|
+
served.push({
|
|
57
|
+
at: surface ? `${surface}:${handler.address}` : handler.address,
|
|
58
|
+
handler: `import('${specifierOf(handler.filePath, options.outFile)}').default`,
|
|
59
|
+
ops: [...(handler.operations ?? [])].map(([name, contract]) => ({ name, codes: codesOf(contract) })),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return facadeModule(served, 'what the scan found');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The module itself — written once, from a scan or from a card.
|
|
68
|
+
*
|
|
69
|
+
* `fougere sync` has the same three facts about a frond in ANOTHER repository: the card names
|
|
70
|
+
* the addresses, the operations, and what each one refuses. What it does not have is the
|
|
71
|
+
* handler's class, so it writes a synthetic interface and points here at that instead. Two
|
|
72
|
+
* producers, one spelling — a second copy of this format would drift the day one gained a
|
|
73
|
+
* member.
|
|
74
|
+
*/
|
|
75
|
+
export function facadeModule(served, source) {
|
|
76
|
+
const rows = served.flatMap((one) => one.ops.map((op) => ` '${one.at}.${op.name}': { errors: ${op.codes} };`));
|
|
77
|
+
const handlers = new Map(served.map((one) => [one.at, one.handler]));
|
|
78
|
+
// A named surface shares its handler's class name, so two of them would declare one const.
|
|
79
|
+
// A browser reaches the DEFAULT surface unless it was handed another endpoint, which is the
|
|
80
|
+
// one a page names; the prefixed keys stay in `FougereOperations` for whoever reads them.
|
|
81
|
+
const facades = [...handlers].filter(([at]) => !at.includes(':')).sort();
|
|
82
|
+
return [
|
|
83
|
+
`// Generated by Fougere from ${source} — do not edit, and do not commit.`,
|
|
84
|
+
'// Rewritten whenever the app boots, so it cannot drift from the handlers it was read off.',
|
|
85
|
+
'',
|
|
86
|
+
"import type { ErrorCode, FacadeName } from '@fougere/core/contract';",
|
|
87
|
+
'',
|
|
88
|
+
"declare module '@fougere/core/contract' {",
|
|
89
|
+
' /** Every facade this app serves, and what each one refuses beyond what `kind` implies. */',
|
|
90
|
+
' interface FougereOperations {',
|
|
91
|
+
...(rows.length > 0 ? rows.sort().map((row) => ` ${row}`) : [' // This app serves no facade.']),
|
|
92
|
+
' }',
|
|
93
|
+
'',
|
|
94
|
+
' /** The class that answers at each address — its operations, and what each one answers. */',
|
|
95
|
+
' interface FougereHandlers {',
|
|
96
|
+
...[...handlers].sort().map(([at, type]) => ` '${at}': ${type};`),
|
|
97
|
+
' }',
|
|
98
|
+
'}',
|
|
99
|
+
'',
|
|
100
|
+
'// One facade per address. A page IMPORTS it, so a project that never generated this file',
|
|
101
|
+
"// fails to resolve rather than falling back to `string` in silence. The value is the",
|
|
102
|
+
'// address and nothing else: the handler is reached as a TYPE, and no server code travels.',
|
|
103
|
+
'//',
|
|
104
|
+
'// Named after the ADDRESS, never after the class: what a page holds is a facade, and calling',
|
|
105
|
+
"// it `PostHandler` would be a value claiming to be a class it is not. A page whose rows are",
|
|
106
|
+
'// already called `post` aliases it on the import, the way any other collision is settled.',
|
|
107
|
+
...facades.map(([at, type]) => `export const ${at}: FacadeName<${type}, '${at}'> = { address: '${at}' };`),
|
|
108
|
+
'',
|
|
109
|
+
].join('\n');
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=Served.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Served.js","sourceRoot":"","sources":["../../src/scan/Served.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAmB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE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9F,iCAAiC;QACjC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC;QACnG,KAAK;QACL,EAAE;QACF,8FAA8F;QAC9F,+BAA+B;QAC/B,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,CAAC;QACpE,KAAK;QACL,GAAG;QACH,EAAE;QACF,2FAA2F;QAC3F,uFAAuF;QACvF,4FAA4F;QAC5F,IAAI;QACJ,+FAA+F;QAC/F,8FAA8F;QAC9F,4FAA4F;QAC5F,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAC5B,gBAAgB,EAAE,gBAAgB,IAAI,MAAM,EAAE,oBAAoB,EAAE,MAAM,CAAC;QAC7E,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/dist/scan/emit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/scan/emit.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/scan/emit.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAOhD,MAAM,WAAW,WAAW;IAC1B,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA6GD,yBAAyB;AACzB,wBAAgB,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,GAAG,MAAM,CA4CzE"}
|
package/dist/scan/emit.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { nameOf } from '@fougere/core/descriptor';
|
|
2
2
|
import { dirname, relative } from 'node:path';
|
|
3
|
-
import { lit, operationsOf, schemaRef } from './
|
|
3
|
+
import { lit, operationsOf, schemaRef } from './Live.js';
|
|
4
4
|
/** Is a TypeScript compiler going to read this module? Its name is the only thing that says. */
|
|
5
5
|
const isTypeScript = (outFile) => /\.tsx?$/.test(outFile);
|
|
6
6
|
/** A source file becomes a specifier its reader can follow — and the two readers differ. */
|
package/dist/scan/emit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../../src/scan/emit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAiK,MAAM,0BAA0B,CAAC;AACjN,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../../src/scan/emit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAiK,MAAM,0BAA0B,CAAC;AACjN,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAG9C,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAa,MAAM,WAAW,CAAC;AASpE,gGAAgG;AAChG,MAAM,YAAY,GAAG,CAAC,OAAe,EAAW,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAE3E,4FAA4F;AAC5F,SAAS,WAAW,CAAC,QAAgB,EAAE,OAAe;IACpD,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,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1,5 +1,6 @@
|
|
|
1
1
|
/** Handler signature parser — extracts method signatures from handler source files. */
|
|
2
2
|
import { type Param, type Signature } from '@fougere/core/descriptor';
|
|
3
|
+
import { type ErrorCode } from '@fougere/core';
|
|
3
4
|
export declare function resetTypePrograms(): void;
|
|
4
5
|
/** Declare every file a run will read, so one program covers it. */
|
|
5
6
|
export declare function seedTypeProgram(filePaths: readonly string[], projectRoot?: string): Promise<void>;
|
|
@@ -14,6 +15,13 @@ export interface HandlerParse {
|
|
|
14
15
|
* binding plan. With a `projectRoot`, the heritage clause is followed too.
|
|
15
16
|
*/
|
|
16
17
|
export declare function parseAllHandlerMethods(filePath: string, projectRoot?: string): Promise<HandlerParse>;
|
|
18
|
+
/**
|
|
19
|
+
* What every operation of a file's program can refuse, walked from the refusals upward.
|
|
20
|
+
*
|
|
21
|
+
* It reads the SAME program the signatures came from, so nothing is opened twice and a
|
|
22
|
+
* dependency resolves through the checker rather than by name.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseRefusals(filePath: string, isOperation: (name: string) => boolean, projectRoot?: string): Promise<Map<string, ErrorCode[]>>;
|
|
17
25
|
/** Parse a presenter source file and extract all method signatures. */
|
|
18
26
|
export declare function parsePresenterMethods(filePath: string, projectRoot?: string): Promise<Signature[]>;
|
|
19
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler-parser.d.ts","sourceRoot":"","sources":["../../src/scan/handler-parser.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAgB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"handler-parser.d.ts","sourceRoot":"","sources":["../../src/scan/handler-parser.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAgB,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAgC/C,wBAAgB,iBAAiB,IAAI,IAAI,CAGxC;AAgFD,oEAAoE;AACpE,wBAAsB,eAAe,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBvG;AA8eD,mFAAmF;AACnF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,4EAA4E;IAC5E,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAG1G;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,EACtC,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAMnC;AAED,uEAAuE;AACvE,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAKxG;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAQrG"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { refusalsIn } from './refusals.js';
|
|
1
2
|
import { readFileSync, existsSync, statSync } from 'node:fs';
|
|
2
3
|
import { join, dirname, resolve as resolvePath } from 'node:path';
|
|
3
4
|
/** Lazy-loaded TypeScript module — avoids bundling the 9MB compiler. */
|
|
@@ -106,6 +107,7 @@ export async function seedTypeProgram(filePaths, projectRoot) {
|
|
|
106
107
|
const grouped = new Map();
|
|
107
108
|
for (const filePath of filePaths) {
|
|
108
109
|
const absolute = resolvePath(filePath);
|
|
110
|
+
const typescript = getTS();
|
|
109
111
|
const configured = compilerProjectOf(absolute, projectRoot);
|
|
110
112
|
const group = grouped.get(configured.key) ?? { options: configured.options, paths: [] };
|
|
111
113
|
group.paths.push(absolute);
|
|
@@ -118,8 +120,8 @@ export async function seedTypeProgram(filePaths, projectRoot) {
|
|
|
118
120
|
typeProjects.set(key, { roots, options, program: builtProgram(key, [...roots], options) });
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
/** The program a file belongs to, built once and widened as more files are asked for. */
|
|
124
|
+
function projectOf(filePath, projectRoot) {
|
|
123
125
|
const absolute = resolvePath(filePath);
|
|
124
126
|
const configured = compilerProjectOf(absolute, projectRoot);
|
|
125
127
|
let project = typeProjects.get(configured.key);
|
|
@@ -137,10 +139,14 @@ function checkedSourceOf(filePath, projectRoot) {
|
|
|
137
139
|
project.roots.add(absolute);
|
|
138
140
|
project.program = builtProgram(configured.key, [...project.roots], project.options);
|
|
139
141
|
}
|
|
140
|
-
|
|
142
|
+
return { program: project.program, absolute };
|
|
143
|
+
}
|
|
144
|
+
function checkedSourceOf(filePath, projectRoot) {
|
|
145
|
+
const { program, absolute } = projectOf(filePath, projectRoot);
|
|
146
|
+
const source = program.getSourceFile(absolute);
|
|
141
147
|
if (!source)
|
|
142
148
|
throw new Error(`TypeScript did not include '${absolute}' in its program.`);
|
|
143
|
-
return { source, checker:
|
|
149
|
+
return { source, checker: program.getTypeChecker() };
|
|
144
150
|
}
|
|
145
151
|
/** A file, opened. Five places read and parsed one, each spelling the same two calls. */
|
|
146
152
|
function sourceOf(filePath) {
|
|
@@ -410,7 +416,7 @@ function extractClassMethods(cls, source, skip, checker) {
|
|
|
410
416
|
// `private`/`protected` is a statement about the surface, and the AST carries it —
|
|
411
417
|
// it was read past. Every helper a handler names by intent (`mustOwn`, `readMany`,
|
|
412
418
|
// `refuse`) became a callable op: measured on the bench, `list.readMany` executed
|
|
413
|
-
// and `list.mayPublish` validated its argument. A
|
|
419
|
+
// and `list.mayPublish` validated its argument. A facade is what the author declares
|
|
414
420
|
// public, and TypeScript already has the word for it. `#name` is private too, but
|
|
415
421
|
// it is not an identifier, so it never reached here in the first place.
|
|
416
422
|
if (member.modifiers?.some((m) => m.kind === ts.SyntaxKind.PrivateKeyword || m.kind === ts.SyntaxKind.ProtectedKeyword))
|
|
@@ -465,7 +471,7 @@ function inheritedFromBase(base, checker, skip) {
|
|
|
465
471
|
if (skip.has(property.name))
|
|
466
472
|
continue;
|
|
467
473
|
// `private`/`protected` is a statement about the surface, and the declaration carries
|
|
468
|
-
// it. A
|
|
474
|
+
// it. A facade is what the author declares public.
|
|
469
475
|
const declaration = property.declarations?.[0];
|
|
470
476
|
if (declaration && typescript.canHaveModifiers(declaration)
|
|
471
477
|
&& typescript.getModifiers(declaration)?.some((m) => m.kind === typescript.SyntaxKind.PrivateKeyword
|
|
@@ -562,6 +568,18 @@ export async function parseAllHandlerMethods(filePath, projectRoot) {
|
|
|
562
568
|
await loadTS();
|
|
563
569
|
return parseClassMethods(filePath, CONSTRUCTOR_ONLY, projectRoot);
|
|
564
570
|
}
|
|
571
|
+
/**
|
|
572
|
+
* What every operation of a file's program can refuse, walked from the refusals upward.
|
|
573
|
+
*
|
|
574
|
+
* It reads the SAME program the signatures came from, so nothing is opened twice and a
|
|
575
|
+
* dependency resolves through the checker rather than by name.
|
|
576
|
+
*/
|
|
577
|
+
export async function parseRefusals(filePath, isOperation, projectRoot) {
|
|
578
|
+
const typescript = await loadTS();
|
|
579
|
+
const { program } = projectOf(filePath, projectRoot);
|
|
580
|
+
const { byMethod } = refusalsIn(typescript, program, isOperation);
|
|
581
|
+
return new Map([...byMethod].map(([method, codes]) => [method, [...codes].sort()]));
|
|
582
|
+
}
|
|
565
583
|
/** Parse a presenter source file and extract all method signatures. */
|
|
566
584
|
export async function parsePresenterMethods(filePath, projectRoot) {
|
|
567
585
|
await loadTS();
|