@wp-typia/project-tools 0.24.11 → 0.24.13

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 (72) hide show
  1. package/dist/runtime/add/cli-add-block-config.js +7 -15
  2. package/dist/runtime/add/cli-add-block-package-json.d.ts +5 -0
  3. package/dist/runtime/add/cli-add-block-package-json.js +32 -0
  4. package/dist/runtime/add/cli-add-block.js +17 -4
  5. package/dist/runtime/add/cli-add-workspace-admin-view-scaffold.js +1 -5
  6. package/dist/runtime/add/cli-add-workspace-hooked-block.js +15 -20
  7. package/dist/runtime/add/cli-add-workspace-mutation.d.ts +15 -2
  8. package/dist/runtime/add/cli-add-workspace-mutation.js +10 -4
  9. package/dist/runtime/add/persistence-rest-artifacts.d.ts +32 -7
  10. package/dist/runtime/add/persistence-rest-artifacts.js +41 -15
  11. package/dist/runtime/cli/cli-diagnostics.d.ts +9 -0
  12. package/dist/runtime/cli/cli-diagnostics.js +8 -0
  13. package/dist/runtime/cli/cli-init-package-json.js +5 -1
  14. package/dist/runtime/doctor/cli-doctor-standalone-control-flow.d.ts +38 -0
  15. package/dist/runtime/doctor/cli-doctor-standalone-control-flow.js +365 -0
  16. package/dist/runtime/doctor/cli-doctor-standalone-rest.d.ts +21 -0
  17. package/dist/runtime/doctor/cli-doctor-standalone-rest.js +1354 -0
  18. package/dist/runtime/doctor/cli-doctor-standalone-shared.d.ts +24 -0
  19. package/dist/runtime/doctor/cli-doctor-standalone-shared.js +50 -0
  20. package/dist/runtime/doctor/cli-doctor-standalone.d.ts +32 -0
  21. package/dist/runtime/doctor/cli-doctor-standalone.js +2594 -0
  22. package/dist/runtime/doctor/cli-doctor-workspace.d.ts +5 -3
  23. package/dist/runtime/doctor/cli-doctor-workspace.js +27 -3
  24. package/dist/runtime/doctor/cli-doctor.d.ts +4 -2
  25. package/dist/runtime/doctor/cli-doctor.js +4 -2
  26. package/dist/runtime/shared/json-utils.d.ts +7 -0
  27. package/dist/runtime/shared/json-utils.js +10 -0
  28. package/dist/runtime/shared/package-json-types.d.ts +1 -1
  29. package/dist/runtime/shared/package-versions.d.ts +2 -0
  30. package/dist/runtime/shared/package-versions.js +2 -0
  31. package/dist/runtime/shared/php-utils.d.ts +39 -2
  32. package/dist/runtime/shared/php-utils.js +205 -6
  33. package/dist/runtime/templates/block-generator-service-core.d.ts +1 -1
  34. package/dist/runtime/templates/block-generator-service-core.js +9 -3
  35. package/dist/runtime/templates/block-generator-service-spec.d.ts +5 -0
  36. package/dist/runtime/templates/built-in-block-artifact-documents.d.ts +1 -1
  37. package/dist/runtime/templates/built-in-block-artifact-documents.js +1 -1
  38. package/dist/runtime/templates/built-in-block-artifact-types.js +2 -2
  39. package/dist/runtime/templates/built-in-block-artifacts.d.ts +1 -1
  40. package/dist/runtime/templates/built-in-block-artifacts.js +16 -12
  41. package/dist/runtime/templates/built-in-block-attribute-emitters.d.ts +5 -0
  42. package/dist/runtime/templates/built-in-block-attribute-emitters.js +113 -8
  43. package/dist/runtime/templates/built-in-block-attribute-specs.js +4 -9
  44. package/dist/runtime/templates/built-in-block-code-artifacts.js +6 -1
  45. package/dist/runtime/templates/built-in-block-code-templates/compound-persistence.d.ts +2 -2
  46. package/dist/runtime/templates/built-in-block-code-templates/compound-persistence.js +24 -1
  47. package/dist/runtime/templates/built-in-block-code-templates/persistence.d.ts +2 -2
  48. package/dist/runtime/templates/built-in-block-code-templates/persistence.js +22 -1
  49. package/dist/runtime/templates/built-in-block-non-ts-compound-templates.d.ts +2 -2
  50. package/dist/runtime/templates/built-in-block-non-ts-compound-templates.js +6 -2
  51. package/dist/runtime/templates/built-in-block-non-ts-persistence-templates.d.ts +2 -2
  52. package/dist/runtime/templates/built-in-block-non-ts-persistence-templates.js +6 -2
  53. package/dist/runtime/templates/cli-scaffold-emission.d.ts +7 -1
  54. package/dist/runtime/templates/cli-scaffold-emission.js +10 -1
  55. package/dist/runtime/templates/cli-templates.d.ts +47 -0
  56. package/dist/runtime/templates/cli-templates.js +50 -1
  57. package/dist/runtime/templates/local-dev-presets.js +1 -1
  58. package/dist/runtime/templates/scaffold-apply-utils.d.ts +4 -8
  59. package/dist/runtime/templates/scaffold-apply-utils.js +44 -28
  60. package/dist/runtime/templates/scaffold-compiler-artifacts.d.ts +17 -0
  61. package/dist/runtime/templates/scaffold-compiler-artifacts.js +81 -0
  62. package/dist/runtime/templates/scaffold-onboarding.d.ts +5 -0
  63. package/dist/runtime/templates/scaffold-onboarding.js +13 -2
  64. package/dist/runtime/templates/scaffold-template-variable-groups.d.ts +4 -0
  65. package/dist/runtime/templates/scaffold-template-variable-groups.js +7 -0
  66. package/dist/runtime/templates/scaffold.d.ts +3 -1
  67. package/dist/runtime/templates/scaffold.js +2 -1
  68. package/dist/runtime/templates/starter-manifests.js +1 -1
  69. package/package.json +5 -5
  70. package/templates/_shared/compound/core/scripts/add-compound-child.ts.mustache +1 -1
  71. package/templates/_shared/compound/persistence/package.json.mustache +1 -0
  72. package/templates/_shared/persistence/core/package.json.mustache +1 -0
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Detect TypeScript errors reported during isolated transpilation.
3
+ * This includes syntax errors and does not perform a full type check.
4
+ *
5
+ * @param source TypeScript source text to parse.
6
+ * @param fileName File name to associate with parser diagnostics.
7
+ * @returns Whether the source produces at least one error diagnostic.
8
+ */
9
+ export declare function hasTypeScriptSyntaxErrors(source: string, fileName: string): boolean;
10
+ /**
11
+ * Check whether a relative path stays within its project boundary.
12
+ *
13
+ * @param relativePath Relative path to validate.
14
+ * @returns Whether the path is non-empty, rootless, and does not escape upward.
15
+ */
16
+ export declare function isProjectLocalRelativePath(relativePath: string): boolean;
17
+ /**
18
+ * Check whether a file path resolves inside a project directory.
19
+ *
20
+ * @param projectDir Absolute project directory used as the resolution base.
21
+ * @param filePath Project-relative file path to validate.
22
+ * @returns Whether the resolved file path remains inside the project directory.
23
+ */
24
+ export declare function isSafeProjectRelativePath(projectDir: string, filePath: string): boolean;
@@ -0,0 +1,50 @@
1
+ import path from 'node:path';
2
+ import ts from 'typescript';
3
+ function hasFilesystemRoot(filePath) {
4
+ return (path.isAbsolute(filePath) || path.win32.parse(filePath).root.length > 0);
5
+ }
6
+ /**
7
+ * Detect TypeScript errors reported during isolated transpilation.
8
+ * This includes syntax errors and does not perform a full type check.
9
+ *
10
+ * @param source TypeScript source text to parse.
11
+ * @param fileName File name to associate with parser diagnostics.
12
+ * @returns Whether the source produces at least one error diagnostic.
13
+ */
14
+ export function hasTypeScriptSyntaxErrors(source, fileName) {
15
+ const result = ts.transpileModule(source, {
16
+ compilerOptions: { target: ts.ScriptTarget.Latest },
17
+ fileName,
18
+ reportDiagnostics: true,
19
+ });
20
+ return (result.diagnostics ?? []).some((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error);
21
+ }
22
+ /**
23
+ * Check whether a relative path stays within its project boundary.
24
+ *
25
+ * @param relativePath Relative path to validate.
26
+ * @returns Whether the path is non-empty, rootless, and does not escape upward.
27
+ */
28
+ export function isProjectLocalRelativePath(relativePath) {
29
+ if (relativePath.length === 0 || hasFilesystemRoot(relativePath)) {
30
+ return false;
31
+ }
32
+ return [path.posix, path.win32].every((pathApi) => {
33
+ const normalizedPath = pathApi.normalize(relativePath);
34
+ return (normalizedPath !== '..' &&
35
+ !normalizedPath.startsWith(`..${pathApi.sep}`));
36
+ });
37
+ }
38
+ /**
39
+ * Check whether a file path resolves inside a project directory.
40
+ *
41
+ * @param projectDir Absolute project directory used as the resolution base.
42
+ * @param filePath Project-relative file path to validate.
43
+ * @returns Whether the resolved file path remains inside the project directory.
44
+ */
45
+ export function isSafeProjectRelativePath(projectDir, filePath) {
46
+ if (!path.isAbsolute(projectDir) || hasFilesystemRoot(filePath)) {
47
+ return false;
48
+ }
49
+ return isProjectLocalRelativePath(path.relative(projectDir, path.resolve(projectDir, filePath)));
50
+ }
@@ -0,0 +1,32 @@
1
+ import type { DoctorCheck } from './cli-doctor.js';
2
+ import type { GeneratedPackageJson } from '../shared/package-json-types.js';
3
+ /** Stable codes emitted by standalone-scaffold doctor rows. */
4
+ export declare const STANDALONE_DOCTOR_CODES: {
5
+ readonly ARTIFACTS: "wp-typia.standalone.generated-artifacts";
6
+ readonly BOOTSTRAP: "wp-typia.standalone.bootstrap";
7
+ readonly DEPENDENCIES: "wp-typia.standalone.dependencies";
8
+ readonly PACKAGE: "wp-typia.standalone.package";
9
+ readonly SOURCE_LAYOUT: "wp-typia.standalone.source-layout";
10
+ };
11
+ type StandalonePackageJson = GeneratedPackageJson;
12
+ /** A safely detected type-derived standalone wp-typia block project. */
13
+ export interface StandaloneScaffoldProject {
14
+ packageJson: StandalonePackageJson;
15
+ packageName: string;
16
+ projectDir: string;
17
+ }
18
+ /**
19
+ * Resolve the nearest supported type-derived standalone scaffold.
20
+ *
21
+ * Detection deliberately combines generated sync/layout signals with wp-typia
22
+ * dependency signals. Requiring every signal would make a damaged scaffold
23
+ * fall back to the misleading environment-only scope, while the weighted
24
+ * threshold avoids treating an arbitrary WordPress package as generated merely
25
+ * because it contains one similarly named file or dependency.
26
+ *
27
+ * @throws {Error} When the nearest package manifest cannot be parsed.
28
+ */
29
+ export declare function tryResolveStandaloneScaffoldProject(startDir: string): StandaloneScaffoldProject | null;
30
+ /** Collect project-scoped checks for one supported standalone scaffold. */
31
+ export declare function getStandaloneScaffoldDoctorChecks(project: StandaloneScaffoldProject): Promise<DoctorCheck[]>;
32
+ export {};