@venizia/ignis-boot 0.2.0-7 → 0.2.0-9

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.
Files changed (174) hide show
  1. package/README.md +87 -158
  2. package/dist/cjs/cli.d.ts +3 -0
  3. package/dist/cjs/cli.d.ts.map +1 -0
  4. package/dist/cjs/cli.js +50 -0
  5. package/dist/cjs/cli.js.map +1 -0
  6. package/dist/cjs/generator/common/constants.d.ts +39 -0
  7. package/dist/cjs/generator/common/constants.d.ts.map +1 -0
  8. package/dist/cjs/generator/common/constants.js +76 -0
  9. package/dist/cjs/generator/common/constants.js.map +1 -0
  10. package/dist/{esm → cjs/generator}/common/index.d.ts +1 -1
  11. package/dist/cjs/generator/common/index.d.ts.map +1 -0
  12. package/dist/cjs/{common → generator/common}/index.js +1 -1
  13. package/dist/cjs/generator/common/index.js.map +1 -0
  14. package/dist/cjs/generator/common/types.d.ts +13 -0
  15. package/dist/cjs/generator/common/types.d.ts.map +1 -0
  16. package/dist/cjs/generator/common/types.js +3 -0
  17. package/dist/cjs/generator/common/types.js.map +1 -0
  18. package/dist/cjs/generator/emitter.d.ts +16 -0
  19. package/dist/cjs/generator/emitter.d.ts.map +1 -0
  20. package/dist/cjs/generator/emitter.js +53 -0
  21. package/dist/cjs/generator/emitter.js.map +1 -0
  22. package/dist/cjs/generator/index.d.ts +24 -0
  23. package/dist/cjs/generator/index.d.ts.map +1 -0
  24. package/dist/cjs/generator/index.js +55 -0
  25. package/dist/cjs/generator/index.js.map +1 -0
  26. package/dist/cjs/generator/scanner.d.ts +18 -0
  27. package/dist/cjs/generator/scanner.d.ts.map +1 -0
  28. package/dist/cjs/generator/scanner.js +173 -0
  29. package/dist/cjs/generator/scanner.js.map +1 -0
  30. package/dist/cjs/index.d.ts +1 -6
  31. package/dist/cjs/index.d.ts.map +1 -1
  32. package/dist/cjs/index.js +1 -6
  33. package/dist/cjs/index.js.map +1 -1
  34. package/dist/esm/cli.d.ts +3 -0
  35. package/dist/esm/cli.d.ts.map +1 -0
  36. package/dist/esm/cli.js +48 -0
  37. package/dist/esm/cli.js.map +1 -0
  38. package/dist/esm/generator/common/constants.d.ts +39 -0
  39. package/dist/esm/generator/common/constants.d.ts.map +1 -0
  40. package/dist/esm/generator/common/constants.js +70 -0
  41. package/dist/esm/generator/common/constants.js.map +1 -0
  42. package/dist/{cjs → esm/generator}/common/index.d.ts +1 -1
  43. package/dist/esm/generator/common/index.d.ts.map +1 -0
  44. package/dist/esm/{common → generator/common}/index.js +1 -1
  45. package/dist/esm/generator/common/index.js.map +1 -0
  46. package/dist/esm/generator/common/types.d.ts +13 -0
  47. package/dist/esm/generator/common/types.d.ts.map +1 -0
  48. package/dist/esm/generator/common/types.js +2 -0
  49. package/dist/esm/generator/common/types.js.map +1 -0
  50. package/dist/esm/generator/emitter.d.ts +16 -0
  51. package/dist/esm/generator/emitter.d.ts.map +1 -0
  52. package/dist/esm/generator/emitter.js +49 -0
  53. package/dist/esm/generator/emitter.js.map +1 -0
  54. package/dist/esm/generator/index.d.ts +24 -0
  55. package/dist/esm/generator/index.d.ts.map +1 -0
  56. package/dist/esm/generator/index.js +36 -0
  57. package/dist/esm/generator/index.js.map +1 -0
  58. package/dist/esm/generator/scanner.d.ts +18 -0
  59. package/dist/esm/generator/scanner.d.ts.map +1 -0
  60. package/dist/esm/generator/scanner.js +166 -0
  61. package/dist/esm/generator/scanner.js.map +1 -0
  62. package/dist/esm/index.d.ts +1 -6
  63. package/dist/esm/index.d.ts.map +1 -1
  64. package/dist/esm/index.js +1 -6
  65. package/dist/esm/index.js.map +1 -1
  66. package/package.json +26 -45
  67. package/dist/cjs/base/base-artifact-booter.d.ts +0 -18
  68. package/dist/cjs/base/base-artifact-booter.d.ts.map +0 -1
  69. package/dist/cjs/base/base-artifact-booter.js +0 -85
  70. package/dist/cjs/base/base-artifact-booter.js.map +0 -1
  71. package/dist/cjs/base/index.d.ts +0 -2
  72. package/dist/cjs/base/index.d.ts.map +0 -1
  73. package/dist/cjs/base/index.js +0 -18
  74. package/dist/cjs/base/index.js.map +0 -1
  75. package/dist/cjs/boot.mixin.d.ts +0 -65
  76. package/dist/cjs/boot.mixin.d.ts.map +0 -1
  77. package/dist/cjs/boot.mixin.js +0 -29
  78. package/dist/cjs/boot.mixin.js.map +0 -1
  79. package/dist/cjs/booters/controller.booter.d.ts +0 -10
  80. package/dist/cjs/booters/controller.booter.d.ts.map +0 -1
  81. package/dist/cjs/booters/controller.booter.js +0 -45
  82. package/dist/cjs/booters/controller.booter.js.map +0 -1
  83. package/dist/cjs/booters/datasource.booter.d.ts +0 -10
  84. package/dist/cjs/booters/datasource.booter.d.ts.map +0 -1
  85. package/dist/cjs/booters/datasource.booter.js +0 -45
  86. package/dist/cjs/booters/datasource.booter.js.map +0 -1
  87. package/dist/cjs/booters/index.d.ts +0 -5
  88. package/dist/cjs/booters/index.d.ts.map +0 -1
  89. package/dist/cjs/booters/index.js +0 -21
  90. package/dist/cjs/booters/index.js.map +0 -1
  91. package/dist/cjs/booters/repository.booter.d.ts +0 -10
  92. package/dist/cjs/booters/repository.booter.d.ts.map +0 -1
  93. package/dist/cjs/booters/repository.booter.js +0 -45
  94. package/dist/cjs/booters/repository.booter.js.map +0 -1
  95. package/dist/cjs/booters/service.booter.d.ts +0 -10
  96. package/dist/cjs/booters/service.booter.d.ts.map +0 -1
  97. package/dist/cjs/booters/service.booter.js +0 -45
  98. package/dist/cjs/booters/service.booter.js.map +0 -1
  99. package/dist/cjs/bootstrapper.d.ts +0 -14
  100. package/dist/cjs/bootstrapper.d.ts.map +0 -1
  101. package/dist/cjs/bootstrapper.js +0 -121
  102. package/dist/cjs/bootstrapper.js.map +0 -1
  103. package/dist/cjs/common/constants.d.ts +0 -6
  104. package/dist/cjs/common/constants.d.ts.map +0 -1
  105. package/dist/cjs/common/constants.js +0 -10
  106. package/dist/cjs/common/constants.js.map +0 -1
  107. package/dist/cjs/common/index.d.ts.map +0 -1
  108. package/dist/cjs/common/index.js.map +0 -1
  109. package/dist/cjs/common/types.d.ts +0 -52
  110. package/dist/cjs/common/types.d.ts.map +0 -1
  111. package/dist/cjs/common/types.js +0 -5
  112. package/dist/cjs/common/types.js.map +0 -1
  113. package/dist/cjs/utilities/boot.utility.d.ts +0 -9
  114. package/dist/cjs/utilities/boot.utility.d.ts.map +0 -1
  115. package/dist/cjs/utilities/boot.utility.js +0 -51
  116. package/dist/cjs/utilities/boot.utility.js.map +0 -1
  117. package/dist/cjs/utilities/index.d.ts +0 -2
  118. package/dist/cjs/utilities/index.d.ts.map +0 -1
  119. package/dist/cjs/utilities/index.js +0 -18
  120. package/dist/cjs/utilities/index.js.map +0 -1
  121. package/dist/esm/base/base-artifact-booter.d.ts +0 -18
  122. package/dist/esm/base/base-artifact-booter.d.ts.map +0 -1
  123. package/dist/esm/base/base-artifact-booter.js +0 -81
  124. package/dist/esm/base/base-artifact-booter.js.map +0 -1
  125. package/dist/esm/base/index.d.ts +0 -2
  126. package/dist/esm/base/index.d.ts.map +0 -1
  127. package/dist/esm/base/index.js +0 -2
  128. package/dist/esm/base/index.js.map +0 -1
  129. package/dist/esm/boot.mixin.d.ts +0 -65
  130. package/dist/esm/boot.mixin.d.ts.map +0 -1
  131. package/dist/esm/boot.mixin.js +0 -25
  132. package/dist/esm/boot.mixin.js.map +0 -1
  133. package/dist/esm/booters/controller.booter.d.ts +0 -10
  134. package/dist/esm/booters/controller.booter.d.ts.map +0 -1
  135. package/dist/esm/booters/controller.booter.js +0 -42
  136. package/dist/esm/booters/controller.booter.js.map +0 -1
  137. package/dist/esm/booters/datasource.booter.d.ts +0 -10
  138. package/dist/esm/booters/datasource.booter.d.ts.map +0 -1
  139. package/dist/esm/booters/datasource.booter.js +0 -42
  140. package/dist/esm/booters/datasource.booter.js.map +0 -1
  141. package/dist/esm/booters/index.d.ts +0 -5
  142. package/dist/esm/booters/index.d.ts.map +0 -1
  143. package/dist/esm/booters/index.js +0 -5
  144. package/dist/esm/booters/index.js.map +0 -1
  145. package/dist/esm/booters/repository.booter.d.ts +0 -10
  146. package/dist/esm/booters/repository.booter.d.ts.map +0 -1
  147. package/dist/esm/booters/repository.booter.js +0 -42
  148. package/dist/esm/booters/repository.booter.js.map +0 -1
  149. package/dist/esm/booters/service.booter.d.ts +0 -10
  150. package/dist/esm/booters/service.booter.d.ts.map +0 -1
  151. package/dist/esm/booters/service.booter.js +0 -42
  152. package/dist/esm/booters/service.booter.js.map +0 -1
  153. package/dist/esm/bootstrapper.d.ts +0 -14
  154. package/dist/esm/bootstrapper.d.ts.map +0 -1
  155. package/dist/esm/bootstrapper.js +0 -118
  156. package/dist/esm/bootstrapper.js.map +0 -1
  157. package/dist/esm/common/constants.d.ts +0 -6
  158. package/dist/esm/common/constants.d.ts.map +0 -1
  159. package/dist/esm/common/constants.js +0 -6
  160. package/dist/esm/common/constants.js.map +0 -1
  161. package/dist/esm/common/index.d.ts.map +0 -1
  162. package/dist/esm/common/index.js.map +0 -1
  163. package/dist/esm/common/types.d.ts +0 -52
  164. package/dist/esm/common/types.d.ts.map +0 -1
  165. package/dist/esm/common/types.js +0 -2
  166. package/dist/esm/common/types.js.map +0 -1
  167. package/dist/esm/utilities/boot.utility.d.ts +0 -9
  168. package/dist/esm/utilities/boot.utility.d.ts.map +0 -1
  169. package/dist/esm/utilities/boot.utility.js +0 -46
  170. package/dist/esm/utilities/boot.utility.js.map +0 -1
  171. package/dist/esm/utilities/index.d.ts +0 -2
  172. package/dist/esm/utilities/index.d.ts.map +0 -1
  173. package/dist/esm/utilities/index.js +0 -2
  174. package/dist/esm/utilities/index.js.map +0 -1
package/README.md CHANGED
@@ -4,216 +4,148 @@
4
4
 
5
5
  # :fire: IGNIS - `@venizia/ignis-boot`
6
6
 
7
- **Convention-based discovery and bootstrapping.**
7
+ **Generates one static registration file from your decorated classes.**
8
8
 
9
9
  [![Docs](https://img.shields.io/badge/Docs-ignis.venizia.ai-2563EB.svg?style=flat-square)](https://ignis.venizia.ai/references/base/bootstrapping)
10
10
  [![npm](https://img.shields.io/npm/v/@venizia/ignis-boot.svg?style=flat-square&color=cb3837&label=@venizia/ignis-boot)](https://www.npmjs.com/package/@venizia/ignis-boot)
11
11
  [![License: MIT](https://img.shields.io/badge/License-MIT-3DA639.svg?style=flat-square)](LICENSE.md)
12
12
  [![TypeScript](https://img.shields.io/badge/TypeScript-6.x-3178C6.svg?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
13
13
 
14
- [Bootstrapping reference](https://ignis.venizia.ai/references/base/bootstrapping) •
15
- [Application](https://ignis.venizia.ai/references/base/application) •
16
- [Dependency injection](https://ignis.venizia.ai/references/base/dependency-injection)
14
+ [Artifact registration reference](https://ignis.venizia.ai/references/base/bootstrapping) •
15
+ [Registering artifacts guide](https://ignis.venizia.ai/guides/core-concepts/application/bootstrapping) •
16
+ [Changelog](https://ignis.venizia.ai/changelogs/2026-09-03-deprecated-boot-api-removed)
17
17
 
18
18
  </div>
19
19
 
20
20
  ---
21
21
 
22
- Finds your controllers, services, repositories, and datasources by filename, then binds each one into
23
- the IoC container - so you never maintain a registration list that drifts from the files on disk.
22
+ `ignis-artifacts` walks a source root with the TypeScript compiler API, finds every named,
23
+ non-abstract class that carries an IGNIS stereotype decorator (`@service`, `@controller`, ...), and
24
+ writes one file of plain static imports: `src/generated/artifacts.ts`. The application passes that
25
+ file as `configs.artifacts`; `@venizia/ignis`'s `registerArtifacts` boot step binds it.
24
26
 
25
- **Most applications never import this package.** `BaseApplication` from `@venizia/ignis` already depends
26
- on it, registers the four built-in booters, and exposes `boot()`. You reach for it directly only to
27
- write a custom booter for an artifact type of your own.
27
+ **This package runs at build time only.** No decorator runs and no class is imported while
28
+ scanning - detection reads source text, so a datasource that opens a pool at import stays inert.
28
29
 
29
30
  ## Install
30
31
 
31
32
  ```bash
32
- bun add @venizia/ignis-boot
33
+ bun add -d @venizia/ignis-boot
33
34
  ```
34
35
 
35
- Already a transitive dependency of `@venizia/ignis`.
36
+ `ignis-artifacts` runs at build time; the generated file imports nothing from this package, so a
37
+ deployed application installs nothing extra for it at runtime.
36
38
 
37
39
  ## Use it
38
40
 
39
- Convention boot is opt-in: call `boot()` before `start()`.
41
+ Decorate the classes you want registered:
40
42
 
41
43
  ```typescript
42
- import { BaseApplication, IApplicationInfo } from '@venizia/ignis';
44
+ import { component, service } from '@venizia/ignis';
43
45
 
44
- class App extends BaseApplication {
45
- getAppInfo(): IApplicationInfo {
46
- return { name: 'my-app', version: '1.0.0', description: 'My app' };
47
- }
48
-
49
- staticConfigure() {}
50
- preConfigure() {}
51
- postConfigure() {}
52
- setupMiddlewares() {}
53
- }
46
+ @service()
47
+ export class PricingService extends BaseService {}
54
48
 
55
- const application = new App({
56
- scope: 'App',
57
- config: {
58
- host: '0.0.0.0',
59
- port: 3000,
60
- path: { base: '/api', isStrict: false },
61
- bootOptions: {}, // the defaults cover the conventional layout
62
- },
63
- });
64
-
65
- await application.boot(); // discover and bind every artifact
66
- await application.start();
49
+ @component()
50
+ export class MetricsComponent extends BaseComponent {}
67
51
  ```
68
52
 
69
- Given the layout below, `boot()` binds `datasources.PostgresDataSource`, `repositories.UserRepository`,
70
- `services.UserService`, and `controllers.UserController` - no further code.
53
+ Add the generator scripts and run one:
71
54
 
55
+ ```json
56
+ {
57
+ "scripts": {
58
+ "generate:artifacts": "ignis-artifacts generate --root src --out src/generated/artifacts.ts",
59
+ "check:artifacts": "ignis-artifacts check --root src --out src/generated/artifacts.ts"
60
+ }
61
+ }
72
62
  ```
73
- <projectRoot>/
74
- datasources/postgres.datasource.js
75
- repositories/user.repository.js
76
- services/user.service.js
77
- controllers/user.controller.js
78
- ```
79
-
80
- ## Discovery conventions
81
-
82
- Each booter has a default directory and a default file suffix, and binds into its own namespace.
83
-
84
- | Booter | Default dir | Default suffix | Binding key | Tag | Scope |
85
- | :--- | :--- | :--- | :--- | :--- | :--- |
86
- | `DatasourceBooter` | `datasources` | `.datasource.js` | `datasources.<ClassName>` | `datasources` | singleton |
87
- | `RepositoryBooter` | `repositories` | `.repository.js` | `repositories.<ClassName>` | `repositories` | transient |
88
- | `ServiceBooter` | `services` | `.service.js` | `services.<ClassName>` | `services` | transient |
89
- | `ControllerBooter` | `controllers` | `.controller.js` | `controllers.<ClassName>` | `controllers` | transient |
90
-
91
- Datasources are singletons because a connection pool must be shared; everything else resolves per use.
92
- Directories resolve relative to the application's `getProjectRoot()`, which defaults to `process.cwd()`.
93
- Subdirectories are included - `isNested` defaults to `true`.
94
63
 
95
- Booters are registered datasources -> repositories -> services -> controllers, so a repository can
96
- always resolve the datasource it injects.
64
+ ```bash
65
+ bun run generate:artifacts
66
+ ```
97
67
 
98
- > [!IMPORTANT]
99
- > **The default suffixes end in `.js`, not `.ts`.** Discovery globs files on disk and `import`s them, and
100
- > it is designed to run against your **compiled output**. Build first, and have `getProjectRoot()` point
101
- > at the built directory - returning `__dirname` from the compiled entrypoint does exactly that. If
102
- > `boot()` reports zero artifacts, this is almost always why. To boot from TypeScript sources instead,
103
- > set the extensions explicitly: `{ controllers: { extensions: ['.controller.ts'] } }`.
68
+ Pass the generated index to your application:
104
69
 
105
- ## Phases
70
+ ```typescript
71
+ import { GeneratedArtifacts } from './generated/artifacts';
106
72
 
107
- `Bootstrapper.boot()` runs three phases across **all** booters - phase by phase, not booter by booter.
73
+ export const configs: IApplicationConfigs = {
74
+ path: { base: '/api', isStrict: true },
75
+ artifacts: GeneratedArtifacts,
76
+ };
77
+ ```
108
78
 
109
- | Phase | What happens |
110
- | :--- | :--- |
111
- | `configure` | Fill in defaults for `dirs`, `extensions`, `isNested`, then build the glob pattern |
112
- | `discover` | Run the glob under the project root, collecting absolute file paths |
113
- | `load` | `import()` each file, keep the exported classes, bind them into the container |
79
+ Commit the generated file; never edit it by hand - the next `generate` overwrites it. Full
80
+ walkthrough: [Registering artifacts](https://ignis.venizia.ai/guides/core-concepts/application/bootstrapping).
114
81
 
115
- `boot()` resolves to an `IBootReport`: the booter class names that ran, per-phase `durationMs`, and
116
- `totalDurationMs`. A throw in any phase is rewrapped naming both the phase and the booter, with the
117
- original error kept as `cause`.
82
+ ## CLI
118
83
 
119
- ## Configuring discovery
84
+ Shipped as the `ignis-artifacts` binary. Requires `typescript >= 5` (peer dependency) and runs
85
+ under bun.
120
86
 
121
- Pass `bootOptions` in the application config. Every artifact type takes the same `IArtifactOptions`.
87
+ ```
88
+ ignis-artifacts <generate|check> [--root src] [--out src/generated/artifacts.ts] [--ignore a,b] [--export GeneratedArtifacts]
89
+ ```
122
90
 
123
- | Option | Type | Meaning |
91
+ | Flag | Default | Meaning |
124
92
  | :--- | :--- | :--- |
125
- | `dirs` | `string[]` | Directories to scan, relative to the project root |
126
- | `extensions` | `string[]` | File suffixes to match |
127
- | `isNested` | `boolean` | Include subdirectories - default `true` |
128
- | `glob` | `string` | Raw glob pattern; overrides the three above |
93
+ | `--root` | `src` | Directory to scan, recursively |
94
+ | `--out` | `src/generated/artifacts.ts` | Output path; import paths are relative to it |
95
+ | `--ignore` | `**/__tests__/**`, `**/*.test.ts`, `**/*.spec.ts`, `**/generated/**` | Comma-separated globs, merged with the default ignore list - never replaces it |
96
+ | `--export` | `GeneratedArtifacts` | Name of the exported constant |
129
97
 
130
- ```typescript
131
- bootOptions: {
132
- controllers: { dirs: ['controllers', 'api'], extensions: ['.controller.js'] },
133
- services: { glob: 'modules/**/*.service.js' },
134
- }
135
- ```
98
+ | Command | Effect | Exit code |
99
+ | :--- | :--- | :--- |
100
+ | `generate` | Writes `--out` when its content changed | `0` |
101
+ | `check` | Renders in memory and compares with `--out`; fails a stale index | `0` fresh, `1` stale |
136
102
 
137
- A key that is present but `undefined` - the shape `dirs: process.env.APP_DIRS?.split(',')` produces - is
138
- treated as not provided and falls back to the default. An empty `dirs` or `extensions` array is not: it
139
- throws when the pattern is built.
103
+ Default ignore list: `**/__tests__/**`, `**/*.test.ts`, `**/*.spec.ts`, `**/generated/**`.
140
104
 
141
- ## Custom booters
105
+ ## Detection rules
142
106
 
143
- Extend `BaseArtifactBooter` and implement its three hooks. The base class handles configure, discover,
144
- and load; you decide only where to look and what to bind.
107
+ A class is emitted when every rule holds. Every miss is logged with its reason.
145
108
 
146
- ```typescript
147
- import { BaseArtifactBooter, IApplication, IBootOptions } from '@venizia/ignis-boot';
148
- import { BindingKeys, inject } from '@venizia/ignis-inversion';
149
-
150
- export class ObserverBooter extends BaseArtifactBooter {
151
- constructor(
152
- @inject({ key: '@app/project_root' }) root: string,
153
- @inject({ key: '@app/instance' }) private readonly application: IApplication,
154
- @inject({ key: '@app/boot-options' }) bootOptions: IBootOptions,
155
- ) {
156
- super({ scope: ObserverBooter.name, root, artifactOptions: bootOptions.observers ?? {} });
157
- }
109
+ - Named export (`export class`), not `export default`, not module-private.
110
+ - Not `abstract`.
111
+ - Decorated with `component`, `controller`, `service`, `repository` or `datasource`, imported from
112
+ `@venizia/ignis` or `@venizia/ignis-kernel` (import aliases resolved) - or with
113
+ `injectable({ type })` where `type` is a string literal or `ArtifactTypes.<NAME>`.
158
114
 
159
- protected override getDefaultDirs(): string[] {
160
- return ['observers'];
161
- }
115
+ `model` classes are recognised and never emitted - a model is reached through its repository.
162
116
 
163
- protected override getDefaultExtensions(): string[] {
164
- return ['.observer.js'];
165
- }
117
+ ## Programmatic API
166
118
 
167
- protected override async bind(): Promise<void> {
168
- for (const cls of this.loadedClasses) {
169
- const key = BindingKeys.build({ namespace: 'observers', key: cls.name });
170
- this.application.bind({ key }).toClass(cls).setTags('observers');
171
- }
172
- }
173
- }
174
- ```
119
+ `@venizia/ignis-boot/generator` exports the same machinery as functions, for a caller that is not
120
+ a shell script.
175
121
 
176
- `IBootOptions` carries an index signature, so `bootOptions.observers` type-checks with no change to the
177
- framework. Booters are found by the `booter` tag, so registering is all that remains - and it must
178
- happen before `boot()` runs, which is earlier than `preConfigure()`:
122
+ | Export | What it is |
123
+ | :--- | :--- |
124
+ | `generateArtifactIndex(opts)` | Renders and writes `opts.out` when the content changed |
125
+ | `checkArtifactIndex(opts)` | Renders in memory and compares with `opts.out`, without writing |
126
+ | `IGenerateOptions` | `{ root, out, ignore?, exportName? }` - shared options for both |
127
+ | `ArtifactScanner.getInstance().scan({ root, ignore? })` | The scan step alone, as `IScannedArtifact[]` |
128
+ | `ArtifactIndexEmitter.render({ artifacts, outFile, exportName })` | The render step alone, as text |
129
+ | `ArtifactStereotypes`, `ArtifactTypes`, `ArtifactIndexFields` | The decorator-to-type map and the emitted field names |
179
130
 
180
131
  ```typescript
181
- override async boot() {
182
- this.booter(ObserverBooter);
183
- return super.boot();
184
- }
185
- ```
132
+ import { checkArtifactIndex } from '@venizia/ignis-boot/generator';
186
133
 
187
- Every constructor parameter must carry `@inject` - a container-instantiated class with one bare
188
- parameter is refused at boot.
134
+ const { isFresh } = checkArtifactIndex({ root: 'src', out: 'src/generated/artifacts.ts' });
135
+ ```
189
136
 
190
137
  ## What you must know
191
138
 
192
- - **Every exported class in a matched file is bound**, not only the one whose name matches the file.
193
- Keep helper classes out of `*.controller.js` and friends, or move them to their own module.
194
- - **Discovery is filename-driven, not decorator-driven.** A correctly decorated controller in the wrong
195
- directory is invisible to it - register that one manually with `this.controller(...)`.
196
- - Calling `boot()` twice does not double-register: the bootstrapper resets its booter list on each run.
197
- - `reflect-metadata` must be imported once at your entrypoint, and `experimentalDecorators` plus
198
- `emitDecoratorMetadata` must be `true` **inline** in your `tsconfig.json` - Bun does not resolve them
199
- through `extends`, and `@inject` is silently dropped without them.
139
+ - **Output is deterministic.** Imports sorted by path, class names sorted within each field, one
140
+ field per kind, empty arrays kept. A field wider than 100 columns wraps one name per line, so the
141
+ file passes the repo's `prettier -l` unchanged.
142
+ - **The scanner never executes a module.** No decorator runs and no import side effect fires while
143
+ scanning, so a stereotype re-exported through a local wrapper module is not recognised - the
144
+ import must name an IGNIS module directly.
145
+ - **`check` belongs where lint runs**, not only in CI - a stale index should fail locally before a
146
+ push reaches the pipeline.
200
147
 
201
- ## Surface
202
-
203
- | Export | What it is |
204
- | :--- | :--- |
205
- | `BaseArtifactBooter` | Abstract base implementing the three phases; extend it for custom artifacts |
206
- | `Bootstrapper` | Runs the phases across every `booter`-tagged binding and returns the report |
207
- | `BootMixin` | Adds `boot()`, `bootOptions`, and the four built-in booters to a raw `Container` |
208
- | `ControllerBooter` / `ServiceBooter` / `RepositoryBooter` / `DatasourceBooter` | The built-in booters |
209
- | `discoverFiles` / `loadClasses` | The glob and dynamic-import primitives, usable standalone |
210
- | `BootPhases` | `configure`, `discover`, `load` |
211
- | `IBootOptions` / `IArtifactOptions` / `IBootReport` / `IBooter` | Public types |
212
-
213
- `BootMixin` is for applications not built on `BaseApplication` - it wires the same four booters onto any
214
- `Container`. `BaseApplication` does its own registration and does not use the mixin.
215
-
216
- Full detail: [Bootstrapping reference](https://ignis.venizia.ai/references/base/bootstrapping).
148
+ Full detail: [Artifact registration reference](https://ignis.venizia.ai/references/base/bootstrapping).
217
149
 
218
150
  ## Links
219
151
 
@@ -223,8 +155,5 @@ Full detail: [Bootstrapping reference](https://ignis.venizia.ai/references/base/
223
155
  [Best practices](https://ignis.venizia.ai/best-practices/) &#8226;
224
156
  [Changelog](https://ignis.venizia.ai/changelogs/)
225
157
 
226
- Inspired by [LoopBack 4's boot system](https://loopback.io/doc/en/lb4/Booting-an-Application.html).
227
-
228
158
  MIT licensed - see [LICENSE.md](LICENSE.md).
229
159
  Questions: [GitHub Issues](https://github.com/VENIZIA-AI/ignis/issues) &#8226; developer@venizia.ai
230
- </content>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bun
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env bun
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const node_util_1 = require("node:util");
5
+ const generator_1 = require("./generator");
6
+ const USAGE = 'ignis-artifacts <generate|check> [--root src] [--out src/generated/artifacts.ts] [--ignore a,b] [--export GeneratedArtifacts]';
7
+ const { positionals, values } = (0, node_util_1.parseArgs)({
8
+ args: process.argv.slice(2),
9
+ allowPositionals: true,
10
+ options: {
11
+ root: { type: 'string', default: 'src' },
12
+ out: { type: 'string', default: 'src/generated/artifacts.ts' },
13
+ ignore: { type: 'string' },
14
+ export: { type: 'string', default: 'GeneratedArtifacts' },
15
+ },
16
+ });
17
+ const options = {
18
+ root: values.root,
19
+ out: values.out,
20
+ ignore: values.ignore
21
+ ?.split(',')
22
+ .map(pattern => pattern.trim())
23
+ .filter(Boolean),
24
+ exportName: values.export,
25
+ };
26
+ /** Exit code of the command, so the process exits in exactly one place. */
27
+ const run = () => {
28
+ switch (positionals[0]) {
29
+ case 'generate': {
30
+ const result = (0, generator_1.generateArtifactIndex)(options);
31
+ console.log(`${result.written ? 'wrote' : 'up to date'} ${options.out} | ${result.artifacts.length} artifact(s)`);
32
+ return 0;
33
+ }
34
+ case 'check': {
35
+ const result = (0, generator_1.checkArtifactIndex)(options);
36
+ if (result.isFresh) {
37
+ console.log(`fresh ${options.out}`);
38
+ return 0;
39
+ }
40
+ console.error(`stale ${options.out} - run: ignis-artifacts generate --root ${options.root} --out ${options.out}`);
41
+ return 1;
42
+ }
43
+ default: {
44
+ console.error(USAGE);
45
+ return 2;
46
+ }
47
+ }
48
+ };
49
+ process.exit(run());
50
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AACtC,2CAAwE;AAExE,MAAM,KAAK,GACT,+HAA+H,CAAC;AAElI,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAS,EAAC;IACxC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3B,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE;QACP,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE;QACxC,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,4BAA4B,EAAE;QAC9D,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC1B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,EAAE;KAC1D;CACF,CAAC,CAAC;AAEH,MAAM,OAAO,GAAG;IACd,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,GAAG,EAAE,MAAM,CAAC,GAAG;IACf,MAAM,EAAE,MAAM,CAAC,MAAM;QACnB,EAAE,KAAK,CAAC,GAAG,CAAC;SACX,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;SAC9B,MAAM,CAAC,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC,MAAM;CAC1B,CAAC;AAEF,2EAA2E;AAC3E,MAAM,GAAG,GAAG,GAAW,EAAE;IACvB,QAAQ,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QACvB,KAAK,UAAU,CAAC,CAAC,CAAC;YAChB,MAAM,MAAM,GAAG,IAAA,iCAAqB,EAAC,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,GAAG,CACT,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,OAAO,CAAC,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,MAAM,cAAc,CACrG,CAAC;YACF,OAAO,CAAC,CAAC;QACX,CAAC;QACD,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,MAAM,GAAG,IAAA,8BAAkB,EAAC,OAAO,CAAC,CAAC;YAC3C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,OAAO,CAAC,GAAG,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;gBACpC,OAAO,CAAC,CAAC;YACX,CAAC;YACD,OAAO,CAAC,KAAK,CACX,SAAS,OAAO,CAAC,GAAG,2CAA2C,OAAO,CAAC,IAAI,UAAU,OAAO,CAAC,GAAG,EAAE,CACnG,CAAC;YACF,OAAO,CAAC,CAAC;QACX,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { TConstValue } from '@venizia/ignis-helpers';
2
+ /** Mirrors the kernel's `ArtifactTypes` values; boot must not depend on kernel (`{boot, kernel} -> core` in the build chain). */
3
+ export declare class ArtifactTypes {
4
+ static readonly COMPONENT = "component";
5
+ static readonly CONTROLLER = "controller";
6
+ static readonly SERVICE = "service";
7
+ static readonly REPOSITORY = "repository";
8
+ static readonly DATASOURCE = "datasource";
9
+ static readonly MODEL = "model";
10
+ static readonly SCHEME_SET: Set<string>;
11
+ static isValid(value: string): boolean;
12
+ }
13
+ export type TArtifactType = TConstValue<typeof ArtifactTypes>;
14
+ /** Mirrors the kernel's `ArtifactIndexFields` - the keys of the object the emitter writes and `registerArtifacts` reads. */
15
+ export declare class ArtifactIndexFields {
16
+ static readonly DATA_SOURCES = "dataSources";
17
+ static readonly COMPONENTS = "components";
18
+ static readonly REPOSITORIES = "repositories";
19
+ static readonly SERVICES = "services";
20
+ static readonly CONTROLLERS = "controllers";
21
+ static readonly SCHEME_SET: Set<string>;
22
+ static isValid(value: string): boolean;
23
+ }
24
+ export type TArtifactIndexField = TConstValue<typeof ArtifactIndexFields>;
25
+ export declare class ArtifactStereotypes {
26
+ /** Decorator name as imported from `@venizia/ignis` or `@venizia/ignis-kernel` -> artifact type. */
27
+ static readonly BY_DECORATOR: Readonly<Record<string, TArtifactType>>;
28
+ static readonly ROOT_DECORATOR = "injectable";
29
+ static readonly SCHEME_SET: Set<string>;
30
+ static isValid(value: string): boolean;
31
+ static readonly SOURCE_MODULES: RegExp;
32
+ static readonly DEFAULT_IGNORE: string[];
33
+ /** The kernel's `registerArtifacts` order; `model` is never emitted. */
34
+ static readonly EMIT_ORDER: ReadonlyArray<{
35
+ type: TArtifactType;
36
+ field: TArtifactIndexField;
37
+ }>;
38
+ }
39
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +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,cAOvB;IAEH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC;AAE9D,4HAA4H;AAC5H,qBAAa,mBAAmB;IAC9B,MAAM,CAAC,QAAQ,CAAC,YAAY,iBAAiB;IAC7C,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,YAAY,kBAAkB;IAC9C,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAc;IACtC,MAAM,CAAC,QAAQ,CAAC,WAAW,iBAAiB;IAE5C,MAAM,CAAC,QAAQ,CAAC,UAAU,cAMvB;IAEH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE1E,qBAAa,mBAAmB;IAC9B,oGAAoG;IACpG,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAOnE;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,wEAAwE;IACxE,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,mBAAmB,CAAA;KAAE,CAAC,CAM5F;CACH"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArtifactStereotypes = exports.ArtifactIndexFields = exports.ArtifactTypes = void 0;
4
+ /** Mirrors the kernel's `ArtifactTypes` values; boot must not depend on kernel (`{boot, kernel} -> core` in the build chain). */
5
+ class ArtifactTypes {
6
+ static { this.COMPONENT = 'component'; }
7
+ static { this.CONTROLLER = 'controller'; }
8
+ static { this.SERVICE = 'service'; }
9
+ static { this.REPOSITORY = 'repository'; }
10
+ static { this.DATASOURCE = 'datasource'; }
11
+ static { this.MODEL = 'model'; }
12
+ static { this.SCHEME_SET = new Set([
13
+ this.COMPONENT,
14
+ this.CONTROLLER,
15
+ this.SERVICE,
16
+ this.REPOSITORY,
17
+ this.DATASOURCE,
18
+ this.MODEL,
19
+ ]); }
20
+ static isValid(value) {
21
+ return this.SCHEME_SET.has(value);
22
+ }
23
+ }
24
+ exports.ArtifactTypes = ArtifactTypes;
25
+ /** Mirrors the kernel's `ArtifactIndexFields` - the keys of the object the emitter writes and `registerArtifacts` reads. */
26
+ class ArtifactIndexFields {
27
+ static { this.DATA_SOURCES = 'dataSources'; }
28
+ static { this.COMPONENTS = 'components'; }
29
+ static { this.REPOSITORIES = 'repositories'; }
30
+ static { this.SERVICES = 'services'; }
31
+ static { this.CONTROLLERS = 'controllers'; }
32
+ static { this.SCHEME_SET = new Set([
33
+ this.DATA_SOURCES,
34
+ this.COMPONENTS,
35
+ this.REPOSITORIES,
36
+ this.SERVICES,
37
+ this.CONTROLLERS,
38
+ ]); }
39
+ static isValid(value) {
40
+ return this.SCHEME_SET.has(value);
41
+ }
42
+ }
43
+ exports.ArtifactIndexFields = ArtifactIndexFields;
44
+ class ArtifactStereotypes {
45
+ /** Decorator name as imported from `@venizia/ignis` or `@venizia/ignis-kernel` -> artifact type. */
46
+ static { this.BY_DECORATOR = {
47
+ component: ArtifactTypes.COMPONENT,
48
+ controller: ArtifactTypes.CONTROLLER,
49
+ service: ArtifactTypes.SERVICE,
50
+ repository: ArtifactTypes.REPOSITORY,
51
+ datasource: ArtifactTypes.DATASOURCE,
52
+ model: ArtifactTypes.MODEL,
53
+ }; }
54
+ static { this.ROOT_DECORATOR = 'injectable'; }
55
+ static { this.SCHEME_SET = new Set(Object.values(ArtifactStereotypes.BY_DECORATOR)); }
56
+ static isValid(value) {
57
+ return this.SCHEME_SET.has(value);
58
+ }
59
+ static { this.SOURCE_MODULES = /^@venizia\/ignis(-kernel)?$/; }
60
+ static { this.DEFAULT_IGNORE = [
61
+ '**/__tests__/**',
62
+ '**/*.test.ts',
63
+ '**/*.spec.ts',
64
+ '**/generated/**',
65
+ ]; }
66
+ /** The kernel's `registerArtifacts` order; `model` is never emitted. */
67
+ static { this.EMIT_ORDER = [
68
+ { type: ArtifactTypes.DATASOURCE, field: ArtifactIndexFields.DATA_SOURCES },
69
+ { type: ArtifactTypes.COMPONENT, field: ArtifactIndexFields.COMPONENTS },
70
+ { type: ArtifactTypes.REPOSITORY, field: ArtifactIndexFields.REPOSITORIES },
71
+ { type: ArtifactTypes.SERVICE, field: ArtifactIndexFields.SERVICES },
72
+ { type: ArtifactTypes.CONTROLLER, field: ArtifactIndexFields.CONTROLLERS },
73
+ ]; }
74
+ }
75
+ exports.ArtifactStereotypes = ArtifactStereotypes;
76
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/generator/common/constants.ts"],"names":[],"mappings":";;;AAEA,iIAAiI;AACjI,MAAa,aAAa;aACR,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,YAAY,CAAC;aAC1B,YAAO,GAAG,SAAS,CAAC;aACpB,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG,YAAY,CAAC;aAC1B,UAAK,GAAG,OAAO,CAAC;aAEhB,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,SAAS;QACd,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,KAAK;KACX,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAnBH,sCAoBC;AAID,4HAA4H;AAC5H,MAAa,mBAAmB;aACd,iBAAY,GAAG,aAAa,CAAC;aAC7B,eAAU,GAAG,YAAY,CAAC;aAC1B,iBAAY,GAAG,cAAc,CAAC;aAC9B,aAAQ,GAAG,UAAU,CAAC;aACtB,gBAAW,GAAG,aAAa,CAAC;aAE5B,eAAU,GAAG,IAAI,GAAG,CAAS;QAC3C,IAAI,CAAC,YAAY;QACjB,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,YAAY;QACjB,IAAI,CAAC,QAAQ;QACb,IAAI,CAAC,WAAW;KACjB,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAjBH,kDAkBC;AAID,MAAa,mBAAmB;IAC9B,oGAAoG;aACpF,iBAAY,GAA4C;QACtE,SAAS,EAAE,aAAa,CAAC,SAAS;QAClC,UAAU,EAAE,aAAa,CAAC,UAAU;QACpC,OAAO,EAAE,aAAa,CAAC,OAAO;QAC9B,UAAU,EAAE,aAAa,CAAC,UAAU;QACpC,UAAU,EAAE,aAAa,CAAC,UAAU;QACpC,KAAK,EAAE,aAAa,CAAC,KAAK;KAC3B,CAAC;aAEc,mBAAc,GAAG,YAAY,CAAC;aAE9B,eAAU,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC;IAE9F,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;aAEe,mBAAc,GAAG,6BAA6B,CAAC;aAE/C,mBAAc,GAAG;QAC/B,iBAAiB;QACjB,cAAc;QACd,cAAc;QACd,iBAAiB;KAClB,CAAC;IAEF,wEAAwE;aACxD,eAAU,GAAuE;QAC/F,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;;AAnCJ,kDAoCC"}
@@ -1,3 +1,3 @@
1
- export * from './types';
2
1
  export * from './constants';
2
+ export * from './types';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/generator/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
17
  __exportStar(require("./constants"), exports);
18
+ __exportStar(require("./types"), exports);
19
19
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generator/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0CAAwB"}
@@ -0,0 +1,13 @@
1
+ import type { TArtifactType } from './constants';
2
+ export interface IScannedArtifact {
3
+ className: string;
4
+ /** Absolute path of the declaring file. */
5
+ filePath: string;
6
+ type: TArtifactType;
7
+ }
8
+ export interface IScanOptions {
9
+ root: string;
10
+ /** Glob patterns relative to `root`; defaults to `ArtifactStereotypes.DEFAULT_IGNORE`. */
11
+ ignore?: string[];
12
+ }
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/generator/common/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { type IScannedArtifact } from './common';
2
+ /** Renders the generated index: deterministic text, plain static imports, no IGNIS import - the object is type-checked where `registerArtifacts` receives it. */
3
+ export declare class ArtifactIndexEmitter {
4
+ /** Mirrors `printWidth` in @venizia/dev-configs prettier settings. */
5
+ static readonly PRINT_WIDTH = 100;
6
+ static readonly HEADER = "// AUTO-GENERATED by @venizia/ignis-boot - do not edit. Regenerate: ignis-artifacts generate --root src --out src/generated/artifacts.ts";
7
+ static render(opts: {
8
+ artifacts: IScannedArtifact[];
9
+ outFile: string;
10
+ exportName: string;
11
+ }): string;
12
+ /** 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
+ private static renderField;
14
+ private static importPath;
15
+ }
16
+ //# sourceMappingURL=emitter.d.ts.map
@@ -0,0 +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,8IACuH;IAE7I,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAClB,SAAS,EAAE,gBAAgB,EAAE,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,MAAM;IAgCV,qIAAqI;IACrI,OAAO,CAAC,MAAM,CAAC,WAAW;IAW1B,OAAO,CAAC,MAAM,CAAC,UAAU;CAI1B"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArtifactIndexEmitter = void 0;
4
+ const node_path_1 = require("node:path");
5
+ const common_1 = require("./common");
6
+ /** Renders the generated index: deterministic text, plain static imports, no IGNIS import - the object is type-checked where `registerArtifacts` receives it. */
7
+ class ArtifactIndexEmitter {
8
+ /** Mirrors `printWidth` in @venizia/dev-configs prettier settings. */
9
+ static { this.PRINT_WIDTH = 100; }
10
+ static { this.HEADER = '// AUTO-GENERATED by @venizia/ignis-boot - do not edit. Regenerate: ignis-artifacts generate --root src --out src/generated/artifacts.ts'; }
11
+ static render(opts) {
12
+ const { artifacts, outFile, exportName } = opts;
13
+ const emitted = artifacts.filter(artifact => artifact.type !== common_1.ArtifactTypes.MODEL);
14
+ const imports = emitted
15
+ .map(artifact => ({
16
+ name: artifact.className,
17
+ path: ArtifactIndexEmitter.importPath({ from: outFile, to: artifact.filePath }),
18
+ }))
19
+ .sort((a, b) => a.path.localeCompare(b.path) || a.name.localeCompare(b.name))
20
+ .map(entry => `import { ${entry.name} } from '${entry.path}';`);
21
+ const fields = common_1.ArtifactStereotypes.EMIT_ORDER.flatMap(({ type, field }) => {
22
+ const names = emitted
23
+ .filter(artifact => artifact.type === type)
24
+ .map(artifact => artifact.className)
25
+ .sort((a, b) => a.localeCompare(b));
26
+ return ArtifactIndexEmitter.renderField({ field, names });
27
+ });
28
+ return [
29
+ ArtifactIndexEmitter.HEADER,
30
+ ...imports,
31
+ '',
32
+ `export const ${exportName} = {`,
33
+ ...fields,
34
+ '};',
35
+ '',
36
+ ].join('\n');
37
+ }
38
+ /** One line while it fits the repo's prettier width, else one name per line - so `prettier -l` on the generated file stays quiet. */
39
+ static renderField(opts) {
40
+ const { field, names } = opts;
41
+ const singleLine = ` ${field}: [${names.join(', ')}],`;
42
+ if (singleLine.length <= ArtifactIndexEmitter.PRINT_WIDTH) {
43
+ return [singleLine];
44
+ }
45
+ return [` ${field}: [`, ...names.map(name => ` ${name},`), ' ],'];
46
+ }
47
+ static importPath(opts) {
48
+ const raw = (0, node_path_1.relative)((0, node_path_1.dirname)(opts.from), opts.to).split(node_path_1.sep).join('/').replace(/\.ts$/, '');
49
+ return raw.startsWith('.') ? raw : `./${raw}`;
50
+ }
51
+ }
52
+ exports.ArtifactIndexEmitter = ArtifactIndexEmitter;
53
+ //# sourceMappingURL=emitter.js.map