@venizia/ignis-boot 0.3.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/dist/cjs/generator/emitter.d.ts +2 -2
- package/dist/cjs/generator/emitter.d.ts.map +1 -1
- package/dist/cjs/generator/emitter.js +2 -2
- package/dist/cjs/generator/emitter.js.map +1 -1
- package/dist/esm/generator/emitter.d.ts +2 -2
- package/dist/esm/generator/emitter.d.ts.map +1 -1
- package/dist/esm/generator/emitter.js +2 -2
- package/dist/esm/generator/emitter.js.map +1 -1
- package/package.json +25 -26
package/LICENSE.md
CHANGED
|
@@ -62,7 +62,7 @@ Part of the Ignis monorepo:
|
|
|
62
62
|
| `@venizia/ignis-boot` | **This package** - Application bootstrapping |
|
|
63
63
|
| `@venizia/ignis-helpers` | Utility helpers - logging, cron, Redis, queues, storage |
|
|
64
64
|
| `@venizia/ignis-inversion` | Dependency Injection & IoC container |
|
|
65
|
-
| `@venizia/dev-configs` | Shared
|
|
65
|
+
| `@venizia/dev-configs` | Shared oxlint, ESLint, TypeScript configurations |
|
|
66
66
|
| `@venizia/ignis-docs` | Documentation and MCP Server |
|
|
67
67
|
|
|
68
68
|
---
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type IScannedArtifact } from './common';
|
|
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
|
-
/** Mirrors `printWidth` in
|
|
4
|
+
/** Mirrors `printWidth` in the root bunfig.toml `[fmt]` table. */
|
|
5
5
|
static readonly PRINT_WIDTH = 100;
|
|
6
6
|
static readonly DEFAULT_EXPORT_NAME = "GeneratedArtifacts";
|
|
7
7
|
/** The `ignis-artifacts generate` command for these options - the header and the CLI's stale hint print the same one. */
|
|
@@ -34,7 +34,7 @@ export declare class ArtifactIndexEmitter {
|
|
|
34
34
|
sourceModules?: string[];
|
|
35
35
|
};
|
|
36
36
|
}): string;
|
|
37
|
-
/** One line while it fits the
|
|
37
|
+
/** One line while it fits the print width, else one name per line - so `bun fmt --check` on the generated file stays quiet. */
|
|
38
38
|
private static renderField;
|
|
39
39
|
private static importPath;
|
|
40
40
|
}
|
|
@@ -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,
|
|
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,kEAAkE;IAClE,MAAM,CAAC,QAAQ,CAAC,WAAW,OAAO;IAElC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,wBAAwB;IAE3D,yHAAyH;IACzH,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE;QACzB,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,GAAG,MAAM;IAeV,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;QACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,GAAG,MAAM;IAIV,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAClB,SAAS,EAAE,gBAAgB,EAAE,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,2GAA2G;QAC3G,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,mHAAmH;QACnH,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;YAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC;KACrF,GAAG,MAAM;IAoCV,+HAA+H;IAC/H,OAAO,CAAC,MAAM,CAAC,WAAW;IAW1B,OAAO,CAAC,MAAM,CAAC,UAAU;CAU1B"}
|
|
@@ -5,7 +5,7 @@ const node_path_1 = require("node:path");
|
|
|
5
5
|
const common_1 = require("./common");
|
|
6
6
|
/** Renders the generated index: deterministic text, plain static imports, no IGNIS import - the object is type-checked where `registerArtifacts` receives it. */
|
|
7
7
|
class ArtifactIndexEmitter {
|
|
8
|
-
/** Mirrors `printWidth` in
|
|
8
|
+
/** Mirrors `printWidth` in the root bunfig.toml `[fmt]` table. */
|
|
9
9
|
static { this.PRINT_WIDTH = 100; }
|
|
10
10
|
static { this.DEFAULT_EXPORT_NAME = 'GeneratedArtifacts'; }
|
|
11
11
|
/** The `ignis-artifacts generate` command for these options - the header and the CLI's stale hint print the same one. */
|
|
@@ -58,7 +58,7 @@ class ArtifactIndexEmitter {
|
|
|
58
58
|
'',
|
|
59
59
|
].join('\n');
|
|
60
60
|
}
|
|
61
|
-
/** One line while it fits the
|
|
61
|
+
/** One line while it fits the print width, else one name per line - so `bun fmt --check` on the generated file stays quiet. */
|
|
62
62
|
static renderField(opts) {
|
|
63
63
|
const { field, names } = opts;
|
|
64
64
|
const singleLine = ` ${field}: [${names.join(', ')}],`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../../src/generator/emitter.ts"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AAG,CAAC;aACT,OAAO,CAAC,4BAAmB,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QACrD,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;IAChD,CAAC;;AAxGH,oDAyGC","sourcesContent":["import { dirname, relative, sep } from 'node:path';\nimport { ArtifactStereotypes, ArtifactTypes, type IScannedArtifact } from './common';\n\n/** Renders the generated index: deterministic text, plain static imports, no IGNIS import - the object is type-checked where `registerArtifacts` receives it. */\nexport class ArtifactIndexEmitter {\n /** Mirrors `printWidth` in the root bunfig.toml `[fmt]` table. */\n static readonly PRINT_WIDTH = 100;\n\n static readonly DEFAULT_EXPORT_NAME = 'GeneratedArtifacts';\n\n /** The `ignis-artifacts generate` command for these options - the header and the CLI's stale hint print the same one. */\n static renderCommand(opts: {\n root: string;\n out: string;\n ignore?: string[];\n exportName?: string;\n sourceModules?: string[];\n }): string {\n const { root, out, ignore = [], exportName, sourceModules = [] } = opts;\n const flags = [`--root ${root}`, `--out ${out}`];\n if (ignore.length > 0) {\n flags.push(`--ignore ${ignore.join(',')}`);\n }\n if (exportName && exportName !== ArtifactIndexEmitter.DEFAULT_EXPORT_NAME) {\n flags.push(`--export ${exportName}`);\n }\n for (const sourceModule of sourceModules) {\n flags.push(`--source-module ${sourceModule}`);\n }\n return `ignis-artifacts generate ${flags.join(' ')}`;\n }\n\n /** The exact command that regenerates the file, so the header never points at another path than the one the build used. */\n static renderHeader(opts: {\n root: string;\n out: string;\n ignore?: string[];\n exportName?: string;\n sourceModules?: string[];\n }): string {\n return `// AUTO-GENERATED by @venizia/ignis-boot - do not edit. Regenerate: ${ArtifactIndexEmitter.renderCommand(opts)}`;\n }\n\n static render(opts: {\n artifacts: IScannedArtifact[];\n outFile: string;\n exportName: string;\n /** Absolute import paths - for a virtual module, which has no directory to resolve a relative one from. */\n absoluteImports?: boolean;\n /** The CLI arguments as given, for the header; `outFile` above is the resolved path used for import specifiers. */\n command: { root: string; out: string; ignore?: string[]; sourceModules?: string[] };\n }): string {\n const { artifacts, outFile, exportName, command } = opts;\n const emitted = artifacts.filter(artifact => artifact.type !== ArtifactTypes.MODEL);\n\n const imports = emitted\n .map(artifact => ({\n name: artifact.className,\n path: ArtifactIndexEmitter.importPath({\n from: outFile,\n to: artifact.filePath,\n isAbsolute: opts.absoluteImports ?? false,\n }),\n }))\n .sort((a, b) => a.path.localeCompare(b.path) || a.name.localeCompare(b.name))\n .map(entry => `import { ${entry.name} } from '${entry.path}';`);\n\n const fields = ArtifactStereotypes.EMIT_ORDER.flatMap(({ type, field }) => {\n const names = emitted\n .filter(artifact => artifact.type === type)\n .map(artifact => artifact.className)\n .sort((a, b) => a.localeCompare(b));\n\n return ArtifactIndexEmitter.renderField({ field, names });\n });\n\n return [\n ArtifactIndexEmitter.renderHeader({ ...command, exportName }),\n ...imports,\n '',\n `export const ${exportName} = {`,\n ...fields,\n '};',\n '',\n ].join('\\n');\n }\n\n /** One line while it fits the print width, else one name per line - so `bun fmt --check` on the generated file stays quiet. */\n private static renderField(opts: { field: string; names: string[] }): string[] {\n const { field, names } = opts;\n const singleLine = ` ${field}: [${names.join(', ')}],`;\n\n if (singleLine.length <= ArtifactIndexEmitter.PRINT_WIDTH) {\n return [singleLine];\n }\n\n return [` ${field}: [`, ...names.map(name => ` ${name},`), ' ],'];\n }\n\n private static importPath(opts: { from: string; to: string; isAbsolute: boolean }): string {\n if (opts.isAbsolute) {\n return opts.to.split(sep).join('/').replace(ArtifactStereotypes.SOURCE_EXTENSION, '');\n }\n const raw = relative(dirname(opts.from), opts.to)\n .split(sep)\n .join('/')\n .replace(ArtifactStereotypes.SOURCE_EXTENSION, '');\n return raw.startsWith('.') ? raw : `./${raw}`;\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
/** Mirrors `printWidth` in
|
|
4
|
+
/** Mirrors `printWidth` in the root bunfig.toml `[fmt]` table. */
|
|
5
5
|
static readonly PRINT_WIDTH = 100;
|
|
6
6
|
static readonly DEFAULT_EXPORT_NAME = "GeneratedArtifacts";
|
|
7
7
|
/** The `ignis-artifacts generate` command for these options - the header and the CLI's stale hint print the same one. */
|
|
@@ -34,7 +34,7 @@ export declare class ArtifactIndexEmitter {
|
|
|
34
34
|
sourceModules?: string[];
|
|
35
35
|
};
|
|
36
36
|
}): string;
|
|
37
|
-
/** One line while it fits the
|
|
37
|
+
/** One line while it fits the print width, else one name per line - so `bun fmt --check` on the generated file stays quiet. */
|
|
38
38
|
private static renderField;
|
|
39
39
|
private static importPath;
|
|
40
40
|
}
|
|
@@ -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,
|
|
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,kEAAkE;IAClE,MAAM,CAAC,QAAQ,CAAC,WAAW,OAAO;IAElC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,wBAAwB;IAE3D,yHAAyH;IACzH,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE;QACzB,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,GAAG,MAAM;IAeV,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;QACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,GAAG,MAAM;IAIV,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAClB,SAAS,EAAE,gBAAgB,EAAE,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,2GAA2G;QAC3G,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,mHAAmH;QACnH,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;YAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC;KACrF,GAAG,MAAM;IAoCV,+HAA+H;IAC/H,OAAO,CAAC,MAAM,CAAC,WAAW;IAW1B,OAAO,CAAC,MAAM,CAAC,UAAU;CAU1B"}
|
|
@@ -2,7 +2,7 @@ import { dirname, relative, sep } from 'node:path';
|
|
|
2
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
|
-
/** Mirrors `printWidth` in
|
|
5
|
+
/** Mirrors `printWidth` in the root bunfig.toml `[fmt]` table. */
|
|
6
6
|
static { this.PRINT_WIDTH = 100; }
|
|
7
7
|
static { this.DEFAULT_EXPORT_NAME = 'GeneratedArtifacts'; }
|
|
8
8
|
/** The `ignis-artifacts generate` command for these options - the header and the CLI's stale hint print the same one. */
|
|
@@ -55,7 +55,7 @@ export class ArtifactIndexEmitter {
|
|
|
55
55
|
'',
|
|
56
56
|
].join('\n');
|
|
57
57
|
}
|
|
58
|
-
/** One line while it fits the
|
|
58
|
+
/** One line while it fits the print width, else one name per line - so `bun fmt --check` on the generated file stays quiet. */
|
|
59
59
|
static renderField(opts) {
|
|
60
60
|
const { field, names } = opts;
|
|
61
61
|
const singleLine = ` ${field}: [${names.join(', ')}],`;
|
|
@@ -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,
|
|
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,kEAAkE;aAClD,gBAAW,GAAG,GAAG,CAAC;aAElB,wBAAmB,GAAG,oBAAoB,CAAC;IAE3D,yHAAyH;IACzH,MAAM,CAAC,aAAa,CAAC,IAMpB;QACC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,EAAE,UAAU,EAAE,aAAa,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QACxE,MAAM,KAAK,GAAG,CAAC,UAAU,IAAI,EAAE,EAAE,SAAS,GAAG,EAAE,CAAC,CAAC;QACjD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EA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D,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,IAAuD;QAC/E,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QACxF,CAAC;QACD,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;aAC9C,KAAK,CAAC,GAAG,CAAC;aACV,IAAI,CAAC,GAAG,CAAC;aACT,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QACrD,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;IAChD,CAAC","sourcesContent":["import { dirname, relative, sep } from 'node:path';\nimport { ArtifactStereotypes, ArtifactTypes, type IScannedArtifact } from './common';\n\n/** Renders the generated index: deterministic text, plain static imports, no IGNIS import - the object is type-checked where `registerArtifacts` receives it. */\nexport class ArtifactIndexEmitter {\n /** Mirrors `printWidth` in the root bunfig.toml `[fmt]` table. */\n static readonly PRINT_WIDTH = 100;\n\n static readonly DEFAULT_EXPORT_NAME = 'GeneratedArtifacts';\n\n /** The `ignis-artifacts generate` command for these options - the header and the CLI's stale hint print the same one. */\n static renderCommand(opts: {\n root: string;\n out: string;\n ignore?: string[];\n exportName?: string;\n sourceModules?: string[];\n }): string {\n const { root, out, ignore = [], exportName, sourceModules = [] } = opts;\n const flags = [`--root ${root}`, `--out ${out}`];\n if (ignore.length > 0) {\n flags.push(`--ignore ${ignore.join(',')}`);\n }\n if (exportName && exportName !== ArtifactIndexEmitter.DEFAULT_EXPORT_NAME) {\n flags.push(`--export ${exportName}`);\n }\n for (const sourceModule of sourceModules) {\n flags.push(`--source-module ${sourceModule}`);\n }\n return `ignis-artifacts generate ${flags.join(' ')}`;\n }\n\n /** The exact command that regenerates the file, so the header never points at another path than the one the build used. */\n static renderHeader(opts: {\n root: string;\n out: string;\n ignore?: string[];\n exportName?: string;\n sourceModules?: string[];\n }): string {\n return `// AUTO-GENERATED by @venizia/ignis-boot - do not edit. Regenerate: ${ArtifactIndexEmitter.renderCommand(opts)}`;\n }\n\n static render(opts: {\n artifacts: IScannedArtifact[];\n outFile: string;\n exportName: string;\n /** Absolute import paths - for a virtual module, which has no directory to resolve a relative one from. */\n absoluteImports?: boolean;\n /** The CLI arguments as given, for the header; `outFile` above is the resolved path used for import specifiers. */\n command: { root: string; out: string; ignore?: string[]; sourceModules?: string[] };\n }): string {\n const { artifacts, outFile, exportName, command } = opts;\n const emitted = artifacts.filter(artifact => artifact.type !== ArtifactTypes.MODEL);\n\n const imports = emitted\n .map(artifact => ({\n name: artifact.className,\n path: ArtifactIndexEmitter.importPath({\n from: outFile,\n to: artifact.filePath,\n isAbsolute: opts.absoluteImports ?? false,\n }),\n }))\n .sort((a, b) => a.path.localeCompare(b.path) || a.name.localeCompare(b.name))\n .map(entry => `import { ${entry.name} } from '${entry.path}';`);\n\n const fields = ArtifactStereotypes.EMIT_ORDER.flatMap(({ type, field }) => {\n const names = emitted\n .filter(artifact => artifact.type === type)\n .map(artifact => artifact.className)\n .sort((a, b) => a.localeCompare(b));\n\n return ArtifactIndexEmitter.renderField({ field, names });\n });\n\n return [\n ArtifactIndexEmitter.renderHeader({ ...command, exportName }),\n ...imports,\n '',\n `export const ${exportName} = {`,\n ...fields,\n '};',\n '',\n ].join('\\n');\n }\n\n /** One line while it fits the print width, else one name per line - so `bun fmt --check` on the generated file stays quiet. */\n private static renderField(opts: { field: string; names: string[] }): string[] {\n const { field, names } = opts;\n const singleLine = ` ${field}: [${names.join(', ')}],`;\n\n if (singleLine.length <= ArtifactIndexEmitter.PRINT_WIDTH) {\n return [singleLine];\n }\n\n return [` ${field}: [`, ...names.map(name => ` ${name},`), ' ],'];\n }\n\n private static importPath(opts: { from: string; to: string; isAbsolute: boolean }): string {\n if (opts.isAbsolute) {\n return opts.to.split(sep).join('/').replace(ArtifactStereotypes.SOURCE_EXTENSION, '');\n }\n const raw = relative(dirname(opts.from), opts.to)\n .split(sep)\n .join('/')\n .replace(ArtifactStereotypes.SOURCE_EXTENSION, '');\n return raw.startsWith('.') ? raw : `./${raw}`;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ignis-boot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Build-time artifact index generator for IGNIS applications: scans decorated classes with the TypeScript AST and emits one static registration file per package, so bun build --compile sees plain imports.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"artifact-index",
|
|
@@ -15,23 +15,34 @@
|
|
|
15
15
|
"venizia"
|
|
16
16
|
],
|
|
17
17
|
"homepage": "https://ignis.venizia.ai",
|
|
18
|
-
"repository": {
|
|
19
|
-
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/VENIZIA-AI/ignis.git",
|
|
21
|
-
"directory": "packages/boot"
|
|
22
|
-
},
|
|
23
18
|
"bugs": {
|
|
24
19
|
"url": "https://github.com/VENIZIA-AI/ignis/issues"
|
|
25
20
|
},
|
|
21
|
+
"license": "MIT",
|
|
26
22
|
"author": {
|
|
27
23
|
"name": "VENIZIA AI Developer",
|
|
28
24
|
"email": "developer@venizia.ai",
|
|
29
25
|
"url": "https://venizia.ai"
|
|
30
26
|
},
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
"
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/VENIZIA-AI/ignis.git",
|
|
30
|
+
"directory": "packages/boot"
|
|
31
|
+
},
|
|
32
|
+
"bin": {
|
|
33
|
+
"ignis-artifacts": "./dist/cjs/clis/artifacts.js"
|
|
34
34
|
},
|
|
35
|
+
"files": [
|
|
36
|
+
"README.md",
|
|
37
|
+
"LICENSE.md",
|
|
38
|
+
"dist",
|
|
39
|
+
"!**/__tests__",
|
|
40
|
+
"!**/*.tsbuildinfo"
|
|
41
|
+
],
|
|
42
|
+
"sideEffects": [
|
|
43
|
+
"./dist/cjs/bun/auto.js",
|
|
44
|
+
"./dist/esm/bun/auto.js"
|
|
45
|
+
],
|
|
35
46
|
"main": "./dist/cjs/index.js",
|
|
36
47
|
"module": "./dist/esm/index.js",
|
|
37
48
|
"types": "./dist/cjs/index.d.ts",
|
|
@@ -74,34 +85,22 @@
|
|
|
74
85
|
"default": "./dist/cjs/build-info/index.js"
|
|
75
86
|
}
|
|
76
87
|
},
|
|
77
|
-
"files": [
|
|
78
|
-
"README.md",
|
|
79
|
-
"LICENSE.md",
|
|
80
|
-
"dist",
|
|
81
|
-
"!**/__tests__",
|
|
82
|
-
"!**/*.tsbuildinfo"
|
|
83
|
-
],
|
|
84
88
|
"publishConfig": {
|
|
85
89
|
"access": "public"
|
|
86
90
|
},
|
|
87
|
-
"sideEffects": [
|
|
88
|
-
"./dist/cjs/bun/auto.js",
|
|
89
|
-
"./dist/esm/bun/auto.js"
|
|
90
|
-
],
|
|
91
91
|
"scripts": {
|
|
92
92
|
"force-update": "sh ../../scripts/force-update.sh",
|
|
93
93
|
"prepublishOnly": "make rebuild",
|
|
94
94
|
"test": "bun test ./src"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@venizia/ignis-helpers": "0.
|
|
98
|
-
"@venizia/ignis-inversion": "0.
|
|
97
|
+
"@venizia/ignis-helpers": "0.4.0",
|
|
98
|
+
"@venizia/ignis-inversion": "0.4.0"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@types/bun": "^1.4.3",
|
|
102
|
-
"@venizia/dev-configs": "0.
|
|
102
|
+
"@venizia/dev-configs": "0.4.0",
|
|
103
103
|
"eslint": "^10.13.0",
|
|
104
|
-
"oxfmt": "0.74.0",
|
|
105
104
|
"oxlint": "1.89.0",
|
|
106
105
|
"oxlint-tsgolint": "7.0.2004",
|
|
107
106
|
"tsc-alias": "1.9.4",
|
|
@@ -110,7 +109,7 @@
|
|
|
110
109
|
"peerDependencies": {
|
|
111
110
|
"typescript": "^5.0.0 || ^6.0.0"
|
|
112
111
|
},
|
|
113
|
-
"
|
|
114
|
-
"
|
|
112
|
+
"engines": {
|
|
113
|
+
"bun": ">=1.4"
|
|
115
114
|
}
|
|
116
115
|
}
|