wp-typia 0.22.6 → 0.22.7

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.
@@ -11,7 +11,6 @@ import {
11
11
  parseAlternateRenderTargets,
12
12
  parseCompoundInnerBlocksPreset,
13
13
  parseTemplateLocator,
14
- pathExists,
15
14
  renderScaffoldCompatibilityConfig,
16
15
  require_semver,
17
16
  resolveExternalTemplateLayers,
@@ -22,7 +21,7 @@ import {
22
21
  scaffoldProject,
23
22
  syncPersistenceRestArtifacts,
24
23
  updatePluginHeaderCompatibility
25
- } from "./cli-6a65qfb1.js";
24
+ } from "./cli-8snabymq.js";
26
25
  import {
27
26
  DEFAULT_WORDPRESS_ABILITIES_VERSION,
28
27
  DEFAULT_WORDPRESS_CORE_ABILITIES_VERSION,
@@ -32,10 +31,10 @@ import {
32
31
  DEFAULT_WP_TYPIA_DATAVIEWS_VERSION,
33
32
  getPackageVersions,
34
33
  resolveManagedPackageVersionRange
35
- } from "./cli-1sm60g1z.js";
34
+ } from "./cli-2hsp17nd.js";
36
35
  import {
37
36
  snapshotProjectVersion
38
- } from "./cli-0q0tz4dq.js";
37
+ } from "./cli-27v2qpjg.js";
39
38
  import {
40
39
  ensureMigrationDirectories,
41
40
  parseMigrationConfig,
@@ -84,6 +83,7 @@ import {
84
83
  isAddBlockTemplateId,
85
84
  normalizeBlockSlug,
86
85
  patchFile,
86
+ pathExists,
87
87
  quotePhpString,
88
88
  quoteTsString,
89
89
  readOptionalFile,
@@ -101,7 +101,7 @@ import {
101
101
  toPascalCase,
102
102
  toSnakeCase,
103
103
  toTitleCase
104
- } from "./cli-5kn2p7ee.js";
104
+ } from "./cli-ta3y0hp2.js";
105
105
  import {
106
106
  createManagedTempRoot
107
107
  } from "./cli-t73q5aqz.js";
@@ -794,7 +794,6 @@ async function runAddBlockCommand({
794
794
  }
795
795
  }
796
796
  // ../wp-typia-project-tools/src/runtime/cli-add-workspace.ts
797
- import fs5 from "fs";
798
797
  import { promises as fsp9 } from "fs";
799
798
  import path14 from "path";
800
799
 
@@ -7117,7 +7116,7 @@ async function writeVariationRegistry(projectDir, blockSlug, variationSlug) {
7117
7116
  const variationsDir = path14.join(projectDir, "src", "blocks", blockSlug, "variations");
7118
7117
  const variationsIndexPath = path14.join(variationsDir, "index.ts");
7119
7118
  await fsp9.mkdir(variationsDir, { recursive: true });
7120
- const existingVariationSlugs = fs5.readdirSync(variationsDir).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
7119
+ const existingVariationSlugs = (await fsp9.readdir(variationsDir)).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
7121
7120
  const nextVariationSlugs = Array.from(new Set([...existingVariationSlugs, variationSlug])).sort();
7122
7121
  await fsp9.writeFile(variationsIndexPath, buildVariationIndexSource(nextVariationSlugs), "utf8");
7123
7122
  }
@@ -7125,7 +7124,7 @@ async function writeBlockStyleRegistry(projectDir, blockSlug, styleSlug) {
7125
7124
  const stylesDir = path14.join(projectDir, "src", "blocks", blockSlug, "styles");
7126
7125
  const stylesIndexPath = path14.join(stylesDir, "index.ts");
7127
7126
  await fsp9.mkdir(stylesDir, { recursive: true });
7128
- const existingStyleSlugs = fs5.readdirSync(stylesDir).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
7127
+ const existingStyleSlugs = (await fsp9.readdir(stylesDir)).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
7129
7128
  const nextStyleSlugs = Array.from(new Set([...existingStyleSlugs, styleSlug])).sort();
7130
7129
  await fsp9.writeFile(stylesIndexPath, buildBlockStyleIndexSource(nextStyleSlugs), "utf8");
7131
7130
  }
@@ -7133,7 +7132,7 @@ async function writeBlockTransformRegistry(projectDir, blockSlug, transformSlug)
7133
7132
  const transformsDir = path14.join(projectDir, "src", "blocks", blockSlug, "transforms");
7134
7133
  const transformsIndexPath = path14.join(transformsDir, "index.ts");
7135
7134
  await fsp9.mkdir(transformsDir, { recursive: true });
7136
- const existingTransformSlugs = fs5.readdirSync(transformsDir).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
7135
+ const existingTransformSlugs = (await fsp9.readdir(transformsDir)).filter((entry) => entry.endsWith(".ts") && entry !== "index.ts").map((entry) => entry.replace(/\.ts$/u, ""));
7137
7136
  const nextTransformSlugs = Array.from(new Set([...existingTransformSlugs, transformSlug])).sort();
7138
7137
  await fsp9.writeFile(transformsIndexPath, buildBlockTransformIndexSource(nextTransformSlugs), "utf8");
7139
7138
  }
@@ -7182,7 +7181,7 @@ async function runAddVariationCommand({
7182
7181
  const variationsDir = path14.join(workspace.projectDir, "src", "blocks", blockSlug, "variations");
7183
7182
  const variationFilePath = path14.join(variationsDir, `${variationSlug}.ts`);
7184
7183
  const variationsIndexPath = path14.join(variationsDir, "index.ts");
7185
- const shouldRemoveVariationsDirOnRollback = !fs5.existsSync(variationsDir);
7184
+ const shouldRemoveVariationsDirOnRollback = !await pathExists(variationsDir);
7186
7185
  const mutationSnapshot = {
7187
7186
  fileSources: await snapshotWorkspaceFiles([
7188
7187
  blockConfigPath,
@@ -7229,7 +7228,7 @@ async function runAddBlockStyleCommand({
7229
7228
  const stylesDir = path14.join(workspace.projectDir, "src", "blocks", blockSlug, "styles");
7230
7229
  const styleFilePath = path14.join(stylesDir, `${styleSlug}.ts`);
7231
7230
  const stylesIndexPath = path14.join(stylesDir, "index.ts");
7232
- const shouldRemoveStylesDirOnRollback = !fs5.existsSync(stylesDir);
7231
+ const shouldRemoveStylesDirOnRollback = !await pathExists(stylesDir);
7233
7232
  const mutationSnapshot = {
7234
7233
  fileSources: await snapshotWorkspaceFiles([
7235
7234
  blockConfigPath,
@@ -7278,7 +7277,7 @@ async function runAddBlockTransformCommand({
7278
7277
  const transformsDir = path14.join(workspace.projectDir, "src", "blocks", target.blockSlug, "transforms");
7279
7278
  const transformFilePath = path14.join(transformsDir, `${transformSlug}.ts`);
7280
7279
  const transformsIndexPath = path14.join(transformsDir, "index.ts");
7281
- const shouldRemoveTransformsDirOnRollback = !fs5.existsSync(transformsDir);
7280
+ const shouldRemoveTransformsDirOnRollback = !await pathExists(transformsDir);
7282
7281
  const mutationSnapshot = {
7283
7282
  fileSources: await snapshotWorkspaceFiles([
7284
7283
  blockConfigPath,
@@ -7338,7 +7337,7 @@ async function runAddHookedBlockCommand({
7338
7337
  if (resolvedAnchorBlockName === selfHookAnchor) {
7339
7338
  throw new Error("`wp-typia add hooked-block` cannot hook a block relative to its own block name.");
7340
7339
  }
7341
- const { blockJson, blockJsonPath } = readWorkspaceBlockJson(workspace.projectDir, blockSlug);
7340
+ const { blockJson, blockJsonPath } = await readWorkspaceBlockJson(workspace.projectDir, blockSlug);
7342
7341
  const blockJsonRelativePath = path14.relative(workspace.projectDir, blockJsonPath);
7343
7342
  const blockHooks = getMutableBlockHooks(blockJson, blockJsonRelativePath);
7344
7343
  if (Object.prototype.hasOwnProperty.call(blockHooks, resolvedAnchorBlockName)) {
@@ -7385,4 +7384,4 @@ export {
7385
7384
  ADD_BLOCK_TEMPLATE_IDS
7386
7385
  };
7387
7386
 
7388
- //# debugId=24FCFA027181E91A64756E2164756E21
7387
+ //# debugId=DA912BE06859998764756E2164756E21
@@ -14,7 +14,7 @@ import {
14
14
  // package.json
15
15
  var package_default = {
16
16
  name: "wp-typia",
17
- version: "0.22.6",
17
+ version: "0.22.7",
18
18
  description: "Canonical CLI package for wp-typia scaffolding and project workflows",
19
19
  packageManager: "bun@1.3.11",
20
20
  type: "module",
@@ -84,7 +84,7 @@ var package_default = {
84
84
  "@bunli/tui": "0.6.0",
85
85
  "@bunli/utils": "0.6.0",
86
86
  "@wp-typia/api-client": "^0.4.5",
87
- "@wp-typia/project-tools": "0.22.6",
87
+ "@wp-typia/project-tools": "0.22.7",
88
88
  "better-result": "^2.7.0",
89
89
  react: "^19.2.5",
90
90
  "react-dom": "^19.2.5",
@@ -1006,4 +1006,4 @@ function createPlugin(input) {
1006
1006
  }
1007
1007
  export { createPlugin, package_default, collectPositionalIndexes, findFirstPositionalIndex, CREATE_OPTION_METADATA, ADD_OPTION_METADATA, INIT_OPTION_METADATA, MIGRATE_OPTION_METADATA, MCP_OPTION_METADATA, SYNC_OPTION_METADATA, DOCTOR_OPTION_METADATA, TEMPLATES_OPTION_METADATA, GLOBAL_OPTION_METADATA, COMMAND_OPTION_METADATA_BY_GROUP, ALL_COMMAND_OPTION_METADATA, buildCommandOptions, collectOptionNamesByType, buildCommandOptionParser, COMMAND_ROUTING_METADATA, createMissingOptionValueError, extractKnownOptionValuesFromArgv, resolveCommandOptionValues, normalizeCliOutputFormatArgv, validateCliOutputFormatArgv, prefersStructuredCliOutput, emitCliDiagnosticFailure, writeStructuredCliDiagnosticError, WP_TYPIA_CANONICAL_CREATE_USAGE, WP_TYPIA_RESERVED_TOP_LEVEL_COMMAND_NAMES, WP_TYPIA_TOP_LEVEL_COMMAND_NAMES, WP_TYPIA_COMMAND_OPTION_GROUP_NAMES_BY_TOP_LEVEL_COMMAND, WP_TYPIA_CONFIG_SOURCES, mergeWpTypiaUserConfig, loadWpTypiaUserConfigFromSource, loadWpTypiaUserConfig, getCreateDefaults, getAddBlockDefaults, getMcpSchemaSources };
1008
1008
 
1009
- //# debugId=B47B1FB40378942764756E2164756E21
1009
+ //# debugId=8CED1A44380ADAE964756E2164756E21
@@ -21,7 +21,7 @@ import {
21
21
  escapeRegex,
22
22
  readWorkspaceInventory,
23
23
  resolveEditorPluginSlotAlias
24
- } from "./cli-5kn2p7ee.js";
24
+ } from "./cli-ta3y0hp2.js";
25
25
  import"./cli-t73q5aqz.js";
26
26
  import"./cli-fys8vm2t.js";
27
27
  import {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  getPackageVersions
4
- } from "./cli-1sm60g1z.js";
4
+ } from "./cli-2hsp17nd.js";
5
5
  import {
6
6
  discoverMigrationInitLayout
7
7
  } from "./cli-2rqf6t0b.js";
@@ -13,7 +13,7 @@ import {
13
13
  snapshotWorkspaceFiles,
14
14
  toPascalCase,
15
15
  updateWorkspaceInventorySource
16
- } from "./cli-5kn2p7ee.js";
16
+ } from "./cli-ta3y0hp2.js";
17
17
  import"./cli-fys8vm2t.js";
18
18
  import {
19
19
  CLI_DIAGNOSTIC_CODES,
@@ -218,6 +218,74 @@ import fs2 from "fs";
218
218
  import path2 from "path";
219
219
  import { analyzeSourceTypes } from "@wp-typia/block-runtime/metadata-parser";
220
220
 
221
+ // ../wp-typia-project-tools/src/runtime/cli-init-plan-presentation.ts
222
+ function buildInitPlanChangeSummary(changes, options) {
223
+ const lines = [];
224
+ for (const dependencyChange of changes.packageChanges.addDevDependencies) {
225
+ lines.push(`devDependency ${dependencyChange.action} ${dependencyChange.name} -> ${dependencyChange.requiredValue}`);
226
+ }
227
+ if (changes.packageChanges.packageManagerField) {
228
+ lines.push(`packageManager ${changes.packageChanges.packageManagerField.action} -> ${changes.packageChanges.packageManagerField.requiredValue}`);
229
+ }
230
+ for (const scriptChange of changes.packageChanges.scripts) {
231
+ lines.push(`script ${scriptChange.action} ${scriptChange.name} -> ${scriptChange.requiredValue}`);
232
+ }
233
+ for (const filePlan of changes.plannedFiles) {
234
+ lines.push(`file ${filePlan.action} ${filePlan.path} (${filePlan.purpose})`);
235
+ }
236
+ if (options.includeGeneratedArtifacts) {
237
+ for (const artifactPath of changes.generatedArtifacts) {
238
+ lines.push(`generated artifact ${artifactPath}`);
239
+ }
240
+ }
241
+ return lines;
242
+ }
243
+ function buildInitPlanNextSteps(options) {
244
+ const cliSpecifier = getWpTypiaCliSpecifier();
245
+ const syncTypesRun = formatRunScript(options.packageManager, "sync-types");
246
+ const syncRun = formatRunScript(options.packageManager, "sync");
247
+ const doctorRun = formatPackageExecCommand(options.packageManager, cliSpecifier, "doctor");
248
+ const migrationInitRun = formatPackageExecCommand(options.packageManager, cliSpecifier, "migrate init --current-migration-version v1");
249
+ const dependencyInstallCommand = formatAddDevDependenciesCommand(options.packageManager, buildRequiredDevDependencyMapEntries());
250
+ if (options.layoutKind === "unsupported") {
251
+ return [
252
+ "Align the project to one of the supported retrofit layouts listed below, then rerun `wp-typia init`.",
253
+ dependencyInstallCommand,
254
+ syncTypesRun,
255
+ doctorRun
256
+ ];
257
+ }
258
+ if (options.commandMode === "apply") {
259
+ return [
260
+ ...options.dependencyChangeCount > 0 ? [
261
+ "Install or reinstall project dependencies so the retrofit sync scripts and metadata generators are available locally.",
262
+ dependencyInstallCommand
263
+ ] : [],
264
+ syncRun,
265
+ doctorRun,
266
+ `Optional migration bootstrap: ${migrationInitRun}`
267
+ ];
268
+ }
269
+ return [
270
+ ...options.hasPlannedChanges ? [
271
+ "Re-run `wp-typia init --apply` to write the planned package.json changes and helper files automatically.",
272
+ ...options.dependencyChangeCount > 0 ? [dependencyInstallCommand] : []
273
+ ] : [],
274
+ syncRun,
275
+ doctorRun,
276
+ `Optional migration bootstrap: ${migrationInitRun}`
277
+ ];
278
+ }
279
+ function buildRetrofitPlanSummary(options) {
280
+ if (options.status === "already-initialized") {
281
+ return options.commandMode === "apply" ? "This project already exposes the minimum wp-typia retrofit surface. No files were changed." : "This project already exposes the minimum wp-typia retrofit surface.";
282
+ }
283
+ if (options.commandMode === "apply") {
284
+ return "Applied the minimum wp-typia retrofit surface so package.json and helper scripts are ready for the next install and sync run.";
285
+ }
286
+ return "This command previews the minimum wp-typia adoption layer for the current project without rewriting it into a full scaffold.";
287
+ }
288
+
221
289
  // ../wp-typia-project-tools/src/runtime/cli-init-types.ts
222
290
  var SUPPORTED_RETROFIT_LAYOUT_NOTE = "Supported retrofit layouts currently mirror the migration bootstrap detector: `src/block.json` + `src/types.ts` + `src/save.tsx`, legacy root `block.json` + `src/types.ts` + `src/save.tsx`, or multi-block `src/blocks/*/block.json` workspaces.";
223
291
  var RETROFIT_APPLY_PREVIEW_NOTE = "If you rerun with `wp-typia init --apply`, package.json and generated helper files are snapshotted and rolled back automatically if a write fails.";
@@ -364,76 +432,9 @@ function buildPlannedFiles(projectDir, layoutKind) {
364
432
  }
365
433
  ];
366
434
  }
367
- function buildChangeSummary(changes, options) {
368
- const lines = [];
369
- for (const dependencyChange of changes.packageChanges.addDevDependencies) {
370
- lines.push(`devDependency ${dependencyChange.action} ${dependencyChange.name} -> ${dependencyChange.requiredValue}`);
371
- }
372
- if (changes.packageChanges.packageManagerField) {
373
- lines.push(`packageManager ${changes.packageChanges.packageManagerField.action} -> ${changes.packageChanges.packageManagerField.requiredValue}`);
374
- }
375
- for (const scriptChange of changes.packageChanges.scripts) {
376
- lines.push(`script ${scriptChange.action} ${scriptChange.name} -> ${scriptChange.requiredValue}`);
377
- }
378
- for (const filePlan of changes.plannedFiles) {
379
- lines.push(`file ${filePlan.action} ${filePlan.path} (${filePlan.purpose})`);
380
- }
381
- if (options.includeGeneratedArtifacts) {
382
- for (const artifactPath of changes.generatedArtifacts) {
383
- lines.push(`generated artifact ${artifactPath}`);
384
- }
385
- }
386
- return lines;
387
- }
388
- function buildNextSteps(options) {
389
- const cliSpecifier = getWpTypiaCliSpecifier();
390
- const syncTypesRun = formatRunScript(options.packageManager, "sync-types");
391
- const syncRun = formatRunScript(options.packageManager, "sync");
392
- const doctorRun = formatPackageExecCommand(options.packageManager, cliSpecifier, "doctor");
393
- const migrationInitRun = formatPackageExecCommand(options.packageManager, cliSpecifier, "migrate init --current-migration-version v1");
394
- const dependencyInstallCommand = formatAddDevDependenciesCommand(options.packageManager, buildRequiredDevDependencyMapEntries());
395
- if (options.layoutKind === "unsupported") {
396
- return [
397
- "Align the project to one of the supported retrofit layouts listed below, then rerun `wp-typia init`.",
398
- dependencyInstallCommand,
399
- syncTypesRun,
400
- doctorRun
401
- ];
402
- }
403
- if (options.commandMode === "apply") {
404
- return [
405
- ...options.dependencyChangeCount > 0 ? [
406
- "Install or reinstall project dependencies so the retrofit sync scripts and metadata generators are available locally.",
407
- dependencyInstallCommand
408
- ] : [],
409
- syncRun,
410
- doctorRun,
411
- `Optional migration bootstrap: ${migrationInitRun}`
412
- ];
413
- }
414
- const steps = [
415
- ...options.hasPlannedChanges ? [
416
- "Re-run `wp-typia init --apply` to write the planned package.json changes and helper files automatically.",
417
- ...options.dependencyChangeCount > 0 ? [dependencyInstallCommand] : []
418
- ] : [],
419
- syncRun,
420
- doctorRun,
421
- `Optional migration bootstrap: ${migrationInitRun}`
422
- ];
423
- return steps;
424
- }
425
- function buildRetrofitPlanSummary(options) {
426
- if (options.status === "already-initialized") {
427
- return options.commandMode === "apply" ? "This project already exposes the minimum wp-typia retrofit surface. No files were changed." : "This project already exposes the minimum wp-typia retrofit surface.";
428
- }
429
- if (options.commandMode === "apply") {
430
- return "Applied the minimum wp-typia retrofit surface so package.json and helper scripts are ready for the next install and sync run.";
431
- }
432
- return "This command previews the minimum wp-typia adoption layer for the current project without rewriting it into a full scaffold.";
433
- }
434
435
  function createRetrofitPlan(options) {
435
436
  const includeGeneratedArtifacts = options.commandMode === "preview-only";
436
- const plannedChanges = buildChangeSummary({
437
+ const plannedChanges = buildInitPlanChangeSummary({
437
438
  generatedArtifacts: options.generatedArtifacts,
438
439
  packageChanges: options.packageChanges,
439
440
  plannedFiles: options.plannedFiles
@@ -445,7 +446,7 @@ function createRetrofitPlan(options) {
445
446
  commandMode: options.commandMode,
446
447
  detectedLayout: options.detectedLayout,
447
448
  generatedArtifacts: options.generatedArtifacts,
448
- nextSteps: options.nextSteps ?? buildNextSteps({
449
+ nextSteps: options.nextSteps ?? buildInitPlanNextSteps({
449
450
  commandMode: options.commandMode,
450
451
  dependencyChangeCount: options.packageChanges.addDevDependencies.length,
451
452
  hasPlannedChanges: plannedChanges.length > 0,
@@ -861,4 +862,4 @@ export {
861
862
  applyInitPlan
862
863
  };
863
864
 
864
- //# debugId=9445E5AD8C9D8E6964756E2164756E21
865
+ //# debugId=4F60C8DD81E9727764756E2164756E21
@@ -19,9 +19,9 @@ import {
19
19
  resolvePackageManagerId,
20
20
  resolveTemplateId,
21
21
  scaffoldProject
22
- } from "./cli-6a65qfb1.js";
23
- import"./cli-1sm60g1z.js";
24
- import"./cli-0q0tz4dq.js";
22
+ } from "./cli-8snabymq.js";
23
+ import"./cli-2hsp17nd.js";
24
+ import"./cli-27v2qpjg.js";
25
25
  import"./cli-2rqf6t0b.js";
26
26
  import"./cli-bq2v559b.js";
27
27
  import"./cli-10pe4mf8.js";
@@ -29,7 +29,7 @@ import {
29
29
  OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE,
30
30
  isBuiltInTemplateId
31
31
  } from "./cli-tke8twkn.js";
32
- import"./cli-5kn2p7ee.js";
32
+ import"./cli-ta3y0hp2.js";
33
33
  import {
34
34
  createManagedTempRoot
35
35
  } from "./cli-t73q5aqz.js";