@wp-typia/project-tools 0.16.11 → 0.16.13

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 (119) hide show
  1. package/README.md +9 -3
  2. package/dist/runtime/block-generator-service-core.d.ts +8 -0
  3. package/dist/runtime/block-generator-service-core.js +274 -0
  4. package/dist/runtime/block-generator-service-spec.d.ts +104 -0
  5. package/dist/runtime/block-generator-service-spec.js +139 -0
  6. package/dist/runtime/block-generator-service.d.ts +2 -110
  7. package/dist/runtime/block-generator-service.js +2 -389
  8. package/dist/runtime/built-in-block-artifact-documents.d.ts +3 -0
  9. package/dist/runtime/built-in-block-artifact-documents.js +2 -0
  10. package/dist/runtime/built-in-block-artifact-types.d.ts +51 -0
  11. package/dist/runtime/built-in-block-artifact-types.js +304 -0
  12. package/dist/runtime/built-in-block-artifacts.js +4 -803
  13. package/dist/runtime/built-in-block-attribute-emitters.d.ts +71 -0
  14. package/dist/runtime/built-in-block-attribute-emitters.js +176 -0
  15. package/dist/runtime/built-in-block-attribute-specs.d.ts +38 -0
  16. package/dist/runtime/built-in-block-attribute-specs.js +358 -0
  17. package/dist/runtime/built-in-block-code-templates/basic.d.ts +4 -0
  18. package/dist/runtime/built-in-block-code-templates/basic.js +249 -0
  19. package/dist/runtime/built-in-block-code-templates/compound-child.d.ts +4 -0
  20. package/dist/runtime/built-in-block-code-templates/compound-child.js +138 -0
  21. package/dist/runtime/built-in-block-code-templates/compound-parent.d.ts +6 -0
  22. package/dist/runtime/built-in-block-code-templates/compound-parent.js +227 -0
  23. package/dist/runtime/built-in-block-code-templates/compound-persistence.d.ts +4 -0
  24. package/dist/runtime/built-in-block-code-templates/compound-persistence.js +478 -0
  25. package/dist/runtime/built-in-block-code-templates/compound.d.ts +3 -0
  26. package/dist/runtime/built-in-block-code-templates/compound.js +3 -0
  27. package/dist/runtime/built-in-block-code-templates/interactivity.d.ts +5 -0
  28. package/dist/runtime/built-in-block-code-templates/interactivity.js +547 -0
  29. package/dist/runtime/built-in-block-code-templates/persistence.d.ts +5 -0
  30. package/dist/runtime/built-in-block-code-templates/persistence.js +550 -0
  31. package/dist/runtime/built-in-block-code-templates/shared.d.ts +16 -0
  32. package/dist/runtime/built-in-block-code-templates/shared.js +53 -0
  33. package/dist/runtime/built-in-block-code-templates.d.ts +5 -32
  34. package/dist/runtime/built-in-block-code-templates.js +5 -2230
  35. package/dist/runtime/cli-add-block-config.d.ts +6 -0
  36. package/dist/runtime/cli-add-block-config.js +143 -0
  37. package/dist/runtime/cli-add-block-legacy-validator.d.ts +4 -0
  38. package/dist/runtime/cli-add-block-legacy-validator.js +168 -0
  39. package/dist/runtime/cli-add-block.js +3 -301
  40. package/dist/runtime/cli-add-workspace-assets.d.ts +38 -0
  41. package/dist/runtime/cli-add-workspace-assets.js +399 -0
  42. package/dist/runtime/cli-add-workspace.d.ts +2 -38
  43. package/dist/runtime/cli-add-workspace.js +5 -396
  44. package/dist/runtime/cli-diagnostics.js +76 -4
  45. package/dist/runtime/cli-doctor-environment.d.ts +12 -0
  46. package/dist/runtime/cli-doctor-environment.js +123 -0
  47. package/dist/runtime/cli-doctor-workspace.d.ts +18 -0
  48. package/dist/runtime/cli-doctor-workspace.js +308 -0
  49. package/dist/runtime/cli-doctor.d.ts +4 -2
  50. package/dist/runtime/cli-doctor.js +10 -405
  51. package/dist/runtime/cli-help.js +1 -1
  52. package/dist/runtime/cli-scaffold.d.ts +8 -1
  53. package/dist/runtime/cli-scaffold.js +47 -4
  54. package/dist/runtime/migration-command-surface.d.ts +67 -0
  55. package/dist/runtime/migration-command-surface.js +189 -0
  56. package/dist/runtime/migration-diff-rename.d.ts +13 -0
  57. package/dist/runtime/migration-diff-rename.js +192 -0
  58. package/dist/runtime/migration-diff-transform.d.ts +14 -0
  59. package/dist/runtime/migration-diff-transform.js +105 -0
  60. package/dist/runtime/migration-diff.js +12 -297
  61. package/dist/runtime/migration-generated-artifacts.d.ts +3 -0
  62. package/dist/runtime/migration-generated-artifacts.js +41 -0
  63. package/dist/runtime/migration-maintenance-fixtures.d.ts +23 -0
  64. package/dist/runtime/migration-maintenance-fixtures.js +126 -0
  65. package/dist/runtime/migration-maintenance-verify.d.ts +26 -0
  66. package/dist/runtime/migration-maintenance-verify.js +262 -0
  67. package/dist/runtime/migration-maintenance.d.ts +2 -0
  68. package/dist/runtime/migration-maintenance.js +2 -0
  69. package/dist/runtime/migration-planning.d.ts +23 -0
  70. package/dist/runtime/migration-planning.js +131 -0
  71. package/dist/runtime/migration-project-config-source.d.ts +6 -0
  72. package/dist/runtime/migration-project-config-source.js +424 -0
  73. package/dist/runtime/migration-project-layout-discovery.d.ts +61 -0
  74. package/dist/runtime/migration-project-layout-discovery.js +337 -0
  75. package/dist/runtime/migration-project-layout-paths.d.ts +135 -0
  76. package/dist/runtime/migration-project-layout-paths.js +288 -0
  77. package/dist/runtime/migration-project-layout.d.ts +3 -0
  78. package/dist/runtime/migration-project-layout.js +2 -0
  79. package/dist/runtime/migration-project-workspace.d.ts +47 -0
  80. package/dist/runtime/migration-project-workspace.js +212 -0
  81. package/dist/runtime/migration-project.d.ts +4 -94
  82. package/dist/runtime/migration-project.js +3 -1101
  83. package/dist/runtime/migration-render-diff-rule.d.ts +5 -0
  84. package/dist/runtime/migration-render-diff-rule.js +120 -0
  85. package/dist/runtime/migration-render-execution.d.ts +3 -0
  86. package/dist/runtime/migration-render-execution.js +428 -0
  87. package/dist/runtime/migration-render-generated.d.ts +27 -0
  88. package/dist/runtime/migration-render-generated.js +230 -0
  89. package/dist/runtime/migration-render-support.d.ts +3 -0
  90. package/dist/runtime/migration-render-support.js +16 -0
  91. package/dist/runtime/migration-render.d.ts +3 -33
  92. package/dist/runtime/migration-render.js +3 -789
  93. package/dist/runtime/migrations.d.ts +24 -121
  94. package/dist/runtime/migrations.js +12 -700
  95. package/dist/runtime/scaffold-apply-utils.d.ts +9 -0
  96. package/dist/runtime/scaffold-apply-utils.js +27 -4
  97. package/dist/runtime/scaffold-bootstrap.d.ts +45 -0
  98. package/dist/runtime/scaffold-bootstrap.js +185 -0
  99. package/dist/runtime/scaffold-onboarding.d.ts +12 -0
  100. package/dist/runtime/scaffold-onboarding.js +42 -5
  101. package/dist/runtime/scaffold-package-manager-files.d.ts +35 -0
  102. package/dist/runtime/scaffold-package-manager-files.js +79 -0
  103. package/dist/runtime/scaffold.d.ts +1 -12
  104. package/dist/runtime/scaffold.js +11 -394
  105. package/dist/runtime/template-source-contracts.d.ts +81 -0
  106. package/dist/runtime/template-source-contracts.js +1 -0
  107. package/dist/runtime/template-source-external.d.ts +21 -0
  108. package/dist/runtime/template-source-external.js +184 -0
  109. package/dist/runtime/template-source-locators.d.ts +4 -0
  110. package/dist/runtime/template-source-locators.js +72 -0
  111. package/dist/runtime/template-source-normalization.d.ts +7 -0
  112. package/dist/runtime/template-source-normalization.js +53 -0
  113. package/dist/runtime/template-source-remote.d.ts +23 -0
  114. package/dist/runtime/template-source-remote.js +336 -0
  115. package/dist/runtime/template-source-seeds.d.ts +12 -0
  116. package/dist/runtime/template-source-seeds.js +243 -0
  117. package/dist/runtime/template-source.d.ts +4 -86
  118. package/dist/runtime/template-source.js +9 -828
  119. package/package.json +4 -4
@@ -0,0 +1,304 @@
1
+ const STANDARD_PREAMBLE_LINES = [
2
+ 'import type { TextAlignment } from "@wp-typia/block-types/block-editor/alignment";',
3
+ "import type {",
4
+ "\tTypiaValidationError,",
5
+ "\tValidationResult,",
6
+ '} from "@wp-typia/block-runtime/validation";',
7
+ 'import { tags } from "typia";',
8
+ "",
9
+ 'export type { TypiaValidationError, ValidationResult } from "@wp-typia/block-runtime/validation";',
10
+ ];
11
+ const VALIDATION_ONLY_PREAMBLE_LINES = [
12
+ 'import type { ValidationResult } from "@wp-typia/block-runtime/validation";',
13
+ 'import { tags } from "typia";',
14
+ "",
15
+ 'export type { ValidationResult } from "@wp-typia/block-runtime/validation";',
16
+ ];
17
+ function emitDocComment(description, indent = "") {
18
+ if (!description) {
19
+ return [];
20
+ }
21
+ return [
22
+ `${indent}/**`,
23
+ ...description.lines.map((line) => line.length === 0 ? `${indent} *` : `${indent} * ${line}`),
24
+ `${indent} */`,
25
+ ];
26
+ }
27
+ function emitInterface(definition) {
28
+ const lines = [
29
+ ...emitDocComment(definition.description),
30
+ `export interface ${definition.name} {`,
31
+ ];
32
+ for (const member of definition.members) {
33
+ lines.push(...emitDocComment(member.description, "\t"));
34
+ lines.push(`\t${member.name}${member.optional ? "?" : ""}: ${member.typeExpression};`);
35
+ }
36
+ lines.push("}");
37
+ return lines;
38
+ }
39
+ function emitTypesModule({ preambleLines, interfaces, typeAliases, }) {
40
+ const sections = [];
41
+ if (preambleLines.length > 0) {
42
+ sections.push(preambleLines.join("\n"));
43
+ }
44
+ for (const definition of interfaces) {
45
+ sections.push(emitInterface(definition).join("\n"));
46
+ }
47
+ if (typeAliases.length > 0) {
48
+ sections.push(typeAliases
49
+ .map((alias) => `export type ${alias.name} = ${alias.value};`)
50
+ .join("\n"));
51
+ }
52
+ return `${sections.join("\n\n")}\n`;
53
+ }
54
+ /**
55
+ * Builds the generated attributes and validation type source for a basic block scaffold.
56
+ *
57
+ * @param variables Resolved scaffold template variables used to name emitted types.
58
+ * @param attributes Emitted built-in attribute definitions that drive the interface members.
59
+ * @returns TypeScript source for the basic block attribute and validation types.
60
+ */
61
+ export function buildBasicTypesSource(variables, attributes) {
62
+ return emitTypesModule({
63
+ preambleLines: [...STANDARD_PREAMBLE_LINES],
64
+ interfaces: [
65
+ {
66
+ description: {
67
+ lines: [
68
+ "Block attributes interface",
69
+ "Typia tags define runtime validation rules",
70
+ ],
71
+ },
72
+ members: attributes.map((attribute) => ({
73
+ description: attribute.description,
74
+ name: attribute.name,
75
+ optional: attribute.optional,
76
+ typeExpression: attribute.typeExpression,
77
+ })),
78
+ name: `${variables.pascalCase}Attributes`,
79
+ },
80
+ ],
81
+ typeAliases: [
82
+ {
83
+ name: `${variables.pascalCase}ValidationResult`,
84
+ value: `ValidationResult<${variables.pascalCase}Attributes>`,
85
+ },
86
+ ],
87
+ });
88
+ }
89
+ /**
90
+ * Builds the generated attributes, context, and validation type source for an interactivity scaffold.
91
+ *
92
+ * @param variables Resolved scaffold template variables used to name emitted types.
93
+ * @param attributes Emitted built-in attribute definitions that drive the interface members.
94
+ * @returns TypeScript source for the interactivity block attribute, context, and validation types.
95
+ */
96
+ export function buildInteractivityTypesSource(variables, attributes) {
97
+ return emitTypesModule({
98
+ preambleLines: [...STANDARD_PREAMBLE_LINES],
99
+ interfaces: [
100
+ {
101
+ members: attributes.map((attribute) => ({
102
+ name: attribute.name,
103
+ optional: attribute.optional,
104
+ typeExpression: attribute.typeExpression,
105
+ })),
106
+ name: `${variables.pascalCase}Attributes`,
107
+ },
108
+ {
109
+ members: [
110
+ { name: "clicks", typeExpression: "number" },
111
+ { name: "isAnimating", typeExpression: "boolean" },
112
+ { name: "isVisible", typeExpression: "boolean" },
113
+ {
114
+ name: "animation",
115
+ typeExpression: '"none" | "bounce" | "pulse" | "shake" | "flip"',
116
+ },
117
+ { name: "maxClicks", typeExpression: "number" },
118
+ ],
119
+ name: `${variables.pascalCase}Context`,
120
+ },
121
+ ],
122
+ typeAliases: [
123
+ {
124
+ name: `${variables.pascalCase}ValidationResult`,
125
+ value: `ValidationResult<${variables.pascalCase}Attributes>`,
126
+ },
127
+ ],
128
+ });
129
+ }
130
+ /**
131
+ * Builds the generated attributes, context, state, client, and validation type source for a persistence scaffold.
132
+ *
133
+ * @param variables Resolved scaffold template variables used to name emitted types.
134
+ * @param attributes Emitted built-in attribute definitions that drive the interface members.
135
+ * @returns TypeScript source for the persistence block runtime types.
136
+ */
137
+ export function buildPersistenceTypesSource(variables, attributes) {
138
+ return emitTypesModule({
139
+ preambleLines: [...STANDARD_PREAMBLE_LINES],
140
+ interfaces: [
141
+ {
142
+ members: attributes.map((attribute) => ({
143
+ name: attribute.name,
144
+ optional: attribute.optional,
145
+ typeExpression: attribute.typeExpression,
146
+ })),
147
+ name: `${variables.pascalCase}Attributes`,
148
+ },
149
+ {
150
+ members: [
151
+ { name: "buttonLabel", typeExpression: "string" },
152
+ { name: "bootstrapReady", typeExpression: "boolean" },
153
+ { name: "canWrite", typeExpression: "boolean" },
154
+ { name: "count", typeExpression: "number" },
155
+ { name: "error", typeExpression: "string" },
156
+ { name: "isBootstrapping", typeExpression: "boolean" },
157
+ { name: "isLoading", typeExpression: "boolean" },
158
+ { name: "isSaving", typeExpression: "boolean" },
159
+ {
160
+ name: "persistencePolicy",
161
+ typeExpression: '"authenticated" | "public"',
162
+ },
163
+ { name: "postId", typeExpression: "number" },
164
+ { name: "resourceKey", typeExpression: "string" },
165
+ {
166
+ name: "storage",
167
+ typeExpression: '"post-meta" | "custom-table"',
168
+ },
169
+ { name: "isVisible", typeExpression: "boolean" },
170
+ {
171
+ name: "client",
172
+ optional: true,
173
+ typeExpression: `${variables.pascalCase}ClientState`,
174
+ },
175
+ ],
176
+ name: `${variables.pascalCase}Context`,
177
+ },
178
+ {
179
+ members: [{ name: "isHydrated", typeExpression: "boolean" }],
180
+ name: `${variables.pascalCase}State`,
181
+ },
182
+ {
183
+ members: [
184
+ { name: "bootstrapError", typeExpression: "string" },
185
+ { name: "writeExpiry", typeExpression: "number" },
186
+ { name: "writeNonce", typeExpression: "string" },
187
+ { name: "writeToken", typeExpression: "string" },
188
+ ],
189
+ name: `${variables.pascalCase}ClientState`,
190
+ },
191
+ ],
192
+ typeAliases: [
193
+ {
194
+ name: `${variables.pascalCase}ValidationResult`,
195
+ value: `ValidationResult<${variables.pascalCase}Attributes>`,
196
+ },
197
+ ],
198
+ });
199
+ }
200
+ /**
201
+ * Builds the generated attributes and optional persistence runtime type source for a compound parent scaffold.
202
+ *
203
+ * @param variables Resolved scaffold template variables used to name emitted types.
204
+ * @param attributes Emitted built-in attribute definitions that drive the interface members.
205
+ * @returns TypeScript source for the compound parent runtime types.
206
+ */
207
+ export function buildCompoundTypesSource(variables, attributes) {
208
+ const persistenceEnabled = variables.compoundPersistenceEnabled === "true";
209
+ return emitTypesModule({
210
+ preambleLines: persistenceEnabled
211
+ ? [...STANDARD_PREAMBLE_LINES]
212
+ : [...VALIDATION_ONLY_PREAMBLE_LINES],
213
+ interfaces: [
214
+ {
215
+ members: attributes.map((attribute) => ({
216
+ name: attribute.name,
217
+ optional: attribute.optional,
218
+ typeExpression: attribute.typeExpression,
219
+ })),
220
+ name: `${variables.pascalCase}Attributes`,
221
+ },
222
+ ...(persistenceEnabled
223
+ ? [
224
+ {
225
+ members: [
226
+ { name: "buttonLabel", typeExpression: "string" },
227
+ { name: "bootstrapReady", typeExpression: "boolean" },
228
+ { name: "canWrite", typeExpression: "boolean" },
229
+ { name: "count", typeExpression: "number" },
230
+ { name: "error", typeExpression: "string" },
231
+ { name: "isBootstrapping", typeExpression: "boolean" },
232
+ { name: "isLoading", typeExpression: "boolean" },
233
+ { name: "isSaving", typeExpression: "boolean" },
234
+ {
235
+ name: "persistencePolicy",
236
+ typeExpression: '"authenticated" | "public"',
237
+ },
238
+ { name: "postId", typeExpression: "number" },
239
+ { name: "resourceKey", typeExpression: "string" },
240
+ { name: "showCount", typeExpression: "boolean" },
241
+ {
242
+ name: "storage",
243
+ typeExpression: '"post-meta" | "custom-table"',
244
+ },
245
+ {
246
+ name: "client",
247
+ optional: true,
248
+ typeExpression: `${variables.pascalCase}ClientState`,
249
+ },
250
+ ],
251
+ name: `${variables.pascalCase}Context`,
252
+ },
253
+ {
254
+ members: [{ name: "isHydrated", typeExpression: "boolean" }],
255
+ name: `${variables.pascalCase}State`,
256
+ },
257
+ {
258
+ members: [
259
+ { name: "bootstrapError", typeExpression: "string" },
260
+ { name: "writeExpiry", typeExpression: "number" },
261
+ { name: "writeNonce", typeExpression: "string" },
262
+ { name: "writeToken", typeExpression: "string" },
263
+ ],
264
+ name: `${variables.pascalCase}ClientState`,
265
+ },
266
+ ]
267
+ : []),
268
+ ],
269
+ typeAliases: [
270
+ {
271
+ name: `${variables.pascalCase}ValidationResult`,
272
+ value: `ValidationResult<${variables.pascalCase}Attributes>`,
273
+ },
274
+ ],
275
+ });
276
+ }
277
+ /**
278
+ * Builds the generated attributes and validation type source for a compound child scaffold.
279
+ *
280
+ * @param variables Resolved scaffold template variables used to name emitted types.
281
+ * @param attributes Emitted built-in attribute definitions that drive the interface members.
282
+ * @returns TypeScript source for the compound child attribute and validation types.
283
+ */
284
+ export function buildCompoundChildTypesSource(variables, attributes) {
285
+ return emitTypesModule({
286
+ preambleLines: [...VALIDATION_ONLY_PREAMBLE_LINES],
287
+ interfaces: [
288
+ {
289
+ members: attributes.map((attribute) => ({
290
+ name: attribute.name,
291
+ optional: attribute.optional,
292
+ typeExpression: attribute.typeExpression,
293
+ })),
294
+ name: `${variables.pascalCase}ItemAttributes`,
295
+ },
296
+ ],
297
+ typeAliases: [
298
+ {
299
+ name: `${variables.pascalCase}ItemValidationResult`,
300
+ value: `ValidationResult<${variables.pascalCase}ItemAttributes>`,
301
+ },
302
+ ],
303
+ });
304
+ }