@venizia/ignis-boot 0.4.3 → 0.4.4

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 (116) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +17 -4
  3. package/dist/esm/build-info/resolver.d.ts +2 -2
  4. package/dist/esm/build-info/resolver.d.ts.map +1 -1
  5. package/dist/esm/build-info/resolver.js +17 -11
  6. package/dist/esm/build-info/resolver.js.map +1 -1
  7. package/dist/esm/bun/plugin.d.ts +1 -1
  8. package/dist/esm/bun/plugin.d.ts.map +1 -1
  9. package/dist/esm/bun/plugin.js +2 -2
  10. package/dist/esm/bun/plugin.js.map +1 -1
  11. package/dist/esm/clis/artifacts.js +0 -0
  12. package/package.json +19 -33
  13. package/dist/cjs/build-info/common/constants.d.ts +0 -12
  14. package/dist/cjs/build-info/common/constants.d.ts.map +0 -1
  15. package/dist/cjs/build-info/common/constants.js +0 -32
  16. package/dist/cjs/build-info/common/constants.js.map +0 -1
  17. package/dist/cjs/build-info/common/index.d.ts +0 -2
  18. package/dist/cjs/build-info/common/index.d.ts.map +0 -1
  19. package/dist/cjs/build-info/common/index.js +0 -18
  20. package/dist/cjs/build-info/common/index.js.map +0 -1
  21. package/dist/cjs/build-info/index.d.ts +0 -4
  22. package/dist/cjs/build-info/index.d.ts.map +0 -1
  23. package/dist/cjs/build-info/index.js +0 -20
  24. package/dist/cjs/build-info/index.js.map +0 -1
  25. package/dist/cjs/build-info/resolver.d.ts +0 -25
  26. package/dist/cjs/build-info/resolver.d.ts.map +0 -1
  27. package/dist/cjs/build-info/resolver.js +0 -105
  28. package/dist/cjs/build-info/resolver.js.map +0 -1
  29. package/dist/cjs/build-info/stamp.d.ts +0 -22
  30. package/dist/cjs/build-info/stamp.d.ts.map +0 -1
  31. package/dist/cjs/build-info/stamp.js +0 -36
  32. package/dist/cjs/build-info/stamp.js.map +0 -1
  33. package/dist/cjs/bun/auto-group.d.ts +0 -22
  34. package/dist/cjs/bun/auto-group.d.ts.map +0 -1
  35. package/dist/cjs/bun/auto-group.js +0 -51
  36. package/dist/cjs/bun/auto-group.js.map +0 -1
  37. package/dist/cjs/bun/auto-loader.d.ts +0 -13
  38. package/dist/cjs/bun/auto-loader.d.ts.map +0 -1
  39. package/dist/cjs/bun/auto-loader.js +0 -63
  40. package/dist/cjs/bun/auto-loader.js.map +0 -1
  41. package/dist/cjs/bun/auto.d.ts +0 -5
  42. package/dist/cjs/bun/auto.d.ts.map +0 -1
  43. package/dist/cjs/bun/auto.js +0 -11
  44. package/dist/cjs/bun/auto.js.map +0 -1
  45. package/dist/cjs/bun/group-resolver.d.ts +0 -16
  46. package/dist/cjs/bun/group-resolver.d.ts.map +0 -1
  47. package/dist/cjs/bun/group-resolver.js +0 -44
  48. package/dist/cjs/bun/group-resolver.js.map +0 -1
  49. package/dist/cjs/bun/index.d.ts +0 -7
  50. package/dist/cjs/bun/index.d.ts.map +0 -1
  51. package/dist/cjs/bun/index.js +0 -23
  52. package/dist/cjs/bun/index.js.map +0 -1
  53. package/dist/cjs/bun/plugin.d.ts +0 -67
  54. package/dist/cjs/bun/plugin.d.ts.map +0 -1
  55. package/dist/cjs/bun/plugin.js +0 -395
  56. package/dist/cjs/bun/plugin.js.map +0 -1
  57. package/dist/cjs/bun/scan-cache.d.ts +0 -22
  58. package/dist/cjs/bun/scan-cache.d.ts.map +0 -1
  59. package/dist/cjs/bun/scan-cache.js +0 -89
  60. package/dist/cjs/bun/scan-cache.js.map +0 -1
  61. package/dist/cjs/bun/sources.d.ts +0 -49
  62. package/dist/cjs/bun/sources.d.ts.map +0 -1
  63. package/dist/cjs/bun/sources.js +0 -115
  64. package/dist/cjs/bun/sources.js.map +0 -1
  65. package/dist/cjs/clis/artifacts.d.ts +0 -3
  66. package/dist/cjs/clis/artifacts.d.ts.map +0 -1
  67. package/dist/cjs/clis/artifacts.js +0 -62
  68. package/dist/cjs/clis/artifacts.js.map +0 -1
  69. package/dist/cjs/common/install-quiet-logger.d.ts +0 -2
  70. package/dist/cjs/common/install-quiet-logger.d.ts.map +0 -1
  71. package/dist/cjs/common/install-quiet-logger.js +0 -7
  72. package/dist/cjs/common/install-quiet-logger.js.map +0 -1
  73. package/dist/cjs/common/quiet-logger.d.ts +0 -18
  74. package/dist/cjs/common/quiet-logger.d.ts.map +0 -1
  75. package/dist/cjs/common/quiet-logger.js +0 -46
  76. package/dist/cjs/common/quiet-logger.js.map +0 -1
  77. package/dist/cjs/generator/common/constants.d.ts +0 -59
  78. package/dist/cjs/generator/common/constants.d.ts.map +0 -1
  79. package/dist/cjs/generator/common/constants.js +0 -102
  80. package/dist/cjs/generator/common/constants.js.map +0 -1
  81. package/dist/cjs/generator/common/index.d.ts +0 -3
  82. package/dist/cjs/generator/common/index.d.ts.map +0 -1
  83. package/dist/cjs/generator/common/index.js +0 -19
  84. package/dist/cjs/generator/common/index.js.map +0 -1
  85. package/dist/cjs/generator/common/types.d.ts +0 -33
  86. package/dist/cjs/generator/common/types.d.ts.map +0 -1
  87. package/dist/cjs/generator/common/types.js +0 -3
  88. package/dist/cjs/generator/common/types.js.map +0 -1
  89. package/dist/cjs/generator/emitter.d.ts +0 -41
  90. package/dist/cjs/generator/emitter.d.ts.map +0 -1
  91. package/dist/cjs/generator/emitter.js +0 -82
  92. package/dist/cjs/generator/emitter.js.map +0 -1
  93. package/dist/cjs/generator/index.d.ts +0 -26
  94. package/dist/cjs/generator/index.d.ts.map +0 -1
  95. package/dist/cjs/generator/index.js +0 -68
  96. package/dist/cjs/generator/index.js.map +0 -1
  97. package/dist/cjs/generator/reexport.d.ts +0 -28
  98. package/dist/cjs/generator/reexport.d.ts.map +0 -1
  99. package/dist/cjs/generator/reexport.js +0 -131
  100. package/dist/cjs/generator/reexport.js.map +0 -1
  101. package/dist/cjs/generator/scanner.d.ts +0 -26
  102. package/dist/cjs/generator/scanner.d.ts.map +0 -1
  103. package/dist/cjs/generator/scanner.js +0 -258
  104. package/dist/cjs/generator/scanner.js.map +0 -1
  105. package/dist/cjs/index.d.ts +0 -3
  106. package/dist/cjs/index.d.ts.map +0 -1
  107. package/dist/cjs/index.js +0 -19
  108. package/dist/cjs/index.js.map +0 -1
  109. package/dist/cjs/vite/index.d.ts +0 -2
  110. package/dist/cjs/vite/index.d.ts.map +0 -1
  111. package/dist/cjs/vite/index.js +0 -18
  112. package/dist/cjs/vite/index.js.map +0 -1
  113. package/dist/cjs/vite/plugin.d.ts +0 -29
  114. package/dist/cjs/vite/plugin.d.ts.map +0 -1
  115. package/dist/cjs/vite/plugin.js +0 -61
  116. package/dist/cjs/vite/plugin.js.map +0 -1
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ScanSkipReasons = 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.CONFIGURATION = 'configuration'; }
7
- static { this.COMPONENT = 'component'; }
8
- static { this.CONTROLLER = 'controller'; }
9
- static { this.SERVICE = 'service'; }
10
- static { this.REPOSITORY = 'repository'; }
11
- static { this.DATASOURCE = 'datasource'; }
12
- static { this.MODEL = 'model'; }
13
- static { this.SCHEME_SET = new Set([
14
- this.CONFIGURATION,
15
- this.COMPONENT,
16
- this.CONTROLLER,
17
- this.SERVICE,
18
- this.REPOSITORY,
19
- this.DATASOURCE,
20
- this.MODEL,
21
- ]); }
22
- static isValid(value) {
23
- return this.SCHEME_SET.has(value);
24
- }
25
- }
26
- exports.ArtifactTypes = ArtifactTypes;
27
- /** Mirrors the kernel's `ArtifactIndexFields` - the keys of the object the emitter writes and `registerArtifacts` reads. */
28
- class ArtifactIndexFields {
29
- static { this.CONFIGURATIONS = 'configurations'; }
30
- static { this.DATA_SOURCES = 'dataSources'; }
31
- static { this.COMPONENTS = 'components'; }
32
- static { this.REPOSITORIES = 'repositories'; }
33
- static { this.SERVICES = 'services'; }
34
- static { this.CONTROLLERS = 'controllers'; }
35
- static { this.SCHEME_SET = new Set([
36
- this.CONFIGURATIONS,
37
- this.DATA_SOURCES,
38
- this.COMPONENTS,
39
- this.REPOSITORIES,
40
- this.SERVICES,
41
- this.CONTROLLERS,
42
- ]); }
43
- static isValid(value) {
44
- return this.SCHEME_SET.has(value);
45
- }
46
- }
47
- exports.ArtifactIndexFields = ArtifactIndexFields;
48
- class ArtifactStereotypes {
49
- /** The source files the scanner reads: TypeScript, with or without JSX. */
50
- static { this.SOURCE_GLOB = '**/*.{ts,tsx}'; }
51
- /** The extension of a source file - stripped for an import specifier, replaced by `.js` for its compiled copy. */
52
- static { this.SOURCE_EXTENSION = /\.tsx?$/; }
53
- /** Decorator name as imported from `@venizia/ignis` or `@venizia/ignis-kernel` -> artifact type. */
54
- static { this.BY_DECORATOR = {
55
- configuration: ArtifactTypes.CONFIGURATION,
56
- component: ArtifactTypes.COMPONENT,
57
- controller: ArtifactTypes.CONTROLLER,
58
- service: ArtifactTypes.SERVICE,
59
- repository: ArtifactTypes.REPOSITORY,
60
- datasource: ArtifactTypes.DATASOURCE,
61
- model: ArtifactTypes.MODEL,
62
- }; }
63
- static { this.ROOT_DECORATOR = 'injectable'; }
64
- static { this.SCHEME_SET = new Set(Object.values(ArtifactStereotypes.BY_DECORATOR)); }
65
- static isValid(value) {
66
- return this.SCHEME_SET.has(value);
67
- }
68
- static { this.SOURCE_MODULES = /^@venizia\/ignis(?:-kernel)?(?:\/.+)?$/; }
69
- static { this.DEFAULT_IGNORE = [
70
- '**/__tests__/**',
71
- '**/*.test.{ts,tsx}',
72
- '**/*.spec.{ts,tsx}',
73
- '**/generated/**',
74
- ]; }
75
- /**
76
- * The kernel's `registerArtifacts` order; `model` is never emitted. Configurations come first:
77
- * `registerConfigurations` runs before the datasource and component sweeps, so a `@configuration`
78
- * can shape what they read. The kernel sorts them among themselves by their `after` declarations
79
- * at boot, so the order within the field does not matter here.
80
- */
81
- static { this.EMIT_ORDER = [
82
- { type: ArtifactTypes.CONFIGURATION, field: ArtifactIndexFields.CONFIGURATIONS },
83
- { type: ArtifactTypes.DATASOURCE, field: ArtifactIndexFields.DATA_SOURCES },
84
- { type: ArtifactTypes.COMPONENT, field: ArtifactIndexFields.COMPONENTS },
85
- { type: ArtifactTypes.REPOSITORY, field: ArtifactIndexFields.REPOSITORIES },
86
- { type: ArtifactTypes.SERVICE, field: ArtifactIndexFields.SERVICES },
87
- { type: ArtifactTypes.CONTROLLER, field: ArtifactIndexFields.CONTROLLERS },
88
- ]; }
89
- }
90
- exports.ArtifactStereotypes = ArtifactStereotypes;
91
- /** Why a decorated class was left out of the index - reported, never silent. */
92
- class ScanSkipReasons {
93
- static { this.ABSTRACT = 'abstract'; }
94
- static { this.NOT_EXPORTED = 'not-exported'; }
95
- static { this.IGNORED = 'ignored'; }
96
- static { this.SCHEME_SET = new Set([this.ABSTRACT, this.NOT_EXPORTED, this.IGNORED]); }
97
- static isValid(value) {
98
- return this.SCHEME_SET.has(value);
99
- }
100
- }
101
- exports.ScanSkipReasons = ScanSkipReasons;
102
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/generator/common/constants.ts"],"names":[],"mappings":";;;AAEA,iIAAiI;AACjI,MAAa,aAAa;aACR,kBAAa,GAAG,eAAe,CAAC;aAChC,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,aAAa;QAClB,IAAI,CAAC,SAAS;QACd,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,OAAO;QACZ,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,UAAU;QACf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C;IACpC,CAAC;;AATH,0CAUC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers';\n\n/** Mirrors the kernel's `ArtifactTypes` values; boot must not depend on kernel (`{boot, kernel} -> core` in the build chain). */\nexport class ArtifactTypes {\n static readonly CONFIGURATION = 'configuration';\n static readonly COMPONENT = 'component';\n static readonly CONTROLLER = 'controller';\n static readonly SERVICE = 'service';\n static readonly REPOSITORY = 'repository';\n static readonly DATASOURCE = 'datasource';\n static readonly MODEL = 'model';\n\n static readonly SCHEME_SET = new Set<string>([\n this.CONFIGURATION,\n this.COMPONENT,\n this.CONTROLLER,\n this.SERVICE,\n this.REPOSITORY,\n this.DATASOURCE,\n this.MODEL,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport type TArtifactType = TConstValue<typeof ArtifactTypes>;\n\n/** Mirrors the kernel's `ArtifactIndexFields` - the keys of the object the emitter writes and `registerArtifacts` reads. */\nexport class ArtifactIndexFields {\n static readonly CONFIGURATIONS = 'configurations';\n static readonly DATA_SOURCES = 'dataSources';\n static readonly COMPONENTS = 'components';\n static readonly REPOSITORIES = 'repositories';\n static readonly SERVICES = 'services';\n static readonly CONTROLLERS = 'controllers';\n\n static readonly SCHEME_SET = new Set<string>([\n this.CONFIGURATIONS,\n this.DATA_SOURCES,\n this.COMPONENTS,\n this.REPOSITORIES,\n this.SERVICES,\n this.CONTROLLERS,\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport type TArtifactIndexField = TConstValue<typeof ArtifactIndexFields>;\n\nexport class ArtifactStereotypes {\n /** The source files the scanner reads: TypeScript, with or without JSX. */\n static readonly SOURCE_GLOB = '**/*.{ts,tsx}';\n /** The extension of a source file - stripped for an import specifier, replaced by `.js` for its compiled copy. */\n static readonly SOURCE_EXTENSION = /\\.tsx?$/;\n /** Decorator name as imported from `@venizia/ignis` or `@venizia/ignis-kernel` -> artifact type. */\n static readonly BY_DECORATOR: Readonly<Record<string, TArtifactType>> = {\n configuration: ArtifactTypes.CONFIGURATION,\n component: ArtifactTypes.COMPONENT,\n controller: ArtifactTypes.CONTROLLER,\n service: ArtifactTypes.SERVICE,\n repository: ArtifactTypes.REPOSITORY,\n datasource: ArtifactTypes.DATASOURCE,\n model: ArtifactTypes.MODEL,\n };\n\n static readonly ROOT_DECORATOR = 'injectable';\n\n static readonly SCHEME_SET = new Set<string>(Object.values(ArtifactStereotypes.BY_DECORATOR));\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n\n static readonly SOURCE_MODULES = /^@venizia\\/ignis(?:-kernel)?(?:\\/.+)?$/;\n\n static readonly DEFAULT_IGNORE = [\n '**/__tests__/**',\n '**/*.test.{ts,tsx}',\n '**/*.spec.{ts,tsx}',\n '**/generated/**',\n ];\n\n /**\n * The kernel's `registerArtifacts` order; `model` is never emitted. Configurations come first:\n * `registerConfigurations` runs before the datasource and component sweeps, so a `@configuration`\n * can shape what they read. The kernel sorts them among themselves by their `after` declarations\n * at boot, so the order within the field does not matter here.\n */\n static readonly EMIT_ORDER: ReadonlyArray<{ type: TArtifactType; field: TArtifactIndexField }> = [\n { type: ArtifactTypes.CONFIGURATION, field: ArtifactIndexFields.CONFIGURATIONS },\n { type: ArtifactTypes.DATASOURCE, field: ArtifactIndexFields.DATA_SOURCES },\n { type: ArtifactTypes.COMPONENT, field: ArtifactIndexFields.COMPONENTS },\n { type: ArtifactTypes.REPOSITORY, field: ArtifactIndexFields.REPOSITORIES },\n { type: ArtifactTypes.SERVICE, field: ArtifactIndexFields.SERVICES },\n { type: ArtifactTypes.CONTROLLER, field: ArtifactIndexFields.CONTROLLERS },\n ];\n}\n\n/** Why a decorated class was left out of the index - reported, never silent. */\nexport class ScanSkipReasons {\n static readonly ABSTRACT = 'abstract';\n static readonly NOT_EXPORTED = 'not-exported';\n static readonly IGNORED = 'ignored';\n\n static readonly SCHEME_SET = new Set<string>([this.ABSTRACT, this.NOT_EXPORTED, this.IGNORED]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\nexport type TScanSkipReason = TConstValue<typeof ScanSkipReasons>;\n"]}
@@ -1,3 +0,0 @@
1
- export * from './constants';
2
- export * from './types';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/generator/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./constants"), exports);
18
- __exportStar(require("./types"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generator/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0CAAwB","sourcesContent":["export * from './constants';\nexport * from './types';\n"]}
@@ -1,33 +0,0 @@
1
- import type { AnyType, TClass } from '@venizia/ignis-helpers';
2
- import type { TArtifactIndexField, TArtifactType, TScanSkipReason } from './constants';
3
- export interface IScannedArtifact {
4
- className: string;
5
- /** Absolute path of the declaring file. */
6
- filePath: string;
7
- type: TArtifactType;
8
- }
9
- export interface IScanOptions {
10
- root: string;
11
- /** Glob patterns relative to `root`; defaults to `ArtifactStereotypes.DEFAULT_IGNORE`. */
12
- ignore?: string[];
13
- /** Module specifiers, matched exactly, whose stereotype imports also count - a package that re-exports the decorators. Adds to `ArtifactStereotypes.SOURCE_MODULES`. */
14
- sourceModules?: string[];
15
- /** Recognise a stereotype imported from any module whose exports lead, through `export *` and renaming re-exports, to a source module - a framework that re-exports the kernel's decorators. */
16
- followReexports?: boolean;
17
- }
18
- /** A decorated class the index leaves out, and why. */
19
- export interface IScanSkipped {
20
- className: string;
21
- filePath: string;
22
- reason: TScanSkipReason;
23
- }
24
- /** The index content plus what a caller's `ignore` silently left out: decorated classes under a user pattern, never under a default one. */
25
- export interface IScanReport {
26
- artifacts: IScannedArtifact[];
27
- ignored: IScannedArtifact[];
28
- /** Every decorated class left out - abstract, not a named export, or under a user ignore pattern. */
29
- skipped: IScanSkipped[];
30
- }
31
- /** The object a generated index exports - structurally the kernel's `IArtifactIndex` (boot does not depend on the kernel). */
32
- export type TGeneratedArtifactIndex = Partial<Record<TArtifactIndexField, ReadonlyArray<TClass<AnyType>>>>;
33
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/generator/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvF,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;IAClB,wKAAwK;IACxK,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,gMAAgM;IAChM,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,uDAAuD;AACvD,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,4IAA4I;AAC5I,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,qGAAqG;IACrG,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAED,8HAA8H;AAC9H,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAC3C,MAAM,CAAC,mBAAmB,EAAE,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAC5D,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/generator/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnyType, TClass } from '@venizia/ignis-helpers';\nimport type { TArtifactIndexField, TArtifactType, TScanSkipReason } from './constants';\n\nexport interface IScannedArtifact {\n className: string;\n /** Absolute path of the declaring file. */\n filePath: string;\n type: TArtifactType;\n}\n\nexport interface IScanOptions {\n root: string;\n /** Glob patterns relative to `root`; defaults to `ArtifactStereotypes.DEFAULT_IGNORE`. */\n ignore?: string[];\n /** Module specifiers, matched exactly, whose stereotype imports also count - a package that re-exports the decorators. Adds to `ArtifactStereotypes.SOURCE_MODULES`. */\n sourceModules?: string[];\n /** Recognise a stereotype imported from any module whose exports lead, through `export *` and renaming re-exports, to a source module - a framework that re-exports the kernel's decorators. */\n followReexports?: boolean;\n}\n\n/** A decorated class the index leaves out, and why. */\nexport interface IScanSkipped {\n className: string;\n filePath: string;\n reason: TScanSkipReason;\n}\n\n/** The index content plus what a caller's `ignore` silently left out: decorated classes under a user pattern, never under a default one. */\nexport interface IScanReport {\n artifacts: IScannedArtifact[];\n ignored: IScannedArtifact[];\n /** Every decorated class left out - abstract, not a named export, or under a user ignore pattern. */\n skipped: IScanSkipped[];\n}\n\n/** The object a generated index exports - structurally the kernel's `IArtifactIndex` (boot does not depend on the kernel). */\nexport type TGeneratedArtifactIndex = Partial<\n Record<TArtifactIndexField, ReadonlyArray<TClass<AnyType>>>\n>;\n"]}
@@ -1,41 +0,0 @@
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 the root bunfig.toml `[fmt]` table. */
5
- static readonly PRINT_WIDTH = 100;
6
- static readonly DEFAULT_EXPORT_NAME = "GeneratedArtifacts";
7
- /** The `ignis-artifacts generate` command for these options - the header and the CLI's stale hint print the same one. */
8
- static renderCommand(opts: {
9
- root: string;
10
- out: string;
11
- ignore?: string[];
12
- exportName?: string;
13
- sourceModules?: string[];
14
- }): string;
15
- /** The exact command that regenerates the file, so the header never points at another path than the one the build used. */
16
- static renderHeader(opts: {
17
- root: string;
18
- out: string;
19
- ignore?: string[];
20
- exportName?: string;
21
- sourceModules?: string[];
22
- }): string;
23
- static render(opts: {
24
- artifacts: IScannedArtifact[];
25
- outFile: string;
26
- exportName: string;
27
- /** Absolute import paths - for a virtual module, which has no directory to resolve a relative one from. */
28
- absoluteImports?: boolean;
29
- /** The CLI arguments as given, for the header; `outFile` above is the resolved path used for import specifiers. */
30
- command: {
31
- root: string;
32
- out: string;
33
- ignore?: string[];
34
- sourceModules?: string[];
35
- };
36
- }): string;
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
- private static renderField;
39
- private static importPath;
40
- }
41
- //# sourceMappingURL=emitter.d.ts.map
@@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AAC,MAAM,CAAC,WAAW;IAW1B,OAAO,CAAC,MAAM,CAAC,UAAU;CAU1B"}
@@ -1,82 +0,0 @@
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 the root bunfig.toml `[fmt]` table. */
9
- static { this.PRINT_WIDTH = 100; }
10
- static { this.DEFAULT_EXPORT_NAME = 'GeneratedArtifacts'; }
11
- /** The `ignis-artifacts generate` command for these options - the header and the CLI's stale hint print the same one. */
12
- static renderCommand(opts) {
13
- const { root, out, ignore = [], exportName, sourceModules = [] } = opts;
14
- const flags = [`--root ${root}`, `--out ${out}`];
15
- if (ignore.length > 0) {
16
- flags.push(`--ignore ${ignore.join(',')}`);
17
- }
18
- if (exportName && exportName !== ArtifactIndexEmitter.DEFAULT_EXPORT_NAME) {
19
- flags.push(`--export ${exportName}`);
20
- }
21
- for (const sourceModule of sourceModules) {
22
- flags.push(`--source-module ${sourceModule}`);
23
- }
24
- return `ignis-artifacts generate ${flags.join(' ')}`;
25
- }
26
- /** The exact command that regenerates the file, so the header never points at another path than the one the build used. */
27
- static renderHeader(opts) {
28
- return `// AUTO-GENERATED by @venizia/ignis-boot - do not edit. Regenerate: ${ArtifactIndexEmitter.renderCommand(opts)}`;
29
- }
30
- static render(opts) {
31
- const { artifacts, outFile, exportName, command } = opts;
32
- const emitted = artifacts.filter((artifact) => artifact.type !== common_1.ArtifactTypes.MODEL);
33
- const imports = emitted
34
- .map((artifact) => ({
35
- name: artifact.className,
36
- path: ArtifactIndexEmitter.importPath({
37
- from: outFile,
38
- to: artifact.filePath,
39
- isAbsolute: opts.absoluteImports ?? false,
40
- }),
41
- }))
42
- .sort((a, b) => a.path.localeCompare(b.path) || a.name.localeCompare(b.name))
43
- .map((entry) => `import { ${entry.name} } from '${entry.path}';`);
44
- const fields = common_1.ArtifactStereotypes.EMIT_ORDER.flatMap(({ type, field }) => {
45
- const names = emitted
46
- .filter((artifact) => artifact.type === type)
47
- .map((artifact) => artifact.className)
48
- .sort((a, b) => a.localeCompare(b));
49
- return ArtifactIndexEmitter.renderField({ field, names });
50
- });
51
- return [
52
- ArtifactIndexEmitter.renderHeader({ ...command, exportName }),
53
- ...imports,
54
- '',
55
- `export const ${exportName} = {`,
56
- ...fields,
57
- '};',
58
- '',
59
- ].join('\n');
60
- }
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
- static renderField(opts) {
63
- const { field, names } = opts;
64
- const singleLine = ` ${field}: [${names.join(', ')}],`;
65
- if (singleLine.length <= ArtifactIndexEmitter.PRINT_WIDTH) {
66
- return [singleLine];
67
- }
68
- return [` ${field}: [`, ...names.map((name) => ` ${name},`), ' ],'];
69
- }
70
- static importPath(opts) {
71
- if (opts.isAbsolute) {
72
- return opts.to.split(node_path_1.sep).join('/').replace(common_1.ArtifactStereotypes.SOURCE_EXTENSION, '');
73
- }
74
- const raw = (0, node_path_1.relative)((0, node_path_1.dirname)(opts.from), opts.to)
75
- .split(node_path_1.sep)
76
- .join('/')
77
- .replace(common_1.ArtifactStereotypes.SOURCE_EXTENSION, '');
78
- return raw.startsWith('.') ? raw : `./${raw}`;
79
- }
80
- }
81
- exports.ArtifactIndexEmitter = ArtifactIndexEmitter;
82
- //# sourceMappingURL=emitter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../../src/generator/emitter.ts"],"names":[],"mappings":";;;AAAA,yCAAmD;AACnD,qCAAqF;AAErF,iKAAiK;AACjK,MAAa,oBAAoB;IAC/B,kEAAkE;aAClD,gBAAW,GAAG,GAAG,CAAC;aAElB,wBAAmB,GAAG,oBAAoB,CAAC;IAE3D,yHAAyH;IACzH,MAAM,CAAC,aAAa,CAAC,I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IACf,CAAC;IAED,+HAA+H;IACvH,MAAM,CAAC,WAAW,CAAC,IAAwC;QACjE,MAAM,EAAE,KAAK,EAAE,KAAK,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,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IAC3E,CAAC;IAEO,MAAM,CAAC,UAAU,CAAC,IAAuD;QAC/E,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,eAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,4BAAmB,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QACxF,CAAC;QACD,MAAM,GAAG,GAAG,IAAA,oBAAQ,EAAC,IAAA,mBAAO,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;aAC9C,KAAK,CAAC,eAAG,CAAC;aACV,IAAI,CAAC,GAAG,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,26 +0,0 @@
1
- import type { IScanReport, IScannedArtifact } from './common';
2
- export interface IGenerateOptions {
3
- root: string;
4
- out: string;
5
- ignore?: string[];
6
- /** Name of the exported constant; default `GeneratedArtifacts`. */
7
- exportName?: string;
8
- /** Extra module specifiers whose stereotype imports count; see `IScanOptions.sourceModules`. */
9
- sourceModules?: string[];
10
- }
11
- /** Writes the index only when its content changed, so an unchanged tree leaves the file's mtime alone. */
12
- export declare const generateArtifactIndex: (opts: IGenerateOptions) => {
13
- content: string;
14
- written: boolean;
15
- } & IScanReport;
16
- /** Renders in memory and compares the body with the committed file - the staleness gate for lint and CI. */
17
- export declare const checkArtifactIndex: (opts: IGenerateOptions) => {
18
- isFresh: boolean;
19
- expected: string;
20
- actual: string | undefined;
21
- ignored: IScannedArtifact[];
22
- };
23
- export * from './common';
24
- export * from './emitter';
25
- export * from './scanner';
26
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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;IACpB,gGAAgG;IAChG,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAuBD,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,68 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.checkArtifactIndex = exports.generateArtifactIndex = void 0;
18
- const node_fs_1 = require("node:fs");
19
- const node_path_1 = require("node:path");
20
- const emitter_1 = require("./emitter");
21
- const scanner_1 = require("./scanner");
22
- const render = (opts) => {
23
- const { artifacts, ignored, skipped } = scanner_1.ArtifactScanner.getInstance().scanWithReport({
24
- root: opts.root,
25
- ignore: opts.ignore,
26
- sourceModules: opts.sourceModules,
27
- });
28
- const content = emitter_1.ArtifactIndexEmitter.render({
29
- artifacts,
30
- outFile: (0, node_path_1.resolve)(opts.out),
31
- exportName: opts.exportName ?? emitter_1.ArtifactIndexEmitter.DEFAULT_EXPORT_NAME,
32
- command: {
33
- root: opts.root,
34
- out: opts.out,
35
- ignore: opts.ignore,
36
- sourceModules: opts.sourceModules,
37
- },
38
- });
39
- return { content, artifacts, ignored, skipped };
40
- };
41
- /** Writes the index only when its content changed, so an unchanged tree leaves the file's mtime alone. */
42
- const generateArtifactIndex = (opts) => {
43
- const { content, artifacts, ignored, skipped } = render(opts);
44
- const out = (0, node_path_1.resolve)(opts.out);
45
- const current = (0, node_fs_1.existsSync)(out) ? (0, node_fs_1.readFileSync)(out, 'utf8') : undefined;
46
- if (current === content) {
47
- return { content, artifacts, ignored, skipped, written: false };
48
- }
49
- (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(out), { recursive: true });
50
- (0, node_fs_1.writeFileSync)(out, content);
51
- return { content, artifacts, ignored, skipped, written: true };
52
- };
53
- exports.generateArtifactIndex = generateArtifactIndex;
54
- /** Everything below the first line: the header only records the command, so a flag change alone must not read as drift. */
55
- const bodyOf = (content) => content.slice(content.indexOf('\n') + 1);
56
- /** Renders in memory and compares the body with the committed file - the staleness gate for lint and CI. */
57
- const checkArtifactIndex = (opts) => {
58
- const { content: expected, ignored } = render(opts);
59
- const out = (0, node_path_1.resolve)(opts.out);
60
- const actual = (0, node_fs_1.existsSync)(out) ? (0, node_fs_1.readFileSync)(out, 'utf8') : undefined;
61
- const isFresh = actual !== undefined && bodyOf(actual) === bodyOf(expected);
62
- return { isFresh, expected, actual, ignored };
63
- };
64
- exports.checkArtifactIndex = checkArtifactIndex;
65
- __exportStar(require("./common"), exports);
66
- __exportStar(require("./emitter"), exports);
67
- __exportStar(require("./scanner"), exports);
68
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/generator/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAA6E;AAC7E,yCAA6C;AAE7C,uCAAiD;AACjD,uCAA4C;AAY5C,MAAM,MAAM,GAAG,CAAC,IAAsB,EAAqC,EAAE;IAC3E,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,yBAAe,CAAC,WAAW,EAAE,CAAC,cAAc,CAAC;QACnF,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,aAAa,EAAE,IAAI,CAAC,aAAa;KAClC,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,8BAAoB,CAAC,MAAM,CAAC;QAC1C,SAAS;QACT,OAAO,EAAE,IAAA,mBAAO,EAAC,IAAI,CAAC,GAAG,CAAC;QAC1B,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,8BAAoB,CAAC,mBAAmB;QACvE,OAAO,EAAE;YACP,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC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AG,MAAM,CAAC,IAAI,CAAC,CAAC;IACpD,MAAM,GAAG,GAAG,IAAA,mBAAO,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,MAAM,GAAG,IAAA,oBAAU,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,sBAAY,EAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACvE,MAAM,OAAO,GAAG,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE5E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAChD,CAAC,CAAC;AAdW,QAAA,kBAAkB,sBAc7B;AAEF,2CAAyB;AACzB,4CAA0B;AAC1B,4CAA0B","sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport type { IScanReport, IScannedArtifact } from './common';\nimport { ArtifactIndexEmitter } from './emitter';\nimport { ArtifactScanner } from './scanner';\n\nexport interface IGenerateOptions {\n root: string;\n out: string;\n ignore?: string[];\n /** Name of the exported constant; default `GeneratedArtifacts`. */\n exportName?: string;\n /** Extra module specifiers whose stereotype imports count; see `IScanOptions.sourceModules`. */\n sourceModules?: string[];\n}\n\nconst render = (opts: IGenerateOptions): { content: string } & IScanReport => {\n const { artifacts, ignored, skipped } = ArtifactScanner.getInstance().scanWithReport({\n root: opts.root,\n ignore: opts.ignore,\n sourceModules: opts.sourceModules,\n });\n const content = ArtifactIndexEmitter.render({\n artifacts,\n outFile: resolve(opts.out),\n exportName: opts.exportName ?? ArtifactIndexEmitter.DEFAULT_EXPORT_NAME,\n command: {\n root: opts.root,\n out: opts.out,\n ignore: opts.ignore,\n sourceModules: opts.sourceModules,\n },\n });\n\n return { content, artifacts, ignored, skipped };\n};\n\n/** Writes the index only when its content changed, so an unchanged tree leaves the file's mtime alone. */\nexport const generateArtifactIndex = (\n opts: IGenerateOptions,\n): { content: string; written: boolean } & IScanReport => {\n const { content, artifacts, ignored, skipped } = render(opts);\n const out = resolve(opts.out);\n const current = existsSync(out) ? readFileSync(out, 'utf8') : undefined;\n\n if (current === content) {\n return { content, artifacts, ignored, skipped, written: false };\n }\n\n mkdirSync(dirname(out), { recursive: true });\n writeFileSync(out, content);\n\n return { content, artifacts, ignored, skipped, written: true };\n};\n\n/** Everything below the first line: the header only records the command, so a flag change alone must not read as drift. */\nconst bodyOf = (content: string): string => content.slice(content.indexOf('\\n') + 1);\n\n/** Renders in memory and compares the body with the committed file - the staleness gate for lint and CI. */\nexport const checkArtifactIndex = (\n opts: IGenerateOptions,\n): {\n isFresh: boolean;\n expected: string;\n actual: string | undefined;\n ignored: IScannedArtifact[];\n} => {\n const { content: expected, ignored } = render(opts);\n const out = resolve(opts.out);\n const actual = existsSync(out) ? readFileSync(out, 'utf8') : undefined;\n const isFresh = actual !== undefined && bodyOf(actual) === bodyOf(expected);\n\n return { isFresh, expected, actual, ignored };\n};\n\nexport * from './common';\nexport * from './emitter';\nexport * from './scanner';\n"]}
@@ -1,28 +0,0 @@
1
- import { BaseHelper } from '@venizia/ignis-helpers';
2
- /** Follows a named import through `export *` and renaming re-exports until it reaches a source module, so a framework that re-exports the kernel's decorators is recognised. Reads declarations only; never builds a type-checked program. */
3
- export declare class StereotypeReexportResolver extends BaseHelper {
4
- static readonly MAX_DEPTH = 10;
5
- private readonly options;
6
- private readonly sourceModules;
7
- /** One scan reads the same barrels many times: resolutions, parsed files and answers are memoized per resolver. */
8
- private readonly resolutions;
9
- private readonly sources;
10
- private readonly origins;
11
- constructor(opts: {
12
- root: string;
13
- sourceModules: Set<string>;
14
- });
15
- /** The nearest tsconfig's options (for `paths` aliases), with bundler resolution as the fallback. */
16
- private static compilerOptionsFor;
17
- /** The kernel name `name` (exported by `specifier`, as seen from `fromFile`) originates as, or `undefined` when the chain never reaches a source module. */
18
- originOf(opts: {
19
- fromFile: string;
20
- specifier: string;
21
- name: string;
22
- }): string | undefined;
23
- private resolveFile;
24
- private parse;
25
- private isSourceModule;
26
- private follow;
27
- }
28
- //# sourceMappingURL=reexport.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reexport.d.ts","sourceRoot":"","sources":["../../../src/generator/reexport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAMpD,8OAA8O;AAC9O,qBAAa,0BAA2B,SAAQ,UAAU;IACxD,MAAM,CAAC,QAAQ,CAAC,SAAS,MAAM;IAE/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAc;IAC5C,mHAAmH;IACnH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAyC;IACrE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoC;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyC;gBAErD,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;KAAE;IAM9D,qGAAqG;IACrG,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAmBjC,4JAA4J;IAC5J,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,GAAG,SAAS;IAQzF,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,KAAK;IAcb,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,MAAM;CA8Ef"}
@@ -1,131 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.StereotypeReexportResolver = void 0;
7
- const ignis_helpers_1 = require("@venizia/ignis-helpers");
8
- const node_fs_1 = require("node:fs");
9
- const node_path_1 = require("node:path");
10
- const typescript_1 = __importDefault(require("typescript"));
11
- const common_1 = require("./common");
12
- /** Follows a named import through `export *` and renaming re-exports until it reaches a source module, so a framework that re-exports the kernel's decorators is recognised. Reads declarations only; never builds a type-checked program. */
13
- class StereotypeReexportResolver extends ignis_helpers_1.BaseHelper {
14
- static { this.MAX_DEPTH = 10; }
15
- constructor(opts) {
16
- super({ scope: StereotypeReexportResolver.name });
17
- /** One scan reads the same barrels many times: resolutions, parsed files and answers are memoized per resolver. */
18
- this.resolutions = new Map();
19
- this.sources = new Map();
20
- this.origins = new Map();
21
- this.sourceModules = opts.sourceModules;
22
- this.options = StereotypeReexportResolver.compilerOptionsFor({ root: opts.root });
23
- }
24
- /** The nearest tsconfig's options (for `paths` aliases), with bundler resolution as the fallback. */
25
- static compilerOptionsFor(opts) {
26
- const configPath = typescript_1.default.findConfigFile(opts.root, typescript_1.default.sys.fileExists);
27
- const fallback = {
28
- module: typescript_1.default.ModuleKind.ESNext,
29
- moduleResolution: typescript_1.default.ModuleResolutionKind.Bundler,
30
- allowJs: true,
31
- };
32
- if (!configPath) {
33
- return fallback;
34
- }
35
- const parsed = typescript_1.default.parseJsonConfigFileContent(typescript_1.default.readConfigFile(configPath, typescript_1.default.sys.readFile).config, typescript_1.default.sys, (0, node_path_1.dirname)(configPath));
36
- return { ...fallback, ...parsed.options };
37
- }
38
- /** The kernel name `name` (exported by `specifier`, as seen from `fromFile`) originates as, or `undefined` when the chain never reaches a source module. */
39
- originOf(opts) {
40
- const key = `${(0, node_path_1.dirname)(opts.fromFile)}|${opts.specifier}|${opts.name}`;
41
- if (!this.origins.has(key)) {
42
- this.origins.set(key, this.follow({ ...opts, depth: 0, seen: new Set() }));
43
- }
44
- return this.origins.get(key);
45
- }
46
- resolveFile(opts) {
47
- const key = `${(0, node_path_1.dirname)(opts.fromFile)}|${opts.specifier}`;
48
- if (!this.resolutions.has(key)) {
49
- this.resolutions.set(key, typescript_1.default.resolveModuleName(opts.specifier, opts.fromFile, this.options, typescript_1.default.sys).resolvedModule
50
- ?.resolvedFileName);
51
- }
52
- return this.resolutions.get(key);
53
- }
54
- parse(opts) {
55
- let source = this.sources.get(opts.file);
56
- if (!source) {
57
- source = typescript_1.default.createSourceFile(opts.file, (0, node_fs_1.readFileSync)(opts.file, 'utf8'), typescript_1.default.ScriptTarget.Latest, true);
58
- this.sources.set(opts.file, source);
59
- }
60
- return source;
61
- }
62
- isSourceModule(opts) {
63
- return (common_1.ArtifactStereotypes.SOURCE_MODULES.test(opts.specifier) ||
64
- this.sourceModules.has(opts.specifier));
65
- }
66
- follow(opts) {
67
- const { fromFile, specifier, name, depth, seen } = opts;
68
- if (this.isSourceModule({ specifier })) {
69
- return name;
70
- }
71
- if (depth >= StereotypeReexportResolver.MAX_DEPTH) {
72
- return undefined;
73
- }
74
- const resolved = this.resolveFile({ fromFile, specifier });
75
- const visit = `${resolved}#${name}`;
76
- if (!resolved || seen.has(visit)) {
77
- return undefined;
78
- }
79
- seen.add(visit);
80
- const source = this.parse({ file: resolved });
81
- const next = (target) => this.follow({ fromFile: resolved, ...target, depth: depth + 1, seen });
82
- const importedBy = new Map();
83
- for (const statement of source.statements) {
84
- if (!typescript_1.default.isImportDeclaration(statement) || !typescript_1.default.isStringLiteral(statement.moduleSpecifier)) {
85
- continue;
86
- }
87
- const bindings = statement.importClause?.namedBindings;
88
- if (!bindings || !typescript_1.default.isNamedImports(bindings)) {
89
- continue;
90
- }
91
- for (const element of bindings.elements) {
92
- importedBy.set(element.name.text, {
93
- specifier: statement.moduleSpecifier.text,
94
- name: (element.propertyName ?? element.name).text,
95
- });
96
- }
97
- }
98
- for (const statement of source.statements) {
99
- if (!typescript_1.default.isExportDeclaration(statement) || statement.isTypeOnly) {
100
- continue;
101
- }
102
- const fromSpecifier = statement.moduleSpecifier && typescript_1.default.isStringLiteral(statement.moduleSpecifier)
103
- ? statement.moduleSpecifier.text
104
- : undefined;
105
- if (!statement.exportClause) {
106
- const origin = fromSpecifier ? next({ specifier: fromSpecifier, name }) : undefined;
107
- if (origin) {
108
- return origin;
109
- }
110
- continue;
111
- }
112
- if (!typescript_1.default.isNamedExports(statement.exportClause)) {
113
- continue;
114
- }
115
- for (const element of statement.exportClause.elements) {
116
- if (element.name.text !== name) {
117
- continue;
118
- }
119
- const original = (element.propertyName ?? element.name).text;
120
- if (fromSpecifier) {
121
- return next({ specifier: fromSpecifier, name: original });
122
- }
123
- const imported = importedBy.get(original);
124
- return imported ? next(imported) : undefined;
125
- }
126
- }
127
- return undefined;
128
- }
129
- }
130
- exports.StereotypeReexportResolver = StereotypeReexportResolver;
131
- //# sourceMappingURL=reexport.js.map