ddd-ts-kit 0.86.0 → 0.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.fr.md +26 -27
  3. package/README.md +26 -25
  4. package/dist/check/explain/layout-docs.js +1 -1
  5. package/dist/check/explain/layout-docs.js.map +1 -1
  6. package/dist/check/explain/tree-docs.js +2 -2
  7. package/dist/check/explain/tree-docs.js.map +1 -1
  8. package/dist/check/explain/wiring-docs.d.ts.map +1 -1
  9. package/dist/check/explain/wiring-docs.js +8 -7
  10. package/dist/check/explain/wiring-docs.js.map +1 -1
  11. package/dist/check/fixtures/authz-policy-fixtures.d.ts.map +1 -1
  12. package/dist/check/fixtures/authz-policy-fixtures.js +3 -3
  13. package/dist/check/fixtures/authz-policy-fixtures.js.map +1 -1
  14. package/dist/check/fixtures/constructor-injection-fixtures.js +6 -6
  15. package/dist/check/fixtures/constructor-injection-fixtures.js.map +1 -1
  16. package/dist/check/fixtures/declarations-fixtures.d.ts.map +1 -1
  17. package/dist/check/fixtures/declarations-fixtures.js +15 -36
  18. package/dist/check/fixtures/declarations-fixtures.js.map +1 -1
  19. package/dist/check/fixtures/declared-declarations.d.ts +4 -2
  20. package/dist/check/fixtures/declared-declarations.d.ts.map +1 -1
  21. package/dist/check/fixtures/declared-declarations.js +9 -3
  22. package/dist/check/fixtures/declared-declarations.js.map +1 -1
  23. package/dist/check/fixtures/earlier-declarations-fixtures.d.ts +4 -0
  24. package/dist/check/fixtures/earlier-declarations-fixtures.d.ts.map +1 -0
  25. package/dist/check/fixtures/earlier-declarations-fixtures.js +48 -0
  26. package/dist/check/fixtures/earlier-declarations-fixtures.js.map +1 -0
  27. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  28. package/dist/check/fixtures/fixtures.js +2 -0
  29. package/dist/check/fixtures/fixtures.js.map +1 -1
  30. package/dist/check/fixtures/paths.d.ts +1 -1
  31. package/dist/check/fixtures/paths.js +1 -1
  32. package/dist/check/fixtures/paths.js.map +1 -1
  33. package/dist/check/rules/declarations-barrel-current.js +16 -11
  34. package/dist/check/rules/declarations-barrel-current.js.map +1 -1
  35. package/dist/check/rules/naming-suffix.js +1 -1
  36. package/dist/check/rules/naming-suffix.js.map +1 -1
  37. package/dist/check/support/is-generated-context-file.d.ts +1 -1
  38. package/dist/check/support/is-generated-context-file.js +1 -1
  39. package/dist/commands/docs.d.ts.map +1 -1
  40. package/dist/commands/docs.js +14 -9
  41. package/dist/commands/docs.js.map +1 -1
  42. package/dist/declared/barrel-file.d.ts +1 -1
  43. package/dist/declared/barrel-file.js +1 -1
  44. package/dist/declared/context-declarations.d.ts +4 -2
  45. package/dist/declared/context-declarations.d.ts.map +1 -1
  46. package/dist/declared/context-declarations.js +4 -2
  47. package/dist/declared/context-declarations.js.map +1 -1
  48. package/dist/declared/declarations-folder-of.d.ts +12 -7
  49. package/dist/declared/declarations-folder-of.d.ts.map +1 -1
  50. package/dist/declared/declarations-folder-of.js +15 -11
  51. package/dist/declared/declarations-folder-of.js.map +1 -1
  52. package/dist/declared/earlier-layout-notice.d.ts +10 -0
  53. package/dist/declared/earlier-layout-notice.d.ts.map +1 -0
  54. package/dist/declared/earlier-layout-notice.js +12 -0
  55. package/dist/declared/earlier-layout-notice.js.map +1 -0
  56. package/dist/declared/earlier-layout-of.d.ts +10 -0
  57. package/dist/declared/earlier-layout-of.d.ts.map +1 -0
  58. package/dist/declared/earlier-layout-of.js +16 -0
  59. package/dist/declared/earlier-layout-of.js.map +1 -0
  60. package/dist/declared/earlier-shape-of.d.ts +13 -0
  61. package/dist/declared/earlier-shape-of.d.ts.map +1 -0
  62. package/dist/declared/earlier-shape-of.js +35 -0
  63. package/dist/declared/earlier-shape-of.js.map +1 -0
  64. package/dist/declared/folder-declarations-file.d.ts +6 -4
  65. package/dist/declared/folder-declarations-file.d.ts.map +1 -1
  66. package/dist/declared/folder-declarations-file.js +7 -5
  67. package/dist/declared/folder-declarations-file.js.map +1 -1
  68. package/dist/declared/index.d.ts +3 -2
  69. package/dist/declared/index.d.ts.map +1 -1
  70. package/dist/declared/index.js +3 -2
  71. package/dist/declared/index.js.map +1 -1
  72. package/dist/declared/is-declarations-file.d.ts +3 -2
  73. package/dist/declared/is-declarations-file.d.ts.map +1 -1
  74. package/dist/declared/is-declarations-file.js +9 -9
  75. package/dist/declared/is-declarations-file.js.map +1 -1
  76. package/dist/declared/keeps-role-folder-files.d.ts +12 -0
  77. package/dist/declared/keeps-role-folder-files.d.ts.map +1 -0
  78. package/dist/declared/keeps-role-folder-files.js +25 -0
  79. package/dist/declared/keeps-role-folder-files.js.map +1 -0
  80. package/dist/declared/keeps-single-file.d.ts +1 -1
  81. package/dist/declared/keeps-single-file.js +1 -1
  82. package/dist/declared/render-declarations.d.ts +7 -3
  83. package/dist/declared/render-declarations.d.ts.map +1 -1
  84. package/dist/declared/render-declarations.js +5 -3
  85. package/dist/declared/render-declarations.js.map +1 -1
  86. package/dist/declared/render-folder-declarations.d.ts +2 -2
  87. package/dist/declared/same-files.d.ts +3 -0
  88. package/dist/declared/same-files.d.ts.map +1 -0
  89. package/dist/declared/same-files.js +5 -0
  90. package/dist/declared/same-files.js.map +1 -0
  91. package/dist/dev/refresh-declarations.d.ts.map +1 -1
  92. package/dist/dev/refresh-declarations.js +1 -1
  93. package/dist/dev/refresh-declarations.js.map +1 -1
  94. package/dist/docs/write-docs.d.ts +3 -3
  95. package/dist/docs/write-docs.d.ts.map +1 -1
  96. package/dist/docs/write-docs.js +3 -3
  97. package/dist/docs/write-docs.js.map +1 -1
  98. package/dist/generate/refresh-barrels.d.ts +17 -11
  99. package/dist/generate/refresh-barrels.d.ts.map +1 -1
  100. package/dist/generate/refresh-barrels.js +32 -26
  101. package/dist/generate/refresh-barrels.js.map +1 -1
  102. package/dist/generate/refresh-docs.d.ts +2 -2
  103. package/dist/generate/refresh-docs.d.ts.map +1 -1
  104. package/dist/generate/refresh-docs.js +3 -3
  105. package/dist/generate/refresh-docs.js.map +1 -1
  106. package/dist/init/manifest/versions.js +24 -24
  107. package/dist/version.d.ts +1 -1
  108. package/dist/version.js +1 -1
  109. package/package.json +2 -2
  110. package/templates/init/AGENTS.md.tpl +1 -1
  111. package/templates/init/README.md.tpl +2 -2
  112. package/templates/pipeline/package-scripts.json +1 -1
  113. package/dist/declared/single-file-notice.d.ts +0 -8
  114. package/dist/declared/single-file-notice.d.ts.map +0 -1
  115. package/dist/declared/single-file-notice.js +0 -9
  116. package/dist/declared/single-file-notice.js.map +0 -1
@@ -1,5 +1,6 @@
1
1
  import type { ClassInjection } from './injection/class-injection.js';
2
2
  import type { Sources } from './injection/sources.js';
3
+ import type { DeclarationsGrouping } from './declarations-folder-of.js';
3
4
  /** A declared context, read where its files are. */
4
5
  export interface DeclaredContext {
5
6
  readonly context: string;
@@ -20,7 +21,8 @@ export interface ContextDeclarations {
20
21
  }
21
22
  /**
22
23
  * What the generator writes for a context assembled by barrel, and what `declarations/barrel-current`
23
- * compares the tree with: one declarations file per role folder and the summary at the root.
24
+ * compares the tree with: one declarations file per layer and the summary at the root, or, for
25
+ * `keepsRoleFolderFiles`, one per role folder as 0.85 and 0.86 wrote them.
24
26
  */
25
- export declare function contextDeclarations({ context, directory, entries, sources, modules, specifierOf, }: DeclaredContext): ContextDeclarations;
27
+ export declare function contextDeclarations({ context, directory, entries, sources, modules, specifierOf }: DeclaredContext, grouping?: DeclarationsGrouping): ContextDeclarations;
26
28
  //# sourceMappingURL=context-declarations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-declarations.d.ts","sourceRoot":"","sources":["../../src/declared/context-declarations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAGnD,oDAAoD;AACpD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,C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S,MAAM,EAAE,CAAC;IACpC,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAChD;AAED,uHAAuH;AACvH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,SAAS,cAAc,EAAE,CAAC;CAChD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,eAAe,EAC/E,QAAQ,GAAE,oBAA8B,GACvC,mBAAmB,CAmBrB"}
@@ -3,14 +3,16 @@ import { renderInjections } from './injection/render-injections.js';
3
3
  import { renderDeclarations } from './render-declarations.js';
4
4
  /**
5
5
  * What the generator writes for a context assembled by barrel, and what `declarations/barrel-current`
6
- * compares the tree with: one declarations file per role folder and the summary at the root.
6
+ * compares the tree with: one declarations file per layer and the summary at the root, or, for
7
+ * `keepsRoleFolderFiles`, one per role folder as 0.85 and 0.86 wrote them.
7
8
  */
8
- export function contextDeclarations({ context, directory, entries, sources, modules, specifierOf, }) {
9
+ export function contextDeclarations({ context, directory, entries, sources, modules, specifierOf }, grouping = 'layer') {
9
10
  const injections = [];
10
11
  const files = renderDeclarations({
11
12
  context,
12
13
  files: entries,
13
14
  modules,
15
+ grouping,
14
16
  specifierOf: (entry) => specifierOf(`${directory}/${entry}`),
15
17
  injectedIn: (roleFiles) => {
16
18
  const read = contextInjections(sources, { directory, entries: roleFiles, modules });
@@ -1 +1 @@
1
- {"version":3,"file":"context-declarations.js","sourceRoot":"","sources":["../../src/declared/context-declarations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAsB3D;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,OAAO,EACP,SAAS,EACT,OAAO,EACP,OAAO,EACP,OAAO,EACP,WAAW,GACK;IAChB,MAAM,UAAU,GAAqB,EAAE,CAAC;IAExC,MAAM,KAAK,GAAG,kBAAkB,CAAC;QAC/B,OAAO;QACP,KAAK,EAAE,OAAO;QACd,OAAO;QACP,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,SAAS,IAAI,KAAK,EAAE,CAAC;QAC5D,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE;YACxB,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;YAEpF,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;YAEzB,OAAO,gBAAgB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC/B,CAAC"}
1
+ {"version":3,"file":"context-declarations.js","sourceRoot":"","sources":["../../src/declared/context-declarations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAsB3D;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAmB,EAC/E,QAAQ,GAAyB,OAAO;IAExC,MAAM,UAAU,GAAqB,EAAE,CAAC;IAExC,MAAM,KAAK,GAAG,kBAAkB,CAAC;QAC/B,OAAO;QACP,KAAK,EAAE,OAAO;QACd,OAAO;QACP,QAAQ;QACR,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,SAAS,IAAI,KAAK,EAAE,CAAC;QAC5D,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE;YACxB,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;YAEpF,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;YAEzB,OAAO,gBAAgB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC/B,CAAC"}
@@ -1,10 +1,15 @@
1
1
  /**
2
- * The role folder a role file of a context belongs to, both relative to the context: the folder
3
- * at `<layer>/<folder>/`, so that a file of a use case
4
- * (`application/commands/issue-invoice/issue-invoice.handler.ts`) or of a route
5
- * (`presentation/http/invoices/issue-invoice/issue-invoice.controller.ts`) rolls up to
6
- * `application/commands` or `presentation/http`; a file sitting directly in its layer
7
- * (`infrastructure/tax-rates.gateway.ts`) belongs to the layer itself.
2
+ * How the declarations of a context are grouped: one file per layer, as the generator writes them,
3
+ * or one per role folder, as 0.85 and 0.86 wrote them (`keepsRoleFolderFiles` alone reads that one).
8
4
  */
9
- export declare function declarationsFolderOf(inModule: string, modules: readonly string[]): string;
5
+ export type DeclarationsGrouping = 'layer' | 'role-folder';
6
+ /**
7
+ * The folder whose generated declarations hold a role file of a context, both relative to the
8
+ * context: its layer, in the module of the model that holds it
9
+ * (`application/commands/issue-invoice/issue-invoice.handler.ts` and
10
+ * `presentation/http/invoices/issue-invoice/issue-invoice.controller.ts` go to `application` and
11
+ * `presentation`). Grouped by role folder, it is the folder at `<layer>/<folder>/`, and a file
12
+ * sitting directly in its layer (`infrastructure/tax-rates.gateway.ts`) goes to the layer itself.
13
+ */
14
+ export declare function declarationsFolderOf(inModule: string, modules: readonly string[], grouping?: DeclarationsGrouping): string;
10
15
  //# sourceMappingURL=declarations-folder-of.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"declarations-folder-of.d.ts","sourceRoot":"","sources":["../../src/declared/declarations-folder-of.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAKzF"}
1
+ {"version":3,"file":"declarations-folder-of.d.ts","sourceRoot":"","sources":["../../src/declared/declarations-folder-of.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,aAAa,CAAC;AAE3D;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,QAAQ,GAAE,oBAA8B,GACvC,MAAM,CASR"}
@@ -1,15 +1,19 @@
1
- import { intoModule, moduleSplit } from '../model-modules/index.js';
1
+ import { moduleSplit } from '../model-modules/index.js';
2
2
  /**
3
- * The role folder a role file of a context belongs to, both relative to the context: the folder
4
- * at `<layer>/<folder>/`, so that a file of a use case
5
- * (`application/commands/issue-invoice/issue-invoice.handler.ts`) or of a route
6
- * (`presentation/http/invoices/issue-invoice/issue-invoice.controller.ts`) rolls up to
7
- * `application/commands` or `presentation/http`; a file sitting directly in its layer
8
- * (`infrastructure/tax-rates.gateway.ts`) belongs to the layer itself.
3
+ * The folder whose generated declarations hold a role file of a context, both relative to the
4
+ * context: its layer, in the module of the model that holds it
5
+ * (`application/commands/issue-invoice/issue-invoice.handler.ts` and
6
+ * `presentation/http/invoices/issue-invoice/issue-invoice.controller.ts` go to `application` and
7
+ * `presentation`). Grouped by role folder, it is the folder at `<layer>/<folder>/`, and a file
8
+ * sitting directly in its layer (`infrastructure/tax-rates.gateway.ts`) goes to the layer itself.
9
9
  */
10
- export function declarationsFolderOf(inModule, modules) {
11
- const { module, path: file } = moduleSplit(inModule, modules);
12
- const [layer = '', folder, ...rest] = file.split('/');
13
- return intoModule(module, folder === undefined || rest.length === 0 ? layer : `${layer}/${folder}`);
10
+ export function declarationsFolderOf(inModule, modules, grouping = 'layer') {
11
+ const parts = moduleSplit(inModule, modules).path.split('/');
12
+ const kept = grouping === 'role-folder' && parts.length > 2 ? 2 : 1;
13
+ // The part of the path below the folder is the same in a module and outside one.
14
+ return inModule
15
+ .split('/')
16
+ .slice(0, kept - parts.length)
17
+ .join('/');
14
18
  }
15
19
  //# sourceMappingURL=declarations-folder-of.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"declarations-folder-of.js","sourceRoot":"","sources":["../../src/declared/declarations-folder-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAgB,EAAE,OAA0B;IAC/E,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9D,MAAM,CAAC,KAAK,GAAG,EAAE,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEtD,OAAO,UAAU,CAAC,MAAM,EAAE,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,MAAM,EAAE,CAAC,CAAC;AACtG,CAAC"}
1
+ {"version":3,"file":"declarations-folder-of.js","sourceRoot":"","sources":["../../src/declared/declarations-folder-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAQ/C;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAgB,EAChB,OAA0B,EAC1B,QAAQ,GAAyB,OAAO;IAExC,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,QAAQ,KAAK,aAAa,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpE,iFAAiF;IACjF,OAAO,QAAQ;SACZ,KAAK,CAAC,GAAG,CAAC;SACV,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC;SAC7B,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,10 @@
1
+ /** A layout of the declarations an earlier version of the generator wrote, accepted while it is current. */
2
+ export type EarlierLayout = 'single-file' | 'role-folders';
3
+ /** What a finding, a note or a warning says of a context that keeps an earlier layout. */
4
+ export interface EarlierLayoutNotice {
5
+ readonly message: string;
6
+ readonly fix: string;
7
+ }
8
+ /** What `check`, `docs --check` and `generate --local-only` say of a context that keeps an earlier layout (`earlierLayoutOf`). */
9
+ export declare function earlierLayoutNotice(context: string, layout: EarlierLayout): EarlierLayoutNotice;
10
+ //# sourceMappingURL=earlier-layout-notice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"earlier-layout-notice.d.ts","sourceRoot":"","sources":["../../src/declared/earlier-layout-notice.ts"],"names":[],"mappings":"AAEA,4GAA4G;AAC5G,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,cAAc,CAAC;AAE3D,0FAA0F;AAC1F,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,kIAAkI;AAClI,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,mBAAmB,CAU/F"}
@@ -0,0 +1,12 @@
1
+ import { barrelFile } from './barrel-file.js';
2
+ /** What `check`, `docs --check` and `generate --local-only` say of a context that keeps an earlier layout (`earlierLayoutOf`). */
3
+ export function earlierLayoutNotice(context, layout) {
4
+ const kept = layout === 'single-file'
5
+ ? `still keeps all its declarations in ${barrelFile(context)}, the single file the generator wrote up to 0.84`
6
+ : 'still keeps its declarations in one file per role folder (application/commands/commands.declarations.ts), as the generator wrote them in 0.85 and 0.86';
7
+ return {
8
+ message: `"${context}" ${kept}: they are current, so this version accepts them, and a later minor version reports them as an error.`,
9
+ fix: `Run \`npx ddd-ts-kit docs\` (or any \`generate\`, or \`npm run dev\`), which writes the <layer>.declarations.ts of each layer${layout === 'role-folders' ? ', deletes those of the role folders' : ''} and rewrites ${barrelFile(context)} as their summary, and commit the result.`,
10
+ };
11
+ }
12
+ //# sourceMappingURL=earlier-layout-notice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"earlier-layout-notice.js","sourceRoot":"","sources":["../../src/declared/earlier-layout-notice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAW3C,kIAAkI;AAClI,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,MAAqB;IACxE,MAAM,IAAI,GACR,MAAM,KAAK,aAAa;QACtB,CAAC,CAAC,uCAAuC,UAAU,CAAC,OAAO,CAAC,kDAAkD;QAC9G,CAAC,CAAC,wJAAwJ,CAAC;IAE/J,OAAO;QACL,OAAO,EAAE,IAAI,OAAO,KAAK,IAAI,uGAAuG;QACpI,GAAG,EAAE,gIAAgI,MAAM,KAAK,cAAc,CAAC,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC,EAAE,iBAAiB,UAAU,CAAC,OAAO,CAAC,2CAA2C;KAC3R,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { DeclaredContext } from './context-declarations.js';
2
+ import type { EarlierLayout } from './earlier-layout-notice.js';
3
+ /**
4
+ * The earlier layout a context keeps its declarations in, current for its tree of today, or
5
+ * undefined when it keeps none: the single file of 0.84 (`keepsSingleFile`) or the files of its
6
+ * role folders of 0.85 and 0.86 (`keepsRoleFolderFiles`). `read` gives the text of a file
7
+ * relative to the context.
8
+ */
9
+ export declare function earlierLayoutOf(declared: DeclaredContext, read: (entry: string) => string | undefined): EarlierLayout | undefined;
10
+ //# sourceMappingURL=earlier-layout-of.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"earlier-layout-of.d.ts","sourceRoot":"","sources":["../../src/declared/earlier-layout-of.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI7D;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAC1C,aAAa,GAAG,SAAS,CAM3B"}
@@ -0,0 +1,16 @@
1
+ import { barrelFile } from './barrel-file.js';
2
+ import { keepsRoleFolderFiles } from './keeps-role-folder-files.js';
3
+ import { keepsSingleFile } from './keeps-single-file.js';
4
+ /**
5
+ * The earlier layout a context keeps its declarations in, current for its tree of today, or
6
+ * undefined when it keeps none: the single file of 0.84 (`keepsSingleFile`) or the files of its
7
+ * role folders of 0.85 and 0.86 (`keepsRoleFolderFiles`). `read` gives the text of a file
8
+ * relative to the context.
9
+ */
10
+ export function earlierLayoutOf(declared, read) {
11
+ if (keepsSingleFile(declared, read(barrelFile(declared.context)))) {
12
+ return 'single-file';
13
+ }
14
+ return keepsRoleFolderFiles(declared, read) ? 'role-folders' : undefined;
15
+ }
16
+ //# sourceMappingURL=earlier-layout-of.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"earlier-layout-of.js","sourceRoot":"","sources":["../../src/declared/earlier-layout-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAyB,EACzB,IAA2C;IAE3C,IAAI,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,OAAO,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type DeclaredContext } from './context-declarations.js';
2
+ import type { EarlierLayout } from './earlier-layout-notice.js';
3
+ /**
4
+ * The earlier layout a context is laid out in, current or not: what `docs --check` and
5
+ * `generate --local-only` keep it in, so that a role file written there is declared as that
6
+ * version would declare it and nothing else moves. The single file of 0.84 when
7
+ * `<context>.declarations.ts` is the only declarations file and exports role files itself; the
8
+ * files of the role folders of 0.85 and 0.86 when one of them is there and no declarations file
9
+ * of a layer that grouping would not write. `read` gives the text of a file relative to the
10
+ * context. A context half moved, or written the same in both layouts, keeps none.
11
+ */
12
+ export declare function earlierShapeOf(declared: DeclaredContext, read: (entry: string) => string | undefined): EarlierLayout | undefined;
13
+ //# sourceMappingURL=earlier-shape-of.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"earlier-shape-of.d.ts","sourceRoot":"","sources":["../../src/declared/earlier-shape-of.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAM7D;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAC1C,aAAa,GAAG,SAAS,CAgB3B"}
@@ -0,0 +1,35 @@
1
+ import { moduleSplit } from '../model-modules/index.js';
2
+ import { barrelFile } from './barrel-file.js';
3
+ import { contextDeclarations } from './context-declarations.js';
4
+ import { isDeclarationsFile } from './is-declarations-file.js';
5
+ import { sameFiles } from './same-files.js';
6
+ const EXPORT = /^export \* from '([^']+)';$/;
7
+ /**
8
+ * The earlier layout a context is laid out in, current or not: what `docs --check` and
9
+ * `generate --local-only` keep it in, so that a role file written there is declared as that
10
+ * version would declare it and nothing else moves. The single file of 0.84 when
11
+ * `<context>.declarations.ts` is the only declarations file and exports role files itself; the
12
+ * files of the role folders of 0.85 and 0.86 when one of them is there and no declarations file
13
+ * of a layer that grouping would not write. `read` gives the text of a file relative to the
14
+ * context. A context half moved, or written the same in both layouts, keeps none.
15
+ */
16
+ export function earlierShapeOf(declared, read) {
17
+ const { context, entries, modules } = declared;
18
+ const generated = entries.filter((entry) => isDeclarationsFile(context, entry, modules));
19
+ if (generated.length === 1 && generated[0] === barrelFile(context)) {
20
+ return exportsRoleFiles(read(barrelFile(context)) ?? '') ? 'single-file' : undefined;
21
+ }
22
+ const byRoleFolder = contextDeclarations(declared, 'role-folder').files;
23
+ const byLayer = contextDeclarations(declared).files;
24
+ const inRoleFolder = (entry) => moduleSplit(entry, modules).path.split('/').length === 3;
25
+ const laidOut = generated.some(inRoleFolder) && generated.every((entry) => byRoleFolder.has(entry) || !byLayer.has(entry));
26
+ return laidOut && !sameFiles(byRoleFolder, byLayer) ? 'role-folders' : undefined;
27
+ }
28
+ /** True when a summary exports a role file, not only the declarations of its layers. */
29
+ function exportsRoleFiles(summary) {
30
+ return summary.split('\n').some((line) => {
31
+ const specifier = EXPORT.exec(line)?.[1];
32
+ return specifier !== undefined && !/\.declarations(\.js)?$/.test(specifier);
33
+ });
34
+ }
35
+ //# sourceMappingURL=earlier-shape-of.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"earlier-shape-of.js","sourceRoot":"","sources":["../../src/declared/earlier-shape-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAwB,MAAM,wBAAwB,CAAC;AAEnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,MAAM,GAAG,6BAA6B,CAAC;AAE7C;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,QAAyB,EACzB,IAA2C;IAE3C,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;IAC/C,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAEzF,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACnE,OAAO,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC;IACvF,CAAC;IAED,MAAM,YAAY,GAAG,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,KAAK,CAAC;IACxE,MAAM,OAAO,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC;IACpD,MAAM,YAAY,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IAE1G,MAAM,OAAO,GACX,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAE7G,OAAO,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC;AACnF,CAAC;AAED,wFAAwF;AACxF,SAAS,gBAAgB,CAAC,OAAe;IACvC,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACvC,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAEzC,OAAO,SAAS,KAAK,SAAS,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,7 +1,9 @@
1
1
  /**
2
- * The generated declarations of a role folder (`declarationsFolderOf`), relative to the context:
3
- * the file named after the folder, inside it, `application/commands/commands.declarations.ts`. It
4
- * exports the role files of the folder and registers what their constructors are injected.
2
+ * The generated declarations of a folder (`declarationsFolderOf`), relative to the context: the
3
+ * file inside it named after the layer, `application/application.declarations.ts`, the same in a
4
+ * module of the model, or, grouped by role folder as 0.85 and 0.86 wrote them, named after the
5
+ * folder, `application/commands/commands.declarations.ts`. It exports the role files of the folder
6
+ * and registers what their constructors are injected. `layer` is the layer of the folder.
5
7
  */
6
- export declare function folderDeclarationsFile(folder: string): string;
8
+ export declare function folderDeclarationsFile(folder: string, layer?: string): string;
7
9
  //# sourceMappingURL=folder-declarations-file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"folder-declarations-file.d.ts","sourceRoot":"","sources":["../../src/declared/folder-declarations-file.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7D"}
1
+ {"version":3,"file":"folder-declarations-file.d.ts","sourceRoot":"","sources":["../../src/declared/folder-declarations-file.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAE7E"}
@@ -1,10 +1,12 @@
1
1
  import path from 'node:path';
2
2
  /**
3
- * The generated declarations of a role folder (`declarationsFolderOf`), relative to the context:
4
- * the file named after the folder, inside it, `application/commands/commands.declarations.ts`. It
5
- * exports the role files of the folder and registers what their constructors are injected.
3
+ * The generated declarations of a folder (`declarationsFolderOf`), relative to the context: the
4
+ * file inside it named after the layer, `application/application.declarations.ts`, the same in a
5
+ * module of the model, or, grouped by role folder as 0.85 and 0.86 wrote them, named after the
6
+ * folder, `application/commands/commands.declarations.ts`. It exports the role files of the folder
7
+ * and registers what their constructors are injected. `layer` is the layer of the folder.
6
8
  */
7
- export function folderDeclarationsFile(folder) {
8
- return `${folder}/${path.posix.basename(folder)}.declarations.ts`;
9
+ export function folderDeclarationsFile(folder, layer) {
10
+ return `${folder}/${layer ?? path.posix.basename(folder)}.declarations.ts`;
9
11
  }
10
12
  //# sourceMappingURL=folder-declarations-file.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"folder-declarations-file.js","sourceRoot":"","sources":["../../src/declared/folder-declarations-file.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAc;IACnD,OAAO,GAAG,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,kBAAkB,CAAC;AACpE,CAAC"}
1
+ {"version":3,"file":"folder-declarations-file.js","sourceRoot":"","sources":["../../src/declared/folder-declarations-file.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAc,EAAE,KAAc;IACnE,OAAO,GAAG,MAAM,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,kBAAkB,CAAC;AAC7E,CAAC"}
@@ -13,8 +13,9 @@ export type { Sources } from './injection/sources.js';
13
13
  export { isDeclarationsFile } from './is-declarations-file.js';
14
14
  export { renderDeclarations } from './render-declarations.js';
15
15
  export { renderDependenciesFile } from './render-dependencies-file.js';
16
- export { keepsSingleFile } from './keeps-single-file.js';
17
16
  export { singleFileDeclarations } from './single-file-declarations.js';
18
- export { singleFileNotice } from './single-file-notice.js';
17
+ export { earlierLayoutNotice, type EarlierLayout } from './earlier-layout-notice.js';
18
+ export { earlierLayoutOf } from './earlier-layout-of.js';
19
+ export { earlierShapeOf } from './earlier-shape-of.js';
19
20
  export { routesFile } from './routes-file.js';
20
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/declared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACxG,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,gBAA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,MAAM,mBAAmB,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
@@ -11,8 +11,9 @@ export { renderInjections } from './injection/render-injections.js';
11
11
  export { isDeclarationsFile } from './is-declarations-file.js';
12
12
  export { renderDeclarations } from './render-declarations.js';
13
13
  export { renderDependenciesFile } from './render-dependencies-file.js';
14
- export { keepsSingleFile } from './keeps-single-file.js';
15
14
  export { singleFileDeclarations } from './single-file-declarations.js';
16
- export { singleFileNotice } from './single-file-notice.js';
15
+ export { earlierLayoutNotice } from './earlier-layout-notice.js';
16
+ export { earlierLayoutOf } from './earlier-layout-of.js';
17
+ export { earlierShapeOf } from './earlier-shape-of.js';
17
18
  export { routesFile } from './routes-file.js';
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/declared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,E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BAAqB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAsB,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * True for a file the generator writes for a declared context assembled by barrel, given relative
3
- * to the context: the summary at its root, `<context>.declarations.ts`, or the declarations of a
4
- * role folder, `<layer>/<folder>/<folder>.declarations.ts` or `<layer>/<layer>.declarations.ts`.
3
+ * to the context: the summary at its root, `<context>.declarations.ts`, the declarations of a
4
+ * layer, `<layer>/<layer>.declarations.ts`, or those of a role folder that 0.85 and 0.86 wrote,
5
+ * `<layer>/<folder>/<folder>.declarations.ts`, which the next refresh deletes.
5
6
  */
6
7
  export declare function isDeclarationsFile(context: string, file: string, modules: readonly string[]): boolean;
7
8
  //# sourceMappingURL=is-declarations-file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-declarations-file.d.ts","sourceRoot":"","sources":["../../src/declared/is-declarations-file.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAYrG"}
1
+ {"version":3,"file":"is-declarations-file.d.ts","sourceRoot":"","sources":["../../src/declared/is-declarations-file.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAcrG"}
@@ -1,23 +1,23 @@
1
- import path from 'node:path';
2
1
  import { barrelFile } from './barrel-file.js';
3
2
  import { DECLARED_ROLES } from './declared-role.js';
4
- import { folderDeclarationsFile } from './folder-declarations-file.js';
5
3
  import { moduleSplit } from '../model-modules/index.js';
6
4
  /** The layers role files live in: `application`, `infrastructure`, `presentation`. */
7
5
  const ROLE_LAYERS = new Set(DECLARED_ROLES.flatMap((role) => role.folders.map((folder) => folder.split('/')[0])));
8
6
  /**
9
7
  * True for a file the generator writes for a declared context assembled by barrel, given relative
10
- * to the context: the summary at its root, `<context>.declarations.ts`, or the declarations of a
11
- * role folder, `<layer>/<folder>/<folder>.declarations.ts` or `<layer>/<layer>.declarations.ts`.
8
+ * to the context: the summary at its root, `<context>.declarations.ts`, the declarations of a
9
+ * layer, `<layer>/<layer>.declarations.ts`, or those of a role folder that 0.85 and 0.86 wrote,
10
+ * `<layer>/<folder>/<folder>.declarations.ts`, which the next refresh deletes.
12
11
  */
13
12
  export function isDeclarationsFile(context, file, modules) {
14
13
  if (file === barrelFile(context)) {
15
14
  return true;
16
15
  }
17
- const folder = path.posix.dirname(file);
18
- const [layer = '', ...deeper] = moduleSplit(`${folder}/`, modules)
19
- .path.split('/')
20
- .filter((part) => part !== '');
21
- return ROLE_LAYERS.has(layer) && deeper.length <= 1 && file === folderDeclarationsFile(folder);
16
+ const [layer = '', ...below] = moduleSplit(file, modules).path.split('/');
17
+ const [folder = '', name] = below;
18
+ return (ROLE_LAYERS.has(layer) &&
19
+ (name === undefined
20
+ ? folder === `${layer}.declarations.ts`
21
+ : below.length === 2 && name === `${folder}.declarations.ts`));
22
22
  }
23
23
  //# sourceMappingURL=is-declarations-file.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-declarations-file.js","sourceRoot":"","sources":["../../src/declared/is-declarations-file.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,sFAAsF;AACtF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAElH;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,IAAY,EAAE,OAA0B;IAC1F,IAAI,IAAI,KAAK,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC,MAAM,CAAC,KAAK,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC,GAAG,WAAW,CAAC,GAAG,MAAM,GAAG,EAAE,OAAO,CAAC;SAC/D,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;SACf,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;IAEjC,OAAO,WAAW,CAAC,GAAG,CAAC,KAA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;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type DeclaredContext } from './context-declarations.js';
2
+ /**
3
+ * True while a context keeps its declarations in one file per role folder, as the generator wrote
4
+ * them in 0.85 and 0.86 (`application/commands/commands.declarations.ts`): every generated file of
5
+ * the context is exactly what that generator would write for the role files and constructors of
6
+ * today, and none other is there. `read` gives the text of a file relative to the context. A
7
+ * context whose role files all sit directly in their layer is written the same in both layouts:
8
+ * it keeps none. This version accepts it with a warning (`earlierLayoutNotice`), so that
9
+ * upgrading the kit fails no gate; a later minor version refuses it.
10
+ */
11
+ export declare function keepsRoleFolderFiles(declared: DeclaredContext, read: (entry: string) => string | undefined): boolean;
12
+ //# sourceMappingURL=keeps-role-folder-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keeps-role-folder-files.d.ts","sourceRoot":"","sources":["../../src/declared/keeps-role-folder-files.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAOnF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAAG,OAAO,CAYpH"}
@@ -0,0 +1,25 @@
1
+ import { barrelFile } from './barrel-file.js';
2
+ import { contextDeclarations } from './context-declarations.js';
3
+ import { isDeclarationsFile } from './is-declarations-file.js';
4
+ import { sameFiles } from './same-files.js';
5
+ /** What every layout writes for a context that declares no role file: such a context is current either way. */
6
+ const NOTHING_DECLARED = 'export {};\n';
7
+ /**
8
+ * True while a context keeps its declarations in one file per role folder, as the generator wrote
9
+ * them in 0.85 and 0.86 (`application/commands/commands.declarations.ts`): every generated file of
10
+ * the context is exactly what that generator would write for the role files and constructors of
11
+ * today, and none other is there. `read` gives the text of a file relative to the context. A
12
+ * context whose role files all sit directly in their layer is written the same in both layouts:
13
+ * it keeps none. This version accepts it with a warning (`earlierLayoutNotice`), so that
14
+ * upgrading the kit fails no gate; a later minor version refuses it.
15
+ */
16
+ export function keepsRoleFolderFiles(declared, read) {
17
+ const { context, entries, modules } = declared;
18
+ const { files } = contextDeclarations(declared, 'role-folder');
19
+ if (files.get(barrelFile(context)) === NOTHING_DECLARED || sameFiles(files, contextDeclarations(declared).files)) {
20
+ return false;
21
+ }
22
+ return (entries.every((entry) => !isDeclarationsFile(context, entry, modules) || files.has(entry)) &&
23
+ [...files].every(([entry, expected]) => read(entry)?.replaceAll('\r\n', '\n') === expected));
24
+ }
25
+ //# sourceMappingURL=keeps-role-folder-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keeps-role-folder-files.js","sourceRoot":"","sources":["../../src/declared/keeps-role-folder-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAwB,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,+GAA+G;AAC/G,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAyB,EAAE,IAA2C;IACzG,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;IAC/C,MAAM,EAAE,KAAK,EAAE,GAAG,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAE/D,IAAI,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,gBAAgB,IAAI,SAAS,CAAC,KAAK,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACjH,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC1F,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,QAAQ,CAAC,CAC5F,CAAC;AACJ,CAAC"}
@@ -3,7 +3,7 @@ import type { DeclaredContext } from './context-declarations.js';
3
3
  * True while a context keeps its declarations in the single file the generator wrote up to 0.84:
4
4
  * no role folder holds a declarations file yet, and `<context>.declarations.ts` (`written`) is
5
5
  * exactly what that generator would write for the role files and constructors of today. This
6
- * version accepts it with a warning (`singleFileNotice`), so that upgrading the kit fails no gate;
6
+ * version accepts it with a warning (`earlierLayoutNotice`), so that upgrading the kit fails no gate;
7
7
  * a later minor version refuses it. A single file that is itself stale, or a context half moved,
8
8
  * is not this case.
9
9
  */
@@ -7,7 +7,7 @@ const NOTHING_DECLARED = 'export {};\n';
7
7
  * True while a context keeps its declarations in the single file the generator wrote up to 0.84:
8
8
  * no role folder holds a declarations file yet, and `<context>.declarations.ts` (`written`) is
9
9
  * exactly what that generator would write for the role files and constructors of today. This
10
- * version accepts it with a warning (`singleFileNotice`), so that upgrading the kit fails no gate;
10
+ * version accepts it with a warning (`earlierLayoutNotice`), so that upgrading the kit fails no gate;
11
11
  * a later minor version refuses it. A single file that is itself stale, or a context half moved,
12
12
  * is not this case.
13
13
  */
@@ -1,3 +1,4 @@
1
+ import { type DeclarationsGrouping } from './declarations-folder-of.js';
1
2
  import type { RenderedInjections } from './injection/rendered-injections.js';
2
3
  /** What the declarations of a context are rendered from; every file is relative to the context. */
3
4
  export interface DeclarationsSource {
@@ -5,16 +6,19 @@ export interface DeclarationsSource {
5
6
  readonly files: readonly string[];
6
7
  /** The modules of the model the context declares. */
7
8
  readonly modules: readonly string[];
9
+ /** One declarations file per layer, the default, or per role folder. */
10
+ readonly grouping?: DeclarationsGrouping;
8
11
  /** How a generated import names a file of the context: its alias, ending as the project writes its imports. */
9
12
  readonly specifierOf: (file: string) => string;
10
- /** The registrations of what the classes of these role files are given, all of one folder. */
13
+ /** The registrations of what the classes of these role files are given, all of one declarations file. */
11
14
  readonly injectedIn: (roleFiles: readonly string[]) => RenderedInjections;
12
15
  }
13
16
  /**
14
17
  * Every generated declarations file of a context assembled by barrel, by path relative to the
15
- * context: one per role folder that holds a role file (`folderDeclarationsFile`), then the summary
18
+ * context: one per layer that holds a role file, in each module of the model
19
+ * (`folderDeclarationsFile`), then the summary
16
20
  * at the root, `<context>.declarations.ts`, which only re-exports them, sorted by path. Nested
17
21
  * `export *` flatten: the namespace the composition root imports holds every declared class.
18
22
  */
19
- export declare function renderDeclarations({ context, files, modules, specifierOf, injectedIn, }: DeclarationsSource): Map<string, string>;
23
+ export declare function renderDeclarations({ context, files, modules, grouping, specifierOf, injectedIn, }: DeclarationsSource): Map<string, string>;
20
24
  //# sourceMappingURL=render-declarations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-declarations.d.ts","sourceRoot":"","sources":["../../src/declared/render-declarations.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAG1E,mGAAmG;AACnG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,+GAA+G;IAC/G,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C,8FAA8F;IAC9F,QAAQ,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,KAAK,kBAAkB,CAAC;CAC3E;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,KAAK,EACL,OAAO,EACP,WAAW,EACX,UAAU,GACX,EAAE,kBAAkB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAmB1C"}
1
+ {"version":3,"file":"render-declarations.d.ts","sourceRoot":"","sources":["../../src/declared/render-declarations.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,oBAAoB,EAAwB,MAAM,0BAA0B,CAAC;AAE3F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAG1E,mGAAmG;AACnG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IACzC,+GAA+G;IAC/G,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C,yGAAyG;IACzG,QAAQ,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,KAAK,kBAAkB,CAAC;CAC3E;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,KAAK,EACL,OAAO,EACP,QAAkB,EAClB,WAAW,EACX,UAAU,GACX,EAAE,kBAAkB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAsB1C"}
@@ -1,3 +1,4 @@
1
+ import { moduleSplit } from '../model-modules/index.js';
1
2
  import { barrelFile } from './barrel-file.js';
2
3
  import { declaredRoleOf } from './declared-role-of.js';
3
4
  import { declarationsFolderOf } from './declarations-folder-of.js';
@@ -5,15 +6,16 @@ import { folderDeclarationsFile } from './folder-declarations-file.js';
5
6
  import { renderFolderDeclarations } from './render-folder-declarations.js';
6
7
  /**
7
8
  * Every generated declarations file of a context assembled by barrel, by path relative to the
8
- * context: one per role folder that holds a role file (`folderDeclarationsFile`), then the summary
9
+ * context: one per layer that holds a role file, in each module of the model
10
+ * (`folderDeclarationsFile`), then the summary
9
11
  * at the root, `<context>.declarations.ts`, which only re-exports them, sorted by path. Nested
10
12
  * `export *` flatten: the namespace the composition root imports holds every declared class.
11
13
  */
12
- export function renderDeclarations({ context, files, modules, specifierOf, injectedIn, }) {
14
+ export function renderDeclarations({ context, files, modules, grouping = 'layer', specifierOf, injectedIn, }) {
13
15
  const byFolder = new Map();
14
16
  const roleFiles = [...new Set(files)].filter((candidate) => declaredRoleOf(candidate, modules) !== undefined);
15
17
  for (const file of roleFiles.sort()) {
16
- const folder = folderDeclarationsFile(declarationsFolderOf(file, modules));
18
+ const folder = folderDeclarationsFile(declarationsFolderOf(file, modules, grouping), grouping === 'layer' ? moduleSplit(file, modules).path.split('/')[0] : undefined);
17
19
  byFolder.set(folder, [...(byFolder.get(folder) ?? []), file]);
18
20
  }
19
21
  const rendered = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"render-declarations.js","sourceRoot":"","sources":["../../src/declared/render-declarations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAcxE;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,OAAO,EACP,KAAK,EACL,OAAO,EACP,WAAW,EACX,UAAU,GACS;IACnB,MAAM,QAAQ,GAAG,IAAI,GAAG,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C,IAAI,EAAE,EAAE,CAAC,kBAAkB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9F,CAAC;AAED,SAAS,MAAM,CAAC,IAAY,EAAE,KAAa;IACzC,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { RenderedInjections } from './injection/rendered-injections.js';
2
2
  /**
3
- * The declarations of one role folder: the imports the registrations need, one `export *` per
4
- * role file of the folder, named by the specifier `specifierOf` gives it and sorted by path, then
3
+ * The declarations of one folder, a layer or a role folder: the imports the registrations need,
4
+ * one `export *` per role file of the folder, named by the specifier `specifierOf` gives it and sorted by path, then
5
5
  * one `injected(Class, [Tokens])` per class of the folder whose constructor takes something its
6
6
  * decorator does not list, read from the constructor signatures. `files` are relative to the
7
7
  * context, `modules` are the modules of the model it declares. It is derived from the tree, never edited by hand: `ddd-ts-kit check` reports a file
@@ -0,0 +1,3 @@
1
+ /** True when two sets of generated files hold the same paths with the same text. */
2
+ export declare function sameFiles(left: ReadonlyMap<string, string>, right: ReadonlyMap<string, string>): boolean;
3
+ //# sourceMappingURL=same-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"same-files.d.ts","sourceRoot":"","sources":["../../src/declared/same-files.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAExG"}
@@ -0,0 +1,5 @@
1
+ /** True when two sets of generated files hold the same paths with the same text. */
2
+ export function sameFiles(left, right) {
3
+ return left.size === right.size && [...left].every(([file, content]) => right.get(file) === content);
4
+ }
5
+ //# sourceMappingURL=same-files.js.map