@venizia/ignis-boot 0.2.0-8 → 0.2.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/LICENSE.md +0 -1
- package/README.md +104 -89
- package/dist/cjs/build-info/common/constants.d.ts +20 -0
- package/dist/cjs/build-info/common/constants.d.ts.map +1 -0
- package/dist/cjs/build-info/common/constants.js +41 -0
- package/dist/cjs/build-info/common/constants.js.map +1 -0
- package/dist/cjs/build-info/common/index.d.ts +3 -0
- package/dist/cjs/build-info/common/index.d.ts.map +1 -0
- package/dist/cjs/build-info/common/index.js +19 -0
- package/dist/cjs/build-info/common/index.js.map +1 -0
- package/dist/cjs/build-info/common/types.d.ts +16 -0
- package/dist/cjs/build-info/common/types.d.ts.map +1 -0
- package/dist/cjs/build-info/common/types.js +3 -0
- package/dist/cjs/build-info/common/types.js.map +1 -0
- package/dist/cjs/build-info/emitter.d.ts +12 -0
- package/dist/cjs/build-info/emitter.d.ts.map +1 -0
- package/dist/cjs/build-info/emitter.js +26 -0
- package/dist/cjs/build-info/emitter.js.map +1 -0
- package/dist/cjs/build-info/index.d.ts +10 -0
- package/dist/cjs/build-info/index.d.ts.map +1 -0
- package/dist/cjs/build-info/index.js +43 -0
- package/dist/cjs/build-info/index.js.map +1 -0
- package/dist/cjs/build-info/resolver.d.ts +25 -0
- package/dist/cjs/build-info/resolver.d.ts.map +1 -0
- package/dist/cjs/build-info/resolver.js +105 -0
- package/dist/cjs/build-info/resolver.js.map +1 -0
- package/dist/cjs/clis/artifacts.d.ts +3 -0
- package/dist/cjs/clis/artifacts.d.ts.map +1 -0
- package/dist/cjs/{cli.js → clis/artifacts.js} +12 -2
- package/dist/cjs/clis/artifacts.js.map +1 -0
- package/dist/cjs/clis/build-info.d.ts +3 -0
- package/dist/cjs/clis/build-info.d.ts.map +1 -0
- package/dist/cjs/clis/build-info.js +48 -0
- package/dist/cjs/clis/build-info.js.map +1 -0
- package/dist/cjs/common/install-quiet-logger.d.ts +2 -0
- package/dist/cjs/common/install-quiet-logger.d.ts.map +1 -0
- package/dist/cjs/common/install-quiet-logger.js +7 -0
- package/dist/cjs/common/install-quiet-logger.js.map +1 -0
- package/dist/cjs/common/quiet-logger.d.ts +18 -0
- package/dist/cjs/common/quiet-logger.d.ts.map +1 -0
- package/dist/cjs/common/quiet-logger.js +46 -0
- package/dist/cjs/common/quiet-logger.js.map +1 -0
- package/dist/cjs/generator/common/constants.d.ts +8 -1
- package/dist/cjs/generator/common/constants.d.ts.map +1 -1
- package/dist/cjs/generator/common/constants.js +12 -1
- package/dist/cjs/generator/common/constants.js.map +1 -1
- package/dist/cjs/generator/common/types.d.ts +5 -0
- package/dist/cjs/generator/common/types.d.ts.map +1 -1
- package/dist/cjs/generator/emitter.d.ts +14 -1
- package/dist/cjs/generator/emitter.d.ts.map +1 -1
- package/dist/cjs/generator/emitter.js +15 -3
- package/dist/cjs/generator/emitter.js.map +1 -1
- package/dist/cjs/generator/index.d.ts +4 -4
- package/dist/cjs/generator/index.d.ts.map +1 -1
- package/dist/cjs/generator/index.js +16 -9
- package/dist/cjs/generator/index.js.map +1 -1
- package/dist/cjs/generator/scanner.d.ts +8 -2
- package/dist/cjs/generator/scanner.d.ts.map +1 -1
- package/dist/cjs/generator/scanner.js +42 -14
- package/dist/cjs/generator/scanner.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/build-info/common/constants.d.ts +20 -0
- package/dist/esm/build-info/common/constants.d.ts.map +1 -0
- package/dist/esm/build-info/common/constants.js +36 -0
- package/dist/esm/build-info/common/constants.js.map +1 -0
- package/dist/esm/build-info/common/index.d.ts +3 -0
- package/dist/esm/build-info/common/index.d.ts.map +1 -0
- package/dist/esm/build-info/common/index.js +3 -0
- package/dist/esm/build-info/common/index.js.map +1 -0
- package/dist/esm/build-info/common/types.d.ts +16 -0
- package/dist/esm/build-info/common/types.d.ts.map +1 -0
- package/dist/esm/build-info/common/types.js +2 -0
- package/dist/esm/build-info/common/types.js.map +1 -0
- package/dist/esm/build-info/emitter.d.ts +12 -0
- package/dist/esm/build-info/emitter.d.ts.map +1 -0
- package/dist/esm/build-info/emitter.js +22 -0
- package/dist/esm/build-info/emitter.js.map +1 -0
- package/dist/esm/build-info/index.d.ts +10 -0
- package/dist/esm/build-info/index.d.ts.map +1 -0
- package/dist/esm/build-info/index.js +25 -0
- package/dist/esm/build-info/index.js.map +1 -0
- package/dist/esm/build-info/resolver.d.ts +25 -0
- package/dist/esm/build-info/resolver.d.ts.map +1 -0
- package/dist/esm/build-info/resolver.js +101 -0
- package/dist/esm/build-info/resolver.js.map +1 -0
- package/dist/esm/clis/artifacts.d.ts +3 -0
- package/dist/esm/clis/artifacts.d.ts.map +1 -0
- package/dist/esm/{cli.js → clis/artifacts.js} +12 -2
- package/dist/esm/clis/artifacts.js.map +1 -0
- package/dist/esm/clis/build-info.d.ts +3 -0
- package/dist/esm/clis/build-info.d.ts.map +1 -0
- package/dist/esm/clis/build-info.js +46 -0
- package/dist/esm/clis/build-info.js.map +1 -0
- package/dist/esm/common/install-quiet-logger.d.ts +2 -0
- package/dist/esm/common/install-quiet-logger.d.ts.map +1 -0
- package/dist/esm/common/install-quiet-logger.js +5 -0
- package/dist/esm/common/install-quiet-logger.js.map +1 -0
- package/dist/esm/common/quiet-logger.d.ts +18 -0
- package/dist/esm/common/quiet-logger.d.ts.map +1 -0
- package/dist/esm/common/quiet-logger.js +42 -0
- package/dist/esm/common/quiet-logger.js.map +1 -0
- package/dist/esm/generator/common/constants.d.ts +8 -1
- package/dist/esm/generator/common/constants.d.ts.map +1 -1
- package/dist/esm/generator/common/constants.js +12 -1
- package/dist/esm/generator/common/constants.js.map +1 -1
- package/dist/esm/generator/common/index.d.ts +2 -2
- package/dist/esm/generator/common/index.js +2 -2
- package/dist/esm/generator/common/types.d.ts +6 -1
- package/dist/esm/generator/common/types.d.ts.map +1 -1
- package/dist/esm/generator/emitter.d.ts +15 -2
- package/dist/esm/generator/emitter.d.ts.map +1 -1
- package/dist/esm/generator/emitter.js +16 -4
- package/dist/esm/generator/emitter.js.map +1 -1
- package/dist/esm/generator/index.d.ts +7 -7
- package/dist/esm/generator/index.d.ts.map +1 -1
- package/dist/esm/generator/index.js +21 -14
- package/dist/esm/generator/index.js.map +1 -1
- package/dist/esm/generator/scanner.d.ts +8 -2
- package/dist/esm/generator/scanner.d.ts.map +1 -1
- package/dist/esm/generator/scanner.js +43 -15
- package/dist/esm/generator/scanner.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +4 -0
- package/package.json +15 -8
- package/dist/cjs/cli.d.ts +0 -3
- package/dist/cjs/cli.d.ts.map +0 -1
- package/dist/cjs/cli.js.map +0 -1
- package/dist/esm/cli.d.ts +0 -3
- package/dist/esm/cli.d.ts.map +0 -1
- package/dist/esm/cli.js.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import '../common/install-quiet-logger.js';
|
|
3
|
+
import { parseArgs } from 'node:util';
|
|
4
|
+
import { BuildInfoEmitter, BuildInfoFormats, generateBuildInfo } from '../build-info/index.js';
|
|
5
|
+
const USAGE = 'ignis-build-info generate [--out src/_build_info.ts] [--root .] [--format ts|json] [--export BUILD_INFO]';
|
|
6
|
+
const { positionals, values } = parseArgs({
|
|
7
|
+
args: process.argv.slice(2),
|
|
8
|
+
allowPositionals: true,
|
|
9
|
+
options: {
|
|
10
|
+
out: { type: 'string', default: 'src/_build_info.ts' },
|
|
11
|
+
root: { type: 'string', default: '.' },
|
|
12
|
+
format: { type: 'string', default: BuildInfoFormats.TS },
|
|
13
|
+
export: { type: 'string', default: BuildInfoEmitter.DEFAULT_EXPORT_NAME },
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
/** Exit code of the command, so the process exits in exactly one place. */
|
|
17
|
+
const run = async () => {
|
|
18
|
+
if (positionals[0] !== 'generate') {
|
|
19
|
+
console.error(USAGE);
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
if (!BuildInfoFormats.isValid(values.format)) {
|
|
23
|
+
console.error(`invalid --format '${values.format}' | expected one of: ${[...BuildInfoFormats.SCHEME_SET].join(', ')}`);
|
|
24
|
+
return 1;
|
|
25
|
+
}
|
|
26
|
+
// Narrowed by comparison, never asserted: `isValid` above already refused everything else.
|
|
27
|
+
const format = values.format === BuildInfoFormats.JSON ? BuildInfoFormats.JSON : BuildInfoFormats.TS;
|
|
28
|
+
const result = await generateBuildInfo({
|
|
29
|
+
out: values.out,
|
|
30
|
+
root: values.root,
|
|
31
|
+
format,
|
|
32
|
+
exportName: values.export,
|
|
33
|
+
});
|
|
34
|
+
const { service, version, commit, branch } = result.buildInfo;
|
|
35
|
+
console.log(`wrote ${values.out} | ${service}@${version} | ${commit} (${branch})`);
|
|
36
|
+
return 0;
|
|
37
|
+
};
|
|
38
|
+
run()
|
|
39
|
+
.then(code => {
|
|
40
|
+
process.exit(code);
|
|
41
|
+
})
|
|
42
|
+
.catch(error => {
|
|
43
|
+
console.error(error);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=build-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-info.js","sourceRoot":"","sources":["../../../src/clis/build-info.ts"],"names":[],"mappings":";AACA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEtF,MAAM,KAAK,GACT,0GAA0G,CAAC;AAE7G,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACxC,IA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AM,CAAC,MAAM;KAC1B,CAAC,CAAC;IAEH,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,OAAO,IAAI,OAAO,MAAM,MAAM,KAAK,MAAM,GAAG,CAAC,CAAC;IAEnF,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,GAAG,EAAE;KACF,IAAI,CAAC,IAAI,CAAC,EAAE;IACX,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC,CAAC;KACD,KAAK,CAAC,KAAK,CAAC,EAAE;IACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-quiet-logger.d.ts","sourceRoot":"","sources":["../../../src/common/install-quiet-logger.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { LoggerFactory } from '@venizia/ignis-helpers';
|
|
2
|
+
import { QuietLogger } from './quiet-logger.js';
|
|
3
|
+
// Imported first by the CLI: a provider registered after another module resolved its logger would still see the console fallback and its warning.
|
|
4
|
+
LoggerFactory.use({ provider: QuietLogger });
|
|
5
|
+
//# sourceMappingURL=install-quiet-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-quiet-logger.js","sourceRoot":"","sources":["../../../src/common/install-quiet-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,kJAAkJ;AAClJ,aAAa,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ILogger, TLogLevel } from '@venizia/ignis-helpers/core';
|
|
2
|
+
/** The generator's own output goes through `console.log`; framework diagnostics below `warn` are dropped and the rest land on stderr, so a codegen run prints nothing but its result on stdout. */
|
|
3
|
+
export declare class QuietLogger implements ILogger {
|
|
4
|
+
private readonly scope;
|
|
5
|
+
private static readonly cache;
|
|
6
|
+
private readonly prefix;
|
|
7
|
+
private constructor();
|
|
8
|
+
static get(scope: string): ILogger;
|
|
9
|
+
private write;
|
|
10
|
+
debug(): void;
|
|
11
|
+
info(): void;
|
|
12
|
+
warn(message: string, ...args: unknown[]): void;
|
|
13
|
+
error(message: string, ...args: unknown[]): void;
|
|
14
|
+
emerg(message: string, ...args: unknown[]): void;
|
|
15
|
+
log(level: TLogLevel, message: string, ...args: unknown[]): void;
|
|
16
|
+
for(methodName: string): ILogger;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=quiet-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quiet-logger.d.ts","sourceRoot":"","sources":["../../../src/common/quiet-logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGtE,mMAAmM;AACnM,qBAAa,WAAY,YAAW,OAAO;IAIrB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAH1C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAkC;IAC/D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC,OAAO;IAIP,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAWlC,OAAO,CAAC,KAAK;IAIb,KAAK,IAAI,IAAI;IAEb,IAAI,IAAI,IAAI;IAEZ,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIhD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIhD,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAQhE,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAGjC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { LogLevels } from '@venizia/ignis-helpers/core';
|
|
2
|
+
/** The generator's own output goes through `console.log`; framework diagnostics below `warn` are dropped and the rest land on stderr, so a codegen run prints nothing but its result on stdout. */
|
|
3
|
+
export class QuietLogger {
|
|
4
|
+
static { this.cache = new Map(); }
|
|
5
|
+
constructor(scope) {
|
|
6
|
+
this.scope = scope;
|
|
7
|
+
this.prefix = scope === '' ? '' : `[${scope}] `;
|
|
8
|
+
}
|
|
9
|
+
static get(scope) {
|
|
10
|
+
const cached = this.cache.get(scope);
|
|
11
|
+
if (cached) {
|
|
12
|
+
return cached;
|
|
13
|
+
}
|
|
14
|
+
const created = new QuietLogger(scope);
|
|
15
|
+
this.cache.set(scope, created);
|
|
16
|
+
return created;
|
|
17
|
+
}
|
|
18
|
+
write(opts) {
|
|
19
|
+
console.error(`${this.prefix}${opts.message}`, ...opts.args);
|
|
20
|
+
}
|
|
21
|
+
debug() { }
|
|
22
|
+
info() { }
|
|
23
|
+
warn(message, ...args) {
|
|
24
|
+
this.write({ message, args });
|
|
25
|
+
}
|
|
26
|
+
error(message, ...args) {
|
|
27
|
+
this.write({ message, args });
|
|
28
|
+
}
|
|
29
|
+
emerg(message, ...args) {
|
|
30
|
+
this.write({ message, args });
|
|
31
|
+
}
|
|
32
|
+
log(level, message, ...args) {
|
|
33
|
+
if (level === LogLevels.DEBUG || level === LogLevels.INFO) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this.write({ message, args });
|
|
37
|
+
}
|
|
38
|
+
for(methodName) {
|
|
39
|
+
return QuietLogger.get(this.scope === '' ? methodName : `${this.scope}-${methodName}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=quiet-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quiet-logger.js","sourceRoot":"","sources":["../../../src/common/quiet-logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,mMAAmM;AACnM,MAAM,OAAO,WAAW;aACE,UAAK,GAAG,IAAI,GAAG,EAAuB,CAAC;IAG/D,YAAqC,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QAChD,IAAI,CAAC,MAAM,GAAG,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,KAAa;QACtB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC;IACjB,CAAC;IAEO,KAAK,CAAC,IAA0C;QACtD,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,KAAU,CAAC;IAEhB,IAAI,KAAU,CAAC;IAEf,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;QACtC,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;QACvC,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;QACvC,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,GAAG,CAAC,KAAgB,EAAE,OAAe,EAAE,GAAG,IAAe;QACvD,IAAI,KAAK,KAAK,SAAS,CAAC,KAAK,IAAI,KAAK,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;YAC1D,OAAO;QACT,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,GAAG,CAAC,UAAkB;QACpB,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,UAAU,EAAE,CAAC,CAAC;IACzF,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { TConstValue } from '@venizia/ignis-helpers';
|
|
2
2
|
/** Mirrors the kernel's `ArtifactTypes` values; boot must not depend on kernel (`{boot, kernel} -> core` in the build chain). */
|
|
3
3
|
export declare class ArtifactTypes {
|
|
4
|
+
static readonly CONFIGURATION = "configuration";
|
|
4
5
|
static readonly COMPONENT = "component";
|
|
5
6
|
static readonly CONTROLLER = "controller";
|
|
6
7
|
static readonly SERVICE = "service";
|
|
@@ -13,6 +14,7 @@ export declare class ArtifactTypes {
|
|
|
13
14
|
export type TArtifactType = TConstValue<typeof ArtifactTypes>;
|
|
14
15
|
/** Mirrors the kernel's `ArtifactIndexFields` - the keys of the object the emitter writes and `registerArtifacts` reads. */
|
|
15
16
|
export declare class ArtifactIndexFields {
|
|
17
|
+
static readonly CONFIGURATIONS = "configurations";
|
|
16
18
|
static readonly DATA_SOURCES = "dataSources";
|
|
17
19
|
static readonly COMPONENTS = "components";
|
|
18
20
|
static readonly REPOSITORIES = "repositories";
|
|
@@ -30,7 +32,12 @@ export declare class ArtifactStereotypes {
|
|
|
30
32
|
static isValid(value: string): boolean;
|
|
31
33
|
static readonly SOURCE_MODULES: RegExp;
|
|
32
34
|
static readonly DEFAULT_IGNORE: string[];
|
|
33
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* The kernel's `registerArtifacts` order; `model` is never emitted. Configurations come first:
|
|
37
|
+
* `registerConfigurations` runs before the datasource and component sweeps, so a `@configuration`
|
|
38
|
+
* can shape what they read. The kernel sorts them among themselves by their `after` declarations
|
|
39
|
+
* at boot, so the order within the field does not matter here.
|
|
40
|
+
*/
|
|
34
41
|
static readonly EMIT_ORDER: ReadonlyArray<{
|
|
35
42
|
type: TArtifactType;
|
|
36
43
|
field: TArtifactIndexField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/generator/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,iIAAiI;AACjI,qBAAa,aAAa;IACxB,MAAM,CAAC,QAAQ,CAAC,SAAS,eAAe;IACxC,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IACpC,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;IAEhC,MAAM,CAAC,QAAQ,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/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aAAa,CAAC,CAAC,CAQnE;IAEF,MAAM,CAAC,QAAQ,CAAC,cAAc,gBAAgB;IAE9C,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAoE;IAE9F,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAItC,MAAM,CAAC,QAAQ,CAAC,cAAc,SAAiC;IAE/D,MAAM,CAAC,QAAQ,CAAC,cAAc,WAK5B;IAEF;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,mBAAmB,CAAA;KAAE,CAAC,CAO5F;CACH"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Mirrors the kernel's `ArtifactTypes` values; boot must not depend on kernel (`{boot, kernel} -> core` in the build chain). */
|
|
2
2
|
export class ArtifactTypes {
|
|
3
|
+
static { this.CONFIGURATION = 'configuration'; }
|
|
3
4
|
static { this.COMPONENT = 'component'; }
|
|
4
5
|
static { this.CONTROLLER = 'controller'; }
|
|
5
6
|
static { this.SERVICE = 'service'; }
|
|
@@ -7,6 +8,7 @@ export class ArtifactTypes {
|
|
|
7
8
|
static { this.DATASOURCE = 'datasource'; }
|
|
8
9
|
static { this.MODEL = 'model'; }
|
|
9
10
|
static { this.SCHEME_SET = new Set([
|
|
11
|
+
this.CONFIGURATION,
|
|
10
12
|
this.COMPONENT,
|
|
11
13
|
this.CONTROLLER,
|
|
12
14
|
this.SERVICE,
|
|
@@ -20,12 +22,14 @@ export class ArtifactTypes {
|
|
|
20
22
|
}
|
|
21
23
|
/** Mirrors the kernel's `ArtifactIndexFields` - the keys of the object the emitter writes and `registerArtifacts` reads. */
|
|
22
24
|
export class ArtifactIndexFields {
|
|
25
|
+
static { this.CONFIGURATIONS = 'configurations'; }
|
|
23
26
|
static { this.DATA_SOURCES = 'dataSources'; }
|
|
24
27
|
static { this.COMPONENTS = 'components'; }
|
|
25
28
|
static { this.REPOSITORIES = 'repositories'; }
|
|
26
29
|
static { this.SERVICES = 'services'; }
|
|
27
30
|
static { this.CONTROLLERS = 'controllers'; }
|
|
28
31
|
static { this.SCHEME_SET = new Set([
|
|
32
|
+
this.CONFIGURATIONS,
|
|
29
33
|
this.DATA_SOURCES,
|
|
30
34
|
this.COMPONENTS,
|
|
31
35
|
this.REPOSITORIES,
|
|
@@ -39,6 +43,7 @@ export class ArtifactIndexFields {
|
|
|
39
43
|
export class ArtifactStereotypes {
|
|
40
44
|
/** Decorator name as imported from `@venizia/ignis` or `@venizia/ignis-kernel` -> artifact type. */
|
|
41
45
|
static { this.BY_DECORATOR = {
|
|
46
|
+
configuration: ArtifactTypes.CONFIGURATION,
|
|
42
47
|
component: ArtifactTypes.COMPONENT,
|
|
43
48
|
controller: ArtifactTypes.CONTROLLER,
|
|
44
49
|
service: ArtifactTypes.SERVICE,
|
|
@@ -58,8 +63,14 @@ export class ArtifactStereotypes {
|
|
|
58
63
|
'**/*.spec.ts',
|
|
59
64
|
'**/generated/**',
|
|
60
65
|
]; }
|
|
61
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* The kernel's `registerArtifacts` order; `model` is never emitted. Configurations come first:
|
|
68
|
+
* `registerConfigurations` runs before the datasource and component sweeps, so a `@configuration`
|
|
69
|
+
* can shape what they read. The kernel sorts them among themselves by their `after` declarations
|
|
70
|
+
* at boot, so the order within the field does not matter here.
|
|
71
|
+
*/
|
|
62
72
|
static { this.EMIT_ORDER = [
|
|
73
|
+
{ type: ArtifactTypes.CONFIGURATION, field: ArtifactIndexFields.CONFIGURATIONS },
|
|
63
74
|
{ type: ArtifactTypes.DATASOURCE, field: ArtifactIndexFields.DATA_SOURCES },
|
|
64
75
|
{ type: ArtifactTypes.COMPONENT, field: ArtifactIndexFields.COMPONENTS },
|
|
65
76
|
{ type: ArtifactTypes.REPOSITORY, field: ArtifactIndexFields.REPOSITORIES },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file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uE;QAC/F,EAAE,IAAI,EAAE,aAAa,CAAC,aAAa,EAAE,KAAK,EAAE,mBAAmB,CAAC,cAAc,EAAE;QAChF,EAAE,IAAI,EAAE,aAAa,CAAC,UAAU,EAAE,KAAK,EAAE,mBAAmB,CAAC,YAAY,EAAE;QAC3E,EAAE,IAAI,EAAE,aAAa,CAAC,SAAS,EAAE,KAAK,EAAE,mBAAmB,CAAC,UAAU,EAAE;QACxE,EAAE,IAAI,EAAE,aAAa,CAAC,UAAU,EAAE,KAAK,EAAE,mBAAmB,CAAC,YAAY,EAAE;QAC3E,EAAE,IAAI,EAAE,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,mBAAmB,CAAC,QAAQ,EAAE;QACpE,EAAE,IAAI,EAAE,aAAa,CAAC,UAAU,EAAE,KAAK,EAAE,mBAAmB,CAAC,WAAW,EAAE;KAC3E,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './constants';
|
|
2
|
-
export * from './types';
|
|
1
|
+
export * from './constants.js';
|
|
2
|
+
export * from './types.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './constants';
|
|
2
|
-
export * from './types';
|
|
1
|
+
export * from './constants.js';
|
|
2
|
+
export * from './types.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TArtifactType } from './constants';
|
|
1
|
+
import type { TArtifactType } from './constants.js';
|
|
2
2
|
export interface IScannedArtifact {
|
|
3
3
|
className: string;
|
|
4
4
|
/** Absolute path of the declaring file. */
|
|
@@ -10,4 +10,9 @@ export interface IScanOptions {
|
|
|
10
10
|
/** Glob patterns relative to `root`; defaults to `ArtifactStereotypes.DEFAULT_IGNORE`. */
|
|
11
11
|
ignore?: string[];
|
|
12
12
|
}
|
|
13
|
+
/** The index content plus what a caller's `ignore` silently left out: decorated classes under a user pattern, never under a default one. */
|
|
14
|
+
export interface IScanReport {
|
|
15
|
+
artifacts: IScannedArtifact[];
|
|
16
|
+
ignored: IScannedArtifact[];
|
|
17
|
+
}
|
|
13
18
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/generator/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,0FAA0F;IAC1F,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/generator/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,0FAA0F;IAC1F,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,4IAA4I;AAC5I,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B"}
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
import { type IScannedArtifact } from './common';
|
|
1
|
+
import { type IScannedArtifact } from './common/index.js';
|
|
2
2
|
/** Renders the generated index: deterministic text, plain static imports, no IGNIS import - the object is type-checked where `registerArtifacts` receives it. */
|
|
3
3
|
export declare class ArtifactIndexEmitter {
|
|
4
4
|
/** Mirrors `printWidth` in @venizia/dev-configs prettier settings. */
|
|
5
5
|
static readonly PRINT_WIDTH = 100;
|
|
6
|
-
static readonly
|
|
6
|
+
static readonly DEFAULT_EXPORT_NAME = "GeneratedArtifacts";
|
|
7
|
+
/** The exact command that regenerates the file, so the header never points at another path than the one the build used. */
|
|
8
|
+
static renderHeader(opts: {
|
|
9
|
+
root: string;
|
|
10
|
+
out: string;
|
|
11
|
+
ignore?: string[];
|
|
12
|
+
exportName?: string;
|
|
13
|
+
}): string;
|
|
7
14
|
static render(opts: {
|
|
8
15
|
artifacts: IScannedArtifact[];
|
|
9
16
|
outFile: string;
|
|
10
17
|
exportName: string;
|
|
18
|
+
/** The CLI arguments as given, for the header; `outFile` above is the resolved path used for import specifiers. */
|
|
19
|
+
command: {
|
|
20
|
+
root: string;
|
|
21
|
+
out: string;
|
|
22
|
+
ignore?: string[];
|
|
23
|
+
};
|
|
11
24
|
}): string;
|
|
12
25
|
/** One line while it fits the repo's prettier width, else one name per line - so `prettier -l` on the generated file stays quiet. */
|
|
13
26
|
private static renderField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../../src/generator/emitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAsC,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAErF,iKAAiK;AACjK,qBAAa,oBAAoB;IAC/B,sEAAsE;IACtE,MAAM,CAAC,QAAQ,CAAC,WAAW,OAAO;IAElC,MAAM,CAAC,QAAQ,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../../src/generator/emitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAsC,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAErF,iKAAiK;AACjK,qBAAa,oBAAoB;IAC/B,sEAAsE;IACtE,MAAM,CAAC,QAAQ,CAAC,WAAW,OAAO;IAElC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,wBAAwB;IAE3D,2HAA2H;IAC3H,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE;QACxB,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,MAAM;IAYV,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAClB,SAAS,EAAE,gBAAgB,EAAE,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,mHAAmH;QACnH,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC;KAC3D,GAAG,MAAM;IAgCV,qIAAqI;IACrI,OAAO,CAAC,MAAM,CAAC,WAAW;IAW1B,OAAO,CAAC,MAAM,CAAC,UAAU;CAI1B"}
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import { dirname, relative, sep } from 'node:path';
|
|
2
|
-
import { ArtifactStereotypes, ArtifactTypes } from './common';
|
|
2
|
+
import { ArtifactStereotypes, ArtifactTypes } from './common/index.js';
|
|
3
3
|
/** Renders the generated index: deterministic text, plain static imports, no IGNIS import - the object is type-checked where `registerArtifacts` receives it. */
|
|
4
4
|
export class ArtifactIndexEmitter {
|
|
5
5
|
/** Mirrors `printWidth` in @venizia/dev-configs prettier settings. */
|
|
6
6
|
static { this.PRINT_WIDTH = 100; }
|
|
7
|
-
static { this.
|
|
7
|
+
static { this.DEFAULT_EXPORT_NAME = 'GeneratedArtifacts'; }
|
|
8
|
+
/** The exact command that regenerates the file, so the header never points at another path than the one the build used. */
|
|
9
|
+
static renderHeader(opts) {
|
|
10
|
+
const { root, out, ignore = [], exportName } = opts;
|
|
11
|
+
const flags = [`--root ${root}`, `--out ${out}`];
|
|
12
|
+
if (ignore.length > 0) {
|
|
13
|
+
flags.push(`--ignore ${ignore.join(',')}`);
|
|
14
|
+
}
|
|
15
|
+
if (exportName && exportName !== ArtifactIndexEmitter.DEFAULT_EXPORT_NAME) {
|
|
16
|
+
flags.push(`--export ${exportName}`);
|
|
17
|
+
}
|
|
18
|
+
return `// AUTO-GENERATED by @venizia/ignis-boot - do not edit. Regenerate: ignis-artifacts generate ${flags.join(' ')}`;
|
|
19
|
+
}
|
|
8
20
|
static render(opts) {
|
|
9
|
-
const { artifacts, outFile, exportName } = opts;
|
|
21
|
+
const { artifacts, outFile, exportName, command } = opts;
|
|
10
22
|
const emitted = artifacts.filter(artifact => artifact.type !== ArtifactTypes.MODEL);
|
|
11
23
|
const imports = emitted
|
|
12
24
|
.map(artifact => ({
|
|
@@ -23,7 +35,7 @@ export class ArtifactIndexEmitter {
|
|
|
23
35
|
return ArtifactIndexEmitter.renderField({ field, names });
|
|
24
36
|
});
|
|
25
37
|
return [
|
|
26
|
-
ArtifactIndexEmitter.
|
|
38
|
+
ArtifactIndexEmitter.renderHeader({ ...command, exportName }),
|
|
27
39
|
...imports,
|
|
28
40
|
'',
|
|
29
41
|
`export const ${exportName} = {`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../../src/generator/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAyB,MAAM,UAAU,CAAC;AAErF,iKAAiK;AACjK,MAAM,OAAO,oBAAoB;IAC/B,sEAAsE;aACtD,gBAAW,GAAG,GAAG,CAAC;aAElB,
|
|
1
|
+
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../../src/generator/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAA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AK,EAAE,GAAG,IAAI,CAAC;QAC9B,MAAM,UAAU,GAAG,KAAK,KAAK,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAExD,IAAI,UAAU,CAAC,MAAM,IAAI,oBAAoB,CAAC,WAAW,EAAE,CAAC;YAC1D,OAAO,CAAC,UAAU,CAAC,CAAC;QACtB,CAAC;QAED,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,IAAI,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IACzE,CAAC;IAEO,MAAM,CAAC,UAAU,CAAC,IAAkC;QAC1D,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC5F,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;IAChD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IScannedArtifact } from './common';
|
|
1
|
+
import type { IScanReport, IScannedArtifact } from './common/index.js';
|
|
2
2
|
export interface IGenerateOptions {
|
|
3
3
|
root: string;
|
|
4
4
|
out: string;
|
|
@@ -9,16 +9,16 @@ export interface IGenerateOptions {
|
|
|
9
9
|
/** Writes the index only when its content changed, so an unchanged tree leaves the file's mtime alone. */
|
|
10
10
|
export declare const generateArtifactIndex: (opts: IGenerateOptions) => {
|
|
11
11
|
content: string;
|
|
12
|
-
artifacts: IScannedArtifact[];
|
|
13
12
|
written: boolean;
|
|
14
|
-
};
|
|
15
|
-
/** Renders in memory and compares with the committed file - the staleness gate for lint and CI. */
|
|
13
|
+
} & IScanReport;
|
|
14
|
+
/** Renders in memory and compares the body with the committed file - the staleness gate for lint and CI. */
|
|
16
15
|
export declare const checkArtifactIndex: (opts: IGenerateOptions) => {
|
|
17
16
|
isFresh: boolean;
|
|
18
17
|
expected: string;
|
|
19
18
|
actual: string | undefined;
|
|
19
|
+
ignored: IScannedArtifact[];
|
|
20
20
|
};
|
|
21
|
-
export * from './common';
|
|
22
|
-
export * from './emitter';
|
|
23
|
-
export * from './scanner';
|
|
21
|
+
export * from './common/index.js';
|
|
22
|
+
export * from './emitter.js';
|
|
23
|
+
export * from './scanner.js';
|
|
24
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generator/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generator/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAI9D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAiBD,0GAA0G;AAC1G,eAAO,MAAM,qBAAqB,GAChC,MAAM,gBAAgB,KACrB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,WAa1C,CAAC;AAKF,4GAA4G;AAC5G,eAAO,MAAM,kBAAkB,GAC7B,MAAM,gBAAgB,KACrB;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAQ7B,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
|
@@ -1,36 +1,43 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { dirname, resolve } from 'node:path';
|
|
3
|
-
import { ArtifactIndexEmitter } from './emitter';
|
|
4
|
-
import { ArtifactScanner } from './scanner';
|
|
3
|
+
import { ArtifactIndexEmitter } from './emitter.js';
|
|
4
|
+
import { ArtifactScanner } from './scanner.js';
|
|
5
5
|
const render = (opts) => {
|
|
6
|
-
const artifacts = ArtifactScanner.getInstance().
|
|
6
|
+
const { artifacts, ignored } = ArtifactScanner.getInstance().scanWithReport({
|
|
7
|
+
root: opts.root,
|
|
8
|
+
ignore: opts.ignore,
|
|
9
|
+
});
|
|
7
10
|
const content = ArtifactIndexEmitter.render({
|
|
8
11
|
artifacts,
|
|
9
12
|
outFile: resolve(opts.out),
|
|
10
|
-
exportName: opts.exportName ??
|
|
13
|
+
exportName: opts.exportName ?? ArtifactIndexEmitter.DEFAULT_EXPORT_NAME,
|
|
14
|
+
command: { root: opts.root, out: opts.out, ignore: opts.ignore },
|
|
11
15
|
});
|
|
12
|
-
return { content, artifacts };
|
|
16
|
+
return { content, artifacts, ignored };
|
|
13
17
|
};
|
|
14
18
|
/** Writes the index only when its content changed, so an unchanged tree leaves the file's mtime alone. */
|
|
15
19
|
export const generateArtifactIndex = (opts) => {
|
|
16
|
-
const { content, artifacts } = render(opts);
|
|
20
|
+
const { content, artifacts, ignored } = render(opts);
|
|
17
21
|
const out = resolve(opts.out);
|
|
18
22
|
const current = existsSync(out) ? readFileSync(out, 'utf8') : undefined;
|
|
19
23
|
if (current === content) {
|
|
20
|
-
return { content, artifacts, written: false };
|
|
24
|
+
return { content, artifacts, ignored, written: false };
|
|
21
25
|
}
|
|
22
26
|
mkdirSync(dirname(out), { recursive: true });
|
|
23
27
|
writeFileSync(out, content);
|
|
24
|
-
return { content, artifacts, written: true };
|
|
28
|
+
return { content, artifacts, ignored, written: true };
|
|
25
29
|
};
|
|
26
|
-
/**
|
|
30
|
+
/** Everything below the first line: the header only records the command, so a flag change alone must not read as drift. */
|
|
31
|
+
const bodyOf = (content) => content.slice(content.indexOf('\n') + 1);
|
|
32
|
+
/** Renders in memory and compares the body with the committed file - the staleness gate for lint and CI. */
|
|
27
33
|
export const checkArtifactIndex = (opts) => {
|
|
28
|
-
const { content: expected } = render(opts);
|
|
34
|
+
const { content: expected, ignored } = render(opts);
|
|
29
35
|
const out = resolve(opts.out);
|
|
30
36
|
const actual = existsSync(out) ? readFileSync(out, 'utf8') : undefined;
|
|
31
|
-
|
|
37
|
+
const isFresh = actual !== undefined && bodyOf(actual) === bodyOf(expected);
|
|
38
|
+
return { isFresh, expected, actual, ignored };
|
|
32
39
|
};
|
|
33
|
-
export * from './common';
|
|
34
|
-
export * from './emitter';
|
|
35
|
-
export * from './scanner';
|
|
40
|
+
export * from './common/index.js';
|
|
41
|
+
export * from './emitter.js';
|
|
42
|
+
export * from './scanner.js';
|
|
36
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/generator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAU5C,MAAM,MAAM,GAAG,CAAC,IAAsB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/generator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS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/ignis-helpers';
|
|
2
|
-
import { type IScanOptions, type IScannedArtifact } from './common';
|
|
2
|
+
import { type IScanOptions, type IScanReport, type IScannedArtifact } from './common/index.js';
|
|
3
3
|
/** Finds exported classes carrying a stereotype decorator by reading the source, never by running it. */
|
|
4
4
|
export declare class ArtifactScanner extends BaseHelper {
|
|
5
5
|
private static instance?;
|
|
6
6
|
private constructor();
|
|
7
7
|
static getInstance(): ArtifactScanner;
|
|
8
8
|
scan(opts: IScanOptions): IScannedArtifact[];
|
|
9
|
-
|
|
9
|
+
/** `scan` plus the decorated classes a caller's own `ignore` pattern hid - the generator prints them so a stale pattern cannot drop an artifact in silence. */
|
|
10
|
+
scanWithReport(opts: IScanOptions): IScanReport;
|
|
11
|
+
/** A hidden file is only reported on, never a reason to fail: a scan error becomes one warning and the file contributes nothing. */
|
|
12
|
+
private scanHiddenFile;
|
|
13
|
+
private sortArtifacts;
|
|
14
|
+
/** `kept` feeds the index; `hidden` is what only a user pattern excluded (a default pattern wins, so tests and generated files are never reported). */
|
|
15
|
+
private partitionSourceFiles;
|
|
10
16
|
private scanFile;
|
|
11
17
|
/** local identifier -> stereotype name, for named imports from an IGNIS module (aliases resolved). */
|
|
12
18
|
private collectStereotypeImports;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../../src/generator/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAY,MAAM,wBAAwB,CAAC;AAI9D,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAEtB,MAAM,UAAU,CAAC;AAElB,yGAAyG;AACzG,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAkB;IAE1C,OAAO;IAIP,MAAM,CAAC,WAAW,IAAI,eAAe;IAIrC,IAAI,CAAC,IAAI,EAAE,YAAY,GAAG,gBAAgB,EAAE;
|
|
1
|
+
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../../src/generator/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAY,MAAM,wBAAwB,CAAC;AAI9D,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EAEtB,MAAM,UAAU,CAAC;AAElB,yGAAyG;AACzG,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAkB;IAE1C,OAAO;IAIP,MAAM,CAAC,WAAW,IAAI,eAAe;IAIrC,IAAI,CAAC,IAAI,EAAE,YAAY,GAAG,gBAAgB,EAAE;IAI5C,+JAA+J;IAC/J,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,WAAW;IAY/C,oIAAoI;IACpI,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,aAAa;IAMrB,uJAAuJ;IACvJ,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,QAAQ;IAiEhB,sGAAsG;IACtG,OAAO,CAAC,wBAAwB;IA8BhC,OAAO,CAAC,wBAAwB;IAkBhC,OAAO,CAAC,eAAe;IA0CvB,OAAO,CAAC,oBAAoB;IA6B5B,OAAO,CAAC,cAAc;CAMvB"}
|
|
@@ -2,7 +2,7 @@ import { BaseHelper, getError } from '@venizia/ignis-helpers';
|
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import { join, resolve } from 'node:path';
|
|
4
4
|
import ts from 'typescript';
|
|
5
|
-
import { ArtifactStereotypes, ArtifactTypes, } from './common';
|
|
5
|
+
import { ArtifactStereotypes, ArtifactTypes, } from './common/index.js';
|
|
6
6
|
/** Finds exported classes carrying a stereotype decorator by reading the source, never by running it. */
|
|
7
7
|
export class ArtifactScanner extends BaseHelper {
|
|
8
8
|
constructor() {
|
|
@@ -12,24 +12,49 @@ export class ArtifactScanner extends BaseHelper {
|
|
|
12
12
|
return (this.instance ??= new ArtifactScanner());
|
|
13
13
|
}
|
|
14
14
|
scan(opts) {
|
|
15
|
+
return this.scanWithReport(opts).artifacts;
|
|
16
|
+
}
|
|
17
|
+
/** `scan` plus the decorated classes a caller's own `ignore` pattern hid - the generator prints them so a stale pattern cannot drop an artifact in silence. */
|
|
18
|
+
scanWithReport(opts) {
|
|
15
19
|
const root = resolve(opts.root);
|
|
16
|
-
const
|
|
17
|
-
const
|
|
20
|
+
const defaultGlobs = ArtifactStereotypes.DEFAULT_IGNORE.map(pattern => new Bun.Glob(pattern));
|
|
21
|
+
const userGlobs = (opts.ignore ?? []).map(pattern => new Bun.Glob(pattern));
|
|
22
|
+
const { kept, hidden } = this.partitionSourceFiles({ root, defaultGlobs, userGlobs });
|
|
23
|
+
return {
|
|
24
|
+
artifacts: this.sortArtifacts(kept.flatMap(filePath => this.scanFile({ filePath }))),
|
|
25
|
+
ignored: this.sortArtifacts(hidden.flatMap(filePath => this.scanHiddenFile({ filePath }))),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** A hidden file is only reported on, never a reason to fail: a scan error becomes one warning and the file contributes nothing. */
|
|
29
|
+
scanHiddenFile(opts) {
|
|
30
|
+
try {
|
|
31
|
+
return this.scanFile({ filePath: opts.filePath, isHidden: true });
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
35
|
+
this.logger.for('scanHiddenFile').warn('Skipped hidden file %s | %s', opts.filePath, reason);
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
sortArtifacts(artifacts) {
|
|
18
40
|
return artifacts.sort((a, b) => a.type.localeCompare(b.type) || a.className.localeCompare(b.className));
|
|
19
41
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
42
|
+
/** `kept` feeds the index; `hidden` is what only a user pattern excluded (a default pattern wins, so tests and generated files are never reported). */
|
|
43
|
+
partitionSourceFiles(opts) {
|
|
44
|
+
const kept = [];
|
|
45
|
+
const hidden = [];
|
|
46
|
+
const sync = new Bun.Glob('**/*.ts').scanSync({ cwd: opts.root });
|
|
47
|
+
for (const relative of sync) {
|
|
48
|
+
if (relative.endsWith('.d.ts') || opts.defaultGlobs.some(glob => glob.match(relative))) {
|
|
25
49
|
continue;
|
|
26
50
|
}
|
|
27
|
-
|
|
51
|
+
const target = opts.userGlobs.some(glob => glob.match(relative)) ? hidden : kept;
|
|
52
|
+
target.push(join(opts.root, relative));
|
|
28
53
|
}
|
|
29
|
-
return
|
|
54
|
+
return { kept: kept.sort(), hidden: hidden.sort() };
|
|
30
55
|
}
|
|
31
56
|
scanFile(opts) {
|
|
32
|
-
const { filePath } = opts;
|
|
57
|
+
const { filePath, isHidden = false } = opts;
|
|
33
58
|
const source = ts.createSourceFile(filePath, readFileSync(filePath, 'utf8'), ts.ScriptTarget.Latest, true);
|
|
34
59
|
const stereotypeByLocalName = this.collectStereotypeImports({ source });
|
|
35
60
|
if (stereotypeByLocalName.size === 0) {
|
|
@@ -62,9 +87,11 @@ export class ArtifactScanner extends BaseHelper {
|
|
|
62
87
|
exportedNames.has(className);
|
|
63
88
|
const isAbstract = has(ts.SyntaxKind.AbstractKeyword);
|
|
64
89
|
if (!isNamedExport || isAbstract) {
|
|
65
|
-
|
|
66
|
-
.
|
|
67
|
-
|
|
90
|
+
if (!isHidden) {
|
|
91
|
+
this.logger
|
|
92
|
+
.for('scanFile')
|
|
93
|
+
.warn('Skipped %s in %s | %s', className, filePath, isAbstract ? 'abstract' : 'not a named export');
|
|
94
|
+
}
|
|
68
95
|
return;
|
|
69
96
|
}
|
|
70
97
|
found.push({ className, filePath, type: types[0] });
|
|
@@ -112,7 +139,8 @@ export class ArtifactScanner extends BaseHelper {
|
|
|
112
139
|
artifactTypesOf(opts) {
|
|
113
140
|
const { node, stereotypeByLocalName, filePath, className } = opts;
|
|
114
141
|
const types = [];
|
|
115
|
-
|
|
142
|
+
const decorators = ts.getDecorators(node) ?? [];
|
|
143
|
+
for (const decorator of decorators) {
|
|
116
144
|
const expression = decorator.expression;
|
|
117
145
|
if (!ts.isCallExpression(expression) || !ts.isIdentifier(expression.expression)) {
|
|
118
146
|
continue;
|