@skmtc/core 0.47.4 → 0.49.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 (207) hide show
  1. package/esm/context/CoreContext.d.ts +1 -1
  2. package/esm/context/CoreContext.js +6 -2
  3. package/esm/context/GenerateContext.d.ts +15 -4
  4. package/esm/context/GenerateContext.js +40 -34
  5. package/esm/context/ParseContext.d.ts +4 -4
  6. package/esm/context/ParseContext.js +6 -6
  7. package/esm/context/RenderContext.d.ts +3 -2
  8. package/esm/context/RenderContext.js +6 -5
  9. package/esm/context/generateTypes.d.ts +10 -6
  10. package/esm/context/tryParseAt.d.ts +1 -1
  11. package/esm/context/tryParseAt.js +1 -1
  12. package/esm/dsl/ContentSettings.d.ts +17 -12
  13. package/esm/dsl/ContentSettings.js +13 -9
  14. package/esm/dsl/Inserted.d.ts +4 -3
  15. package/esm/dsl/Inserted.js +2 -2
  16. package/esm/dsl/PendingDefinition.d.ts +3 -2
  17. package/esm/dsl/driverFiles.d.ts +46 -0
  18. package/esm/dsl/driverFiles.js +31 -0
  19. package/esm/dsl/model/ModelDriver.d.ts +5 -7
  20. package/esm/dsl/model/ModelDriver.js +12 -29
  21. package/esm/dsl/operation/gql/GqlOperationDriver.d.ts +1 -1
  22. package/esm/dsl/operation/gql/GqlOperationDriver.js +15 -12
  23. package/esm/dsl/operation/oas/OasOperationDriver.d.ts +1 -1
  24. package/esm/dsl/operation/oas/OasOperationDriver.js +11 -14
  25. package/esm/dsl/webhook/WebhookDriver.d.ts +1 -1
  26. package/esm/dsl/webhook/WebhookDriver.js +15 -12
  27. package/esm/enrichments/EnrichmentAudit.d.ts +1 -1
  28. package/esm/enrichments/EnrichmentWarning.d.ts +1 -1
  29. package/esm/enrichments/findUnknownKeys.d.ts +1 -1
  30. package/esm/enrichments/findUnknownKeys.js +1 -1
  31. package/esm/enrichments/parseEnrichmentUmbrella.d.ts +1 -1
  32. package/esm/enrichments/parseEnrichmentUmbrella.js +1 -1
  33. package/esm/enrichments/parseEnrichmentValue.d.ts +2 -2
  34. package/esm/enrichments/parseEnrichmentValue.js +2 -2
  35. package/esm/enrichments/readEnrichments.d.ts +4 -4
  36. package/esm/enrichments/readEnrichments.js +4 -4
  37. package/esm/enrichments/validateConfig.d.ts +1 -1
  38. package/esm/helpers/applyGeneratedSuffix.d.ts +1 -1
  39. package/esm/helpers/applyGeneratedSuffix.js +1 -1
  40. package/esm/helpers/getByWorkspacePath.d.ts +9 -0
  41. package/esm/helpers/getByWorkspacePath.js +10 -0
  42. package/esm/helpers/normalizeWorkspacePath.d.ts +26 -3
  43. package/esm/helpers/normalizeWorkspacePath.js +17 -2
  44. package/esm/oas/array/Array.d.ts +2 -2
  45. package/esm/oas/array/Array.js +2 -2
  46. package/esm/oas/boolean/Boolean.d.ts +2 -2
  47. package/esm/oas/boolean/Boolean.js +2 -2
  48. package/esm/oas/integer/Integer.d.ts +2 -2
  49. package/esm/oas/integer/Integer.js +2 -2
  50. package/esm/oas/intersection/Intersection.d.ts +3 -3
  51. package/esm/oas/intersection/Intersection.js +3 -3
  52. package/esm/oas/number/Number.d.ts +2 -2
  53. package/esm/oas/number/Number.js +2 -2
  54. package/esm/oas/object/Object.d.ts +2 -2
  55. package/esm/oas/object/Object.js +2 -2
  56. package/esm/oas/operation/Operation.d.ts +1 -1
  57. package/esm/oas/operation/Operation.js +1 -1
  58. package/esm/oas/operation/toEffectiveParameters.d.ts +2 -2
  59. package/esm/oas/operation/toEffectiveParameters.js +2 -2
  60. package/esm/oas/ref/DanglingRefError.d.ts +1 -1
  61. package/esm/oas/ref/DanglingRefError.js +1 -1
  62. package/esm/oas/ref/Ref.d.ts +2 -2
  63. package/esm/oas/ref/Ref.js +2 -2
  64. package/esm/oas/string/String.d.ts +2 -2
  65. package/esm/oas/string/String.js +2 -2
  66. package/esm/oas/union/Union.d.ts +3 -3
  67. package/esm/oas/union/Union.js +3 -3
  68. package/esm/oas/unknown/Unknown.d.ts +2 -2
  69. package/esm/oas/unknown/Unknown.js +2 -2
  70. package/esm/parse/allOfSystem.d.ts +4 -4
  71. package/esm/parse/allOfSystem.js +2 -2
  72. package/esm/parse/anyOfSystem.d.ts +5 -5
  73. package/esm/parse/anyOfSystem.js +4 -4
  74. package/esm/parse/keptRefs.d.ts +2 -2
  75. package/esm/parse/v3-0/_merge-all-of/merge-union.d.ts +1 -1
  76. package/esm/parse/v3-0/_merge-all-of/merge-union.js +3 -3
  77. package/esm/parse/v3-0/_merge-all-of/merge.js +2 -2
  78. package/esm/parse/v3-0/_merge-all-of/types.d.ts +4 -4
  79. package/esm/parse/v3-0/ref/toRefV31.js +1 -1
  80. package/esm/parse/v3-0/schema/toSchemasV3.js +3 -3
  81. package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +1 -1
  82. package/esm/parse/v3-1/_merge-all-of/merge-union.js +3 -3
  83. package/esm/parse/v3-1/_merge-all-of/merge.js +2 -2
  84. package/esm/parse/v3-1/_merge-all-of/types.d.ts +4 -4
  85. package/esm/parse/v3-1/ref/toRefV31.js +1 -1
  86. package/esm/parse/v3-1/schema/toSchemasV3.js +3 -3
  87. package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +1 -1
  88. package/esm/parse/v3-2/_merge-all-of/merge-union.js +3 -3
  89. package/esm/parse/v3-2/_merge-all-of/merge.js +2 -2
  90. package/esm/parse/v3-2/_merge-all-of/types.d.ts +4 -4
  91. package/esm/parse/v3-2/ref/toRefV31.js +1 -1
  92. package/esm/parse/v3-2/schema/toSchemasV3.js +3 -3
  93. package/esm/run/toEnrichmentDefaults.d.ts +1 -1
  94. package/esm/run/toEnrichmentDefaults.js +1 -1
  95. package/esm/types/EnrichmentDefaults.d.ts +1 -1
  96. package/esm/types/EnrichmentDefaults.js +1 -1
  97. package/esm/types/Enrichments.d.ts +1 -1
  98. package/esm/types/Manifest.d.ts +1 -1
  99. package/esm/types/ModuleSelect.d.ts +1 -1
  100. package/esm/types/Settings.d.ts +29 -11
  101. package/esm/types/Settings.js +13 -6
  102. package/esm/types/Variant.d.ts +3 -3
  103. package/esm/types/Variant.js +3 -3
  104. package/package.json +1 -1
  105. package/script/context/CoreContext.d.ts +1 -1
  106. package/script/context/CoreContext.js +6 -2
  107. package/script/context/GenerateContext.d.ts +15 -4
  108. package/script/context/GenerateContext.js +38 -32
  109. package/script/context/ParseContext.d.ts +4 -4
  110. package/script/context/ParseContext.js +6 -6
  111. package/script/context/RenderContext.d.ts +3 -2
  112. package/script/context/RenderContext.js +6 -5
  113. package/script/context/generateTypes.d.ts +10 -6
  114. package/script/context/tryParseAt.d.ts +1 -1
  115. package/script/context/tryParseAt.js +1 -1
  116. package/script/dsl/ContentSettings.d.ts +17 -12
  117. package/script/dsl/ContentSettings.js +13 -9
  118. package/script/dsl/Inserted.d.ts +4 -3
  119. package/script/dsl/Inserted.js +2 -2
  120. package/script/dsl/PendingDefinition.d.ts +3 -2
  121. package/script/dsl/driverFiles.d.ts +46 -0
  122. package/script/dsl/driverFiles.js +38 -0
  123. package/script/dsl/model/ModelDriver.d.ts +5 -7
  124. package/script/dsl/model/ModelDriver.js +12 -29
  125. package/script/dsl/operation/gql/GqlOperationDriver.d.ts +1 -1
  126. package/script/dsl/operation/gql/GqlOperationDriver.js +15 -12
  127. package/script/dsl/operation/oas/OasOperationDriver.d.ts +1 -1
  128. package/script/dsl/operation/oas/OasOperationDriver.js +11 -14
  129. package/script/dsl/webhook/WebhookDriver.d.ts +1 -1
  130. package/script/dsl/webhook/WebhookDriver.js +15 -12
  131. package/script/enrichments/EnrichmentAudit.d.ts +1 -1
  132. package/script/enrichments/EnrichmentWarning.d.ts +1 -1
  133. package/script/enrichments/findUnknownKeys.d.ts +1 -1
  134. package/script/enrichments/findUnknownKeys.js +1 -1
  135. package/script/enrichments/parseEnrichmentUmbrella.d.ts +1 -1
  136. package/script/enrichments/parseEnrichmentUmbrella.js +1 -1
  137. package/script/enrichments/parseEnrichmentValue.d.ts +2 -2
  138. package/script/enrichments/parseEnrichmentValue.js +2 -2
  139. package/script/enrichments/readEnrichments.d.ts +4 -4
  140. package/script/enrichments/readEnrichments.js +4 -4
  141. package/script/enrichments/validateConfig.d.ts +1 -1
  142. package/script/helpers/applyGeneratedSuffix.d.ts +1 -1
  143. package/script/helpers/applyGeneratedSuffix.js +1 -1
  144. package/script/helpers/getByWorkspacePath.d.ts +9 -0
  145. package/script/helpers/getByWorkspacePath.js +14 -0
  146. package/script/helpers/normalizeWorkspacePath.d.ts +26 -3
  147. package/script/helpers/normalizeWorkspacePath.js +19 -3
  148. package/script/oas/array/Array.d.ts +2 -2
  149. package/script/oas/array/Array.js +2 -2
  150. package/script/oas/boolean/Boolean.d.ts +2 -2
  151. package/script/oas/boolean/Boolean.js +2 -2
  152. package/script/oas/integer/Integer.d.ts +2 -2
  153. package/script/oas/integer/Integer.js +2 -2
  154. package/script/oas/intersection/Intersection.d.ts +3 -3
  155. package/script/oas/intersection/Intersection.js +3 -3
  156. package/script/oas/number/Number.d.ts +2 -2
  157. package/script/oas/number/Number.js +2 -2
  158. package/script/oas/object/Object.d.ts +2 -2
  159. package/script/oas/object/Object.js +2 -2
  160. package/script/oas/operation/Operation.d.ts +1 -1
  161. package/script/oas/operation/Operation.js +1 -1
  162. package/script/oas/operation/toEffectiveParameters.d.ts +2 -2
  163. package/script/oas/operation/toEffectiveParameters.js +2 -2
  164. package/script/oas/ref/DanglingRefError.d.ts +1 -1
  165. package/script/oas/ref/DanglingRefError.js +1 -1
  166. package/script/oas/ref/Ref.d.ts +2 -2
  167. package/script/oas/ref/Ref.js +2 -2
  168. package/script/oas/string/String.d.ts +2 -2
  169. package/script/oas/string/String.js +2 -2
  170. package/script/oas/union/Union.d.ts +3 -3
  171. package/script/oas/union/Union.js +3 -3
  172. package/script/oas/unknown/Unknown.d.ts +2 -2
  173. package/script/oas/unknown/Unknown.js +2 -2
  174. package/script/parse/allOfSystem.d.ts +4 -4
  175. package/script/parse/allOfSystem.js +2 -2
  176. package/script/parse/anyOfSystem.d.ts +5 -5
  177. package/script/parse/anyOfSystem.js +4 -4
  178. package/script/parse/keptRefs.d.ts +2 -2
  179. package/script/parse/v3-0/_merge-all-of/merge-union.d.ts +1 -1
  180. package/script/parse/v3-0/_merge-all-of/merge-union.js +3 -3
  181. package/script/parse/v3-0/_merge-all-of/merge.js +2 -2
  182. package/script/parse/v3-0/_merge-all-of/types.d.ts +4 -4
  183. package/script/parse/v3-0/ref/toRefV31.js +1 -1
  184. package/script/parse/v3-0/schema/toSchemasV3.js +3 -3
  185. package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +1 -1
  186. package/script/parse/v3-1/_merge-all-of/merge-union.js +3 -3
  187. package/script/parse/v3-1/_merge-all-of/merge.js +2 -2
  188. package/script/parse/v3-1/_merge-all-of/types.d.ts +4 -4
  189. package/script/parse/v3-1/ref/toRefV31.js +1 -1
  190. package/script/parse/v3-1/schema/toSchemasV3.js +3 -3
  191. package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +1 -1
  192. package/script/parse/v3-2/_merge-all-of/merge-union.js +3 -3
  193. package/script/parse/v3-2/_merge-all-of/merge.js +2 -2
  194. package/script/parse/v3-2/_merge-all-of/types.d.ts +4 -4
  195. package/script/parse/v3-2/ref/toRefV31.js +1 -1
  196. package/script/parse/v3-2/schema/toSchemasV3.js +3 -3
  197. package/script/run/toEnrichmentDefaults.d.ts +1 -1
  198. package/script/run/toEnrichmentDefaults.js +1 -1
  199. package/script/types/EnrichmentDefaults.d.ts +1 -1
  200. package/script/types/EnrichmentDefaults.js +1 -1
  201. package/script/types/Enrichments.d.ts +1 -1
  202. package/script/types/Manifest.d.ts +1 -1
  203. package/script/types/ModuleSelect.d.ts +1 -1
  204. package/script/types/Settings.d.ts +29 -11
  205. package/script/types/Settings.js +14 -7
  206. package/script/types/Variant.d.ts +3 -3
  207. package/script/types/Variant.js +3 -3
@@ -55,7 +55,7 @@ import { type Method } from './Method.js';
55
55
  /**
56
56
  * Valibot schema for {@link ModulePackage}.
57
57
  *
58
- * `rootPath` must be a **forward** path: `client.json` `basePath` is
58
+ * `rootPath` must be a **forward** path: `skmtc.config.json` `basePath` is
59
59
  * the common on-disk anchor, so every package sits forward from it.
60
60
  * A `..` segment means `basePath` was placed too deep — a misconfig
61
61
  * that otherwise misplaces every artifact silently.
@@ -163,16 +163,22 @@ export declare const includeModels: v.GenericSchema<IncludeModels>;
163
163
  */
164
164
  export declare const anchorsSettings: v.GenericSchema<AnchorsSettings>;
165
165
  /**
166
- * What `client.json#settings.system.danglingRefs` can list: each kind of
166
+ * What `skmtc.config.json#settings.parse.danglingRefs` can list: each kind of
167
167
  * `$ref`, and `allOfMember`, a `$ref` that core merges at parse: a member of
168
168
  * an `allOf`, also one inside a `oneOf` or `anyOf` member, or a `oneOf` or
169
169
  * `anyOf` member merged with the keywords beside the union.
170
170
  */
171
171
  export declare const danglingRefKinds: readonly ["schema", "parameter", "requestBody", "response", "header", "securityScheme", "example", "link", "allOfMember"];
172
- /** A kind of `$ref` that `system.danglingRefs` can let name nothing. */
172
+ /** A kind of `$ref` that `parse.danglingRefs` can let name nothing. */
173
173
  export type DanglingRefKind = (typeof danglingRefKinds)[number];
174
- /** Valibot schema for {@link SystemSettings}: `client.json#settings.system`. */
175
- export declare const systemSettings: v.GenericSchema<SystemSettings>;
174
+ /** Valibot schema for {@link ParseSettings}: `skmtc.config.json#settings.parse`. */
175
+ export declare const parseSettings: v.GenericSchema<ParseSettings>;
176
+ /**
177
+ * The old name of {@link parseSettings}.
178
+ *
179
+ * @deprecated Use `parseSettings`.
180
+ */
181
+ export declare const systemSettings: v.GenericSchema<ParseSettings>;
176
182
  export declare const clientSettings: v.GenericSchema<ClientSettings>;
177
183
  /**
178
184
  * Configuration for skipping specific HTTP methods + variants on API paths.
@@ -408,7 +414,7 @@ export type Include = IncludeOperations | IncludeModels | string;
408
414
  */
409
415
  /**
410
416
  * Per-project gen-maps (`anchors`) configuration. Lives at
411
- * `client.json#settings.anchors`.
417
+ * `skmtc.config.json#settings.anchors`.
412
418
  *
413
419
  * v1 honours the two fields below. Future fields (parser choice,
414
420
  * gzip compression, map toggle) will land additively as the
@@ -431,11 +437,11 @@ export type AnchorsSettings = {
431
437
  };
432
438
  /**
433
439
  * How the OpenAPI parser treats what it cannot read faithfully, or reads
434
- * another way (`client.json#settings.system`). Each setting's default parses
440
+ * another way (`skmtc.config.json#settings.parse`). Each setting's default parses
435
441
  * as core always did: `strict` fails the schema, and `removeErroredItems`
436
442
  * removes each item that uses it.
437
443
  */
438
- export type SystemSettings = {
444
+ export type ParseSettings = {
439
445
  /**
440
446
  * `latestWins`: where `allOf` members contradict, the later member's
441
447
  * keyword wins, with one warning for each schema where it happens.
@@ -480,6 +486,12 @@ export type SystemSettings = {
480
486
  */
481
487
  intersections?: 'merge' | 'cycles' | 'all';
482
488
  };
489
+ /**
490
+ * The old name of {@link ParseSettings}.
491
+ *
492
+ * @deprecated Use `ParseSettings`.
493
+ */
494
+ export type SystemSettings = ParseSettings;
483
495
  export type ClientSettings = {
484
496
  /** Base output path for generated files */
485
497
  basePath?: string;
@@ -503,12 +515,18 @@ export type ClientSettings = {
503
515
  * in v1. See {@link AnchorsSettings}.
504
516
  */
505
517
  anchors?: AnchorsSettings;
506
- /** How the OpenAPI parser treats what it cannot read faithfully. See {@link SystemSettings}. */
507
- system?: SystemSettings;
518
+ /** How the OpenAPI parser treats what it cannot read faithfully. See {@link ParseSettings}. */
519
+ parse?: ParseSettings;
520
+ /**
521
+ * The old name of {@link parse}. Read only when `parse` is not set.
522
+ *
523
+ * @deprecated Use `parse`. `skmtc migrate config <project>` moves it.
524
+ */
525
+ system?: ParseSettings;
508
526
  /**
509
527
  * Preview input-matcher discovery directories (project-root relative, e.g.
510
528
  * `src/fields`, `src/inputs`). A preview/hub concern: the generation engine
511
- * ignores it. Declared here so the CLI preserves it when reading `client.json`
529
+ * ignores it. Declared here so the CLI preserves it when reading `skmtc.config.json`
512
530
  * and carries it through `skmtc push` to the hub.
513
531
  */
514
532
  inputDirs?: string[];
@@ -57,14 +57,14 @@ import { toWorkspacePath } from '../helpers/toWorkspacePath.js';
57
57
  /**
58
58
  * Valibot schema for {@link ModulePackage}.
59
59
  *
60
- * `rootPath` must be a **forward** path: `client.json` `basePath` is
60
+ * `rootPath` must be a **forward** path: `skmtc.config.json` `basePath` is
61
61
  * the common on-disk anchor, so every package sits forward from it.
62
62
  * A `..` segment means `basePath` was placed too deep — a misconfig
63
63
  * that otherwise misplaces every artifact silently.
64
64
  */
65
65
  export const modulePackage = v.object({
66
66
  rootPath: v.pipe(v.string(), v.check(rootPath => !hasParentSegment(rootPath), 'package rootPath must be a forward path with no ".." segments — ' +
67
- 'set client.json basePath to a common ancestor of every package ' +
67
+ 'set skmtc.config.json basePath to a common ancestor of every package ' +
68
68
  'so each rootPath is written forward from it')),
69
69
  moduleName: v.optional(v.string())
70
70
  });
@@ -170,7 +170,7 @@ export const anchorsSettings = v.object({
170
170
  out: v.optional(v.string())
171
171
  });
172
172
  /**
173
- * What `client.json#settings.system.danglingRefs` can list: each kind of
173
+ * What `skmtc.config.json#settings.parse.danglingRefs` can list: each kind of
174
174
  * `$ref`, and `allOfMember`, a `$ref` that core merges at parse: a member of
175
175
  * an `allOf`, also one inside a `oneOf` or `anyOf` member, or a `oneOf` or
176
176
  * `anyOf` member merged with the keywords beside the union.
@@ -186,8 +186,8 @@ export const danglingRefKinds = [
186
186
  'link',
187
187
  'allOfMember'
188
188
  ];
189
- /** Valibot schema for {@link SystemSettings}: `client.json#settings.system`. */
190
- export const systemSettings = v.object({
189
+ /** Valibot schema for {@link ParseSettings}: `skmtc.config.json#settings.parse`. */
190
+ export const parseSettings = v.object({
191
191
  allOf: v.optional(v.picklist(['strict', 'latestWins'])),
192
192
  responseContradictions: v.optional(v.picklist(['strict', 'unknown'])),
193
193
  not: v.optional(v.picklist(['strict', 'unknown'])),
@@ -195,6 +195,12 @@ export const systemSettings = v.object({
195
195
  danglingRefs: v.optional(v.array(v.picklist(danglingRefKinds))),
196
196
  intersections: v.optional(v.picklist(['merge', 'cycles', 'all']))
197
197
  });
198
+ /**
199
+ * The old name of {@link parseSettings}.
200
+ *
201
+ * @deprecated Use `parseSettings`.
202
+ */
203
+ export const systemSettings = parseSettings;
198
204
  export const clientSettings = v.object({
199
205
  basePath: v.optional(v.pipe(v.string(), v.check(basePath => !isAbsolutePath(basePath), 'basePath must be relative to the SKMTC root (the directory containing .skmtc/); ' +
200
206
  'absolute paths are not supported because generated output is always written under it'), v.check(basePath => !hasParentSegment(basePath), 'basePath must be a forward path with no ".." segments — it is the on-disk anchor ' +
@@ -205,7 +211,8 @@ export const clientSettings = v.object({
205
211
  include: v.optional(v.array(include)),
206
212
  skip: v.optional(v.array(skip)),
207
213
  anchors: v.optional(anchorsSettings),
208
- system: v.optional(systemSettings),
214
+ parse: v.optional(parseSettings),
215
+ system: v.optional(parseSettings),
209
216
  inputDirs: v.optional(v.array(v.string())),
210
217
  formatter: v.optional(v.string()),
211
218
  generatedSuffix: v.optional(v.string()),
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * A **variant** is a named axis below `[path][method]` (OAS) or
5
5
  * `[rootKind][fieldName]` (GraphQL) inside
6
- * `client.json#settings.enrichments`. It lets a single operation produce
6
+ * `skmtc.config.json#settings.enrichments`. It lets a single operation produce
7
7
  * N Definitions instead of one — e.g. a single broad `PATCH` endpoint
8
8
  * driving several section-edit forms, each scoped to a subset of fields.
9
9
  *
@@ -11,10 +11,10 @@
11
11
  * enrichment block. The variant name `'main'` is the canonical default
12
12
  * and is guaranteed to be present:
13
13
  *
14
- * - When a consumer's `client.json` writes no enrichments at all for a
14
+ * - When a consumer's `skmtc.config.json` writes no enrichments at all for a
15
15
  * `(generatorId, path, method)`, the engine still dispatches once with
16
16
  * `variant: 'main'` and `enrichments: undefined`.
17
- * - When a consumer's `client.json` writes any variants for a
17
+ * - When a consumer's `skmtc.config.json` writes any variants for a
18
18
  * `(generatorId, path, method)`, `'main'` must be among them — Valibot
19
19
  * rejects at parse time, and the engine also throws at runtime.
20
20
  *
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * A **variant** is a named axis below `[path][method]` (OAS) or
5
5
  * `[rootKind][fieldName]` (GraphQL) inside
6
- * `client.json#settings.enrichments`. It lets a single operation produce
6
+ * `skmtc.config.json#settings.enrichments`. It lets a single operation produce
7
7
  * N Definitions instead of one — e.g. a single broad `PATCH` endpoint
8
8
  * driving several section-edit forms, each scoped to a subset of fields.
9
9
  *
@@ -11,10 +11,10 @@
11
11
  * enrichment block. The variant name `'main'` is the canonical default
12
12
  * and is guaranteed to be present:
13
13
  *
14
- * - When a consumer's `client.json` writes no enrichments at all for a
14
+ * - When a consumer's `skmtc.config.json` writes no enrichments at all for a
15
15
  * `(generatorId, path, method)`, the engine still dispatches once with
16
16
  * `variant: 'main'` and `enrichments: undefined`.
17
- * - When a consumer's `client.json` writes any variants for a
17
+ * - When a consumer's `skmtc.config.json` writes any variants for a
18
18
  * `(generatorId, path, method)`, `'main'` must be among them — Valibot
19
19
  * rejects at parse time, and the engine also throws at runtime.
20
20
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.47.4",
3
+ "version": "0.49.0",
4
4
  "description": "Skmtc is a declarative code generation framework",
5
5
  "keywords": [
6
6
  "openapi",
@@ -304,7 +304,7 @@ export declare class CoreContext {
304
304
  * Seed-values sibling of {@link toSupportedSubjects}: parse the document, then
305
305
  * call each generator's `toEnrichmentDefaults` over its supported subjects —
306
306
  * no transform, no render. Returns the default enrichment values keyed by the
307
- * `client.json#settings.enrichments` routing, plus parse issues. Fails open
307
+ * `skmtc.config.json#settings.enrichments` routing, plus parse issues. Fails open
308
308
  * like {@link toArtifacts}: a bad schema surfaces as a `parseIssue` and the
309
309
  * defaults map is returned empty.
310
310
  */
@@ -464,7 +464,7 @@ class CoreContext {
464
464
  * Seed-values sibling of {@link toSupportedSubjects}: parse the document, then
465
465
  * call each generator's `toEnrichmentDefaults` over its supported subjects —
466
466
  * no transform, no render. Returns the default enrichment values keyed by the
467
- * `client.json#settings.enrichments` routing, plus parse issues. Fails open
467
+ * `skmtc.config.json#settings.enrichments` routing, plus parse issues. Fails open
468
468
  * like {@link toArtifacts}: a bad schema surfaces as a `parseIssue` and the
469
469
  * defaults map is returned empty.
470
470
  */
@@ -575,11 +575,15 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
575
575
  }
576
576
  }
577
577
  }, _CoreContext_setupParsePhase = function _CoreContext_setupParsePhase(input, settings) {
578
+ if (settings?.parse && settings.system) {
579
+ this.logger.warn('settings.parse and settings.system are both set: settings.parse is used and settings.system is ignored. ' +
580
+ 'settings.system is the deprecated name of settings.parse; remove it.');
581
+ }
578
582
  const parseContext = new ParseContext_js_1.ParseContext({
579
583
  input,
580
584
  logger: this.logger,
581
585
  silent: this.silent,
582
- system: settings?.system
586
+ system: settings?.parse ?? settings?.system
583
587
  });
584
588
  return { type: 'parse', context: parseContext };
585
589
  }, _CoreContext_setupGeneratePhase = function _CoreContext_setupGeneratePhase({ document, settings, toGeneratorConfigMap, captureChannel }) {
@@ -1,3 +1,4 @@
1
+ import { type WorkspacePath } from '../helpers/normalizeWorkspacePath.js';
1
2
  import type { DefinitionBase } from '../dsl/Definition.js';
2
3
  import type { PendingDefinition } from '../dsl/PendingDefinition.js';
3
4
  import type { OasSchema } from '../oas/schema/Schema.js';
@@ -201,7 +202,7 @@ export declare class GenerateContext implements GenerateContextType {
201
202
  * document — the *values* counterpart of {@link toSupportedSubjects}. For
202
203
  * every generator that advertises `toEnrichmentDefaults`, calls it over the
203
204
  * subjects the generator supports and keeps the non-`undefined` subject-scope
204
- * leaves, keyed by the `client.json#settings.enrichments` routing:
205
+ * leaves, keyed by the `skmtc.config.json#settings.enrichments` routing:
205
206
  * `[id][path][method]['main']` for operations, `[id][refName]['main']` for
206
207
  * models. Seeding targets the `'main'` variant; a generator that advertises
207
208
  * no defaults (or whose every subject returns `undefined`) is omitted.
@@ -216,10 +217,19 @@ export declare class GenerateContext implements GenerateContextType {
216
217
  * exists. Neutral primitive: returns the abstract `FileBase` and never
217
218
  * constructs anything, so a (future) language-owned `register` can ask
218
219
  * "does this file exist yet?" without the engine knowing the language.
219
- * To create-on-miss, use the internal `#getFile`; to add a
220
- * language-constructed file, use {@link addFile}.
220
+ * To create on a miss, add a file your language constructs with
221
+ * {@link addFile} (`getFile(path) ?? addFile(lang.createFile(…))`).
222
+ *
223
+ * `filePath` may be in any spelling. It is normalized only when it is no
224
+ * key: a key is a normalized path. The file's own `path` is the key.
221
225
  */
222
226
  getFile(filePath: string): FileBase | undefined;
227
+ /**
228
+ * The file whose normalized path is `path`, or `undefined`. A normalized
229
+ * path is a key as it is, so a miss is not normalized again, as it is in
230
+ * {@link getFile}: there is no file there in any spelling.
231
+ */
232
+ getFileByWorkspacePath(path: WorkspacePath): FileBase | undefined;
223
233
  /**
224
234
  * Read-only view of every file generated so far, keyed by (normalized)
225
235
  * export path. An **inspection / tooling** seam — NOT a coordination
@@ -235,7 +245,8 @@ export declare class GenerateContext implements GenerateContextType {
235
245
  * Store a language-constructed file. The engine never constructs a
236
246
  * concrete (language) `File`; the language's `register` builds its own
237
247
  * `FileBase` subclass and hands it in here. Throws if a file already
238
- * exists at the (normalized) path. Returns the stored file, so
248
+ * exists at the (normalized) path. Sets `file.path` to that normalized
249
+ * path, the file's key. Returns the stored file, so
239
250
  * get-or-create is a single expression at the call site
240
251
  * (`context.getFile(path) ?? context.addFile(new KtFile({ … }))`).
241
252
  */
@@ -17,6 +17,7 @@ var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_failedI
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.toModelSource = exports.toGqlOperationSource = exports.toWebhookSource = exports.toOasOperationSource = exports.GenerateContext = void 0;
19
19
  const normalizeWorkspacePath_js_1 = require("../helpers/normalizeWorkspacePath.js");
20
+ const getByWorkspacePath_js_1 = require("../helpers/getByWorkspacePath.js");
20
21
  const applyGeneratedSuffix_js_1 = require("../helpers/applyGeneratedSuffix.js");
21
22
  const DanglingRefError_js_1 = require("../oas/ref/DanglingRefError.js");
22
23
  const refFns_js_1 = require("../helpers/refFns.js");
@@ -387,7 +388,7 @@ class GenerateContext {
387
388
  * document — the *values* counterpart of {@link toSupportedSubjects}. For
388
389
  * every generator that advertises `toEnrichmentDefaults`, calls it over the
389
390
  * subjects the generator supports and keeps the non-`undefined` subject-scope
390
- * leaves, keyed by the `client.json#settings.enrichments` routing:
391
+ * leaves, keyed by the `skmtc.config.json#settings.enrichments` routing:
391
392
  * `[id][path][method]['main']` for operations, `[id][refName]['main']` for
392
393
  * models. Seeding targets the `'main'` variant; a generator that advertises
393
394
  * no defaults (or whose every subject returns `undefined`) is omitted.
@@ -483,11 +484,22 @@ class GenerateContext {
483
484
  * exists. Neutral primitive: returns the abstract `FileBase` and never
484
485
  * constructs anything, so a (future) language-owned `register` can ask
485
486
  * "does this file exist yet?" without the engine knowing the language.
486
- * To create-on-miss, use the internal `#getFile`; to add a
487
- * language-constructed file, use {@link addFile}.
487
+ * To create on a miss, add a file your language constructs with
488
+ * {@link addFile} (`getFile(path) ?? addFile(lang.createFile(…))`).
489
+ *
490
+ * `filePath` may be in any spelling. It is normalized only when it is no
491
+ * key: a key is a normalized path. The file's own `path` is the key.
488
492
  */
489
493
  getFile(filePath) {
490
- return __classPrivateFieldGet(this, _GenerateContext_files, "f").get((0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(filePath));
494
+ return (0, getByWorkspacePath_js_1.getByWorkspacePath)(__classPrivateFieldGet(this, _GenerateContext_files, "f"), filePath);
495
+ }
496
+ /**
497
+ * The file whose normalized path is `path`, or `undefined`. A normalized
498
+ * path is a key as it is, so a miss is not normalized again, as it is in
499
+ * {@link getFile}: there is no file there in any spelling.
500
+ */
501
+ getFileByWorkspacePath(path) {
502
+ return __classPrivateFieldGet(this, _GenerateContext_files, "f").get(path);
491
503
  }
492
504
  /**
493
505
  * Read-only view of every file generated so far, keyed by (normalized)
@@ -506,7 +518,8 @@ class GenerateContext {
506
518
  * Store a language-constructed file. The engine never constructs a
507
519
  * concrete (language) `File`; the language's `register` builds its own
508
520
  * `FileBase` subclass and hands it in here. Throws if a file already
509
- * exists at the (normalized) path. Returns the stored file, so
521
+ * exists at the (normalized) path. Sets `file.path` to that normalized
522
+ * path, the file's key. Returns the stored file, so
510
523
  * get-or-create is a single expression at the call site
511
524
  * (`context.getFile(path) ?? context.addFile(new KtFile({ … }))`).
512
525
  */
@@ -523,6 +536,7 @@ class GenerateContext {
523
536
  if (existingPath !== undefined) {
524
537
  throw new Error(`File '${normalizedPath}' differs from '${existingPath}' only in case. On a file system that ignores case, as macOS's and Windows' do by default, they are one file.`);
525
538
  }
539
+ file.path = normalizedPath;
526
540
  __classPrivateFieldGet(this, _GenerateContext_files, "f").set(normalizedPath, file);
527
541
  __classPrivateFieldGet(this, _GenerateContext_foldedPaths, "f").set(foldedPath, normalizedPath);
528
542
  return file;
@@ -534,12 +548,8 @@ class GenerateContext {
534
548
  * @param args - Registration arguments with destination path and JSON content
535
549
  */
536
550
  registerJson({ destinationPath, json }) {
537
- const normalizedPath = (0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(destinationPath);
538
- let currentFile = this.getFile(normalizedPath);
539
- if (!currentFile) {
540
- currentFile = new JsonFile_js_1.JsonFile({ path: normalizedPath, content: {} });
541
- this.addFile(currentFile);
542
- }
551
+ const currentFile = this.getFile(destinationPath) ??
552
+ this.addFile(new JsonFile_js_1.JsonFile({ path: (0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(destinationPath), content: {} }));
543
553
  (0, tiny_invariant_1.default)(currentFile instanceof JsonFile_js_1.JsonFile, `File at "${destinationPath}" is not a "JsonFile" type`);
544
554
  currentFile.content = json;
545
555
  }
@@ -553,12 +563,8 @@ class GenerateContext {
553
563
  * @experimental This method is experimental and may change in future versions
554
564
  */
555
565
  registerMarkdown({ destinationPath, markdown }) {
556
- const normalizedPath = (0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(destinationPath);
557
- let currentFile = this.getFile(normalizedPath);
558
- if (!currentFile) {
559
- currentFile = new MarkdownFile_js_1.MarkdownFile({ path: normalizedPath, content: '' });
560
- this.addFile(currentFile);
561
- }
566
+ const currentFile = this.getFile(destinationPath) ??
567
+ this.addFile(new MarkdownFile_js_1.MarkdownFile({ path: (0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(destinationPath), content: '' }));
562
568
  (0, tiny_invariant_1.default)(currentFile instanceof MarkdownFile_js_1.MarkdownFile, `File at "${destinationPath}" is not a "MarkdownFile" type`);
563
569
  currentFile.content = markdown;
564
570
  }
@@ -574,14 +580,13 @@ class GenerateContext {
574
580
  * @mutates this.files
575
581
  */
576
582
  register({ imports = [], reExports = [], definitions, custom, destinationPath, into }) {
577
- const normalizedPath = (0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(destinationPath);
578
- const currentFile = this.getFile(normalizedPath);
583
+ const currentFile = this.getFile(destinationPath);
579
584
  // `register` never creates files — it speaks pure data and the engine
580
585
  // never names a file class. Callers pre-create the destination file
581
586
  // through their language (the lang package's register function, the
582
587
  // Drivers' ensureFile); reaching a file-miss here is a bug at the
583
588
  // caller.
584
- (0, tiny_invariant_1.default)(currentFile, `Cannot register into '${normalizedPath}' — the file does not exist. ` +
589
+ (0, tiny_invariant_1.default)(currentFile, () => `Cannot register into '${(0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(destinationPath)}' — the file does not exist. ` +
585
590
  `Pre-create it through your lang (its register function does this).`);
586
591
  // `custom` is language-neutral — it lives on `FileBase`, so any file
587
592
  // (code or not, e.g. a JSON/Markdown file) can receive it. Last
@@ -603,7 +608,7 @@ class GenerateContext {
603
608
  const placesADefinition = definitions?.some(definition => definition !== undefined) ?? false;
604
609
  const place = into === undefined || !placesADefinition
605
610
  ? currentFile
606
- : __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toContainer).call(this, currentFile, into, normalizedPath);
611
+ : __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toContainer).call(this, currentFile, into, currentFile.path);
607
612
  definitions?.forEach(definition => {
608
613
  if (definition) {
609
614
  place.addDefinition(definition);
@@ -679,17 +684,18 @@ class GenerateContext {
679
684
  // the use site (same ephemeral read the Drivers make) — pre-creates
680
685
  // the destination file caller-side, and stores via the pure-data
681
686
  // `register`.
682
- const normalizedPath = (0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(destinationPath);
683
- if (!this.getFile(normalizedPath)) {
684
- this.addFile(projection.lang.createFile({ path: normalizedPath, settings: this.settings }));
685
- }
687
+ const file = this.getFile(destinationPath) ??
688
+ this.addFile(projection.lang.createFile({
689
+ path: (0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(destinationPath),
690
+ settings: this.settings
691
+ }));
686
692
  const definition = projection.lang.toDefinition({
687
693
  context: this,
688
694
  identifier: projection.createIdentifier(fallbackName),
689
695
  value,
690
696
  noExport: insertOptions.noExport
691
697
  });
692
- this.register({ definitions: [definition], destinationPath: normalizedPath });
698
+ this.register({ definitions: [definition], destinationPath: file.path });
693
699
  // @TODO Using mapped types would help avoid generics casting
694
700
  return definition;
695
701
  }
@@ -766,10 +772,10 @@ class GenerateContext {
766
772
  }),
767
773
  ...args.projection.toIdentifierType(args.operation, this)
768
774
  }),
769
- exportPath: __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toContentSettingsExportPath).call(this,
770
- // A member has no file of its own: the Driver passes its container's.
771
- args.exportPath ??
772
- args.projection.toExportPath({
775
+ // A member has no file of its own: the Driver passes its container's,
776
+ // which is a finished export path (normalized, suffixed, ejected).
777
+ exportPath: args.exportPath ??
778
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toContentSettingsExportPath).call(this, args.projection.toExportPath({
773
779
  operation: args.operation,
774
780
  enrichments,
775
781
  variant,
@@ -1242,14 +1248,14 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_failedItems = new WeakM
1242
1248
  source
1243
1249
  };
1244
1250
  }, _GenerateContext_toContentSettingsExportPath = function _GenerateContext_toContentSettingsExportPath(exportPath, generatorId) {
1245
- const suffixed = (0, applyGeneratedSuffix_js_1.applyGeneratedSuffix)((0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(exportPath, { generatorId }), this.settings?.generatedSuffix ?? applyGeneratedSuffix_js_1.DEFAULT_GENERATED_SUFFIX);
1251
+ const suffixed = (0, normalizeWorkspacePath_js_1.applyGeneratedSuffixToWorkspacePath)((0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(exportPath, { generatorId }), this.settings?.generatedSuffix ?? applyGeneratedSuffix_js_1.DEFAULT_GENERATED_SUFFIX, { generatorId });
1246
1252
  return __classPrivateFieldGet(this, _GenerateContext_instances, "a", _GenerateContext_ejectedBySuffixedPath_get).get(suffixed) ?? suffixed;
1247
1253
  }, _GenerateContext_ejectedBySuffixedPath_get = function _GenerateContext_ejectedBySuffixedPath_get() {
1248
1254
  if (__classPrivateFieldGet(this, _GenerateContext_ejectedBySuffixedPathCache, "f") === undefined) {
1249
1255
  const suffix = this.settings?.generatedSuffix ?? applyGeneratedSuffix_js_1.DEFAULT_GENERATED_SUFFIX;
1250
1256
  __classPrivateFieldSet(this, _GenerateContext_ejectedBySuffixedPathCache, new Map((this.settings?.ejected ?? []).map(ejectedPath => {
1251
1257
  const normalized = (0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(ejectedPath);
1252
- return [(0, applyGeneratedSuffix_js_1.applyGeneratedSuffix)(normalized, suffix), normalized];
1258
+ return [(0, normalizeWorkspacePath_js_1.applyGeneratedSuffixToWorkspacePath)(normalized, suffix), normalized];
1253
1259
  })), "f");
1254
1260
  }
1255
1261
  return __classPrivateFieldGet(this, _GenerateContext_ejectedBySuffixedPathCache, "f");
@@ -72,7 +72,7 @@ type ConstructorArgs = {
72
72
  options?: {
73
73
  gql?: GqlParseOptions;
74
74
  };
75
- /** `client.json#settings.system`: how the OpenAPI parsers treat what they cannot read faithfully. */
75
+ /** `skmtc.config.json#settings.parse`: how the OpenAPI parsers treat what they cannot read faithfully. */
76
76
  system?: SystemSettings;
77
77
  };
78
78
  export declare class ParseContext {
@@ -90,7 +90,7 @@ export declare class ParseContext {
90
90
  currentStackTrail: StackTrail | undefined;
91
91
  /**
92
92
  * How the OpenAPI parsers treat what they cannot read faithfully
93
- * (`client.json#settings.system`). Each setting left out is `strict`.
93
+ * (`skmtc.config.json#settings.parse`). Each setting left out is `strict`.
94
94
  */
95
95
  system: SystemSettings;
96
96
  constructor({ input, logger, silent, options, system }: ConstructorArgs);
@@ -102,7 +102,7 @@ export declare class ParseContext {
102
102
  get oasDocument(): OasDocument;
103
103
  /** OAS-only accessor; symmetric reason to {@link oasDocument}. */
104
104
  get documentObject(): OpenAPIV3.Document;
105
- /** The refs of the document that a merge keeps as refs (`system.intersections`); `undefined` under `merge`. */
105
+ /** The refs of the document that a merge keeps as refs (`parse.intersections`); `undefined` under `merge`. */
106
106
  get keptRefs(): KeptRefs | undefined;
107
107
  /** GQL-only accessor; throws if called on an OAS context. */
108
108
  get schema(): GraphQLSchema;
@@ -180,7 +180,7 @@ export declare class ParseContext {
180
180
  * What a merge reads in place of a `$ref` that names nothing: an `allOf`
181
181
  * member, or in a `oneOf` or `anyOf`, a member's own `allOf` member or a
182
182
  * member merged with the keywords beside the union. When
183
- * `system.danglingRefs` lists `allOfMember`, it is `{}`, which
183
+ * `parse.danglingRefs` lists `allOfMember`, it is `{}`, which
184
184
  * adds nothing to the merge (`A & unknown` is `A`), and a `DANGLING_REF`
185
185
  * warning at `stackTrail`: the model has no properties from that member.
186
186
  * Otherwise it throws `DanglingRefError`, and what holds the `allOf` is
@@ -150,7 +150,7 @@ class ParseContext {
150
150
  });
151
151
  /**
152
152
  * How the OpenAPI parsers treat what they cannot read faithfully
153
- * (`client.json#settings.system`). Each setting left out is `strict`.
153
+ * (`skmtc.config.json#settings.parse`). Each setting left out is `strict`.
154
154
  */
155
155
  Object.defineProperty(this, "system", {
156
156
  enumerable: true,
@@ -242,7 +242,7 @@ class ParseContext {
242
242
  }
243
243
  return this.protocol.documentObject;
244
244
  }
245
- /** The refs of the document that a merge keeps as refs (`system.intersections`); `undefined` under `merge`. */
245
+ /** The refs of the document that a merge keeps as refs (`parse.intersections`); `undefined` under `merge`. */
246
246
  get keptRefs() {
247
247
  __classPrivateFieldSet(this, _ParseContext_keptRefs, __classPrivateFieldGet(this, _ParseContext_keptRefs, "f") ?? {
248
248
  value: (0, keptRefs_js_1.toKeptRefs)({ documentObject: this.documentObject, setting: this.system.intersections })
@@ -461,7 +461,7 @@ class ParseContext {
461
461
  * What a merge reads in place of a `$ref` that names nothing: an `allOf`
462
462
  * member, or in a `oneOf` or `anyOf`, a member's own `allOf` member or a
463
463
  * member merged with the keywords beside the union. When
464
- * `system.danglingRefs` lists `allOfMember`, it is `{}`, which
464
+ * `parse.danglingRefs` lists `allOfMember`, it is `{}`, which
465
465
  * adds nothing to the merge (`A & unknown` is `A`), and a `DANGLING_REF`
466
466
  * warning at `stackTrail`: the model has no properties from that member.
467
467
  * Otherwise it throws `DanglingRefError`, and what holds the `allOf` is
@@ -474,7 +474,7 @@ class ParseContext {
474
474
  }
475
475
  this.logIssueNoKey({
476
476
  level: 'warning',
477
- message: `${error.message}. It is left out of the allOf merge (system.danglingRefs lists 'allOfMember').`,
477
+ message: `${error.message}. It is left out of the allOf merge (parse.danglingRefs lists 'allOfMember').`,
478
478
  parent: { $ref: error.ref },
479
479
  stackTrail,
480
480
  type: 'DANGLING_REF'
@@ -831,7 +831,7 @@ _ParseContext_refConsumers = new WeakMap(), _ParseContext_refErrors = new WeakMa
831
831
  else if (this.system.danglingRefs?.includes(ref.refType)) {
832
832
  this.logIssueNoKey({
833
833
  level: 'warning',
834
- message: `${error.message}. It is kept (system.danglingRefs lists '${ref.refType}'), and resolving it throws DanglingRefError.`,
834
+ message: `${error.message}. It is kept (parse.danglingRefs lists '${ref.refType}'), and resolving it throws DanglingRefError.`,
835
835
  parent: { $ref: ref.$ref },
836
836
  stackTrail: consumer,
837
837
  type: 'DANGLING_REF'
@@ -844,7 +844,7 @@ _ParseContext_refConsumers = new WeakMap(), _ParseContext_refErrors = new WeakMa
844
844
  refTarget,
845
845
  error,
846
846
  type: 'DANGLING_REF',
847
- message: `${error.message}, so what holds it is removed. To keep it, list '${ref.refType}' in system.danglingRefs.`
847
+ message: `${error.message}, so what holds it is removed. To keep it, list '${ref.refType}' in parse.danglingRefs.`
848
848
  });
849
849
  }
850
850
  }
@@ -132,8 +132,9 @@ export declare class RenderContext {
132
132
  /**
133
133
  * Retrieves a file from the context by its export path.
134
134
  *
135
- * The path is canonicalized first ({@link normalizeWorkspacePath}), so any
136
- * spelling of the same export path finds the same file. Throws when no
135
+ * A path that is no key is canonicalized ({@link normalizeWorkspacePath})
136
+ * and looked up again, so any spelling of the same export path finds the
137
+ * same file. Throws when no
137
138
  * file exists at that path.
138
139
  *
139
140
  * @param filePath - The export path to retrieve, in any spelling
@@ -17,6 +17,7 @@ var _RenderContext_captureChannel, _RenderContext_capture;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.RenderContext = void 0;
19
19
  const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
20
+ const getByWorkspacePath_js_1 = require("../helpers/getByWorkspacePath.js");
20
21
  const normalizeWorkspacePath_js_1 = require("../helpers/normalizeWorkspacePath.js");
21
22
  const toResolvedArtifactPath_js_1 = require("../helpers/toResolvedArtifactPath.js");
22
23
  const CodeFileBase_js_1 = require("../dsl/CodeFileBase.js");
@@ -250,8 +251,9 @@ class RenderContext {
250
251
  /**
251
252
  * Retrieves a file from the context by its export path.
252
253
  *
253
- * The path is canonicalized first ({@link normalizeWorkspacePath}), so any
254
- * spelling of the same export path finds the same file. Throws when no
254
+ * A path that is no key is canonicalized ({@link normalizeWorkspacePath})
255
+ * and looked up again, so any spelling of the same export path finds the
256
+ * same file. Throws when no
255
257
  * file exists at that path.
256
258
  *
257
259
  * @param filePath - The export path to retrieve, in any spelling
@@ -269,9 +271,8 @@ class RenderContext {
269
271
  * ```
270
272
  */
271
273
  getFile(filePath) {
272
- const normalizedPath = (0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(filePath);
273
- const currentFile = this.files.get(normalizedPath);
274
- (0, tiny_invariant_1.default)(currentFile, `File not found during render phase: ${normalizedPath}`);
274
+ const currentFile = (0, getByWorkspacePath_js_1.getByWorkspacePath)(this.files, filePath);
275
+ (0, tiny_invariant_1.default)(currentFile, () => `File not found during render phase: ${(0, normalizeWorkspacePath_js_1.normalizeWorkspacePath)(filePath)}`);
275
276
  return currentFile;
276
277
  }
277
278
  /**