wp-typia 0.20.5 → 0.22.0

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.
package/dist-bunli/cli.js CHANGED
@@ -1,20 +1,25 @@
1
1
  // @bun
2
2
  import {
3
- ADD_OPTION_METADATA,
4
- CREATE_OPTION_METADATA,
3
+ ALL_COMMAND_OPTION_METADATA,
4
+ COMMAND_OPTION_METADATA_BY_GROUP,
5
+ COMMAND_ROUTING_METADATA,
5
6
  GLOBAL_OPTION_METADATA,
6
- MIGRATE_OPTION_METADATA,
7
- TEMPLATES_OPTION_METADATA,
7
+ WP_TYPIA_CANONICAL_CREATE_USAGE,
8
+ WP_TYPIA_COMMAND_OPTION_GROUP_NAMES_BY_TOP_LEVEL_COMMAND,
8
9
  WP_TYPIA_CONFIG_SOURCES,
10
+ WP_TYPIA_RESERVED_TOP_LEVEL_COMMAND_NAMES,
9
11
  buildCommandOptionParser,
10
12
  collectOptionNamesByType,
13
+ collectPositionalIndexes,
11
14
  createPlugin,
15
+ extractKnownOptionValuesFromArgv,
16
+ findFirstPositionalIndex,
12
17
  loadWpTypiaUserConfig,
13
18
  loadWpTypiaUserConfigFromSource,
14
19
  mergeWpTypiaUserConfig,
15
20
  package_default,
16
21
  writeStructuredCliDiagnosticError
17
- } from "./cli-xnh2s5kz.js";
22
+ } from "./cli-ktp869eh.js";
18
23
  import"./cli-03j0axbt.js";
19
24
  import {
20
25
  GLOBAL_FLAGS,
@@ -29,7 +34,7 @@ import {
29
34
  } from "./cli-hv2yedw2.js";
30
35
  import"./cli-ac2ebaf8.js";
31
36
  import"./cli-6v0pcxw6.js";
32
- import"./cli-xxzpb58s.js";
37
+ import"./cli-p95wr1q8.js";
33
38
  import {
34
39
  __require
35
40
  } from "./cli-xnn9xjcy.js";
@@ -2254,88 +2259,22 @@ var bunliConfig = defineConfig({
2254
2259
 
2255
2260
  // src/command-contract.ts
2256
2261
  import path from "path";
2257
- var WP_TYPIA_CANONICAL_CREATE_USAGE = "wp-typia create <project-dir>";
2258
- var WP_TYPIA_RESERVED_TOP_LEVEL_COMMAND_NAMES = [
2259
- "create",
2260
- "init",
2261
- "sync",
2262
- "add",
2263
- "migrate",
2264
- "templates",
2265
- "doctor",
2266
- "mcp",
2267
- "help",
2268
- "version",
2269
- "skills",
2270
- "completions",
2271
- "complete"
2272
- ];
2273
- var WP_TYPIA_NODE_FALLBACK_TOP_LEVEL_COMMAND_NAMES = [
2274
- "create",
2275
- "init",
2276
- "sync",
2277
- "add",
2278
- "migrate",
2279
- "templates",
2280
- "doctor",
2281
- "help",
2282
- "version"
2283
- ];
2284
- var NODE_FALLBACK_TOP_LEVEL_COMMAND_NAME_SET = new Set(WP_TYPIA_NODE_FALLBACK_TOP_LEVEL_COMMAND_NAMES);
2285
- var WP_TYPIA_BUN_REQUIRED_TOP_LEVEL_COMMAND_NAMES = WP_TYPIA_RESERVED_TOP_LEVEL_COMMAND_NAMES.filter((name) => !NODE_FALLBACK_TOP_LEVEL_COMMAND_NAME_SET.has(name));
2286
- var SHARED_OPTION_PARSER = buildCommandOptionParser(ADD_OPTION_METADATA, GLOBAL_OPTION_METADATA, CREATE_OPTION_METADATA, MIGRATE_OPTION_METADATA, TEMPLATES_OPTION_METADATA);
2287
- var STRING_OPTION_NAMES_BY_COMMAND = {
2288
- add: new Set(collectOptionNamesByType(ADD_OPTION_METADATA, "string")),
2289
- create: new Set(collectOptionNamesByType(CREATE_OPTION_METADATA, "string")),
2290
- migrate: new Set(collectOptionNamesByType(MIGRATE_OPTION_METADATA, "string")),
2291
- templates: new Set(collectOptionNamesByType(TEMPLATES_OPTION_METADATA, "string"))
2292
- };
2262
+ var SHARED_OPTION_PARSER = buildCommandOptionParser(ALL_COMMAND_OPTION_METADATA);
2263
+ var STRING_OPTION_NAMES_BY_GROUP = Object.fromEntries(Object.entries(COMMAND_OPTION_METADATA_BY_GROUP).map(([groupName, metadata]) => [
2264
+ groupName,
2265
+ new Set(collectOptionNamesByType(metadata, "string"))
2266
+ ]));
2267
+ var STRING_OPTION_NAMES_BY_COMMAND = Object.fromEntries(WP_TYPIA_RESERVED_TOP_LEVEL_COMMAND_NAMES.map((commandName) => [
2268
+ commandName,
2269
+ new Set(WP_TYPIA_COMMAND_OPTION_GROUP_NAMES_BY_TOP_LEVEL_COMMAND[commandName].flatMap((groupName) => Array.from(STRING_OPTION_NAMES_BY_GROUP[groupName])))
2270
+ ]));
2293
2271
  var GLOBAL_STRING_OPTION_NAMES = new Set(collectOptionNamesByType(GLOBAL_OPTION_METADATA, "string"));
2294
2272
  var SHORT_OPTION_NAMES_WITH_VALUES = new Set([...SHARED_OPTION_PARSER.shortFlagMap.entries()].filter(([, option]) => option.type === "string").map(([short]) => short));
2295
- function isLongOptionValueConsumer(optionName) {
2296
- if (GLOBAL_STRING_OPTION_NAMES.has(optionName)) {
2297
- return true;
2298
- }
2299
- return Object.values(STRING_OPTION_NAMES_BY_COMMAND).some((optionNames) => optionNames.has(optionName));
2300
- }
2301
- function findFirstPositionalIndex(argv) {
2302
- const positionalIndexes = collectPositionalIndexes(argv);
2303
- return positionalIndexes[0] ?? -1;
2304
- }
2305
- function collectPositionalIndexes(argv) {
2306
- const positionalIndexes = [];
2307
- for (let index = 0;index < argv.length; index += 1) {
2308
- const arg = argv[index];
2309
- if (arg === "--") {
2310
- for (let restIndex = index + 1;restIndex < argv.length; restIndex += 1) {
2311
- positionalIndexes.push(restIndex);
2312
- }
2313
- break;
2314
- }
2315
- if (!arg.startsWith("-") || arg === "-") {
2316
- positionalIndexes.push(index);
2317
- continue;
2318
- }
2319
- if (arg.startsWith("--")) {
2320
- if (arg.includes("=")) {
2321
- continue;
2322
- }
2323
- if (isLongOptionValueConsumer(arg.slice(2))) {
2324
- index += 1;
2325
- }
2326
- continue;
2327
- }
2328
- if (arg.length === 2 && SHORT_OPTION_NAMES_WITH_VALUES.has(arg.slice(1))) {
2329
- index += 1;
2330
- }
2331
- }
2332
- return positionalIndexes;
2333
- }
2334
2273
  function isReservedTopLevelCommandName(value) {
2335
2274
  return WP_TYPIA_RESERVED_TOP_LEVEL_COMMAND_NAMES.includes(value);
2336
2275
  }
2337
2276
  function assertStringOptionValues(argv) {
2338
- const firstPositionalIndex = findFirstPositionalIndex(argv);
2277
+ const firstPositionalIndex = findFirstPositionalIndex(argv, COMMAND_ROUTING_METADATA);
2339
2278
  if (firstPositionalIndex === -1) {
2340
2279
  return;
2341
2280
  }
@@ -2401,7 +2340,7 @@ function assertPositionalAliasProjectDir(projectDir) {
2401
2340
  }
2402
2341
  }
2403
2342
  function normalizeWpTypiaArgv(argv) {
2404
- const positionalIndexes = collectPositionalIndexes(argv);
2343
+ const positionalIndexes = collectPositionalIndexes(argv, COMMAND_ROUTING_METADATA);
2405
2344
  const firstPositionalIndex = positionalIndexes[0] ?? -1;
2406
2345
  if (firstPositionalIndex === -1) {
2407
2346
  return argv;
@@ -2432,40 +2371,15 @@ function normalizeWpTypiaArgv(argv) {
2432
2371
  }
2433
2372
 
2434
2373
  // src/config-override.ts
2374
+ var GLOBAL_OPTION_PARSER = buildCommandOptionParser(GLOBAL_OPTION_METADATA);
2435
2375
  function extractWpTypiaConfigOverride(argv) {
2436
- const nextArgv = [];
2437
- let configOverridePath;
2438
- for (let index = 0;index < argv.length; index += 1) {
2439
- const arg = argv[index];
2440
- if (!arg) {
2441
- continue;
2442
- }
2443
- if (arg === "--") {
2444
- nextArgv.push(...argv.slice(index));
2445
- break;
2446
- }
2447
- if (arg === "--config" || arg === "-c") {
2448
- const next = argv[index + 1];
2449
- if (!next || next.startsWith("-")) {
2450
- throw new Error(`\`${arg}\` requires a value.`);
2451
- }
2452
- configOverridePath = next;
2453
- index += 1;
2454
- continue;
2455
- }
2456
- if (arg.startsWith("--config=")) {
2457
- const inlineValue = arg.slice("--config=".length);
2458
- if (!inlineValue) {
2459
- throw new Error("`--config` requires a value.");
2460
- }
2461
- configOverridePath = inlineValue;
2462
- continue;
2463
- }
2464
- nextArgv.push(arg);
2465
- }
2376
+ const { argv: nextArgv, flags } = extractKnownOptionValuesFromArgv(argv, {
2377
+ optionNames: ["config"],
2378
+ parser: GLOBAL_OPTION_PARSER
2379
+ });
2466
2380
  return {
2467
2381
  argv: nextArgv,
2468
- configOverridePath
2382
+ configOverridePath: typeof flags.config === "string" ? flags.config : undefined
2469
2383
  };
2470
2384
  }
2471
2385
 
@@ -2531,7 +2445,7 @@ function resolveGeneratedMetadataPath(moduleUrl) {
2531
2445
  }
2532
2446
  async function formatCliError(error) {
2533
2447
  try {
2534
- const { formatCliDiagnosticError } = await import("./cli-diagnostics-zecc6w1f.js");
2448
+ const { formatCliDiagnosticError } = await import("./cli-diagnostics-5dvztm7q.js");
2535
2449
  return formatCliDiagnosticError(error);
2536
2450
  } catch {
2537
2451
  return error instanceof Error ? error.message : String(error);
@@ -2539,7 +2453,7 @@ async function formatCliError(error) {
2539
2453
  }
2540
2454
  async function createWpTypiaCli(options = {}) {
2541
2455
  applyStandaloneSupportLayoutEnv();
2542
- const { wpTypiaCommands } = await import("./command-list-pztcgga5.js");
2456
+ const { wpTypiaCommands } = await import("./command-list-jt1a1w7r.js");
2543
2457
  const cli = await createCLI({
2544
2458
  ...bunliConfig,
2545
2459
  description: package_default.description,
@@ -2598,4 +2512,4 @@ export {
2598
2512
  createWpTypiaCli
2599
2513
  };
2600
2514
 
2601
- //# debugId=69710AB9747B2B1564756E2164756E21
2515
+ //# debugId=5EFFD418326B0BAA64756E2164756E21