wp-typia 0.24.0 → 0.24.2

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.
@@ -4,7 +4,10 @@ import {
4
4
  } from "./cli-8hxf9qw6.js";
5
5
  import {
6
6
  getOptionalNodeErrorCode
7
- } from "./cli-v0nnagb3.js";
7
+ } from "./cli-kbqztfkt.js";
8
+ import {
9
+ safeJsonParse
10
+ } from "./cli-ccax7s0s.js";
8
11
 
9
12
  // ../wp-typia-project-tools/src/runtime/package-versions.ts
10
13
  import fs from "fs";
@@ -88,11 +91,10 @@ function readPackageManifest(location) {
88
91
  if (!location.packageJsonPath || location.source === null) {
89
92
  return null;
90
93
  }
91
- try {
92
- return JSON.parse(location.source);
93
- } catch (error) {
94
- throw new Error(`Failed to parse package version manifest at ${location.packageJsonPath}: ${error instanceof Error ? error.message : String(error)}`);
95
- }
94
+ return safeJsonParse(location.source, {
95
+ context: "package version manifest",
96
+ filePath: location.packageJsonPath
97
+ });
96
98
  }
97
99
  function tryReadPackageManifest(location) {
98
100
  if (!location) {
@@ -193,4 +195,4 @@ function getPackageVersions() {
193
195
 
194
196
  export { DEFAULT_WORDPRESS_ABILITIES_VERSION, DEFAULT_WORDPRESS_CORE_ABILITIES_VERSION, DEFAULT_WORDPRESS_CORE_DATA_VERSION, DEFAULT_WORDPRESS_DATA_VERSION, DEFAULT_WORDPRESS_DATAVIEWS_VERSION, DEFAULT_WORDPRESS_ENV_VERSION, DEFAULT_WP_TYPIA_DATAVIEWS_VERSION, resolveManagedPackageVersionRange, getPackageVersions };
195
197
 
196
- //# debugId=5C44FE33F29175BD64756E2164756E21
198
+ //# debugId=8B55C11F64E194C164756E2164756E21
package/dist-bunli/cli.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  package_default,
23
23
  validateCliOutputFormatArgv,
24
24
  writeStructuredCliDiagnosticError
25
- } from "./cli-cwjdzq6n.js";
25
+ } from "./cli-6mr6vja7.js";
26
26
  import"./cli-03j0axbt.js";
27
27
  import {
28
28
  GLOBAL_FLAGS,
@@ -2460,7 +2460,7 @@ async function formatCliError(error) {
2460
2460
  }
2461
2461
  async function createWpTypiaCli(options = {}) {
2462
2462
  applyStandaloneSupportLayoutEnv();
2463
- const { wpTypiaCommands } = await import("./command-list-xaw5agks.js");
2463
+ const { wpTypiaCommands } = await import("./command-list-rqt03qqy.js");
2464
2464
  const cli = await createCLI({
2465
2465
  ...bunliConfig,
2466
2466
  description: package_default.description,
@@ -19,7 +19,7 @@ import {
19
19
  package_default,
20
20
  prefersStructuredCliOutput,
21
21
  resolveCommandOptionValues
22
- } from "./cli-cwjdzq6n.js";
22
+ } from "./cli-6mr6vja7.js";
23
23
  import {
24
24
  Result,
25
25
  TaggedError,
@@ -115,6 +115,13 @@ var NAME_ONLY_VISIBLE_FIELDS = [
115
115
  "kind",
116
116
  "name"
117
117
  ];
118
+ var PATTERN_CATALOG_VISIBLE_FIELDS = [
119
+ "kind",
120
+ "name",
121
+ "scope",
122
+ "section-role",
123
+ "catalog-title"
124
+ ];
118
125
  var NAME_SOURCE_VISIBLE_FIELDS = [
119
126
  "kind",
120
127
  "name",
@@ -583,6 +590,15 @@ var contractAddKindEntry = defineAddKindRegistryEntry({
583
590
  // src/add-kinds/core-variation.ts
584
591
  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>.";
585
592
  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>.";
593
+ var CORE_VARIATION_BLOCK_NAME_PATTERN = /^[^/\s]+\/[^/\s]+$/u;
594
+ function formatCoreVariationMissingPositionalNameMessage(blockName) {
595
+ return [
596
+ `\`wp-typia add core-variation ${blockName}\` is missing <name>.`,
597
+ "Usage: wp-typia add core-variation <block-name> <name>",
598
+ "Alternative: wp-typia add core-variation <name> --block <namespace/block>"
599
+ ].join(`
600
+ `);
601
+ }
586
602
  function resolveCoreVariationInputs(context) {
587
603
  const positionalTargetBlockName = context.positionalArgs?.[1];
588
604
  const positionalVariationName = context.positionalArgs?.[2];
@@ -595,16 +611,17 @@ function resolveCoreVariationInputs(context) {
595
611
  variationName: positionalVariationName
596
612
  };
597
613
  }
598
- if (context.name?.includes("/") && !readOptionalStrictStringFlag(context.flags, "block")) {
599
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, CORE_VARIATION_MISSING_NAME_MESSAGE);
614
+ const targetBlockFlag = readOptionalStrictStringFlag(context.flags, "block");
615
+ const missingPositionalNameTarget = context.name !== undefined && positionalTargetBlockName === context.name && CORE_VARIATION_BLOCK_NAME_PATTERN.test(context.name) ? context.name : undefined;
616
+ if (missingPositionalNameTarget && !targetBlockFlag) {
617
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, formatCoreVariationMissingPositionalNameMessage(missingPositionalNameTarget));
600
618
  }
601
619
  const variationName = requireAddKindName(context, CORE_VARIATION_MISSING_NAME_MESSAGE);
602
- const targetBlockName = readOptionalStrictStringFlag(context.flags, "block");
603
- if (!targetBlockName) {
620
+ if (!targetBlockFlag) {
604
621
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, CORE_VARIATION_MISSING_BLOCK_MESSAGE);
605
622
  }
606
623
  return {
607
- targetBlockName,
624
+ targetBlockName: targetBlockFlag,
608
625
  variationName
609
626
  };
610
627
  }
@@ -636,6 +653,7 @@ var coreVariationAddKindEntry = defineAddKindRegistryEntry({
636
653
  variationFile: result.variationFile,
637
654
  variationSlug: result.variationSlug
638
655
  }),
656
+ getWarnings: (result) => result.warnings,
639
657
  missingNameMessage: CORE_VARIATION_MISSING_NAME_MESSAGE,
640
658
  name: variationName,
641
659
  warnLine: context.warnLine
@@ -782,7 +800,8 @@ var integrationEnvAddKindEntry = defineAddKindRegistryEntry({
782
800
  supportsDryRun: true,
783
801
  usage: "wp-typia add integration-env <name> [--wp-env] [--release-zip] [--service <none|docker-compose>] [--dry-run]",
784
802
  visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS,
785
- hiddenBooleanSubmitFields: ["wp-env", "release-zip"]
803
+ hiddenBooleanSubmitFields: ["wp-env", "release-zip"],
804
+ hiddenStringSubmitFields: ["service"]
786
805
  });
787
806
 
788
807
  // src/add-kinds/pattern.ts
@@ -801,21 +820,18 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
801
820
  title: "Added workspace pattern"
802
821
  },
803
822
  description: "Add a PHP block pattern shell",
804
- hiddenStringSubmitFields: [
805
- "scope",
806
- "section-role",
807
- "tags",
808
- "thumbnail-url"
809
- ],
823
+ hiddenStringSubmitFields: ["tag", "tags", "thumbnail-url"],
810
824
  nameLabel: "Pattern name",
811
825
  async prepareExecution(context) {
812
826
  const name = requireAddKindName(context, PATTERN_MISSING_NAME_MESSAGE);
813
- const scope = typeof context.flags.scope === "string" ? context.flags.scope : undefined;
814
- const sectionRole = typeof context.flags["section-role"] === "string" ? context.flags["section-role"] : undefined;
815
- const tags = typeof context.flags.tags === "string" ? context.flags.tags : undefined;
827
+ const scope = resolvePatternScopeFlag(context);
828
+ const sectionRole = resolvePatternSectionRoleFlag(context, scope);
829
+ const catalogTitle = typeof context.flags["catalog-title"] === "string" ? context.flags["catalog-title"] : undefined;
830
+ const tags = normalizePatternTagFlags(context.flags.tags, context.flags.tag);
816
831
  const thumbnailUrl = typeof context.flags["thumbnail-url"] === "string" ? context.flags["thumbnail-url"] : undefined;
817
832
  return {
818
833
  execute: (cwd) => context.addRuntime.runAddPatternCommand({
834
+ catalogTitle,
819
835
  cwd,
820
836
  patternScope: scope,
821
837
  patternName: name,
@@ -834,9 +850,58 @@ var patternAddKindEntry = defineAddKindRegistryEntry({
834
850
  },
835
851
  sortOrder: 60,
836
852
  supportsDryRun: true,
837
- usage: "wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--tags <tag,...>] [--thumbnail-url <url>] [--dry-run]",
838
- visibleFieldNames: () => NAME_ONLY_VISIBLE_FIELDS
853
+ usage: "wp-typia add pattern <name> [--scope <full|section>] [--section-role <role>] [--catalog-title <title>] [--tags <tag,...>] [--tag <tag>...] [--thumbnail-url <url>] [--dry-run]",
854
+ visibleFieldNames: () => PATTERN_CATALOG_VISIBLE_FIELDS
839
855
  });
856
+ function createInvalidPatternArgumentError(message) {
857
+ return createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT, message);
858
+ }
859
+ function createMissingPatternArgumentError(message) {
860
+ return createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
861
+ }
862
+ function resolvePatternScopeFlag(context) {
863
+ const scope = readOptionalLooseStringFlag(context.flags, "scope");
864
+ if (!scope) {
865
+ return;
866
+ }
867
+ if (context.addRuntime.PATTERN_CATALOG_SCOPE_IDS.includes(scope)) {
868
+ return scope;
869
+ }
870
+ throw createInvalidPatternArgumentError(`\`--scope\` must be one of: ${context.addRuntime.PATTERN_CATALOG_SCOPE_IDS.join(", ")}. Usage: wp-typia add pattern <name> --scope <full|section>.`);
871
+ }
872
+ function resolvePatternSectionRoleFlag(context, scope) {
873
+ const sectionRole = readOptionalLooseStringFlag(context.flags, "section-role");
874
+ if (scope === "section" && sectionRole === undefined) {
875
+ throw createMissingPatternArgumentError("`wp-typia add pattern --scope section` requires --section-role <role> because section-scoped patterns need a typed catalog section role.");
876
+ }
877
+ if (scope !== "section" && sectionRole !== undefined) {
878
+ throw createInvalidPatternArgumentError("`--section-role` only applies with `--scope section`. Use `--scope section --section-role <role>` or omit `--section-role` for full patterns.");
879
+ }
880
+ const normalizedSectionRole = sectionRole === undefined ? undefined : context.addRuntime.normalizeBlockSlug(sectionRole);
881
+ if (normalizedSectionRole && !context.addRuntime.PATTERN_SECTION_ROLE_PATTERN.test(normalizedSectionRole)) {
882
+ 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`.");
883
+ }
884
+ if (sectionRole !== undefined && !normalizedSectionRole) {
885
+ 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`.");
886
+ }
887
+ return normalizedSectionRole;
888
+ }
889
+ function collectStringFlagValues(value) {
890
+ if (typeof value === "string") {
891
+ return [value];
892
+ }
893
+ if (Array.isArray(value)) {
894
+ return value.filter((item) => typeof item === "string");
895
+ }
896
+ return [];
897
+ }
898
+ function normalizePatternTagFlags(tagsFlag, tagFlag) {
899
+ const tags = [
900
+ ...collectStringFlagValues(tagsFlag),
901
+ ...collectStringFlagValues(tagFlag)
902
+ ];
903
+ return tags.length > 0 ? tags : undefined;
904
+ }
840
905
 
841
906
  // src/add-kinds/post-meta.ts
842
907
  var POST_META_MISSING_NAME_MESSAGE = "`wp-typia add post-meta` requires <name>. Usage: wp-typia add post-meta <name> --post-type <post-type> [--type <ExportedTypeName>] [--meta-key <meta-key>].";
@@ -1791,7 +1856,7 @@ function pushFlag(argv, name, value) {
1791
1856
  }
1792
1857
 
1793
1858
  // src/runtime-bridge-add.ts
1794
- var loadCliAddRuntime = () => import("./cli-add-nmdraf20.js");
1859
+ var loadCliAddRuntime = () => import("./cli-add-r4c15g7g.js");
1795
1860
  var loadCliPromptRuntime = () => import("./cli-prompt-ncyg68rn.js");
1796
1861
  async function executeWorkspaceAddWithOptionalDryRun(options) {
1797
1862
  const simulated = options.dryRun ? await simulateWorkspaceAddDryRun({
@@ -1901,7 +1966,7 @@ async function executeAddCommand({
1901
1966
  }
1902
1967
  // src/runtime-bridge-create.ts
1903
1968
  var loadCliPromptRuntime2 = () => import("./cli-prompt-ncyg68rn.js");
1904
- var loadCliScaffoldRuntime = () => import("./cli-scaffold-an2k0fnm.js");
1969
+ var loadCliScaffoldRuntime = () => import("./cli-scaffold-b49zc1rw.js");
1905
1970
  var loadCliTemplatesRuntime = () => import("./cli-templates-g8t4fm11.js");
1906
1971
  var loadCreateTemplateValidationRuntime = () => import("./create-template-validation-4fr851vg.js");
1907
1972
  var PACKAGE_MANAGER_PROMPT_OPTIONS = [
@@ -2022,7 +2087,7 @@ async function executeCreateCommand({
2022
2087
  }
2023
2088
  }
2024
2089
  // src/runtime-bridge-doctor.ts
2025
- var loadCliDoctorRuntime = () => import("./cli-doctor-pcss6ecx.js");
2090
+ var loadCliDoctorRuntime = () => import("./cli-doctor-fd6mfx0f.js");
2026
2091
  async function executeDoctorCommand(cwd, options = {}) {
2027
2092
  try {
2028
2093
  const { runDoctor } = await loadCliDoctorRuntime();
@@ -2033,7 +2098,7 @@ async function executeDoctorCommand(cwd, options = {}) {
2033
2098
  }
2034
2099
  // src/runtime-bridge-init.ts
2035
2100
  import path2 from "path";
2036
- var loadCliInitRuntime = () => import("./cli-init-he7vm7kc.js");
2101
+ var loadCliInitRuntime = () => import("./cli-init-kmredfj7.js");
2037
2102
  async function executeInitCommand({ apply, cwd, packageManager, projectDir }, options = {}) {
2038
2103
  try {
2039
2104
  const { runInitCommand } = await loadCliInitRuntime();
@@ -2059,7 +2124,7 @@ async function executeInitCommand({ apply, cwd, packageManager, projectDir }, op
2059
2124
  }
2060
2125
  }
2061
2126
  // src/runtime-bridge-migrate.ts
2062
- var loadMigrationsRuntime = () => import("./migrations-z7f4kxba.js");
2127
+ var loadMigrationsRuntime = () => import("./migrations-zhd03hvy.js");
2063
2128
  var defaultPrintLine2 = (line) => {
2064
2129
  process.stdout.write(`${line}
2065
2130
  `);
@@ -2955,7 +3020,7 @@ var doctorCommand = defineCommand({
2955
3020
  createDoctorRunSummary,
2956
3021
  getDoctorChecks,
2957
3022
  getDoctorExitFailureDetailLines
2958
- } = await import("./cli-doctor-pcss6ecx.js");
3023
+ } = await import("./cli-doctor-fd6mfx0f.js");
2959
3024
  const checks = await getDoctorChecks(args.cwd);
2960
3025
  const summary = createDoctorRunSummary(checks, {
2961
3026
  exitPolicy: doctorExitPolicy
@@ -3850,4 +3915,4 @@ export {
3850
3915
  wpTypiaCommands
3851
3916
  };
3852
3917
 
3853
- //# debugId=57FDA4D19922070564756E2164756E21
3918
+ //# debugId=30271EF71AB322F564756E2164756E21
@@ -15,9 +15,9 @@ import {
15
15
  snapshotProjectVersion,
16
16
  verifyProjectMigrations,
17
17
  wizardProjectMigrations
18
- } from "./cli-0v407aag.js";
18
+ } from "./cli-6ys6d16y.js";
19
19
  import"./cli-e4bwd81c.js";
20
- import"./cli-v0nnagb3.js";
20
+ import"./cli-kbqztfkt.js";
21
21
  import"./cli-cvxvcw7c.js";
22
22
  import"./cli-bajwv85z.js";
23
23
  import"./cli-tq730sqt.js";