wp-typia 0.22.8 → 0.22.9

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.
@@ -7,10 +7,10 @@ import {
7
7
  parseTemplateLocator,
8
8
  require_semver,
9
9
  validateExplicitCreateTemplateId
10
- } from "./cli-mzvzbpnz.js";
10
+ } from "./cli-8reep89s.js";
11
11
  import {
12
12
  seedProjectMigrations
13
- } from "./cli-bwwssctv.js";
13
+ } from "./cli-ag722tzm.js";
14
14
  import {
15
15
  ensureMigrationDirectories,
16
16
  isPlainObject,
@@ -27,7 +27,7 @@ import {
27
27
  isOmittableBuiltInTemplateLayerDir,
28
28
  resolveBuiltInTemplateSource,
29
29
  resolveBuiltInTemplateSourceFromLayerDirs
30
- } from "./cli-pnjx2e2h.js";
30
+ } from "./cli-xw1wbxf3.js";
31
31
  import {
32
32
  BUILTIN_BLOCK_METADATA_VERSION,
33
33
  COMPOUND_CHILD_BLOCK_METADATA_DEFAULTS,
@@ -57,7 +57,7 @@ import {
57
57
  toTitleCase,
58
58
  validateBlockSlug,
59
59
  validateNamespace
60
- } from "./cli-bbj0kn1e.js";
60
+ } from "./cli-regw5384.js";
61
61
  import {
62
62
  createManagedTempRoot
63
63
  } from "./cli-t73q5aqz.js";
@@ -2556,7 +2556,6 @@ async function collectScaffoldAnswers({
2556
2556
  }
2557
2557
 
2558
2558
  // ../wp-typia-project-tools/src/runtime/scaffold.ts
2559
- import fs11 from "fs";
2560
2559
  import { promises as fsp12 } from "fs";
2561
2560
  import path17 from "path";
2562
2561
 
@@ -3428,7 +3427,6 @@ async function applyBuiltInScaffoldProjectFiles({
3428
3427
  import path13 from "path";
3429
3428
 
3430
3429
  // ../wp-typia-project-tools/src/runtime/template-layers.ts
3431
- import fs5 from "fs";
3432
3430
  import path10 from "path";
3433
3431
  import { promises as fsp7 } from "fs";
3434
3432
  var TEMPLATE_LAYER_MANIFEST_FILENAME = "wp-typia.layers.json";
@@ -3480,7 +3478,7 @@ function parseLayerDefinition(layerId, value) {
3480
3478
  }
3481
3479
  async function loadExternalTemplateLayerManifest(sourceRoot) {
3482
3480
  const manifestPath = path10.join(sourceRoot, TEMPLATE_LAYER_MANIFEST_FILENAME);
3483
- if (!fs5.existsSync(manifestPath)) {
3481
+ if (!await pathExists(manifestPath)) {
3484
3482
  return null;
3485
3483
  }
3486
3484
  const raw = JSON.parse(await fsp7.readFile(manifestPath, "utf8"));
@@ -3615,13 +3613,12 @@ async function assertExternalTemplateLayersDoNotWriteProtectedOutputs({
3615
3613
  }
3616
3614
 
3617
3615
  // ../wp-typia-project-tools/src/runtime/template-source-external.ts
3618
- import fs7 from "fs";
3619
3616
  import { promises as fsp8 } from "fs";
3620
3617
  import path11 from "path";
3621
3618
  import { pathToFileURL } from "url";
3622
3619
 
3623
3620
  // ../wp-typia-project-tools/src/runtime/external-template-guards.ts
3624
- import fs6 from "fs";
3621
+ import fs5 from "fs";
3625
3622
  var TEMPLATE_SOURCE_TIMEOUT_CODE = "template-source-timeout";
3626
3623
  var TEMPLATE_SOURCE_TOO_LARGE_CODE = "template-source-too-large";
3627
3624
  var DEFAULT_EXTERNAL_TEMPLATE_TIMEOUT_MS = 20000;
@@ -3663,7 +3660,7 @@ function createExternalTemplateTooLargeError(label, maxBytes) {
3663
3660
  return createTemplateGuardError(TEMPLATE_SOURCE_TOO_LARGE_CODE, `${label} exceeded the external template size limit (${maxBytes} bytes).`);
3664
3661
  }
3665
3662
  function assertExternalTemplateFileSize(filePath, options) {
3666
- const stats = fs6.statSync(filePath);
3663
+ const stats = fs5.statSync(filePath);
3667
3664
  if (stats.size > options.maxBytes) {
3668
3665
  throw createExternalTemplateTooLargeError(options.label, options.maxBytes);
3669
3666
  }
@@ -3898,9 +3895,9 @@ async function renderCreateBlockExternalTemplate(sourceDir, context, requestedVa
3898
3895
  const view = await buildExternalTemplateView(context, config, selectedVariant, variantConfig);
3899
3896
  const blockTemplateDir = resolveSourceSubpath(sourceDir, templatePath);
3900
3897
  await copyRenderedDirectory(blockTemplateDir, blockDir, view, {
3901
- filter: (sourcePath, _destinationPath, entry) => {
3898
+ filter: async (sourcePath, _destinationPath, entry) => {
3902
3899
  const mustacheVariantPath = path11.join(path11.dirname(sourcePath), `${entry.name}.mustache`);
3903
- return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && fs7.existsSync(mustacheVariantPath));
3900
+ return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && await pathExists(mustacheVariantPath));
3904
3901
  }
3905
3902
  });
3906
3903
  const assetsPath = typeof variantConfig.assetsPath === "string" ? variantConfig.assetsPath : config.assetsPath;
@@ -3924,7 +3921,6 @@ async function renderCreateBlockExternalTemplate(sourceDir, context, requestedVa
3924
3921
  }
3925
3922
 
3926
3923
  // ../wp-typia-project-tools/src/runtime/template-source-remote.ts
3927
- import fs8 from "fs";
3928
3924
  import { promises as fsp9 } from "fs";
3929
3925
  import path12 from "path";
3930
3926
  async function cleanupSeedRootPair(cleanup, seedCleanup) {
@@ -4009,9 +4005,9 @@ async function normalizeWpTypiaTemplateSeed(seed) {
4009
4005
  const normalizedDir = path12.join(tempRoot, "template");
4010
4006
  try {
4011
4007
  await copyRawDirectory(seed.blockDir, normalizedDir, {
4012
- filter: (sourcePath, _targetPath, entry) => {
4008
+ filter: async (sourcePath, _targetPath, entry) => {
4013
4009
  const mustacheVariantPath = path12.join(path12.dirname(sourcePath), `${entry.name}.mustache`);
4014
- return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && fs8.existsSync(mustacheVariantPath));
4010
+ return !(entry.isFile() && (entry.name === "package.json" || entry.name === "README.md") && await pathExists(mustacheVariantPath));
4015
4011
  }
4016
4012
  });
4017
4013
  if (seed.assetsDir && await pathExists(seed.assetsDir)) {
@@ -4325,7 +4321,7 @@ async function detectTemplateSourceFormat(sourceDir) {
4325
4321
 
4326
4322
  // ../wp-typia-project-tools/src/runtime/template-source-seeds.ts
4327
4323
  var import_semver = __toESM(require_semver(), 1);
4328
- import fs10 from "fs";
4324
+ import fs7 from "fs";
4329
4325
  import { promises as fsp11 } from "fs";
4330
4326
  import { createRequire as createRequire2 } from "module";
4331
4327
  import path16 from "path";
@@ -6601,7 +6597,7 @@ var Vn = 512 * 1024;
6601
6597
  var $n = pr | ur | dr | mr;
6602
6598
  var lr = !fr && typeof ar == "number" ? ar | ur | dr | mr : null;
6603
6599
  var cs = lr !== null ? () => lr : Kn ? (s3) => s3 < Vn ? $n : "w" : () => "w";
6604
- var fs9 = (s3, t, e) => {
6600
+ var fs6 = (s3, t, e) => {
6605
6601
  try {
6606
6602
  return mi.lchownSync(s3, t, e);
6607
6603
  } catch (i) {
@@ -6650,7 +6646,7 @@ var ds = (s3, t, e, i) => {
6650
6646
  });
6651
6647
  };
6652
6648
  var qn = (s3, t, e, i) => {
6653
- t.isDirectory() && us(Ee.resolve(s3, t.name), e, i), fs9(Ee.resolve(s3, t.name), e, i);
6649
+ t.isDirectory() && us(Ee.resolve(s3, t.name), e, i), fs6(Ee.resolve(s3, t.name), e, i);
6654
6650
  };
6655
6651
  var us = (s3, t, e) => {
6656
6652
  let i;
@@ -6661,12 +6657,12 @@ var us = (s3, t, e) => {
6661
6657
  if (n?.code === "ENOENT")
6662
6658
  return;
6663
6659
  if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP")
6664
- return fs9(s3, t, e);
6660
+ return fs6(s3, t, e);
6665
6661
  throw n;
6666
6662
  }
6667
6663
  for (let r of i)
6668
6664
  qn(s3, r, t, e);
6669
- return fs9(s3, t, e);
6665
+ return fs6(s3, t, e);
6670
6666
  };
6671
6667
  var we = class extends Error {
6672
6668
  path;
@@ -8213,8 +8209,8 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
8213
8209
  return null;
8214
8210
  }
8215
8211
  const workspacePackagesRoot = path16.resolve(PROJECT_TOOLS_PACKAGE_ROOT, "..");
8216
- if (fs10.existsSync(workspacePackagesRoot)) {
8217
- for (const entry of fs10.readdirSync(workspacePackagesRoot, {
8212
+ if (fs7.existsSync(workspacePackagesRoot)) {
8213
+ for (const entry of fs7.readdirSync(workspacePackagesRoot, {
8218
8214
  withFileTypes: true
8219
8215
  })) {
8220
8216
  if (!entry.isDirectory()) {
@@ -8222,10 +8218,10 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
8222
8218
  }
8223
8219
  const packageDir = path16.join(workspacePackagesRoot, entry.name);
8224
8220
  const packageJsonPath = path16.join(packageDir, "package.json");
8225
- if (!fs10.existsSync(packageJsonPath)) {
8221
+ if (!fs7.existsSync(packageJsonPath)) {
8226
8222
  continue;
8227
8223
  }
8228
- const manifest = JSON.parse(fs10.readFileSync(packageJsonPath, "utf8"));
8224
+ const manifest = JSON.parse(fs7.readFileSync(packageJsonPath, "utf8"));
8229
8225
  if (manifest.name === locator.name) {
8230
8226
  return {
8231
8227
  blockDir: packageDir,
@@ -8236,7 +8232,7 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
8236
8232
  }
8237
8233
  const workspaceRequire = createRequire2(path16.join(path16.resolve(cwd), "__wp_typia_template_resolver__.cjs"));
8238
8234
  try {
8239
- const packageJsonPath = fs10.realpathSync(workspaceRequire.resolve(`${locator.name}/package.json`));
8235
+ const packageJsonPath = fs7.realpathSync(workspaceRequire.resolve(`${locator.name}/package.json`));
8240
8236
  const sourceDir = path16.dirname(packageJsonPath);
8241
8237
  return {
8242
8238
  blockDir: sourceDir,
@@ -8247,10 +8243,10 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
8247
8243
  if (errorCode === "MODULE_NOT_FOUND" || errorCode === "ERR_PACKAGE_PATH_NOT_EXPORTED") {
8248
8244
  for (const basePath of workspaceRequire.resolve.paths(locator.name) ?? []) {
8249
8245
  const packageJsonPath = path16.join(basePath, locator.name, "package.json");
8250
- if (!fs10.existsSync(packageJsonPath)) {
8246
+ if (!fs7.existsSync(packageJsonPath)) {
8251
8247
  continue;
8252
8248
  }
8253
- const sourceDir = path16.dirname(fs10.realpathSync(packageJsonPath));
8249
+ const sourceDir = path16.dirname(fs7.realpathSync(packageJsonPath));
8254
8250
  return {
8255
8251
  blockDir: sourceDir,
8256
8252
  rootDir: sourceDir
@@ -8261,13 +8257,13 @@ function resolveInstalledNpmTemplateSource(locator, cwd) {
8261
8257
  throw error;
8262
8258
  }
8263
8259
  }
8264
- function isOfficialWorkspaceTemplateSeed(seed) {
8260
+ async function isOfficialWorkspaceTemplateSeedAsync(seed) {
8265
8261
  const packageJsonPath = path16.join(seed.rootDir, "package.json");
8266
- if (!fs10.existsSync(packageJsonPath)) {
8262
+ if (!await pathExists(packageJsonPath)) {
8267
8263
  return false;
8268
8264
  }
8269
8265
  try {
8270
- const packageJson = JSON.parse(fs10.readFileSync(packageJsonPath, "utf8"));
8266
+ const packageJson = JSON.parse(await fsp11.readFile(packageJsonPath, "utf8"));
8271
8267
  return packageJson.name === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE;
8272
8268
  } catch {
8273
8269
  return false;
@@ -8310,13 +8306,13 @@ function runGitTemplateCommand(args, label, options = {}) {
8310
8306
  function getGitHubTemplateRepositoryUrl(locator) {
8311
8307
  return `https://github.com/${locator.owner}/${locator.repo}.git`;
8312
8308
  }
8313
- function resolveGitHubTemplateDirectory(checkoutDir, locator) {
8309
+ async function resolveGitHubTemplateDirectory(checkoutDir, locator) {
8314
8310
  const sourceDir = path16.resolve(checkoutDir, locator.sourcePath);
8315
8311
  const relativeSourceDir = path16.relative(checkoutDir, sourceDir);
8316
8312
  if (relativeSourceDir.startsWith("..") || path16.isAbsolute(relativeSourceDir)) {
8317
8313
  throw new Error("GitHub template path must stay within the cloned repository.");
8318
8314
  }
8319
- if (!fs10.existsSync(sourceDir)) {
8315
+ if (!await pathExists(sourceDir)) {
8320
8316
  throw new Error(`GitHub template path does not exist: ${locator.sourcePath}`);
8321
8317
  }
8322
8318
  return sourceDir;
@@ -8440,7 +8436,7 @@ async function reuseGitHubTemplateCacheByMetadata(locator) {
8440
8436
  if (!cachedSource) {
8441
8437
  return null;
8442
8438
  }
8443
- const sourceDir = resolveGitHubTemplateDirectory(cachedSource.sourceDir, locator);
8439
+ const sourceDir = await resolveGitHubTemplateDirectory(cachedSource.sourceDir, locator);
8444
8440
  await assertNoSymlinks2(sourceDir);
8445
8441
  return {
8446
8442
  blockDir: sourceDir,
@@ -8483,12 +8479,12 @@ async function resolveGitHubTemplateSource(locator) {
8483
8479
  namespace: "github"
8484
8480
  }, async (checkoutDir2) => {
8485
8481
  cloneGitHubTemplateSource(locator, checkoutDir2);
8486
- const sourceDir = resolveGitHubTemplateDirectory(checkoutDir2, locator);
8482
+ const sourceDir = await resolveGitHubTemplateDirectory(checkoutDir2, locator);
8487
8483
  await assertNoSymlinks2(sourceDir);
8488
8484
  pinGitHubTemplateCacheRevision(locator, checkoutDir2, resolvedCacheRevision);
8489
8485
  });
8490
8486
  if (cachedSource) {
8491
- const sourceDir = resolveGitHubTemplateDirectory(cachedSource.sourceDir, locator);
8487
+ const sourceDir = await resolveGitHubTemplateDirectory(cachedSource.sourceDir, locator);
8492
8488
  await assertNoSymlinks2(sourceDir);
8493
8489
  return {
8494
8490
  blockDir: sourceDir,
@@ -8505,7 +8501,7 @@ async function resolveGitHubTemplateSource(locator) {
8505
8501
  const checkoutDir = path16.join(remoteRoot, "source");
8506
8502
  try {
8507
8503
  cloneGitHubTemplateSource(locator, checkoutDir);
8508
- const sourceDir = resolveGitHubTemplateDirectory(checkoutDir, locator);
8504
+ const sourceDir = await resolveGitHubTemplateDirectory(checkoutDir, locator);
8509
8505
  await assertNoSymlinks2(sourceDir);
8510
8506
  return {
8511
8507
  blockDir: sourceDir,
@@ -8520,7 +8516,7 @@ async function resolveGitHubTemplateSource(locator) {
8520
8516
  async function resolveTemplateSeed(locator, cwd) {
8521
8517
  if (locator.kind === "path") {
8522
8518
  const sourceDir = path16.resolve(cwd, locator.templatePath);
8523
- if (!fs10.existsSync(sourceDir)) {
8519
+ if (!await pathExists(sourceDir)) {
8524
8520
  throw new Error(`Template path does not exist: ${sourceDir}`);
8525
8521
  }
8526
8522
  await assertNoSymlinks2(sourceDir);
@@ -8556,7 +8552,7 @@ async function resolveTemplateSource(templateId, cwd, variables, variant) {
8556
8552
  const locator = parseTemplateLocator(templateId);
8557
8553
  const context = getTemplateVariableContext(variables);
8558
8554
  const seed = await resolveTemplateSeed(locator, cwd);
8559
- const isOfficialWorkspaceTemplate = templateId === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE || isOfficialWorkspaceTemplateSeed(seed);
8555
+ const isOfficialWorkspaceTemplate = templateId === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE || await isOfficialWorkspaceTemplateSeedAsync(seed);
8560
8556
  let normalizedSeed = null;
8561
8557
  try {
8562
8558
  const format = await detectTemplateSourceFormat(seed.blockDir);
@@ -13927,7 +13923,7 @@ async function scaffoldProject({
13927
13923
  title: "Finalizing scaffold output"
13928
13924
  });
13929
13925
  const readmePath = path17.join(projectDir, "README.md");
13930
- if (!fs11.existsSync(readmePath)) {
13926
+ if (!await pathExists(readmePath)) {
13931
13927
  await fsp12.writeFile(readmePath, buildReadme(resolvedTemplateId, variables, resolvedPackageManager, {
13932
13928
  withMigrationUi: isBuiltInTemplate || isWorkspace ? withMigrationUi : false,
13933
13929
  withTestPreset: isBuiltInTemplate ? withTestPreset : false,
@@ -13935,7 +13931,7 @@ async function scaffoldProject({
13935
13931
  }), "utf8");
13936
13932
  }
13937
13933
  const gitignorePath = path17.join(projectDir, ".gitignore");
13938
- const existingGitignore = fs11.existsSync(gitignorePath) ? await fsp12.readFile(gitignorePath, "utf8") : "";
13934
+ const existingGitignore = await pathExists(gitignorePath) ? await fsp12.readFile(gitignorePath, "utf8") : "";
13939
13935
  await fsp12.writeFile(gitignorePath, mergeTextLines(buildGitignore(), existingGitignore), "utf8");
13940
13936
  await normalizePackageJson(projectDir, resolvedPackageManager);
13941
13937
  if (isBuiltInTemplate) {
@@ -14018,4 +14014,4 @@ async function resolveOptionalInteractiveExternalLayerId({
14018
14014
 
14019
14015
  export { syncPersistenceRestArtifacts, copyInterpolatedDirectory, listInterpolatedDirectoryOutputs, getPrimaryDevelopmentScript, getOptionalOnboardingSteps, getOptionalOnboardingNote, getOptionalOnboardingShortNote, isCompoundPersistenceEnabled, formatNonEmptyTargetDirectoryError, resolveExternalTemplateLayers, resolveTemplateSeed, normalizeOptionalCliString, resolveLocalCliPathOption, assertExternalLayerCompositionOptions, assertBuiltInTemplateVariantAllowed, parseAlternateRenderTargets, parseCompoundInnerBlocksPreset, OPTIONAL_WORDPRESS_AI_CLIENT_COMPATIBILITY, REQUIRED_WORKSPACE_ABILITY_COMPATIBILITY, resolveScaffoldCompatibilityPolicy, createScaffoldCompatibilityConfig, renderScaffoldCompatibilityConfig, updatePluginHeaderCompatibility, getDefaultAnswers, resolveTemplateId, resolvePackageManagerId, collectScaffoldAnswers, DATA_STORAGE_MODES, PERSISTENCE_POLICIES, isDataStorageMode, isPersistencePolicy, scaffoldProject, resolveOptionalInteractiveExternalLayerId };
14020
14016
 
14021
- //# debugId=FB940205207109BF64756E2164756E21
14017
+ //# debugId=D545F6556EC75A4064756E2164756E21
@@ -9,6 +9,9 @@ import {
9
9
  isBuiltInTemplateId,
10
10
  isRemovedBuiltInTemplateId
11
11
  } from "./cli-qse6myha.js";
12
+ import {
13
+ suggestCloseId
14
+ } from "./cli-cvxvcw7c.js";
12
15
  import {
13
16
  CLI_DIAGNOSTIC_CODES,
14
17
  createCliDiagnosticCodeError
@@ -3629,37 +3632,12 @@ function looksLikeExplicitNonNpmExternalTemplateLocator(templateId) {
3629
3632
  function looksLikeExplicitCreateExternalTemplateLocator(templateId) {
3630
3633
  return looksLikeExplicitNonNpmExternalTemplateLocator(templateId) || parseNpmTemplateLocator(templateId) !== null;
3631
3634
  }
3632
- function getEditDistance(left, right) {
3633
- const previous = Array.from({ length: right.length + 1 }, (_, index) => index);
3634
- const current = new Array(right.length + 1);
3635
- for (let leftIndex = 0;leftIndex < left.length; leftIndex += 1) {
3636
- current[0] = leftIndex + 1;
3637
- for (let rightIndex = 0;rightIndex < right.length; rightIndex += 1) {
3638
- const substitutionCost = left[leftIndex] === right[rightIndex] ? 0 : 1;
3639
- current[rightIndex + 1] = Math.min(current[rightIndex] + 1, previous[rightIndex + 1] + 1, previous[rightIndex] + substitutionCost);
3640
- }
3641
- for (let index = 0;index < current.length; index += 1) {
3642
- previous[index] = current[index];
3643
- }
3644
- }
3645
- return previous[right.length];
3646
- }
3647
3635
  function findMistypedBuiltInTemplateSuggestion(templateId) {
3648
3636
  const normalizedTemplateId = templateId.trim().toLowerCase();
3649
3637
  if (normalizedTemplateId.length === 0 || looksLikeExplicitNonNpmExternalTemplateLocator(normalizedTemplateId)) {
3650
3638
  return null;
3651
3639
  }
3652
- let bestCandidate = null;
3653
- for (const candidateId of TEMPLATE_SUGGESTION_IDS) {
3654
- const distance = getEditDistance(normalizedTemplateId, candidateId);
3655
- if (bestCandidate === null || distance < bestCandidate.distance) {
3656
- bestCandidate = {
3657
- distance,
3658
- id: candidateId
3659
- };
3660
- }
3661
- }
3662
- return bestCandidate && bestCandidate.distance <= 2 ? bestCandidate.id : null;
3640
+ return suggestCloseId(normalizedTemplateId, TEMPLATE_SUGGESTION_IDS);
3663
3641
  }
3664
3642
  function getMistypedBuiltInTemplateMessage(templateId) {
3665
3643
  const suggestion = findMistypedBuiltInTemplateSuggestion(templateId);
@@ -3699,4 +3677,4 @@ function validateExplicitCreateTemplateId(templateId) {
3699
3677
 
3700
3678
  export { require_semver2 as require_semver, parseTemplateLocator, CREATE_TEMPLATE_SELECTION_HINT, validateExplicitCreateTemplateId };
3701
3679
 
3702
- //# debugId=BE9DD1EB4BD209FD64756E2164756E21
3680
+ //# debugId=4BED06AE7FCF36F264756E2164756E21
@@ -20,7 +20,7 @@ import {
20
20
  scaffoldProject,
21
21
  syncPersistenceRestArtifacts,
22
22
  updatePluginHeaderCompatibility
23
- } from "./cli-fa7g1aqm.js";
23
+ } from "./cli-2pnk64h0.js";
24
24
  import {
25
25
  DEFAULT_WORDPRESS_ABILITIES_VERSION,
26
26
  DEFAULT_WORDPRESS_CORE_ABILITIES_VERSION,
@@ -34,10 +34,10 @@ import {
34
34
  import {
35
35
  parseTemplateLocator,
36
36
  require_semver
37
- } from "./cli-mzvzbpnz.js";
37
+ } from "./cli-8reep89s.js";
38
38
  import {
39
39
  snapshotProjectVersion
40
- } from "./cli-bwwssctv.js";
40
+ } from "./cli-ag722tzm.js";
41
41
  import {
42
42
  ensureMigrationDirectories,
43
43
  parseMigrationConfig,
@@ -51,7 +51,7 @@ import {
51
51
  hasUncommentedPattern,
52
52
  maskTypeScriptCommentsAndLiterals
53
53
  } from "./cli-rwjkqjhs.js";
54
- import"./cli-pnjx2e2h.js";
54
+ import"./cli-xw1wbxf3.js";
55
55
  import {
56
56
  SHARED_WORKSPACE_TEMPLATE_ROOT
57
57
  } from "./cli-qse6myha.js";
@@ -81,6 +81,7 @@ import {
81
81
  getMutableBlockHooks,
82
82
  getPropertyNameText,
83
83
  getWorkspaceBlockSelectOptions,
84
+ getWorkspaceBlockSelectOptionsAsync,
84
85
  getWorkspaceBootstrapPath,
85
86
  hasPhpFunctionCall,
86
87
  hasPhpFunctionDefinition,
@@ -101,12 +102,14 @@ import {
101
102
  resolveWorkspaceBlock,
102
103
  rollbackWorkspaceMutation,
103
104
  snapshotWorkspaceFiles,
105
+ suggestAddBlockTemplateId,
104
106
  toCamelCase,
105
107
  toKebabCase,
106
108
  toPascalCase,
107
109
  toSnakeCase,
108
110
  toTitleCase
109
- } from "./cli-bbj0kn1e.js";
111
+ } from "./cli-regw5384.js";
112
+ import"./cli-cvxvcw7c.js";
110
113
  import {
111
114
  createManagedTempRoot
112
115
  } from "./cli-t73q5aqz.js";
@@ -504,6 +507,13 @@ async function assertWorkspaceDependenciesInstalled(workspace) {
504
507
  }
505
508
  throw new Error(`Workspace dependencies have not been installed yet. Run \`${formatInstallCommand(workspace.packageManager)}\` from the workspace root before using \`wp-typia add block ...\`.`);
506
509
  }
510
+ function getMistypedAddBlockTemplateMessage(templateId) {
511
+ const suggestion = suggestAddBlockTemplateId(templateId);
512
+ if (!suggestion) {
513
+ return null;
514
+ }
515
+ return `Unknown add-block template "${templateId}". Did you mean "${suggestion}"? Use \`--template ${suggestion}\`, or run \`wp-typia templates list\` to inspect available templates.`;
516
+ }
507
517
  async function copyScaffoldedBlockSlice(projectDir, templateId, tempProjectDir, variables, legacyValidatorPaths = []) {
508
518
  if (templateId === "compound") {
509
519
  await ensureCompoundWorkspaceSupportFiles(projectDir, tempProjectDir, legacyValidatorPaths);
@@ -681,6 +691,10 @@ async function runAddBlockCommand({
681
691
  throw new Error("`wp-typia add block --template query-loop` is not supported. Query Loop is a create-time `core/query` variation scaffold, so use `wp-typia create <project-dir> --template query-loop` instead.");
682
692
  }
683
693
  if (!isAddBlockTemplateId(templateId)) {
694
+ const mistypedAddBlockTemplateMessage = getMistypedAddBlockTemplateMessage(templateId);
695
+ if (mistypedAddBlockTemplateMessage) {
696
+ throw new Error(mistypedAddBlockTemplateMessage);
697
+ }
684
698
  throw new Error(`Unknown add-block template "${templateId}". Expected one of: ${ADD_BLOCK_TEMPLATE_IDS.join(", ")}. Run \`wp-typia templates list\` to inspect available templates.`);
685
699
  }
686
700
  const resolvedTemplateId = templateId;
@@ -7386,6 +7400,7 @@ async function runAddHookedBlockCommand({
7386
7400
  }
7387
7401
  }
7388
7402
  export {
7403
+ suggestAddBlockTemplateId,
7389
7404
  seedWorkspaceMigrationProject,
7390
7405
  runAddVariationCommand,
7391
7406
  runAddRestResourceCommand,
@@ -7400,6 +7415,7 @@ export {
7400
7415
  runAddAdminViewCommand,
7401
7416
  runAddAbilityCommand,
7402
7417
  isAddBlockTemplateId,
7418
+ getWorkspaceBlockSelectOptionsAsync,
7403
7419
  getWorkspaceBlockSelectOptions,
7404
7420
  formatAddHelpText,
7405
7421
  EDITOR_PLUGIN_SLOT_IDS,
@@ -7407,4 +7423,4 @@ export {
7407
7423
  ADD_BLOCK_TEMPLATE_IDS
7408
7424
  };
7409
7425
 
7410
- //# debugId=D2A71082E757E7C764756E2164756E21
7426
+ //# debugId=31F5DCD7996BF38964756E2164756E21
@@ -51,7 +51,7 @@ import {
51
51
  } from "./cli-bq2v559b.js";
52
52
  import {
53
53
  readWorkspaceInventory
54
- } from "./cli-bbj0kn1e.js";
54
+ } from "./cli-regw5384.js";
55
55
  import {
56
56
  getInvalidWorkspaceProjectReason,
57
57
  tryResolveWorkspaceProject
@@ -0,0 +1,46 @@
1
+ // @bun
2
+ // ../wp-typia-project-tools/src/runtime/id-suggestions.ts
3
+ function normalizeCloseId(value) {
4
+ return value.trim().toLowerCase();
5
+ }
6
+ function getEditDistance(left, right) {
7
+ const previous = Array.from({ length: right.length + 1 }, (_, index) => index);
8
+ const current = new Array(right.length + 1);
9
+ for (let leftIndex = 0;leftIndex < left.length; leftIndex += 1) {
10
+ current[0] = leftIndex + 1;
11
+ for (let rightIndex = 0;rightIndex < right.length; rightIndex += 1) {
12
+ const substitutionCost = left[leftIndex] === right[rightIndex] ? 0 : 1;
13
+ current[rightIndex + 1] = Math.min(current[rightIndex] + 1, previous[rightIndex + 1] + 1, previous[rightIndex] + substitutionCost);
14
+ }
15
+ for (let index = 0;index < current.length; index += 1) {
16
+ previous[index] = current[index];
17
+ }
18
+ }
19
+ return previous[right.length];
20
+ }
21
+ function suggestCloseId(input, candidates, options = {}) {
22
+ const normalize = options.normalize ?? normalizeCloseId;
23
+ const normalizedInput = normalize(input);
24
+ if (normalizedInput.length === 0) {
25
+ return null;
26
+ }
27
+ const maxDistance = options.maxDistance ?? 2;
28
+ if (maxDistance < 0) {
29
+ return null;
30
+ }
31
+ let bestCandidate = null;
32
+ for (const candidateId of candidates) {
33
+ const distance = getEditDistance(normalizedInput, normalize(candidateId));
34
+ if (bestCandidate === null || distance < bestCandidate.distance) {
35
+ bestCandidate = {
36
+ distance,
37
+ id: candidateId
38
+ };
39
+ }
40
+ }
41
+ return bestCandidate && bestCandidate.distance <= maxDistance ? bestCandidate.id : null;
42
+ }
43
+
44
+ export { suggestCloseId };
45
+
46
+ //# debugId=7EAC7A78B56C749964756E2164756E21
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  getBuiltInTemplateLayerDirs,
9
9
  isOmittableBuiltInTemplateLayerDir
10
- } from "./cli-pnjx2e2h.js";
10
+ } from "./cli-xw1wbxf3.js";
11
11
  import {
12
12
  isBuiltInTemplateId,
13
13
  listTemplates
@@ -21,7 +21,8 @@ import {
21
21
  escapeRegex,
22
22
  readWorkspaceInventory,
23
23
  resolveEditorPluginSlotAlias
24
- } from "./cli-bbj0kn1e.js";
24
+ } from "./cli-regw5384.js";
25
+ import"./cli-cvxvcw7c.js";
25
26
  import"./cli-t73q5aqz.js";
26
27
  import"./cli-fys8vm2t.js";
27
28
  import {
@@ -1114,4 +1115,4 @@ export {
1114
1115
  getDoctorChecks
1115
1116
  };
1116
1117
 
1117
- //# debugId=3C7A7D362A24E1A964756E2164756E21
1118
+ //# debugId=C5B6D0A40DB5B07664756E2164756E21
@@ -13,7 +13,8 @@ import {
13
13
  snapshotWorkspaceFiles,
14
14
  toPascalCase,
15
15
  updateWorkspaceInventorySource
16
- } from "./cli-bbj0kn1e.js";
16
+ } from "./cli-regw5384.js";
17
+ import"./cli-cvxvcw7c.js";
17
18
  import"./cli-fys8vm2t.js";
18
19
  import {
19
20
  CLI_DIAGNOSTIC_CODES,
@@ -862,4 +863,4 @@ export {
862
863
  applyInitPlan
863
864
  };
864
865
 
865
- //# debugId=4F60C8DD81E9727764756E2164756E21
866
+ //# debugId=0E2AA29C775DCB7E64756E2164756E21