@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,424 @@
1
+ import path from "node:path";
2
+ import { compareMigrationVersionLabels, formatLegacyMigrationWorkspaceResetGuidance, isLegacySemverMigrationVersion, isMigrationVersionLabel, } from "./migration-utils.js";
3
+ export function normalizeRelativePath(value) {
4
+ return value.replace(/\\/g, "/");
5
+ }
6
+ export function ensureRelativePath(projectDir, filePath) {
7
+ return normalizeRelativePath(path.relative(projectDir, filePath));
8
+ }
9
+ function stripCommentsAndStrings(source) {
10
+ let result = "";
11
+ let index = 0;
12
+ let mode = "code";
13
+ while (index < source.length) {
14
+ const current = source[index];
15
+ const next = source[index + 1];
16
+ if (mode === "code") {
17
+ if (current === "/" && next === "/") {
18
+ result += " ";
19
+ index += 2;
20
+ mode = "line-comment";
21
+ continue;
22
+ }
23
+ if (current === "/" && next === "*") {
24
+ result += " ";
25
+ index += 2;
26
+ mode = "block-comment";
27
+ continue;
28
+ }
29
+ if (current === "'") {
30
+ result += current;
31
+ index += 1;
32
+ mode = "single-quote";
33
+ continue;
34
+ }
35
+ if (current === "\"") {
36
+ result += current;
37
+ index += 1;
38
+ mode = "double-quote";
39
+ continue;
40
+ }
41
+ if (current === "`") {
42
+ result += current;
43
+ index += 1;
44
+ mode = "template";
45
+ continue;
46
+ }
47
+ result += current;
48
+ index += 1;
49
+ continue;
50
+ }
51
+ if (mode === "line-comment") {
52
+ result += current === "\n" ? "\n" : " ";
53
+ index += 1;
54
+ if (current === "\n") {
55
+ mode = "code";
56
+ }
57
+ continue;
58
+ }
59
+ if (mode === "block-comment") {
60
+ if (current === "*" && next === "/") {
61
+ result += " ";
62
+ index += 2;
63
+ mode = "code";
64
+ continue;
65
+ }
66
+ result += current === "\n" ? "\n" : " ";
67
+ index += 1;
68
+ continue;
69
+ }
70
+ if (current === "\\") {
71
+ result += index + 1 < source.length ? " " : " ";
72
+ index += Math.min(2, source.length - index);
73
+ continue;
74
+ }
75
+ const closingQuote = mode === "single-quote"
76
+ ? "'"
77
+ : mode === "double-quote"
78
+ ? "\""
79
+ : "`";
80
+ if (current === closingQuote) {
81
+ result += current;
82
+ index += 1;
83
+ mode = "code";
84
+ continue;
85
+ }
86
+ result += current === "\n" ? "\n" : " ";
87
+ index += 1;
88
+ }
89
+ return result;
90
+ }
91
+ function findMigrationConfigBodyRange(source) {
92
+ const sanitizedSource = stripCommentsAndStrings(source);
93
+ const configAssignment = /\bmigrationConfig\s*=\s*\{/u.exec(sanitizedSource);
94
+ if (!configAssignment) {
95
+ return null;
96
+ }
97
+ const braceStart = configAssignment.index + configAssignment[0].length - 1;
98
+ let braceDepth = 0;
99
+ for (let index = braceStart; index < sanitizedSource.length; index += 1) {
100
+ const current = sanitizedSource[index];
101
+ if (current === "{") {
102
+ braceDepth += 1;
103
+ continue;
104
+ }
105
+ if (current === "}") {
106
+ braceDepth -= 1;
107
+ if (braceDepth === 0) {
108
+ return {
109
+ end: index,
110
+ start: braceStart + 1,
111
+ };
112
+ }
113
+ }
114
+ }
115
+ return null;
116
+ }
117
+ function createTopLevelConfigView(source) {
118
+ const range = findMigrationConfigBodyRange(source);
119
+ if (!range) {
120
+ return null;
121
+ }
122
+ const bodySource = source.slice(range.start, range.end);
123
+ const sanitizedBody = stripCommentsAndStrings(bodySource);
124
+ let view = "";
125
+ let braceDepth = 0;
126
+ let bracketDepth = 0;
127
+ let parenDepth = 0;
128
+ for (let index = 0; index < sanitizedBody.length; index += 1) {
129
+ const current = sanitizedBody[index];
130
+ if (current === "{") {
131
+ braceDepth += 1;
132
+ }
133
+ else if (current === "}") {
134
+ braceDepth = Math.max(0, braceDepth - 1);
135
+ }
136
+ else if (current === "[") {
137
+ bracketDepth += 1;
138
+ }
139
+ else if (current === "]") {
140
+ bracketDepth = Math.max(0, bracketDepth - 1);
141
+ }
142
+ else if (current === "(") {
143
+ parenDepth += 1;
144
+ }
145
+ else if (current === ")") {
146
+ parenDepth = Math.max(0, parenDepth - 1);
147
+ }
148
+ const nested = braceDepth > 0 || bracketDepth > 0 || parenDepth > 0;
149
+ view += nested && current !== "{" && current !== "}" && current !== "[" && current !== "]" && current !== "(" && current !== ")"
150
+ ? current === "\n"
151
+ ? "\n"
152
+ : " "
153
+ : current;
154
+ }
155
+ return view;
156
+ }
157
+ function findTopLevelConfigPropertyValueStart(source, key) {
158
+ const range = findMigrationConfigBodyRange(source);
159
+ if (!range) {
160
+ return null;
161
+ }
162
+ const bodySource = source.slice(range.start, range.end);
163
+ const topLevelView = createTopLevelConfigView(source);
164
+ if (!topLevelView) {
165
+ return null;
166
+ }
167
+ const pattern = new RegExp(`\\b${key}\\s*:\\s*`, "u");
168
+ const match = pattern.exec(topLevelView);
169
+ if (!match) {
170
+ return null;
171
+ }
172
+ let start = match.index + match[0].length;
173
+ while (start < bodySource.length && /\s/u.test(bodySource[start])) {
174
+ start += 1;
175
+ }
176
+ return { bodySource, start };
177
+ }
178
+ export function hasLegacyConfigKeys(source) {
179
+ const topLevelView = createTopLevelConfigView(source);
180
+ if (!topLevelView) {
181
+ return false;
182
+ }
183
+ return /\bcurrentVersion\s*:/u.test(topLevelView) || /\bsupportedVersions\s*:/u.test(topLevelView);
184
+ }
185
+ function readQuotedString(source, startIndex) {
186
+ const quote = source[startIndex];
187
+ if (quote !== "\"" && quote !== "'") {
188
+ return null;
189
+ }
190
+ let value = "";
191
+ let index = startIndex + 1;
192
+ while (index < source.length) {
193
+ const current = source[index];
194
+ if (current === "\\") {
195
+ if (index + 1 < source.length) {
196
+ value += source.slice(index, index + 2);
197
+ index += 2;
198
+ continue;
199
+ }
200
+ value += current;
201
+ index += 1;
202
+ continue;
203
+ }
204
+ if (current === quote) {
205
+ return value;
206
+ }
207
+ value += current;
208
+ index += 1;
209
+ }
210
+ return null;
211
+ }
212
+ function readStringArrayLiteral(source, startIndex) {
213
+ if (source[startIndex] !== "[") {
214
+ return null;
215
+ }
216
+ let bracketDepth = 0;
217
+ let index = startIndex;
218
+ let quote = null;
219
+ while (index < source.length) {
220
+ const current = source[index];
221
+ if (quote) {
222
+ if (current === "\\") {
223
+ index += 2;
224
+ continue;
225
+ }
226
+ if (current === quote) {
227
+ quote = null;
228
+ }
229
+ index += 1;
230
+ continue;
231
+ }
232
+ if (current === "\"" || current === "'") {
233
+ quote = current;
234
+ index += 1;
235
+ continue;
236
+ }
237
+ if (current === "[") {
238
+ bracketDepth += 1;
239
+ }
240
+ else if (current === "]") {
241
+ bracketDepth -= 1;
242
+ if (bracketDepth === 0) {
243
+ const body = source.slice(startIndex + 1, index);
244
+ return [...body.matchAll(/["']([^"']+)["']/gu)].map((match) => match[1]);
245
+ }
246
+ }
247
+ index += 1;
248
+ }
249
+ return null;
250
+ }
251
+ function readArrayLiteralBody(source, startIndex) {
252
+ if (source[startIndex] !== "[") {
253
+ return null;
254
+ }
255
+ let bracketDepth = 0;
256
+ let index = startIndex;
257
+ let quote = null;
258
+ while (index < source.length) {
259
+ const current = source[index];
260
+ if (quote) {
261
+ if (current === "\\") {
262
+ index += 2;
263
+ continue;
264
+ }
265
+ if (current === quote) {
266
+ quote = null;
267
+ }
268
+ index += 1;
269
+ continue;
270
+ }
271
+ if (current === "\"" || current === "'") {
272
+ quote = current;
273
+ index += 1;
274
+ continue;
275
+ }
276
+ if (current === "[") {
277
+ bracketDepth += 1;
278
+ }
279
+ else if (current === "]") {
280
+ bracketDepth -= 1;
281
+ if (bracketDepth === 0) {
282
+ return source.slice(startIndex + 1, index);
283
+ }
284
+ }
285
+ index += 1;
286
+ }
287
+ return null;
288
+ }
289
+ function extractObjectLiteralBodies(source) {
290
+ const results = [];
291
+ let braceDepth = 0;
292
+ let objectStart = -1;
293
+ let quote = null;
294
+ for (let index = 0; index < source.length; index += 1) {
295
+ const current = source[index];
296
+ if (quote) {
297
+ if (current === "\\") {
298
+ index += 1;
299
+ continue;
300
+ }
301
+ if (current === quote) {
302
+ quote = null;
303
+ }
304
+ continue;
305
+ }
306
+ if (current === "\"" || current === "'") {
307
+ quote = current;
308
+ continue;
309
+ }
310
+ if (current === "{") {
311
+ if (braceDepth === 0) {
312
+ objectStart = index + 1;
313
+ }
314
+ braceDepth += 1;
315
+ continue;
316
+ }
317
+ if (current === "}") {
318
+ braceDepth -= 1;
319
+ if (braceDepth === 0 && objectStart >= 0) {
320
+ results.push(source.slice(objectStart, index));
321
+ objectStart = -1;
322
+ }
323
+ }
324
+ }
325
+ return results;
326
+ }
327
+ export function createLegacyMigrationWorkspaceResetError(reason) {
328
+ return new Error(`Detected a legacy semver-based migration workspace. ${formatLegacyMigrationWorkspaceResetGuidance(reason)}`);
329
+ }
330
+ function parseMigrationBlocks(source) {
331
+ const blocksArrayBody = matchRootConfigArrayBody(source, "blocks");
332
+ if (!blocksArrayBody) {
333
+ return [];
334
+ }
335
+ const blockLiterals = extractObjectLiteralBodies(blocksArrayBody);
336
+ return blockLiterals
337
+ .map((body) => {
338
+ const key = matchConfigValue(body, "key");
339
+ const blockName = matchConfigValue(body, "blockName");
340
+ const blockJsonFile = matchConfigValue(body, "blockJsonFile");
341
+ const manifestFile = matchConfigValue(body, "manifestFile");
342
+ const saveFile = matchConfigValue(body, "saveFile");
343
+ const typesFile = matchConfigValue(body, "typesFile");
344
+ if (!key || !blockName || !blockJsonFile || !manifestFile || !saveFile || !typesFile) {
345
+ return null;
346
+ }
347
+ return {
348
+ blockJsonFile,
349
+ blockName,
350
+ key,
351
+ manifestFile,
352
+ saveFile,
353
+ typesFile,
354
+ };
355
+ })
356
+ .filter((block) => block !== null);
357
+ }
358
+ function matchConfigValue(source, key) {
359
+ const pattern = new RegExp(`${key}:\\s*["']([^"']+)["']`, "u");
360
+ return source.match(pattern)?.[1] ?? null;
361
+ }
362
+ function matchRootConfigValue(source, key) {
363
+ const match = findTopLevelConfigPropertyValueStart(source, key);
364
+ if (!match) {
365
+ return null;
366
+ }
367
+ return readQuotedString(match.bodySource, match.start);
368
+ }
369
+ function matchRootConfigStringArrayValue(source, key) {
370
+ const match = findTopLevelConfigPropertyValueStart(source, key);
371
+ if (!match) {
372
+ return null;
373
+ }
374
+ return readStringArrayLiteral(match.bodySource, match.start);
375
+ }
376
+ function matchRootConfigArrayBody(source, key) {
377
+ const match = findTopLevelConfigPropertyValueStart(source, key);
378
+ if (!match) {
379
+ return null;
380
+ }
381
+ return readArrayLiteralBody(match.bodySource, match.start);
382
+ }
383
+ export function parseMigrationConfig(source) {
384
+ if (hasLegacyConfigKeys(source)) {
385
+ throw createLegacyMigrationWorkspaceResetError("Detected legacy config keys `currentVersion` / `supportedVersions` in `src/migrations/config.ts`.");
386
+ }
387
+ const blockName = matchRootConfigValue(source, "blockName");
388
+ const currentMigrationVersion = matchRootConfigValue(source, "currentMigrationVersion");
389
+ const snapshotDir = matchRootConfigValue(source, "snapshotDir");
390
+ const supportedMigrationVersions = matchRootConfigStringArrayValue(source, "supportedMigrationVersions");
391
+ const blocksArrayBody = matchRootConfigArrayBody(source, "blocks");
392
+ const blocks = blocksArrayBody === null ? [] : parseMigrationBlocks(source);
393
+ if (!currentMigrationVersion || !snapshotDir || !supportedMigrationVersions) {
394
+ throw new Error("Unable to parse migration config. Regenerate with `wp-typia migrate init --current-migration-version v1`.");
395
+ }
396
+ if (blocksArrayBody !== null && blocks.length === 0 && blocksArrayBody.trim().length > 0) {
397
+ throw new Error("Migration config defines `blocks`, but the array entries could not be parsed. Regenerate the config or fix the malformed block targets in `src/migrations/config.ts`.");
398
+ }
399
+ if (!blockName && blocks.length === 0 && blocksArrayBody === null) {
400
+ throw new Error("Migration config must define `blockName` or `blocks`.");
401
+ }
402
+ if (!isMigrationVersionLabel(currentMigrationVersion)) {
403
+ if (isLegacySemverMigrationVersion(currentMigrationVersion)) {
404
+ throw createLegacyMigrationWorkspaceResetError(`Detected legacy semver migration version label \`${currentMigrationVersion}\` in \`src/migrations/config.ts\`.`);
405
+ }
406
+ throw new Error(`Invalid current migration version: ${currentMigrationVersion}. Expected vN with N >= 1.`);
407
+ }
408
+ for (const version of supportedMigrationVersions) {
409
+ if (!isMigrationVersionLabel(version)) {
410
+ if (isLegacySemverMigrationVersion(version)) {
411
+ throw createLegacyMigrationWorkspaceResetError(`Detected legacy semver migration version label \`${version}\` in \`src/migrations/config.ts\`.`);
412
+ }
413
+ throw new Error(`Invalid supported migration version: ${version}. Expected vN with N >= 1.`);
414
+ }
415
+ }
416
+ supportedMigrationVersions.sort(compareMigrationVersionLabels);
417
+ return {
418
+ blockName: blockName ?? undefined,
419
+ blocks: blocksArrayBody === null ? undefined : blocks,
420
+ currentMigrationVersion,
421
+ snapshotDir,
422
+ supportedMigrationVersions,
423
+ };
424
+ }
@@ -0,0 +1,61 @@
1
+ import type { MigrationBlockConfig, MigrationConfig, ResolvedMigrationBlockTarget } from "./migration-types.js";
2
+ /**
3
+ * Describes the migration retrofit layout discovered in a project directory.
4
+ *
5
+ * Multi-block discovery wins when block targets are discovered under
6
+ * `src/blocks/<slug>/block.json`.
7
+ * Otherwise the runtime falls back to a supported single-block layout.
8
+ */
9
+ export type DiscoveredMigrationLayout = {
10
+ block: MigrationBlockConfig;
11
+ mode: "single";
12
+ } | {
13
+ blocks: MigrationBlockConfig[];
14
+ mode: "multi";
15
+ };
16
+ /**
17
+ * Synthesizes the implicit legacy migration block target for single-block projects.
18
+ *
19
+ * @param projectDir Project directory that may contain a legacy root migration layout.
20
+ * @param blockName Optional configured block name used to prefer a matching legacy root target.
21
+ * @returns The discovered single-block migration target keyed as `default`.
22
+ */
23
+ export declare function createImplicitLegacyBlock(projectDir: string, blockName?: string): MigrationBlockConfig;
24
+ /**
25
+ * Verifies that a project directory contains the files required for migration tooling.
26
+ *
27
+ * @param projectDir Project directory to validate.
28
+ * @param blocks Optional block targets to validate directly instead of auto-discovering them.
29
+ * @returns Nothing.
30
+ * @throws Error When any required project file is missing.
31
+ */
32
+ export declare function ensureAdvancedMigrationProject(projectDir: string, blocks?: MigrationBlockConfig[]): void;
33
+ /**
34
+ * Detects the supported migration retrofit layout for `migrate init`.
35
+ *
36
+ * Multi-block targets under `src/blocks/<slug>` take precedence over
37
+ * single-block layouts.
38
+ * Returns the detected layout on success and throws an actionable error when no
39
+ * supported first-party layout can be inferred.
40
+ *
41
+ * @param projectDir Project directory to inspect.
42
+ * @returns The discovered migration layout.
43
+ * @throws Error When no supported layout can be inferred.
44
+ */
45
+ export declare function discoverMigrationInitLayout(projectDir: string): DiscoveredMigrationLayout;
46
+ /**
47
+ * Resolves the configured migration block targets and their current artifacts.
48
+ *
49
+ * @param projectDir Project directory containing the migration workspace.
50
+ * @param config Parsed migration configuration.
51
+ * @returns The resolved block targets, including current block.json and manifest documents.
52
+ */
53
+ export declare function resolveMigrationBlocks(projectDir: string, config: MigrationConfig): ResolvedMigrationBlockTarget[];
54
+ /**
55
+ * Returns the discovered block name for a supported single-block project.
56
+ *
57
+ * Uses `discoverSingleBlockTarget(projectDir)` internally and throws when the
58
+ * project directory does not resolve to a supported single-block migration
59
+ * layout.
60
+ */
61
+ export declare function readProjectBlockName(projectDir: string): string;