wp-typia 0.24.1 → 0.24.3
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-bunli/.bunli/commands.gen.js +346 -323
- package/dist-bunli/{cli-gaq29kzp.js → cli-377p86mf.js} +1 -1
- package/dist-bunli/{cli-1xt99e09.js → cli-4pzxbk4s.js} +36 -13
- package/dist-bunli/{cli-zjw3eqfj.js → cli-84c7wff4.js} +1 -1
- package/dist-bunli/{cli-add-mr731xtv.js → cli-add-mxxk5rep.js} +20 -12
- package/dist-bunli/{cli-doctor-kf9gwdhh.js → cli-doctor-6fyxq940.js} +2 -2
- package/dist-bunli/{cli-h2v72j8q.js → cli-fv4h3ydt.js} +188 -188
- package/dist-bunli/{cli-init-557vq109.js → cli-init-7avk42dh.js} +2 -2
- package/dist-bunli/{cli-4ah8dawy.js → cli-kfm9mm68.js} +3130 -3132
- package/dist-bunli/{cli-scaffold-bt1ttnkg.js → cli-scaffold-0bb6pr3w.js} +95 -133
- package/dist-bunli/{cli-fzhkqzc7.js → cli-tj7ajdvf.js} +1 -1
- package/dist-bunli/cli.js +2 -2
- package/dist-bunli/{command-list-bd2582k1.js → command-list-bgwaa2f4.js} +73 -33
- package/dist-bunli/{migrations-ky53fj2h.js → migrations-3vngdy51.js} +2 -2
- package/dist-bunli/node-cli.js +154 -161
- package/package.json +2 -2
|
@@ -37567,7 +37567,7 @@ function formatAddHelpText() {
|
|
|
37567
37567
|
wp-typia add variation <name> --block <block-slug> [--dry-run]
|
|
37568
37568
|
wp-typia add style <name> --block <block-slug> [--dry-run]
|
|
37569
37569
|
wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug> [--dry-run]
|
|
37570
|
-
wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag
|
|
37570
|
+
wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag,...>] [--tag <tag>...] [--thumbnail-url <url>] [--dry-run]
|
|
37571
37571
|
wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>] [--from-post-meta|--post-meta <post-meta> [--meta-path <field>]] [--dry-run]
|
|
37572
37572
|
wp-typia add contract <name> [--type <ExportedTypeName>] [--dry-run]
|
|
37573
37573
|
wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <${REST_RESOURCE_METHOD_IDS.join(",")}>] [--route-pattern <route-pattern>] [--permission-callback <callback>] [--controller-class <ClassName>] [--controller-extends <BaseClass>] [--dry-run]
|
|
@@ -37595,7 +37595,7 @@ Notes:
|
|
|
37595
37595
|
\`add variation\` targets an existing block slug from \`scripts/block-config.ts\`.
|
|
37596
37596
|
\`add style\` registers a Block Styles option for an existing generated block.
|
|
37597
37597
|
\`add transform\` adds a block-to-block transform into an existing generated block.
|
|
37598
|
-
\`add pattern\` scaffolds a namespaced PHP pattern shell under \`src/patterns/full/\` or \`src/patterns/sections/\` and records typed catalog metadata in \`PATTERNS\`; pass \`--catalog-title "Hero Photo"\` to override the generated catalog title,
|
|
37598
|
+
\`add pattern\` scaffolds a namespaced PHP pattern shell under \`src/patterns/full/\` or \`src/patterns/sections/\` and records typed catalog metadata in \`PATTERNS\`; pass \`--catalog-title "Hero Photo"\` to override the generated catalog title, pass \`--tags hero,landing\` for a comma-separated tag list, and repeat \`--tag hero --tag landing\` for single tag values.
|
|
37599
37599
|
\`add binding-source\` scaffolds shared PHP and editor registration under \`src/bindings/\`; pass \`--block\` and \`--attribute\` together to declare an end-to-end bindable attribute on an existing generated block. Pass \`--from-post-meta\` or \`--post-meta\` to generate a source backed by a typed post-meta contract; \`--meta-path\` selects one top-level field as the default binding arg.
|
|
37600
37600
|
\`add contract\` registers a standalone TypeScript wire contract under \`src/contracts/\` and generates a stable JSON Schema artifact without creating PHP route glue.
|
|
37601
37601
|
\`add rest-resource\` scaffolds plugin-level TypeScript REST contracts under \`src/rest/\` and PHP route glue under \`inc/rest/\`. Use \`--route-pattern\`, \`--permission-callback\`, \`--controller-class\`, and \`--controller-extends\` when an existing WordPress controller or permission model needs to own part of the generated route surface.
|
|
@@ -240181,17 +240181,21 @@ function resolvePatternScope(scope) {
|
|
|
240181
240181
|
}
|
|
240182
240182
|
throw new Error(`Pattern scope must be one of: ${PATTERN_CATALOG_SCOPE_IDS.join(", ")}.`);
|
|
240183
240183
|
}
|
|
240184
|
-
function
|
|
240184
|
+
function normalizePatternSectionRole(value2) {
|
|
240185
240185
|
if (value2 === undefined || value2.trim() === "") {
|
|
240186
240186
|
return;
|
|
240187
240187
|
}
|
|
240188
|
-
|
|
240188
|
+
const sectionRole = normalizeBlockSlug(value2);
|
|
240189
|
+
if (!PATTERN_SECTION_ROLE_PATTERN.test(sectionRole)) {
|
|
240190
|
+
throw new Error("Pattern section role must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens. Section roles apply only with `--scope section`.");
|
|
240191
|
+
}
|
|
240192
|
+
return sectionRole;
|
|
240189
240193
|
}
|
|
240190
240194
|
function normalizePatternTags(tags) {
|
|
240191
240195
|
const rawTags = typeof tags === "string" ? tags.split(",") : Array.isArray(tags) ? tags.flatMap((tag) => tag.split(",")) : [];
|
|
240192
240196
|
const normalizedTags = rawTags.map((tag) => normalizeBlockSlug(tag)).filter((tag) => tag.length > 0);
|
|
240193
240197
|
for (const tag of normalizedTags) {
|
|
240194
|
-
if (!
|
|
240198
|
+
if (!PATTERN_TAG_PATTERN.test(tag)) {
|
|
240195
240199
|
throw new Error(`Pattern tag "${tag}" must contain only lowercase letters, numbers, and hyphens.`);
|
|
240196
240200
|
}
|
|
240197
240201
|
}
|
|
@@ -240216,12 +240220,12 @@ function resolvePatternContentFile(patternSlug, patternScope, contentFile) {
|
|
|
240216
240220
|
}
|
|
240217
240221
|
function resolvePatternCatalogOptions(patternSlug, options) {
|
|
240218
240222
|
const patternScope = resolvePatternScope(options.patternScope);
|
|
240219
|
-
const sectionRole =
|
|
240223
|
+
const sectionRole = normalizePatternSectionRole(options.sectionRole);
|
|
240220
240224
|
if (patternScope === "section" && !sectionRole) {
|
|
240221
|
-
throw new Error("`wp-typia add pattern --scope section` requires --section-role <role
|
|
240225
|
+
throw new Error("`wp-typia add pattern --scope section` requires --section-role <role> because section-scoped patterns need a typed catalog section role.");
|
|
240222
240226
|
}
|
|
240223
240227
|
if (patternScope !== "section" && sectionRole) {
|
|
240224
|
-
throw new Error("`--section-role`
|
|
240228
|
+
throw new Error("`--section-role` only applies with `--scope section`. Use `--scope section --section-role <role>` or omit `--section-role` for full patterns.");
|
|
240225
240229
|
}
|
|
240226
240230
|
const title = options.catalogTitle && options.catalogTitle.trim() !== "" ? options.catalogTitle.trim() : toTitleCase(patternSlug);
|
|
240227
240231
|
const thumbnailUrl = normalizePatternThumbnailUrl(options.thumbnailUrl);
|
|
@@ -240234,12 +240238,11 @@ function resolvePatternCatalogOptions(patternSlug, options) {
|
|
|
240234
240238
|
title
|
|
240235
240239
|
};
|
|
240236
240240
|
}
|
|
240237
|
-
var PATTERN_CONTENT_FILE_ROOT2 = "src/patterns/"
|
|
240241
|
+
var PATTERN_CONTENT_FILE_ROOT2 = "src/patterns/";
|
|
240238
240242
|
var init_cli_add_workspace_pattern_options = __esm(() => {
|
|
240239
240243
|
init_cli_add_shared();
|
|
240240
240244
|
init_pattern_catalog();
|
|
240241
240245
|
init_string_case();
|
|
240242
|
-
PATTERN_TAG_PATTERN2 = /^[a-z0-9][a-z0-9-]*$/u;
|
|
240243
240246
|
});
|
|
240244
240247
|
|
|
240245
240248
|
// ../wp-typia-project-tools/src/runtime/cli-add-workspace-pattern-source-emitters.ts
|
|
@@ -244141,10 +244144,13 @@ __export(exports_cli_add, {
|
|
|
244141
244144
|
runAddAiFeatureCommand: () => runAddAiFeatureCommand,
|
|
244142
244145
|
runAddAdminViewCommand: () => runAddAdminViewCommand,
|
|
244143
244146
|
runAddAbilityCommand: () => runAddAbilityCommand,
|
|
244147
|
+
normalizeBlockSlug: () => normalizeBlockSlug,
|
|
244144
244148
|
isAddBlockTemplateId: () => isAddBlockTemplateId,
|
|
244145
244149
|
getWorkspaceBlockSelectOptionsAsync: () => getWorkspaceBlockSelectOptionsAsync,
|
|
244146
244150
|
getWorkspaceBlockSelectOptions: () => getWorkspaceBlockSelectOptions,
|
|
244147
244151
|
formatAddHelpText: () => formatAddHelpText,
|
|
244152
|
+
PATTERN_TAG_PATTERN: () => PATTERN_TAG_PATTERN,
|
|
244153
|
+
PATTERN_SECTION_ROLE_PATTERN: () => PATTERN_SECTION_ROLE_PATTERN,
|
|
244148
244154
|
PATTERN_CATALOG_SCOPE_IDS: () => PATTERN_CATALOG_SCOPE_IDS,
|
|
244149
244155
|
EDITOR_PLUGIN_SLOT_IDS: () => EDITOR_PLUGIN_SLOT_IDS,
|
|
244150
244156
|
ADD_KIND_IDS: () => ADD_KIND_IDS,
|
|
@@ -244157,13 +244163,7 @@ var init_cli_add = __esm(() => {
|
|
|
244157
244163
|
init_workspace_inventory();
|
|
244158
244164
|
});
|
|
244159
244165
|
|
|
244160
|
-
// ../wp-typia-project-tools/src/runtime/cli-scaffold.ts
|
|
244161
|
-
var exports_cli_scaffold = {};
|
|
244162
|
-
__export(exports_cli_scaffold, {
|
|
244163
|
-
runScaffoldFlow: () => runScaffoldFlow,
|
|
244164
|
-
getOptionalOnboarding: () => getOptionalOnboarding,
|
|
244165
|
-
getNextSteps: () => getNextSteps
|
|
244166
|
-
});
|
|
244166
|
+
// ../wp-typia-project-tools/src/runtime/cli-scaffold-files.ts
|
|
244167
244167
|
import { promises as fsp43 } from "fs";
|
|
244168
244168
|
import path91 from "path";
|
|
244169
244169
|
async function listRelativeProjectFiles(rootDir) {
|
|
@@ -244191,58 +244191,43 @@ async function assertDryRunTargetDirectoryReady(projectDir, allowExistingDir) {
|
|
|
244191
244191
|
throw new Error(formatNonEmptyTargetDirectoryError(projectDir));
|
|
244192
244192
|
}
|
|
244193
244193
|
}
|
|
244194
|
-
async function
|
|
244195
|
-
|
|
244196
|
-
|
|
244197
|
-
|
|
244198
|
-
|
|
244199
|
-
|
|
244200
|
-
|
|
244201
|
-
|
|
244202
|
-
|
|
244203
|
-
|
|
244204
|
-
|
|
244205
|
-
|
|
244206
|
-
|
|
244207
|
-
|
|
244208
|
-
|
|
244209
|
-
|
|
244210
|
-
|
|
244211
|
-
|
|
244212
|
-
|
|
244213
|
-
|
|
244214
|
-
|
|
244215
|
-
}
|
|
244216
|
-
|
|
244194
|
+
async function readGeneratedPackageScripts(projectDir) {
|
|
244195
|
+
try {
|
|
244196
|
+
const parsedPackageJson = await readJsonFile(path91.join(projectDir, "package.json"), {
|
|
244197
|
+
context: "generated package manifest"
|
|
244198
|
+
});
|
|
244199
|
+
const scripts = parsedPackageJson.scripts && typeof parsedPackageJson.scripts === "object" && !Array.isArray(parsedPackageJson.scripts) ? parsedPackageJson.scripts : {};
|
|
244200
|
+
return Object.entries(scripts).filter(([, value2]) => typeof value2 === "string").map(([scriptName]) => scriptName);
|
|
244201
|
+
} catch {
|
|
244202
|
+
return;
|
|
244203
|
+
}
|
|
244204
|
+
}
|
|
244205
|
+
var init_cli_scaffold_files = __esm(() => {
|
|
244206
|
+
init_scaffold_bootstrap();
|
|
244207
|
+
init_fs_async();
|
|
244208
|
+
init_json_utils();
|
|
244209
|
+
});
|
|
244210
|
+
|
|
244211
|
+
// ../wp-typia-project-tools/src/runtime/cli-scaffold-emission.ts
|
|
244212
|
+
import path92 from "path";
|
|
244213
|
+
async function emitScaffoldProject(options) {
|
|
244214
|
+
return scaffoldProject(options);
|
|
244215
|
+
}
|
|
244216
|
+
async function buildScaffoldDryRunPlan(options) {
|
|
244217
|
+
await assertDryRunTargetDirectoryReady(options.projectDir, options.allowExistingDir);
|
|
244217
244218
|
const { path: tempRoot, cleanup } = await createManagedTempRoot("wp-typia-scaffold-plan-");
|
|
244218
|
-
const previewProjectDir =
|
|
244219
|
+
const previewProjectDir = path92.join(tempRoot, "preview-project");
|
|
244219
244220
|
try {
|
|
244220
|
-
const result = await
|
|
244221
|
+
const result = await emitScaffoldProject({
|
|
244222
|
+
...options,
|
|
244221
244223
|
allowExistingDir: false,
|
|
244222
|
-
alternateRenderTargets,
|
|
244223
|
-
answers,
|
|
244224
|
-
cwd,
|
|
244225
|
-
dataStorageMode,
|
|
244226
|
-
externalLayerId,
|
|
244227
|
-
externalLayerSource,
|
|
244228
|
-
externalLayerSourceLabel,
|
|
244229
|
-
installDependencies,
|
|
244230
244224
|
noInstall: true,
|
|
244231
|
-
|
|
244232
|
-
packageManager,
|
|
244233
|
-
persistencePolicy,
|
|
244234
|
-
profile,
|
|
244235
|
-
projectDir: previewProjectDir,
|
|
244236
|
-
templateId,
|
|
244237
|
-
variant,
|
|
244238
|
-
withMigrationUi,
|
|
244239
|
-
withTestPreset,
|
|
244240
|
-
withWpEnv
|
|
244225
|
+
projectDir: previewProjectDir
|
|
244241
244226
|
});
|
|
244242
244227
|
const files = await listRelativeProjectFiles(previewProjectDir);
|
|
244243
244228
|
return {
|
|
244244
244229
|
plan: {
|
|
244245
|
-
dependencyInstall: noInstall ? "skipped-by-flag" : "would-install",
|
|
244230
|
+
dependencyInstall: options.noInstall ? "skipped-by-flag" : "would-install",
|
|
244246
244231
|
files
|
|
244247
244232
|
},
|
|
244248
244233
|
result
|
|
@@ -244251,19 +244236,77 @@ async function buildScaffoldDryRunPlan({
|
|
|
244251
244236
|
await cleanup();
|
|
244252
244237
|
}
|
|
244253
244238
|
}
|
|
244239
|
+
var init_cli_scaffold_emission = __esm(() => {
|
|
244240
|
+
init_cli_scaffold_files();
|
|
244241
|
+
init_scaffold();
|
|
244242
|
+
init_temp_roots();
|
|
244243
|
+
});
|
|
244244
|
+
|
|
244245
|
+
// ../wp-typia-project-tools/src/runtime/cli-scaffold-output.ts
|
|
244246
|
+
import path93 from "path";
|
|
244247
|
+
function quoteShellValue(value2) {
|
|
244248
|
+
if (!value2.startsWith("-") && /^[A-Za-z0-9._/@:-]+(?:\/[A-Za-z0-9._@:-]+)*$/.test(value2)) {
|
|
244249
|
+
return value2;
|
|
244250
|
+
}
|
|
244251
|
+
return `'${value2.replace(/'/g, `'"'"'`)}'`;
|
|
244252
|
+
}
|
|
244253
|
+
function getNextSteps({
|
|
244254
|
+
projectInput,
|
|
244255
|
+
projectDir,
|
|
244256
|
+
packageManager,
|
|
244257
|
+
noInstall,
|
|
244258
|
+
templateId
|
|
244259
|
+
}) {
|
|
244260
|
+
const cdTarget = path93.isAbsolute(projectInput) ? projectDir : projectInput;
|
|
244261
|
+
const steps = [`cd ${quoteShellValue(cdTarget)}`];
|
|
244262
|
+
if (noInstall) {
|
|
244263
|
+
steps.push(formatInstallCommand(packageManager));
|
|
244264
|
+
}
|
|
244265
|
+
steps.push(formatRunScript(packageManager, getPrimaryDevelopmentScript(templateId)));
|
|
244266
|
+
return steps;
|
|
244267
|
+
}
|
|
244268
|
+
function getOptionalOnboarding({
|
|
244269
|
+
availableScripts,
|
|
244270
|
+
packageManager,
|
|
244271
|
+
templateId,
|
|
244272
|
+
compoundPersistenceEnabled = false
|
|
244273
|
+
}) {
|
|
244274
|
+
return {
|
|
244275
|
+
note: getOptionalOnboardingNote(packageManager, templateId, {
|
|
244276
|
+
availableScripts,
|
|
244277
|
+
compoundPersistenceEnabled
|
|
244278
|
+
}),
|
|
244279
|
+
shortNote: getOptionalOnboardingShortNote(packageManager, templateId, {
|
|
244280
|
+
availableScripts,
|
|
244281
|
+
compoundPersistenceEnabled
|
|
244282
|
+
}),
|
|
244283
|
+
steps: getOptionalOnboardingSteps(packageManager, templateId, {
|
|
244284
|
+
availableScripts,
|
|
244285
|
+
compoundPersistenceEnabled
|
|
244286
|
+
})
|
|
244287
|
+
};
|
|
244288
|
+
}
|
|
244289
|
+
var init_cli_scaffold_output = __esm(() => {
|
|
244290
|
+
init_package_managers();
|
|
244291
|
+
init_scaffold_onboarding();
|
|
244292
|
+
init_local_dev_presets();
|
|
244293
|
+
});
|
|
244294
|
+
|
|
244295
|
+
// ../wp-typia-project-tools/src/runtime/cli-scaffold-validation.ts
|
|
244296
|
+
import path94 from "path";
|
|
244254
244297
|
function validateCreateProjectInput(projectInput) {
|
|
244255
244298
|
const normalizedProjectInput = projectInput.trim();
|
|
244256
244299
|
if (normalizedProjectInput.length === 0) {
|
|
244257
244300
|
throw new Error("Project directory is required. Usage: wp-typia create <project-dir> (or wp-typia <project-dir> when <project-dir> is the only positional argument).");
|
|
244258
244301
|
}
|
|
244259
|
-
const normalizedProjectPath =
|
|
244302
|
+
const normalizedProjectPath = path94.normalize(normalizedProjectInput).replace(/[\\/]+$/u, "") || path94.normalize(normalizedProjectInput);
|
|
244260
244303
|
if (normalizedProjectPath === "." || normalizedProjectPath === "..") {
|
|
244261
244304
|
throw new Error("`wp-typia create` requires a new project directory. Use an explicit child directory instead of `.` or `..`.");
|
|
244262
244305
|
}
|
|
244263
244306
|
}
|
|
244264
244307
|
function collectProjectDirectoryWarnings(projectDir) {
|
|
244265
244308
|
const warnings = [];
|
|
244266
|
-
const projectName =
|
|
244309
|
+
const projectName = path94.basename(projectDir);
|
|
244267
244310
|
if (/\s/u.test(projectName)) {
|
|
244268
244311
|
warnings.push(`Project directory "${projectName}" contains spaces. The generated next-step commands will be quoted, but a simple kebab-case directory name is usually easier to use with shells and downstream tooling.`);
|
|
244269
244312
|
}
|
|
@@ -244372,7 +244415,7 @@ async function resolveOptionalSelection({
|
|
|
244372
244415
|
if (!shouldResolve) {
|
|
244373
244416
|
return;
|
|
244374
244417
|
}
|
|
244375
|
-
if (explicitValue) {
|
|
244418
|
+
if (explicitValue !== undefined) {
|
|
244376
244419
|
return parseSelectableValue(label, explicitValue, isValue, allowedValues);
|
|
244377
244420
|
}
|
|
244378
244421
|
if (yes) {
|
|
@@ -244405,48 +244448,21 @@ async function resolveOptionalBooleanFlag({
|
|
|
244405
244448
|
}
|
|
244406
244449
|
return defaultValue;
|
|
244407
244450
|
}
|
|
244408
|
-
|
|
244409
|
-
|
|
244410
|
-
|
|
244411
|
-
|
|
244412
|
-
|
|
244413
|
-
}
|
|
244414
|
-
|
|
244415
|
-
|
|
244416
|
-
|
|
244417
|
-
|
|
244418
|
-
|
|
244419
|
-
|
|
244420
|
-
|
|
244421
|
-
|
|
244422
|
-
|
|
244423
|
-
if (noInstall) {
|
|
244424
|
-
steps.push(formatInstallCommand(packageManager));
|
|
244425
|
-
}
|
|
244426
|
-
steps.push(formatRunScript(packageManager, getPrimaryDevelopmentScript(templateId)));
|
|
244427
|
-
return steps;
|
|
244428
|
-
}
|
|
244429
|
-
function getOptionalOnboarding({
|
|
244430
|
-
availableScripts,
|
|
244431
|
-
packageManager,
|
|
244432
|
-
templateId,
|
|
244433
|
-
compoundPersistenceEnabled = false
|
|
244434
|
-
}) {
|
|
244435
|
-
return {
|
|
244436
|
-
note: getOptionalOnboardingNote(packageManager, templateId, {
|
|
244437
|
-
availableScripts,
|
|
244438
|
-
compoundPersistenceEnabled
|
|
244439
|
-
}),
|
|
244440
|
-
shortNote: getOptionalOnboardingShortNote(packageManager, templateId, {
|
|
244441
|
-
availableScripts,
|
|
244442
|
-
compoundPersistenceEnabled
|
|
244443
|
-
}),
|
|
244444
|
-
steps: getOptionalOnboardingSteps(packageManager, templateId, {
|
|
244445
|
-
availableScripts,
|
|
244446
|
-
compoundPersistenceEnabled
|
|
244447
|
-
})
|
|
244448
|
-
};
|
|
244449
|
-
}
|
|
244451
|
+
var init_cli_scaffold_validation = __esm(() => {
|
|
244452
|
+
init_alternate_render_targets();
|
|
244453
|
+
init_compound_inner_blocks();
|
|
244454
|
+
init_cli_validation();
|
|
244455
|
+
init_template_registry();
|
|
244456
|
+
});
|
|
244457
|
+
|
|
244458
|
+
// ../wp-typia-project-tools/src/runtime/cli-scaffold.ts
|
|
244459
|
+
var exports_cli_scaffold = {};
|
|
244460
|
+
__export(exports_cli_scaffold, {
|
|
244461
|
+
runScaffoldFlow: () => runScaffoldFlow,
|
|
244462
|
+
getOptionalOnboarding: () => getOptionalOnboarding,
|
|
244463
|
+
getNextSteps: () => getNextSteps
|
|
244464
|
+
});
|
|
244465
|
+
import path95 from "path";
|
|
244450
244466
|
async function runScaffoldFlow({
|
|
244451
244467
|
projectInput,
|
|
244452
244468
|
cwd = process.cwd(),
|
|
@@ -244568,8 +244584,8 @@ async function runScaffoldFlow({
|
|
|
244568
244584
|
select: selectWithMigrationUi,
|
|
244569
244585
|
yes
|
|
244570
244586
|
});
|
|
244571
|
-
const projectDir =
|
|
244572
|
-
const projectName =
|
|
244587
|
+
const projectDir = path95.resolve(cwd, projectInput);
|
|
244588
|
+
const projectName = path95.basename(projectDir);
|
|
244573
244589
|
const answers = await collectScaffoldAnswers({
|
|
244574
244590
|
dataStorageMode: resolvedDataStorage,
|
|
244575
244591
|
namespace,
|
|
@@ -244585,7 +244601,7 @@ async function runScaffoldFlow({
|
|
|
244585
244601
|
if (resolvedTemplateId === "compound" && resolvedInnerBlocksPreset) {
|
|
244586
244602
|
answers.compoundInnerBlocksPreset = resolvedInnerBlocksPreset;
|
|
244587
244603
|
}
|
|
244588
|
-
const
|
|
244604
|
+
const emissionOptions = {
|
|
244589
244605
|
allowExistingDir,
|
|
244590
244606
|
alternateRenderTargets,
|
|
244591
244607
|
answers,
|
|
@@ -244606,43 +244622,12 @@ async function runScaffoldFlow({
|
|
|
244606
244622
|
withMigrationUi: resolvedWithMigrationUi,
|
|
244607
244623
|
withTestPreset: resolvedWithTestPreset,
|
|
244608
244624
|
withWpEnv: resolvedWithWpEnv
|
|
244609
|
-
}
|
|
244625
|
+
};
|
|
244626
|
+
const resolvedResult = dryRun ? await buildScaffoldDryRunPlan(emissionOptions) : {
|
|
244610
244627
|
plan: undefined,
|
|
244611
|
-
result: await
|
|
244612
|
-
alternateRenderTargets,
|
|
244613
|
-
answers,
|
|
244614
|
-
allowExistingDir,
|
|
244615
|
-
cwd,
|
|
244616
|
-
dataStorageMode: resolvedDataStorage,
|
|
244617
|
-
externalLayerId: resolvedExternalLayerSelection.externalLayerId,
|
|
244618
|
-
externalLayerSource: resolvedExternalLayerSelection.externalLayerSource,
|
|
244619
|
-
externalLayerSourceLabel: normalizedExternalLayerSource,
|
|
244620
|
-
installDependencies,
|
|
244621
|
-
noInstall,
|
|
244622
|
-
onProgress,
|
|
244623
|
-
packageManager: resolvedPackageManager,
|
|
244624
|
-
persistencePolicy: resolvedPersistencePolicy,
|
|
244625
|
-
profile: resolvedProfile,
|
|
244626
|
-
projectDir,
|
|
244627
|
-
templateId: resolvedTemplateId,
|
|
244628
|
-
variant,
|
|
244629
|
-
withMigrationUi: resolvedWithMigrationUi,
|
|
244630
|
-
withTestPreset: resolvedWithTestPreset,
|
|
244631
|
-
withWpEnv: resolvedWithWpEnv
|
|
244632
|
-
})
|
|
244628
|
+
result: await emitScaffoldProject(emissionOptions)
|
|
244633
244629
|
};
|
|
244634
|
-
|
|
244635
|
-
if (!dryRun) {
|
|
244636
|
-
try {
|
|
244637
|
-
const parsedPackageJson = await readJsonFile(path91.join(projectDir, "package.json"), {
|
|
244638
|
-
context: "generated package manifest"
|
|
244639
|
-
});
|
|
244640
|
-
const scripts = parsedPackageJson.scripts && typeof parsedPackageJson.scripts === "object" && !Array.isArray(parsedPackageJson.scripts) ? parsedPackageJson.scripts : {};
|
|
244641
|
-
availableScripts = Object.entries(scripts).filter(([, value2]) => typeof value2 === "string").map(([scriptName]) => scriptName);
|
|
244642
|
-
} catch {
|
|
244643
|
-
availableScripts = undefined;
|
|
244644
|
-
}
|
|
244645
|
-
}
|
|
244630
|
+
const availableScripts = dryRun ? undefined : await readGeneratedPackageScripts(projectDir);
|
|
244646
244631
|
return {
|
|
244647
244632
|
dryRun,
|
|
244648
244633
|
optionalOnboarding: getOptionalOnboarding({
|
|
@@ -244681,19 +244666,16 @@ async function runScaffoldFlow({
|
|
|
244681
244666
|
}
|
|
244682
244667
|
var init_cli_scaffold = __esm(() => {
|
|
244683
244668
|
init_scaffold();
|
|
244684
|
-
init_alternate_render_targets();
|
|
244685
244669
|
init_compound_inner_blocks();
|
|
244686
244670
|
init_scaffold_template_variable_groups();
|
|
244687
|
-
|
|
244688
|
-
|
|
244689
|
-
|
|
244690
|
-
|
|
244691
|
-
init_scaffold_bootstrap();
|
|
244692
|
-
init_fs_async();
|
|
244693
|
-
init_json_utils();
|
|
244671
|
+
init_cli_scaffold_emission();
|
|
244672
|
+
init_cli_scaffold_files();
|
|
244673
|
+
init_cli_scaffold_output();
|
|
244674
|
+
init_cli_scaffold_validation();
|
|
244694
244675
|
init_template_registry();
|
|
244695
244676
|
init_external_layer_selection();
|
|
244696
244677
|
init_cli_validation();
|
|
244678
|
+
init_cli_scaffold_output();
|
|
244697
244679
|
});
|
|
244698
244680
|
|
|
244699
244681
|
// ../wp-typia-project-tools/src/runtime/cli-templates.ts
|
|
@@ -244855,7 +244837,7 @@ var init_cli_templates = __esm(() => {
|
|
|
244855
244837
|
|
|
244856
244838
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-shared.ts
|
|
244857
244839
|
import fs32 from "fs";
|
|
244858
|
-
import
|
|
244840
|
+
import path96 from "path";
|
|
244859
244841
|
function createDoctorCheck(label, status, detail, code) {
|
|
244860
244842
|
return code ? { code, detail, label, status } : { detail, label, status };
|
|
244861
244843
|
}
|
|
@@ -244866,10 +244848,10 @@ function getWorkspaceBootstrapRelativePath(packageName) {
|
|
|
244866
244848
|
return `${packageName.split("/").pop() ?? packageName}.php`;
|
|
244867
244849
|
}
|
|
244868
244850
|
function resolveWorkspaceBootstrapPath(projectDir, packageName) {
|
|
244869
|
-
return
|
|
244851
|
+
return path96.join(projectDir, getWorkspaceBootstrapRelativePath(packageName));
|
|
244870
244852
|
}
|
|
244871
244853
|
function checkExistingFiles(projectDir, label, filePaths) {
|
|
244872
|
-
const missing = filePaths.filter((filePath) => typeof filePath === "string").filter((filePath) => !fs32.existsSync(
|
|
244854
|
+
const missing = filePaths.filter((filePath) => typeof filePath === "string").filter((filePath) => !fs32.existsSync(path96.join(projectDir, filePath)));
|
|
244873
244855
|
return createDoctorCheck(label, missing.length === 0 ? "pass" : "fail", missing.length === 0 ? "All referenced files exist" : `Missing: ${missing.join(", ")}`);
|
|
244874
244856
|
}
|
|
244875
244857
|
var WORKSPACE_BINDING_SERVER_GLOB = "/src/bindings/*/server.php", WORKSPACE_BINDING_EDITOR_SCRIPT = "build/bindings/index.js", WORKSPACE_BINDING_EDITOR_ASSET = "build/bindings/index.asset.php", WORKSPACE_REST_RESOURCE_GLOB = "/inc/rest/*.php", WORKSPACE_POST_META_GLOB = "/inc/post-meta/*.php", WORKSPACE_ABILITY_GLOB = "/inc/abilities/*.php", WORKSPACE_ABILITY_EDITOR_SCRIPT = "build/abilities/index.js", WORKSPACE_ABILITY_EDITOR_ASSET = "build/abilities/index.asset.php", WORKSPACE_AI_FEATURE_GLOB = "/inc/ai-features/*.php", WORKSPACE_ADMIN_VIEW_GLOB = "/inc/admin-views/*.php", WORKSPACE_ADMIN_VIEW_SCRIPT = "build/admin-views/index.js", WORKSPACE_ADMIN_VIEW_ASSET = "build/admin-views/index.asset.php", WORKSPACE_ADMIN_VIEW_STYLE = "build/admin-views/style-index.css", WORKSPACE_EDITOR_PLUGIN_EDITOR_SCRIPT = "build/editor-plugins/index.js", WORKSPACE_EDITOR_PLUGIN_EDITOR_ASSET = "build/editor-plugins/index.asset.php", WORKSPACE_EDITOR_PLUGIN_EDITOR_STYLE = "build/editor-plugins/style-index.css", WORKSPACE_GENERATED_BLOCK_ARTIFACTS, WORKSPACE_FULL_BLOCK_NAME_PATTERN;
|
|
@@ -244889,7 +244871,7 @@ import { execFileSync as execFileSync3 } from "child_process";
|
|
|
244889
244871
|
import { access, constants as fsConstants, rm as rm2, writeFile as writeFile6 } from "fs/promises";
|
|
244890
244872
|
import fs33 from "fs";
|
|
244891
244873
|
import os5 from "os";
|
|
244892
|
-
import
|
|
244874
|
+
import path97 from "path";
|
|
244893
244875
|
function readCommandVersion(command, args = ["--version"]) {
|
|
244894
244876
|
try {
|
|
244895
244877
|
return execFileSync3(command, args, {
|
|
@@ -244913,7 +244895,7 @@ async function checkWritableDirectory(directory) {
|
|
|
244913
244895
|
}
|
|
244914
244896
|
}
|
|
244915
244897
|
async function checkTempDirectory() {
|
|
244916
|
-
const tempFile =
|
|
244898
|
+
const tempFile = path97.join(os5.tmpdir(), `wp-typia-${Date.now()}.tmp`);
|
|
244917
244899
|
try {
|
|
244918
244900
|
await writeFile6(tempFile, "ok", "utf8");
|
|
244919
244901
|
await rm2(tempFile, { force: true });
|
|
@@ -244927,7 +244909,7 @@ function getTemplateDoctorChecks() {
|
|
|
244927
244909
|
for (const template of listTemplates()) {
|
|
244928
244910
|
if (!isBuiltInTemplateId(template.id)) {
|
|
244929
244911
|
const templateDirExists = fs33.existsSync(template.templateDir);
|
|
244930
|
-
const hasAssets2 = templateDirExists && fs33.existsSync(
|
|
244912
|
+
const hasAssets2 = templateDirExists && fs33.existsSync(path97.join(template.templateDir, "package.json.mustache"));
|
|
244931
244913
|
checks3.push({
|
|
244932
244914
|
status: !templateDirExists || hasAssets2 ? "pass" : "fail",
|
|
244933
244915
|
label: `Template ${template.id}`,
|
|
@@ -244952,7 +244934,7 @@ function getTemplateDoctorChecks() {
|
|
|
244952
244934
|
])) : getBuiltInTemplateLayerDirs(builtInTemplateId);
|
|
244953
244935
|
const missingRequiredLayer = layerDirs.some((layerDir) => !fs33.existsSync(layerDir) && !isOmittableBuiltInTemplateLayerDir(builtInTemplateId, layerDir));
|
|
244954
244936
|
const existingLayerDirs = layerDirs.filter((layerDir) => fs33.existsSync(layerDir));
|
|
244955
|
-
const hasAssets = !missingRequiredLayer && existingLayerDirs.some((layerDir) => fs33.existsSync(
|
|
244937
|
+
const hasAssets = !missingRequiredLayer && existingLayerDirs.some((layerDir) => fs33.existsSync(path97.join(layerDir, "package.json.mustache"))) && existingLayerDirs.some((layerDir) => fs33.existsSync(path97.join(layerDir, "src")));
|
|
244956
244938
|
checks3.push({
|
|
244957
244939
|
status: hasAssets ? "pass" : "fail",
|
|
244958
244940
|
label: `Template ${template.id}`,
|
|
@@ -244984,12 +244966,12 @@ var init_cli_doctor_environment = __esm(() => {
|
|
|
244984
244966
|
|
|
244985
244967
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-bindings.ts
|
|
244986
244968
|
import fs34 from "fs";
|
|
244987
|
-
import
|
|
244969
|
+
import path98 from "path";
|
|
244988
244970
|
import { parseScaffoldBlockMetadata as parseScaffoldBlockMetadata2 } from "@wp-typia/block-runtime/blocks";
|
|
244989
244971
|
function checkWorkspaceBindingBootstrap(projectDir, packageName) {
|
|
244990
244972
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
244991
244973
|
if (!fs34.existsSync(bootstrapPath)) {
|
|
244992
|
-
return createDoctorCheck("Binding bootstrap", "fail", `Missing ${
|
|
244974
|
+
return createDoctorCheck("Binding bootstrap", "fail", `Missing ${path98.basename(bootstrapPath)}`);
|
|
244993
244975
|
}
|
|
244994
244976
|
const source = fs34.readFileSync(bootstrapPath, "utf8");
|
|
244995
244977
|
const hasServerGlob = source.includes(WORKSPACE_BINDING_SERVER_GLOB);
|
|
@@ -244999,11 +244981,11 @@ function checkWorkspaceBindingBootstrap(projectDir, packageName) {
|
|
|
244999
244981
|
return createDoctorCheck("Binding bootstrap", hasServerGlob && hasEditorEnqueueHook && hasEditorScript && hasEditorAsset ? "pass" : "fail", hasServerGlob && hasEditorEnqueueHook && hasEditorScript && hasEditorAsset ? "Binding source PHP and editor bootstrap hooks are present" : "Missing binding source PHP require glob or editor enqueue hook");
|
|
245000
244982
|
}
|
|
245001
244983
|
function checkWorkspaceBindingSourcesIndex(projectDir, bindingSources) {
|
|
245002
|
-
const indexRelativePath = [
|
|
244984
|
+
const indexRelativePath = [path98.join("src", "bindings", "index.ts"), path98.join("src", "bindings", "index.js")].find((relativePath) => fs34.existsSync(path98.join(projectDir, relativePath)));
|
|
245003
244985
|
if (!indexRelativePath) {
|
|
245004
244986
|
return createDoctorCheck("Binding sources index", "fail", "Missing src/bindings/index.ts or src/bindings/index.js");
|
|
245005
244987
|
}
|
|
245006
|
-
const indexPath =
|
|
244988
|
+
const indexPath = path98.join(projectDir, indexRelativePath);
|
|
245007
244989
|
const source = fs34.readFileSync(indexPath, "utf8");
|
|
245008
244990
|
const missingImports = bindingSources.filter((bindingSource) => !source.includes(`./${bindingSource.slug}/editor`));
|
|
245009
244991
|
return createDoctorCheck("Binding sources index", missingImports.length === 0 ? "pass" : "fail", missingImports.length === 0 ? "Binding source editor registrations are aggregated" : `Missing editor imports for: ${missingImports.map((entry) => entry.slug).join(", ")}`);
|
|
@@ -245020,8 +245002,8 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
|
|
|
245020
245002
|
if (!registeredBlockSlugs.has(bindingSource.block)) {
|
|
245021
245003
|
return createDoctorCheck(`Binding target ${bindingSource.slug}`, "fail", `Binding target references unknown block "${bindingSource.block}".`);
|
|
245022
245004
|
}
|
|
245023
|
-
const blockJsonRelativePath =
|
|
245024
|
-
const blockJsonPath =
|
|
245005
|
+
const blockJsonRelativePath = path98.join("src", "blocks", bindingSource.block, "block.json");
|
|
245006
|
+
const blockJsonPath = path98.join(projectDir, blockJsonRelativePath);
|
|
245025
245007
|
const issues = [];
|
|
245026
245008
|
try {
|
|
245027
245009
|
const blockJson = parseScaffoldBlockMetadata2(readJsonFileSync(blockJsonPath, {
|
|
@@ -245039,7 +245021,7 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
|
|
|
245039
245021
|
} catch (error48) {
|
|
245040
245022
|
issues.push(error48 instanceof Error ? `Unable to read ${blockJsonRelativePath}: ${error48.message}` : `Unable to read ${blockJsonRelativePath}.`);
|
|
245041
245023
|
}
|
|
245042
|
-
const serverPath =
|
|
245024
|
+
const serverPath = path98.join(projectDir, bindingSource.serverFile);
|
|
245043
245025
|
if (fs34.existsSync(serverPath)) {
|
|
245044
245026
|
const serverSource = fs34.readFileSync(serverPath, "utf8");
|
|
245045
245027
|
const supportedAttributesFilter = `block_bindings_supported_attributes_${workspace.workspace.namespace}/${bindingSource.block}`;
|
|
@@ -245052,7 +245034,7 @@ function checkWorkspaceBindingTarget(projectDir, workspace, registeredBlockSlugs
|
|
|
245052
245034
|
} else {
|
|
245053
245035
|
issues.push(`Missing ${bindingSource.serverFile}`);
|
|
245054
245036
|
}
|
|
245055
|
-
const editorPath =
|
|
245037
|
+
const editorPath = path98.join(projectDir, bindingSource.editorFile);
|
|
245056
245038
|
if (fs34.existsSync(editorPath)) {
|
|
245057
245039
|
const editorSource = fs34.readFileSync(editorPath, "utf8");
|
|
245058
245040
|
const blockName = `${workspace.workspace.namespace}/${bindingSource.block}`;
|
|
@@ -245092,7 +245074,7 @@ function checkWorkspaceBindingPostMeta(projectDir, inventory, bindingSource) {
|
|
|
245092
245074
|
} catch (error48) {
|
|
245093
245075
|
issues.push(error48 instanceof Error ? error48.message : String(error48));
|
|
245094
245076
|
}
|
|
245095
|
-
const serverPath =
|
|
245077
|
+
const serverPath = path98.join(projectDir, bindingSource.serverFile);
|
|
245096
245078
|
if (fs34.existsSync(serverPath)) {
|
|
245097
245079
|
const serverSource = fs34.readFileSync(serverPath, "utf8");
|
|
245098
245080
|
if (!serverSource.includes("get_post_meta")) {
|
|
@@ -245107,7 +245089,7 @@ function checkWorkspaceBindingPostMeta(projectDir, inventory, bindingSource) {
|
|
|
245107
245089
|
} else {
|
|
245108
245090
|
issues.push(`Missing ${bindingSource.serverFile}`);
|
|
245109
245091
|
}
|
|
245110
|
-
const editorPath =
|
|
245092
|
+
const editorPath = path98.join(projectDir, bindingSource.editorFile);
|
|
245111
245093
|
if (fs34.existsSync(editorPath)) {
|
|
245112
245094
|
const editorSource = fs34.readFileSync(editorPath, "utf8");
|
|
245113
245095
|
if (!editorSource.includes("POST_META_BINDING_FIELDS")) {
|
|
@@ -245155,7 +245137,7 @@ var init_cli_doctor_workspace_bindings = __esm(() => {
|
|
|
245155
245137
|
|
|
245156
245138
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-block-addons.ts
|
|
245157
245139
|
import fs35 from "fs";
|
|
245158
|
-
import
|
|
245140
|
+
import path99 from "path";
|
|
245159
245141
|
function isNestedPatternContentFile(patternFile) {
|
|
245160
245142
|
if (!patternFile) {
|
|
245161
245143
|
return false;
|
|
@@ -245166,7 +245148,7 @@ function isNestedPatternContentFile(patternFile) {
|
|
|
245166
245148
|
function checkWorkspacePatternBootstrap(projectDir, packageName, requiresNestedPatternGlob) {
|
|
245167
245149
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
245168
245150
|
if (!fs35.existsSync(bootstrapPath)) {
|
|
245169
|
-
return createDoctorCheck("Pattern bootstrap", "fail", `Missing ${
|
|
245151
|
+
return createDoctorCheck("Pattern bootstrap", "fail", `Missing ${path99.basename(bootstrapPath)}`);
|
|
245170
245152
|
}
|
|
245171
245153
|
const source = fs35.readFileSync(bootstrapPath, "utf8");
|
|
245172
245154
|
const hasCategoryAnchor = source.includes("register_block_pattern_category");
|
|
@@ -245176,9 +245158,9 @@ function checkWorkspacePatternBootstrap(projectDir, packageName, requiresNestedP
|
|
|
245176
245158
|
return createDoctorCheck("Pattern bootstrap", hasCategoryAnchor && hasRequiredPatternGlobs ? "pass" : "fail", hasCategoryAnchor && hasRequiredPatternGlobs ? "Pattern category and loader hooks are present" : requiresNestedPatternGlob ? "Missing pattern category registration or nested src/patterns loader hook" : "Missing pattern category registration or src/patterns loader hook");
|
|
245177
245159
|
}
|
|
245178
245160
|
function checkVariationEntrypoint(projectDir, blockSlug) {
|
|
245179
|
-
const entryPath =
|
|
245161
|
+
const entryPath = path99.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
|
|
245180
245162
|
if (!fs35.existsSync(entryPath)) {
|
|
245181
|
-
return createDoctorCheck(`Variation entrypoint ${blockSlug}`, "fail", `Missing ${
|
|
245163
|
+
return createDoctorCheck(`Variation entrypoint ${blockSlug}`, "fail", `Missing ${path99.relative(projectDir, entryPath)}`);
|
|
245182
245164
|
}
|
|
245183
245165
|
const source = fs35.readFileSync(entryPath, "utf8");
|
|
245184
245166
|
const hasImport = hasUncommentedPattern(source, WORKSPACE_VARIATIONS_IMPORT_PATTERN);
|
|
@@ -245186,9 +245168,9 @@ function checkVariationEntrypoint(projectDir, blockSlug) {
|
|
|
245186
245168
|
return createDoctorCheck(`Variation entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall ? "Variations registration hook is present" : "Missing ./variations import or registerWorkspaceVariations() call");
|
|
245187
245169
|
}
|
|
245188
245170
|
function checkBlockStyleEntrypoint(projectDir, blockSlug) {
|
|
245189
|
-
const entryPath =
|
|
245171
|
+
const entryPath = path99.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
|
|
245190
245172
|
if (!fs35.existsSync(entryPath)) {
|
|
245191
|
-
return createDoctorCheck(`Block style entrypoint ${blockSlug}`, "fail", `Missing ${
|
|
245173
|
+
return createDoctorCheck(`Block style entrypoint ${blockSlug}`, "fail", `Missing ${path99.relative(projectDir, entryPath)}`);
|
|
245192
245174
|
}
|
|
245193
245175
|
const source = fs35.readFileSync(entryPath, "utf8");
|
|
245194
245176
|
const hasImport = hasUncommentedPattern(source, WORKSPACE_BLOCK_STYLES_IMPORT_PATTERN);
|
|
@@ -245196,9 +245178,9 @@ function checkBlockStyleEntrypoint(projectDir, blockSlug) {
|
|
|
245196
245178
|
return createDoctorCheck(`Block style entrypoint ${blockSlug}`, hasImport && hasCall ? "pass" : "fail", hasImport && hasCall ? "Block style registration hook is present" : "Missing ./styles import or registerWorkspaceBlockStyles() call");
|
|
245197
245179
|
}
|
|
245198
245180
|
function checkBlockTransformEntrypoint(projectDir, blockSlug) {
|
|
245199
|
-
const entryPath =
|
|
245181
|
+
const entryPath = path99.join(projectDir, "src", "blocks", blockSlug, "index.tsx");
|
|
245200
245182
|
if (!fs35.existsSync(entryPath)) {
|
|
245201
|
-
return createDoctorCheck(`Block transform entrypoint ${blockSlug}`, "fail", `Missing ${
|
|
245183
|
+
return createDoctorCheck(`Block transform entrypoint ${blockSlug}`, "fail", `Missing ${path99.relative(projectDir, entryPath)}`);
|
|
245202
245184
|
}
|
|
245203
245185
|
const source = fs35.readFileSync(entryPath, "utf8");
|
|
245204
245186
|
const hasImport = hasUncommentedPattern(source, WORKSPACE_BLOCK_TRANSFORMS_IMPORT_PATTERN);
|
|
@@ -245241,7 +245223,7 @@ function getWorkspaceBlockAddonDoctorChecks(workspace, inventory, registeredBloc
|
|
|
245241
245223
|
}
|
|
245242
245224
|
for (const blockSlug of blockStyleTargetBlocks) {
|
|
245243
245225
|
checks3.push(checkExistingFiles(workspace.projectDir, `Block style registry ${blockSlug}`, [
|
|
245244
|
-
|
|
245226
|
+
path99.join("src", "blocks", blockSlug, "styles", "index.ts")
|
|
245245
245227
|
]));
|
|
245246
245228
|
checks3.push(checkBlockStyleEntrypoint(workspace.projectDir, blockSlug));
|
|
245247
245229
|
}
|
|
@@ -245257,11 +245239,11 @@ function getWorkspaceBlockAddonDoctorChecks(workspace, inventory, registeredBloc
|
|
|
245257
245239
|
}
|
|
245258
245240
|
for (const blockSlug of blockTransformTargetBlocks) {
|
|
245259
245241
|
checks3.push(checkExistingFiles(workspace.projectDir, `Block transform registry ${blockSlug}`, [
|
|
245260
|
-
|
|
245242
|
+
path99.join("src", "blocks", blockSlug, "transforms", "index.ts")
|
|
245261
245243
|
]));
|
|
245262
245244
|
checks3.push(checkBlockTransformEntrypoint(workspace.projectDir, blockSlug));
|
|
245263
245245
|
}
|
|
245264
|
-
const shouldCheckPatternBootstrap = inventory.patterns.length > 0 || fs35.existsSync(
|
|
245246
|
+
const shouldCheckPatternBootstrap = inventory.patterns.length > 0 || fs35.existsSync(path99.join(workspace.projectDir, "src", "patterns"));
|
|
245265
245247
|
if (shouldCheckPatternBootstrap) {
|
|
245266
245248
|
const requiresNestedPatternGlob = inventory.patterns.some((pattern) => isNestedPatternContentFile(resolvePatternCatalogContentFile(pattern)));
|
|
245267
245249
|
checks3.push(checkWorkspacePatternBootstrap(workspace.projectDir, workspace.packageName, requiresNestedPatternGlob));
|
|
@@ -245293,10 +245275,10 @@ var init_cli_doctor_workspace_block_addons = __esm(() => {
|
|
|
245293
245275
|
|
|
245294
245276
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-block-iframe.ts
|
|
245295
245277
|
import fs36 from "fs";
|
|
245296
|
-
import
|
|
245278
|
+
import path100 from "path";
|
|
245297
245279
|
import { parseScaffoldBlockMetadata as parseScaffoldBlockMetadata3 } from "@wp-typia/block-runtime/blocks";
|
|
245298
245280
|
function normalizePathSeparators(relativePath) {
|
|
245299
|
-
return relativePath.split(
|
|
245281
|
+
return relativePath.split(path100.sep).join("/");
|
|
245300
245282
|
}
|
|
245301
245283
|
function hasRegisteredBlockAsset(value2) {
|
|
245302
245284
|
if (typeof value2 === "string") {
|
|
@@ -245308,8 +245290,8 @@ function hasRegisteredBlockAsset(value2) {
|
|
|
245308
245290
|
return false;
|
|
245309
245291
|
}
|
|
245310
245292
|
function readWorkspaceBlockIframeMetadata(projectDir, blockSlug) {
|
|
245311
|
-
const blockJsonRelativePath =
|
|
245312
|
-
const blockJsonPath =
|
|
245293
|
+
const blockJsonRelativePath = path100.join("src", "blocks", blockSlug, "block.json");
|
|
245294
|
+
const blockJsonPath = path100.join(projectDir, blockJsonRelativePath);
|
|
245313
245295
|
if (!fs36.existsSync(blockJsonPath)) {
|
|
245314
245296
|
return {
|
|
245315
245297
|
blockJsonRelativePath,
|
|
@@ -245336,8 +245318,8 @@ function isWorkspaceBlockEditorSource(relativePath) {
|
|
|
245336
245318
|
return false;
|
|
245337
245319
|
}
|
|
245338
245320
|
const normalizedRelativePath = normalizePathSeparators(relativePath);
|
|
245339
|
-
const normalizedDirName =
|
|
245340
|
-
const normalizedBaseName =
|
|
245321
|
+
const normalizedDirName = path100.posix.dirname(normalizedRelativePath);
|
|
245322
|
+
const normalizedBaseName = path100.posix.basename(normalizedRelativePath, path100.posix.extname(normalizedRelativePath));
|
|
245341
245323
|
if (WORKSPACE_BLOCK_EDITOR_SOURCE_BASENAMES.has(normalizedBaseName)) {
|
|
245342
245324
|
return true;
|
|
245343
245325
|
}
|
|
@@ -245345,11 +245327,11 @@ function isWorkspaceBlockEditorSource(relativePath) {
|
|
|
245345
245327
|
return pathSegments.some((segment) => WORKSPACE_BLOCK_EDITOR_SOURCE_DIRECTORIES.has(segment));
|
|
245346
245328
|
}
|
|
245347
245329
|
function isWorkspaceBlockSaveSource(relativePath) {
|
|
245348
|
-
const normalizedBaseName =
|
|
245330
|
+
const normalizedBaseName = path100.basename(relativePath, path100.extname(relativePath));
|
|
245349
245331
|
return normalizedBaseName === "save";
|
|
245350
245332
|
}
|
|
245351
245333
|
function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
|
|
245352
|
-
const blockDir =
|
|
245334
|
+
const blockDir = path100.join(projectDir, "src", "blocks", blockSlug);
|
|
245353
245335
|
if (!fs36.existsSync(blockDir)) {
|
|
245354
245336
|
return [];
|
|
245355
245337
|
}
|
|
@@ -245361,7 +245343,7 @@ function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
|
|
|
245361
245343
|
continue;
|
|
245362
245344
|
}
|
|
245363
245345
|
for (const entry of fs36.readdirSync(currentDir, { withFileTypes: true })) {
|
|
245364
|
-
const absolutePath =
|
|
245346
|
+
const absolutePath = path100.join(currentDir, entry.name);
|
|
245365
245347
|
if (entry.isDirectory()) {
|
|
245366
245348
|
queue.push(absolutePath);
|
|
245367
245349
|
continue;
|
|
@@ -245369,7 +245351,7 @@ function collectWorkspaceBlockEditorSources(projectDir, blockSlug) {
|
|
|
245369
245351
|
if (!entry.isFile()) {
|
|
245370
245352
|
continue;
|
|
245371
245353
|
}
|
|
245372
|
-
const relativePath =
|
|
245354
|
+
const relativePath = path100.relative(projectDir, absolutePath);
|
|
245373
245355
|
if (!isWorkspaceBlockEditorSource(relativePath)) {
|
|
245374
245356
|
continue;
|
|
245375
245357
|
}
|
|
@@ -245442,8 +245424,8 @@ function getWorkspaceBlockIframeCompatibilityChecks(projectDir, blockSlug) {
|
|
|
245442
245424
|
}
|
|
245443
245425
|
const blockJson = metadataResult.document;
|
|
245444
245426
|
const apiVersion = typeof blockJson.apiVersion === "number" && Number.isFinite(blockJson.apiVersion) ? blockJson.apiVersion : null;
|
|
245445
|
-
const blockDir =
|
|
245446
|
-
const localStyleFiles = WORKSPACE_BLOCK_LOCAL_STYLE_FILES.filter((fileName) => fs36.existsSync(
|
|
245427
|
+
const blockDir = path100.join(projectDir, "src", "blocks", blockSlug);
|
|
245428
|
+
const localStyleFiles = WORKSPACE_BLOCK_LOCAL_STYLE_FILES.filter((fileName) => fs36.existsSync(path100.join(blockDir, fileName))).map((fileName) => normalizePathSeparators(path100.join("src", "blocks", blockSlug, fileName)));
|
|
245447
245429
|
const hasRegisteredEditorStyles = hasRegisteredBlockAsset(blockJson.style) || hasRegisteredBlockAsset(blockJson.editorStyle);
|
|
245448
245430
|
const editorSources = collectWorkspaceBlockEditorSources(projectDir, blockSlug);
|
|
245449
245431
|
const editorWrapperSources = editorSources.filter((source) => !isWorkspaceBlockSaveSource(source.relativePath));
|
|
@@ -245495,21 +245477,21 @@ var init_cli_doctor_workspace_block_iframe = __esm(() => {
|
|
|
245495
245477
|
|
|
245496
245478
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-block-metadata.ts
|
|
245497
245479
|
import fs37 from "fs";
|
|
245498
|
-
import
|
|
245480
|
+
import path101 from "path";
|
|
245499
245481
|
import { parseScaffoldBlockMetadata as parseScaffoldBlockMetadata4 } from "@wp-typia/block-runtime/blocks";
|
|
245500
245482
|
function getWorkspaceBlockRequiredFiles(block) {
|
|
245501
|
-
const blockDir =
|
|
245483
|
+
const blockDir = path101.join("src", "blocks", block.slug);
|
|
245502
245484
|
return Array.from(new Set([
|
|
245503
245485
|
block.typesFile,
|
|
245504
245486
|
block.apiTypesFile,
|
|
245505
245487
|
block.openApiFile,
|
|
245506
|
-
|
|
245507
|
-
...WORKSPACE_GENERATED_BLOCK_ARTIFACTS.map((fileName) =>
|
|
245488
|
+
path101.join(blockDir, "index.tsx"),
|
|
245489
|
+
...WORKSPACE_GENERATED_BLOCK_ARTIFACTS.map((fileName) => path101.join(blockDir, fileName))
|
|
245508
245490
|
].filter((filePath) => typeof filePath === "string")));
|
|
245509
245491
|
}
|
|
245510
245492
|
function checkWorkspaceBlockMetadata(projectDir, workspace, block) {
|
|
245511
|
-
const blockJsonRelativePath =
|
|
245512
|
-
const blockJsonPath =
|
|
245493
|
+
const blockJsonRelativePath = path101.join("src", "blocks", block.slug, "block.json");
|
|
245494
|
+
const blockJsonPath = path101.join(projectDir, blockJsonRelativePath);
|
|
245513
245495
|
if (!fs37.existsSync(blockJsonPath)) {
|
|
245514
245496
|
return createDoctorCheck(`Block metadata ${block.slug}`, "fail", `Missing ${blockJsonRelativePath}`);
|
|
245515
245497
|
}
|
|
@@ -245532,8 +245514,8 @@ function checkWorkspaceBlockMetadata(projectDir, workspace, block) {
|
|
|
245532
245514
|
return createDoctorCheck(`Block metadata ${block.slug}`, issues.length === 0 ? "pass" : "fail", issues.length === 0 ? `block.json matches ${expectedName} and ${workspace.workspace.textDomain}` : issues.join("; "));
|
|
245533
245515
|
}
|
|
245534
245516
|
function checkWorkspaceBlockHooks(projectDir, blockSlug) {
|
|
245535
|
-
const blockJsonRelativePath =
|
|
245536
|
-
const blockJsonPath =
|
|
245517
|
+
const blockJsonRelativePath = path101.join("src", "blocks", blockSlug, "block.json");
|
|
245518
|
+
const blockJsonPath = path101.join(projectDir, blockJsonRelativePath);
|
|
245537
245519
|
if (!fs37.existsSync(blockJsonPath)) {
|
|
245538
245520
|
return createDoctorCheck(`Block hooks ${blockSlug}`, "fail", `Missing ${blockJsonRelativePath}`);
|
|
245539
245521
|
}
|
|
@@ -245557,8 +245539,8 @@ function checkWorkspaceBlockHooks(projectDir, blockSlug) {
|
|
|
245557
245539
|
return createDoctorCheck(`Block hooks ${blockSlug}`, invalidEntries.length === 0 ? "pass" : "fail", invalidEntries.length === 0 ? `blockHooks metadata is valid${Object.keys(blockHooks).length > 0 ? ` (${Object.keys(blockHooks).join(", ")})` : ""}` : `Invalid blockHooks entries: ${invalidEntries.map(([anchor, position]) => `${anchor || "<empty>"} => ${String(position)}`).join(", ")}`);
|
|
245558
245540
|
}
|
|
245559
245541
|
function checkWorkspaceBlockCollectionImport(projectDir, blockSlug) {
|
|
245560
|
-
const entryRelativePath =
|
|
245561
|
-
const entryPath =
|
|
245542
|
+
const entryRelativePath = path101.join("src", "blocks", blockSlug, "index.tsx");
|
|
245543
|
+
const entryPath = path101.join(projectDir, entryRelativePath);
|
|
245562
245544
|
if (!fs37.existsSync(entryPath)) {
|
|
245563
245545
|
return createDoctorCheck(`Block collection ${blockSlug}`, "fail", `Missing ${entryRelativePath}`);
|
|
245564
245546
|
}
|
|
@@ -245601,7 +245583,7 @@ var init_cli_doctor_workspace_blocks = __esm(() => {
|
|
|
245601
245583
|
|
|
245602
245584
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-features-abilities.ts
|
|
245603
245585
|
import fs38 from "fs";
|
|
245604
|
-
import
|
|
245586
|
+
import path102 from "path";
|
|
245605
245587
|
function getWorkspaceAbilityRequiredFiles(ability) {
|
|
245606
245588
|
return Array.from(new Set([
|
|
245607
245589
|
ability.clientFile,
|
|
@@ -245614,7 +245596,7 @@ function getWorkspaceAbilityRequiredFiles(ability) {
|
|
|
245614
245596
|
]));
|
|
245615
245597
|
}
|
|
245616
245598
|
function checkWorkspaceAbilityConfig(projectDir, ability) {
|
|
245617
|
-
const configPath =
|
|
245599
|
+
const configPath = path102.join(projectDir, ability.configFile);
|
|
245618
245600
|
if (!fs38.existsSync(configPath)) {
|
|
245619
245601
|
return createDoctorCheck(`Ability config ${ability.slug}`, "fail", `Missing ${ability.configFile}`);
|
|
245620
245602
|
}
|
|
@@ -245634,7 +245616,7 @@ function checkWorkspaceAbilityConfig(projectDir, ability) {
|
|
|
245634
245616
|
function checkWorkspaceAbilityBootstrap(projectDir, packageName, phpPrefix) {
|
|
245635
245617
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
245636
245618
|
if (!fs38.existsSync(bootstrapPath)) {
|
|
245637
|
-
return createDoctorCheck("Ability bootstrap", "fail", `Missing ${
|
|
245619
|
+
return createDoctorCheck("Ability bootstrap", "fail", `Missing ${path102.basename(bootstrapPath)}`);
|
|
245638
245620
|
}
|
|
245639
245621
|
const source = fs38.readFileSync(bootstrapPath, "utf8");
|
|
245640
245622
|
const loadFunctionName = `${phpPrefix}_load_workflow_abilities`;
|
|
@@ -245653,13 +245635,13 @@ function checkWorkspaceAbilityBootstrap(projectDir, packageName, phpPrefix) {
|
|
|
245653
245635
|
}
|
|
245654
245636
|
function checkWorkspaceAbilityIndex(projectDir, abilities) {
|
|
245655
245637
|
const indexRelativePath = [
|
|
245656
|
-
|
|
245657
|
-
|
|
245658
|
-
].find((relativePath) => fs38.existsSync(
|
|
245638
|
+
path102.join("src", "abilities", "index.ts"),
|
|
245639
|
+
path102.join("src", "abilities", "index.js")
|
|
245640
|
+
].find((relativePath) => fs38.existsSync(path102.join(projectDir, relativePath)));
|
|
245659
245641
|
if (!indexRelativePath) {
|
|
245660
245642
|
return createDoctorCheck("Abilities index", "fail", "Missing src/abilities/index.ts or src/abilities/index.js");
|
|
245661
245643
|
}
|
|
245662
|
-
const indexPath =
|
|
245644
|
+
const indexPath = path102.join(projectDir, indexRelativePath);
|
|
245663
245645
|
const source = fs38.readFileSync(indexPath, "utf8");
|
|
245664
245646
|
const missingExports = abilities.filter((ability) => {
|
|
245665
245647
|
const exportPattern = new RegExp(`^\\s*export\\s+(?:\\*\\s+from|\\{[^}]+\\}\\s+from)\\s+['"\`]\\./${escapeRegex2(ability.slug)}\\/client['"\`]`, "mu");
|
|
@@ -245686,17 +245668,17 @@ var init_cli_doctor_workspace_features_abilities = __esm(() => {
|
|
|
245686
245668
|
|
|
245687
245669
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-features-admin-views.ts
|
|
245688
245670
|
import fs39 from "fs";
|
|
245689
|
-
import
|
|
245671
|
+
import path103 from "path";
|
|
245690
245672
|
function getWorkspaceAdminViewRequiredFiles(adminView) {
|
|
245691
|
-
const adminViewDir =
|
|
245673
|
+
const adminViewDir = path103.join("src", "admin-views", adminView.slug);
|
|
245692
245674
|
return Array.from(new Set([
|
|
245693
245675
|
adminView.file,
|
|
245694
245676
|
adminView.phpFile,
|
|
245695
|
-
|
|
245696
|
-
|
|
245697
|
-
|
|
245698
|
-
|
|
245699
|
-
|
|
245677
|
+
path103.join(adminViewDir, "Screen.tsx"),
|
|
245678
|
+
path103.join(adminViewDir, "config.ts"),
|
|
245679
|
+
path103.join(adminViewDir, "data.ts"),
|
|
245680
|
+
path103.join(adminViewDir, "style.scss"),
|
|
245681
|
+
path103.join(adminViewDir, "types.ts")
|
|
245700
245682
|
]));
|
|
245701
245683
|
}
|
|
245702
245684
|
function checkWorkspaceAdminViewConfig(adminView, inventory) {
|
|
@@ -245718,7 +245700,7 @@ function checkWorkspaceAdminViewConfig(adminView, inventory) {
|
|
|
245718
245700
|
function checkWorkspaceAdminViewBootstrap(projectDir, packageName, phpPrefix) {
|
|
245719
245701
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
245720
245702
|
if (!fs39.existsSync(bootstrapPath)) {
|
|
245721
|
-
return createDoctorCheck("Admin view bootstrap", "fail", `Missing ${
|
|
245703
|
+
return createDoctorCheck("Admin view bootstrap", "fail", `Missing ${path103.basename(bootstrapPath)}`);
|
|
245722
245704
|
}
|
|
245723
245705
|
const source = fs39.readFileSync(bootstrapPath, "utf8");
|
|
245724
245706
|
const loadFunctionName = `${phpPrefix}_load_admin_views`;
|
|
@@ -245729,13 +245711,13 @@ function checkWorkspaceAdminViewBootstrap(projectDir, packageName, phpPrefix) {
|
|
|
245729
245711
|
}
|
|
245730
245712
|
function checkWorkspaceAdminViewIndex(projectDir, adminViews) {
|
|
245731
245713
|
const indexRelativePath = [
|
|
245732
|
-
|
|
245733
|
-
|
|
245734
|
-
].find((relativePath) => fs39.existsSync(
|
|
245714
|
+
path103.join("src", "admin-views", "index.ts"),
|
|
245715
|
+
path103.join("src", "admin-views", "index.js")
|
|
245716
|
+
].find((relativePath) => fs39.existsSync(path103.join(projectDir, relativePath)));
|
|
245735
245717
|
if (!indexRelativePath) {
|
|
245736
245718
|
return createDoctorCheck("Admin views index", "fail", "Missing src/admin-views/index.ts or src/admin-views/index.js");
|
|
245737
245719
|
}
|
|
245738
|
-
const indexPath =
|
|
245720
|
+
const indexPath = path103.join(projectDir, indexRelativePath);
|
|
245739
245721
|
const source = fs39.readFileSync(indexPath, "utf8");
|
|
245740
245722
|
const missingImports = adminViews.filter((adminView) => {
|
|
245741
245723
|
const importPattern = new RegExp(`['"\`]\\./${escapeRegex2(adminView.slug)}(?:/[^'"\`]*)?['"\`]`, "u");
|
|
@@ -245744,7 +245726,7 @@ function checkWorkspaceAdminViewIndex(projectDir, adminViews) {
|
|
|
245744
245726
|
return createDoctorCheck("Admin views index", missingImports.length === 0 ? "pass" : "fail", missingImports.length === 0 ? "Admin view registrations are aggregated" : `Missing admin view imports for: ${missingImports.map((entry) => entry.slug).join(", ")}`);
|
|
245745
245727
|
}
|
|
245746
245728
|
function checkWorkspaceAdminViewPhp(projectDir, adminView) {
|
|
245747
|
-
const phpPath =
|
|
245729
|
+
const phpPath = path103.join(projectDir, adminView.phpFile);
|
|
245748
245730
|
if (!fs39.existsSync(phpPath)) {
|
|
245749
245731
|
return createDoctorCheck(`Admin view PHP ${adminView.slug}`, "fail", `Missing ${adminView.phpFile}`);
|
|
245750
245732
|
}
|
|
@@ -245777,14 +245759,14 @@ var init_cli_doctor_workspace_features_admin_views = __esm(() => {
|
|
|
245777
245759
|
|
|
245778
245760
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-features-ai.ts
|
|
245779
245761
|
import fs40 from "fs";
|
|
245780
|
-
import
|
|
245762
|
+
import path104 from "path";
|
|
245781
245763
|
function getWorkspaceAiFeatureRequiredFiles(aiFeature) {
|
|
245782
245764
|
return Array.from(new Set([
|
|
245783
245765
|
aiFeature.aiSchemaFile,
|
|
245784
245766
|
aiFeature.apiFile,
|
|
245785
|
-
|
|
245786
|
-
|
|
245787
|
-
|
|
245767
|
+
path104.join(path104.dirname(aiFeature.typesFile), "api-schemas", "feature-request.schema.json"),
|
|
245768
|
+
path104.join(path104.dirname(aiFeature.typesFile), "api-schemas", "feature-response.schema.json"),
|
|
245769
|
+
path104.join(path104.dirname(aiFeature.typesFile), "api-schemas", "feature-result.schema.json"),
|
|
245788
245770
|
aiFeature.clientFile,
|
|
245789
245771
|
aiFeature.dataFile,
|
|
245790
245772
|
aiFeature.openApiFile,
|
|
@@ -245800,7 +245782,7 @@ function checkWorkspaceAiFeatureConfig(aiFeature) {
|
|
|
245800
245782
|
function checkWorkspaceAiFeatureBootstrap(projectDir, packageName, phpPrefix) {
|
|
245801
245783
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
245802
245784
|
if (!fs40.existsSync(bootstrapPath)) {
|
|
245803
|
-
return createDoctorCheck("AI feature bootstrap", "fail", `Missing ${
|
|
245785
|
+
return createDoctorCheck("AI feature bootstrap", "fail", `Missing ${path104.basename(bootstrapPath)}`);
|
|
245804
245786
|
}
|
|
245805
245787
|
const source = fs40.readFileSync(bootstrapPath, "utf8");
|
|
245806
245788
|
const registerFunctionName = `${phpPrefix}_register_ai_features`;
|
|
@@ -245827,16 +245809,16 @@ var init_cli_doctor_workspace_features_ai = __esm(() => {
|
|
|
245827
245809
|
|
|
245828
245810
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-features-editor-plugins.ts
|
|
245829
245811
|
import fs41 from "fs";
|
|
245830
|
-
import
|
|
245812
|
+
import path105 from "path";
|
|
245831
245813
|
function getWorkspaceEditorPluginRequiredFiles(editorPlugin) {
|
|
245832
|
-
const editorPluginDir =
|
|
245833
|
-
const surfaceFile = editorPlugin.slot === "PluginSidebar" ?
|
|
245814
|
+
const editorPluginDir = path105.join("src", "editor-plugins", editorPlugin.slug);
|
|
245815
|
+
const surfaceFile = editorPlugin.slot === "PluginSidebar" ? path105.join(editorPluginDir, "Sidebar.tsx") : path105.join(editorPluginDir, "Surface.tsx");
|
|
245834
245816
|
return Array.from(new Set([
|
|
245835
245817
|
editorPlugin.file,
|
|
245836
245818
|
surfaceFile,
|
|
245837
|
-
|
|
245838
|
-
|
|
245839
|
-
|
|
245819
|
+
path105.join(editorPluginDir, "data.ts"),
|
|
245820
|
+
path105.join(editorPluginDir, "types.ts"),
|
|
245821
|
+
path105.join(editorPluginDir, "style.scss")
|
|
245840
245822
|
]));
|
|
245841
245823
|
}
|
|
245842
245824
|
function checkWorkspaceEditorPluginConfig(editorPlugin) {
|
|
@@ -245847,7 +245829,7 @@ function checkWorkspaceEditorPluginConfig(editorPlugin) {
|
|
|
245847
245829
|
function checkWorkspaceEditorPluginBootstrap(projectDir, packageName, phpPrefix) {
|
|
245848
245830
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
245849
245831
|
if (!fs41.existsSync(bootstrapPath)) {
|
|
245850
|
-
return createDoctorCheck("Editor plugin bootstrap", "fail", `Missing ${
|
|
245832
|
+
return createDoctorCheck("Editor plugin bootstrap", "fail", `Missing ${path105.basename(bootstrapPath)}`);
|
|
245851
245833
|
}
|
|
245852
245834
|
const source = fs41.readFileSync(bootstrapPath, "utf8");
|
|
245853
245835
|
const enqueueFunctionName = `${phpPrefix}_enqueue_editor_plugins_editor`;
|
|
@@ -245860,13 +245842,13 @@ function checkWorkspaceEditorPluginBootstrap(projectDir, packageName, phpPrefix)
|
|
|
245860
245842
|
}
|
|
245861
245843
|
function checkWorkspaceEditorPluginIndex(projectDir, editorPlugins) {
|
|
245862
245844
|
const indexRelativePath = [
|
|
245863
|
-
|
|
245864
|
-
|
|
245865
|
-
].find((relativePath) => fs41.existsSync(
|
|
245845
|
+
path105.join("src", "editor-plugins", "index.ts"),
|
|
245846
|
+
path105.join("src", "editor-plugins", "index.js")
|
|
245847
|
+
].find((relativePath) => fs41.existsSync(path105.join(projectDir, relativePath)));
|
|
245866
245848
|
if (!indexRelativePath) {
|
|
245867
245849
|
return createDoctorCheck("Editor plugins index", "fail", "Missing src/editor-plugins/index.ts or src/editor-plugins/index.js");
|
|
245868
245850
|
}
|
|
245869
|
-
const indexPath =
|
|
245851
|
+
const indexPath = path105.join(projectDir, indexRelativePath);
|
|
245870
245852
|
const source = fs41.readFileSync(indexPath, "utf8");
|
|
245871
245853
|
const missingImports = editorPlugins.filter((editorPlugin) => {
|
|
245872
245854
|
const importPattern = new RegExp(`['"\`]\\./${escapeRegex2(editorPlugin.slug)}(?:/[^'"\`]*)?['"\`]`, "u");
|
|
@@ -245893,7 +245875,7 @@ var init_cli_doctor_workspace_features_editor_plugins = __esm(() => {
|
|
|
245893
245875
|
|
|
245894
245876
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-features-post-meta.ts
|
|
245895
245877
|
import fs42 from "fs";
|
|
245896
|
-
import
|
|
245878
|
+
import path106 from "path";
|
|
245897
245879
|
function getWorkspacePostMetaRequiredFiles(postMeta) {
|
|
245898
245880
|
return Array.from(new Set([
|
|
245899
245881
|
postMeta.phpFile,
|
|
@@ -245915,7 +245897,7 @@ function checkWorkspacePostMetaConfig(postMeta) {
|
|
|
245915
245897
|
function checkWorkspacePostMetaBootstrap(projectDir, packageName, phpPrefix) {
|
|
245916
245898
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
245917
245899
|
if (!fs42.existsSync(bootstrapPath)) {
|
|
245918
|
-
return createDoctorCheck("Post meta bootstrap", "fail", `Missing ${
|
|
245900
|
+
return createDoctorCheck("Post meta bootstrap", "fail", `Missing ${path106.basename(bootstrapPath)}`);
|
|
245919
245901
|
}
|
|
245920
245902
|
const source = fs42.readFileSync(bootstrapPath, "utf8");
|
|
245921
245903
|
const registerFunctionName = `${phpPrefix}_register_post_meta_contracts`;
|
|
@@ -245925,7 +245907,7 @@ function checkWorkspacePostMetaBootstrap(projectDir, packageName, phpPrefix) {
|
|
|
245925
245907
|
return createDoctorCheck("Post meta bootstrap", hasServerGlob && hasRegisterHook ? "pass" : "fail", hasServerGlob && hasRegisterHook ? "Post meta PHP loader hook is present" : "Missing post meta PHP require glob or init hook");
|
|
245926
245908
|
}
|
|
245927
245909
|
function checkWorkspacePostMetaPhp(projectDir, postMeta) {
|
|
245928
|
-
const phpPath =
|
|
245910
|
+
const phpPath = path106.join(projectDir, postMeta.phpFile);
|
|
245929
245911
|
if (!fs42.existsSync(phpPath)) {
|
|
245930
245912
|
return createDoctorCheck(`Post meta PHP ${postMeta.slug}`, "fail", `Missing ${postMeta.phpFile}`);
|
|
245931
245913
|
}
|
|
@@ -245956,7 +245938,7 @@ var init_cli_doctor_workspace_features_post_meta = __esm(() => {
|
|
|
245956
245938
|
|
|
245957
245939
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-features-rest.ts
|
|
245958
245940
|
import fs43 from "fs";
|
|
245959
|
-
import
|
|
245941
|
+
import path107 from "path";
|
|
245960
245942
|
function isManualRestResource(restResource) {
|
|
245961
245943
|
return restResource.mode === "manual";
|
|
245962
245944
|
}
|
|
@@ -245970,7 +245952,7 @@ function getWorkspaceRestResourceRequiredFiles(restResource) {
|
|
|
245970
245952
|
schemaNames.add("response");
|
|
245971
245953
|
return Array.from(new Set([
|
|
245972
245954
|
restResource.apiFile,
|
|
245973
|
-
...Array.from(schemaNames, (schemaName) =>
|
|
245955
|
+
...Array.from(schemaNames, (schemaName) => path107.join(path107.dirname(restResource.typesFile), "api-schemas", `${schemaName}.schema.json`)),
|
|
245974
245956
|
restResource.clientFile,
|
|
245975
245957
|
restResource.openApiFile,
|
|
245976
245958
|
restResource.typesFile,
|
|
@@ -246000,7 +245982,7 @@ function getWorkspaceRestResourceRequiredFiles(restResource) {
|
|
|
246000
245982
|
}
|
|
246001
245983
|
return Array.from(new Set([
|
|
246002
245984
|
restResource.apiFile,
|
|
246003
|
-
...Array.from(schemaNames, (schemaName) =>
|
|
245985
|
+
...Array.from(schemaNames, (schemaName) => path107.join(path107.dirname(restResource.typesFile), "api-schemas", `${schemaName}.schema.json`)),
|
|
246004
245986
|
restResource.clientFile,
|
|
246005
245987
|
...restResource.dataFile ? [restResource.dataFile] : [],
|
|
246006
245988
|
restResource.openApiFile,
|
|
@@ -246025,7 +246007,7 @@ function checkWorkspaceRestResourceConfig(restResource) {
|
|
|
246025
246007
|
function checkWorkspaceRestResourceBootstrap(projectDir, packageName, phpPrefix) {
|
|
246026
246008
|
const bootstrapPath = resolveWorkspaceBootstrapPath(projectDir, packageName);
|
|
246027
246009
|
if (!fs43.existsSync(bootstrapPath)) {
|
|
246028
|
-
return createDoctorCheck("REST resource bootstrap", "fail", `Missing ${
|
|
246010
|
+
return createDoctorCheck("REST resource bootstrap", "fail", `Missing ${path107.basename(bootstrapPath)}`);
|
|
246029
246011
|
}
|
|
246030
246012
|
const source = fs43.readFileSync(bootstrapPath, "utf8");
|
|
246031
246013
|
const registerFunctionName = `${phpPrefix}_register_rest_resources`;
|
|
@@ -246071,14 +246053,14 @@ var init_cli_doctor_workspace_features = __esm(() => {
|
|
|
246071
246053
|
});
|
|
246072
246054
|
|
|
246073
246055
|
// ../wp-typia-project-tools/src/runtime/cli-doctor-workspace-package.ts
|
|
246074
|
-
import
|
|
246056
|
+
import path108 from "path";
|
|
246075
246057
|
async function prepareWorkspacePackageDoctorSnapshot(workspace, packageJson) {
|
|
246076
246058
|
const packageName = packageJson.name;
|
|
246077
246059
|
const bootstrapRelativePath = getWorkspaceBootstrapRelativePath(typeof packageName === "string" && packageName.length > 0 ? packageName : workspace.packageName);
|
|
246078
|
-
const migrationConfigRelativePath =
|
|
246060
|
+
const migrationConfigRelativePath = path108.join("src", "migrations", "config.ts");
|
|
246079
246061
|
const [bootstrapExists, migrationConfigExists] = await Promise.all([
|
|
246080
|
-
pathExists(
|
|
246081
|
-
pathExists(
|
|
246062
|
+
pathExists(path108.join(workspace.projectDir, bootstrapRelativePath)),
|
|
246063
|
+
pathExists(path108.join(workspace.projectDir, migrationConfigRelativePath))
|
|
246082
246064
|
]);
|
|
246083
246065
|
return {
|
|
246084
246066
|
bootstrapExists,
|
|
@@ -246308,9 +246290,9 @@ var init_cli_doctor = __esm(() => {
|
|
|
246308
246290
|
|
|
246309
246291
|
// ../wp-typia-project-tools/src/runtime/cli-init-package-json.ts
|
|
246310
246292
|
import fs44 from "fs";
|
|
246311
|
-
import
|
|
246293
|
+
import path109 from "path";
|
|
246312
246294
|
function readProjectPackageJson(projectDir) {
|
|
246313
|
-
const packageJsonPath =
|
|
246295
|
+
const packageJsonPath = path109.join(projectDir, "package.json");
|
|
246314
246296
|
if (!fs44.existsSync(packageJsonPath)) {
|
|
246315
246297
|
return null;
|
|
246316
246298
|
}
|
|
@@ -246327,13 +246309,13 @@ function inferInitPackageManager(projectDir, packageJson) {
|
|
|
246327
246309
|
if (packageJson?.packageManager) {
|
|
246328
246310
|
return parseWorkspacePackageManagerId(packageJson.packageManager);
|
|
246329
246311
|
}
|
|
246330
|
-
if (fs44.existsSync(
|
|
246312
|
+
if (fs44.existsSync(path109.join(projectDir, "bun.lock")) || fs44.existsSync(path109.join(projectDir, "bun.lockb"))) {
|
|
246331
246313
|
return "bun";
|
|
246332
246314
|
}
|
|
246333
|
-
if (fs44.existsSync(
|
|
246315
|
+
if (fs44.existsSync(path109.join(projectDir, "pnpm-lock.yaml"))) {
|
|
246334
246316
|
return "pnpm";
|
|
246335
246317
|
}
|
|
246336
|
-
if (fs44.existsSync(
|
|
246318
|
+
if (fs44.existsSync(path109.join(projectDir, "yarn.lock")) || fs44.existsSync(path109.join(projectDir, ".yarnrc.yml"))) {
|
|
246337
246319
|
return "yarn";
|
|
246338
246320
|
}
|
|
246339
246321
|
return "npm";
|
|
@@ -246420,10 +246402,10 @@ function hasExistingWpTypiaProjectSurface(projectDir, packageJson) {
|
|
|
246420
246402
|
const scripts = packageJson?.scripts ?? {};
|
|
246421
246403
|
const hasSyncSurface = typeof scripts.sync === "string" || typeof scripts["sync-types"] === "string";
|
|
246422
246404
|
const hasHelperFiles = [
|
|
246423
|
-
|
|
246424
|
-
|
|
246425
|
-
|
|
246426
|
-
].every((relativePath) => fs44.existsSync(
|
|
246405
|
+
path109.join("scripts", "block-config.ts"),
|
|
246406
|
+
path109.join("scripts", "sync-project.ts"),
|
|
246407
|
+
path109.join("scripts", "sync-types-to-block-json.ts")
|
|
246408
|
+
].every((relativePath) => fs44.existsSync(path109.join(projectDir, relativePath)));
|
|
246427
246409
|
const hasRuntimeDeps = typeof getExistingDependencyVersion(packageJson, "@wp-typia/block-runtime") === "string" && typeof getExistingDependencyVersion(packageJson, "@wp-typia/block-types") === "string";
|
|
246428
246410
|
return hasSyncSurface && hasHelperFiles && hasRuntimeDeps;
|
|
246429
246411
|
}
|
|
@@ -246565,19 +246547,19 @@ var SUPPORTED_RETROFIT_LAYOUT_NOTE = "Supported retrofit layouts currently mirro
|
|
|
246565
246547
|
|
|
246566
246548
|
// ../wp-typia-project-tools/src/runtime/cli-init-plan.ts
|
|
246567
246549
|
import fs45 from "fs";
|
|
246568
|
-
import
|
|
246550
|
+
import path110 from "path";
|
|
246569
246551
|
import { analyzeSourceTypes } from "@wp-typia/block-runtime/metadata-parser";
|
|
246570
246552
|
function normalizeRelativePath2(value2) {
|
|
246571
246553
|
return value2.replace(/\\/gu, "/");
|
|
246572
246554
|
}
|
|
246573
246555
|
function buildGeneratedArtifactPaths(blockJsonFile, manifestFile) {
|
|
246574
|
-
const manifestDir =
|
|
246556
|
+
const manifestDir = path110.dirname(manifestFile);
|
|
246575
246557
|
const artifactPaths = [
|
|
246576
246558
|
blockJsonFile,
|
|
246577
246559
|
manifestFile,
|
|
246578
|
-
|
|
246579
|
-
|
|
246580
|
-
|
|
246560
|
+
path110.join(manifestDir, "typia.schema.json"),
|
|
246561
|
+
path110.join(manifestDir, "typia-validator.php"),
|
|
246562
|
+
path110.join(manifestDir, "typia.openapi.json")
|
|
246581
246563
|
];
|
|
246582
246564
|
return Array.from(new Set(artifactPaths.map((filePath) => normalizeRelativePath2(filePath))));
|
|
246583
246565
|
}
|
|
@@ -246598,7 +246580,7 @@ function isObjectLikeSourceType(projectDir, typesFile, sourceTypeName) {
|
|
|
246598
246580
|
return analyzedTypes[sourceTypeName]?.kind === "object";
|
|
246599
246581
|
}
|
|
246600
246582
|
function inferRetrofitAttributeTypeName(projectDir, block) {
|
|
246601
|
-
const typesPath =
|
|
246583
|
+
const typesPath = path110.join(projectDir, block.typesFile);
|
|
246602
246584
|
const typesSource = fs45.readFileSync(typesPath, "utf8");
|
|
246603
246585
|
const blockNameSegments = block.blockName.split("/");
|
|
246604
246586
|
const slug = blockNameSegments[blockNameSegments.length - 1] ?? block.key;
|
|
@@ -246691,17 +246673,17 @@ function buildPlannedFiles(projectDir, layoutKind) {
|
|
|
246691
246673
|
}
|
|
246692
246674
|
return [
|
|
246693
246675
|
{
|
|
246694
|
-
action: fs45.existsSync(
|
|
246676
|
+
action: fs45.existsSync(path110.join(projectDir, "scripts", "block-config.ts")) ? "update" : "add",
|
|
246695
246677
|
path: "scripts/block-config.ts",
|
|
246696
246678
|
purpose: "Declare the current retrofit block targets so sync-types can regenerate metadata from the existing TypeScript source of truth."
|
|
246697
246679
|
},
|
|
246698
246680
|
{
|
|
246699
|
-
action: fs45.existsSync(
|
|
246681
|
+
action: fs45.existsSync(path110.join(projectDir, "scripts", "sync-types-to-block-json.ts")) ? "update" : "add",
|
|
246700
246682
|
path: "scripts/sync-types-to-block-json.ts",
|
|
246701
246683
|
purpose: "Generate block.json and Typia metadata artifacts from the current TypeScript source of truth."
|
|
246702
246684
|
},
|
|
246703
246685
|
{
|
|
246704
|
-
action: fs45.existsSync(
|
|
246686
|
+
action: fs45.existsSync(path110.join(projectDir, "scripts", "sync-project.ts")) ? "update" : "add",
|
|
246705
246687
|
path: "scripts/sync-project.ts",
|
|
246706
246688
|
purpose: "Provide one shared sync entrypoint that can grow into sync-rest or workspace-aware refresh steps later."
|
|
246707
246689
|
}
|
|
@@ -246742,7 +246724,7 @@ function createRetrofitPlan(options) {
|
|
|
246742
246724
|
};
|
|
246743
246725
|
}
|
|
246744
246726
|
function getInitPlan(projectDir, options = {}) {
|
|
246745
|
-
const resolvedProjectDir =
|
|
246727
|
+
const resolvedProjectDir = path110.resolve(projectDir);
|
|
246746
246728
|
const packageJson = readProjectPackageJson(resolvedProjectDir);
|
|
246747
246729
|
const packageManager = resolveInitPackageManager(resolvedProjectDir, packageJson, options.packageManager);
|
|
246748
246730
|
const workspace = tryResolveWorkspaceProject(resolvedProjectDir);
|
|
@@ -246778,7 +246760,7 @@ function getInitPlan(projectDir, options = {}) {
|
|
|
246778
246760
|
status: "already-initialized"
|
|
246779
246761
|
});
|
|
246780
246762
|
}
|
|
246781
|
-
const projectName = typeof packageJson?.name === "string" && packageJson.name.length > 0 ? packageJson.name :
|
|
246763
|
+
const projectName = typeof packageJson?.name === "string" && packageJson.name.length > 0 ? packageJson.name : path110.basename(resolvedProjectDir);
|
|
246782
246764
|
const layout = buildInitLayoutDetails(resolvedProjectDir);
|
|
246783
246765
|
const dependencyChanges = buildDependencyChanges(packageJson);
|
|
246784
246766
|
const scriptChanges = buildScriptChanges(packageJson, packageManager);
|
|
@@ -246832,7 +246814,7 @@ var init_cli_init_plan = __esm(() => {
|
|
|
246832
246814
|
});
|
|
246833
246815
|
|
|
246834
246816
|
// ../wp-typia-project-tools/src/runtime/cli-init-templates.ts
|
|
246835
|
-
import
|
|
246817
|
+
import path111 from "path";
|
|
246836
246818
|
function buildRetrofitBlockConfigEntry(target) {
|
|
246837
246819
|
return [
|
|
246838
246820
|
"\t{",
|
|
@@ -247060,9 +247042,9 @@ main().catch( ( error ) => {
|
|
|
247060
247042
|
}
|
|
247061
247043
|
function buildRetrofitHelperFiles(blockTargets) {
|
|
247062
247044
|
return {
|
|
247063
|
-
[
|
|
247064
|
-
[
|
|
247065
|
-
[
|
|
247045
|
+
[path111.join("scripts", "block-config.ts")]: buildRetrofitBlockConfigSource(blockTargets),
|
|
247046
|
+
[path111.join("scripts", "sync-project.ts")]: buildRetrofitSyncProjectScriptSource(),
|
|
247047
|
+
[path111.join("scripts", "sync-types-to-block-json.ts")]: buildRetrofitSyncTypesScriptSource()
|
|
247066
247048
|
};
|
|
247067
247049
|
}
|
|
247068
247050
|
var init_cli_init_templates = __esm(() => {
|
|
@@ -247073,9 +247055,9 @@ var init_cli_init_templates = __esm(() => {
|
|
|
247073
247055
|
// ../wp-typia-project-tools/src/runtime/cli-init-apply.ts
|
|
247074
247056
|
import fs46 from "fs";
|
|
247075
247057
|
import { promises as fsp44 } from "fs";
|
|
247076
|
-
import
|
|
247058
|
+
import path112 from "path";
|
|
247077
247059
|
async function createRetrofitMutationSnapshot(projectDir, filePaths) {
|
|
247078
|
-
const scriptsDir =
|
|
247060
|
+
const scriptsDir = path112.join(projectDir, "scripts");
|
|
247079
247061
|
const scriptsDirExisted = fs46.existsSync(scriptsDir);
|
|
247080
247062
|
const fileSources = await snapshotWorkspaceFiles(filePaths);
|
|
247081
247063
|
const targetPaths = fileSources.filter((entry) => entry.source === null).map((entry) => entry.filePath);
|
|
@@ -247090,11 +247072,11 @@ async function createRetrofitMutationSnapshot(projectDir, filePaths) {
|
|
|
247090
247072
|
}
|
|
247091
247073
|
async function writeRetrofitFiles(options) {
|
|
247092
247074
|
const helperFiles = buildRetrofitHelperFiles(options.blockTargets);
|
|
247093
|
-
const scriptsDir =
|
|
247075
|
+
const scriptsDir = path112.join(options.projectDir, "scripts");
|
|
247094
247076
|
await fsp44.mkdir(scriptsDir, { recursive: true });
|
|
247095
|
-
await fsp44.writeFile(
|
|
247077
|
+
await fsp44.writeFile(path112.join(options.projectDir, "package.json"), buildProjectPackageJsonSource(options.packageJson), "utf8");
|
|
247096
247078
|
for (const [relativePath, source] of Object.entries(helperFiles)) {
|
|
247097
|
-
await fsp44.writeFile(
|
|
247079
|
+
await fsp44.writeFile(path112.join(options.projectDir, relativePath), source, "utf8");
|
|
247098
247080
|
}
|
|
247099
247081
|
}
|
|
247100
247082
|
function buildApplyFailureError(error48) {
|
|
@@ -247128,8 +247110,8 @@ async function applyInitPlan(projectDir, options = {}) {
|
|
|
247128
247110
|
});
|
|
247129
247111
|
const helperFiles = buildRetrofitHelperFiles(previewPlan.blockTargets);
|
|
247130
247112
|
const filePaths = [
|
|
247131
|
-
|
|
247132
|
-
...Object.keys(helperFiles).map((relativePath) =>
|
|
247113
|
+
path112.join(previewPlan.projectDir, "package.json"),
|
|
247114
|
+
...Object.keys(helperFiles).map((relativePath) => path112.join(previewPlan.projectDir, relativePath))
|
|
247133
247115
|
];
|
|
247134
247116
|
const mutationSnapshot = await createRetrofitMutationSnapshot(previewPlan.projectDir, filePaths);
|
|
247135
247117
|
try {
|
|
@@ -299808,11 +299790,11 @@ var ADD_OPTION_METADATA = {
|
|
|
299808
299790
|
type: "string"
|
|
299809
299791
|
},
|
|
299810
299792
|
scope: {
|
|
299811
|
-
description: "Pattern catalog scope for pattern workflows
|
|
299793
|
+
description: "Pattern catalog scope for pattern workflows; one of full or section.",
|
|
299812
299794
|
type: "string"
|
|
299813
299795
|
},
|
|
299814
299796
|
"section-role": {
|
|
299815
|
-
description: "Typed section role for section-scoped pattern catalog entries.",
|
|
299797
|
+
description: "Typed section role for section-scoped pattern catalog entries; requires --scope section.",
|
|
299816
299798
|
type: "string"
|
|
299817
299799
|
},
|
|
299818
299800
|
"secret-field": {
|
|
@@ -299856,12 +299838,12 @@ var ADD_OPTION_METADATA = {
|
|
|
299856
299838
|
type: "string"
|
|
299857
299839
|
},
|
|
299858
299840
|
tags: {
|
|
299859
|
-
description: "Comma-separated tags for typed pattern catalog entries;
|
|
299841
|
+
description: "Comma-separated tags for typed pattern catalog entries; combine with repeatable --tag for single tags.",
|
|
299860
299842
|
repeatable: true,
|
|
299861
299843
|
type: "string"
|
|
299862
299844
|
},
|
|
299863
299845
|
tag: {
|
|
299864
|
-
description: "Repeatable
|
|
299846
|
+
description: "Repeatable single tag for typed pattern catalog entries; use --tags for comma-separated lists.",
|
|
299865
299847
|
repeatable: true,
|
|
299866
299848
|
type: "string"
|
|
299867
299849
|
},
|
|
@@ -300350,6 +300332,15 @@ var NAME_ONLY_VISIBLE_FIELDS = [
|
|
|
300350
300332
|
"kind",
|
|
300351
300333
|
"name"
|
|
300352
300334
|
];
|
|
300335
|
+
var PATTERN_CATALOG_VISIBLE_FIELDS = [
|
|
300336
|
+
"kind",
|
|
300337
|
+
"name",
|
|
300338
|
+
"scope",
|
|
300339
|
+
"section-role",
|
|
300340
|
+
"catalog-title",
|
|
300341
|
+
"tags",
|
|
300342
|
+
"thumbnail-url"
|
|
300343
|
+
];
|
|
300353
300344
|
var NAME_SOURCE_VISIBLE_FIELDS = [
|
|
300354
300345
|
"kind",
|
|
300355
300346
|
"name",
|
|
@@ -300820,6 +300811,15 @@ var contractAddKindEntry = defineAddKindRegistryEntry({
|
|
|
300820
300811
|
init_cli_diagnostics();
|
|
300821
300812
|
var CORE_VARIATION_MISSING_NAME_MESSAGE = "`wp-typia add core-variation` requires <name>. Usage: wp-typia add core-variation <block-name> <name> or wp-typia add core-variation <name> --block <namespace/block>.";
|
|
300822
300813
|
var CORE_VARIATION_MISSING_BLOCK_MESSAGE = "`wp-typia add core-variation` requires <block-name>. Usage: wp-typia add core-variation <block-name> <name> or wp-typia add core-variation <name> --block <namespace/block>.";
|
|
300814
|
+
var CORE_VARIATION_BLOCK_NAME_PATTERN = /^[^/\s]+\/[^/\s]+$/u;
|
|
300815
|
+
function formatCoreVariationMissingPositionalNameMessage(blockName) {
|
|
300816
|
+
return [
|
|
300817
|
+
`\`wp-typia add core-variation ${blockName}\` is missing <name>.`,
|
|
300818
|
+
"Usage: wp-typia add core-variation <block-name> <name>",
|
|
300819
|
+
"Alternative: wp-typia add core-variation <name> --block <namespace/block>"
|
|
300820
|
+
].join(`
|
|
300821
|
+
`);
|
|
300822
|
+
}
|
|
300823
300823
|
function resolveCoreVariationInputs(context) {
|
|
300824
300824
|
const positionalTargetBlockName = context.positionalArgs?.[1];
|
|
300825
300825
|
const positionalVariationName = context.positionalArgs?.[2];
|
|
@@ -300832,16 +300832,17 @@ function resolveCoreVariationInputs(context) {
|
|
|
300832
300832
|
variationName: positionalVariationName
|
|
300833
300833
|
};
|
|
300834
300834
|
}
|
|
300835
|
-
|
|
300836
|
-
|
|
300835
|
+
const targetBlockFlag = readOptionalStrictStringFlag(context.flags, "block");
|
|
300836
|
+
const missingPositionalNameTarget = context.name !== undefined && positionalTargetBlockName === context.name && CORE_VARIATION_BLOCK_NAME_PATTERN.test(context.name) ? context.name : undefined;
|
|
300837
|
+
if (missingPositionalNameTarget && !targetBlockFlag) {
|
|
300838
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, formatCoreVariationMissingPositionalNameMessage(missingPositionalNameTarget));
|
|
300837
300839
|
}
|
|
300838
300840
|
const variationName = requireAddKindName(context, CORE_VARIATION_MISSING_NAME_MESSAGE);
|
|
300839
|
-
|
|
300840
|
-
if (!targetBlockName) {
|
|
300841
|
+
if (!targetBlockFlag) {
|
|
300841
300842
|
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, CORE_VARIATION_MISSING_BLOCK_MESSAGE);
|
|
300842
300843
|
}
|
|
300843
300844
|
return {
|
|
300844
|
-
targetBlockName,
|
|
300845
|
+
targetBlockName: targetBlockFlag,
|
|
300845
300846
|
variationName
|
|
300846
300847
|
};
|
|
300847
300848
|
}
|
|
@@ -301020,10 +301021,12 @@ var integrationEnvAddKindEntry = defineAddKindRegistryEntry({
|
|
|
301020
301021
|
supportsDryRun: true,
|
|
301021
301022
|
usage: "wp-typia add integration-env <name> [--wp-env] [--release-zip] [--service <none|docker-compose>] [--dry-run]",
|
|
301022
301023
|
visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS,
|
|
301023
|
-
hiddenBooleanSubmitFields: ["wp-env", "release-zip"]
|
|
301024
|
+
hiddenBooleanSubmitFields: ["wp-env", "release-zip"],
|
|
301025
|
+
hiddenStringSubmitFields: ["service"]
|
|
301024
301026
|
});
|
|
301025
301027
|
|
|
301026
301028
|
// src/add-kinds/pattern.ts
|
|
301029
|
+
init_cli_diagnostics();
|
|
301027
301030
|
var PATTERN_MISSING_NAME_MESSAGE = "`wp-typia add pattern` requires <name>. Usage: wp-typia add pattern <name>.";
|
|
301028
301031
|
var patternAddKindEntry = defineAddKindRegistryEntry({
|
|
301029
301032
|
completion: {
|
|
@@ -301039,19 +301042,12 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
|
|
|
301039
301042
|
title: "Added workspace pattern"
|
|
301040
301043
|
},
|
|
301041
301044
|
description: "Add a PHP block pattern shell",
|
|
301042
|
-
hiddenStringSubmitFields: [
|
|
301043
|
-
"catalog-title",
|
|
301044
|
-
"scope",
|
|
301045
|
-
"section-role",
|
|
301046
|
-
"tag",
|
|
301047
|
-
"tags",
|
|
301048
|
-
"thumbnail-url"
|
|
301049
|
-
],
|
|
301045
|
+
hiddenStringSubmitFields: ["tag"],
|
|
301050
301046
|
nameLabel: "Pattern name",
|
|
301051
301047
|
async prepareExecution(context) {
|
|
301052
301048
|
const name2 = requireAddKindName(context, PATTERN_MISSING_NAME_MESSAGE);
|
|
301053
|
-
const scope =
|
|
301054
|
-
const sectionRole =
|
|
301049
|
+
const scope = resolvePatternScopeFlag(context);
|
|
301050
|
+
const sectionRole = resolvePatternSectionRoleFlag(context, scope);
|
|
301055
301051
|
const catalogTitle = typeof context.flags["catalog-title"] === "string" ? context.flags["catalog-title"] : undefined;
|
|
301056
301052
|
const tags = normalizePatternTagFlags(context.flags.tags, context.flags.tag);
|
|
301057
301053
|
const thumbnailUrl = typeof context.flags["thumbnail-url"] === "string" ? context.flags["thumbnail-url"] : undefined;
|
|
@@ -301076,9 +301072,42 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
|
|
|
301076
301072
|
},
|
|
301077
301073
|
sortOrder: 60,
|
|
301078
301074
|
supportsDryRun: true,
|
|
301079
|
-
usage: "wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag
|
|
301080
|
-
visibleFieldNames: () =>
|
|
301075
|
+
usage: "wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag,...>] [--tag <tag>...] [--thumbnail-url <url>] [--dry-run]",
|
|
301076
|
+
visibleFieldNames: () => PATTERN_CATALOG_VISIBLE_FIELDS
|
|
301081
301077
|
});
|
|
301078
|
+
function createInvalidPatternArgumentError(message) {
|
|
301079
|
+
return createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, message);
|
|
301080
|
+
}
|
|
301081
|
+
function createMissingPatternArgumentError(message) {
|
|
301082
|
+
return createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
|
|
301083
|
+
}
|
|
301084
|
+
function resolvePatternScopeFlag(context) {
|
|
301085
|
+
const scope = readOptionalLooseStringFlag(context.flags, "scope");
|
|
301086
|
+
if (!scope) {
|
|
301087
|
+
return;
|
|
301088
|
+
}
|
|
301089
|
+
if (context.addRuntime.PATTERN_CATALOG_SCOPE_IDS.includes(scope)) {
|
|
301090
|
+
return scope;
|
|
301091
|
+
}
|
|
301092
|
+
throw createInvalidPatternArgumentError(`\`--scope\` must be one of: ${context.addRuntime.PATTERN_CATALOG_SCOPE_IDS.join(", ")}. Usage: wp-typia add pattern <name> --scope <full|section>.`);
|
|
301093
|
+
}
|
|
301094
|
+
function resolvePatternSectionRoleFlag(context, scope) {
|
|
301095
|
+
const sectionRole = readOptionalLooseStringFlag(context.flags, "section-role");
|
|
301096
|
+
if (scope === "section" && sectionRole === undefined) {
|
|
301097
|
+
throw createMissingPatternArgumentError("`wp-typia add pattern --scope section` requires --section-role <role> because section-scoped patterns need a typed catalog section role.");
|
|
301098
|
+
}
|
|
301099
|
+
if (scope !== "section" && sectionRole !== undefined) {
|
|
301100
|
+
throw createInvalidPatternArgumentError("`--section-role` only applies with `--scope section`. Use `--scope section --section-role <role>` or omit `--section-role` for full patterns.");
|
|
301101
|
+
}
|
|
301102
|
+
const normalizedSectionRole = sectionRole === undefined ? undefined : context.addRuntime.normalizeBlockSlug(sectionRole);
|
|
301103
|
+
if (normalizedSectionRole && !context.addRuntime.PATTERN_SECTION_ROLE_PATTERN.test(normalizedSectionRole)) {
|
|
301104
|
+
throw createInvalidPatternArgumentError("`--section-role` must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens. Section roles apply only with `--scope section`.");
|
|
301105
|
+
}
|
|
301106
|
+
if (sectionRole !== undefined && !normalizedSectionRole) {
|
|
301107
|
+
throw createInvalidPatternArgumentError("`--section-role` must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens. Section roles apply only with `--scope section`.");
|
|
301108
|
+
}
|
|
301109
|
+
return normalizedSectionRole;
|
|
301110
|
+
}
|
|
301082
301111
|
function collectStringFlagValues(value2) {
|
|
301083
301112
|
if (typeof value2 === "string") {
|
|
301084
301113
|
return [value2];
|
|
@@ -301093,13 +301122,7 @@ function normalizePatternTagFlags(tagsFlag, tagFlag) {
|
|
|
301093
301122
|
...collectStringFlagValues(tagsFlag),
|
|
301094
301123
|
...collectStringFlagValues(tagFlag)
|
|
301095
301124
|
];
|
|
301096
|
-
|
|
301097
|
-
return;
|
|
301098
|
-
}
|
|
301099
|
-
if (tags.length === 1) {
|
|
301100
|
-
return tags[0];
|
|
301101
|
-
}
|
|
301102
|
-
return tags;
|
|
301125
|
+
return tags.length > 0 ? tags : undefined;
|
|
301103
301126
|
}
|
|
301104
301127
|
|
|
301105
301128
|
// src/add-kinds/post-meta.ts
|
|
@@ -301849,7 +301872,7 @@ function buildStructuredInitSuccessPayload(plan) {
|
|
|
301849
301872
|
// package.json
|
|
301850
301873
|
var package_default2 = {
|
|
301851
301874
|
name: "wp-typia",
|
|
301852
|
-
version: "0.24.
|
|
301875
|
+
version: "0.24.3",
|
|
301853
301876
|
description: "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
301854
301877
|
packageManager: "bun@1.3.11",
|
|
301855
301878
|
type: "module",
|
|
@@ -301919,7 +301942,7 @@ var package_default2 = {
|
|
|
301919
301942
|
"@bunli/tui": "0.6.0",
|
|
301920
301943
|
"@bunli/utils": "0.6.0",
|
|
301921
301944
|
"@wp-typia/api-client": "^0.4.5",
|
|
301922
|
-
"@wp-typia/project-tools": "0.24.
|
|
301945
|
+
"@wp-typia/project-tools": "0.24.3",
|
|
301923
301946
|
"better-result": "^2.7.0",
|
|
301924
301947
|
react: "^19.2.5",
|
|
301925
301948
|
"react-dom": "^19.2.5",
|
|
@@ -302396,12 +302419,12 @@ async function executeDoctorCommand(cwd, options = {}) {
|
|
|
302396
302419
|
}
|
|
302397
302420
|
}
|
|
302398
302421
|
// src/runtime-bridge-init.ts
|
|
302399
|
-
import
|
|
302422
|
+
import path113 from "path";
|
|
302400
302423
|
var loadCliInitRuntime = () => Promise.resolve().then(() => (init_cli_init(), exports_cli_init));
|
|
302401
302424
|
async function executeInitCommand({ apply, cwd, packageManager, projectDir }, options = {}) {
|
|
302402
302425
|
try {
|
|
302403
302426
|
const { runInitCommand: runInitCommand2 } = await loadCliInitRuntime();
|
|
302404
|
-
const resolvedProjectDir = projectDir ?
|
|
302427
|
+
const resolvedProjectDir = projectDir ? path113.resolve(cwd, projectDir) : cwd;
|
|
302405
302428
|
const plan = await runInitCommand2({
|
|
302406
302429
|
apply,
|
|
302407
302430
|
packageManager,
|
|
@@ -302519,7 +302542,7 @@ init_cli_diagnostics();
|
|
|
302519
302542
|
init_package_managers();
|
|
302520
302543
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
302521
302544
|
import fs47 from "fs";
|
|
302522
|
-
import
|
|
302545
|
+
import path114 from "path";
|
|
302523
302546
|
var SYNC_INSTALL_MARKERS = [
|
|
302524
302547
|
"node_modules",
|
|
302525
302548
|
".pnp.cjs",
|
|
@@ -302549,7 +302572,7 @@ function readSyncPackageJson(packageJsonPath) {
|
|
|
302549
302572
|
}
|
|
302550
302573
|
}
|
|
302551
302574
|
function resolveSyncProjectContext(cwd) {
|
|
302552
|
-
const packageJsonPath =
|
|
302575
|
+
const packageJsonPath = path114.join(cwd, "package.json");
|
|
302553
302576
|
if (!fs47.existsSync(packageJsonPath)) {
|
|
302554
302577
|
throw getSyncRootError(cwd);
|
|
302555
302578
|
}
|
|
@@ -302584,12 +302607,12 @@ function resolveSyncProjectContext(cwd) {
|
|
|
302584
302607
|
};
|
|
302585
302608
|
}
|
|
302586
302609
|
function findInstalledDependencyMarkerDir(projectDir) {
|
|
302587
|
-
let currentDir =
|
|
302610
|
+
let currentDir = path114.resolve(projectDir);
|
|
302588
302611
|
while (true) {
|
|
302589
|
-
if (SYNC_INSTALL_MARKERS.some((marker) => fs47.existsSync(
|
|
302612
|
+
if (SYNC_INSTALL_MARKERS.some((marker) => fs47.existsSync(path114.join(currentDir, marker)))) {
|
|
302590
302613
|
return currentDir;
|
|
302591
302614
|
}
|
|
302592
|
-
const parentDir =
|
|
302615
|
+
const parentDir = path114.dirname(currentDir);
|
|
302593
302616
|
if (parentDir === currentDir) {
|
|
302594
302617
|
return null;
|
|
302595
302618
|
}
|
|
@@ -303398,7 +303421,7 @@ init_cli_diagnostics();
|
|
|
303398
303421
|
|
|
303399
303422
|
// src/mcp.ts
|
|
303400
303423
|
import fs48 from "fs/promises";
|
|
303401
|
-
import
|
|
303424
|
+
import path115 from "path";
|
|
303402
303425
|
|
|
303403
303426
|
// ../../node_modules/.bun/@bunli+plugin-mcp@0.2.5+ef72ce197b058209/node_modules/@bunli/plugin-mcp/src/errors.ts
|
|
303404
303427
|
class SchemaConversionError extends TaggedError("SchemaConversionError")() {
|
|
@@ -303933,7 +303956,7 @@ function getErrorCauseOptions(error48) {
|
|
|
303933
303956
|
return error48 instanceof Error ? { cause: error48 } : undefined;
|
|
303934
303957
|
}
|
|
303935
303958
|
async function readSchemaSource(cwd, source) {
|
|
303936
|
-
const schemaPath =
|
|
303959
|
+
const schemaPath = path115.resolve(cwd, source.path);
|
|
303937
303960
|
const raw = await fs48.readFile(schemaPath, "utf8");
|
|
303938
303961
|
let parsed;
|
|
303939
303962
|
try {
|
|
@@ -303955,7 +303978,7 @@ async function readSchemaSource(cwd, source) {
|
|
|
303955
303978
|
async function loadMcpToolGroups(cwd, schemaSources) {
|
|
303956
303979
|
return Promise.all(schemaSources.map((source) => readSchemaSource(cwd, source)));
|
|
303957
303980
|
}
|
|
303958
|
-
async function syncMcpSchemas(cwd, schemaSources, outputDir =
|
|
303981
|
+
async function syncMcpSchemas(cwd, schemaSources, outputDir = path115.join(cwd, ".bunli", "mcp")) {
|
|
303959
303982
|
const groups = await loadMcpToolGroups(cwd, schemaSources);
|
|
303960
303983
|
const result = await generateMCPTypes({
|
|
303961
303984
|
outputDir,
|
|
@@ -303978,7 +304001,7 @@ async function syncMcpSchemas(cwd, schemaSources, outputDir = path111.join(cwd,
|
|
|
303978
304001
|
}
|
|
303979
304002
|
}
|
|
303980
304003
|
await fs48.mkdir(outputDir, { recursive: true });
|
|
303981
|
-
await fs48.writeFile(
|
|
304004
|
+
await fs48.writeFile(path115.join(outputDir, "registry.json"), `${JSON.stringify(registry2, null, 2)}
|
|
303982
304005
|
`, "utf8");
|
|
303983
304006
|
return {
|
|
303984
304007
|
commandCount: registry2.reduce((count, group) => count + group.tools.length, 0),
|
|
@@ -304307,4 +304330,4 @@ export {
|
|
|
304307
304330
|
cli
|
|
304308
304331
|
};
|
|
304309
304332
|
|
|
304310
|
-
//# debugId=
|
|
304333
|
+
//# debugId=2AB06C2166C7F45664756E2164756E21
|