wp-typia 0.22.1 → 0.22.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.
@@ -18,7 +18,7 @@ import {
18
18
  package_default,
19
19
  prefersStructuredCliOutput,
20
20
  resolveCommandOptionValues
21
- } from "./cli-0p8wz4a4.js";
21
+ } from "./cli-mpgt29xc.js";
22
22
  import {
23
23
  Result,
24
24
  TaggedError,
@@ -71,6 +71,62 @@ function resolveBundledModuleHref(baseUrl, candidates, options = {}) {
71
71
  `));
72
72
  }
73
73
 
74
+ // src/cli-string-flags.ts
75
+ function readOptionalCliStringFlagValue(flags, name, mode) {
76
+ const value = flags[name];
77
+ if (value === undefined || value === null) {
78
+ return;
79
+ }
80
+ if (typeof value !== "string") {
81
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
82
+ }
83
+ const trimmed = value.trim();
84
+ if (trimmed.length === 0) {
85
+ if (mode === "strict") {
86
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
87
+ }
88
+ return;
89
+ }
90
+ return mode === "strict" ? value : trimmed;
91
+ }
92
+ function readOptionalLooseStringFlag(flags, name) {
93
+ return readOptionalCliStringFlagValue(flags, name, "loose");
94
+ }
95
+ function readOptionalStrictStringFlag(flags, name) {
96
+ return readOptionalCliStringFlagValue(flags, name, "strict");
97
+ }
98
+ function requireStrictStringFlag(flags, name, message) {
99
+ const value = readOptionalStrictStringFlag(flags, name);
100
+ if (!value) {
101
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
102
+ }
103
+ return value;
104
+ }
105
+ function readOptionalPairedStrictStringFlags(flags, leftName, rightName, message) {
106
+ const leftValue = readOptionalStrictStringFlag(flags, leftName);
107
+ const rightValue = readOptionalStrictStringFlag(flags, rightName);
108
+ if (Boolean(leftValue) !== Boolean(rightValue)) {
109
+ throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
110
+ }
111
+ return [leftValue, rightValue];
112
+ }
113
+
114
+ // src/external-layer-prompt-options.ts
115
+ function formatExternalLayerSelectHint(option2) {
116
+ const details = [
117
+ option2.description,
118
+ option2.extends.length > 0 ? `extends ${option2.extends.join(", ")}` : undefined
119
+ ].filter((value) => typeof value === "string" && value.length > 0);
120
+ return details.length > 0 ? details.join(" \xB7 ") : undefined;
121
+ }
122
+ function toExternalLayerPromptOptions(options) {
123
+ return options.map((option2) => ({
124
+ hint: formatExternalLayerSelectHint(option2),
125
+ label: option2.id,
126
+ value: option2.id
127
+ }));
128
+ }
129
+
74
130
  // src/add-kind-registry.ts
75
131
  var BLOCK_VISIBLE_FIELD_ORDER = [
76
132
  "kind",
@@ -129,51 +185,12 @@ var NAME_NAMESPACE_VISIBLE_FIELDS = [
129
185
  "name",
130
186
  "namespace"
131
187
  ];
132
- function readOptionalStringFlag(flags, name) {
133
- const value = flags[name];
134
- if (value === undefined || value === null) {
135
- return;
136
- }
137
- if (typeof value !== "string" || value.trim().length === 0) {
138
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
139
- }
140
- return value;
141
- }
142
- function requireStringFlag(flags, name, message) {
143
- const value = readOptionalStringFlag(flags, name);
144
- if (!value) {
145
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
146
- }
147
- return value;
148
- }
149
- function readOptionalPairedStringFlags(flags, leftName, rightName, message) {
150
- const leftValue = readOptionalStringFlag(flags, leftName);
151
- const rightValue = readOptionalStringFlag(flags, rightName);
152
- if (Boolean(leftValue) !== Boolean(rightValue)) {
153
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
154
- }
155
- return [leftValue, rightValue];
156
- }
157
188
  function requireAddKindName(context, message) {
158
189
  if (!context.name) {
159
190
  throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, message);
160
191
  }
161
192
  return context.name;
162
193
  }
163
- function formatExternalLayerSelectHint(option2) {
164
- const details = [
165
- option2.description,
166
- option2.extends.length > 0 ? `extends ${option2.extends.join(", ")}` : undefined
167
- ].filter((value) => typeof value === "string" && value.length > 0);
168
- return details.length > 0 ? details.join(" \xB7 ") : undefined;
169
- }
170
- function toExternalLayerPromptOptions(options) {
171
- return options.map((option2) => ({
172
- hint: formatExternalLayerSelectHint(option2),
173
- label: option2.id,
174
- value: option2.id
175
- }));
176
- }
177
194
  function defineAddKindRegistryEntry(entry) {
178
195
  return entry;
179
196
  }
@@ -207,7 +224,7 @@ var ADD_KIND_REGISTRY = {
207
224
  nameLabel: "Admin view name",
208
225
  async prepareExecution(context) {
209
226
  const name = requireAddKindName(context, "`wp-typia add admin-view` requires <name>. Usage: wp-typia add admin-view <name> [--source <rest-resource:slug|core-data:kind/name>].");
210
- const source = readOptionalStringFlag(context.flags, "source");
227
+ const source = readOptionalStrictStringFlag(context.flags, "source");
211
228
  return createNamedExecutionPlan(context, {
212
229
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAdminViewCommand({
213
230
  adminViewName: name2,
@@ -247,7 +264,7 @@ var ADD_KIND_REGISTRY = {
247
264
  nameLabel: "Binding source name",
248
265
  async prepareExecution(context) {
249
266
  const name = requireAddKindName(context, "`wp-typia add binding-source` requires <name>. Usage: wp-typia add binding-source <name> [--block <block-slug|namespace/block-slug> --attribute <attribute>].");
250
- const [blockName, attributeName] = readOptionalPairedStringFlags(context.flags, "block", "attribute", "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
267
+ const [blockName, attributeName] = readOptionalPairedStrictStringFlags(context.flags, "block", "attribute", "`wp-typia add binding-source` requires --block and --attribute to be provided together.");
251
268
  return createNamedExecutionPlan(context, {
252
269
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBindingSourceCommand({
253
270
  attributeName,
@@ -287,15 +304,15 @@ var ADD_KIND_REGISTRY = {
287
304
  nameLabel: "Block name",
288
305
  async prepareExecution(context) {
289
306
  const name = requireAddKindName(context, "`wp-typia add block` requires <name>. Usage: wp-typia add block <name> [--template <basic|interactivity|persistence|compound>]");
290
- const externalLayerId = readOptionalStringFlag(context.flags, "external-layer-id");
291
- const externalLayerSource = readOptionalStringFlag(context.flags, "external-layer-source");
307
+ const externalLayerId = readOptionalStrictStringFlag(context.flags, "external-layer-id");
308
+ const externalLayerSource = readOptionalStrictStringFlag(context.flags, "external-layer-source");
292
309
  const shouldPromptForLayerSelection = Boolean(externalLayerSource) && !Boolean(externalLayerId) && context.isInteractiveSession;
293
310
  const selectPrompt = shouldPromptForLayerSelection ? await context.getOrCreatePrompt() : undefined;
294
- const alternateRenderTargets = readOptionalStringFlag(context.flags, "alternate-render-targets");
295
- const dataStorageMode = readOptionalStringFlag(context.flags, "data-storage");
296
- const innerBlocksPreset = readOptionalStringFlag(context.flags, "inner-blocks-preset");
297
- const persistencePolicy = readOptionalStringFlag(context.flags, "persistence-policy");
298
- let resolvedTemplateId = readOptionalStringFlag(context.flags, "template");
311
+ const alternateRenderTargets = readOptionalStrictStringFlag(context.flags, "alternate-render-targets");
312
+ const dataStorageMode = readOptionalStrictStringFlag(context.flags, "data-storage");
313
+ const innerBlocksPreset = readOptionalStrictStringFlag(context.flags, "inner-blocks-preset");
314
+ const persistencePolicy = readOptionalStrictStringFlag(context.flags, "persistence-policy");
315
+ let resolvedTemplateId = readOptionalStrictStringFlag(context.flags, "template");
299
316
  if (!resolvedTemplateId && context.isInteractiveSession) {
300
317
  const templatePrompt = await context.getOrCreatePrompt();
301
318
  resolvedTemplateId = await templatePrompt.select("Select a block template", context.addRuntime.ADD_BLOCK_TEMPLATE_IDS.map((templateId) => ({
@@ -392,7 +409,7 @@ var ADD_KIND_REGISTRY = {
392
409
  nameLabel: "Editor plugin name",
393
410
  async prepareExecution(context) {
394
411
  const name = requireAddKindName(context, "`wp-typia add editor-plugin` requires <name>. Usage: wp-typia add editor-plugin <name> [--slot <sidebar|document-setting-panel>].");
395
- const slot = readOptionalStringFlag(context.flags, "slot");
412
+ const slot = readOptionalStrictStringFlag(context.flags, "slot");
396
413
  return createNamedExecutionPlan(context, {
397
414
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddEditorPluginCommand({
398
415
  cwd,
@@ -430,8 +447,8 @@ var ADD_KIND_REGISTRY = {
430
447
  nameLabel: "Target block",
431
448
  async prepareExecution(context) {
432
449
  const name = requireAddKindName(context, "`wp-typia add hooked-block` requires <block-slug>. Usage: wp-typia add hooked-block <block-slug> --anchor <anchor-block-name> --position <before|after|firstChild|lastChild>.");
433
- const anchorBlockName = requireStringFlag(context.flags, "anchor", "`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
434
- const position = requireStringFlag(context.flags, "position", "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
450
+ const anchorBlockName = requireStrictStringFlag(context.flags, "anchor", "`wp-typia add hooked-block` requires --anchor <anchor-block-name>.");
451
+ const position = requireStrictStringFlag(context.flags, "position", "`wp-typia add hooked-block` requires --position <before|after|firstChild|lastChild>.");
435
452
  return createNamedExecutionPlan(context, {
436
453
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddHookedBlockCommand({
437
454
  anchorBlockName,
@@ -501,7 +518,7 @@ var ADD_KIND_REGISTRY = {
501
518
  nameLabel: "Style name",
502
519
  async prepareExecution(context) {
503
520
  const name = requireAddKindName(context, "`wp-typia add style` requires <name>. Usage: wp-typia add style <name> --block <block-slug>.");
504
- const blockSlug = requireStringFlag(context.flags, "block", "`wp-typia add style` requires --block <block-slug>.");
521
+ const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add style` requires --block <block-slug>.");
505
522
  return createNamedExecutionPlan(context, {
506
523
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBlockStyleCommand({
507
524
  blockName: blockSlug,
@@ -539,8 +556,8 @@ var ADD_KIND_REGISTRY = {
539
556
  nameLabel: "Transform name",
540
557
  async prepareExecution(context) {
541
558
  const name = requireAddKindName(context, "`wp-typia add transform` requires <name>. Usage: wp-typia add transform <name> --from <namespace/block> --to <block-slug|namespace/block-slug>.");
542
- const fromBlockName = requireStringFlag(context.flags, "from", "`wp-typia add transform` requires --from <namespace/block>.");
543
- const toBlockName = requireStringFlag(context.flags, "to", "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
559
+ const fromBlockName = requireStrictStringFlag(context.flags, "from", "`wp-typia add transform` requires --from <namespace/block>.");
560
+ const toBlockName = requireStrictStringFlag(context.flags, "to", "`wp-typia add transform` requires --to <block-slug|namespace/block-slug>.");
544
561
  return createNamedExecutionPlan(context, {
545
562
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddBlockTransformCommand({
546
563
  cwd,
@@ -581,8 +598,8 @@ var ADD_KIND_REGISTRY = {
581
598
  nameLabel: "REST resource name",
582
599
  async prepareExecution(context) {
583
600
  const name = requireAddKindName(context, "`wp-typia add rest-resource` requires <name>. Usage: wp-typia add rest-resource <name> [--namespace <vendor/v1>] [--methods <list,read,create>].");
584
- const methods = readOptionalStringFlag(context.flags, "methods");
585
- const namespace = readOptionalStringFlag(context.flags, "namespace");
601
+ const methods = readOptionalStrictStringFlag(context.flags, "methods");
602
+ const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
586
603
  return createNamedExecutionPlan(context, {
587
604
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddRestResourceCommand({
588
605
  cwd,
@@ -621,7 +638,7 @@ var ADD_KIND_REGISTRY = {
621
638
  nameLabel: "AI feature name",
622
639
  async prepareExecution(context) {
623
640
  const name = requireAddKindName(context, "`wp-typia add ai-feature` requires <name>. Usage: wp-typia add ai-feature <name> [--namespace <vendor/v1>].");
624
- const namespace = readOptionalStringFlag(context.flags, "namespace");
641
+ const namespace = readOptionalStrictStringFlag(context.flags, "namespace");
625
642
  return createNamedExecutionPlan(context, {
626
643
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddAiFeatureCommand({
627
644
  aiFeatureName: name2,
@@ -660,7 +677,7 @@ var ADD_KIND_REGISTRY = {
660
677
  nameLabel: "Variation name",
661
678
  async prepareExecution(context) {
662
679
  const name = requireAddKindName(context, "`wp-typia add variation` requires <name>. Usage: wp-typia add variation <name> --block <block-slug>");
663
- const blockSlug = requireStringFlag(context.flags, "block", "`wp-typia add variation` requires --block <block-slug>.");
680
+ const blockSlug = requireStrictStringFlag(context.flags, "block", "`wp-typia add variation` requires --block <block-slug>.");
664
681
  return createNamedExecutionPlan(context, {
665
682
  execute: ({ cwd, name: name2 }) => context.addRuntime.runAddVariationCommand({
666
683
  blockName: blockSlug,
@@ -1165,20 +1182,6 @@ function printBlock(lines, printLine) {
1165
1182
  printLine(line);
1166
1183
  }
1167
1184
  }
1168
- function formatExternalLayerSelectHint2(option2) {
1169
- const details = [
1170
- option2.description,
1171
- option2.extends.length > 0 ? `extends ${option2.extends.join(", ")}` : undefined
1172
- ].filter((value) => typeof value === "string" && value.length > 0);
1173
- return details.length > 0 ? details.join(" \xB7 ") : undefined;
1174
- }
1175
- function toExternalLayerPromptOptions2(options) {
1176
- return options.map((option2) => ({
1177
- hint: formatExternalLayerSelectHint2(option2),
1178
- label: option2.id,
1179
- value: option2.id
1180
- }));
1181
- }
1182
1185
 
1183
1186
  // src/runtime-capabilities.ts
1184
1187
  function isInteractiveTerminal({
@@ -1440,14 +1443,14 @@ async function executeSyncCommand({
1440
1443
  }
1441
1444
 
1442
1445
  // src/runtime-bridge.ts
1443
- var loadCliAddRuntime = () => import("./cli-add-5z3wpzkh.js");
1446
+ var loadCliAddRuntime = () => import("./cli-add-p3re8act.js");
1444
1447
  var loadCliDiagnosticsRuntime = () => import("./cli-diagnostics-5dvztm7q.js");
1445
- var loadCliDoctorRuntime = () => import("./cli-doctor-jd7qyr5s.js");
1446
- var loadCliInitRuntime = () => import("./cli-init-10nktmme.js");
1448
+ var loadCliDoctorRuntime = () => import("./cli-doctor-cjm4rzbk.js");
1449
+ var loadCliInitRuntime = () => import("./cli-init-7gcthyn1.js");
1447
1450
  var loadCliPromptRuntime = () => import("./cli-prompt-614tq57c.js");
1448
- var loadCliScaffoldRuntime = () => import("./cli-scaffold-837x3xsv.js");
1451
+ var loadCliScaffoldRuntime = () => import("./cli-scaffold-x1dp8sz1.js");
1449
1452
  var loadCliTemplatesRuntime = () => import("./cli-templates-9t2a7zqd.js");
1450
- var loadMigrationsRuntime = () => import("./migrations-x3a9t9yf.js");
1453
+ var loadMigrationsRuntime = () => import("./migrations-xfb2h7nf.js");
1451
1454
  async function wrapCliCommandError(command, error) {
1452
1455
  const { createCliCommandError } = await loadCliDiagnosticsRuntime();
1453
1456
  return createCliCommandError({ command, error });
@@ -1461,17 +1464,6 @@ function shouldWrapCliCommandError(options) {
1461
1464
  }
1462
1465
  return true;
1463
1466
  }
1464
- function readOptionalLooseStringFlag(flags, name) {
1465
- const value = flags[name];
1466
- if (value === undefined || value === null) {
1467
- return;
1468
- }
1469
- if (typeof value !== "string") {
1470
- throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
1471
- }
1472
- const trimmed = value.trim();
1473
- return trimmed.length > 0 ? trimmed : undefined;
1474
- }
1475
1467
  function pushFlag(argv, name, value) {
1476
1468
  if (value === undefined || value === null || value === false) {
1477
1469
  return;
@@ -1613,7 +1605,7 @@ async function executeCreateCommand({
1613
1605
  promptText: activePrompt ? (message, defaultValue, validate) => activePrompt.text(message, defaultValue, validate) : undefined,
1614
1606
  queryPostType: readOptionalLooseStringFlag(flags, "query-post-type"),
1615
1607
  selectDataStorage: activePrompt ? () => activePrompt.select("Select a data storage mode", [...DATA_STORAGE_PROMPT_OPTIONS], 1) : undefined,
1616
- selectExternalLayerId: shouldPromptForExternalLayerSelection && activePrompt ? (options) => activePrompt.select("Select an external layer", toExternalLayerPromptOptions2(options), 1) : undefined,
1608
+ selectExternalLayerId: shouldPromptForExternalLayerSelection && activePrompt ? (options) => activePrompt.select("Select an external layer", toExternalLayerPromptOptions(options), 1) : undefined,
1617
1609
  selectPackageManager: activePrompt ? () => activePrompt.select("Select a package manager", [...PACKAGE_MANAGER_PROMPT_OPTIONS], 1) : undefined,
1618
1610
  selectPersistencePolicy: activePrompt ? () => activePrompt.select("Select a persistence policy", [...PERSISTENCE_POLICY_PROMPT_OPTIONS], 1) : undefined,
1619
1611
  selectTemplate: activePrompt ? () => activePrompt.select("Select a template", getTemplateSelectOptions(), 1) : undefined,
@@ -2406,7 +2398,7 @@ var doctorCommand = defineCommand({
2406
2398
  const prefersStructuredOutput = prefersStructuredCliOutput(args);
2407
2399
  if (prefersStructuredOutput) {
2408
2400
  const [{ getDoctorChecks }, { getDoctorFailureDetailLines }] = await Promise.all([
2409
- import("./cli-doctor-jd7qyr5s.js"),
2401
+ import("./cli-doctor-cjm4rzbk.js"),
2410
2402
  import("./cli-diagnostics-5dvztm7q.js")
2411
2403
  ]);
2412
2404
  const checks = await getDoctorChecks(args.cwd);
@@ -3272,4 +3264,4 @@ export {
3272
3264
  wpTypiaCommands
3273
3265
  };
3274
3266
 
3275
- //# debugId=844373B8B205795464756E2164756E21
3267
+ //# debugId=73FFE6511B0A672B64756E2164756E21
@@ -15,11 +15,11 @@ import {
15
15
  snapshotProjectVersion,
16
16
  verifyProjectMigrations,
17
17
  wizardProjectMigrations
18
- } from "./cli-yzmkz95r.js";
18
+ } from "./cli-prc42zqd.js";
19
19
  import"./cli-gcbre1zs.js";
20
20
  import"./cli-bq2v559b.js";
21
21
  import"./cli-sj5mtyzj.js";
22
- import"./cli-5md428hf.js";
22
+ import"./cli-x0h03qqe.js";
23
23
  import"./cli-pd5pqgre.js";
24
24
  import"./cli-xnn9xjcy.js";
25
25
  export {