@fougere/core 0.8.3-alpha.0 → 0.9.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/AppLifecycle.d.ts +8 -0
- package/dist/boot/AppLifecycle.d.ts.map +1 -1
- package/dist/boot/AppLifecycle.js.map +1 -1
- package/dist/boot/Emissions.d.ts +26 -0
- package/dist/boot/Emissions.d.ts.map +1 -1
- package/dist/boot/Emissions.js +144 -9
- package/dist/boot/Emissions.js.map +1 -1
- package/dist/boot/auth.d.ts +1 -1
- package/dist/boot/auth.d.ts.map +1 -1
- package/dist/boot/bootstrap.d.ts.map +1 -1
- package/dist/boot/bootstrap.js +401 -598
- package/dist/boot/bootstrap.js.map +1 -1
- package/dist/boot/card.js +1 -1
- package/dist/boot/card.js.map +1 -1
- package/dist/boot/hosted.d.ts +1 -1
- package/dist/boot/hosted.d.ts.map +1 -1
- package/dist/boot/hosted.js +1 -0
- package/dist/boot/hosted.js.map +1 -1
- package/dist/boot/install.d.ts +42 -0
- package/dist/boot/install.d.ts.map +1 -0
- package/dist/boot/install.js +327 -0
- package/dist/boot/install.js.map +1 -0
- package/dist/boot/ownership.d.ts +1 -1
- package/dist/boot/ownership.d.ts.map +1 -1
- package/dist/boot/ownership.js +14 -1
- package/dist/boot/ownership.js.map +1 -1
- package/dist/boot/ports.d.ts +12 -3
- package/dist/boot/ports.d.ts.map +1 -1
- package/dist/boot/ports.js +51 -21
- package/dist/boot/ports.js.map +1 -1
- package/dist/boot/remote.d.ts.map +1 -1
- package/dist/boot/remote.js +3 -3
- package/dist/boot/remote.js.map +1 -1
- package/dist/boot/seed.d.ts +7 -1
- package/dist/boot/seed.d.ts.map +1 -1
- package/dist/boot/seed.js +7 -2
- package/dist/boot/seed.js.map +1 -1
- package/dist/boot/statement-drift.d.ts +1 -1
- package/dist/boot/statement-drift.d.ts.map +1 -1
- package/dist/boot/together.d.ts +1 -1
- package/dist/boot/together.d.ts.map +1 -1
- package/dist/boot/together.js +1 -1
- package/dist/boot/together.js.map +1 -1
- package/dist/boot/types.d.ts +18 -3
- package/dist/boot/types.d.ts.map +1 -1
- package/dist/builtin/LogLine.d.ts +38 -0
- package/dist/builtin/LogLine.d.ts.map +1 -0
- package/dist/builtin/LogLine.js +37 -0
- package/dist/builtin/LogLine.js.map +1 -0
- package/dist/builtin/logger.d.ts +57 -0
- package/dist/builtin/logger.d.ts.map +1 -1
- package/dist/builtin/logger.js +72 -17
- package/dist/builtin/logger.js.map +1 -1
- package/dist/config-loader.d.ts +3 -2
- package/dist/config-loader.d.ts.map +1 -1
- package/dist/config-loader.js.map +1 -1
- package/dist/contract.d.ts +3 -7
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +3 -4
- package/dist/contract.js.map +1 -1
- package/dist/{scan/conventions.d.ts → conventions.d.ts} +6 -0
- package/dist/conventions.d.ts.map +1 -0
- package/dist/{scan/conventions.js → conventions.js} +3 -2
- package/dist/conventions.js.map +1 -0
- package/dist/crypto/encoding.d.ts +0 -1
- package/dist/crypto/encoding.d.ts.map +1 -1
- package/dist/crypto/encoding.js +0 -7
- package/dist/crypto/encoding.js.map +1 -1
- package/dist/declare.d.ts +11 -1
- package/dist/declare.d.ts.map +1 -1
- package/dist/declare.js +10 -1
- package/dist/declare.js.map +1 -1
- package/dist/descriptor/frond.d.ts +34 -0
- package/dist/descriptor/frond.d.ts.map +1 -1
- package/dist/descriptor/index.d.ts +15 -0
- package/dist/descriptor/index.d.ts.map +1 -0
- package/dist/descriptor/index.js +14 -0
- package/dist/descriptor/index.js.map +1 -0
- package/dist/descriptor/surface.d.ts +8 -0
- package/dist/descriptor/surface.d.ts.map +1 -0
- package/dist/descriptor/surface.js +16 -0
- package/dist/descriptor/surface.js.map +1 -0
- package/dist/dispatch/ArgumentResolver.d.ts.map +1 -1
- package/dist/dispatch/ArgumentResolver.js +6 -2
- package/dist/dispatch/ArgumentResolver.js.map +1 -1
- package/dist/dispatch/HandlerFacade.d.ts +2 -0
- package/dist/dispatch/HandlerFacade.d.ts.map +1 -1
- package/dist/dispatch/HandlerFacade.js +9 -4
- package/dist/dispatch/HandlerFacade.js.map +1 -1
- package/dist/dispatch/StorageGuard.d.ts.map +1 -1
- package/dist/dispatch/StorageGuard.js +9 -23
- package/dist/dispatch/StorageGuard.js.map +1 -1
- package/dist/dispatch/presenterArguments.d.ts +7 -1
- package/dist/dispatch/presenterArguments.d.ts.map +1 -1
- package/dist/dispatch/presenterArguments.js +15 -4
- package/dist/dispatch/presenterArguments.js.map +1 -1
- package/dist/dispatch/validateInput.d.ts.map +1 -1
- package/dist/dispatch/validateInput.js +2 -2
- package/dist/dispatch/validateInput.js.map +1 -1
- package/dist/effective-operation.d.ts +1 -1
- package/dist/effective-operation.d.ts.map +1 -1
- package/dist/effective-operation.js +13 -19
- package/dist/effective-operation.js.map +1 -1
- package/dist/frond-config.d.ts +24 -0
- package/dist/frond-config.d.ts.map +1 -1
- package/dist/frond-config.js.map +1 -1
- package/dist/index.d.ts +35 -40
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -14
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +2 -12
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +2 -12
- package/dist/node.js.map +1 -1
- package/dist/prefab/crud.d.ts +1 -1
- package/dist/prefab/crud.d.ts.map +1 -1
- package/dist/prefab/mirror.d.ts +10 -11
- package/dist/prefab/mirror.d.ts.map +1 -1
- package/dist/prefab/mirror.js +1 -27
- package/dist/prefab/mirror.js.map +1 -1
- package/dist/prefab/repository.d.ts +1 -1
- package/dist/prefab/repository.d.ts.map +1 -1
- package/dist/{scan/result.d.ts → scan.d.ts} +2 -2
- package/dist/scan.d.ts.map +1 -0
- package/dist/scan.js +2 -0
- package/dist/scan.js.map +1 -0
- package/dist/source.d.ts +1 -1
- package/dist/source.d.ts.map +1 -1
- package/dist/storage/criterion.d.ts.map +1 -0
- package/dist/{criterion.js → storage/criterion.js} +2 -2
- package/dist/storage/criterion.js.map +1 -0
- package/dist/{storage.d.ts → storage/port.d.ts} +6 -3
- package/dist/storage/port.d.ts.map +1 -0
- package/dist/{storage.js → storage/port.js} +13 -6
- package/dist/storage/port.js.map +1 -0
- package/dist/{store.d.ts → storage/store.d.ts} +1 -1
- package/dist/storage/store.d.ts.map +1 -0
- package/dist/{store.js → storage/store.js} +33 -17
- package/dist/storage/store.js.map +1 -0
- package/dist/verify.js +1 -1
- package/dist/verify.js.map +1 -1
- package/dist/wire/Invocation.d.ts +1 -3
- package/dist/wire/Invocation.d.ts.map +1 -1
- package/dist/wire/Invocation.js +1 -5
- package/dist/wire/Invocation.js.map +1 -1
- package/dist/wire/binding.d.ts +9 -0
- package/dist/wire/binding.d.ts.map +1 -1
- package/dist/wire/binding.js +11 -6
- package/dist/wire/binding.js.map +1 -1
- package/dist/wire/emit.d.ts +45 -0
- package/dist/wire/emit.d.ts.map +1 -0
- package/dist/wire/emit.js +44 -0
- package/dist/wire/emit.js.map +1 -0
- package/dist/wire/errors.js +2 -2
- package/dist/wire/errors.js.map +1 -1
- package/dist/wire/loggerMiddleware.d.ts.map +1 -1
- package/dist/wire/loggerMiddleware.js +6 -0
- package/dist/wire/loggerMiddleware.js.map +1 -1
- package/package.json +10 -4
- package/src/boot/AppLifecycle.ts +8 -0
- package/src/boot/Emissions.ts +177 -9
- package/src/boot/auth.ts +1 -1
- package/src/boot/bootstrap.ts +456 -672
- package/src/boot/card.ts +1 -1
- package/src/boot/hosted.ts +4 -2
- package/src/boot/install.ts +421 -0
- package/src/boot/ownership.ts +17 -2
- package/src/boot/ports.ts +71 -27
- package/src/boot/remote.ts +3 -3
- package/src/boot/seed.ts +18 -3
- package/src/boot/statement-drift.ts +1 -1
- package/src/boot/together.ts +1 -1
- package/src/boot/types.ts +18 -3
- package/src/builtin/LogLine.ts +38 -0
- package/src/builtin/logger.ts +109 -17
- package/src/config-loader.ts +3 -2
- package/src/contract.ts +5 -9
- package/src/{scan/conventions.ts → conventions.ts} +9 -2
- package/src/crypto/encoding.ts +0 -7
- package/src/declare.ts +20 -2
- package/src/descriptor/frond.ts +31 -0
- package/src/descriptor/index.ts +15 -0
- package/src/descriptor/surface.ts +23 -0
- package/src/dispatch/ArgumentResolver.ts +6 -2
- package/src/dispatch/HandlerFacade.ts +11 -4
- package/src/dispatch/StorageGuard.ts +8 -21
- package/src/dispatch/presenterArguments.ts +21 -9
- package/src/dispatch/validateInput.ts +2 -2
- package/src/effective-operation.ts +16 -21
- package/src/frond-config.ts +20 -0
- package/src/index.ts +44 -57
- package/src/node.ts +2 -16
- package/src/prefab/crud.ts +1 -1
- package/src/prefab/mirror.ts +12 -38
- package/src/prefab/repository.ts +1 -1
- package/src/{scan/result.ts → scan.ts} +1 -1
- package/src/source.ts +1 -1
- package/src/{criterion.ts → storage/criterion.ts} +2 -2
- package/src/{storage.ts → storage/port.ts} +20 -5
- package/src/{store.ts → storage/store.ts} +35 -16
- package/src/verify.ts +1 -1
- package/src/wire/Invocation.ts +2 -7
- package/src/wire/binding.ts +17 -6
- package/src/wire/call.ts +1 -1
- package/src/wire/emit.ts +84 -0
- package/src/wire/errors.ts +2 -2
- package/src/wire/loggerMiddleware.ts +6 -0
- package/dist/boot/boot.d.ts +0 -45
- package/dist/boot/boot.d.ts.map +0 -1
- package/dist/boot/boot.js +0 -63
- package/dist/boot/boot.js.map +0 -1
- package/dist/criterion.d.ts.map +0 -1
- package/dist/criterion.js.map +0 -1
- package/dist/declarations.d.ts +0 -34
- package/dist/declarations.d.ts.map +0 -1
- package/dist/declarations.js +0 -75
- package/dist/declarations.js.map +0 -1
- package/dist/emit.d.ts +0 -13
- package/dist/emit.d.ts.map +0 -1
- package/dist/emit.js +0 -21
- package/dist/emit.js.map +0 -1
- package/dist/imports.d.ts +0 -16
- package/dist/imports.d.ts.map +0 -1
- package/dist/imports.js +0 -78
- package/dist/imports.js.map +0 -1
- package/dist/placement.d.ts +0 -25
- package/dist/placement.d.ts.map +0 -1
- package/dist/placement.js +0 -69
- package/dist/placement.js.map +0 -1
- package/dist/scan/adapters.d.ts +0 -3
- package/dist/scan/adapters.d.ts.map +0 -1
- package/dist/scan/adapters.js +0 -25
- package/dist/scan/adapters.js.map +0 -1
- package/dist/scan/bundling.d.ts +0 -3
- package/dist/scan/bundling.d.ts.map +0 -1
- package/dist/scan/bundling.js +0 -15
- package/dist/scan/bundling.js.map +0 -1
- package/dist/scan/contract.d.ts +0 -27
- package/dist/scan/contract.d.ts.map +0 -1
- package/dist/scan/contract.js +0 -46
- package/dist/scan/contract.js.map +0 -1
- package/dist/scan/conventions.d.ts.map +0 -1
- package/dist/scan/conventions.js.map +0 -1
- package/dist/scan/emit.d.ts +0 -10
- package/dist/scan/emit.d.ts.map +0 -1
- package/dist/scan/emit.js +0 -144
- package/dist/scan/emit.js.map +0 -1
- package/dist/scan/handler-parser.d.ts +0 -26
- package/dist/scan/handler-parser.d.ts.map +0 -1
- package/dist/scan/handler-parser.js +0 -607
- package/dist/scan/handler-parser.js.map +0 -1
- package/dist/scan/result.d.ts.map +0 -1
- package/dist/scan/result.js +0 -2
- package/dist/scan/result.js.map +0 -1
- package/dist/scan/scanner.d.ts +0 -12
- package/dist/scan/scanner.d.ts.map +0 -1
- package/dist/scan/scanner.js +0 -573
- package/dist/scan/scanner.js.map +0 -1
- package/dist/scan/statement.d.ts +0 -4
- package/dist/scan/statement.d.ts.map +0 -1
- package/dist/scan/statement.js +0 -135
- package/dist/scan/statement.js.map +0 -1
- package/dist/storage.d.ts.map +0 -1
- package/dist/storage.js.map +0 -1
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js.map +0 -1
- package/src/boot/boot.ts +0 -110
- package/src/declarations.ts +0 -110
- package/src/emit.ts +0 -32
- package/src/imports.ts +0 -94
- package/src/placement.ts +0 -86
- package/src/scan/adapters.ts +0 -32
- package/src/scan/bundling.ts +0 -14
- package/src/scan/contract.ts +0 -80
- package/src/scan/emit.ts +0 -160
- package/src/scan/handler-parser.ts +0 -695
- package/src/scan/scanner.ts +0 -698
- package/src/scan/statement.ts +0 -159
- /package/dist/{criterion.d.ts → storage/criterion.d.ts} +0 -0
package/dist/imports.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { readdir, readFile } from 'node:fs/promises';
|
|
2
|
-
import { join, resolve, dirname, relative, isAbsolute } from 'node:path';
|
|
3
|
-
let _ts;
|
|
4
|
-
async function loadTs() {
|
|
5
|
-
if (!_ts)
|
|
6
|
-
_ts = (await import('@typescript/typescript6')).default;
|
|
7
|
-
return _ts;
|
|
8
|
-
}
|
|
9
|
-
/** Is `child` inside `parent`? Path-based, so it says nothing about either existing. */
|
|
10
|
-
function inside(parent, child) {
|
|
11
|
-
const rel = relative(parent, child);
|
|
12
|
-
return rel !== '' && !rel.startsWith('..') && !isAbsolute(rel);
|
|
13
|
-
}
|
|
14
|
-
async function sourcesUnder(dir) {
|
|
15
|
-
const out = [];
|
|
16
|
-
let entries;
|
|
17
|
-
try {
|
|
18
|
-
entries = await readdir(dir, { withFileTypes: true });
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
// Unreadable is the scan's complaint, not this rule's — and an absent directory is
|
|
22
|
-
// ordinary (a frond with no handlers).
|
|
23
|
-
return out;
|
|
24
|
-
}
|
|
25
|
-
for (const entry of entries) {
|
|
26
|
-
if (entry.name === 'node_modules' || entry.name.startsWith('.'))
|
|
27
|
-
continue;
|
|
28
|
-
const full = join(dir, entry.name);
|
|
29
|
-
if (entry.isDirectory())
|
|
30
|
-
out.push(...await sourcesUnder(full));
|
|
31
|
-
else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.d.ts'))
|
|
32
|
-
out.push(full);
|
|
33
|
-
}
|
|
34
|
-
return out;
|
|
35
|
-
}
|
|
36
|
-
/** Every relative import that resolves outside its own frond. */
|
|
37
|
-
export async function crossFrondImports(fronds) {
|
|
38
|
-
const typescript = await loadTs();
|
|
39
|
-
// `source.package` is the scoped name the scan already resolved — the remedy this rule
|
|
40
|
-
// prints must be the name that actually resolves, not one rebuilt from a prefix here.
|
|
41
|
-
const roots = fronds.map((frond) => ({
|
|
42
|
-
name: frond.name, path: resolve(frond.source.path), package: frond.source.package,
|
|
43
|
-
}));
|
|
44
|
-
const found = [];
|
|
45
|
-
for (const root of roots) {
|
|
46
|
-
for (const filePath of await sourcesUnder(root.path)) {
|
|
47
|
-
const text = await readFile(filePath, 'utf8').catch(() => undefined);
|
|
48
|
-
if (text === undefined)
|
|
49
|
-
continue;
|
|
50
|
-
for (const { fileName: specifier } of typescript.preProcessFile(text, true, true).importedFiles) {
|
|
51
|
-
if (!specifier.startsWith('.'))
|
|
52
|
-
continue;
|
|
53
|
-
const landed = resolve(dirname(filePath), specifier);
|
|
54
|
-
if (inside(root.path, landed))
|
|
55
|
-
continue;
|
|
56
|
-
const target = roots.find((other) => other.name !== root.name && inside(other.path, landed));
|
|
57
|
-
found.push({
|
|
58
|
-
rule: 'cross-frond-import',
|
|
59
|
-
frond: root.name,
|
|
60
|
-
filePath,
|
|
61
|
-
specifier,
|
|
62
|
-
...(target ? { target: target.name } : {}),
|
|
63
|
-
message: target
|
|
64
|
-
? `'${specifier}' resolves into frond '${target.name}'. A relative path states that `
|
|
65
|
-
+ `these two fronds share a directory tree — a constraint nothing declares, and one `
|
|
66
|
-
+ `that nothing here can see. Write '${target.package}/…' instead: it says the `
|
|
67
|
-
+ `same dependency in terms the model reads, and it is the form \`fougere sync\` writes, `
|
|
68
|
-
+ `so it survives '${target.name}' moving out.`
|
|
69
|
-
: `'${specifier}' resolves outside frond '${root.name}', into no frond at all. `
|
|
70
|
-
+ `Whatever it reaches is not part of any frond's contract, so nothing carries it `
|
|
71
|
-
+ `when this one is deployed on its own.`,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return found;
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=imports.js.map
|
package/dist/imports.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"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oBAAE,SAAS;gBACzC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;gBACrD,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;oBAAE,SAAS;gBAExC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;gBAC7F,KAAK,CAAC,IAAI,CAAC;oBACT,IAAI,EAAE,oBAAoB;oBAC1B,KAAK,EAAE,IAAI,CAAC,IAAI;oBAChB,QAAQ;oBACR,SAAS;oBACT,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC1C,OAAO,EAAE,MAAM;wBACb,CAAC,CAAC,IAAI,SAAS,0BAA0B,MAAM,CAAC,IAAI,iCAAiC;8BACjF,mFAAmF;8BACnF,qCAAqC,MAAM,CAAC,OAAO,2BAA2B;8BAC9E,wFAAwF;8BACxF,mBAAmB,MAAM,CAAC,IAAI,eAAe;wBACjD,CAAC,CAAC,IAAI,SAAS,6BAA6B,IAAI,CAAC,IAAI,2BAA2B;8BAC5E,iFAAiF;8BACjF,uCAAuC;iBAC9C,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/placement.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type Conventions } from './scan/conventions.js';
|
|
2
|
-
import type { FrondDescriptor } from './descriptor/frond.js';
|
|
3
|
-
export interface OutsideConvention {
|
|
4
|
-
/** Stable rule name — the same vocabulary `verify()` uses. */
|
|
5
|
-
rule: 'outside-convention';
|
|
6
|
-
frond: string;
|
|
7
|
-
filePath: string;
|
|
8
|
-
kind: 'file' | 'directory';
|
|
9
|
-
message: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* What sits in a frond and belongs to no convention — a directory somebody invented, or a
|
|
13
|
-
* module dropped at the root.
|
|
14
|
-
*
|
|
15
|
-
* The eight names are the frond's whole vocabulary, and until now nothing said so: a scan
|
|
16
|
-
* READS them and steps over everything else in silence, so a file outside them is not
|
|
17
|
-
* refused, it is unseen. That silence is what lets a domain word settle wherever it was
|
|
18
|
-
* first needed — most often in the handler that used it, which is a second rule
|
|
19
|
-
* (`handler-declaration`) reporting the same drift one file lower.
|
|
20
|
-
*
|
|
21
|
-
* It names the addresses rather than describing them: a rule that says "put it somewhere
|
|
22
|
-
* better" is advice, and advice is what everybody already had.
|
|
23
|
-
*/
|
|
24
|
-
export declare function outsideConventions(fronds: readonly Pick<FrondDescriptor, 'name' | 'source'>[], conventions: Conventions): Promise<OutsideConvention[]>;
|
|
25
|
-
//# sourceMappingURL=placement.d.ts.map
|
package/dist/placement.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"placement.d.ts","sourceRoot":"","sources":["../src/placement.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAe,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAChC,8DAA8D;IAC9D,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;CACjB;AAaD;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,SAAS,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,QAAQ,CAAC,EAAE,EAC3D,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA2C9B"}
|
package/dist/placement.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/** A file inside a frond that no convention names. */
|
|
2
|
-
import { readdir } from 'node:fs/promises';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { frondDirsOf } from './scan/conventions.js';
|
|
5
|
-
/**
|
|
6
|
-
* `tests` is not a convention and is not an offence either: `@fougere/testing` reads the
|
|
7
|
-
* LEVEL a case runs at from where its file sits, so a frond holding its own tests is a
|
|
8
|
-
* supported shape (`demos/test-gradient`). The rest are outputs and installs, which are
|
|
9
|
-
* not the project's source at all.
|
|
10
|
-
*/
|
|
11
|
-
const NOT_SOURCE = new Set(['tests', 'node_modules', 'dist', 'build', 'coverage']);
|
|
12
|
-
/** The one file a frond states about itself, at its root. */
|
|
13
|
-
const FROND_FILES = new Set(['frond.config.ts', 'package.json', 'tsconfig.json', 'README.md']);
|
|
14
|
-
/**
|
|
15
|
-
* What sits in a frond and belongs to no convention — a directory somebody invented, or a
|
|
16
|
-
* module dropped at the root.
|
|
17
|
-
*
|
|
18
|
-
* The eight names are the frond's whole vocabulary, and until now nothing said so: a scan
|
|
19
|
-
* READS them and steps over everything else in silence, so a file outside them is not
|
|
20
|
-
* refused, it is unseen. That silence is what lets a domain word settle wherever it was
|
|
21
|
-
* first needed — most often in the handler that used it, which is a second rule
|
|
22
|
-
* (`handler-declaration`) reporting the same drift one file lower.
|
|
23
|
-
*
|
|
24
|
-
* It names the addresses rather than describing them: a rule that says "put it somewhere
|
|
25
|
-
* better" is advice, and advice is what everybody already had.
|
|
26
|
-
*/
|
|
27
|
-
export async function outsideConventions(fronds, conventions) {
|
|
28
|
-
const known = new Set(frondDirsOf(conventions));
|
|
29
|
-
const addresses = [...known].sort().join(', ');
|
|
30
|
-
const found = [];
|
|
31
|
-
for (const frond of fronds) {
|
|
32
|
-
const entries = await readdir(frond.source.path, { withFileTypes: true }).catch(() => []);
|
|
33
|
-
for (const entry of entries) {
|
|
34
|
-
if (entry.name.startsWith('.') || NOT_SOURCE.has(entry.name))
|
|
35
|
-
continue;
|
|
36
|
-
const filePath = join(frond.source.path, entry.name);
|
|
37
|
-
if (entry.isDirectory()) {
|
|
38
|
-
if (known.has(entry.name))
|
|
39
|
-
continue;
|
|
40
|
-
found.push({
|
|
41
|
-
rule: 'outside-convention',
|
|
42
|
-
frond: frond.name,
|
|
43
|
-
filePath,
|
|
44
|
-
kind: 'directory',
|
|
45
|
-
message: `'${entry.name}/' is a directory no convention names, so nothing in it is read `
|
|
46
|
-
+ `as anything — it is a subject somebody filed under its own word. A frond's `
|
|
47
|
-
+ `directories are ${addresses}. If what it holds computes with nothing injected it `
|
|
48
|
-
+ `is \`${conventions.dirs.rules}/\`; if it holds a dependency it is `
|
|
49
|
-
+ `\`${conventions.dirs.services}/\`.`,
|
|
50
|
-
});
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (!entry.name.endsWith('.ts') || FROND_FILES.has(entry.name))
|
|
54
|
-
continue;
|
|
55
|
-
found.push({
|
|
56
|
-
rule: 'outside-convention',
|
|
57
|
-
frond: frond.name,
|
|
58
|
-
filePath,
|
|
59
|
-
kind: 'file',
|
|
60
|
-
message: `'${entry.name}' sits at the root of '${frond.name}', where the frond states `
|
|
61
|
-
+ `itself and nothing else. A frond's directories are ${addresses} — this one belongs `
|
|
62
|
-
+ `in \`${conventions.dirs.rules}/\` if it computes with nothing injected, in `
|
|
63
|
-
+ `\`${conventions.dirs.services}/\` if it holds a dependency.`,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return found;
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=placement.js.map
|
package/dist/placement.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"placement.js","sourceRoot":"","sources":["../src/placement.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO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AAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAShE"}
|
package/dist/scan/adapters.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
/** Which adapters a PROJECT could load, read off its dependencies. */
|
|
4
|
-
const ADAPTER_PACKAGE = /^@fougere\/adapter-(.+)$/;
|
|
5
|
-
/** The adapter names this project depends on — empty when it has no package.json to read. */
|
|
6
|
-
export async function adaptersOf(root) {
|
|
7
|
-
const manifest = await read(join(root, 'package.json'));
|
|
8
|
-
if (!manifest)
|
|
9
|
-
return [];
|
|
10
|
-
const declared = { ...manifest.dependencies, ...manifest.devDependencies };
|
|
11
|
-
return Object.keys(declared)
|
|
12
|
-
.map((name) => ADAPTER_PACKAGE.exec(name)?.[1])
|
|
13
|
-
.filter((name) => name !== undefined);
|
|
14
|
-
}
|
|
15
|
-
async function read(path) {
|
|
16
|
-
try {
|
|
17
|
-
return JSON.parse(await readFile(path, 'utf8'));
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
// No manifest, or one that is not JSON. Either way this cannot validate a name, and
|
|
21
|
-
// reporting every `adapters:` key as unknown would be worse than saying nothing.
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=adapters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../../src/scan/adapters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,sEAAsE;AACtE,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAEnD,6FAA6F;AAC7F,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IAC3C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEzB,MAAM,QAAQ,GAAG,EAAE,GAAG,QAAQ,CAAC,YAAY,EAAE,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAC;IAE3E,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;SACzB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SAC9C,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;AAC1D,CAAC;AAED,KAAK,UAAU,IAAI,CAAC,IAAY;IAC9B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAa,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,oFAAoF;QACpF,iFAAiF;QACjF,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
package/dist/scan/bundling.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundling.d.ts","sourceRoot":"","sources":["../../src/scan/bundling.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAY7C,CAAC"}
|
package/dist/scan/bundling.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** What a Fougere boot loads at RUNTIME, so a bundler must leave it alone. */
|
|
2
|
-
export const RUNTIME_PACKAGES = [
|
|
3
|
-
'@fougere/app',
|
|
4
|
-
'@fougere/core',
|
|
5
|
-
'@fougere/schema',
|
|
6
|
-
'@fougere/defaults',
|
|
7
|
-
'@fougere/transport-http',
|
|
8
|
-
'@fougere/adapter-sql',
|
|
9
|
-
'@fougere/adapter-graphql',
|
|
10
|
-
'@fougere/auth-better',
|
|
11
|
-
'better-sqlite3',
|
|
12
|
-
'jiti',
|
|
13
|
-
'typescript',
|
|
14
|
-
];
|
|
15
|
-
//# sourceMappingURL=bundling.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundling.js","sourceRoot":"","sources":["../../src/scan/bundling.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAAsB;IACjD,cAAc;IACd,eAAe;IACf,iBAAiB;IACjB,mBAAmB;IACnB,yBAAyB;IACzB,sBAAsB;IACtB,0BAA0B;IAC1B,sBAAsB;IACtB,gBAAgB;IAChB,MAAM;IACN,YAAY;CACb,CAAC"}
|
package/dist/scan/contract.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/** An operation contract, written down — the half two emitters say the same way. */
|
|
2
|
-
import { type SchemaView } from '@fougere/schema';
|
|
3
|
-
import type { OperationContract } from '../wire/operation.js';
|
|
4
|
-
/** A value that ends up as an import in the module being written. */
|
|
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
|
-
export declare const lit: (value: unknown) => string;
|
|
21
|
-
/** What a schema slot becomes in the generated module. */
|
|
22
|
-
export declare function schemaRef(schema: SchemaView | undefined, declaredIn: string, imports: Aliases): string | undefined;
|
|
23
|
-
/** One entry of an operations Map, as its module spells it. */
|
|
24
|
-
export declare function contractOf(op: string, contract: OperationContract, declaredIn: string, imports: Aliases): string;
|
|
25
|
-
/** The operations of one handler, as the Map its reader builds. */
|
|
26
|
-
export declare function operationsOf(operations: ReadonlyMap<string, OperationContract>, declaredIn: string, imports: Aliases, indent: string): string;
|
|
27
|
-
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/scan/contract.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,OAAO,EAA+B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,qEAAqE;AACrE,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAE1B;;;;;;;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;AAED,eAAO,MAAM,GAAG,GAAI,OAAO,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,CAYR;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"}
|
package/dist/scan/contract.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/** An operation contract, written down — the half two emitters say the same way. */
|
|
2
|
-
import { ANONYMOUS_SCHEMA_NAME, Card } from '@fougere/schema';
|
|
3
|
-
export const lit = (value) => JSON.stringify(value ?? null);
|
|
4
|
-
/** What a schema slot becomes in the generated module. */
|
|
5
|
-
export function schemaRef(schema, declaredIn, imports) {
|
|
6
|
-
if (!schema)
|
|
7
|
-
return undefined;
|
|
8
|
-
const known = imports.aliasOf(schema);
|
|
9
|
-
if (known)
|
|
10
|
-
return known;
|
|
11
|
-
const name = schema.name;
|
|
12
|
-
if (name && name !== ANONYMOUS_SCHEMA_NAME)
|
|
13
|
-
return imports.named(schema, declaredIn, name);
|
|
14
|
-
const card = Card.fromSchema(schema);
|
|
15
|
-
const source = card.origin?.from ?? card.descriptor.title;
|
|
16
|
-
const from = source ? imports.classNamed(source) : undefined;
|
|
17
|
-
if (from)
|
|
18
|
-
return `${imports.aliasOf(from)}.partial()`;
|
|
19
|
-
throw new Error(`A scan cannot be written down: an anonymous schema in ${declaredIn} names no source. `
|
|
20
|
-
+ 'Only `Partial<X>` is derivable here, and it says which X it came from.');
|
|
21
|
-
}
|
|
22
|
-
/** One entry of an operations Map, as its module spells it. */
|
|
23
|
-
export function contractOf(op, contract, declaredIn, imports) {
|
|
24
|
-
const parts = [];
|
|
25
|
-
const input = schemaRef(contract.input, declaredIn, imports);
|
|
26
|
-
const output = schemaRef(contract.output, declaredIn, imports);
|
|
27
|
-
if (input)
|
|
28
|
-
parts.push(`input: ${input}`);
|
|
29
|
-
if (output)
|
|
30
|
-
parts.push(`output: ${output}`);
|
|
31
|
-
if (contract.binding !== undefined)
|
|
32
|
-
parts.push(`binding: ${lit(contract.binding)}`);
|
|
33
|
-
if (contract.description !== undefined)
|
|
34
|
-
parts.push(`description: ${lit(contract.description)}`);
|
|
35
|
-
if (contract.cardinality !== undefined)
|
|
36
|
-
parts.push(`cardinality: ${lit(contract.cardinality)}`);
|
|
37
|
-
if (contract.signature !== undefined)
|
|
38
|
-
parts.push(`signature: ${lit(contract.signature)}`);
|
|
39
|
-
return `[${lit(op)}, { ${parts.join(', ')} }]`;
|
|
40
|
-
}
|
|
41
|
-
/** The operations of one handler, as the Map its reader builds. */
|
|
42
|
-
export function operationsOf(operations, declaredIn, imports, indent) {
|
|
43
|
-
const ops = [...operations].map((entry) => contractOf(entry[0], entry[1], declaredIn, imports));
|
|
44
|
-
return `new Map([\n${indent} ${ops.join(`,\n${indent} `)}\n${indent}])`;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/scan/contract.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAmB,MAAM,iBAAiB,CAAC;AAsB/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,CAAC,K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AAO;QACd,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC;AASF,6DAA6D;AAC7D,MAAM,UAAU,kBAAkB,CAAC,KAAwB;IACzD,OAAO;QACL,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,mBAAmB,CAAC,KAAK;QAChD,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,mBAAmB,CAAC,MAAM;QACnD,IAAI,EAAE,EAAE,GAAG,mBAAmB,CAAC,IAAI,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE;KACtD,CAAC;AACJ,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,WAAwB;IACjE,OAAO,GAAG,WAAW,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;AACxC,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,cAAc,CAAC,WAAwB;IACrD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,WAAW,CAAC,WAAwB;IAClD,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC;IAChG,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC;YACjB,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ;YAClE,GAAG,cAAc,CAAC,WAAW,CAAC;SAC/B,CAAC,CAAC,CAAC;AACN,CAAC"}
|
package/dist/scan/emit.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ScanResult } from './result.js';
|
|
2
|
-
export interface EmitOptions {
|
|
3
|
-
/** Where the generated module will sit. Imports are written relative to it. */
|
|
4
|
-
outFile: string;
|
|
5
|
-
/** How `@fougere/core` is reached from there. Default: the package name. */
|
|
6
|
-
core?: string;
|
|
7
|
-
}
|
|
8
|
-
/** Write a scan down. */
|
|
9
|
-
export declare function emitScan(result: ScanResult, options: EmitOptions): string;
|
|
10
|
-
//# sourceMappingURL=emit.d.ts.map
|
package/dist/scan/emit.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/scan/emit.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,MAAM,WAAW,WAAW;IAC1B,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAuGD,yBAAyB;AACzB,wBAAgB,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,GAAG,MAAM,CA2CzE"}
|
package/dist/scan/emit.js
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/** The scan, written down as a module — what `createApp` is handed where there is no disk. */
|
|
2
|
-
import { dirname, relative } from 'node:path';
|
|
3
|
-
import { nameOf } from '../descriptor/frond.js';
|
|
4
|
-
import { lit, operationsOf, schemaRef } from './contract.js';
|
|
5
|
-
/** Is a TypeScript compiler going to read this module? Its name is the only thing that says. */
|
|
6
|
-
const isTypeScript = (outFile) => /\.tsx?$/.test(outFile);
|
|
7
|
-
/** A source file becomes a specifier its reader can follow — and the two readers differ. */
|
|
8
|
-
function specifierOf(filePath, outFile) {
|
|
9
|
-
const path = relative(dirname(outFile), filePath);
|
|
10
|
-
const rel = isTypeScript(outFile) ? path.replace(/\.tsx?$/, '.js') : path;
|
|
11
|
-
return rel.startsWith('.') ? rel : `./${rel}`;
|
|
12
|
-
}
|
|
13
|
-
class Imports {
|
|
14
|
-
outFile;
|
|
15
|
-
byValue = new Map();
|
|
16
|
-
lines = [];
|
|
17
|
-
/** Entity classes by their class name — what a `Partial<X>` names as its source. */
|
|
18
|
-
byClassName = new Map();
|
|
19
|
-
constructor(outFile) {
|
|
20
|
-
this.outFile = outFile;
|
|
21
|
-
}
|
|
22
|
-
/** Register `value` as the default export of `filePath`, and answer its alias. */
|
|
23
|
-
default(value, filePath) {
|
|
24
|
-
const known = this.byValue.get(value);
|
|
25
|
-
if (known)
|
|
26
|
-
return known;
|
|
27
|
-
const alias = `_${this.lines.length}`;
|
|
28
|
-
this.lines.push(`import ${alias} from '${specifierOf(filePath, this.outFile)}';`);
|
|
29
|
-
this.byValue.set(value, alias);
|
|
30
|
-
return alias;
|
|
31
|
-
}
|
|
32
|
-
/** Register `value` as a NAMED export of `filePath` — its class name is the export. */
|
|
33
|
-
named(value, filePath, name) {
|
|
34
|
-
const known = this.byValue.get(value);
|
|
35
|
-
if (known)
|
|
36
|
-
return known;
|
|
37
|
-
const alias = `_${this.lines.length}`;
|
|
38
|
-
this.lines.push(`import { ${name} as ${alias} } from '${specifierOf(filePath, this.outFile)}';`);
|
|
39
|
-
this.byValue.set(value, alias);
|
|
40
|
-
return alias;
|
|
41
|
-
}
|
|
42
|
-
has(value) { return this.byValue.has(value); }
|
|
43
|
-
aliasOf(value) { return this.byValue.get(value); }
|
|
44
|
-
classNamed(name) { return this.byClassName.get(name); }
|
|
45
|
-
render() { return this.lines.join('\n'); }
|
|
46
|
-
}
|
|
47
|
-
function entityOf(e, imports) {
|
|
48
|
-
return `{ name: ${lit(e.name)}, entityClass: ${imports.aliasOf(e.entityClass)}, `
|
|
49
|
-
+ `filePath: ${lit(e.filePath)}, exposed: ${lit(e.exposed)} }`;
|
|
50
|
-
}
|
|
51
|
-
function handlerOf(h, imports) {
|
|
52
|
-
const ops = operationsOf(h.operations, h.filePath, imports, ' ');
|
|
53
|
-
const override = schemaRef(h.outputOverride, h.filePath, imports);
|
|
54
|
-
return `{ name: ${lit(h.name)}, address: ${lit(h.address)}, ctor: ${imports.aliasOf(h.ctor)}, `
|
|
55
|
-
+ `deps: ${lit(h.deps)}, filePath: ${lit(h.filePath)}, exposed: ${lit(h.exposed)}, `
|
|
56
|
-
+ (h.surface ? `surface: ${lit(h.surface)}, ` : '')
|
|
57
|
-
+ (override ? `outputOverride: ${override}, ` : '')
|
|
58
|
-
+ `operations: ${ops} }`;
|
|
59
|
-
}
|
|
60
|
-
function presenterOf(p, imports) {
|
|
61
|
-
// `views` is not written: it is read back off the constructor (`__views`), so emitting
|
|
62
|
-
// it would be a second copy of a statement the imported class already carries.
|
|
63
|
-
return `{ entityName: ${lit(p.entityName)}, ctor: ${imports.aliasOf(p.ctor)}, `
|
|
64
|
-
+ `fields: ${lit(p.fields)}, fieldMeta: ${lit(p.fieldMeta)}, deps: ${lit(p.deps)}, `
|
|
65
|
-
+ `filePath: ${lit(p.filePath)} }`;
|
|
66
|
-
}
|
|
67
|
-
function collectorOf(c, imports) {
|
|
68
|
-
return `{ typeName: ${lit(c.typeName)}, ctor: ${imports.aliasOf(c.ctor)}, `
|
|
69
|
-
+ `deps: ${lit(c.deps)}, filePath: ${lit(c.filePath)} }`;
|
|
70
|
-
}
|
|
71
|
-
function providerOf(p, imports) {
|
|
72
|
-
return `{ name: ${lit(nameOf(p))}, ctor: ${imports.aliasOf(p.ctor)}, `
|
|
73
|
-
+ `deps: ${lit(p.deps)}, filePath: ${lit(p.filePath)} }`;
|
|
74
|
-
}
|
|
75
|
-
function seedOf(s, imports) {
|
|
76
|
-
const data = typeof s.data === 'function' ? imports.aliasOf(s.data) : lit(s.data);
|
|
77
|
-
return `{ entityName: ${lit(s.entityName)}, data: ${data}, filePath: ${lit(s.filePath)} }`;
|
|
78
|
-
}
|
|
79
|
-
function frondOf(f, imports) {
|
|
80
|
-
const list = (label, items) => ` ${label}: [${items.length ? `\n ${items.join(',\n ')},\n ` : ''}],`;
|
|
81
|
-
return [
|
|
82
|
-
' {',
|
|
83
|
-
` name: ${lit(f.name)},`,
|
|
84
|
-
` source: ${lit(f.source)},`,
|
|
85
|
-
list('providers', f.providers.map((p) => providerOf(p, imports))),
|
|
86
|
-
list('entities', f.entities.map((e) => entityOf(e, imports))),
|
|
87
|
-
list('handlers', f.handlers.map((h) => handlerOf(h, imports))),
|
|
88
|
-
list('presenters', f.presenters.map((p) => presenterOf(p, imports))),
|
|
89
|
-
list('collectors', f.collectors.map((c) => collectorOf(c, imports))),
|
|
90
|
-
list('seeds', f.seeds.map((s) => seedOf(s, imports))),
|
|
91
|
-
f.surfaces ? ` surfaces: ${lit(f.surfaces)},` : '',
|
|
92
|
-
f.reads ? ` reads: ${lit(f.reads)},` : '',
|
|
93
|
-
' }',
|
|
94
|
-
].filter(Boolean).join('\n');
|
|
95
|
-
}
|
|
96
|
-
/** Write a scan down. */
|
|
97
|
-
export function emitScan(result, options) {
|
|
98
|
-
const imports = new Imports(options.outFile);
|
|
99
|
-
const core = options.core ?? '@fougere/core';
|
|
100
|
-
// Every class the descriptor names by a file comes first: a schema slot holding one of
|
|
101
|
-
// them then finds it in the table instead of being imported a second time.
|
|
102
|
-
for (const f of result.fronds) {
|
|
103
|
-
for (const e of f.entities) {
|
|
104
|
-
imports.default(e.entityClass, e.filePath);
|
|
105
|
-
const name = e.entityClass.name;
|
|
106
|
-
if (name)
|
|
107
|
-
imports.byClassName.set(name, e.entityClass);
|
|
108
|
-
}
|
|
109
|
-
for (const p of f.providers)
|
|
110
|
-
imports.default(p.ctor, p.filePath);
|
|
111
|
-
for (const h of f.handlers)
|
|
112
|
-
imports.default(h.ctor, h.filePath);
|
|
113
|
-
for (const p of f.presenters)
|
|
114
|
-
imports.default(p.ctor, p.filePath);
|
|
115
|
-
for (const c of f.collectors)
|
|
116
|
-
imports.default(c.ctor, c.filePath);
|
|
117
|
-
for (const s of f.seeds)
|
|
118
|
-
if (typeof s.data === 'function')
|
|
119
|
-
imports.default(s.data, s.filePath);
|
|
120
|
-
}
|
|
121
|
-
const fronds = result.fronds.map((f) => frondOf(f, imports)).join(',\n');
|
|
122
|
-
// `cause` is dropped: it is an Error, and the build that produced this already reported
|
|
123
|
-
// it. What a boot logs is the message, and that travels.
|
|
124
|
-
const diagnostics = result.diagnostics.map(({ cause: _cause, ...rest }) => lit(rest));
|
|
125
|
-
// The annotation is a convenience for a file a human's tsc will read; it is never what
|
|
126
|
-
// makes the value correct. A bundler parses a `.mjs` as JavaScript and `import type`
|
|
127
|
-
// stops it dead — measured, Nitro's rollup refused the Nuxt template at that line.
|
|
128
|
-
const typed = isTypeScript(options.outFile);
|
|
129
|
-
return `// Generated by \`fougere build\` — the scan, written down. Do not edit.
|
|
130
|
-
//
|
|
131
|
-
// \`createApp\` reads this instead of a disk. Everything here was decided by the scan that
|
|
132
|
-
// produced it; nothing is resolved a second time.
|
|
133
|
-
import { Fronds } from '${core}';
|
|
134
|
-
${typed ? `import type { ScanResult } from '${core}';\n` : ''}${imports.render()}
|
|
135
|
-
|
|
136
|
-
export const scan${typed ? ': ScanResult' : ''} = {
|
|
137
|
-
fronds: Fronds.hosting([
|
|
138
|
-
${fronds}
|
|
139
|
-
]),
|
|
140
|
-
diagnostics: [${diagnostics.join(', ')}],
|
|
141
|
-
};
|
|
142
|
-
`;
|
|
143
|
-
}
|
|
144
|
-
//# sourceMappingURL=emit.js.map
|
package/dist/scan/emit.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../../src/scan/emit.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAA2B,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAStF,gGAAgG;AAChG,MAAM,YAAY,GAAG,CAAC,OAAe,EAAW,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAE3E,4FAA4F;A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AAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzE,wFAAwF;IACxF,yDAAyD;IACzD,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAEtF,uFAAuF;IACvF,qFAAqF;IACrF,mFAAmF;IACnF,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5C,OAAO;;;;0BAIiB,IAAI;EAC5B,KAAK,CAAC,CAAC,CAAC,oCAAoC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE;;mBAE7D,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;;EAE5C,MAAM;;kBAEU,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;;CAEvC,CAAC;AACF,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/** Handler signature parser — extracts method signatures from handler source files. */
|
|
2
|
-
import type { Param, Signature } from '../wire/signature.js';
|
|
3
|
-
export declare function resetTypePrograms(): void;
|
|
4
|
-
/** Drop what runs share. For a test that must prove a cold read. */
|
|
5
|
-
export declare function forgetParsedSources(): void;
|
|
6
|
-
/** Declare every file a run will read, so one program covers it. */
|
|
7
|
-
export declare function seedTypeProgram(filePaths: readonly string[], projectRoot?: string): Promise<void>;
|
|
8
|
-
/** What a handler file yielded — its methods, AND what the pass could not open. */
|
|
9
|
-
export interface HandlerParse {
|
|
10
|
-
methods: Signature[];
|
|
11
|
-
/** Base classes whose source this pass could not open. Empty is a claim. */
|
|
12
|
-
unresolvedHeritage: string[];
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Every method a handler declares, its inherited ones included — the raw material of a
|
|
16
|
-
* binding plan. With a `projectRoot`, the heritage clause is followed too.
|
|
17
|
-
*/
|
|
18
|
-
export declare function parseAllHandlerMethods(filePath: string, projectRoot?: string): Promise<HandlerParse>;
|
|
19
|
-
/** Parse a presenter source file and extract all method signatures. */
|
|
20
|
-
export declare function parsePresenterMethods(filePath: string, projectRoot?: string): Promise<Signature[]>;
|
|
21
|
-
/**
|
|
22
|
-
* Parse constructor parameter types from a source file's default class.
|
|
23
|
-
* Returns type names (e.g. ['PostStorage', 'Logger']) for DI resolution.
|
|
24
|
-
*/
|
|
25
|
-
export declare function parseConstructorParams(filePath: string, projectRoot?: string): Promise<Param[]>;
|
|
26
|
-
//# sourceMappingURL=handler-parser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler-parser.d.ts","sourceRoot":"","sources":["../../src/scan/handler-parser.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,KAAK,EAAW,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA8BtE,wBAAgB,iBAAiB,IAAI,IAAI,CAGxC;AAED,oEAAoE;AACpE,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C;AAgFD,oEAAoE;AACpE,wBAAsB,eAAe,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBvG;AA2eD,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,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"}
|