@wp-typia/project-tools 0.15.0 → 0.15.2
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/runtime/cli-add.js +26 -70
- package/dist/runtime/cli-doctor.js +25 -9
- package/dist/runtime/cli-help.js +1 -0
- package/dist/runtime/cli-templates.js +10 -0
- package/dist/runtime/json-utils.d.ts +5 -8
- package/dist/runtime/json-utils.js +5 -10
- package/dist/runtime/metadata-analysis.d.ts +7 -11
- package/dist/runtime/metadata-analysis.js +7 -285
- package/dist/runtime/metadata-model.d.ts +7 -84
- package/dist/runtime/metadata-model.js +7 -59
- package/dist/runtime/metadata-parser.d.ts +5 -51
- package/dist/runtime/metadata-parser.js +5 -792
- package/dist/runtime/metadata-php-render.d.ts +5 -27
- package/dist/runtime/metadata-php-render.js +5 -547
- package/dist/runtime/metadata-projection.d.ts +7 -7
- package/dist/runtime/metadata-projection.js +7 -233
- package/dist/runtime/object-utils.d.ts +1 -1
- package/dist/runtime/object-utils.js +3 -6
- package/dist/runtime/persistence-rest-artifacts.d.ts +76 -0
- package/dist/runtime/persistence-rest-artifacts.js +99 -0
- package/dist/runtime/scaffold.d.ts +10 -2
- package/dist/runtime/scaffold.js +95 -1
- package/dist/runtime/template-builtins.js +1 -1
- package/dist/runtime/template-registry.d.ts +2 -1
- package/dist/runtime/template-registry.js +13 -2
- package/package.json +9 -8
- package/templates/_shared/compound/core/scripts/add-compound-child.ts.mustache +103 -7
- package/templates/_shared/persistence/core/src/api-validators.ts.mustache +14 -0
- package/templates/_shared/persistence/core/src/api.ts.mustache +28 -9
- package/templates/_shared/persistence/core/src/interactivity.ts.mustache +17 -11
- package/templates/interactivity/src/block.json.mustache +1 -0
- package/templates/interactivity/src/editor.scss.mustache +8 -0
- package/templates/interactivity/src/index.tsx.mustache +1 -0
- package/templates/persistence/src/edit.tsx.mustache +6 -6
|
@@ -1,59 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
maximum: null,
|
|
9
|
-
minLength: null,
|
|
10
|
-
minItems: null,
|
|
11
|
-
minimum: null,
|
|
12
|
-
multipleOf: null,
|
|
13
|
-
pattern: null,
|
|
14
|
-
typeTag: null,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export function getWordPressKind(node) {
|
|
18
|
-
return node.kind === "union" ? "object" : node.kind;
|
|
19
|
-
}
|
|
20
|
-
export function baseNode(kind, pathLabel) {
|
|
21
|
-
return {
|
|
22
|
-
constraints: defaultAttributeConstraints(),
|
|
23
|
-
enumValues: null,
|
|
24
|
-
kind,
|
|
25
|
-
path: pathLabel,
|
|
26
|
-
required: true,
|
|
27
|
-
union: null,
|
|
28
|
-
wp: {
|
|
29
|
-
selector: null,
|
|
30
|
-
source: null,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export function withRequired(node, required) {
|
|
35
|
-
return {
|
|
36
|
-
...node,
|
|
37
|
-
items: node.items
|
|
38
|
-
? withRequired(node.items, node.items.required)
|
|
39
|
-
: undefined,
|
|
40
|
-
properties: node.properties ? cloneProperties(node.properties) : undefined,
|
|
41
|
-
required,
|
|
42
|
-
union: node.union ? cloneUnion(node.union) : null,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export function cloneUnion(union) {
|
|
46
|
-
return {
|
|
47
|
-
branches: Object.fromEntries(Object.entries(union.branches).map(([key, branch]) => [
|
|
48
|
-
key,
|
|
49
|
-
withRequired(branch, branch.required),
|
|
50
|
-
])),
|
|
51
|
-
discriminator: union.discriminator,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
export function cloneProperties(properties) {
|
|
55
|
-
return Object.fromEntries(Object.entries(properties).map(([key, node]) => [
|
|
56
|
-
key,
|
|
57
|
-
withRequired(node, node.required),
|
|
58
|
-
]));
|
|
59
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports the metadata model types and helpers from `@wp-typia/block-runtime`.
|
|
3
|
+
* This adapter keeps the public project-tools runtime path stable while the
|
|
4
|
+
* implementation is consolidated in block-runtime.
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
export * from "@wp-typia/block-runtime/metadata-model";
|
|
@@ -1,53 +1,7 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { type AnalysisContext } from "./metadata-analysis.js";
|
|
3
|
-
import { type AttributeNode } from "./metadata-model.js";
|
|
4
1
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @returns The resolved project root plus the parsed root attribute node for
|
|
10
|
-
* the requested source type.
|
|
2
|
+
* Re-exports metadata parser utilities from `@wp-typia/block-runtime`.
|
|
3
|
+
* This adapter keeps the public project-tools runtime path stable while the
|
|
4
|
+
* implementation is consolidated in block-runtime.
|
|
5
|
+
* @module
|
|
11
6
|
*/
|
|
12
|
-
export
|
|
13
|
-
projectRoot?: string;
|
|
14
|
-
sourceTypeName: string;
|
|
15
|
-
typesFile: string;
|
|
16
|
-
}): {
|
|
17
|
-
projectRoot: string;
|
|
18
|
-
rootNode: AttributeNode;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Analyze multiple named source types from a TypeScript module.
|
|
22
|
-
*
|
|
23
|
-
* @param options Metadata analysis options including the optional project root
|
|
24
|
-
* and the relative types file path to parse.
|
|
25
|
-
* @param sourceTypeNames Exported type or interface names to resolve from the
|
|
26
|
-
* configured types file.
|
|
27
|
-
* @returns A record keyed by source type name with parsed attribute-node trees
|
|
28
|
-
* for each requested type.
|
|
29
|
-
*/
|
|
30
|
-
export declare function analyzeSourceTypes(options: {
|
|
31
|
-
projectRoot?: string;
|
|
32
|
-
typesFile: string;
|
|
33
|
-
}, sourceTypeNames: string[]): Record<string, AttributeNode>;
|
|
34
|
-
/**
|
|
35
|
-
* Parse an interface or type alias declaration into one attribute-node tree.
|
|
36
|
-
*
|
|
37
|
-
* @param declaration TypeScript declaration node to parse.
|
|
38
|
-
* @param ctx Shared analysis context used for type resolution and recursion
|
|
39
|
-
* detection.
|
|
40
|
-
* @param pathLabel Human-readable path label for diagnostics.
|
|
41
|
-
* @param required Whether the resulting node should be marked as required.
|
|
42
|
-
* @returns The parsed attribute-node representation for the declaration.
|
|
43
|
-
*/
|
|
44
|
-
export declare function parseNamedDeclaration(declaration: ts.InterfaceDeclaration | ts.TypeAliasDeclaration, ctx: AnalysisContext, pathLabel: string, required: boolean): AttributeNode;
|
|
45
|
-
/**
|
|
46
|
-
* Parse one TypeScript type node into the internal metadata model.
|
|
47
|
-
*
|
|
48
|
-
* @param node TypeScript AST node describing the source type shape.
|
|
49
|
-
* @param ctx Shared analysis context used for symbol and type resolution.
|
|
50
|
-
* @param pathLabel Human-readable path label used in parse errors and warnings.
|
|
51
|
-
* @returns The parsed attribute-node representation of the provided type node.
|
|
52
|
-
*/
|
|
53
|
-
export declare function parseTypeNode(node: ts.TypeNode, ctx: AnalysisContext, pathLabel: string): AttributeNode;
|
|
7
|
+
export * from "@wp-typia/block-runtime/metadata-parser";
|