@wp-typia/project-tools 0.22.6 → 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.
Files changed (47) hide show
  1. package/dist/runtime/block-targets.d.ts +40 -0
  2. package/dist/runtime/block-targets.js +71 -0
  3. package/dist/runtime/built-in-block-artifact-types.js +2 -1
  4. package/dist/runtime/built-in-block-attribute-specs.js +2 -1
  5. package/dist/runtime/built-in-block-code-artifacts.js +2 -0
  6. package/dist/runtime/built-in-block-non-ts-family-artifacts.js +12 -9
  7. package/dist/runtime/built-in-block-non-ts-render-utils.js +2 -0
  8. package/dist/runtime/cli-add-block-config.js +2 -1
  9. package/dist/runtime/cli-add-block-json.d.ts +2 -2
  10. package/dist/runtime/cli-add-block-json.js +5 -4
  11. package/dist/runtime/cli-add-block.js +4 -3
  12. package/dist/runtime/cli-add-workspace-ability-scaffold.js +21 -15
  13. package/dist/runtime/cli-add-workspace-ability.js +2 -2
  14. package/dist/runtime/cli-add-workspace-admin-view-scaffold.js +17 -13
  15. package/dist/runtime/cli-add-workspace-admin-view.js +2 -2
  16. package/dist/runtime/cli-add-workspace-ai.js +2 -2
  17. package/dist/runtime/cli-add-workspace-assets.js +42 -48
  18. package/dist/runtime/cli-add-workspace-rest.js +2 -2
  19. package/dist/runtime/cli-add-workspace.js +14 -49
  20. package/dist/runtime/cli-diagnostics.js +6 -0
  21. package/dist/runtime/cli-init-plan-presentation.d.ts +16 -0
  22. package/dist/runtime/cli-init-plan-presentation.js +74 -0
  23. package/dist/runtime/cli-init-plan.js +5 -77
  24. package/dist/runtime/cli-scaffold.js +2 -1
  25. package/dist/runtime/create-template-validation.d.ts +10 -0
  26. package/dist/runtime/create-template-validation.js +121 -0
  27. package/dist/runtime/package-versions.d.ts +1 -1
  28. package/dist/runtime/package-versions.js +16 -3
  29. package/dist/runtime/php-utils.js +151 -148
  30. package/dist/runtime/scaffold-answer-resolution.js +5 -108
  31. package/dist/runtime/scaffold-apply-utils.js +3 -2
  32. package/dist/runtime/scaffold-identifiers.js +4 -3
  33. package/dist/runtime/scaffold-template-assertions.d.ts +6 -0
  34. package/dist/runtime/scaffold-template-assertions.js +33 -0
  35. package/dist/runtime/scaffold-template-variable-groups.d.ts +2 -0
  36. package/dist/runtime/scaffold-template-variable-groups.js +7 -0
  37. package/dist/runtime/string-case.d.ts +2 -4
  38. package/dist/runtime/string-case.js +15 -4
  39. package/dist/runtime/template-source-cache-policy.d.ts +53 -0
  40. package/dist/runtime/template-source-cache-policy.js +135 -0
  41. package/dist/runtime/template-source-cache.d.ts +1 -45
  42. package/dist/runtime/template-source-cache.js +9 -152
  43. package/dist/runtime/ts-property-names.d.ts +11 -0
  44. package/dist/runtime/ts-property-names.js +16 -0
  45. package/dist/runtime/workspace-inventory.d.ts +13 -1
  46. package/dist/runtime/workspace-inventory.js +35 -9
  47. package/package.json +6 -1
@@ -179,13 +179,25 @@ type WorkspaceInventoryUpdateOptions = {
179
179
  */
180
180
  export declare function parseWorkspaceInventorySource(source: string): Omit<WorkspaceInventory, "blockConfigPath">;
181
181
  /**
182
- * Read and parse the canonical workspace inventory file.
182
+ * Synchronously read and parse the canonical workspace inventory file.
183
+ *
184
+ * This compatibility helper is intentionally sync-only for callers that expose
185
+ * synchronous APIs. Prefer `readWorkspaceInventoryAsync()` from async command
186
+ * paths so workspace reads do not block the event loop.
183
187
  *
184
188
  * @param projectDir Workspace root directory.
185
189
  * @returns Parsed `WorkspaceInventory` including the resolved `blockConfigPath`.
186
190
  * @throws {Error} When `scripts/block-config.ts` is missing or invalid.
187
191
  */
188
192
  export declare function readWorkspaceInventory(projectDir: string): WorkspaceInventory;
193
+ /**
194
+ * Asynchronously read and parse the canonical workspace inventory file.
195
+ *
196
+ * @param projectDir Workspace root directory.
197
+ * @returns Parsed `WorkspaceInventory` including the resolved `blockConfigPath`.
198
+ * @throws {Error} When `scripts/block-config.ts` is missing or invalid.
199
+ */
200
+ export declare function readWorkspaceInventoryAsync(projectDir: string): Promise<WorkspaceInventory>;
189
201
  /**
190
202
  * Return select options for the current workspace block inventory.
191
203
  *
@@ -1,9 +1,10 @@
1
- import fs from "node:fs";
1
+ import { readFileSync } from "node:fs";
2
2
  import path from "node:path";
3
3
  import { readFile, writeFile } from "node:fs/promises";
4
4
  import ts from "typescript";
5
5
  import { REST_RESOURCE_METHOD_IDS } from "./cli-add-shared.js";
6
6
  import { escapeRegex } from "./php-utils.js";
7
+ import { getPropertyNameText } from "./ts-property-names.js";
7
8
  function defineInventoryEntryParser(descriptor) {
8
9
  return descriptor;
9
10
  }
@@ -524,12 +525,6 @@ const INVENTORY_SECTIONS = [
524
525
  },
525
526
  },
526
527
  ];
527
- function getPropertyNameText(name) {
528
- if (ts.isIdentifier(name) || ts.isStringLiteral(name)) {
529
- return name.text;
530
- }
531
- return null;
532
- }
533
528
  function findExportedArrayLiteral(sourceFile, exportName) {
534
529
  for (const statement of sourceFile.statements) {
535
530
  if (!ts.isVariableStatement(statement)) {
@@ -705,7 +700,11 @@ export function parseWorkspaceInventorySource(source) {
705
700
  return parsedInventory;
706
701
  }
707
702
  /**
708
- * Read and parse the canonical workspace inventory file.
703
+ * Synchronously read and parse the canonical workspace inventory file.
704
+ *
705
+ * This compatibility helper is intentionally sync-only for callers that expose
706
+ * synchronous APIs. Prefer `readWorkspaceInventoryAsync()` from async command
707
+ * paths so workspace reads do not block the event loop.
709
708
  *
710
709
  * @param projectDir Workspace root directory.
711
710
  * @returns Parsed `WorkspaceInventory` including the resolved `blockConfigPath`.
@@ -715,7 +714,34 @@ export function readWorkspaceInventory(projectDir) {
715
714
  const blockConfigPath = path.join(projectDir, "scripts", "block-config.ts");
716
715
  let source;
717
716
  try {
718
- source = fs.readFileSync(blockConfigPath, "utf8");
717
+ source = readFileSync(blockConfigPath, "utf8");
718
+ }
719
+ catch (error) {
720
+ if (typeof error === "object" &&
721
+ error !== null &&
722
+ "code" in error &&
723
+ error.code === "ENOENT") {
724
+ throw new Error(`Workspace inventory file is missing at ${blockConfigPath}. Expected scripts/block-config.ts to exist.`);
725
+ }
726
+ throw error;
727
+ }
728
+ return {
729
+ blockConfigPath,
730
+ ...parseWorkspaceInventorySource(source),
731
+ };
732
+ }
733
+ /**
734
+ * Asynchronously read and parse the canonical workspace inventory file.
735
+ *
736
+ * @param projectDir Workspace root directory.
737
+ * @returns Parsed `WorkspaceInventory` including the resolved `blockConfigPath`.
738
+ * @throws {Error} When `scripts/block-config.ts` is missing or invalid.
739
+ */
740
+ export async function readWorkspaceInventoryAsync(projectDir) {
741
+ const blockConfigPath = path.join(projectDir, "scripts", "block-config.ts");
742
+ let source;
743
+ try {
744
+ source = await readFile(blockConfigPath, "utf8");
719
745
  }
720
746
  catch (error) {
721
747
  if (typeof error === "object" &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-typia/project-tools",
3
- "version": "0.22.6",
3
+ "version": "0.22.8",
4
4
  "description": "Project orchestration and programmatic tooling for wp-typia",
5
5
  "packageManager": "bun@1.3.11",
6
6
  "type": "module",
@@ -47,6 +47,11 @@
47
47
  "import": "./dist/runtime/cli-scaffold.js",
48
48
  "default": "./dist/runtime/cli-scaffold.js"
49
49
  },
50
+ "./create-template-validation": {
51
+ "types": "./dist/runtime/create-template-validation.d.ts",
52
+ "import": "./dist/runtime/create-template-validation.js",
53
+ "default": "./dist/runtime/create-template-validation.js"
54
+ },
50
55
  "./ai-artifacts": {
51
56
  "types": "./dist/runtime/ai-artifacts.d.ts",
52
57
  "import": "./dist/runtime/ai-artifacts.js",