@wp-typia/project-tools 0.22.10 → 0.23.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 (155) hide show
  1. package/dist/runtime/ai-feature-artifacts.js +4 -1
  2. package/dist/runtime/block-generator-service-spec.js +2 -1
  3. package/dist/runtime/cli-add-block-json.js +5 -1
  4. package/dist/runtime/cli-add-collision.d.ts +25 -0
  5. package/dist/runtime/cli-add-collision.js +76 -0
  6. package/dist/runtime/cli-add-help.js +12 -2
  7. package/dist/runtime/cli-add-kind-ids.d.ts +1 -1
  8. package/dist/runtime/cli-add-kind-ids.js +3 -0
  9. package/dist/runtime/cli-add-types.d.ts +129 -0
  10. package/dist/runtime/cli-add-types.js +26 -0
  11. package/dist/runtime/cli-add-validation.d.ts +97 -1
  12. package/dist/runtime/cli-add-validation.js +313 -1
  13. package/dist/runtime/cli-add-workspace-ability-scaffold.js +4 -1
  14. package/dist/runtime/cli-add-workspace-admin-view-scaffold.js +79 -20
  15. package/dist/runtime/cli-add-workspace-admin-view-source.js +11 -2
  16. package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.d.ts +34 -0
  17. package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.js +483 -0
  18. package/dist/runtime/cli-add-workspace-admin-view-templates-default.d.ts +30 -0
  19. package/dist/runtime/cli-add-workspace-admin-view-templates-default.js +310 -0
  20. package/dist/runtime/cli-add-workspace-admin-view-templates-rest.d.ts +25 -0
  21. package/dist/runtime/cli-add-workspace-admin-view-templates-rest.js +124 -0
  22. package/dist/runtime/cli-add-workspace-admin-view-templates-settings.d.ts +34 -0
  23. package/dist/runtime/cli-add-workspace-admin-view-templates-settings.js +370 -0
  24. package/dist/runtime/cli-add-workspace-admin-view-templates-shared.d.ts +49 -0
  25. package/dist/runtime/cli-add-workspace-admin-view-templates-shared.js +259 -0
  26. package/dist/runtime/cli-add-workspace-admin-view-templates.d.ts +19 -10
  27. package/dist/runtime/cli-add-workspace-admin-view-templates.js +31 -971
  28. package/dist/runtime/cli-add-workspace-admin-view-types.d.ts +21 -0
  29. package/dist/runtime/cli-add-workspace-admin-view-types.js +22 -0
  30. package/dist/runtime/cli-add-workspace-ai-anchors.js +125 -32
  31. package/dist/runtime/cli-add-workspace-ai-source-emitters.js +17 -1
  32. package/dist/runtime/cli-add-workspace-contract-source-emitters.d.ts +15 -0
  33. package/dist/runtime/cli-add-workspace-contract-source-emitters.js +42 -0
  34. package/dist/runtime/cli-add-workspace-contract.d.ts +15 -0
  35. package/dist/runtime/cli-add-workspace-contract.js +65 -0
  36. package/dist/runtime/cli-add-workspace-integration-env.d.ts +26 -0
  37. package/dist/runtime/cli-add-workspace-integration-env.js +428 -0
  38. package/dist/runtime/cli-add-workspace-post-meta-anchors.d.ts +23 -0
  39. package/dist/runtime/cli-add-workspace-post-meta-anchors.js +244 -0
  40. package/dist/runtime/cli-add-workspace-post-meta-source-emitters.d.ts +63 -0
  41. package/dist/runtime/cli-add-workspace-post-meta-source-emitters.js +179 -0
  42. package/dist/runtime/cli-add-workspace-post-meta.d.ts +15 -0
  43. package/dist/runtime/cli-add-workspace-post-meta.js +107 -0
  44. package/dist/runtime/cli-add-workspace-rest-anchors.d.ts +9 -0
  45. package/dist/runtime/cli-add-workspace-rest-anchors.js +326 -21
  46. package/dist/runtime/cli-add-workspace-rest-generated.d.ts +9 -0
  47. package/dist/runtime/cli-add-workspace-rest-generated.js +158 -0
  48. package/dist/runtime/cli-add-workspace-rest-manual.d.ts +8 -0
  49. package/dist/runtime/cli-add-workspace-rest-manual.js +279 -0
  50. package/dist/runtime/cli-add-workspace-rest-php-templates.d.ts +24 -0
  51. package/dist/runtime/cli-add-workspace-rest-php-templates.js +678 -0
  52. package/dist/runtime/cli-add-workspace-rest-source-emitters.d.ts +98 -2
  53. package/dist/runtime/cli-add-workspace-rest-source-emitters.js +323 -29
  54. package/dist/runtime/cli-add-workspace-rest-types.d.ts +108 -0
  55. package/dist/runtime/cli-add-workspace-rest-types.js +1 -0
  56. package/dist/runtime/cli-add-workspace-rest.d.ts +3 -7
  57. package/dist/runtime/cli-add-workspace-rest.js +34 -481
  58. package/dist/runtime/cli-add-workspace.d.ts +15 -0
  59. package/dist/runtime/cli-add-workspace.js +15 -0
  60. package/dist/runtime/cli-add.d.ts +1 -1
  61. package/dist/runtime/cli-add.js +1 -1
  62. package/dist/runtime/cli-core.d.ts +3 -2
  63. package/dist/runtime/cli-core.js +3 -2
  64. package/dist/runtime/cli-diagnostics.d.ts +3 -1
  65. package/dist/runtime/cli-diagnostics.js +17 -5
  66. package/dist/runtime/cli-doctor-environment.js +1 -3
  67. package/dist/runtime/cli-doctor-workspace-bindings.js +4 -1
  68. package/dist/runtime/cli-doctor-workspace-block-addons.d.ts +12 -0
  69. package/dist/runtime/cli-doctor-workspace-block-addons.js +134 -0
  70. package/dist/runtime/cli-doctor-workspace-block-iframe.d.ts +9 -0
  71. package/dist/runtime/cli-doctor-workspace-block-iframe.js +228 -0
  72. package/dist/runtime/cli-doctor-workspace-block-metadata.d.ts +11 -0
  73. package/dist/runtime/cli-doctor-workspace-block-metadata.js +111 -0
  74. package/dist/runtime/cli-doctor-workspace-blocks.js +6 -424
  75. package/dist/runtime/cli-doctor-workspace-features-abilities.d.ts +11 -0
  76. package/dist/runtime/cli-doctor-workspace-features-abilities.js +112 -0
  77. package/dist/runtime/cli-doctor-workspace-features-admin-views.d.ts +11 -0
  78. package/dist/runtime/cli-doctor-workspace-features-admin-views.js +128 -0
  79. package/dist/runtime/cli-doctor-workspace-features-ai.d.ts +11 -0
  80. package/dist/runtime/cli-doctor-workspace-features-ai.js +57 -0
  81. package/dist/runtime/cli-doctor-workspace-features-editor-plugins.d.ts +11 -0
  82. package/dist/runtime/cli-doctor-workspace-features-editor-plugins.js +80 -0
  83. package/dist/runtime/cli-doctor-workspace-features-post-meta.d.ts +11 -0
  84. package/dist/runtime/cli-doctor-workspace-features-post-meta.js +77 -0
  85. package/dist/runtime/cli-doctor-workspace-features-rest.d.ts +11 -0
  86. package/dist/runtime/cli-doctor-workspace-features-rest.js +120 -0
  87. package/dist/runtime/cli-doctor-workspace-features.js +14 -369
  88. package/dist/runtime/cli-doctor-workspace-package.d.ts +25 -3
  89. package/dist/runtime/cli-doctor-workspace-package.js +35 -13
  90. package/dist/runtime/cli-doctor-workspace-shared.d.ts +2 -0
  91. package/dist/runtime/cli-doctor-workspace-shared.js +2 -0
  92. package/dist/runtime/cli-doctor-workspace.js +8 -3
  93. package/dist/runtime/cli-doctor.d.ts +52 -3
  94. package/dist/runtime/cli-doctor.js +79 -8
  95. package/dist/runtime/cli-help.js +10 -0
  96. package/dist/runtime/cli-init-package-json.js +4 -2
  97. package/dist/runtime/cli-init-templates.js +11 -1
  98. package/dist/runtime/cli-prompt.d.ts +16 -2
  99. package/dist/runtime/cli-prompt.js +29 -12
  100. package/dist/runtime/cli-scaffold.d.ts +2 -1
  101. package/dist/runtime/cli-scaffold.js +19 -10
  102. package/dist/runtime/contract-artifacts.d.ts +14 -0
  103. package/dist/runtime/contract-artifacts.js +15 -0
  104. package/dist/runtime/external-template-guards.js +4 -6
  105. package/dist/runtime/index.d.ts +2 -2
  106. package/dist/runtime/index.js +1 -1
  107. package/dist/runtime/json-utils.d.ts +62 -4
  108. package/dist/runtime/json-utils.js +78 -4
  109. package/dist/runtime/local-dev-presets.js +4 -1
  110. package/dist/runtime/migration-ui-capability.js +4 -1
  111. package/dist/runtime/migration-utils.js +4 -1
  112. package/dist/runtime/package-managers.js +6 -1
  113. package/dist/runtime/package-versions.js +6 -1
  114. package/dist/runtime/rest-resource-artifacts.d.ts +57 -1
  115. package/dist/runtime/rest-resource-artifacts.js +97 -1
  116. package/dist/runtime/scaffold-bootstrap.js +7 -2
  117. package/dist/runtime/scaffold-package-manager-files.js +5 -1
  118. package/dist/runtime/scaffold-repository-reference.js +4 -2
  119. package/dist/runtime/scaffold-template-variables.js +2 -1
  120. package/dist/runtime/scaffold.d.ts +18 -1
  121. package/dist/runtime/scaffold.js +55 -2
  122. package/dist/runtime/temp-roots.js +4 -1
  123. package/dist/runtime/template-layers.js +4 -1
  124. package/dist/runtime/template-registry.js +9 -3
  125. package/dist/runtime/template-render.d.ts +1 -1
  126. package/dist/runtime/template-render.js +1 -1
  127. package/dist/runtime/template-source-cache-markers.d.ts +37 -0
  128. package/dist/runtime/template-source-cache-markers.js +125 -0
  129. package/dist/runtime/template-source-cache.d.ts +1 -4
  130. package/dist/runtime/template-source-cache.js +16 -122
  131. package/dist/runtime/template-source-contracts.d.ts +2 -0
  132. package/dist/runtime/template-source-external.d.ts +4 -2
  133. package/dist/runtime/template-source-external.js +4 -2
  134. package/dist/runtime/template-source-normalization.js +2 -1
  135. package/dist/runtime/template-source-remote.d.ts +8 -4
  136. package/dist/runtime/template-source-remote.js +26 -9
  137. package/dist/runtime/template-source-seeds.js +10 -3
  138. package/dist/runtime/workspace-inventory-mutations.js +54 -4
  139. package/dist/runtime/workspace-inventory-parser-entries.d.ts +17 -0
  140. package/dist/runtime/workspace-inventory-parser-entries.js +157 -0
  141. package/dist/runtime/workspace-inventory-parser-validation.d.ts +104 -0
  142. package/dist/runtime/workspace-inventory-parser-validation.js +34 -0
  143. package/dist/runtime/workspace-inventory-parser.d.ts +3 -44
  144. package/dist/runtime/workspace-inventory-parser.js +7 -464
  145. package/dist/runtime/workspace-inventory-read.d.ts +9 -2
  146. package/dist/runtime/workspace-inventory-read.js +9 -2
  147. package/dist/runtime/workspace-inventory-section-descriptors.d.ts +19 -0
  148. package/dist/runtime/workspace-inventory-section-descriptors.js +435 -0
  149. package/dist/runtime/workspace-inventory-templates.d.ts +16 -1
  150. package/dist/runtime/workspace-inventory-templates.js +75 -4
  151. package/dist/runtime/workspace-inventory-types.d.ts +52 -2
  152. package/dist/runtime/workspace-inventory.d.ts +2 -2
  153. package/dist/runtime/workspace-inventory.js +1 -1
  154. package/dist/runtime/workspace-project.js +4 -6
  155. package/package.json +2 -2
@@ -1,468 +1,7 @@
1
1
  import ts from "typescript";
2
- import { REST_RESOURCE_METHOD_IDS } from "./cli-add-shared.js";
3
- import { getPropertyNameText } from "./ts-property-names.js";
4
- import { ABILITY_CONFIG_ENTRY_MARKER, ABILITIES_CONST_SECTION, ABILITIES_INTERFACE_SECTION, ADMIN_VIEW_CONFIG_ENTRY_MARKER, ADMIN_VIEWS_CONST_SECTION, ADMIN_VIEWS_INTERFACE_SECTION, AI_FEATURES_CONST_SECTION, AI_FEATURES_INTERFACE_SECTION, AI_FEATURE_CONFIG_ENTRY_MARKER, BINDING_SOURCES_CONST_SECTION, BINDING_SOURCES_INTERFACE_SECTION, BINDING_SOURCE_CONFIG_ENTRY_MARKER, BLOCK_CONFIG_ENTRY_MARKER, BLOCK_STYLES_CONST_SECTION, BLOCK_STYLES_INTERFACE_SECTION, BLOCK_STYLE_CONFIG_ENTRY_MARKER, BLOCK_TRANSFORMS_CONST_SECTION, BLOCK_TRANSFORMS_INTERFACE_SECTION, BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER, EDITOR_PLUGINS_CONST_SECTION, EDITOR_PLUGINS_INTERFACE_SECTION, EDITOR_PLUGIN_CONFIG_ENTRY_MARKER, PATTERNS_CONST_SECTION, PATTERNS_INTERFACE_SECTION, PATTERN_CONFIG_ENTRY_MARKER, REST_RESOURCES_CONST_SECTION, REST_RESOURCES_INTERFACE_SECTION, REST_RESOURCE_CONFIG_ENTRY_MARKER, VARIATIONS_CONST_SECTION, VARIATIONS_INTERFACE_SECTION, VARIATION_CONFIG_ENTRY_MARKER, } from "./workspace-inventory-templates.js";
5
- function defineInventoryEntryParser() {
6
- return (descriptor) => descriptor;
7
- }
8
- export const BLOCK_INVENTORY_SECTION = {
9
- append: {
10
- marker: BLOCK_CONFIG_ENTRY_MARKER,
11
- optionKey: "blockEntries",
12
- },
13
- parse: {
14
- entriesKey: "blocks",
15
- entry: defineInventoryEntryParser()({
16
- entryName: "BLOCKS",
17
- fields: [
18
- { key: "apiTypesFile" },
19
- { key: "attributeTypeName" },
20
- { key: "openApiFile" },
21
- { key: "slug", required: true },
22
- { key: "typesFile", required: true },
23
- ],
24
- }),
25
- exportName: "BLOCKS",
26
- required: true,
27
- },
28
- };
29
- export const INVENTORY_SECTIONS = [
30
- {
31
- append: {
32
- marker: VARIATION_CONFIG_ENTRY_MARKER,
33
- optionKey: "variationEntries",
34
- },
35
- interface: {
36
- name: "WorkspaceVariationConfig",
37
- section: VARIATIONS_INTERFACE_SECTION,
38
- },
39
- parse: {
40
- entriesKey: "variations",
41
- entry: defineInventoryEntryParser()({
42
- entryName: "VARIATIONS",
43
- fields: [
44
- { key: "block", required: true },
45
- { key: "file", required: true },
46
- { key: "slug", required: true },
47
- ],
48
- }),
49
- hasSectionKey: "hasVariationsSection",
50
- },
51
- value: {
52
- name: "VARIATIONS",
53
- section: VARIATIONS_CONST_SECTION,
54
- },
55
- },
56
- {
57
- append: {
58
- marker: BLOCK_STYLE_CONFIG_ENTRY_MARKER,
59
- optionKey: "blockStyleEntries",
60
- },
61
- interface: {
62
- name: "WorkspaceBlockStyleConfig",
63
- section: BLOCK_STYLES_INTERFACE_SECTION,
64
- },
65
- parse: {
66
- entriesKey: "blockStyles",
67
- entry: defineInventoryEntryParser()({
68
- entryName: "BLOCK_STYLES",
69
- fields: [
70
- { key: "block", required: true },
71
- { key: "file", required: true },
72
- { key: "slug", required: true },
73
- ],
74
- }),
75
- hasSectionKey: "hasBlockStylesSection",
76
- },
77
- value: {
78
- name: "BLOCK_STYLES",
79
- section: BLOCK_STYLES_CONST_SECTION,
80
- },
81
- },
82
- {
83
- append: {
84
- marker: BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER,
85
- optionKey: "blockTransformEntries",
86
- },
87
- interface: {
88
- name: "WorkspaceBlockTransformConfig",
89
- section: BLOCK_TRANSFORMS_INTERFACE_SECTION,
90
- },
91
- parse: {
92
- entriesKey: "blockTransforms",
93
- entry: defineInventoryEntryParser()({
94
- entryName: "BLOCK_TRANSFORMS",
95
- fields: [
96
- { key: "block", required: true },
97
- { key: "file", required: true },
98
- { key: "from", required: true },
99
- { key: "slug", required: true },
100
- { key: "to", required: true },
101
- ],
102
- }),
103
- hasSectionKey: "hasBlockTransformsSection",
104
- },
105
- value: {
106
- name: "BLOCK_TRANSFORMS",
107
- section: BLOCK_TRANSFORMS_CONST_SECTION,
108
- },
109
- },
110
- {
111
- append: {
112
- marker: PATTERN_CONFIG_ENTRY_MARKER,
113
- optionKey: "patternEntries",
114
- },
115
- interface: {
116
- name: "WorkspacePatternConfig",
117
- section: PATTERNS_INTERFACE_SECTION,
118
- },
119
- parse: {
120
- entriesKey: "patterns",
121
- entry: defineInventoryEntryParser()({
122
- entryName: "PATTERNS",
123
- fields: [
124
- { key: "file", required: true },
125
- { key: "slug", required: true },
126
- ],
127
- }),
128
- hasSectionKey: "hasPatternsSection",
129
- },
130
- value: {
131
- name: "PATTERNS",
132
- section: PATTERNS_CONST_SECTION,
133
- },
134
- },
135
- {
136
- append: {
137
- marker: BINDING_SOURCE_CONFIG_ENTRY_MARKER,
138
- optionKey: "bindingSourceEntries",
139
- },
140
- interface: {
141
- name: "WorkspaceBindingSourceConfig",
142
- section: BINDING_SOURCES_INTERFACE_SECTION,
143
- },
144
- parse: {
145
- entriesKey: "bindingSources",
146
- entry: defineInventoryEntryParser()({
147
- entryName: "BINDING_SOURCES",
148
- fields: [
149
- { key: "attribute" },
150
- { key: "block" },
151
- { key: "editorFile", required: true },
152
- { key: "serverFile", required: true },
153
- { key: "slug", required: true },
154
- ],
155
- }),
156
- hasSectionKey: "hasBindingSourcesSection",
157
- },
158
- value: {
159
- name: "BINDING_SOURCES",
160
- section: BINDING_SOURCES_CONST_SECTION,
161
- },
162
- },
163
- {
164
- append: {
165
- marker: REST_RESOURCE_CONFIG_ENTRY_MARKER,
166
- optionKey: "restResourceEntries",
167
- },
168
- interface: {
169
- name: "WorkspaceRestResourceConfig",
170
- section: REST_RESOURCES_INTERFACE_SECTION,
171
- },
172
- parse: {
173
- entriesKey: "restResources",
174
- entry: defineInventoryEntryParser()({
175
- entryName: "REST_RESOURCES",
176
- fields: [
177
- { key: "apiFile", required: true },
178
- { key: "clientFile", required: true },
179
- { key: "dataFile", required: true },
180
- {
181
- key: "methods",
182
- kind: "stringArray",
183
- required: true,
184
- validate: (value, context) => {
185
- const methods = Array.isArray(value) ? value : [];
186
- const invalidMethods = methods.filter((method) => !REST_RESOURCE_METHOD_IDS.includes(method));
187
- if (invalidMethods.length > 0) {
188
- throw new Error(`${context.entryName}[${context.elementIndex}].${context.key} includes unsupported values: ${invalidMethods.join(", ")}.`);
189
- }
190
- },
191
- },
192
- { key: "namespace", required: true },
193
- { key: "openApiFile", required: true },
194
- { key: "phpFile", required: true },
195
- { key: "slug", required: true },
196
- { key: "typesFile", required: true },
197
- { key: "validatorsFile", required: true },
198
- ],
199
- }),
200
- hasSectionKey: "hasRestResourcesSection",
201
- },
202
- value: {
203
- name: "REST_RESOURCES",
204
- section: REST_RESOURCES_CONST_SECTION,
205
- },
206
- },
207
- {
208
- append: {
209
- marker: ABILITY_CONFIG_ENTRY_MARKER,
210
- optionKey: "abilityEntries",
211
- },
212
- interface: {
213
- name: "WorkspaceAbilityConfig",
214
- section: ABILITIES_INTERFACE_SECTION,
215
- },
216
- parse: {
217
- entriesKey: "abilities",
218
- entry: defineInventoryEntryParser()({
219
- entryName: "ABILITIES",
220
- fields: [
221
- { key: "clientFile", required: true },
222
- { key: "configFile", required: true },
223
- { key: "dataFile", required: true },
224
- { key: "inputSchemaFile", required: true },
225
- { key: "inputTypeName", required: true },
226
- { key: "outputSchemaFile", required: true },
227
- { key: "outputTypeName", required: true },
228
- { key: "phpFile", required: true },
229
- { key: "slug", required: true },
230
- { key: "typesFile", required: true },
231
- ],
232
- }),
233
- hasSectionKey: "hasAbilitiesSection",
234
- },
235
- value: {
236
- name: "ABILITIES",
237
- section: ABILITIES_CONST_SECTION,
238
- },
239
- },
240
- {
241
- append: {
242
- marker: AI_FEATURE_CONFIG_ENTRY_MARKER,
243
- optionKey: "aiFeatureEntries",
244
- },
245
- interface: {
246
- name: "WorkspaceAiFeatureConfig",
247
- section: AI_FEATURES_INTERFACE_SECTION,
248
- },
249
- parse: {
250
- entriesKey: "aiFeatures",
251
- entry: defineInventoryEntryParser()({
252
- entryName: "AI_FEATURES",
253
- fields: [
254
- { key: "aiSchemaFile", required: true },
255
- { key: "apiFile", required: true },
256
- { key: "clientFile", required: true },
257
- { key: "dataFile", required: true },
258
- { key: "namespace", required: true },
259
- { key: "openApiFile", required: true },
260
- { key: "phpFile", required: true },
261
- { key: "slug", required: true },
262
- { key: "typesFile", required: true },
263
- { key: "validatorsFile", required: true },
264
- ],
265
- }),
266
- hasSectionKey: "hasAiFeaturesSection",
267
- },
268
- value: {
269
- name: "AI_FEATURES",
270
- section: AI_FEATURES_CONST_SECTION,
271
- },
272
- },
273
- {
274
- append: {
275
- marker: ADMIN_VIEW_CONFIG_ENTRY_MARKER,
276
- optionKey: "adminViewEntries",
277
- },
278
- interface: {
279
- name: "WorkspaceAdminViewConfig",
280
- section: ADMIN_VIEWS_INTERFACE_SECTION,
281
- },
282
- parse: {
283
- entriesKey: "adminViews",
284
- entry: defineInventoryEntryParser()({
285
- entryName: "ADMIN_VIEWS",
286
- fields: [
287
- { key: "file", required: true },
288
- { key: "phpFile", required: true },
289
- { key: "slug", required: true },
290
- { key: "source" },
291
- ],
292
- }),
293
- hasSectionKey: "hasAdminViewsSection",
294
- },
295
- value: {
296
- name: "ADMIN_VIEWS",
297
- section: ADMIN_VIEWS_CONST_SECTION,
298
- },
299
- },
300
- {
301
- append: {
302
- marker: EDITOR_PLUGIN_CONFIG_ENTRY_MARKER,
303
- optionKey: "editorPluginEntries",
304
- },
305
- interface: {
306
- name: "WorkspaceEditorPluginConfig",
307
- section: EDITOR_PLUGINS_INTERFACE_SECTION,
308
- },
309
- parse: {
310
- entriesKey: "editorPlugins",
311
- entry: defineInventoryEntryParser()({
312
- entryName: "EDITOR_PLUGINS",
313
- fields: [
314
- { key: "file", required: true },
315
- { key: "slug", required: true },
316
- { key: "slot", required: true },
317
- ],
318
- }),
319
- hasSectionKey: "hasEditorPluginsSection",
320
- },
321
- value: {
322
- name: "EDITOR_PLUGINS",
323
- section: EDITOR_PLUGINS_CONST_SECTION,
324
- },
325
- },
326
- ];
327
- function findExportedArrayLiteral(sourceFile, exportName) {
328
- for (const statement of sourceFile.statements) {
329
- if (!ts.isVariableStatement(statement)) {
330
- continue;
331
- }
332
- if (!statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)) {
333
- continue;
334
- }
335
- for (const declaration of statement.declarationList.declarations) {
336
- if (!ts.isIdentifier(declaration.name) ||
337
- declaration.name.text !== exportName) {
338
- continue;
339
- }
340
- if (declaration.initializer &&
341
- ts.isArrayLiteralExpression(declaration.initializer)) {
342
- return {
343
- array: declaration.initializer,
344
- found: true,
345
- };
346
- }
347
- return {
348
- array: null,
349
- found: true,
350
- };
351
- }
352
- }
353
- return {
354
- array: null,
355
- found: false,
356
- };
357
- }
358
- function getOptionalStringProperty(entryName, elementIndex, objectLiteral, key) {
359
- for (const property of objectLiteral.properties) {
360
- if (!ts.isPropertyAssignment(property)) {
361
- continue;
362
- }
363
- const propertyName = getPropertyNameText(property.name);
364
- if (propertyName !== key) {
365
- continue;
366
- }
367
- if (ts.isStringLiteralLike(property.initializer)) {
368
- return property.initializer.text;
369
- }
370
- throw new Error(`${entryName}[${elementIndex}] must use a string literal for "${key}" in scripts/block-config.ts.`);
371
- }
372
- return undefined;
373
- }
374
- function getOptionalStringArrayProperty(entryName, elementIndex, objectLiteral, key) {
375
- for (const property of objectLiteral.properties) {
376
- if (!ts.isPropertyAssignment(property)) {
377
- continue;
378
- }
379
- const propertyName = getPropertyNameText(property.name);
380
- if (propertyName !== key) {
381
- continue;
382
- }
383
- if (!ts.isArrayLiteralExpression(property.initializer)) {
384
- throw new Error(`${entryName}[${elementIndex}] must use an array literal for "${key}" in scripts/block-config.ts.`);
385
- }
386
- return property.initializer.elements.map((element, itemIndex) => {
387
- if (!ts.isStringLiteralLike(element)) {
388
- throw new Error(`${entryName}[${elementIndex}].${key}[${itemIndex}] must use a string literal in scripts/block-config.ts.`);
389
- }
390
- return element.text;
391
- });
392
- }
393
- return undefined;
394
- }
395
- function isMissingRequiredInventoryValue(value) {
396
- return (value === undefined || (typeof value === "string" && value.length === 0));
397
- }
398
- function formatMissingRequiredInventoryFields(keys) {
399
- return keys.length === 1
400
- ? `required "${keys[0]}"`
401
- : `required fields ${keys.map((key) => `"${key}"`).join(", ")}`;
402
- }
403
- function assertParsedInventoryEntry(entry, descriptor, elementIndex) {
404
- const missingRequiredKeys = descriptor.fields
405
- .filter((field) => field.required === true &&
406
- isMissingRequiredInventoryValue(entry[field.key]))
407
- .map((field) => field.key);
408
- if (missingRequiredKeys.length > 0) {
409
- throw new Error(`${descriptor.entryName}[${elementIndex}] is missing ${formatMissingRequiredInventoryFields(missingRequiredKeys)} in scripts/block-config.ts.`);
410
- }
411
- }
412
- function parseInventoryEntries(arrayLiteral, descriptor) {
413
- return arrayLiteral.elements.map((element, elementIndex) => {
414
- if (!ts.isObjectLiteralExpression(element)) {
415
- throw new Error(`${descriptor.entryName}[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
416
- }
417
- const entry = {};
418
- for (const field of descriptor.fields) {
419
- const kind = field.kind ?? "string";
420
- const value = kind === "stringArray"
421
- ? getOptionalStringArrayProperty(descriptor.entryName, elementIndex, element, field.key)
422
- : getOptionalStringProperty(descriptor.entryName, elementIndex, element, field.key);
423
- field.validate?.(value, {
424
- elementIndex,
425
- entryName: descriptor.entryName,
426
- key: field.key,
427
- });
428
- entry[field.key] = value;
429
- }
430
- assertParsedInventoryEntry(entry, descriptor, elementIndex);
431
- return entry;
432
- });
433
- }
434
- function parseInventorySection(sourceFile, descriptor) {
435
- if (!descriptor.parse) {
436
- return {
437
- entries: [],
438
- found: false,
439
- };
440
- }
441
- const exportName = descriptor.parse.exportName ?? descriptor.value?.name;
442
- if (!exportName) {
443
- throw new Error("Inventory parser descriptor is missing an export name.");
444
- }
445
- const exportedArray = findExportedArrayLiteral(sourceFile, exportName);
446
- if (!exportedArray.found) {
447
- if (descriptor.parse.required) {
448
- throw new Error(`scripts/block-config.ts must export a ${exportName} array.`);
449
- }
450
- return {
451
- entries: [],
452
- found: false,
453
- };
454
- }
455
- if (!exportedArray.array) {
456
- if (descriptor.parse.required) {
457
- throw new Error(`scripts/block-config.ts must export a ${exportName} array.`);
458
- }
459
- throw new Error(`scripts/block-config.ts must export ${exportName} as an array literal.`);
460
- }
461
- return {
462
- entries: parseInventoryEntries(exportedArray.array, descriptor.parse.entry),
463
- found: true,
464
- };
465
- }
2
+ import { parseInventorySection } from "./workspace-inventory-parser-entries.js";
3
+ import { BLOCK_INVENTORY_SECTION, INVENTORY_SECTIONS, } from "./workspace-inventory-section-descriptors.js";
4
+ export { BLOCK_INVENTORY_SECTION, INVENTORY_SECTIONS, } from "./workspace-inventory-section-descriptors.js";
466
5
  /**
467
6
  * Parse workspace inventory entries from the source of `scripts/block-config.ts`.
468
7
  *
@@ -480,6 +19,7 @@ export function parseWorkspaceInventorySource(source) {
480
19
  blockStyles: [],
481
20
  blockTransforms: [],
482
21
  blocks: parseInventorySection(sourceFile, BLOCK_INVENTORY_SECTION).entries,
22
+ contracts: [],
483
23
  editorPlugins: [],
484
24
  hasAbilitiesSection: false,
485
25
  hasAdminViewsSection: false,
@@ -487,11 +27,14 @@ export function parseWorkspaceInventorySource(source) {
487
27
  hasBindingSourcesSection: false,
488
28
  hasBlockStylesSection: false,
489
29
  hasBlockTransformsSection: false,
30
+ hasContractsSection: false,
490
31
  hasEditorPluginsSection: false,
491
32
  hasPatternsSection: false,
33
+ hasPostMetaSection: false,
492
34
  hasRestResourcesSection: false,
493
35
  hasVariationsSection: false,
494
36
  patterns: [],
37
+ postMeta: [],
495
38
  restResources: [],
496
39
  source,
497
40
  variations: [],
@@ -6,6 +6,11 @@ import type { WorkspaceBlockSelectOption, WorkspaceInventory } from "./workspace
6
6
  * synchronous APIs. Prefer `readWorkspaceInventoryAsync()` from async command
7
7
  * paths so workspace reads do not block the event loop.
8
8
  *
9
+ * @deprecated Since 0.22.10. Use `readWorkspaceInventoryAsync()` from async
10
+ * command paths. Removal target: not currently scheduled; this sync
11
+ * compatibility helper remains available until release notes announce a
12
+ * versioned target.
13
+ *
9
14
  * @param projectDir Workspace root directory.
10
15
  * @returns Parsed `WorkspaceInventory` including the resolved `blockConfigPath`.
11
16
  * @throws {Error} When `scripts/block-config.ts` is missing or invalid.
@@ -25,8 +30,10 @@ export declare function readWorkspaceInventoryAsync(projectDir: string): Promise
25
30
  * The `description` field mirrors `block.typesFile`, while `name` and `value`
26
31
  * both map to the block slug for use in interactive add flows.
27
32
  *
28
- * @deprecated Use `getWorkspaceBlockSelectOptionsAsync()` from async command
29
- * paths. This helper intentionally remains sync-only for compatibility callers.
33
+ * @deprecated Since 0.22.10. Use `getWorkspaceBlockSelectOptionsAsync()` from
34
+ * async command paths. Removal target: not currently scheduled; this sync
35
+ * compatibility helper remains available until release notes announce a
36
+ * versioned target.
30
37
  *
31
38
  * @param projectDir Workspace root directory.
32
39
  * @returns Block options for variation-target selection.
@@ -10,6 +10,11 @@ import { parseWorkspaceInventorySource } from "./workspace-inventory-parser.js";
10
10
  * synchronous APIs. Prefer `readWorkspaceInventoryAsync()` from async command
11
11
  * paths so workspace reads do not block the event loop.
12
12
  *
13
+ * @deprecated Since 0.22.10. Use `readWorkspaceInventoryAsync()` from async
14
+ * command paths. Removal target: not currently scheduled; this sync
15
+ * compatibility helper remains available until release notes announce a
16
+ * versioned target.
17
+ *
13
18
  * @param projectDir Workspace root directory.
14
19
  * @returns Parsed `WorkspaceInventory` including the resolved `blockConfigPath`.
15
20
  * @throws {Error} When `scripts/block-config.ts` is missing or invalid.
@@ -68,8 +73,10 @@ function toWorkspaceBlockSelectOptions(blocks) {
68
73
  * The `description` field mirrors `block.typesFile`, while `name` and `value`
69
74
  * both map to the block slug for use in interactive add flows.
70
75
  *
71
- * @deprecated Use `getWorkspaceBlockSelectOptionsAsync()` from async command
72
- * paths. This helper intentionally remains sync-only for compatibility callers.
76
+ * @deprecated Since 0.22.10. Use `getWorkspaceBlockSelectOptionsAsync()` from
77
+ * async command paths. Removal target: not currently scheduled; this sync
78
+ * compatibility helper remains available until release notes announce a
79
+ * versioned target.
73
80
  *
74
81
  * @param projectDir Workspace root directory.
75
82
  * @returns Block options for variation-target selection.
@@ -0,0 +1,19 @@
1
+ import { type InventorySectionDescriptor } from "./workspace-inventory-parser-validation.js";
2
+ /**
3
+ * Descriptor for the required `BLOCKS` inventory section.
4
+ *
5
+ * Runtime readers use its `parse` contract to require the exported `BLOCKS`
6
+ * array and validate required block entry fields; mutation helpers use its
7
+ * `append` marker to insert generated block entries without duplicating section
8
+ * knowledge.
9
+ */
10
+ export declare const BLOCK_INVENTORY_SECTION: InventorySectionDescriptor;
11
+ /**
12
+ * Descriptors for optional workspace inventory sections beyond `BLOCKS`.
13
+ *
14
+ * Each descriptor centralizes append markers, exported interface/value repair
15
+ * sections, parser entry metadata such as `entriesKey` and `entryName`, and
16
+ * optional section flags so add, doctor, read, and mutation flows share one
17
+ * runtime contract when adding new inventory domains.
18
+ */
19
+ export declare const INVENTORY_SECTIONS: readonly InventorySectionDescriptor[];