@wp-typia/project-tools 0.17.0 → 0.19.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.
- package/dist/runtime/alternate-render-targets.d.ts +5 -0
- package/dist/runtime/alternate-render-targets.js +29 -0
- package/dist/runtime/block-generator-service-core.d.ts +2 -2
- package/dist/runtime/block-generator-service-core.js +13 -8
- package/dist/runtime/block-generator-service-spec.d.ts +10 -2
- package/dist/runtime/block-generator-service-spec.js +43 -1
- package/dist/runtime/built-in-block-artifacts.js +1 -0
- package/dist/runtime/built-in-block-code-templates/compound-child.d.ts +2 -2
- package/dist/runtime/built-in-block-code-templates/compound-child.js +35 -2
- package/dist/runtime/built-in-block-code-templates/compound-parent.d.ts +2 -2
- package/dist/runtime/built-in-block-code-templates/compound-parent.js +204 -27
- package/dist/runtime/built-in-block-code-templates/compound-persistence.d.ts +1 -1
- package/dist/runtime/built-in-block-code-templates/compound-persistence.js +11 -8
- package/dist/runtime/built-in-block-non-ts-artifacts.js +505 -2
- package/dist/runtime/cli-add-block.d.ts +6 -2
- package/dist/runtime/cli-add-block.js +71 -24
- package/dist/runtime/cli-add-shared.d.ts +58 -2
- package/dist/runtime/cli-add-shared.js +111 -12
- package/dist/runtime/cli-add-workspace-assets.d.ts +21 -1
- package/dist/runtime/cli-add-workspace-assets.js +417 -1
- package/dist/runtime/cli-add-workspace-rest.d.ts +14 -0
- package/dist/runtime/cli-add-workspace-rest.js +1060 -0
- package/dist/runtime/cli-add-workspace.d.ts +10 -1
- package/dist/runtime/cli-add-workspace.js +10 -1
- package/dist/runtime/cli-add.d.ts +3 -3
- package/dist/runtime/cli-add.js +2 -2
- package/dist/runtime/cli-core.d.ts +5 -1
- package/dist/runtime/cli-core.js +3 -1
- package/dist/runtime/cli-doctor-workspace.js +135 -1
- package/dist/runtime/cli-help.js +12 -7
- package/dist/runtime/cli-scaffold.d.ts +12 -2
- package/dist/runtime/cli-scaffold.js +222 -46
- package/dist/runtime/cli-templates.d.ts +4 -4
- package/dist/runtime/cli-templates.js +104 -39
- package/dist/runtime/cli-validation.d.ts +66 -0
- package/dist/runtime/cli-validation.js +92 -0
- package/dist/runtime/compound-inner-blocks.d.ts +78 -0
- package/dist/runtime/compound-inner-blocks.js +88 -0
- package/dist/runtime/index.d.ts +6 -3
- package/dist/runtime/index.js +4 -2
- package/dist/runtime/local-dev-presets.js +7 -2
- package/dist/runtime/migration-command-surface.js +2 -0
- package/dist/runtime/package-versions.d.ts +1 -0
- package/dist/runtime/package-versions.js +12 -0
- package/dist/runtime/rest-resource-artifacts.d.ts +35 -0
- package/dist/runtime/rest-resource-artifacts.js +158 -0
- package/dist/runtime/scaffold-answer-resolution.js +78 -8
- package/dist/runtime/scaffold-apply-utils.d.ts +4 -3
- package/dist/runtime/scaffold-apply-utils.js +34 -17
- package/dist/runtime/scaffold-bootstrap.d.ts +15 -0
- package/dist/runtime/scaffold-bootstrap.js +29 -7
- package/dist/runtime/scaffold-documents.js +24 -3
- package/dist/runtime/scaffold-identifiers.d.ts +17 -0
- package/dist/runtime/scaffold-identifiers.js +22 -0
- package/dist/runtime/scaffold-onboarding.js +25 -13
- package/dist/runtime/scaffold-package-manager-files.js +6 -1
- package/dist/runtime/scaffold-template-variables.js +22 -0
- package/dist/runtime/scaffold.d.ts +22 -1
- package/dist/runtime/scaffold.js +56 -11
- package/dist/runtime/template-render.d.ts +5 -2
- package/dist/runtime/template-render.js +9 -3
- package/dist/runtime/template-source-contracts.d.ts +11 -0
- package/dist/runtime/template-source-external.d.ts +1 -1
- package/dist/runtime/template-source-external.js +45 -13
- package/dist/runtime/template-source-normalization.d.ts +1 -1
- package/dist/runtime/template-source-normalization.js +5 -1
- package/dist/runtime/template-source-remote.d.ts +5 -0
- package/dist/runtime/template-source-remote.js +33 -0
- package/dist/runtime/template-source.js +35 -4
- package/dist/runtime/workspace-inventory.d.ts +43 -1
- package/dist/runtime/workspace-inventory.js +132 -1
- package/dist/runtime/workspace-project.d.ts +1 -1
- package/dist/runtime/workspace-project.js +3 -3
- package/package.json +9 -4
- package/templates/_shared/compound/core/scripts/add-compound-child.ts.mustache +728 -49
- package/templates/query-loop/src/validator-toolkit.ts.mustache +0 -1
|
@@ -19,14 +19,49 @@ export interface WorkspaceBindingSourceInventoryEntry {
|
|
|
19
19
|
serverFile: string;
|
|
20
20
|
slug: string;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* REST-resource entry parsed from `scripts/block-config.ts`.
|
|
24
|
+
*
|
|
25
|
+
* Each file path is stored relative to the workspace root so doctor checks and
|
|
26
|
+
* workspace mutation helpers can resolve the generated TypeScript, OpenAPI, and
|
|
27
|
+
* PHP route artifacts without guessing their locations.
|
|
28
|
+
*/
|
|
29
|
+
export interface WorkspaceRestResourceInventoryEntry {
|
|
30
|
+
apiFile: string;
|
|
31
|
+
clientFile: string;
|
|
32
|
+
dataFile: string;
|
|
33
|
+
methods: string[];
|
|
34
|
+
namespace: string;
|
|
35
|
+
openApiFile: string;
|
|
36
|
+
phpFile: string;
|
|
37
|
+
slug: string;
|
|
38
|
+
typesFile: string;
|
|
39
|
+
validatorsFile: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Editor-plugin entry parsed from `scripts/block-config.ts`.
|
|
43
|
+
*
|
|
44
|
+
* @property file Relative path to the generated editor plugin entry file.
|
|
45
|
+
* @property slug Normalized editor plugin slug.
|
|
46
|
+
* @property slot Canonical editor shell slot for the plugin scaffold.
|
|
47
|
+
*/
|
|
48
|
+
export interface WorkspaceEditorPluginInventoryEntry {
|
|
49
|
+
file: string;
|
|
50
|
+
slug: string;
|
|
51
|
+
slot: string;
|
|
52
|
+
}
|
|
22
53
|
export interface WorkspaceInventory {
|
|
23
54
|
bindingSources: WorkspaceBindingSourceInventoryEntry[];
|
|
24
55
|
blockConfigPath: string;
|
|
25
56
|
blocks: WorkspaceBlockInventoryEntry[];
|
|
26
57
|
hasBindingSourcesSection: boolean;
|
|
58
|
+
hasEditorPluginsSection: boolean;
|
|
27
59
|
hasPatternsSection: boolean;
|
|
60
|
+
hasRestResourcesSection: boolean;
|
|
28
61
|
hasVariationsSection: boolean;
|
|
62
|
+
editorPlugins: WorkspaceEditorPluginInventoryEntry[];
|
|
29
63
|
patterns: WorkspacePatternInventoryEntry[];
|
|
64
|
+
restResources: WorkspaceRestResourceInventoryEntry[];
|
|
30
65
|
source: string;
|
|
31
66
|
variations: WorkspaceVariationInventoryEntry[];
|
|
32
67
|
}
|
|
@@ -34,6 +69,11 @@ export declare const BLOCK_CONFIG_ENTRY_MARKER = "\t// wp-typia add block entrie
|
|
|
34
69
|
export declare const VARIATION_CONFIG_ENTRY_MARKER = "\t// wp-typia add variation entries";
|
|
35
70
|
export declare const PATTERN_CONFIG_ENTRY_MARKER = "\t// wp-typia add pattern entries";
|
|
36
71
|
export declare const BINDING_SOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add binding-source entries";
|
|
72
|
+
export declare const REST_RESOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add rest-resource entries";
|
|
73
|
+
/**
|
|
74
|
+
* Marker used to append generated editor-plugin entries into `EDITOR_PLUGINS`.
|
|
75
|
+
*/
|
|
76
|
+
export declare const EDITOR_PLUGIN_CONFIG_ENTRY_MARKER = "\t// wp-typia add editor-plugin entries";
|
|
37
77
|
/**
|
|
38
78
|
* Parse workspace inventory entries from the source of `scripts/block-config.ts`.
|
|
39
79
|
*
|
|
@@ -75,10 +115,12 @@ export declare function getWorkspaceBlockSelectOptions(projectDir: string): Arra
|
|
|
75
115
|
* @param options Entry lists plus an optional source transformer.
|
|
76
116
|
* @returns Updated source text with all requested inventory entries appended.
|
|
77
117
|
*/
|
|
78
|
-
export declare function updateWorkspaceInventorySource(source: string, { blockEntries, bindingSourceEntries, patternEntries, variationEntries, transformSource, }?: {
|
|
118
|
+
export declare function updateWorkspaceInventorySource(source: string, { blockEntries, bindingSourceEntries, editorPluginEntries, patternEntries, restResourceEntries, variationEntries, transformSource, }?: {
|
|
79
119
|
blockEntries?: string[];
|
|
80
120
|
bindingSourceEntries?: string[];
|
|
121
|
+
editorPluginEntries?: string[];
|
|
81
122
|
patternEntries?: string[];
|
|
123
|
+
restResourceEntries?: string[];
|
|
82
124
|
transformSource?: (source: string) => string;
|
|
83
125
|
variationEntries?: string[];
|
|
84
126
|
}): string;
|
|
@@ -2,10 +2,16 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { readFile, writeFile } from "node:fs/promises";
|
|
4
4
|
import ts from "typescript";
|
|
5
|
+
import { REST_RESOURCE_METHOD_IDS } from "./cli-add-shared.js";
|
|
5
6
|
export const BLOCK_CONFIG_ENTRY_MARKER = "\t// wp-typia add block entries";
|
|
6
7
|
export const VARIATION_CONFIG_ENTRY_MARKER = "\t// wp-typia add variation entries";
|
|
7
8
|
export const PATTERN_CONFIG_ENTRY_MARKER = "\t// wp-typia add pattern entries";
|
|
8
9
|
export const BINDING_SOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add binding-source entries";
|
|
10
|
+
export const REST_RESOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add rest-resource entries";
|
|
11
|
+
/**
|
|
12
|
+
* Marker used to append generated editor-plugin entries into `EDITOR_PLUGINS`.
|
|
13
|
+
*/
|
|
14
|
+
export const EDITOR_PLUGIN_CONFIG_ENTRY_MARKER = "\t// wp-typia add editor-plugin entries";
|
|
9
15
|
const VARIATIONS_INTERFACE_SECTION = `
|
|
10
16
|
|
|
11
17
|
export interface WorkspaceVariationConfig {
|
|
@@ -47,6 +53,44 @@ export const BINDING_SOURCES: WorkspaceBindingSourceConfig[] = [
|
|
|
47
53
|
\t// wp-typia add binding-source entries
|
|
48
54
|
];
|
|
49
55
|
`;
|
|
56
|
+
const REST_RESOURCES_INTERFACE_SECTION = `
|
|
57
|
+
|
|
58
|
+
export interface WorkspaceRestResourceConfig {
|
|
59
|
+
\tapiFile: string;
|
|
60
|
+
\tclientFile: string;
|
|
61
|
+
\tdataFile: string;
|
|
62
|
+
\tmethods: Array< 'list' | 'read' | 'create' | 'update' | 'delete' >;
|
|
63
|
+
\tnamespace: string;
|
|
64
|
+
\topenApiFile: string;
|
|
65
|
+
\tphpFile: string;
|
|
66
|
+
\trestManifest?: ReturnType<
|
|
67
|
+
\t\ttypeof import( '@wp-typia/block-runtime/metadata-core' ).defineEndpointManifest
|
|
68
|
+
\t>;
|
|
69
|
+
\tslug: string;
|
|
70
|
+
\ttypesFile: string;
|
|
71
|
+
\tvalidatorsFile: string;
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
const REST_RESOURCES_CONST_SECTION = `
|
|
75
|
+
|
|
76
|
+
export const REST_RESOURCES: WorkspaceRestResourceConfig[] = [
|
|
77
|
+
\t// wp-typia add rest-resource entries
|
|
78
|
+
];
|
|
79
|
+
`;
|
|
80
|
+
const EDITOR_PLUGINS_INTERFACE_SECTION = `
|
|
81
|
+
|
|
82
|
+
export interface WorkspaceEditorPluginConfig {
|
|
83
|
+
\tfile: string;
|
|
84
|
+
\tslug: string;
|
|
85
|
+
\tslot: string;
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
const EDITOR_PLUGINS_CONST_SECTION = `
|
|
89
|
+
|
|
90
|
+
export const EDITOR_PLUGINS: WorkspaceEditorPluginConfig[] = [
|
|
91
|
+
\t// wp-typia add editor-plugin entries
|
|
92
|
+
];
|
|
93
|
+
`;
|
|
50
94
|
function getPropertyNameText(name) {
|
|
51
95
|
if (ts.isIdentifier(name) || ts.isStringLiteral(name)) {
|
|
52
96
|
return name.text;
|
|
@@ -105,6 +149,27 @@ function getRequiredStringProperty(entryName, elementIndex, objectLiteral, key)
|
|
|
105
149
|
}
|
|
106
150
|
return value;
|
|
107
151
|
}
|
|
152
|
+
function getRequiredStringArrayProperty(entryName, elementIndex, objectLiteral, key) {
|
|
153
|
+
for (const property of objectLiteral.properties) {
|
|
154
|
+
if (!ts.isPropertyAssignment(property)) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const propertyName = getPropertyNameText(property.name);
|
|
158
|
+
if (propertyName !== key) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (!ts.isArrayLiteralExpression(property.initializer)) {
|
|
162
|
+
throw new Error(`${entryName}[${elementIndex}] must use an array literal for "${key}" in scripts/block-config.ts.`);
|
|
163
|
+
}
|
|
164
|
+
return property.initializer.elements.map((element, itemIndex) => {
|
|
165
|
+
if (!ts.isStringLiteralLike(element)) {
|
|
166
|
+
throw new Error(`${entryName}[${elementIndex}].${key}[${itemIndex}] must use a string literal in scripts/block-config.ts.`);
|
|
167
|
+
}
|
|
168
|
+
return element.text;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
throw new Error(`${entryName}[${elementIndex}] is missing required "${key}" in scripts/block-config.ts.`);
|
|
172
|
+
}
|
|
108
173
|
function parseBlockEntries(arrayLiteral) {
|
|
109
174
|
return arrayLiteral.elements.map((element, elementIndex) => {
|
|
110
175
|
if (!ts.isObjectLiteralExpression(element)) {
|
|
@@ -154,6 +219,42 @@ function parseBindingSourceEntries(arrayLiteral) {
|
|
|
154
219
|
};
|
|
155
220
|
});
|
|
156
221
|
}
|
|
222
|
+
function parseRestResourceEntries(arrayLiteral) {
|
|
223
|
+
return arrayLiteral.elements.map((element, elementIndex) => {
|
|
224
|
+
if (!ts.isObjectLiteralExpression(element)) {
|
|
225
|
+
throw new Error(`REST_RESOURCES[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
|
|
226
|
+
}
|
|
227
|
+
const methods = getRequiredStringArrayProperty("REST_RESOURCES", elementIndex, element, "methods");
|
|
228
|
+
const invalidMethods = methods.filter((method) => !REST_RESOURCE_METHOD_IDS.includes(method));
|
|
229
|
+
if (invalidMethods.length > 0) {
|
|
230
|
+
throw new Error(`REST_RESOURCES[${elementIndex}].methods includes unsupported values: ${invalidMethods.join(", ")}.`);
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
apiFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "apiFile"),
|
|
234
|
+
clientFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "clientFile"),
|
|
235
|
+
dataFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "dataFile"),
|
|
236
|
+
methods,
|
|
237
|
+
namespace: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "namespace"),
|
|
238
|
+
openApiFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "openApiFile"),
|
|
239
|
+
phpFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "phpFile"),
|
|
240
|
+
slug: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "slug"),
|
|
241
|
+
typesFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "typesFile"),
|
|
242
|
+
validatorsFile: getRequiredStringProperty("REST_RESOURCES", elementIndex, element, "validatorsFile"),
|
|
243
|
+
};
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function parseEditorPluginEntries(arrayLiteral) {
|
|
247
|
+
return arrayLiteral.elements.map((element, elementIndex) => {
|
|
248
|
+
if (!ts.isObjectLiteralExpression(element)) {
|
|
249
|
+
throw new Error(`EDITOR_PLUGINS[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
file: getRequiredStringProperty("EDITOR_PLUGINS", elementIndex, element, "file"),
|
|
253
|
+
slug: getRequiredStringProperty("EDITOR_PLUGINS", elementIndex, element, "slug"),
|
|
254
|
+
slot: getRequiredStringProperty("EDITOR_PLUGINS", elementIndex, element, "slot"),
|
|
255
|
+
};
|
|
256
|
+
});
|
|
257
|
+
}
|
|
157
258
|
/**
|
|
158
259
|
* Parse workspace inventory entries from the source of `scripts/block-config.ts`.
|
|
159
260
|
*
|
|
@@ -170,6 +271,8 @@ export function parseWorkspaceInventorySource(source) {
|
|
|
170
271
|
const variationArray = findExportedArrayLiteral(sourceFile, "VARIATIONS");
|
|
171
272
|
const patternArray = findExportedArrayLiteral(sourceFile, "PATTERNS");
|
|
172
273
|
const bindingSourceArray = findExportedArrayLiteral(sourceFile, "BINDING_SOURCES");
|
|
274
|
+
const restResourceArray = findExportedArrayLiteral(sourceFile, "REST_RESOURCES");
|
|
275
|
+
const editorPluginArray = findExportedArrayLiteral(sourceFile, "EDITOR_PLUGINS");
|
|
173
276
|
if (variationArray.found && !variationArray.array) {
|
|
174
277
|
throw new Error("scripts/block-config.ts must export VARIATIONS as an array literal.");
|
|
175
278
|
}
|
|
@@ -179,15 +282,29 @@ export function parseWorkspaceInventorySource(source) {
|
|
|
179
282
|
if (bindingSourceArray.found && !bindingSourceArray.array) {
|
|
180
283
|
throw new Error("scripts/block-config.ts must export BINDING_SOURCES as an array literal.");
|
|
181
284
|
}
|
|
285
|
+
if (restResourceArray.found && !restResourceArray.array) {
|
|
286
|
+
throw new Error("scripts/block-config.ts must export REST_RESOURCES as an array literal.");
|
|
287
|
+
}
|
|
288
|
+
if (editorPluginArray.found && !editorPluginArray.array) {
|
|
289
|
+
throw new Error("scripts/block-config.ts must export EDITOR_PLUGINS as an array literal.");
|
|
290
|
+
}
|
|
182
291
|
return {
|
|
183
292
|
bindingSources: bindingSourceArray.array
|
|
184
293
|
? parseBindingSourceEntries(bindingSourceArray.array)
|
|
185
294
|
: [],
|
|
186
295
|
blocks: parseBlockEntries(blockArray.array),
|
|
187
296
|
hasBindingSourcesSection: bindingSourceArray.found,
|
|
297
|
+
hasEditorPluginsSection: editorPluginArray.found,
|
|
188
298
|
hasPatternsSection: patternArray.found,
|
|
299
|
+
hasRestResourcesSection: restResourceArray.found,
|
|
189
300
|
hasVariationsSection: variationArray.found,
|
|
301
|
+
editorPlugins: editorPluginArray.array
|
|
302
|
+
? parseEditorPluginEntries(editorPluginArray.array)
|
|
303
|
+
: [],
|
|
190
304
|
patterns: patternArray.array ? parsePatternEntries(patternArray.array) : [],
|
|
305
|
+
restResources: restResourceArray.array
|
|
306
|
+
? parseRestResourceEntries(restResourceArray.array)
|
|
307
|
+
: [],
|
|
191
308
|
source,
|
|
192
309
|
variations: variationArray.array ? parseVariationEntries(variationArray.array) : [],
|
|
193
310
|
};
|
|
@@ -255,6 +372,18 @@ function ensureWorkspaceInventorySections(source) {
|
|
|
255
372
|
if (!/export\s+const\s+BINDING_SOURCES\b/u.test(nextSource)) {
|
|
256
373
|
nextSource += BINDING_SOURCES_CONST_SECTION;
|
|
257
374
|
}
|
|
375
|
+
if (!/export\s+interface\s+WorkspaceRestResourceConfig\b/u.test(nextSource)) {
|
|
376
|
+
nextSource += REST_RESOURCES_INTERFACE_SECTION;
|
|
377
|
+
}
|
|
378
|
+
if (!/export\s+const\s+REST_RESOURCES\b/u.test(nextSource)) {
|
|
379
|
+
nextSource += REST_RESOURCES_CONST_SECTION;
|
|
380
|
+
}
|
|
381
|
+
if (!/export\s+interface\s+WorkspaceEditorPluginConfig\b/u.test(nextSource)) {
|
|
382
|
+
nextSource += EDITOR_PLUGINS_INTERFACE_SECTION;
|
|
383
|
+
}
|
|
384
|
+
if (!/export\s+const\s+EDITOR_PLUGINS\b/u.test(nextSource)) {
|
|
385
|
+
nextSource += EDITOR_PLUGINS_CONST_SECTION;
|
|
386
|
+
}
|
|
258
387
|
return `${nextSource}\n`;
|
|
259
388
|
}
|
|
260
389
|
function appendEntriesAtMarker(source, marker, entries) {
|
|
@@ -277,7 +406,7 @@ function appendEntriesAtMarker(source, marker, entries) {
|
|
|
277
406
|
* @param options Entry lists plus an optional source transformer.
|
|
278
407
|
* @returns Updated source text with all requested inventory entries appended.
|
|
279
408
|
*/
|
|
280
|
-
export function updateWorkspaceInventorySource(source, { blockEntries = [], bindingSourceEntries = [], patternEntries = [], variationEntries = [], transformSource, } = {}) {
|
|
409
|
+
export function updateWorkspaceInventorySource(source, { blockEntries = [], bindingSourceEntries = [], editorPluginEntries = [], patternEntries = [], restResourceEntries = [], variationEntries = [], transformSource, } = {}) {
|
|
281
410
|
let nextSource = ensureWorkspaceInventorySections(source);
|
|
282
411
|
if (transformSource) {
|
|
283
412
|
nextSource = transformSource(nextSource);
|
|
@@ -286,6 +415,8 @@ export function updateWorkspaceInventorySource(source, { blockEntries = [], bind
|
|
|
286
415
|
nextSource = appendEntriesAtMarker(nextSource, VARIATION_CONFIG_ENTRY_MARKER, variationEntries);
|
|
287
416
|
nextSource = appendEntriesAtMarker(nextSource, PATTERN_CONFIG_ENTRY_MARKER, patternEntries);
|
|
288
417
|
nextSource = appendEntriesAtMarker(nextSource, BINDING_SOURCE_CONFIG_ENTRY_MARKER, bindingSourceEntries);
|
|
418
|
+
nextSource = appendEntriesAtMarker(nextSource, REST_RESOURCE_CONFIG_ENTRY_MARKER, restResourceEntries);
|
|
419
|
+
nextSource = appendEntriesAtMarker(nextSource, EDITOR_PLUGIN_CONFIG_ENTRY_MARKER, editorPluginEntries);
|
|
289
420
|
return nextSource;
|
|
290
421
|
}
|
|
291
422
|
/**
|
|
@@ -43,7 +43,7 @@ export declare function getInvalidWorkspaceProjectReason(startDir: string): stri
|
|
|
43
43
|
* Parse a package-manager identifier from a `packageManager` field.
|
|
44
44
|
*
|
|
45
45
|
* @param packageManagerField Raw package-manager field such as `bun@1.3.11`.
|
|
46
|
-
* @returns A normalized `PackageManagerId`, defaulting to `"
|
|
46
|
+
* @returns A normalized `PackageManagerId`, defaulting to `"npm"` when the
|
|
47
47
|
* field is missing or unsupported.
|
|
48
48
|
*/
|
|
49
49
|
export declare function parseWorkspacePackageManagerId(packageManagerField: string | undefined): PackageManagerId;
|
|
@@ -77,7 +77,7 @@ export function getInvalidWorkspaceProjectReason(startDir) {
|
|
|
77
77
|
* Parse a package-manager identifier from a `packageManager` field.
|
|
78
78
|
*
|
|
79
79
|
* @param packageManagerField Raw package-manager field such as `bun@1.3.11`.
|
|
80
|
-
* @returns A normalized `PackageManagerId`, defaulting to `"
|
|
80
|
+
* @returns A normalized `PackageManagerId`, defaulting to `"npm"` when the
|
|
81
81
|
* field is missing or unsupported.
|
|
82
82
|
*/
|
|
83
83
|
export function parseWorkspacePackageManagerId(packageManagerField) {
|
|
@@ -89,7 +89,7 @@ export function parseWorkspacePackageManagerId(packageManagerField) {
|
|
|
89
89
|
case "yarn":
|
|
90
90
|
return packageManagerId;
|
|
91
91
|
default:
|
|
92
|
-
return "
|
|
92
|
+
return "npm";
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
@@ -148,5 +148,5 @@ export function resolveWorkspaceProject(startDir) {
|
|
|
148
148
|
if (workspace) {
|
|
149
149
|
return workspace;
|
|
150
150
|
}
|
|
151
|
-
throw new Error(`This command must run inside
|
|
151
|
+
throw new Error(`This command must run inside an official wp-typia workspace. Create one with \`wp-typia create my-plugin --template workspace\` first (the short alias for \`${WORKSPACE_TEMPLATE_PACKAGE}\`).`);
|
|
152
152
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-typia/project-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Project orchestration and programmatic tooling for wp-typia",
|
|
5
5
|
"packageManager": "bun@1.3.11",
|
|
6
6
|
"type": "module",
|
|
@@ -37,6 +37,11 @@
|
|
|
37
37
|
"import": "./dist/runtime/cli-scaffold.js",
|
|
38
38
|
"default": "./dist/runtime/cli-scaffold.js"
|
|
39
39
|
},
|
|
40
|
+
"./compound-inner-blocks": {
|
|
41
|
+
"types": "./dist/runtime/compound-inner-blocks.d.ts",
|
|
42
|
+
"import": "./dist/runtime/compound-inner-blocks.js",
|
|
43
|
+
"default": "./dist/runtime/compound-inner-blocks.js"
|
|
44
|
+
},
|
|
40
45
|
"./cli-templates": {
|
|
41
46
|
"types": "./dist/runtime/cli-templates.d.ts",
|
|
42
47
|
"import": "./dist/runtime/cli-templates.js",
|
|
@@ -86,7 +91,7 @@
|
|
|
86
91
|
"test:migration-planning": "bun run build && bun test tests/migration-init.test.ts tests/migration-config.test.ts tests/migration-plan-wizard.test.ts",
|
|
87
92
|
"test:migration-execution": "bun run build && bun test tests/migration-scaffold-diff.test.ts tests/migration-doctor.test.ts tests/migration-fixtures-fuzz.test.ts",
|
|
88
93
|
"test:project-tools": "bun run test:scaffold-core && bun run test:workspace && bun run test:compound && bun run test:migration-planning && bun run test:migration-execution",
|
|
89
|
-
"test:coverage": "bun run build && bun test tests/*.test.ts --coverage --coverage-reporter=lcov --coverage-dir=coverage",
|
|
94
|
+
"test:coverage": "bun run build && bun run --filter wp-typia build && bun test tests/*.test.ts --coverage --coverage-reporter=lcov --coverage-dir=coverage",
|
|
90
95
|
"clean": "rm -rf dist",
|
|
91
96
|
"prepublishOnly": "bun run build"
|
|
92
97
|
},
|
|
@@ -120,8 +125,8 @@
|
|
|
120
125
|
},
|
|
121
126
|
"dependencies": {
|
|
122
127
|
"@wp-typia/api-client": "^0.4.5",
|
|
123
|
-
"@wp-typia/block-runtime": "^0.
|
|
124
|
-
"@wp-typia/rest": "^0.3.
|
|
128
|
+
"@wp-typia/block-runtime": "^0.5.0",
|
|
129
|
+
"@wp-typia/rest": "^0.3.11",
|
|
125
130
|
"@wp-typia/block-types": "^0.2.4",
|
|
126
131
|
"mustache": "^4.2.0",
|
|
127
132
|
"npm-package-arg": "^13.0.0",
|