ddd-ts-kit 0.113.0 → 0.113.1

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 (80) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/help/work-notes.d.ts.map +1 -1
  3. package/dist/help/work-notes.js +5 -2
  4. package/dist/help/work-notes.js.map +1 -1
  5. package/dist/init/manifest/versions.js +25 -25
  6. package/dist/markers/merge-imports.d.ts.map +1 -1
  7. package/dist/markers/merge-imports.js +2 -22
  8. package/dist/markers/merge-imports.js.map +1 -1
  9. package/dist/markers/one-line-imports.d.ts +3 -0
  10. package/dist/markers/one-line-imports.d.ts.map +1 -0
  11. package/dist/markers/one-line-imports.js +22 -0
  12. package/dist/markers/one-line-imports.js.map +1 -0
  13. package/dist/merge/declarations/brackets-left-open.d.ts +7 -0
  14. package/dist/merge/declarations/brackets-left-open.d.ts.map +1 -0
  15. package/dist/merge/declarations/brackets-left-open.js +21 -0
  16. package/dist/merge/declarations/brackets-left-open.js.map +1 -0
  17. package/dist/merge/declarations/declaration.d.ts +15 -0
  18. package/dist/merge/declarations/declaration.d.ts.map +1 -0
  19. package/dist/merge/declarations/declaration.js +2 -0
  20. package/dist/merge/declarations/declaration.js.map +1 -0
  21. package/dist/merge/declarations/declarations-of.d.ts +11 -0
  22. package/dist/merge/declarations/declarations-of.d.ts.map +1 -0
  23. package/dist/merge/declarations/declarations-of.js +130 -0
  24. package/dist/merge/declarations/declarations-of.js.map +1 -0
  25. package/dist/merge/declarations/declared-lines.d.ts +14 -0
  26. package/dist/merge/declarations/declared-lines.d.ts.map +1 -0
  27. package/dist/merge/declarations/declared-lines.js +42 -0
  28. package/dist/merge/declarations/declared-lines.js.map +1 -0
  29. package/dist/merge/declarations/declared-side.d.ts +8 -0
  30. package/dist/merge/declarations/declared-side.d.ts.map +1 -0
  31. package/dist/merge/declarations/declared-side.js +2 -0
  32. package/dist/merge/declarations/declared-side.js.map +1 -0
  33. package/dist/merge/declarations/holds-every-line.d.ts +3 -0
  34. package/dist/merge/declarations/holds-every-line.d.ts.map +1 -0
  35. package/dist/merge/declarations/holds-every-line.js +10 -0
  36. package/dist/merge/declarations/holds-every-line.js.map +1 -0
  37. package/dist/merge/declarations/merge-declarations.d.ts +44 -0
  38. package/dist/merge/declarations/merge-declarations.d.ts.map +1 -0
  39. package/dist/merge/declarations/merge-declarations.js +101 -0
  40. package/dist/merge/declarations/merge-declarations.js.map +1 -0
  41. package/dist/merge/declarations/merged-imports.d.ts +9 -0
  42. package/dist/merge/declarations/merged-imports.d.ts.map +1 -0
  43. package/dist/merge/declarations/merged-imports.js +25 -0
  44. package/dist/merge/declarations/merged-imports.js.map +1 -0
  45. package/dist/merge/declarations/merged-lines.d.ts +16 -0
  46. package/dist/merge/declarations/merged-lines.d.ts.map +1 -0
  47. package/dist/merge/declarations/merged-lines.js +43 -0
  48. package/dist/merge/declarations/merged-lines.js.map +1 -0
  49. package/dist/merge/declarations/merged-region.d.ts +32 -0
  50. package/dist/merge/declarations/merged-region.d.ts.map +1 -0
  51. package/dist/merge/declarations/merged-region.js +84 -0
  52. package/dist/merge/declarations/merged-region.js.map +1 -0
  53. package/dist/merge/declarations/reads-as-merged.d.ts +9 -0
  54. package/dist/merge/declarations/reads-as-merged.d.ts.map +1 -0
  55. package/dist/merge/declarations/reads-as-merged.js +19 -0
  56. package/dist/merge/declarations/reads-as-merged.js.map +1 -0
  57. package/dist/merge/declarations/settle-declarations.d.ts +21 -0
  58. package/dist/merge/declarations/settle-declarations.d.ts.map +1 -0
  59. package/dist/merge/declarations/settle-declarations.js +88 -0
  60. package/dist/merge/declarations/settle-declarations.js.map +1 -0
  61. package/dist/merge/declarations/shares-half-a-pair.d.ts +11 -0
  62. package/dist/merge/declarations/shares-half-a-pair.d.ts.map +1 -0
  63. package/dist/merge/declarations/shares-half-a-pair.js +41 -0
  64. package/dist/merge/declarations/shares-half-a-pair.js.map +1 -0
  65. package/dist/merge/declarations/shown-of.d.ts +5 -0
  66. package/dist/merge/declarations/shown-of.d.ts.map +1 -0
  67. package/dist/merge/declarations/shown-of.js +5 -0
  68. package/dist/merge/declarations/shown-of.js.map +1 -0
  69. package/dist/merge/for-you-entry.js +4 -1
  70. package/dist/merge/for-you-entry.js.map +1 -1
  71. package/dist/merge/resolution.d.ts +2 -0
  72. package/dist/merge/resolution.d.ts.map +1 -1
  73. package/dist/merge/resolve-conflict.d.ts +4 -2
  74. package/dist/merge/resolve-conflict.d.ts.map +1 -1
  75. package/dist/merge/resolve-conflict.js +60 -15
  76. package/dist/merge/resolve-conflict.js.map +1 -1
  77. package/dist/version.d.ts +1 -1
  78. package/dist/version.js +1 -1
  79. package/package.json +6 -6
  80. package/templates/pipeline/package-scripts.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ What each version changes for someone who uses the kit. The packages of `package
4
4
  together, under one version; the notes of each [GitHub release](https://github.com/gbourgeat/ddd-ts-kit/releases)
5
5
  list the pull requests behind it.
6
6
 
7
+ ## 0.113.1
8
+
9
+ **`ddd-ts-kit merge-trunk` keeps each table whole when both sides added one to the same context.** Two branches that each stored an aggregate in one context each add a table to its tables file, at the same place. git sets the two side by side and keeps the lines they share once, their last ones, and the merge then kept "the lines of both sides" of the conflict: the tables file it committed, exit 0, held two tables with the closing lines of one (`TS1005 '}' expected`), on the four ORM: the tables file of the context on Drizzle and on TypeORM, `create-<context>-tables.schema.ts` on Knex, `prisma/schema/<context>.prisma` on Prisma, the context flat or laid out in modules. The schema index was right, and still is.
10
+
11
+ The lines of both sides are still what a conflict inside a generated region keeps: the report says `generated registry: the lines of both sides kept` and the region is written as it was before this change, in every case but two. The first: the region those lines give does not pair its brackets, the case above. The second: in one conflict, two different statements that each hold a bracket open across several lines open on the same line or close on the same line (two `platform.commands.register(` written on several lines), a line the union keeps once; a chain written on several lines with no bracket across them is not seen; a statement both sides added alike does not count, it is kept once as before. In these two cases the region of a TypeScript, JavaScript or Prisma file is merged declaration by declaration instead, from the three sides of the file. The declaration each side added is kept whole; one both added alike is kept once; one a side changed or removed while the other left it as the base holds it follows that side; one both changed takes the merge of its lines, as git merges a file, when they merge without a conflict: a line one side removed stays removed. The declarations both sides hold stand in the order of the side that changed their order, ours when neither did, and what a side alone adds stands after the declaration it follows on that side, or first when it opened the region there. The report then says `generated registry: the declarations of both sides kept, each one whole`, in a dry run too, and `generated registry: the declarations of both sides kept, each one whole, and the lines of both sides kept` when another region of the file kept the lines of both sides.
12
+
13
+ What the kit does not merge this way is left to you. A declaration both sides wrote differently (two tables of one name with different columns, one of them with one more column included, a table both changed whose lines do not merge, a table one side changed and the other removed) is one hunk that holds each version whole, the rest of the region being merged, and the report names it when both sides hold it: ``the two sides do not agree on `invoices` in the region `tables`: for each, write the one declaration that keeps the intent of both, whole, or remove it.`` In the cases that follow nothing is written in the region, the hunks git wrote stay, those of a region written inside it too, and the report says why and what to write, each declaration of both sides whole, once, in most cases, where it said `both sides only add lines: keep both`: a bracket that does not pair, a regular expression, a region written inside it, two declarations of one name on one side, a side that does not hold the region once; a statement that declares no name (a call written on several lines) which a side changed or removed; lines that end no statement (entries of a list, or statements written without `;`) on which the two sides differ; two statements with no declared name that open alike, one holding every line of the other, which nothing tells from one statement written twice; declarations both sides set in two different orders; a default export on each side, written `export default` or `export { name as default }` on one line, a file having one (another spelling, `export { default } from`, a list on several lines, is not seen, and a line of that shape in a comment or a template literal counts); merged lines that would not read back as the declarations merged.
14
+
7
15
  ## 0.113.0
8
16
 
9
17
  **`ddd-ts-kit check` reports a read model store that the list of the read model tables does not answer for (`persistence/read-model-listed`).** The application checks the tables of its read models when it starts, and `npm run db:read-models` before a deployment, by the stores `src/platform/database/read-model-tables.ts` lists and no other: a store written by hand and never listed was checked by nothing, in silence. The new rule, an error, reads the stores of the tree and reports each one the list neither holds under its context (itself, a class that extends it, or the name a file gives it when it re-exports it, `export { A as B } from` or `export * from`, one level), nor names in `NOT_LISTED`, nor leaves out by a comment between the markers of the file that holds `<context>: <Store>`. Its fix gives the import and the entry to add, the entry alone when the list still imports the class, and for a store the list cannot build, what stands in the way. A store is a class of a context, tests aside, that is not abstract and extends `DrizzleReadModelStore`, `KnexReadModelStore`, `PrismaReadModelStore` or `TypeOrmReadModelStore`, directly or through classes of the project, wherever they are declared. It also reports an entry of the list whose class the file neither imports nor declares, whose import leads to no file, or whose class another context declares; a line of `NOT_LISTED` whose class is gone or whose store `LISTED` answers for; a `LISTED` whose entries it cannot read (spread, or built by a call); and, once, a project on one of the four ORM that holds stores and no list. It does not judge: an abstract class; a store in memory or in a search engine, and a class directly over `TableReadModelStore` of the kernel; a store of the tests; a class declared in a function or in a `namespace` block, and a class expression that has no name of its own (one that has is read under that name); a base that is not the name of the store of the kit or of a class of the project: a namespace (`kit.KnexReadModelStore`), an import alias, a call (`mixin(KnexReadModelStore)`); of two classes of one name in one context, which one an entry names; whether a class that extends a store reads the same table; the reason a comment gives; what a package exports (`ddd-ts-kit explain persistence/read-model-listed`, [docs/concepts/cqrs.md](docs/concepts/cqrs.md#every-table-checked-at-the-start-and-before-a-deployment)).
@@ -1 +1 @@
1
- {"version":3,"file":"work-notes.d.ts","sourceRoot":"","sources":["../../src/help/work-notes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC,yFAAyF;AACzF,eAAO,MAAM,UAAU,EAAE,SAAS,IAAI,EA6MrC,CAAC"}
1
+ {"version":3,"file":"work-notes.d.ts","sourceRoot":"","sources":["../../src/help/work-notes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC,yFAAyF;AACzF,eAAO,MAAM,UAAU,EAAE,SAAS,IAAI,EAgNrC,CAAC"}
@@ -188,8 +188,11 @@ export const WORK_NOTES = [
188
188
  'lines are on the trunk; else git merge-base). Settles derived files and drizzle-kit meta',
189
189
  '(trunk side), the package.json of a client (trunk side, at the higher of both versions;',
190
190
  'left to you when one is not a semantic version), generated regions of CONTEXT.md and the',
191
- 'context map (trunk side), conflicts inside generated registries (lines of both sides),',
192
- 'slices.md row by row (the furthest status), the stored-events lock by key, the lockfile',
191
+ 'context map (trunk side), conflicts inside generated registries (lines of both sides;',
192
+ 'where those lines would leave a declaration open, two tables added at one place, the',
193
+ 'region merged declaration by declaration, what is not read with certainty left to you as',
194
+ 'git wrote it), slices.md row by row (the furthest status), the stored-events lock by key,',
195
+ 'the lockfile',
193
196
  '(trunk side, installed again when the branch changed package.json); the rest is left in a',
194
197
  'merge in progress git understands, with what each side did (exit 1). Then, or on',
195
198
  '--continue: the drizzle migrations of both sides replayed, on --to-land the working',
@@ -1 +1 @@
1
- {"version":3,"file":"work-notes.js","sourceRoot":"","sources":["../../src/help/work-notes.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,MAAM,CAAC,MAAM,UAAU,GAAoB;IACzC;QACE,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,cAAc;QACvB,KAAK,EAAE;YACL,+FAA+F;YAC/F,8FAA8F;YAC9F,0FAA0F;YAC1F,0FAA0F;YAC1F,0FAA0F;YAC1F,6FAA6F;YAC7F,yFAAyF;YACzF,sFAAsF;YACtF,qEAAqE;SACtE;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,cAAc;QACvB,KAAK,EAAE;YACL,2FAA2F;YAC3F,kFAAkF;YAClF,uFAAuF;SACxF;KACF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,aAAa;QACtB,KAAK,EAAE;YACL,4FAA4F;YAC5F,qFAAqF;YACrF,0FAA0F;YAC1F,0FAA0F;YAC1F,wFAAwF;YACxF,wFAAwF;YACxF,uFAAuF;YACvF,qFAAqF;YACrF,wFAAwF;YACxF,sFAAsF;YACtF,WAAW;SACZ;KACF;IACD;QACE,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE;YACL,2FAA2F;YAC3F,yFAAyF;YACzF,sFAAs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EAAE;YACL,yFAAyF;YACzF,sFAAsF;YACtF,uFAAuF;YACvF,sFAAsF;YACtF,wFAAwF;YACxF,qFAAqF;YACrF,uFAAuF;YACvF,uFAAuF;YACvF,6DAA6D;SAC9D;KACF;IACD;QACE,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,cAAc;QACvB,KAAK,EAAE;YACL,wFAAwF;YACxF,0FAA0F;YAC1F,wFAAwF;YACxF,uFAAuF;YACvF,uFAAuF;YACvF,mFAAmF;YACnF,yFAAyF;YACzF,mFAAmF;YACnF,qFAAqF;YACrF,uFAAuF;YACvF,yFAAyF;YACzF,uFAAuF;YACvF,mFAAmF;YACnF,wFAAwF;YACxF,2FAA2F;YAC3F,uFAAuF;YACvF,4DAA4D;YAC5D,iFAAiF;YACjF,wFAAwF;YACxF,0FAA0F;YAC1F,2FAA2F;YAC3F,wFAAwF;YACxF,yEAAyE;SAC1E;KACF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,aAAa;QACtB,KAAK,EAAE;YACL,8FAA8F;YAC9F,4EAA4E;YAC5E,2FAA2F;YAC3F,kFAAkF;YAClF,4FAA4F;YAC5F,2FAA2F;YAC3F,0FAA0F;YAC1F,yFAAyF;YACzF,0FAA0F;YAC1F,wFAAwF;YACxF,yFAAyF;YACzF,2FAA2F;YAC3F,kFAAkF;YAClF,qFAAqF;YACrF,6FAA6F;YAC7F,yFAAyF;YACzF,4FAA4F;YAC5F,sFAAsF;YACtF,0FAA0F;YAC1F,oEAAoE;YACpE,4FAA4F;YAC5F,6FAA6F;YAC7F,4DAA4D;SAC7D;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"work-notes.js","sourceRoot":"","sources":["../../src/help/work-notes.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,MAAM,CAAC,MAAM,UAAU,GAAoB;IACzC;QACE,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,cAAc;QACvB,KAAK,EAAE;YACL,+FAA+F;YAC/F,8FAA8F;Y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FAA8F;YAC9F,4EAA4E;YAC5E,2FAA2F;YAC3F,kFAAkF;YAClF,4FAA4F;YAC5F,2FAA2F;YAC3F,0FAA0F;YAC1F,yFAAyF;YACzF,0FAA0F;YAC1F,uFAAuF;YACvF,sFAAsF;YACtF,0FAA0F;YAC1F,2FAA2F;YAC3F,cAAc;YACd,2FAA2F;YAC3F,kFAAkF;YAClF,qFAAqF;YACrF,6FAA6F;YAC7F,yFAAyF;YACzF,4FAA4F;YAC5F,sFAAsF;YACtF,0FAA0F;YAC1F,oEAAoE;YACpE,4FAA4F;YAC5F,6FAA6F;YAC7F,4DAA4D;SAC7D;KACF;CACF,CAAC"}
@@ -1,36 +1,36 @@
1
1
  /** Ranges written to the generated package.json; bumped together with the kit. */
2
2
  export const VERSIONS = {
3
- '@ddd-ts-kit/kernel': '^0.113.0',
4
- '@ddd-ts-kit/validation': '^0.113.0',
5
- '@ddd-ts-kit/http': '^0.113.0',
6
- '@ddd-ts-kit/tracing': '^0.113.0',
7
- '@ddd-ts-kit/di': '^0.113.0',
8
- '@ddd-ts-kit/events': '^0.113.0',
9
- '@ddd-ts-kit/testing': '^0.113.0',
10
- '@ddd-ts-kit/drizzle': '^0.113.0',
11
- '@ddd-ts-kit/knex': '^0.113.0',
12
- '@ddd-ts-kit/prisma': '^0.113.0',
13
- '@ddd-ts-kit/typeorm': '^0.113.0',
14
- '@ddd-ts-kit/auth': '^0.113.0',
15
- '@ddd-ts-kit/rabbitmq': '^0.113.0',
16
- '@ddd-ts-kit/aspects': '^0.113.0',
17
- '@ddd-ts-kit/audit': '^0.113.0',
18
- '@ddd-ts-kit/redis': '^0.113.0',
19
- '@ddd-ts-kit/kafka': '^0.113.0',
20
- '@ddd-ts-kit/nats': '^0.113.0',
21
- '@ddd-ts-kit/scheduling': '^0.113.0',
22
- '@ddd-ts-kit/sentry': '^0.113.0',
23
- '@ddd-ts-kit/s3': '^0.113.0',
24
- '@ddd-ts-kit/opensearch': '^0.113.0',
3
+ '@ddd-ts-kit/kernel': '^0.113.1',
4
+ '@ddd-ts-kit/validation': '^0.113.1',
5
+ '@ddd-ts-kit/http': '^0.113.1',
6
+ '@ddd-ts-kit/tracing': '^0.113.1',
7
+ '@ddd-ts-kit/di': '^0.113.1',
8
+ '@ddd-ts-kit/events': '^0.113.1',
9
+ '@ddd-ts-kit/testing': '^0.113.1',
10
+ '@ddd-ts-kit/drizzle': '^0.113.1',
11
+ '@ddd-ts-kit/knex': '^0.113.1',
12
+ '@ddd-ts-kit/prisma': '^0.113.1',
13
+ '@ddd-ts-kit/typeorm': '^0.113.1',
14
+ '@ddd-ts-kit/auth': '^0.113.1',
15
+ '@ddd-ts-kit/rabbitmq': '^0.113.1',
16
+ '@ddd-ts-kit/aspects': '^0.113.1',
17
+ '@ddd-ts-kit/audit': '^0.113.1',
18
+ '@ddd-ts-kit/redis': '^0.113.1',
19
+ '@ddd-ts-kit/kafka': '^0.113.1',
20
+ '@ddd-ts-kit/nats': '^0.113.1',
21
+ '@ddd-ts-kit/scheduling': '^0.113.1',
22
+ '@ddd-ts-kit/sentry': '^0.113.1',
23
+ '@ddd-ts-kit/s3': '^0.113.1',
24
+ '@ddd-ts-kit/opensearch': '^0.113.1',
25
25
  '@aws-sdk/client-s3': '^3.1150.0',
26
26
  '@aws-sdk/lib-storage': '^3.1150.0',
27
27
  '@aws-sdk/s3-request-presigner': '^3.1150.0',
28
28
  busboy: '^1.6.0',
29
29
  '@sentry/node': '^11.6.0',
30
- '@ddd-ts-kit/pino': '^0.113.0',
30
+ '@ddd-ts-kit/pino': '^0.113.1',
31
31
  pino: '^10.4.0',
32
32
  'pino-pretty': '^13.2.0',
33
- '@ddd-ts-kit/winston': '^0.113.0',
33
+ '@ddd-ts-kit/winston': '^0.113.1',
34
34
  winston: '^3.19.0',
35
35
  '@confluentinc/kafka-javascript': '^1.11.0',
36
36
  '@nats-io/jetstream': '^3.4.0',
@@ -41,7 +41,7 @@ export const VERSIONS = {
41
41
  'passport-jwt': '^4.0.1',
42
42
  '@types/passport-jwt': '^4.0.1',
43
43
  amqplib: '^2.2.0',
44
- 'ddd-ts-kit': '^0.113.0',
44
+ 'ddd-ts-kit': '^0.113.1',
45
45
  tsx: '^4.23.15',
46
46
  vitest: '^5.0.3',
47
47
  'fast-check': '^4.10.2',
@@ -1 +1 @@
1
- {"version":3,"file":"merge-imports.d.ts","sourceRoot":"","sources":["../../src/markers/merge-imports.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAqB5F"}
1
+ {"version":3,"file":"merge-imports.d.ts","sourceRoot":"","sources":["../../src/markers/merge-imports.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAqB5F"}
@@ -1,11 +1,12 @@
1
1
  import { LINE_WIDTH } from '../layout/index.js';
2
+ import { oneLineImports } from './one-line-imports.js';
2
3
  const NAMED_IMPORT = /^import (type )?\{ ([^}]+) \} from '([^']+)';$/;
3
4
  /**
4
5
  * Adds import lines to those already there; names imported from one module end up in one
5
6
  * statement, written one name per line once it no longer fits the line width.
6
7
  */
7
8
  export function mergeImports(present, wanted) {
8
- const merged = joined(present);
9
+ const merged = oneLineImports(present);
9
10
  for (const line of wanted.map((candidate) => candidate.trim())) {
10
11
  const added = NAMED_IMPORT.exec(line);
11
12
  const twin = added === null ? -1 : merged.findIndex((existing) => sameSource(NAMED_IMPORT.exec(existing), added));
@@ -20,27 +21,6 @@ export function mergeImports(present, wanted) {
20
21
  }
21
22
  return merged.flatMap(fitted);
22
23
  }
23
- /** Each import statement on one line, whatever the number of lines it was written on. */
24
- function joined(present) {
25
- const statements = [];
26
- let open;
27
- for (const line of present.map((candidate) => candidate.trim())) {
28
- if (open === undefined && /^import (?:type )?\{$/.test(line)) {
29
- open = [line];
30
- }
31
- else if (open === undefined) {
32
- statements.push(line);
33
- }
34
- else if (line.startsWith('}')) {
35
- statements.push(`${open[0] ?? ''} ${open.slice(1).join(' ').replace(/,$/, '')} ${line}`);
36
- open = undefined;
37
- }
38
- else {
39
- open.push(line);
40
- }
41
- }
42
- return [...statements, ...(open ?? [])];
43
- }
44
24
  function fitted(line) {
45
25
  const named = NAMED_IMPORT.exec(line);
46
26
  // One name alone stays on its line, whatever its length.
@@ -1 +1 @@
1
- {"version":3,"file":"merge-imports.js","sourceRoot":"","sources":["../../src/markers/merge-imports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,YAAY,GAAG,gDAAgD,CAAC;AAEtE;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,OAA0B,EAAE,MAAyB;IAChF,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE/B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAC/D,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,IAAI,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QAElH,IAAI,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;YAED,SAAS;QACX,CAAC;QA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ever the number of lines it was written on. */
2
+ export declare function oneLineImports(present: readonly string[]): string[];
3
+ //# sourceMappingURL=one-line-imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"one-line-imports.d.ts","sourceRoot":"","sources":["../../src/markers/one-line-imports.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAkBnE"}
@@ -0,0 +1,22 @@
1
+ /** Each import statement on one line, whatever the number of lines it was written on. */
2
+ export function oneLineImports(present) {
3
+ const statements = [];
4
+ let open;
5
+ for (const line of present.map((candidate) => candidate.trim())) {
6
+ if (open === undefined && /^import (?:type )?\{$/.test(line)) {
7
+ open = [line];
8
+ }
9
+ else if (open === undefined) {
10
+ statements.push(line);
11
+ }
12
+ else if (line.startsWith('}')) {
13
+ statements.push(`${open[0] ?? ''} ${open.slice(1).join(' ').replace(/,$/, '')} ${line}`);
14
+ open = undefined;
15
+ }
16
+ else {
17
+ open.push(line);
18
+ }
19
+ }
20
+ return [...statements, ...(open ?? [])];
21
+ }
22
+ //# sourceMappingURL=one-line-imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"one-line-imports.js","sourceRoot":"","sources":["../../src/markers/one-line-imports.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,UAAU,cAAc,CAAC,OAA0B;IACvD,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,IAAI,IAA0B,CAAC;IAE/B,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAChE,IAAI,IAAI,KAAK,SAAS,IAAI,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7D,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC;aAAM,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YAC9B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;aAAM,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;YACzF,IAAI,GAAG,SAAS,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,UAAU,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The brackets left open after `code`, read after those `open` holds, each by its kind; undefined
3
+ * when a bracket closes one that was not opened, or one of another kind. Comments and strings
4
+ * are blanked in `code`.
5
+ */
6
+ export declare function bracketsLeftOpen(code: string, open?: readonly number[]): number[] | undefined;
7
+ //# sourceMappingURL=brackets-left-open.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brackets-left-open.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/brackets-left-open.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAejG"}
@@ -0,0 +1,21 @@
1
+ import { BRACKETS } from '../../check/text/brackets.js';
2
+ /**
3
+ * The brackets left open after `code`, read after those `open` holds, each by its kind; undefined
4
+ * when a bracket closes one that was not opened, or one of another kind. Comments and strings
5
+ * are blanked in `code`.
6
+ */
7
+ export function bracketsLeftOpen(code, open = []) {
8
+ const waiting = [...open];
9
+ for (const char of code) {
10
+ const opener = BRACKETS.openers.indexOf(char);
11
+ const closer = BRACKETS.closers.indexOf(char);
12
+ if (opener !== -1) {
13
+ waiting.push(opener);
14
+ }
15
+ else if (closer !== -1 && waiting.pop() !== closer) {
16
+ return undefined;
17
+ }
18
+ }
19
+ return waiting;
20
+ }
21
+ //# sourceMappingURL=brackets-left-open.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brackets-left-open.js","sourceRoot":"","sources":["../../../src/merge/declarations/brackets-left-open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,IAAI,GAAsB,EAAE;IACzE,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAE1B,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC9C,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YAClB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;aAAM,IAAI,MAAM,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,KAAK,MAAM,EAAE,CAAC;YACrD,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /** One declaration of a generated region: a table, a model, a function, with the comments written above it. */
2
+ export interface Declaration {
3
+ /** What makes it the same declaration on two sides: the name it declares, else its text. */
4
+ readonly key: string;
5
+ /** The name it declares, when it declares one. */
6
+ readonly name?: string;
7
+ readonly lines: readonly string[];
8
+ /** Whether a line that ends a statement closes it: an entry of a list, ended by a comma, is closed by a blank line or the end of the region. */
9
+ readonly ended: boolean;
10
+ /** The blank lines written above it. */
11
+ readonly gap: number;
12
+ /** Whether it opens the region on its side: nothing above it says how it is set apart. */
13
+ readonly first: boolean;
14
+ }
15
+ //# sourceMappingURL=declaration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/declaration.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,MAAM,WAAW,WAAW;IAC1B,4FAA4F;IAC5F,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,gJAAgJ;IAChJ,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,wCAAwC;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,0FAA0F;IAC1F,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=declaration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../../src/merge/declarations/declaration.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { DeclaredSide } from './declared-side.js';
2
+ /**
3
+ * The lines of a region read as declarations, each whole: a statement runs until its brackets are
4
+ * closed and its line ends it (a closing brace does not when the next line goes on with an
5
+ * operator), until a blank line outside any bracket, or until a line that declares another name
6
+ * outside any bracket; the comments above it are its own. Undefined when the region cannot be read with certainty: a bracket that does not
7
+ * pair, a text the lexer may have taken for code, a region written inside it, or two declarations
8
+ * of one name.
9
+ */
10
+ export declare function declarationsOf(lines: readonly string[]): DeclaredSide | undefined;
11
+ //# sourceMappingURL=declarations-of.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declarations-of.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/declarations-of.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAqCpD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,GAAG,SAAS,CAkBjF"}
@@ -0,0 +1,130 @@
1
+ import { scan } from '../../check/scan/scan.js';
2
+ import { REGION_MARKER } from '../../markers/index.js';
3
+ import { bracketsLeftOpen } from './brackets-left-open.js';
4
+ /** A line that declares a name outside any bracket: a constant, a function, a class, a type, an enum, a model of Prisma. */
5
+ const NAMED = /^\s*(?:export\s+)?(?:default\s+)?(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:const\s+enum|const|let|var|function\s*\*?|class|interface|type|enum|namespace|module|model|view)\s+([A-Za-z_$][\w$]*)/;
6
+ /** A default export written as a declaration or an expression. */
7
+ const DEFAULT = /^\s*export\s+default\b/;
8
+ /** How the last line of a statement ends once its brackets are closed: a comma goes on with a second name or a type argument. */
9
+ const ENDS = /[;}]$/;
10
+ /** How a line starts that goes on with the statement above it, whatever that one ends with but a semicolon. */
11
+ const GOES_ON = /^(?:[|&?:.+\-*/=]|satisfies\b|as\b)/;
12
+ /**
13
+ * The lines of a region read as declarations, each whole: a statement runs until its brackets are
14
+ * closed and its line ends it (a closing brace does not when the next line goes on with an
15
+ * operator), until a blank line outside any bracket, or until a line that declares another name
16
+ * outside any bracket; the comments above it are its own. Undefined when the region cannot be read with certainty: a bracket that does not
17
+ * pair, a text the lexer may have taken for code, a region written inside it, or two declarations
18
+ * of one name.
19
+ */
20
+ export function declarationsOf(lines) {
21
+ const scanned = scan(lines.join('\n'));
22
+ if (scanned.uncertain || lines.some((line) => REGION_MARKER.test(line))) {
23
+ return undefined;
24
+ }
25
+ const read = readings(lines, scanned.code.split('\n'));
26
+ if (read === undefined) {
27
+ return undefined;
28
+ }
29
+ const left = read.last.lines.length > 0;
30
+ const declarations = [...read.closed, ...(left ? [read.last] : [])].map(declared);
31
+ const keys = new Set(declarations.map(({ key }) => key));
32
+ return keys.size === declarations.length ? { declarations, trailing: left ? 0 : read.last.gap } : undefined;
33
+ }
34
+ /** Each declaration a line closed, and the one the last line left; undefined when a bracket does not pair. */
35
+ function readings(lines, code) {
36
+ const closed = [];
37
+ let reading = blank(0);
38
+ for (const [at, line] of lines.entries()) {
39
+ const next = code.slice(at + 1).find((after) => after.trim() !== '') ?? '';
40
+ const step = followed(reading, { line, code: (code[at] ?? '').trim(), goesOn: GOES_ON.test(next.trim()) });
41
+ if (step === undefined) {
42
+ return undefined;
43
+ }
44
+ closed.push(...step.closed);
45
+ reading = step.reading;
46
+ }
47
+ return reading.open.length > 0 ? undefined : { closed, last: reading };
48
+ }
49
+ function blank(gap) {
50
+ return { lines: [], open: [], name: undefined, code: false, tail: 0, margin: 0, gap, ended: false };
51
+ }
52
+ /** The reading after one more line; undefined when the line closes a bracket that is not open. */
53
+ function followed(reading, { line, code, goesOn }) {
54
+ const apart = line.trim() === '' && reading.open.length === 0 ? setApart(reading, goesOn) : undefined;
55
+ if (apart !== undefined) {
56
+ return apart;
57
+ }
58
+ const second = startsAnother(reading, line, code);
59
+ const grown = withLine(second ? afterNamed(reading) : reading, line, code);
60
+ const before = second ? [beforeNamed(reading)] : [];
61
+ if (grown === undefined) {
62
+ return undefined;
63
+ }
64
+ return grown.code && grown.open.length === 0 && ends(code, goesOn)
65
+ ? { reading: blank(0), closed: [...before, { ...grown, ended: true }] }
66
+ : { reading: grown, closed: before };
67
+ }
68
+ /** Whether a line ends its statement once its brackets are closed: a semicolon does, a closing brace unless the next line goes on. */
69
+ function ends(code, goesOn) {
70
+ return code.endsWith(';') || (ENDS.test(code) && !goesOn);
71
+ }
72
+ /**
73
+ * What a blank line outside any bracket makes of a reading: one more above a declaration to come,
74
+ * the end of one that holds code unless the code after it goes on with it.
75
+ */
76
+ function setApart(reading, goesOn) {
77
+ if (reading.lines.length === 0) {
78
+ return { reading: { ...reading, gap: reading.gap + 1 }, closed: [] };
79
+ }
80
+ return reading.code && !goesOn ? { reading: blank(1), closed: [reading] } : undefined;
81
+ }
82
+ /** Whether a line declares another name where the declaration read so far declared its own: outside any bracket, no deeper in the margin. */
83
+ function startsAnother(reading, line, code) {
84
+ return (reading.open.length === 0 &&
85
+ reading.name !== undefined &&
86
+ nameOf(code) !== undefined &&
87
+ marginOf(line) <= reading.margin);
88
+ }
89
+ function marginOf(line) {
90
+ return line.length - line.trimStart().length;
91
+ }
92
+ /** A declaration without the comments written under its last line of code: they stand above the one that follows. */
93
+ function beforeNamed(reading) {
94
+ return { ...reading, lines: reading.lines.slice(0, reading.lines.length - reading.tail), tail: 0 };
95
+ }
96
+ /** The reading a second name starts: the comments the declaration before it ended with. */
97
+ function afterNamed(reading) {
98
+ return { ...blank(0), lines: reading.lines.slice(reading.lines.length - reading.tail) };
99
+ }
100
+ /** A reading with one more line: the brackets it leaves open, the name it declares when it is written outside any. */
101
+ function withLine(reading, line, code) {
102
+ const open = bracketsLeftOpen(code, reading.open);
103
+ const named = reading.open.length === 0 ? nameOf(code) : undefined;
104
+ return open === undefined
105
+ ? undefined
106
+ : {
107
+ ...reading,
108
+ lines: [...reading.lines, line],
109
+ open,
110
+ name: reading.name ?? named,
111
+ margin: reading.name === undefined && named !== undefined ? marginOf(line) : reading.margin,
112
+ code: reading.code || code !== '',
113
+ tail: code === '' ? reading.tail + 1 : 0,
114
+ };
115
+ }
116
+ /** The name a line declares; a default export that declares none is `default`. */
117
+ function nameOf(code) {
118
+ return NAMED.exec(code)?.[1] ?? (DEFAULT.test(code) ? 'default' : undefined);
119
+ }
120
+ function declared({ lines, name, gap, ended }, at) {
121
+ return {
122
+ ended,
123
+ key: name === undefined ? `text ${lines.join('\n')}` : `name ${name}`,
124
+ ...(name === undefined ? {} : { name }),
125
+ lines,
126
+ gap,
127
+ first: at === 0,
128
+ };
129
+ }
130
+ //# sourceMappingURL=declarations-of.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declarations-of.js","sourceRoot":"","sources":["../../../src/merge/declarations/declarations-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAIxD,4HAA4H;AAC5H,MAAM,KAAK,GACT,uMAAuM,CAAC;AAE1M,kEAAkE;AAClE,MAAM,OAAO,GAAG,wBAAwB,CAAC;AAEzC,iIAAiI;AACjI,MAAM,IAAI,GAAG,OAAO,CAAC;AAErB,+GAA+G;AAC/G,MAAM,OAAO,GAAG,qCAAqC,CAAC;AAwBtD;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,KAAwB;IACrD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvC,IAAI,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACxE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CA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CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM;YAC3F,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI,KAAK,EAAE;YACjC,IAAI,EAAE,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SACzC,CAAC;AACR,CAAC;AAED,kFAAkF;AAClF,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAW,EAAE,EAAU;IAChE,OAAO;QACL,KAAK;QACL,GAAG,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE;QACrE,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QACvC,KAAK;QACL,GAAG;QACH,KAAK,EAAE,EAAE,KAAK,CAAC;KAChB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { DeclaredSide } from './declared-side.js';
2
+ import type { MergedDeclaration } from './merge-declarations.js';
3
+ /** The marker lines of a conflict, as the merge wrote them for the file. */
4
+ export interface ConflictLabels {
5
+ readonly ours: string;
6
+ readonly base: string;
7
+ readonly theirs: string;
8
+ }
9
+ /**
10
+ * The lines of a merged region: each declaration whole, set apart as its side wrote it, and each
11
+ * one the two sides do not agree on as one conflict that holds its three versions whole.
12
+ */
13
+ export declare function declaredLines(merged: readonly MergedDeclaration[], ours: DeclaredSide, labels: ConflictLabels): string[];
14
+ //# sourceMappingURL=declared-lines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declared-lines.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/declared-lines.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,iBAAiB,EAAE,EACpC,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,cAAc,GACrB,MAAM,EAAE,CAWV"}
@@ -0,0 +1,42 @@
1
+ import { shownOf } from './shown-of.js';
2
+ /**
3
+ * The lines of a merged region: each declaration whole, set apart as its side wrote it, and each
4
+ * one the two sides do not agree on as one conflict that holds its three versions whole.
5
+ */
6
+ export function declaredLines(merged, ours, labels) {
7
+ const leading = ours.declarations[0]?.gap ?? 0;
8
+ const lines = merged.flatMap((item, at) => {
9
+ const previous = merged[at - 1];
10
+ const gap = gapOf(shownOf(item), previous === undefined ? undefined : shownOf(previous), leading);
11
+ return [...Array(gap).fill(''), ...linesOf(item, labels)];
12
+ });
13
+ return [...lines, ...Array(ours.trailing).fill('')];
14
+ }
15
+ /**
16
+ * The blank lines above a declaration: those its side wrote. The one that opens the merged region
17
+ * stands as our side opens it, and one that opened its side stands apart from several lines.
18
+ */
19
+ function gapOf(shown, previous, leading) {
20
+ if (previous === undefined) {
21
+ return leading;
22
+ }
23
+ if (shown === undefined || !shown.first) {
24
+ return shown?.gap ?? 0;
25
+ }
26
+ return shown.lines.length > 1 || previous.lines.length > 1 ? 1 : 0;
27
+ }
28
+ function linesOf(item, labels) {
29
+ if (item.kind === 'kept') {
30
+ return item.declaration.lines;
31
+ }
32
+ return [
33
+ labels.ours,
34
+ ...(item.ours?.lines ?? []),
35
+ labels.base,
36
+ ...(item.base?.lines ?? []),
37
+ '=======',
38
+ ...(item.theirs?.lines ?? []),
39
+ labels.theirs,
40
+ ];
41
+ }
42
+ //# sourceMappingURL=declared-lines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declared-lines.js","sourceRoot":"","sources":["../../../src/merge/declarations/declared-lines.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AASrC;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAoC,EACpC,IAAkB,EAClB,MAAsB;IAEtB,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAE/C,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE;QACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QAChC,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;QAElG,OAAO,CAAC,GAAG,KAAK,CAAS,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,KAAK,CAAS,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;;;GAGG;AACH,SAAS,KAAK,CAAC,KAA8B,EAAE,QAAiC,EAAE,OAAe;IAC/F,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACxC,OAAO,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,OAAO,CAAC,IAAuB,EAAE,MAAsB;IAC9D,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;IAChC,CAAC;IAED,OAAO;QACL,MAAM,CAAC,IAAI;QACX,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;QAC3B,MAAM,CAAC,IAAI;QACX,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;QAC3B,SAAS;QACT,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC;QAC7B,MAAM,CAAC,MAAM;KACd,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Declaration } from './declaration.js';
2
+ /** The declarations of a region as one side of a merge holds it, in their order. */
3
+ export interface DeclaredSide {
4
+ readonly declarations: readonly Declaration[];
5
+ /** The blank lines written after the last one. */
6
+ readonly trailing: number;
7
+ }
8
+ //# sourceMappingURL=declared-side.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declared-side.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/declared-side.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,oFAAoF;AACpF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9C,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=declared-side.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declared-side.js","sourceRoot":"","sources":["../../../src/merge/declarations/declared-side.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ /** Whether `lines` holds every line of `part`, in the same order. */
2
+ export declare function holdsEveryLine(lines: readonly string[], part: readonly string[]): boolean;
3
+ //# sourceMappingURL=holds-every-line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"holds-every-line.d.ts","sourceRoot":"","sources":["../../../src/merge/declarations/holds-every-line.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAUzF"}
@@ -0,0 +1,10 @@
1
+ /** Whether `lines` holds every line of `part`, in the same order. */
2
+ export function holdsEveryLine(lines, part) {
3
+ let from = 0;
4
+ return part.every((line) => {
5
+ const at = lines.indexOf(line, from);
6
+ from = at + 1;
7
+ return at !== -1;
8
+ });
9
+ }
10
+ //# sourceMappingURL=holds-every-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"holds-every-line.js","sourceRoot":"","sources":["../../../src/merge/declarations/holds-every-line.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,UAAU,cAAc,CAAC,KAAwB,EAAE,IAAuB;IAC9E,IAAI,IAAI,GAAG,CAAC,CAAC;IAEb,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAErC,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC;QAEd,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC"}