wp-typia 0.22.7 → 0.22.8

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.
@@ -1,4 +1,8 @@
1
1
  // @bun
2
+ import {
3
+ CLI_DIAGNOSTIC_CODES,
4
+ createCliDiagnosticCodeError
5
+ } from "./cli-p95wr1q8.js";
2
6
  import {
3
7
  WORKSPACE_TEMPLATE_PACKAGE
4
8
  } from "./cli-hhp1d348.js";
@@ -170952,7 +170956,9 @@ var COMMON_ACRONYM_PREFIXES = [
170952
170956
  "JSON",
170953
170957
  "REST",
170954
170958
  "UUID",
170959
+ "AJAX",
170955
170960
  "API",
170961
+ "CPT",
170956
170962
  "CSS",
170957
170963
  "CTA",
170958
170964
  "DOM",
@@ -170966,12 +170972,16 @@ var COMMON_ACRONYM_PREFIXES = [
170966
170972
  "UI",
170967
170973
  "WP"
170968
170974
  ];
170975
+ var COMMON_ACRONYM_LOWERCASE_SUFFIXES = ["slug"];
170969
170976
  function capitalizeSegment(segment) {
170970
170977
  return segment.charAt(0).toUpperCase() + segment.slice(1);
170971
170978
  }
170972
170979
  function findCommonAcronymPrefix(segment) {
170973
170980
  return COMMON_ACRONYM_PREFIXES.find((prefix) => segment.startsWith(prefix));
170974
170981
  }
170982
+ function isCommonAcronymLowercaseSuffix(suffix) {
170983
+ return COMMON_ACRONYM_LOWERCASE_SUFFIXES.includes(suffix);
170984
+ }
170975
170985
  function splitKnownAcronymSegment(segment) {
170976
170986
  const prefixes = [];
170977
170987
  let remaining = segment;
@@ -170984,6 +170994,9 @@ function splitKnownAcronymSegment(segment) {
170984
170994
  if (/^[A-Z][a-z]/.test(suffix)) {
170985
170995
  return [...prefixes, prefix, suffix].join("-");
170986
170996
  }
170997
+ if (/^[a-z]+$/.test(suffix) && isCommonAcronymLowercaseSuffix(suffix)) {
170998
+ return [...prefixes, prefix, suffix].join("-");
170999
+ }
170987
171000
  if (!findCommonAcronymPrefix(suffix)) {
170988
171001
  break;
170989
171002
  }
@@ -171145,7 +171158,7 @@ function validatePhpPrefix(input) {
171145
171158
  function assertValidIdentifier(label, value, validate) {
171146
171159
  const result = validate(value);
171147
171160
  if (result !== true) {
171148
- throw new Error(typeof result === "string" ? `${label}: ${result}` : `${label} is invalid`);
171161
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, typeof result === "string" ? `${label}: ${result}` : `${label} is invalid`);
171149
171162
  }
171150
171163
  return value;
171151
171164
  }
@@ -171158,9 +171171,9 @@ function resolveNonEmptyNormalizedBlockSlug(options) {
171158
171171
  return normalizedSlug;
171159
171172
  }
171160
171173
  if (options.input.trim().length === 0) {
171161
- throw new Error(`${options.label} is required. Use \`${options.usage}\`.`);
171174
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `${options.label} is required. Use \`${options.usage}\`.`);
171162
171175
  }
171163
- throw new Error(`${options.label} "${options.input.trim()}" normalizes to an empty slug. Use letters or numbers so wp-typia can generate a block slug.`);
171176
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, `${options.label} "${options.input.trim()}" normalizes to an empty slug. Use letters or numbers so wp-typia can generate a block slug.`);
171164
171177
  }
171165
171178
  function resolveValidatedBlockSlug(value) {
171166
171179
  return assertValidIdentifier("Block slug", normalizeBlockSlug(value), validateBlockSlug);
@@ -171576,8 +171589,8 @@ function assertEditorPluginDoesNotExist(projectDir, editorPluginSlug, inventory)
171576
171589
  });
171577
171590
  }
171578
171591
  // ../wp-typia-project-tools/src/runtime/workspace-inventory.ts
171579
- var import_typescript = __toESM(require_typescript(), 1);
171580
- import fs2 from "fs";
171592
+ var import_typescript2 = __toESM(require_typescript(), 1);
171593
+ import { readFileSync } from "fs";
171581
171594
  import path4 from "path";
171582
171595
  import { readFile, writeFile } from "fs/promises";
171583
171596
 
@@ -171726,6 +171739,9 @@ function matchesPhpFunctionCallAt(source, index, functionName) {
171726
171739
  function createPhpScannerState() {
171727
171740
  return {
171728
171741
  heredocDelimiter: "",
171742
+ interpolationComment: "",
171743
+ interpolationDepth: 0,
171744
+ interpolationQuote: "",
171729
171745
  mode: "code"
171730
171746
  };
171731
171747
  }
@@ -171749,11 +171765,73 @@ function advancePhpScanner(source, index, state) {
171749
171765
  if (character === "\\") {
171750
171766
  return { ambiguous: false, inCode: false, index: index + 2 };
171751
171767
  }
171768
+ if (state.mode === "double-quoted" && character === "{" && source[index + 1] === "$") {
171769
+ state.mode = "double-quoted-interpolation";
171770
+ state.interpolationComment = "";
171771
+ state.interpolationDepth = 1;
171772
+ state.interpolationQuote = "";
171773
+ return { ambiguous: false, inCode: false, index: index + 2 };
171774
+ }
171752
171775
  if (character === quote) {
171753
171776
  state.mode = "code";
171754
171777
  }
171755
171778
  return { ambiguous: false, inCode: false, index: index + 1 };
171756
171779
  }
171780
+ if (state.mode === "double-quoted-interpolation") {
171781
+ if (state.interpolationQuote) {
171782
+ if (character === "\\") {
171783
+ return { ambiguous: false, inCode: false, index: index + 2 };
171784
+ }
171785
+ if (character === state.interpolationQuote) {
171786
+ state.interpolationQuote = "";
171787
+ }
171788
+ return { ambiguous: false, inCode: false, index: index + 1 };
171789
+ }
171790
+ if (state.interpolationComment === "line") {
171791
+ if (character === "\r" || character === `
171792
+ `) {
171793
+ state.interpolationComment = "";
171794
+ }
171795
+ return { ambiguous: false, inCode: false, index: index + 1 };
171796
+ }
171797
+ if (state.interpolationComment === "block") {
171798
+ if (character === "*" && source[index + 1] === "/") {
171799
+ state.interpolationComment = "";
171800
+ return { ambiguous: false, inCode: false, index: index + 2 };
171801
+ }
171802
+ return { ambiguous: false, inCode: false, index: index + 1 };
171803
+ }
171804
+ if (character === "/" && source[index + 1] === "/") {
171805
+ state.interpolationComment = "line";
171806
+ return { ambiguous: false, inCode: false, index: index + 2 };
171807
+ }
171808
+ if (character === "#" && source[index + 1] !== "[") {
171809
+ state.interpolationComment = "line";
171810
+ return { ambiguous: false, inCode: false, index: index + 1 };
171811
+ }
171812
+ if (character === "/" && source[index + 1] === "*") {
171813
+ state.interpolationComment = "block";
171814
+ return { ambiguous: false, inCode: false, index: index + 2 };
171815
+ }
171816
+ if (character === "'" || character === '"') {
171817
+ state.interpolationQuote = character;
171818
+ return { ambiguous: false, inCode: false, index: index + 1 };
171819
+ }
171820
+ if (character === "{") {
171821
+ state.interpolationDepth += 1;
171822
+ return { ambiguous: false, inCode: false, index: index + 1 };
171823
+ }
171824
+ if (character === "}") {
171825
+ state.interpolationDepth -= 1;
171826
+ if (state.interpolationDepth <= 0) {
171827
+ state.interpolationComment = "";
171828
+ state.interpolationDepth = 0;
171829
+ state.mode = "double-quoted";
171830
+ }
171831
+ return { ambiguous: false, inCode: false, index: index + 1 };
171832
+ }
171833
+ return { ambiguous: false, inCode: false, index: index + 1 };
171834
+ }
171757
171835
  if (state.mode === "line-comment") {
171758
171836
  if (character === "\r" || character === `
171759
171837
  `) {
@@ -171885,6 +171963,15 @@ function replacePhpFunctionDefinition(source, functionName, replacement, options
171885
171963
  ].join("");
171886
171964
  }
171887
171965
 
171966
+ // ../wp-typia-project-tools/src/runtime/ts-property-names.ts
171967
+ var import_typescript = __toESM(require_typescript(), 1);
171968
+ function getPropertyNameText(name) {
171969
+ if (import_typescript.default.isIdentifier(name) || import_typescript.default.isStringLiteral(name) || import_typescript.default.isNumericLiteral(name)) {
171970
+ return name.text;
171971
+ }
171972
+ return null;
171973
+ }
171974
+
171888
171975
  // ../wp-typia-project-tools/src/runtime/workspace-inventory.ts
171889
171976
  function defineInventoryEntryParser(descriptor) {
171890
171977
  return descriptor;
@@ -172403,25 +172490,19 @@ var INVENTORY_SECTIONS = [
172403
172490
  }
172404
172491
  }
172405
172492
  ];
172406
- function getPropertyNameText(name) {
172407
- if (import_typescript.default.isIdentifier(name) || import_typescript.default.isStringLiteral(name)) {
172408
- return name.text;
172409
- }
172410
- return null;
172411
- }
172412
172493
  function findExportedArrayLiteral(sourceFile, exportName) {
172413
172494
  for (const statement of sourceFile.statements) {
172414
- if (!import_typescript.default.isVariableStatement(statement)) {
172495
+ if (!import_typescript2.default.isVariableStatement(statement)) {
172415
172496
  continue;
172416
172497
  }
172417
- if (!statement.modifiers?.some((modifier) => modifier.kind === import_typescript.default.SyntaxKind.ExportKeyword)) {
172498
+ if (!statement.modifiers?.some((modifier) => modifier.kind === import_typescript2.default.SyntaxKind.ExportKeyword)) {
172418
172499
  continue;
172419
172500
  }
172420
172501
  for (const declaration of statement.declarationList.declarations) {
172421
- if (!import_typescript.default.isIdentifier(declaration.name) || declaration.name.text !== exportName) {
172502
+ if (!import_typescript2.default.isIdentifier(declaration.name) || declaration.name.text !== exportName) {
172422
172503
  continue;
172423
172504
  }
172424
- if (declaration.initializer && import_typescript.default.isArrayLiteralExpression(declaration.initializer)) {
172505
+ if (declaration.initializer && import_typescript2.default.isArrayLiteralExpression(declaration.initializer)) {
172425
172506
  return {
172426
172507
  array: declaration.initializer,
172427
172508
  found: true
@@ -172440,14 +172521,14 @@ function findExportedArrayLiteral(sourceFile, exportName) {
172440
172521
  }
172441
172522
  function getOptionalStringProperty(entryName, elementIndex, objectLiteral, key) {
172442
172523
  for (const property of objectLiteral.properties) {
172443
- if (!import_typescript.default.isPropertyAssignment(property)) {
172524
+ if (!import_typescript2.default.isPropertyAssignment(property)) {
172444
172525
  continue;
172445
172526
  }
172446
172527
  const propertyName = getPropertyNameText(property.name);
172447
172528
  if (propertyName !== key) {
172448
172529
  continue;
172449
172530
  }
172450
- if (import_typescript.default.isStringLiteralLike(property.initializer)) {
172531
+ if (import_typescript2.default.isStringLiteralLike(property.initializer)) {
172451
172532
  return property.initializer.text;
172452
172533
  }
172453
172534
  throw new Error(`${entryName}[${elementIndex}] must use a string literal for "${key}" in scripts/block-config.ts.`);
@@ -172463,18 +172544,18 @@ function getRequiredStringProperty(entryName, elementIndex, objectLiteral, key)
172463
172544
  }
172464
172545
  function getRequiredStringArrayProperty(entryName, elementIndex, objectLiteral, key) {
172465
172546
  for (const property of objectLiteral.properties) {
172466
- if (!import_typescript.default.isPropertyAssignment(property)) {
172547
+ if (!import_typescript2.default.isPropertyAssignment(property)) {
172467
172548
  continue;
172468
172549
  }
172469
172550
  const propertyName = getPropertyNameText(property.name);
172470
172551
  if (propertyName !== key) {
172471
172552
  continue;
172472
172553
  }
172473
- if (!import_typescript.default.isArrayLiteralExpression(property.initializer)) {
172554
+ if (!import_typescript2.default.isArrayLiteralExpression(property.initializer)) {
172474
172555
  throw new Error(`${entryName}[${elementIndex}] must use an array literal for "${key}" in scripts/block-config.ts.`);
172475
172556
  }
172476
172557
  return property.initializer.elements.map((element, itemIndex) => {
172477
- if (!import_typescript.default.isStringLiteralLike(element)) {
172558
+ if (!import_typescript2.default.isStringLiteralLike(element)) {
172478
172559
  throw new Error(`${entryName}[${elementIndex}].${key}[${itemIndex}] must use a string literal in scripts/block-config.ts.`);
172479
172560
  }
172480
172561
  return element.text;
@@ -172484,7 +172565,7 @@ function getRequiredStringArrayProperty(entryName, elementIndex, objectLiteral,
172484
172565
  }
172485
172566
  function parseInventoryEntries(arrayLiteral, descriptor) {
172486
172567
  return arrayLiteral.elements.map((element, elementIndex) => {
172487
- if (!import_typescript.default.isObjectLiteralExpression(element)) {
172568
+ if (!import_typescript2.default.isObjectLiteralExpression(element)) {
172488
172569
  throw new Error(`${descriptor.entryName}[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
172489
172570
  }
172490
172571
  const entry = {};
@@ -172534,7 +172615,7 @@ function parseInventorySection(sourceFile, descriptor) {
172534
172615
  };
172535
172616
  }
172536
172617
  function parseWorkspaceInventorySource(source) {
172537
- const sourceFile = import_typescript.default.createSourceFile("block-config.ts", source, import_typescript.default.ScriptTarget.Latest, true, import_typescript.default.ScriptKind.TS);
172618
+ const sourceFile = import_typescript2.default.createSourceFile("block-config.ts", source, import_typescript2.default.ScriptTarget.Latest, true, import_typescript2.default.ScriptKind.TS);
172538
172619
  const parsedInventory = {
172539
172620
  abilities: [],
172540
172621
  adminViews: [],
@@ -172576,7 +172657,23 @@ function readWorkspaceInventory(projectDir) {
172576
172657
  const blockConfigPath = path4.join(projectDir, "scripts", "block-config.ts");
172577
172658
  let source;
172578
172659
  try {
172579
- source = fs2.readFileSync(blockConfigPath, "utf8");
172660
+ source = readFileSync(blockConfigPath, "utf8");
172661
+ } catch (error) {
172662
+ if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
172663
+ throw new Error(`Workspace inventory file is missing at ${blockConfigPath}. Expected scripts/block-config.ts to exist.`);
172664
+ }
172665
+ throw error;
172666
+ }
172667
+ return {
172668
+ blockConfigPath,
172669
+ ...parseWorkspaceInventorySource(source)
172670
+ };
172671
+ }
172672
+ async function readWorkspaceInventoryAsync(projectDir) {
172673
+ const blockConfigPath = path4.join(projectDir, "scripts", "block-config.ts");
172674
+ let source;
172675
+ try {
172676
+ source = await readFile(blockConfigPath, "utf8");
172580
172677
  } catch (error) {
172581
172678
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
172582
172679
  throw new Error(`Workspace inventory file is missing at ${blockConfigPath}. Expected scripts/block-config.ts to exist.`);
@@ -172705,6 +172802,6 @@ async function appendWorkspaceInventoryEntries(projectDir, options) {
172705
172802
  }
172706
172803
  }
172707
172804
 
172708
- export { toKebabCase, toSnakeCase, toPascalCase, toCamelCase, toSegmentPascalCase, toTitleCase, validateBlockSlug, validateNamespace, normalizeBlockSlug, resolveNonEmptyNormalizedBlockSlug, buildBlockCssClassName, buildFrontendCssClassName, resolveScaffoldIdentifiers, REST_RESOURCE_METHOD_IDS, EDITOR_PLUGIN_SLOT_IDS, resolveEditorPluginSlotAlias, ADD_BLOCK_TEMPLATE_IDS, HOOKED_BLOCK_POSITION_SET, HOOKED_BLOCK_ANCHOR_PATTERN, REST_RESOURCE_NAMESPACE_PATTERN, assertValidGeneratedSlug, resolveRestResourceNamespace, assertValidRestResourceMethods, assertValidHookedBlockPosition, buildWorkspacePhpPrefix, isAddBlockTemplateId, quoteTsString, assertValidHookAnchor, assertValidEditorPluginSlot, getWorkspaceBootstrapPath, patchFile, readOptionalFile, snapshotWorkspaceFiles, rollbackWorkspaceMutation, pathExists, readOptionalUtf8File, resolveWorkspaceBlock, readWorkspaceBlockJson, getMutableBlockHooks, assertVariationDoesNotExist, assertBlockStyleDoesNotExist, assertBlockTransformDoesNotExist, assertPatternDoesNotExist, assertBindingSourceDoesNotExist, assertRestResourceDoesNotExist, assertAdminViewDoesNotExist, assertAbilityDoesNotExist, assertAiFeatureDoesNotExist, assertEditorPluginDoesNotExist, formatAddHelpText, require_typescript, escapeRegex, quotePhpString, hasPhpFunctionDefinition, hasPhpFunctionCall, findPhpFunctionRange, replacePhpFunctionDefinition, readWorkspaceInventory, getWorkspaceBlockSelectOptions, updateWorkspaceInventorySource, appendWorkspaceInventoryEntries };
172805
+ export { toKebabCase, toSnakeCase, toPascalCase, toCamelCase, toSegmentPascalCase, toTitleCase, validateBlockSlug, validateNamespace, normalizeBlockSlug, resolveNonEmptyNormalizedBlockSlug, buildBlockCssClassName, buildFrontendCssClassName, resolveScaffoldIdentifiers, REST_RESOURCE_METHOD_IDS, EDITOR_PLUGIN_SLOT_IDS, resolveEditorPluginSlotAlias, ADD_BLOCK_TEMPLATE_IDS, HOOKED_BLOCK_POSITION_SET, HOOKED_BLOCK_ANCHOR_PATTERN, REST_RESOURCE_NAMESPACE_PATTERN, assertValidGeneratedSlug, resolveRestResourceNamespace, assertValidRestResourceMethods, assertValidHookedBlockPosition, buildWorkspacePhpPrefix, isAddBlockTemplateId, quoteTsString, assertValidHookAnchor, assertValidEditorPluginSlot, getWorkspaceBootstrapPath, patchFile, readOptionalFile, snapshotWorkspaceFiles, rollbackWorkspaceMutation, pathExists, readOptionalUtf8File, getNodeErrorCode, resolveWorkspaceBlock, readWorkspaceBlockJson, getMutableBlockHooks, assertVariationDoesNotExist, assertBlockStyleDoesNotExist, assertBlockTransformDoesNotExist, assertPatternDoesNotExist, assertBindingSourceDoesNotExist, assertRestResourceDoesNotExist, assertAdminViewDoesNotExist, assertAbilityDoesNotExist, assertAiFeatureDoesNotExist, assertEditorPluginDoesNotExist, formatAddHelpText, require_typescript, escapeRegex, quotePhpString, hasPhpFunctionDefinition, hasPhpFunctionCall, findPhpFunctionRange, replacePhpFunctionDefinition, getPropertyNameText, readWorkspaceInventory, readWorkspaceInventoryAsync, getWorkspaceBlockSelectOptions, updateWorkspaceInventorySource, appendWorkspaceInventoryEntries };
172709
172806
 
172710
- //# debugId=6D5B4520C8A1BC7E64756E2164756E21
172807
+ //# debugId=282F6AFDCE13C26664756E2164756E21
@@ -51,7 +51,7 @@ import {
51
51
  } from "./cli-bq2v559b.js";
52
52
  import {
53
53
  readWorkspaceInventory
54
- } from "./cli-ta3y0hp2.js";
54
+ } from "./cli-bbj0kn1e.js";
55
55
  import {
56
56
  getInvalidWorkspaceProjectReason,
57
57
  tryResolveWorkspaceProject
@@ -7,11 +7,11 @@ import {
7
7
  import {
8
8
  getBuiltInTemplateLayerDirs,
9
9
  isOmittableBuiltInTemplateLayerDir
10
- } from "./cli-10pe4mf8.js";
10
+ } from "./cli-pnjx2e2h.js";
11
11
  import {
12
12
  isBuiltInTemplateId,
13
13
  listTemplates
14
- } from "./cli-tke8twkn.js";
14
+ } from "./cli-qse6myha.js";
15
15
  import {
16
16
  EDITOR_PLUGIN_SLOT_IDS,
17
17
  HOOKED_BLOCK_ANCHOR_PATTERN,
@@ -21,7 +21,7 @@ import {
21
21
  escapeRegex,
22
22
  readWorkspaceInventory,
23
23
  resolveEditorPluginSlotAlias
24
- } from "./cli-ta3y0hp2.js";
24
+ } from "./cli-bbj0kn1e.js";
25
25
  import"./cli-t73q5aqz.js";
26
26
  import"./cli-fys8vm2t.js";
27
27
  import {
@@ -14,7 +14,7 @@ import {
14
14
  // package.json
15
15
  var package_default = {
16
16
  name: "wp-typia",
17
- version: "0.22.7",
17
+ version: "0.22.8",
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.7",
87
+ "@wp-typia/project-tools": "0.22.8",
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=8CED1A44380ADAE964756E2164756E21
1009
+ //# debugId=1B6B6622EAD33E5164756E2164756E21