@wp-typia/project-tools 0.23.1 → 0.24.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/runtime/built-in-block-non-ts-basic-artifacts.d.ts +9 -0
- package/dist/runtime/built-in-block-non-ts-basic-artifacts.js +84 -0
- package/dist/runtime/built-in-block-non-ts-compound-artifacts.d.ts +9 -0
- package/dist/runtime/built-in-block-non-ts-compound-artifacts.js +36 -0
- package/dist/runtime/built-in-block-non-ts-compound-templates.d.ts +23 -0
- package/dist/runtime/built-in-block-non-ts-compound-templates.js +453 -0
- package/dist/runtime/built-in-block-non-ts-family-artifacts.d.ts +8 -26
- package/dist/runtime/built-in-block-non-ts-family-artifacts.js +8 -1034
- package/dist/runtime/built-in-block-non-ts-interactivity-artifacts.d.ts +9 -0
- package/dist/runtime/built-in-block-non-ts-interactivity-artifacts.js +83 -0
- package/dist/runtime/built-in-block-non-ts-persistence-artifacts.d.ts +9 -0
- package/dist/runtime/built-in-block-non-ts-persistence-artifacts.js +33 -0
- package/dist/runtime/built-in-block-non-ts-persistence-templates.d.ts +23 -0
- package/dist/runtime/built-in-block-non-ts-persistence-templates.js +395 -0
- package/dist/runtime/cli-add-collision.js +8 -0
- package/dist/runtime/cli-add-help.js +10 -7
- package/dist/runtime/cli-add-kind-ids.d.ts +1 -1
- package/dist/runtime/cli-add-kind-ids.js +1 -0
- package/dist/runtime/cli-add-types.d.ts +28 -1
- package/dist/runtime/cli-add-types.js +2 -0
- package/dist/runtime/cli-add-workspace-ability-anchors.d.ts +24 -0
- package/dist/runtime/cli-add-workspace-ability-anchors.js +294 -0
- package/dist/runtime/cli-add-workspace-ability-registry.d.ts +10 -0
- package/dist/runtime/cli-add-workspace-ability-registry.js +51 -0
- package/dist/runtime/cli-add-workspace-ability-scaffold.d.ts +1 -1
- package/dist/runtime/cli-add-workspace-ability-scaffold.js +5 -311
- package/dist/runtime/cli-add-workspace-admin-view-scaffold.js +1 -1
- package/dist/runtime/cli-add-workspace-ai-anchors.d.ts +4 -4
- package/dist/runtime/cli-add-workspace-ai-anchors.js +4 -232
- package/dist/runtime/cli-add-workspace-ai-scaffold.js +4 -2
- package/dist/runtime/cli-add-workspace-ai-source-emitters.d.ts +1 -4
- package/dist/runtime/cli-add-workspace-ai-source-emitters.js +1 -145
- package/dist/runtime/cli-add-workspace-ai-sync-rest-anchors.d.ts +5 -0
- package/dist/runtime/cli-add-workspace-ai-sync-rest-anchors.js +236 -0
- package/dist/runtime/cli-add-workspace-ai-sync-script-source.d.ts +4 -0
- package/dist/runtime/cli-add-workspace-ai-sync-script-source.js +145 -0
- package/dist/runtime/cli-add-workspace-assets.d.ts +6 -63
- package/dist/runtime/cli-add-workspace-assets.js +6 -950
- package/dist/runtime/cli-add-workspace-binding-source-anchors.d.ts +23 -0
- package/dist/runtime/cli-add-workspace-binding-source-anchors.js +112 -0
- package/dist/runtime/cli-add-workspace-binding-source-source-emitters.d.ts +33 -0
- package/dist/runtime/cli-add-workspace-binding-source-source-emitters.js +436 -0
- package/dist/runtime/cli-add-workspace-binding-source-types.d.ts +20 -0
- package/dist/runtime/cli-add-workspace-binding-source-types.js +1 -0
- package/dist/runtime/cli-add-workspace-binding-source.d.ts +40 -0
- package/dist/runtime/cli-add-workspace-binding-source.js +275 -0
- package/dist/runtime/cli-add-workspace-block-style.d.ts +22 -0
- package/dist/runtime/cli-add-workspace-block-style.js +148 -0
- package/dist/runtime/cli-add-workspace-block-transform.d.ts +32 -0
- package/dist/runtime/cli-add-workspace-block-transform.js +197 -0
- package/dist/runtime/cli-add-workspace-contract.js +1 -1
- package/dist/runtime/cli-add-workspace-core-variation.d.ts +20 -0
- package/dist/runtime/cli-add-workspace-core-variation.js +322 -0
- package/dist/runtime/cli-add-workspace-editor-plugin-anchors.d.ts +37 -0
- package/dist/runtime/cli-add-workspace-editor-plugin-anchors.js +206 -0
- package/dist/runtime/cli-add-workspace-editor-plugin-source-emitters.d.ts +47 -0
- package/dist/runtime/cli-add-workspace-editor-plugin-source-emitters.js +219 -0
- package/dist/runtime/cli-add-workspace-editor-plugin.d.ts +22 -0
- package/dist/runtime/cli-add-workspace-editor-plugin.js +78 -0
- package/dist/runtime/cli-add-workspace-hooked-block.d.ts +23 -0
- package/dist/runtime/cli-add-workspace-hooked-block.js +57 -0
- package/dist/runtime/cli-add-workspace-integration-env-files.d.ts +33 -0
- package/dist/runtime/cli-add-workspace-integration-env-files.js +65 -0
- package/dist/runtime/cli-add-workspace-integration-env-package-json.d.ts +38 -0
- package/dist/runtime/cli-add-workspace-integration-env-package-json.js +122 -0
- package/dist/runtime/cli-add-workspace-integration-env-source-emitters.d.ts +44 -0
- package/dist/runtime/cli-add-workspace-integration-env-source-emitters.js +262 -0
- package/dist/runtime/cli-add-workspace-integration-env.js +5 -345
- package/dist/runtime/cli-add-workspace-pattern-anchors.d.ts +10 -0
- package/dist/runtime/cli-add-workspace-pattern-anchors.js +95 -0
- package/dist/runtime/cli-add-workspace-pattern-options.d.ts +20 -0
- package/dist/runtime/cli-add-workspace-pattern-options.js +113 -0
- package/dist/runtime/cli-add-workspace-pattern-source-emitters.d.ts +20 -0
- package/dist/runtime/cli-add-workspace-pattern-source-emitters.js +57 -0
- package/dist/runtime/cli-add-workspace-pattern.d.ts +42 -0
- package/dist/runtime/cli-add-workspace-pattern.js +99 -0
- package/dist/runtime/cli-add-workspace-post-meta.js +1 -1
- package/dist/runtime/cli-add-workspace-registration-hooks.d.ts +50 -0
- package/dist/runtime/cli-add-workspace-registration-hooks.js +162 -0
- package/dist/runtime/cli-add-workspace-rest-anchors.d.ts +6 -9
- package/dist/runtime/cli-add-workspace-rest-anchors.js +6 -466
- package/dist/runtime/cli-add-workspace-rest-bootstrap-anchors.d.ts +17 -0
- package/dist/runtime/cli-add-workspace-rest-bootstrap-anchors.js +108 -0
- package/dist/runtime/cli-add-workspace-rest-contract-sync-anchors.d.ts +9 -0
- package/dist/runtime/cli-add-workspace-rest-contract-sync-anchors.js +142 -0
- package/dist/runtime/cli-add-workspace-rest-generated-source-emitters.d.ts +51 -0
- package/dist/runtime/cli-add-workspace-rest-generated-source-emitters.js +415 -0
- package/dist/runtime/cli-add-workspace-rest-generated.js +5 -3
- package/dist/runtime/cli-add-workspace-rest-manual-source-emitters.d.ts +80 -0
- package/dist/runtime/cli-add-workspace-rest-manual-source-emitters.js +238 -0
- package/dist/runtime/cli-add-workspace-rest-manual.js +3 -16
- package/dist/runtime/cli-add-workspace-rest-php-templates.d.ts +1 -7
- package/dist/runtime/cli-add-workspace-rest-php-templates.js +3 -322
- package/dist/runtime/cli-add-workspace-rest-resource-php-routing-template.d.ts +33 -0
- package/dist/runtime/cli-add-workspace-rest-resource-php-routing-template.js +145 -0
- package/dist/runtime/cli-add-workspace-rest-resource-sync-anchors.d.ts +9 -0
- package/dist/runtime/cli-add-workspace-rest-resource-sync-anchors.js +162 -0
- package/dist/runtime/cli-add-workspace-rest-schema-helper-php-template.d.ts +7 -0
- package/dist/runtime/cli-add-workspace-rest-schema-helper-php-template.js +193 -0
- package/dist/runtime/cli-add-workspace-rest-source-emitters.d.ts +5 -99
- package/dist/runtime/cli-add-workspace-rest-source-emitters.js +5 -663
- package/dist/runtime/cli-add-workspace-rest-source-utils.d.ts +17 -0
- package/dist/runtime/cli-add-workspace-rest-source-utils.js +50 -0
- package/dist/runtime/cli-add-workspace-rest-sync-script-shared.d.ts +56 -0
- package/dist/runtime/cli-add-workspace-rest-sync-script-shared.js +122 -0
- package/dist/runtime/cli-add-workspace-rest-types.d.ts +3 -3
- package/dist/runtime/cli-add-workspace-variation.d.ts +22 -0
- package/dist/runtime/cli-add-workspace-variation.js +162 -0
- package/dist/runtime/cli-add-workspace.d.ts +42 -107
- package/dist/runtime/cli-add-workspace.js +42 -674
- package/dist/runtime/cli-add.d.ts +3 -3
- package/dist/runtime/cli-add.js +2 -2
- package/dist/runtime/cli-core.d.ts +2 -1
- package/dist/runtime/cli-core.js +1 -1
- package/dist/runtime/cli-doctor-workspace-bindings.js +59 -0
- package/dist/runtime/cli-doctor-workspace-block-addons.js +33 -5
- package/dist/runtime/cli-doctor.d.ts +2 -0
- package/dist/runtime/cli-doctor.js +13 -2
- package/dist/runtime/cli-help.js +6 -4
- package/dist/runtime/index.d.ts +5 -2
- package/dist/runtime/index.js +4 -2
- package/dist/runtime/local-dev-presets.js +2 -1
- package/dist/runtime/package-versions.d.ts +1 -0
- package/dist/runtime/package-versions.js +10 -2
- package/dist/runtime/pattern-catalog.d.ts +122 -0
- package/dist/runtime/pattern-catalog.js +471 -0
- package/dist/runtime/post-meta-binding-fields.d.ts +46 -0
- package/dist/runtime/post-meta-binding-fields.js +135 -0
- package/dist/runtime/typia-llm-json-schema.d.ts +24 -0
- package/dist/runtime/typia-llm-json-schema.js +33 -0
- package/dist/runtime/typia-llm-openapi-constraints.d.ts +20 -0
- package/dist/runtime/typia-llm-openapi-constraints.js +254 -0
- package/dist/runtime/typia-llm-projection.d.ts +25 -0
- package/dist/runtime/typia-llm-projection.js +58 -0
- package/dist/runtime/typia-llm-render.d.ts +21 -0
- package/dist/runtime/typia-llm-render.js +252 -0
- package/dist/runtime/typia-llm-sync.d.ts +10 -0
- package/dist/runtime/typia-llm-sync.js +63 -0
- package/dist/runtime/typia-llm-types.d.ts +197 -0
- package/dist/runtime/typia-llm-types.js +1 -0
- package/dist/runtime/typia-llm.d.ts +9 -255
- package/dist/runtime/typia-llm.js +5 -634
- package/dist/runtime/workspace-inventory-mutations.js +13 -0
- package/dist/runtime/workspace-inventory-section-descriptors.js +9 -1
- package/dist/runtime/workspace-inventory-templates.d.ts +2 -2
- package/dist/runtime/workspace-inventory-templates.js +9 -1
- package/dist/runtime/workspace-inventory-types.d.ts +9 -1
- package/package.json +8 -3
- package/templates/_shared/compound/core/scripts/block-config.ts.mustache +22 -0
- package/templates/_shared/compound/core/scripts/sync-types-to-block-json.ts.mustache +103 -2
- package/templates/_shared/compound/core/src/inner-blocks-templates.ts.mustache +13 -0
- package/templates/_shared/compound/persistence/scripts/block-config.ts.mustache +22 -1
|
@@ -23,9 +23,9 @@ export declare const BLOCK_STYLES_INTERFACE_SECTION = "\n\nexport interface Work
|
|
|
23
23
|
export declare const BLOCK_STYLES_CONST_SECTION = "\n\nexport const BLOCK_STYLES: WorkspaceBlockStyleConfig[] = [\n\t// wp-typia add style entries\n];\n";
|
|
24
24
|
export declare const BLOCK_TRANSFORMS_INTERFACE_SECTION = "\n\nexport interface WorkspaceBlockTransformConfig {\n\tblock: string;\n\tfile: string;\n\tfrom: string;\n\tslug: string;\n\tto: string;\n}\n";
|
|
25
25
|
export declare const BLOCK_TRANSFORMS_CONST_SECTION = "\n\nexport const BLOCK_TRANSFORMS: WorkspaceBlockTransformConfig[] = [\n\t// wp-typia add transform entries\n];\n";
|
|
26
|
-
export declare const PATTERNS_INTERFACE_SECTION = "\n\nexport interface WorkspacePatternConfig {\n\tfile
|
|
26
|
+
export declare const PATTERNS_INTERFACE_SECTION = "\n\nexport interface WorkspacePatternConfig {\n\tcontentFile?: string;\n\tfile?: string;\n\tscope?: 'full' | 'section';\n\tsectionRole?: string;\n\tslug: string;\n\ttags?: string[];\n\tthumbnailUrl?: string;\n\ttitle?: string;\n}\n";
|
|
27
27
|
export declare const PATTERNS_CONST_SECTION = "\n\nexport const PATTERNS: WorkspacePatternConfig[] = [\n\t// wp-typia add pattern entries\n];\n";
|
|
28
|
-
export declare const BINDING_SOURCES_INTERFACE_SECTION = "\n\nexport interface WorkspaceBindingSourceConfig {\n\tattribute?: string;\n\tblock?: string;\n\teditorFile: string;\n\tserverFile: string;\n\tslug: string;\n}\n";
|
|
28
|
+
export declare const BINDING_SOURCES_INTERFACE_SECTION = "\n\nexport interface WorkspaceBindingSourceConfig {\n\tattribute?: string;\n\tblock?: string;\n\teditorFile: string;\n\tmetaPath?: string;\n\tpostMeta?: string;\n\tserverFile: string;\n\tslug: string;\n}\n";
|
|
29
29
|
export declare const BINDING_SOURCES_CONST_SECTION = "\n\nexport const BINDING_SOURCES: WorkspaceBindingSourceConfig[] = [\n\t// wp-typia add binding-source entries\n];\n";
|
|
30
30
|
export declare const CONTRACTS_INTERFACE_SECTION = "\n\nexport interface WorkspaceContractConfig {\n\tschemaFile: string;\n\tslug: string;\n\tsourceTypeName: string;\n\ttypesFile: string;\n}\n";
|
|
31
31
|
export declare const CONTRACTS_CONST_SECTION = "\n\nexport const CONTRACTS: WorkspaceContractConfig[] = [\n\t// wp-typia add contract entries\n];\n";
|
|
@@ -64,8 +64,14 @@ export const BLOCK_TRANSFORMS: WorkspaceBlockTransformConfig[] = [
|
|
|
64
64
|
export const PATTERNS_INTERFACE_SECTION = `
|
|
65
65
|
|
|
66
66
|
export interface WorkspacePatternConfig {
|
|
67
|
-
\
|
|
67
|
+
\tcontentFile?: string;
|
|
68
|
+
\tfile?: string;
|
|
69
|
+
\tscope?: 'full' | 'section';
|
|
70
|
+
\tsectionRole?: string;
|
|
68
71
|
\tslug: string;
|
|
72
|
+
\ttags?: string[];
|
|
73
|
+
\tthumbnailUrl?: string;
|
|
74
|
+
\ttitle?: string;
|
|
69
75
|
}
|
|
70
76
|
`;
|
|
71
77
|
export const PATTERNS_CONST_SECTION = `
|
|
@@ -80,6 +86,8 @@ export interface WorkspaceBindingSourceConfig {
|
|
|
80
86
|
\tattribute?: string;
|
|
81
87
|
\tblock?: string;
|
|
82
88
|
\teditorFile: string;
|
|
89
|
+
\tmetaPath?: string;
|
|
90
|
+
\tpostMeta?: string;
|
|
83
91
|
\tserverFile: string;
|
|
84
92
|
\tslug: string;
|
|
85
93
|
}
|
|
@@ -23,13 +23,21 @@ export interface WorkspaceBlockTransformInventoryEntry {
|
|
|
23
23
|
to: string;
|
|
24
24
|
}
|
|
25
25
|
export interface WorkspacePatternInventoryEntry {
|
|
26
|
-
|
|
26
|
+
contentFile?: string;
|
|
27
|
+
file?: string;
|
|
28
|
+
scope?: string;
|
|
29
|
+
sectionRole?: string;
|
|
27
30
|
slug: string;
|
|
31
|
+
tags?: string[];
|
|
32
|
+
thumbnailUrl?: string;
|
|
33
|
+
title?: string;
|
|
28
34
|
}
|
|
29
35
|
export interface WorkspaceBindingSourceInventoryEntry {
|
|
30
36
|
attribute?: string;
|
|
31
37
|
block?: string;
|
|
32
38
|
editorFile: string;
|
|
39
|
+
metaPath?: string;
|
|
40
|
+
postMeta?: string;
|
|
33
41
|
serverFile: string;
|
|
34
42
|
slug: string;
|
|
35
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-typia/project-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Project orchestration and programmatic tooling for wp-typia",
|
|
5
5
|
"packageManager": "bun@1.3.11",
|
|
6
6
|
"type": "module",
|
|
@@ -92,6 +92,11 @@
|
|
|
92
92
|
"import": "./dist/runtime/package-managers.js",
|
|
93
93
|
"default": "./dist/runtime/package-managers.js"
|
|
94
94
|
},
|
|
95
|
+
"./pattern-catalog": {
|
|
96
|
+
"types": "./dist/runtime/pattern-catalog.d.ts",
|
|
97
|
+
"import": "./dist/runtime/pattern-catalog.js",
|
|
98
|
+
"default": "./dist/runtime/pattern-catalog.js"
|
|
99
|
+
},
|
|
95
100
|
"./schema-core": {
|
|
96
101
|
"types": "./dist/runtime/schema-core.d.ts",
|
|
97
102
|
"import": "./dist/runtime/schema-core.js",
|
|
@@ -161,9 +166,9 @@
|
|
|
161
166
|
},
|
|
162
167
|
"dependencies": {
|
|
163
168
|
"@wp-typia/api-client": "^0.4.5",
|
|
164
|
-
"@wp-typia/block-runtime": "^0.
|
|
169
|
+
"@wp-typia/block-runtime": "^0.7.0",
|
|
165
170
|
"@wp-typia/rest": "^0.3.13",
|
|
166
|
-
"@wp-typia/block-types": "^0.
|
|
171
|
+
"@wp-typia/block-types": "^0.3.0",
|
|
167
172
|
"mustache": "^4.2.0",
|
|
168
173
|
"npm-package-arg": "^13.0.0",
|
|
169
174
|
"semver": "^7.7.3",
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineBlockNesting,
|
|
3
|
+
defineInnerBlocksTemplates,
|
|
4
|
+
} from '@wp-typia/block-runtime/metadata-core';
|
|
5
|
+
|
|
6
|
+
export const BLOCK_NESTING = defineBlockNesting( {
|
|
7
|
+
// Add parent, ancestor, and allowedBlocks relationships here.
|
|
8
|
+
} );
|
|
9
|
+
|
|
10
|
+
export const BLOCK_TEMPLATES = defineInnerBlocksTemplates( {
|
|
11
|
+
// Add default InnerBlocks templates here.
|
|
12
|
+
} );
|
|
13
|
+
|
|
14
|
+
export interface WorkspacePatternConfig {
|
|
15
|
+
file: string;
|
|
16
|
+
slug: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
1
19
|
export const BLOCKS = [
|
|
2
20
|
{
|
|
3
21
|
attributeTypeName: '{{pascalCase}}Attributes',
|
|
@@ -11,3 +29,7 @@ export const BLOCKS = [
|
|
|
11
29
|
},
|
|
12
30
|
// add-child: insert new block config entries here
|
|
13
31
|
] as const;
|
|
32
|
+
|
|
33
|
+
export const PATTERNS: WorkspacePatternConfig[] = [
|
|
34
|
+
// wp-typia add pattern entries
|
|
35
|
+
];
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
+
import fs from 'node:fs';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
formatBlockPatternContentNestingDiagnostics,
|
|
7
|
+
validateBlockPatternContentNesting,
|
|
8
|
+
syncInnerBlocksTemplateModule,
|
|
9
|
+
syncBlockMetadata,
|
|
10
|
+
validateBlockNestingContract,
|
|
11
|
+
validateInnerBlocksTemplates,
|
|
12
|
+
} from '@wp-typia/block-runtime/metadata-core';
|
|
5
13
|
|
|
6
|
-
import { BLOCKS } from './block-config';
|
|
14
|
+
import { BLOCK_NESTING, BLOCK_TEMPLATES, BLOCKS, PATTERNS } from './block-config';
|
|
7
15
|
|
|
8
16
|
function parseCliOptions( argv: string[] ) {
|
|
9
17
|
const options = {
|
|
@@ -22,15 +30,108 @@ function parseCliOptions( argv: string[] ) {
|
|
|
22
30
|
return options;
|
|
23
31
|
}
|
|
24
32
|
|
|
33
|
+
function readWorkspaceBlockName( block: ( typeof BLOCKS )[ number ] ): string {
|
|
34
|
+
const blockJsonFile = path.join( 'src', 'blocks', block.slug, 'block.json' );
|
|
35
|
+
let blockJson: { name?: unknown };
|
|
36
|
+
try {
|
|
37
|
+
blockJson = JSON.parse( fs.readFileSync( blockJsonFile, 'utf8' ) ) as {
|
|
38
|
+
name?: unknown;
|
|
39
|
+
};
|
|
40
|
+
} catch ( error ) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`Failed to read block.json for block "${ block.slug }" at ${ blockJsonFile }: ${
|
|
43
|
+
error instanceof Error ? error.message : String( error )
|
|
44
|
+
}`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
if ( typeof blockJson.name !== 'string' || blockJson.name.trim() === '' ) {
|
|
48
|
+
throw new Error( `${ blockJsonFile } must define a string "name".` );
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return blockJson.name;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function readPatternFileContent( pattern: ( typeof PATTERNS )[ number ] ): string {
|
|
55
|
+
try {
|
|
56
|
+
return fs.readFileSync( pattern.file, 'utf8' );
|
|
57
|
+
} catch ( error ) {
|
|
58
|
+
throw new Error(
|
|
59
|
+
`Failed to read pattern "${ pattern.slug }" at ${ pattern.file }: ${
|
|
60
|
+
error instanceof Error ? error.message : String( error )
|
|
61
|
+
}`
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function validatePatternContentNesting( knownBlockNames: readonly string[] ) {
|
|
67
|
+
const diagnostics = PATTERNS.flatMap( ( pattern ) => {
|
|
68
|
+
const content = readPatternFileContent( pattern );
|
|
69
|
+
return validateBlockPatternContentNesting( content, {
|
|
70
|
+
allowExternalBlockNames: true,
|
|
71
|
+
knownBlockNames,
|
|
72
|
+
nesting: BLOCK_NESTING,
|
|
73
|
+
patternFile: pattern.file,
|
|
74
|
+
} ).diagnostics;
|
|
75
|
+
} );
|
|
76
|
+
const warnings = diagnostics.filter(
|
|
77
|
+
( diagnostic ) => diagnostic.severity === 'warning'
|
|
78
|
+
);
|
|
79
|
+
const errors = diagnostics.filter(
|
|
80
|
+
( diagnostic ) => diagnostic.severity === 'error'
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
if ( warnings.length > 0 ) {
|
|
84
|
+
console.warn(
|
|
85
|
+
`⚠️ Pattern nesting validation warnings:\n${ formatBlockPatternContentNestingDiagnostics(
|
|
86
|
+
warnings
|
|
87
|
+
) }`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if ( errors.length > 0 ) {
|
|
92
|
+
throw new Error(
|
|
93
|
+
`Pattern content violates block nesting contract:\n${ formatBlockPatternContentNestingDiagnostics(
|
|
94
|
+
errors
|
|
95
|
+
) }`
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
25
100
|
async function main() {
|
|
26
101
|
const options = parseCliOptions( process.argv.slice( 2 ) );
|
|
102
|
+
const knownBlockNames = BLOCKS.map( readWorkspaceBlockName );
|
|
103
|
+
validateBlockNestingContract( BLOCK_NESTING, {
|
|
104
|
+
allowExternalBlockNames: true,
|
|
105
|
+
knownBlockNames,
|
|
106
|
+
} );
|
|
107
|
+
validateInnerBlocksTemplates( BLOCK_TEMPLATES, {
|
|
108
|
+
allowExternalBlockNames: true,
|
|
109
|
+
knownBlockNames,
|
|
110
|
+
nesting: BLOCK_NESTING,
|
|
111
|
+
} );
|
|
112
|
+
validatePatternContentNesting( knownBlockNames );
|
|
113
|
+
await syncInnerBlocksTemplateModule(
|
|
114
|
+
{
|
|
115
|
+
allowExternalBlockNames: true,
|
|
116
|
+
knownBlockNames,
|
|
117
|
+
nesting: BLOCK_NESTING,
|
|
118
|
+
outputFile: path.join( 'src', 'inner-blocks-templates.ts' ),
|
|
119
|
+
templates: BLOCK_TEMPLATES,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
check: options.check,
|
|
123
|
+
}
|
|
124
|
+
);
|
|
27
125
|
|
|
28
126
|
for ( const block of BLOCKS ) {
|
|
29
127
|
const baseDir = path.join( 'src', 'blocks', block.slug );
|
|
30
128
|
const result = await syncBlockMetadata( {
|
|
129
|
+
allowExternalBlockNames: true,
|
|
31
130
|
blockJsonFile: path.join( baseDir, 'block.json' ),
|
|
32
131
|
jsonSchemaFile: path.join( baseDir, 'typia.schema.json' ),
|
|
132
|
+
knownBlockNames,
|
|
33
133
|
manifestFile: path.join( baseDir, 'typia.manifest.json' ),
|
|
134
|
+
nesting: BLOCK_NESTING,
|
|
34
135
|
openApiFile: path.join( baseDir, 'typia.openapi.json' ),
|
|
35
136
|
sourceTypeName: block.attributeTypeName,
|
|
36
137
|
typesFile: block.typesFile,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* This file is generated by wp-typia. Do not edit manually. */
|
|
2
|
+
|
|
3
|
+
export type WpTypiaInnerBlocksTemplateAttributes = Record<string, unknown>;
|
|
4
|
+
export type WpTypiaInnerBlocksTemplateItem = [
|
|
5
|
+
blockName: string,
|
|
6
|
+
attributes?: WpTypiaInnerBlocksTemplateAttributes,
|
|
7
|
+
innerBlocks?: WpTypiaInnerBlocksTemplate,
|
|
8
|
+
];
|
|
9
|
+
export type WpTypiaInnerBlocksTemplate = WpTypiaInnerBlocksTemplateItem[];
|
|
10
|
+
|
|
11
|
+
export const INNER_BLOCKS_TEMPLATES = {} satisfies Record<string, WpTypiaInnerBlocksTemplate>;
|
|
12
|
+
|
|
13
|
+
export type WpTypiaInnerBlocksTemplateName = keyof typeof INNER_BLOCKS_TEMPLATES;
|
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
defineBlockNesting,
|
|
3
|
+
defineEndpointManifest,
|
|
4
|
+
defineInnerBlocksTemplates,
|
|
5
|
+
} from '@wp-typia/block-runtime/metadata-core';
|
|
6
|
+
|
|
7
|
+
export const BLOCK_NESTING = defineBlockNesting( {
|
|
8
|
+
// Add parent, ancestor, and allowedBlocks relationships here.
|
|
9
|
+
} );
|
|
10
|
+
|
|
11
|
+
export const BLOCK_TEMPLATES = defineInnerBlocksTemplates( {
|
|
12
|
+
// Add default InnerBlocks templates here.
|
|
13
|
+
} );
|
|
14
|
+
|
|
15
|
+
export interface WorkspacePatternConfig {
|
|
16
|
+
file: string;
|
|
17
|
+
slug: string;
|
|
18
|
+
}
|
|
2
19
|
|
|
3
20
|
export const BLOCKS = [
|
|
4
21
|
{
|
|
@@ -73,3 +90,7 @@ export const BLOCKS = [
|
|
|
73
90
|
},
|
|
74
91
|
// add-child: insert new block config entries here
|
|
75
92
|
] as const;
|
|
93
|
+
|
|
94
|
+
export const PATTERNS: WorkspacePatternConfig[] = [
|
|
95
|
+
// wp-typia add pattern entries
|
|
96
|
+
];
|