wp-typia 0.24.4 → 0.24.5

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.
Files changed (58) hide show
  1. package/README.md +7 -5
  2. package/bin/wp-typia.js +24 -103
  3. package/{dist-bunli/node-cli.js → dist/cli.js} +5013 -3687
  4. package/package.json +9 -36
  5. package/bin/routing-metadata.generated.d.ts +0 -8
  6. package/bin/routing-metadata.generated.js +0 -93
  7. package/bin/runtime-routing.d.ts +0 -34
  8. package/bin/runtime-routing.js +0 -124
  9. package/dist-bunli/.bunli/commands.gen.js +0 -304441
  10. package/dist-bunli/.bunli/highlights-eq9cgrbb.scm +0 -604
  11. package/dist-bunli/.bunli/highlights-ghv9g403.scm +0 -205
  12. package/dist-bunli/.bunli/highlights-hk7bwhj4.scm +0 -284
  13. package/dist-bunli/.bunli/highlights-r812a2qc.scm +0 -150
  14. package/dist-bunli/.bunli/highlights-x6tmsnaa.scm +0 -115
  15. package/dist-bunli/.bunli/injections-73j83es3.scm +0 -27
  16. package/dist-bunli/.bunli/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
  17. package/dist-bunli/.bunli/tree-sitter-markdown-411r6y9b.wasm +0 -0
  18. package/dist-bunli/.bunli/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
  19. package/dist-bunli/.bunli/tree-sitter-typescript-zxjzwt75.wasm +0 -0
  20. package/dist-bunli/.bunli/tree-sitter-zig-e78zbjpm.wasm +0 -0
  21. package/dist-bunli/agents-91fpdyyt.js +0 -12
  22. package/dist-bunli/chunk-bdqvmfwv-f5qmzmxg.js +0 -16825
  23. package/dist-bunli/cli-03j0axbt.js +0 -163
  24. package/dist-bunli/cli-1170yyve.js +0 -106
  25. package/dist-bunli/cli-368d4cgy.js +0 -1235
  26. package/dist-bunli/cli-377p86mf.js +0 -191
  27. package/dist-bunli/cli-6v0pcxw6.js +0 -314
  28. package/dist-bunli/cli-84c7wff4.js +0 -198
  29. package/dist-bunli/cli-8hxf9qw6.js +0 -198
  30. package/dist-bunli/cli-9fx0qgb7.js +0 -3680
  31. package/dist-bunli/cli-ac2ebaf8.js +0 -3
  32. package/dist-bunli/cli-add-qjd3ba8j.js +0 -10671
  33. package/dist-bunli/cli-am5x7tb4.js +0 -192
  34. package/dist-bunli/cli-bajwv85z.js +0 -24
  35. package/dist-bunli/cli-ccax7s0s.js +0 -34
  36. package/dist-bunli/cli-cvxvcw7c.js +0 -46
  37. package/dist-bunli/cli-diagnostics-10drxh34.js +0 -34
  38. package/dist-bunli/cli-doctor-6fyxq940.js +0 -1446
  39. package/dist-bunli/cli-e4bwd81c.js +0 -1260
  40. package/dist-bunli/cli-fv4h3ydt.js +0 -173823
  41. package/dist-bunli/cli-hv2yedw2.js +0 -74591
  42. package/dist-bunli/cli-init-7avk42dh.js +0 -880
  43. package/dist-bunli/cli-kfm9mm68.js +0 -14679
  44. package/dist-bunli/cli-prompt-ncyg68rn.js +0 -12
  45. package/dist-bunli/cli-rdcga1bd.js +0 -135
  46. package/dist-bunli/cli-scaffold-0bb6pr3w.js +0 -538
  47. package/dist-bunli/cli-t73q5aqz.js +0 -103
  48. package/dist-bunli/cli-templates-g8t4fm11.js +0 -167
  49. package/dist-bunli/cli-tj7ajdvf.js +0 -2612
  50. package/dist-bunli/cli-tq730sqt.js +0 -344
  51. package/dist-bunli/cli-xnn9xjcy.js +0 -68
  52. package/dist-bunli/cli-z48frc8t.js +0 -229
  53. package/dist-bunli/cli.js +0 -2523
  54. package/dist-bunli/command-list-y3g7e9rb.js +0 -4013
  55. package/dist-bunli/create-template-validation-4fr851vg.js +0 -16
  56. package/dist-bunli/migrations-3vngdy51.js +0 -47
  57. package/dist-bunli/sync-k2k8svyc.js +0 -13
  58. package/dist-bunli/workspace-project-gmv2a71z.js +0 -22
@@ -1,344 +0,0 @@
1
- // @bun
2
- // ../wp-typia-project-tools/src/runtime/cli-diagnostics.ts
3
- var CLI_DIAGNOSTIC_CODES = {
4
- COMMAND_EXECUTION: "command-execution",
5
- CONFIGURATION_MISSING: "configuration-missing",
6
- DEPENDENCIES_NOT_INSTALLED: "dependencies-not-installed",
7
- DOCTOR_CHECK_FAILED: "doctor-check-failed",
8
- INVALID_ARGUMENT: "invalid-argument",
9
- INVALID_COMMAND: "invalid-command",
10
- MISSING_ARGUMENT: "missing-argument",
11
- MISSING_BUILD_ARTIFACT: "missing-build-artifact",
12
- OUTSIDE_PROJECT_ROOT: "outside-project-root",
13
- TEMPLATE_SOURCE_TIMEOUT: "template-source-timeout",
14
- TEMPLATE_SOURCE_TOO_LARGE: "template-source-too-large",
15
- UNKNOWN_TEMPLATE: "unknown-template",
16
- UNSUPPORTED_COMMAND: "unsupported-command"
17
- };
18
- var CLI_DIAGNOSTIC_CODE_METADATA = {
19
- [CLI_DIAGNOSTIC_CODES.COMMAND_EXECUTION]: {
20
- cause: "The command failed after argument parsing and preflight checks completed.",
21
- recovery: "Read the detail lines for the underlying tool failure, rerun with the same command once corrected, and report the full JSON envelope if the recovery is unclear."
22
- },
23
- [CLI_DIAGNOSTIC_CODES.CONFIGURATION_MISSING]: {
24
- cause: "A command needs configuration that is not present in the current project.",
25
- recovery: "Add the missing wp-typia config section or rerun the scaffold/init flow that creates the expected configuration."
26
- },
27
- [CLI_DIAGNOSTIC_CODES.DEPENDENCIES_NOT_INSTALLED]: {
28
- cause: "Generated project or workspace dependencies are missing from the local install.",
29
- recovery: "Run the package-manager install command from the reported project root, then rerun the wp-typia command."
30
- },
31
- [CLI_DIAGNOSTIC_CODES.DOCTOR_CHECK_FAILED]: {
32
- cause: "One or more doctor checks reported a failing environment or workspace row.",
33
- recovery: "Inspect the failed check labels and details, fix the reported drift or missing prerequisite, then rerun `wp-typia doctor`."
34
- },
35
- [CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT]: {
36
- cause: "An argument was present but did not match the supported value, shape, or project state.",
37
- recovery: "Correct the argument value using command help or the detail lines, then rerun the command."
38
- },
39
- [CLI_DIAGNOSTIC_CODES.INVALID_COMMAND]: {
40
- cause: "The command or subcommand is not part of the supported wp-typia command tree.",
41
- recovery: "Run `wp-typia --help` or the relevant command help and switch to a supported command/subcommand."
42
- },
43
- [CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT]: {
44
- cause: "A required positional argument or flag value was omitted.",
45
- recovery: "Provide the missing argument or flag value shown in the detail lines, then rerun the command."
46
- },
47
- [CLI_DIAGNOSTIC_CODES.MISSING_BUILD_ARTIFACT]: {
48
- cause: "The published or standalone CLI layout is missing bundled build artifacts.",
49
- recovery: "Reinstall the package or standalone binary, or rebuild the workspace before invoking the command again."
50
- },
51
- [CLI_DIAGNOSTIC_CODES.OUTSIDE_PROJECT_ROOT]: {
52
- cause: "The command was run outside a generated wp-typia project or official workspace root.",
53
- recovery: "Change into the scaffolded project/workspace root, or rerun the scaffold/init workflow that creates the expected root files."
54
- },
55
- [CLI_DIAGNOSTIC_CODES.TEMPLATE_SOURCE_TIMEOUT]: {
56
- cause: "External template resolution did not complete within the allowed time.",
57
- recovery: "Retry with a reachable template source, use a local path, or cache the template package before rerunning."
58
- },
59
- [CLI_DIAGNOSTIC_CODES.TEMPLATE_SOURCE_TOO_LARGE]: {
60
- cause: "External template content exceeded the safety size limit.",
61
- recovery: "Reduce the template package size or point wp-typia at a smaller official template layer."
62
- },
63
- [CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE]: {
64
- cause: "The requested scaffold template or add-block template id is not registered.",
65
- recovery: "Run `wp-typia templates list` and rerun with one of the listed template ids."
66
- },
67
- [CLI_DIAGNOSTIC_CODES.UNSUPPORTED_COMMAND]: {
68
- cause: "The requested command exists conceptually but is not supported by the current runtime surface.",
69
- recovery: "Install Bun 1.3.11+ or use the standalone wp-typia binary when the detail lines say the Bun-powered runtime is required."
70
- }
71
- };
72
- var DEFAULT_CLI_FAILURE_SUMMARIES = {
73
- add: "Unable to complete the requested add workflow.",
74
- create: "Unable to complete the requested create workflow.",
75
- doctor: "One or more doctor checks failed.",
76
- init: "Unable to preview the requested retrofit init plan.",
77
- mcp: "Unable to inspect or sync MCP metadata.",
78
- migrate: "Unable to complete the requested migration command.",
79
- sync: "Unable to complete the requested sync workflow.",
80
- templates: "Unable to inspect scaffold templates."
81
- };
82
- var MIN_CLI_WRAP_COLUMNS = 32;
83
- function parseCliColumns(value) {
84
- if (typeof value !== "string" || value.trim().length === 0) {
85
- return null;
86
- }
87
- const parsed = Number.parseInt(value, 10);
88
- return Number.isFinite(parsed) && parsed >= MIN_CLI_WRAP_COLUMNS ? parsed : null;
89
- }
90
- function resolveCliWrapColumns(streamColumns) {
91
- return parseCliColumns(process.env.COLUMNS) ?? (typeof streamColumns === "number" && streamColumns >= MIN_CLI_WRAP_COLUMNS ? streamColumns : null);
92
- }
93
- function wrapCliText(text, maxWidth) {
94
- const words = text.trim().split(/\s+/u).filter((word) => word.length > 0);
95
- if (words.length === 0) {
96
- return [""];
97
- }
98
- const lines = [];
99
- let currentLine = words[0] ?? "";
100
- for (const word of words.slice(1)) {
101
- const nextLine = `${currentLine} ${word}`;
102
- if (nextLine.length <= maxWidth) {
103
- currentLine = nextLine;
104
- continue;
105
- }
106
- lines.push(currentLine);
107
- currentLine = word;
108
- }
109
- lines.push(currentLine);
110
- return lines;
111
- }
112
- function formatWrappedPrefixedLine(prefix, text, columns, continuationIndent = " ") {
113
- const singleLine = `${prefix}${text}`;
114
- if (columns === null || singleLine.length <= columns) {
115
- return [singleLine];
116
- }
117
- const words = text.trim().split(/\s+/u).filter((word) => word.length > 0);
118
- if (words.length === 0) {
119
- return [prefix.trimEnd()];
120
- }
121
- const continuationWidth = Math.max(1, columns - continuationIndent.length);
122
- const firstLineWidth = columns - prefix.length;
123
- if (firstLineWidth <= 0 || (words[0]?.length ?? 0) > firstLineWidth) {
124
- return [
125
- prefix.trimEnd(),
126
- ...wrapCliText(text, continuationWidth).map((line) => `${continuationIndent}${line}`)
127
- ];
128
- }
129
- const lines = [];
130
- let currentPrefix = prefix;
131
- let currentWidth = Math.max(1, columns - currentPrefix.length);
132
- let currentLine = words[0] ?? "";
133
- for (const word of words.slice(1)) {
134
- const nextLine = `${currentLine} ${word}`;
135
- if (nextLine.length <= currentWidth) {
136
- currentLine = nextLine;
137
- continue;
138
- }
139
- lines.push(`${currentPrefix}${currentLine}`);
140
- currentPrefix = continuationIndent;
141
- currentWidth = continuationWidth;
142
- currentLine = word;
143
- }
144
- lines.push(`${currentPrefix}${currentLine}`);
145
- return lines;
146
- }
147
- function formatCliDiagnosticBlock(message) {
148
- const columns = resolveCliWrapColumns(process.stderr.columns);
149
- const lines = [
150
- `wp-typia ${message.command} failed`,
151
- ...formatWrappedPrefixedLine("Summary: ", message.summary, columns)
152
- ];
153
- if (message.detailLines.length > 0) {
154
- lines.push("Details:");
155
- for (const detailLine of message.detailLines) {
156
- lines.push(...formatWrappedPrefixedLine("- ", detailLine, columns));
157
- }
158
- }
159
- return lines.join(`
160
- `);
161
- }
162
- function getErrorMessage(error) {
163
- if (error instanceof Error) {
164
- return error.message;
165
- }
166
- return String(error);
167
- }
168
- function normalizeDetailLines(detailLines) {
169
- return detailLines.flatMap((detailLine) => typeof detailLine === "string" ? detailLine.split(`
170
- `) : []).map((detailLine) => detailLine.trim()).filter((detailLine) => detailLine.length > 0);
171
- }
172
-
173
- class CliDiagnosticError extends Error {
174
- code;
175
- command;
176
- detailLines;
177
- summary;
178
- constructor(message, options) {
179
- super(formatCliDiagnosticBlock(message), options);
180
- this.code = message.code;
181
- this.command = message.command;
182
- this.detailLines = [...message.detailLines];
183
- this.name = "CliDiagnosticError";
184
- this.summary = message.summary;
185
- }
186
- }
187
- function isCliDiagnosticError(error) {
188
- return error instanceof CliDiagnosticError;
189
- }
190
- function isCliDiagnosticCode(value) {
191
- return Object.values(CLI_DIAGNOSTIC_CODES).includes(value);
192
- }
193
- function readCliDiagnosticCode(error) {
194
- if (isCliDiagnosticError(error)) {
195
- return error.code;
196
- }
197
- if (typeof error === "object" && error !== null && "code" in error) {
198
- const { code } = error;
199
- if (isCliDiagnosticCode(code)) {
200
- return code;
201
- }
202
- }
203
- return null;
204
- }
205
- function getCliDiagnosticCodeMetadata(code) {
206
- return CLI_DIAGNOSTIC_CODE_METADATA[code];
207
- }
208
- function createCliDiagnosticCodeError(code, message, options) {
209
- const error = new Error(message, options);
210
- error.code = code;
211
- return error;
212
- }
213
- function inferCliDiagnosticCode(options) {
214
- const inheritedCode = readCliDiagnosticCode(options.error);
215
- if (inheritedCode) {
216
- return inheritedCode;
217
- }
218
- const haystack = normalizeDetailLines([
219
- ...options.detailLines,
220
- options.error === undefined ? undefined : getErrorMessage(options.error)
221
- ]).join(`
222
- `);
223
- if (/No MCP schema sources are configured\./u.test(haystack)) {
224
- return CLI_DIAGNOSTIC_CODES.CONFIGURATION_MISSING;
225
- }
226
- if (/Missing bundled build artifacts/u.test(haystack)) {
227
- return CLI_DIAGNOSTIC_CODES.MISSING_BUILD_ARTIFACT;
228
- }
229
- if (/No generated wp-typia project root was found/u.test(haystack)) {
230
- return CLI_DIAGNOSTIC_CODES.OUTSIDE_PROJECT_ROOT;
231
- }
232
- if (/dependencies have not been installed yet/u.test(haystack)) {
233
- return CLI_DIAGNOSTIC_CODES.DEPENDENCIES_NOT_INSTALLED;
234
- }
235
- if (/Timed out while .*external template|Timed out while .*npm template|Timed out while .*GitHub template/u.test(haystack)) {
236
- return CLI_DIAGNOSTIC_CODES.TEMPLATE_SOURCE_TIMEOUT;
237
- }
238
- if (/external template size limit/u.test(haystack)) {
239
- return CLI_DIAGNOSTIC_CODES.TEMPLATE_SOURCE_TOO_LARGE;
240
- }
241
- if (options.command === "doctor") {
242
- return CLI_DIAGNOSTIC_CODES.DOCTOR_CHECK_FAILED;
243
- }
244
- if (/requires <|requires --|requires a value/u.test(haystack)) {
245
- return CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT;
246
- }
247
- if (/Unknown (?:add-block )?template\s+(?:"|\\")/u.test(haystack)) {
248
- return CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE;
249
- }
250
- if (/Unknown .*subcommand|Unknown add kind|removed in favor|does not support|The Bun-free fallback runtime does not support|The positional alias only accepts/u.test(haystack)) {
251
- return haystack.includes("does not support") || haystack.includes("The Bun-free fallback runtime does not support") ? CLI_DIAGNOSTIC_CODES.UNSUPPORTED_COMMAND : CLI_DIAGNOSTIC_CODES.INVALID_COMMAND;
252
- }
253
- if (/Invalid |must start with|cannot hook|cannot nest|cannot use|cannot be|already defines|already exists|Expected one of/u.test(haystack)) {
254
- return CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT;
255
- }
256
- return CLI_DIAGNOSTIC_CODES.COMMAND_EXECUTION;
257
- }
258
- function createCliCommandError(options) {
259
- if (isCliDiagnosticError(options.error)) {
260
- return options.error;
261
- }
262
- const summary = options.summary ?? DEFAULT_CLI_FAILURE_SUMMARIES[options.command] ?? "Command failed.";
263
- const detailLines = normalizeDetailLines(options.detailLines ?? [options.error === undefined ? undefined : getErrorMessage(options.error)]);
264
- const code = options.code ?? inferCliDiagnosticCode({
265
- command: options.command,
266
- detailLines,
267
- error: options.error
268
- });
269
- return new CliDiagnosticError({
270
- code,
271
- command: options.command,
272
- detailLines,
273
- summary
274
- }, options.error instanceof Error ? { cause: options.error } : undefined);
275
- }
276
- function formatCliDiagnosticError(error) {
277
- if (!isCliDiagnosticError(error)) {
278
- return getErrorMessage(error);
279
- }
280
- return formatCliDiagnosticBlock({
281
- code: error.code,
282
- command: error.command,
283
- detailLines: error.detailLines,
284
- summary: error.summary
285
- });
286
- }
287
- function serializeCliDiagnosticError(error) {
288
- if (isCliDiagnosticError(error)) {
289
- return {
290
- code: error.code,
291
- command: error.command,
292
- detailLines: [...error.detailLines],
293
- kind: "command-execution",
294
- message: formatCliDiagnosticBlock({
295
- code: error.code,
296
- command: error.command,
297
- detailLines: error.detailLines,
298
- summary: error.summary
299
- }),
300
- name: error.name,
301
- summary: error.summary,
302
- tag: "CommandExecutionError"
303
- };
304
- }
305
- return {
306
- code: inferCliDiagnosticCode({
307
- command: "unknown",
308
- detailLines: [],
309
- error
310
- }),
311
- kind: "command-execution",
312
- message: getErrorMessage(error),
313
- name: error instanceof Error ? error.name : "Error",
314
- tag: "CommandExecutionError"
315
- };
316
- }
317
- function formatDoctorCheckLine(check) {
318
- const statusLabel = check.status === "pass" ? "PASS" : check.status === "warn" ? "WARN" : "FAIL";
319
- return formatWrappedPrefixedLine(`${statusLabel} ${check.label}: `, check.detail, resolveCliWrapColumns(process.stdout.columns)).join(`
320
- `);
321
- }
322
- function getFailingDoctorChecks(checks) {
323
- return checks.filter((check) => check.status === "fail");
324
- }
325
- function formatDoctorSummaryLine(checks, options = {}) {
326
- const failedChecks = getFailingDoctorChecks(checks);
327
- const exitFailureChecks = options.exitFailureChecks ?? failedChecks;
328
- const advisoryFailureCount = failedChecks.length - exitFailureChecks.length;
329
- const warningCount = checks.filter((check) => check.status === "warn").length;
330
- const summaryStatus = exitFailureChecks.length > 0 ? "FAIL" : advisoryFailureCount > 0 || warningCount > 0 ? "WARN" : "PASS";
331
- return formatWrappedPrefixedLine(`${summaryStatus} wp-typia doctor summary: `, [
332
- `${checks.length - failedChecks.length - warningCount}/${checks.length} checks passed`,
333
- advisoryFailureCount > 0 ? `${advisoryFailureCount} advisory failure(s)` : null,
334
- warningCount > 0 ? `${warningCount} warning(s)` : null
335
- ].filter((detail) => detail !== null).join(", "), resolveCliWrapColumns(process.stdout.columns)).join(`
336
- `);
337
- }
338
- function getDoctorFailureDetailLines(checks) {
339
- return getFailingDoctorChecks(checks).map((check) => `${check.label}: ${check.detail}`);
340
- }
341
-
342
- export { CLI_DIAGNOSTIC_CODES, CLI_DIAGNOSTIC_CODE_METADATA, CliDiagnosticError, isCliDiagnosticError, getCliDiagnosticCodeMetadata, createCliDiagnosticCodeError, createCliCommandError, formatCliDiagnosticError, serializeCliDiagnosticError, formatDoctorCheckLine, getFailingDoctorChecks, formatDoctorSummaryLine, getDoctorFailureDetailLines };
343
-
344
- //# debugId=65A9D8947CD0E24564756E2164756E21
@@ -1,68 +0,0 @@
1
- // @bun
2
- var __create = Object.create;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- function __accessProp(key) {
8
- return this[key];
9
- }
10
- var __reExport = (target, mod, secondTarget) => {
11
- var keys = __getOwnPropNames(mod);
12
- for (let key of keys)
13
- if (!__hasOwnProp.call(target, key) && key !== "default")
14
- __defProp(target, key, {
15
- get: __accessProp.bind(mod, key),
16
- enumerable: true
17
- });
18
- if (secondTarget) {
19
- for (let key of keys)
20
- if (!__hasOwnProp.call(secondTarget, key) && key !== "default")
21
- __defProp(secondTarget, key, {
22
- get: __accessProp.bind(mod, key),
23
- enumerable: true
24
- });
25
- return secondTarget;
26
- }
27
- };
28
- var __toESMCache_node;
29
- var __toESMCache_esm;
30
- var __toESM = (mod, isNodeMode, target) => {
31
- var canCache = mod != null && typeof mod === "object";
32
- if (canCache) {
33
- var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
34
- var cached = cache.get(mod);
35
- if (cached)
36
- return cached;
37
- }
38
- target = mod != null ? __create(__getProtoOf(mod)) : {};
39
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
40
- for (let key of __getOwnPropNames(mod))
41
- if (!__hasOwnProp.call(to, key))
42
- __defProp(to, key, {
43
- get: __accessProp.bind(mod, key),
44
- enumerable: true
45
- });
46
- if (canCache)
47
- cache.set(mod, to);
48
- return to;
49
- };
50
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
51
- var __returnValue = (v) => v;
52
- function __exportSetter(name, newValue) {
53
- this[name] = __returnValue.bind(null, newValue);
54
- }
55
- var __export = (target, all) => {
56
- for (var name in all)
57
- __defProp(target, name, {
58
- get: all[name],
59
- enumerable: true,
60
- configurable: true,
61
- set: __exportSetter.bind(all, name)
62
- });
63
- };
64
- var __require = import.meta.require;
65
-
66
- export { __reExport, __toESM, __commonJS, __export, __require };
67
-
68
- //# debugId=3EB09234C00A422464756E2164756E21
@@ -1,229 +0,0 @@
1
- // @bun
2
- import {
3
- readJsonFile,
4
- readJsonFileSync
5
- } from "./cli-ccax7s0s.js";
6
-
7
- // ../wp-typia-project-tools/src/runtime/cli-add-workspace-admin-view-types.ts
8
- var ADMIN_VIEW_REST_SOURCE_KIND = "rest-resource";
9
- var ADMIN_VIEW_CORE_DATA_SOURCE_KIND = "core-data";
10
- var ADMIN_VIEW_CORE_DATA_ENTITY_KIND_IDS = [
11
- "postType",
12
- "taxonomy"
13
- ];
14
- var ADMIN_VIEW_CORE_DATA_ENTITY_SEGMENT_PATTERN = /^[A-Za-z][A-Za-z0-9_-]*$/u;
15
- var ADMIN_VIEW_CORE_DATA_ENTITY_NAME_PATTERN = /^[a-z0-9][a-z0-9_-]*$/u;
16
- var ADMIN_VIEW_SOURCE_USAGE = "wp-typia add admin-view <name> --source <rest-resource:slug|core-data:kind/name>";
17
- var ADMIN_VIEWS_SCRIPT = "build/admin-views/index.js";
18
- var ADMIN_VIEWS_ASSET = "build/admin-views/index.asset.php";
19
- var ADMIN_VIEWS_STYLE = "build/admin-views/style-index.css";
20
- var ADMIN_VIEWS_STYLE_RTL = "build/admin-views/style-index-rtl.css";
21
- var ADMIN_VIEWS_PHP_GLOB = "/inc/admin-views/*.php";
22
- var ADMIN_VIEW_MANUAL_REST_ROUTE_PARAMETER_PATTERN = /(?:^|[^\\])\(/u;
23
- function isAdminViewCoreDataSource(source) {
24
- return source?.kind === ADMIN_VIEW_CORE_DATA_SOURCE_KIND;
25
- }
26
- function isAdminViewRestResourceSource(source) {
27
- return source?.kind === ADMIN_VIEW_REST_SOURCE_KIND;
28
- }
29
- function isAdminViewManualSettingsRestResource(restResource) {
30
- return restResource?.mode === "manual" && typeof restResource.bodyTypeName === "string" && restResource.bodyTypeName.trim().length > 0 && typeof restResource.queryTypeName === "string" && restResource.queryTypeName.trim().length > 0 && typeof restResource.responseTypeName === "string" && restResource.responseTypeName.trim().length > 0;
31
- }
32
- function hasAdminViewManualSettingsRouteParameters(restResource) {
33
- return [restResource?.pathPattern, restResource?.routePattern].some((pattern) => typeof pattern === "string" && ADMIN_VIEW_MANUAL_REST_ROUTE_PARAMETER_PATTERN.test(pattern));
34
- }
35
- function formatAdminViewSourceLocator(source) {
36
- if (isAdminViewCoreDataSource(source)) {
37
- return `${source.kind}:${source.entityKind}/${source.entityName}`;
38
- }
39
- return `${source.kind}:${source.slug}`;
40
- }
41
-
42
- // ../wp-typia-project-tools/src/runtime/post-meta-binding-fields.ts
43
- import path from "path";
44
- var SUPPORTED_SCHEMA_TYPES = new Set([
45
- "array",
46
- "boolean",
47
- "integer",
48
- "number",
49
- "object",
50
- "string"
51
- ]);
52
- function isJsonRecord(value) {
53
- return typeof value === "object" && value !== null && !Array.isArray(value);
54
- }
55
- function resolveSchemaType(schema) {
56
- const type = schema.type;
57
- if (typeof type === "string" && SUPPORTED_SCHEMA_TYPES.has(type)) {
58
- return type;
59
- }
60
- if (Array.isArray(type) && type.every((entry) => typeof entry === "string")) {
61
- const nonNullType = type.find((entry) => entry !== "null" && SUPPORTED_SCHEMA_TYPES.has(entry));
62
- if (nonNullType) {
63
- return nonNullType;
64
- }
65
- }
66
- if (Array.isArray(schema.enum) && schema.enum.length > 0) {
67
- return "string";
68
- }
69
- return "unknown";
70
- }
71
- function resolveFallbackValue(name, schema, schemaType) {
72
- const enumValue = Array.isArray(schema.enum) ? schema.enum.find((entry) => typeof entry === "string") : undefined;
73
- if (typeof enumValue === "string") {
74
- return enumValue;
75
- }
76
- switch (schemaType) {
77
- case "array":
78
- return "[]";
79
- case "boolean":
80
- return "false";
81
- case "integer":
82
- case "number":
83
- return "0";
84
- case "object":
85
- return "{}";
86
- default:
87
- return `${name} preview`;
88
- }
89
- }
90
- function resolveFieldLabel(name) {
91
- return name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (match) => match.toUpperCase());
92
- }
93
- function extractPostMetaBindingFields(schema, context) {
94
- if (!isJsonRecord(schema) || !isJsonRecord(schema.properties)) {
95
- throw new Error(`${context} must expose an object schema with top-level properties before it can back a binding source.`);
96
- }
97
- const required = Array.isArray(schema.required) ? new Set(schema.required.filter((entry) => typeof entry === "string")) : new Set;
98
- const fields = Object.entries(schema.properties).map(([name, propertySchema]) => {
99
- const property = isJsonRecord(propertySchema) ? propertySchema : {};
100
- const schemaType = resolveSchemaType(property);
101
- return {
102
- fallbackValue: resolveFallbackValue(name, property, schemaType),
103
- label: resolveFieldLabel(name),
104
- name,
105
- required: required.has(name),
106
- schemaType
107
- };
108
- });
109
- if (fields.length === 0) {
110
- throw new Error(`${context} does not expose any top-level properties that can back binding fields.`);
111
- }
112
- return fields;
113
- }
114
- async function loadPostMetaBindingFields(projectDir, postMeta) {
115
- const schemaPath = path.join(projectDir, postMeta.schemaFile);
116
- const schema = await readJsonFile(schemaPath, {
117
- context: `post meta schema for ${postMeta.slug}`
118
- });
119
- return extractPostMetaBindingFields(schema, postMeta.schemaFile);
120
- }
121
- function loadPostMetaBindingFieldsSync(projectDir, postMeta) {
122
- const schemaPath = path.join(projectDir, postMeta.schemaFile);
123
- const schema = readJsonFileSync(schemaPath, {
124
- context: `post meta schema for ${postMeta.slug}`
125
- });
126
- return extractPostMetaBindingFields(schema, postMeta.schemaFile);
127
- }
128
- function assertPostMetaBindingPath(fields, postMetaSlug, metaPath) {
129
- const trimmed = metaPath.trim();
130
- if (!trimmed) {
131
- throw new Error("Post meta binding path must include a value.");
132
- }
133
- if (trimmed.includes(".")) {
134
- throw new Error(`Nested post meta path "${trimmed}" for "${postMetaSlug}" is not supported yet. Use one of the top-level fields: ${fields.map((field2) => field2.name).join(", ")}.`);
135
- }
136
- const field = fields.find((candidate) => candidate.name === trimmed);
137
- if (!field) {
138
- throw new Error(`Post meta path "${trimmed}" does not exist in the "${postMetaSlug}" schema. Expected one of: ${fields.map((candidate) => candidate.name).join(", ")}.`);
139
- }
140
- return field;
141
- }
142
-
143
- // ../wp-typia-project-tools/src/runtime/ts-source-masking.ts
144
- function maskSourceSegment(segment) {
145
- return segment.replace(/[^\n\r]/gu, " ");
146
- }
147
- function testPattern(source, pattern) {
148
- pattern.lastIndex = 0;
149
- const matched = pattern.test(source);
150
- pattern.lastIndex = 0;
151
- return matched;
152
- }
153
- function maskTypeScriptComments(source) {
154
- return source.replace(/\/\*[\s\S]*?\*\//gu, maskSourceSegment).replace(/\/\/[^\n\r]*/gu, maskSourceSegment);
155
- }
156
- function maskTypeScriptCommentsAndLiterals(source) {
157
- let maskedSource = "";
158
- let index = 0;
159
- while (index < source.length) {
160
- const current = source[index];
161
- const next = source[index + 1];
162
- if (current === "/" && next === "/") {
163
- const start = index;
164
- index += 2;
165
- while (index < source.length && source[index] !== `
166
- ` && source[index] !== "\r") {
167
- index += 1;
168
- }
169
- maskedSource += maskSourceSegment(source.slice(start, index));
170
- continue;
171
- }
172
- if (current === "/" && next === "*") {
173
- const start = index;
174
- index += 2;
175
- while (index < source.length && !(source[index] === "*" && source[index + 1] === "/")) {
176
- index += 1;
177
- }
178
- index = Math.min(index + 2, source.length);
179
- maskedSource += maskSourceSegment(source.slice(start, index));
180
- continue;
181
- }
182
- if (current === "'" || current === '"' || current === "`") {
183
- const start = index;
184
- const quote = current;
185
- index += 1;
186
- while (index < source.length) {
187
- const char = source[index];
188
- if (char === "\\") {
189
- index += 2;
190
- continue;
191
- }
192
- index += 1;
193
- if (char === quote) {
194
- break;
195
- }
196
- }
197
- maskedSource += maskSourceSegment(source.slice(start, index));
198
- continue;
199
- }
200
- maskedSource += current;
201
- index += 1;
202
- }
203
- return maskedSource;
204
- }
205
- function hasExecutablePattern(source, pattern) {
206
- return testPattern(maskTypeScriptCommentsAndLiterals(source), pattern);
207
- }
208
- function hasUncommentedPattern(source, pattern) {
209
- return testPattern(maskTypeScriptComments(source), pattern);
210
- }
211
- function findExecutablePatternMatch(source, patterns) {
212
- const maskedSource = maskTypeScriptCommentsAndLiterals(source);
213
- for (const pattern of patterns) {
214
- pattern.lastIndex = 0;
215
- const match = pattern.exec(maskedSource);
216
- pattern.lastIndex = 0;
217
- if (match && match.index !== undefined) {
218
- return {
219
- end: match.index + match[0].length,
220
- start: match.index
221
- };
222
- }
223
- }
224
- return;
225
- }
226
-
227
- export { ADMIN_VIEW_REST_SOURCE_KIND, ADMIN_VIEW_CORE_DATA_SOURCE_KIND, ADMIN_VIEW_CORE_DATA_ENTITY_KIND_IDS, ADMIN_VIEW_CORE_DATA_ENTITY_SEGMENT_PATTERN, ADMIN_VIEW_CORE_DATA_ENTITY_NAME_PATTERN, ADMIN_VIEW_SOURCE_USAGE, ADMIN_VIEWS_SCRIPT, ADMIN_VIEWS_ASSET, ADMIN_VIEWS_STYLE, ADMIN_VIEWS_STYLE_RTL, ADMIN_VIEWS_PHP_GLOB, isAdminViewCoreDataSource, isAdminViewRestResourceSource, isAdminViewManualSettingsRestResource, hasAdminViewManualSettingsRouteParameters, formatAdminViewSourceLocator, loadPostMetaBindingFields, loadPostMetaBindingFieldsSync, assertPostMetaBindingPath, maskTypeScriptCommentsAndLiterals, hasExecutablePattern, hasUncommentedPattern, findExecutablePatternMatch };
228
-
229
- //# debugId=088B083477FD04FF64756E2164756E21