@forgewp/compiler 0.4.2 → 0.4.4
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/README.md +70 -3
- package/bin/add.js +30 -15
- package/bin/analyze.js +66 -1
- package/bin/cli.js +149 -70
- package/bin/doctor.js +21 -12
- package/bin/export.js +69 -20
- package/bin/fresh.js +6 -1
- package/bin/i18n-extract.js +3 -10
- package/bin/i18n-translate.js +15 -24
- package/bin/make-block.js +24 -0
- package/bin/make-editable.js +166 -0
- package/bin/make-form.js +131 -0
- package/bin/make-island.js +11 -0
- package/bin/make-loop.js +147 -0
- package/bin/make-mail.js +27 -0
- package/bin/make-page.js +83 -0
- package/bin/make-post-type.js +68 -29
- package/bin/make-sandbox.js +609 -0
- package/bin/make-section.js +221 -0
- package/bin/make-shell.js +375 -0
- package/bin/repair.js +14 -26
- package/bin/seed.js +119 -0
- package/bin/sync-routes.js +107 -85
- package/lib/adapters/html-adapter.js +13 -3
- package/lib/adapters/stub-adapter.js +10 -2
- package/lib/add-component.js +153 -92
- package/lib/asset-loader.js +333 -1
- package/lib/assets/asset-graph.js +432 -0
- package/lib/assets/asset-pipeline.js +125 -0
- package/lib/assets/diagnostics-report.js +345 -0
- package/lib/assets/external-fetcher.js +173 -0
- package/lib/assets/font-orchestrator.js +348 -0
- package/lib/assets/font-usage-scanner.js +242 -0
- package/lib/assets/image-optimizer.js +229 -0
- package/lib/assets/index.js +51 -0
- package/lib/assets/preload-generator.js +70 -0
- package/lib/assets/public-url.js +153 -0
- package/lib/block-authoring-help.js +11 -0
- package/lib/blocks/ast-parser.js +67 -0
- package/lib/blocks/discover-blocks.js +146 -0
- package/lib/blocks/editor-scope.js +733 -0
- package/lib/blocks/editor-transpiler.js +1229 -0
- package/lib/blocks/index.js +2838 -0
- package/lib/blocks/php-transpiler.js +4928 -0
- package/lib/blocks/scanner.js +1487 -0
- package/lib/blocks/shared-utils.js +290 -0
- package/lib/blocks/source-sanitize.js +1449 -0
- package/lib/blueprints.js +77 -5
- package/lib/build-assets.js +38 -33
- package/lib/collect-page-template-routes.js +102 -0
- package/lib/collect-static-routes.js +175 -0
- package/lib/diagnostics.js +58 -33
- package/lib/export-theme.js +84 -5
- package/lib/extract-template-content.js +90 -0
- package/lib/forms-preview.js +42 -0
- package/lib/functions/cpt-routing.js +69 -0
- package/lib/functions/forms.js +2461 -0
- package/lib/functions/hydration-enqueuer.js +400 -0
- package/lib/functions/index.js +1623 -0
- package/lib/functions/load-menus.js +112 -0
- package/lib/functions/load-translations.js +148 -0
- package/lib/functions/rest-endpoints.js +2923 -0
- package/lib/functions/routing.js +765 -0
- package/lib/functions/seed-mock-data.js +392 -0
- package/lib/functions/seed-products.js +481 -0
- package/lib/functions/settings-page.js +273 -0
- package/lib/functions/theme-setup.js +494 -0
- package/lib/generate-theme.js +2076 -303
- package/lib/hydration/editable-schemas.js +332 -0
- package/lib/hydration/enter-hidden-initial.js +65 -0
- package/lib/hydration/form-schemas.js +227 -0
- package/lib/hydration/index.js +12 -0
- package/lib/hydration/is-interactive.js +951 -0
- package/lib/hydration/island-split.js +1231 -0
- package/lib/hydration/islands-scanner.js +599 -0
- package/lib/hydration/resolve-island-chunk.js +103 -0
- package/lib/hydration/resolve-island-component.js +52 -0
- package/lib/hydration/rollup-inputs.js +81 -0
- package/lib/hydration/root-class-extractor.js +220 -0
- package/lib/hydration/scan-app-providers.js +154 -0
- package/lib/hydration/static-lint.js +382 -0
- package/lib/hydration/transform.js +257 -0
- package/lib/hydration/uses-block-area.js +49 -0
- package/lib/hydration/utils.js +119 -0
- package/lib/i18n/translation-cache.js +141 -0
- package/lib/icon-registry.js +72 -0
- package/lib/index.d.ts +324 -8
- package/lib/index.js +3 -2
- package/lib/load-config.js +338 -144
- package/lib/mail-templates.js +37 -0
- package/lib/markup-processor.js +483 -92
- package/lib/node-runtime.js +7 -0
- package/lib/page-config-plugin.js +84 -0
- package/lib/php-builders.js +383 -42
- package/lib/react-adapter.js +1053 -246
- package/lib/registration-metadata.js +11 -0
- package/lib/render-theme.mts +1410 -543
- package/lib/route-layout.js +76 -0
- package/lib/template-discovery.js +58 -0
- package/lib/theme-compatibility.js +32 -0
- package/lib/validate-export.js +51 -2
- package/lib/validate.js +27 -5
- package/lib/virtual-plugin.js +319 -0
- package/lib/walkthrough.md +26 -0
- package/package.json +17 -5
- package/templates/PresetsStyle.tsx +1 -1
- package/templates/auth/cms/email-logs.json +9 -0
- package/templates/auth/cms/menus.json +11 -0
- package/templates/auth/cms/mock-data.json +123 -0
- package/templates/auth/cms/roles.json +7 -0
- package/templates/auth/cms/sessions.json +1 -0
- package/templates/auth/cms/site-settings.json +28 -0
- package/templates/auth/cms/translations.json +4 -0
- package/templates/auth/cms/users.json +46 -0
- package/templates/auth/components/dashboard-view-wrapper.tsx +168 -0
- package/templates/auth/components/forgot-password-form-wrapper.tsx +141 -0
- package/templates/auth/components/login-form-wrapper.tsx +300 -0
- package/templates/auth/components/reset-password-form-wrapper.tsx +190 -0
- package/templates/auth/components/signup-form-wrapper.tsx +257 -0
- package/templates/auth/components/verify-email-view-wrapper.tsx +265 -0
- package/templates/auth/pages/DashboardPage.tsx +12 -0
- package/templates/auth/pages/ForgotPasswordPage.tsx +11 -0
- package/templates/auth/pages/LoginPage.tsx +11 -0
- package/templates/auth/pages/ResetPasswordPage.tsx +11 -0
- package/templates/auth/pages/SignUpPage.tsx +11 -0
- package/templates/auth/pages/VerifyEmailPage.tsx +11 -0
- package/templates/auth/ui/button.tsx +57 -0
- package/templates/auth/ui/card.tsx +76 -0
- package/templates/auth/ui/field.tsx +242 -0
- package/templates/auth/ui/input.tsx +22 -0
- package/templates/auth/ui/label.tsx +24 -0
- package/templates/auth/ui/separator.tsx +31 -0
- package/templates/forgewp-config.ts +70 -3
- package/templates/menus.json +12 -10
- package/templates/mock-data.json +122 -433
- package/templates/products.json +5 -0
- package/templates/roles.json +7 -0
- package/templates/sessions.json +1 -0
- package/templates/users.json +38 -0
- package/templates/wordpress.tsx +1835 -1297
- package/bin/make-template.js +0 -145
- package/lib/block-compiler.js +0 -552
- package/lib/functions-builder.js +0 -2044
- package/lib/hydration-scanner.js +0 -821
package/lib/index.d.ts
CHANGED
|
@@ -18,16 +18,36 @@ export interface FontFamilyPreset {
|
|
|
18
18
|
|
|
19
19
|
export interface CustomPostTypeConfig {
|
|
20
20
|
translatable?: boolean;
|
|
21
|
+
icon?: string;
|
|
21
22
|
labels?: {
|
|
22
23
|
singular?: string;
|
|
23
24
|
plural?: string;
|
|
24
25
|
};
|
|
26
|
+
/** Replaces the default features; [] disables all features (emitted as PHP false). */
|
|
27
|
+
supports?: string[];
|
|
28
|
+
public?: boolean;
|
|
29
|
+
hasArchive?: boolean;
|
|
30
|
+
showInRest?: boolean;
|
|
31
|
+
rewrite?: false | { slug?: string; withFront?: boolean };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface CustomTaxonomyConfig {
|
|
35
|
+
translatable?: boolean;
|
|
36
|
+
hierarchical?: boolean;
|
|
37
|
+
labels?: {
|
|
38
|
+
singular?: string;
|
|
39
|
+
plural?: string;
|
|
40
|
+
};
|
|
41
|
+
public?: boolean;
|
|
42
|
+
showUi?: boolean;
|
|
43
|
+
showInRest?: boolean;
|
|
25
44
|
}
|
|
26
45
|
|
|
27
46
|
export interface ForgeWPI18nConfig {
|
|
28
47
|
locales: string[];
|
|
29
48
|
defaultLocale: string;
|
|
30
49
|
provider?: 'local' | 'deepl' | 'libretranslate' | 'google' | string;
|
|
50
|
+
/** Optional project-relative JSON response cache for i18n:translate. */
|
|
31
51
|
cache?: string;
|
|
32
52
|
providerConfig?: {
|
|
33
53
|
apiKey?: string;
|
|
@@ -40,13 +60,153 @@ export interface ForgeWpSeoSitemapsConfig {
|
|
|
40
60
|
taxonomies: string[];
|
|
41
61
|
}
|
|
42
62
|
|
|
63
|
+
export interface ForgeWPPluginContext {
|
|
64
|
+
fs: typeof import('node:fs');
|
|
65
|
+
path: typeof import('node:path');
|
|
66
|
+
}
|
|
67
|
+
|
|
43
68
|
export interface ForgeWPPlugin {
|
|
44
69
|
name: string;
|
|
45
|
-
validateConfig?: (config: ForgeWPThemeConfig, themeRoot: string) => void;
|
|
46
|
-
transformFunctionsPhp?: (
|
|
70
|
+
validateConfig?: (config: ForgeWPThemeConfig, themeRoot: string, context: ForgeWPPluginContext) => void;
|
|
71
|
+
transformFunctionsPhp?: (
|
|
72
|
+
php: string,
|
|
73
|
+
config: ForgeWPThemeConfig,
|
|
74
|
+
themeRoot: string,
|
|
75
|
+
context: ForgeWPPluginContext,
|
|
76
|
+
) => string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type ForgeWPFormFieldType =
|
|
80
|
+
| 'text'
|
|
81
|
+
| 'email'
|
|
82
|
+
| 'tel'
|
|
83
|
+
| 'number'
|
|
84
|
+
| 'textarea'
|
|
85
|
+
| 'select'
|
|
86
|
+
| 'checkbox';
|
|
87
|
+
|
|
88
|
+
export interface ForgeWPFormField {
|
|
89
|
+
type: ForgeWPFormFieldType;
|
|
90
|
+
label?: string;
|
|
91
|
+
required?: boolean;
|
|
92
|
+
options?: string[];
|
|
93
|
+
maxLength?: number;
|
|
94
|
+
placeholder?: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type ForgeWPFormFieldSeed = Array<ForgeWPFormField & { name: string }>;
|
|
98
|
+
|
|
99
|
+
export interface ForgeWPFormClientFieldsConfig {
|
|
100
|
+
enabled: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Initial client-owned field set. A flat array is used for every configured
|
|
103
|
+
* locale (fine for a single-language theme, or as a same-content starting
|
|
104
|
+
* point before translating). For a theme with `i18n.locales.length > 1`,
|
|
105
|
+
* provide a per-locale map instead so each language seeds independently —
|
|
106
|
+
* client-owned labels/options are runtime content, not compiled strings,
|
|
107
|
+
* so they can't go through the usual __()/translations.json pipeline.
|
|
108
|
+
*/
|
|
109
|
+
seed: ForgeWPFormFieldSeed | Record<string, ForgeWPFormFieldSeed>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface ForgeWPFormConfirmationConfig {
|
|
113
|
+
enabled: boolean;
|
|
114
|
+
emailField: string;
|
|
115
|
+
subject?: string;
|
|
116
|
+
body?: string;
|
|
117
|
+
/** Named plain-text template in cms/mail/<name>.json. */
|
|
118
|
+
template?: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface ForgeWPFormConfig {
|
|
122
|
+
/**
|
|
123
|
+
* 'native' (default): ForgeWP generates the REST endpoint, mail delivery,
|
|
124
|
+
* optional submission storage, and the wp-admin field editor. Requires
|
|
125
|
+
* `mailTo` and `fields`.
|
|
126
|
+
*
|
|
127
|
+
* 'shortcode': escape hatch for clients who want to self-manage a form
|
|
128
|
+
* entirely inside a WordPress plugin (CF7, WPForms, Gravity…). ForgeWP
|
|
129
|
+
* generates none of the above — the developer renders the plugin's
|
|
130
|
+
* markup directly with <WpShortcode code={...} />. Requires `shortcode`.
|
|
131
|
+
* `mailTo`, `fields`, `clientFields`, and `storeSubmissions` are ignored.
|
|
132
|
+
*/
|
|
133
|
+
mode?: 'native' | 'shortcode';
|
|
134
|
+
/** Default/example shortcode string for 'shortcode' mode, e.g. '[contact-form-7 id="58" title="Contact Form"]'. */
|
|
135
|
+
shortcode?: string;
|
|
136
|
+
/** 'admin' → get_option('admin_email'); or a literal email;
|
|
137
|
+
* or 'option:some_key' → get_option('some_key'). Required in 'native' mode. */
|
|
138
|
+
mailTo?: string;
|
|
139
|
+
/** Email subject line. Supports {field} interpolation from submitted values. */
|
|
140
|
+
subject?: string;
|
|
141
|
+
/** Optional private-inbox title template. Supports developer-owned {field} values. */
|
|
142
|
+
submissionTitle?: string;
|
|
143
|
+
/** Plain-text notification email body. Supports {field}; blank uses the default field list. */
|
|
144
|
+
notificationBody?: string;
|
|
145
|
+
/** Named notification default in cms/mail/<name>.json. */
|
|
146
|
+
notificationTemplate?: string;
|
|
147
|
+
/** Visitor-facing success message returned by the native submission endpoint. */
|
|
148
|
+
successMessage?: string;
|
|
149
|
+
/** Dev-owned fields — the fixed part of the server-side allowlist. Required in 'native' mode. */
|
|
150
|
+
fields?: Record<string, ForgeWPFormField>;
|
|
151
|
+
clientFields?: ForgeWPFormClientFieldsConfig;
|
|
152
|
+
/** Store each submission in the forgewp_submission CPT (client inbox). Default true. */
|
|
153
|
+
storeSubmissions?: boolean;
|
|
154
|
+
/** Optional plain-text submitter confirmation. Disabled unless enabled. */
|
|
155
|
+
confirmation?: ForgeWPFormConfirmationConfig;
|
|
156
|
+
/** Permanently delete stored submissions after this many days. No cleanup by default. */
|
|
157
|
+
retentionDays?: number;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface WpOptionField {
|
|
161
|
+
_type:
|
|
162
|
+
| 'text'
|
|
163
|
+
| 'url'
|
|
164
|
+
| 'email'
|
|
165
|
+
| 'textarea'
|
|
166
|
+
| 'toggle'
|
|
167
|
+
| 'number'
|
|
168
|
+
| 'postPicker';
|
|
169
|
+
label?: string;
|
|
170
|
+
default?: string;
|
|
171
|
+
postType?: string;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export type WpOptionsSchema = Record<string, WpOptionField>;
|
|
175
|
+
|
|
176
|
+
export type ForgeWPSeedStrategy = boolean | 'once' | 'upsert' | 'force';
|
|
177
|
+
|
|
178
|
+
export interface ForgeWPSeedConfig {
|
|
179
|
+
/**
|
|
180
|
+
* Sync local products from `cms/products.ts` (or `products.json`) into WooCommerce.
|
|
181
|
+
* Default: false
|
|
182
|
+
*/
|
|
183
|
+
products?: ForgeWPSeedStrategy;
|
|
184
|
+
/**
|
|
185
|
+
* Sync mock posts, pages, and CPTs from `cms/mock-data.ts` (or `mock-data.json`).
|
|
186
|
+
* A map opts in each post type independently; omitted/false types are disabled,
|
|
187
|
+
* even when invoked with --force. true is equivalent to 'once'.
|
|
188
|
+
* Default: false
|
|
189
|
+
*/
|
|
190
|
+
mockData?: ForgeWPSeedStrategy | Record<string, ForgeWPSeedStrategy>;
|
|
191
|
+
/**
|
|
192
|
+
* Automatically sideload remote CDN image URLs into the WordPress Media Library.
|
|
193
|
+
* Default: true
|
|
194
|
+
*/
|
|
195
|
+
sideloadImages?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Safety guard: Only execute when WP_DEBUG is true, unless explicitly forced.
|
|
198
|
+
* Default: true
|
|
199
|
+
*/
|
|
200
|
+
developmentOnly?: boolean;
|
|
47
201
|
}
|
|
48
202
|
|
|
49
203
|
export interface ForgeWPThemeConfig {
|
|
204
|
+
/** Generated style.css requirements. Raise minima for project dependencies; record testedUpTo after WordPress acceptance. */
|
|
205
|
+
compatibility?: {
|
|
206
|
+
requiresWordPress?: string;
|
|
207
|
+
requiresPhp?: string;
|
|
208
|
+
testedUpTo?: string;
|
|
209
|
+
};
|
|
50
210
|
name: string;
|
|
51
211
|
slug: string;
|
|
52
212
|
version: string;
|
|
@@ -54,6 +214,8 @@ export interface ForgeWPThemeConfig {
|
|
|
54
214
|
textDomain: string;
|
|
55
215
|
configVersion?: number;
|
|
56
216
|
favicon?: string;
|
|
217
|
+
headerPath?: string;
|
|
218
|
+
footerPath?: string;
|
|
57
219
|
seo?: {
|
|
58
220
|
sitemaps?: ForgeWpSeoSitemapsConfig;
|
|
59
221
|
plugins?: {
|
|
@@ -63,9 +225,48 @@ export interface ForgeWPThemeConfig {
|
|
|
63
225
|
};
|
|
64
226
|
frameworkAdapter?: 'react' | 'html' | 'stub';
|
|
65
227
|
style?: 'forgewp' | 'shadcn';
|
|
228
|
+
/** Declare menu location keys. Labels come from settings.menus; use cms/menus.ts for starter entries. */
|
|
229
|
+
menus?: Record<string, string>;
|
|
230
|
+
presets?: {
|
|
231
|
+
/** Whether to add wp-block-styles theme support. Default: true. */
|
|
232
|
+
wordpressCoreStyles?: boolean;
|
|
233
|
+
};
|
|
234
|
+
headless?: {
|
|
235
|
+
apiUrl?: string;
|
|
236
|
+
jwtAuth?: boolean;
|
|
237
|
+
};
|
|
238
|
+
auth?: {
|
|
239
|
+
loginField?: 'usernameOnly' | 'emailOnly' | 'usernameAndEmail';
|
|
240
|
+
defaultRole?: string;
|
|
241
|
+
/** Profile metadata accepted from public signup. Empty by default; reserved keys cannot be allowed. */
|
|
242
|
+
registrationMetaFields?: string[];
|
|
243
|
+
reservedUsernames?: string[];
|
|
244
|
+
features?: {
|
|
245
|
+
registration?: boolean;
|
|
246
|
+
emailVerification?: boolean;
|
|
247
|
+
blockLoginUntilVerified?: boolean;
|
|
248
|
+
autoLoginAfterSignup?: boolean;
|
|
249
|
+
};
|
|
250
|
+
emails?: {
|
|
251
|
+
verification?: {
|
|
252
|
+
subject?: string;
|
|
253
|
+
body?: string;
|
|
254
|
+
};
|
|
255
|
+
passwordReset?: {
|
|
256
|
+
subject?: string;
|
|
257
|
+
body?: string;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
};
|
|
66
261
|
postTypes?: Record<string, CustomPostTypeConfig>;
|
|
262
|
+
taxonomies?: Record<string, CustomTaxonomyConfig>;
|
|
263
|
+
options?: WpOptionsSchema;
|
|
264
|
+
themeMods?: Record<string, any>;
|
|
265
|
+
seed?: ForgeWPSeedConfig;
|
|
67
266
|
i18n?: ForgeWPI18nConfig;
|
|
68
267
|
settings?: {
|
|
268
|
+
/** Explicit location descriptions, taking precedence over inferred menu labels. */
|
|
269
|
+
menus?: Record<string, { description?: string }>;
|
|
69
270
|
layout?: {
|
|
70
271
|
contentSize?: string;
|
|
71
272
|
wideSize?: string;
|
|
@@ -81,10 +282,15 @@ export interface ForgeWPThemeConfig {
|
|
|
81
282
|
};
|
|
82
283
|
};
|
|
83
284
|
plugins?: ForgeWPPlugin[];
|
|
285
|
+
forms?: Record<string, ForgeWPFormConfig>;
|
|
286
|
+
/**
|
|
287
|
+
* Capability required to manage form fields and view stored submissions.
|
|
288
|
+
* Defaults to `manage_options`. Granting a lower capability also grants
|
|
289
|
+
* access to submitted form data.
|
|
290
|
+
*/
|
|
291
|
+
formsAdminCapability?: string;
|
|
84
292
|
}
|
|
85
293
|
|
|
86
|
-
|
|
87
|
-
|
|
88
294
|
export interface ForgeWPBuildAssets {
|
|
89
295
|
cssFile: string;
|
|
90
296
|
jsFile?: string;
|
|
@@ -118,7 +324,27 @@ export interface ForgeWPFrameworkAdapter {
|
|
|
118
324
|
pc: any;
|
|
119
325
|
},
|
|
120
326
|
): Promise<void> | void;
|
|
121
|
-
|
|
327
|
+
onMakeShell?(
|
|
328
|
+
themeRoot: string,
|
|
329
|
+
options: {
|
|
330
|
+
pascalCase: string;
|
|
331
|
+
nameSlug: string;
|
|
332
|
+
readableTitle: string;
|
|
333
|
+
childrenSlugs: string[];
|
|
334
|
+
shell: { className?: string; gridClassName?: string };
|
|
335
|
+
innerBlocks: {
|
|
336
|
+
allowedBlocks?: string[];
|
|
337
|
+
template?: Array<[string, Record<string, any>?]>;
|
|
338
|
+
templateLock?: boolean | 'all' | 'insert';
|
|
339
|
+
orientation?: 'horizontal' | 'vertical';
|
|
340
|
+
};
|
|
341
|
+
category: string;
|
|
342
|
+
icon: string;
|
|
343
|
+
description: string;
|
|
344
|
+
pc: any;
|
|
345
|
+
},
|
|
346
|
+
): Promise<void> | void;
|
|
347
|
+
onMakeLoop?(
|
|
122
348
|
themeRoot: string,
|
|
123
349
|
options: {
|
|
124
350
|
pascalCase: string;
|
|
@@ -128,6 +354,13 @@ export interface ForgeWPFrameworkAdapter {
|
|
|
128
354
|
pc: any;
|
|
129
355
|
},
|
|
130
356
|
): Promise<void> | void;
|
|
357
|
+
onMakePage?(
|
|
358
|
+
themeRoot: string,
|
|
359
|
+
options: {
|
|
360
|
+
pascalCase: string;
|
|
361
|
+
pc: any;
|
|
362
|
+
},
|
|
363
|
+
): Promise<void> | void;
|
|
131
364
|
onSyncRoutes?(
|
|
132
365
|
themeRoot: string,
|
|
133
366
|
options: {
|
|
@@ -143,17 +376,97 @@ export type ForgeWPFrameworkAdapterModule = ForgeWPFrameworkAdapter & {
|
|
|
143
376
|
default?: ForgeWPFrameworkAdapter;
|
|
144
377
|
};
|
|
145
378
|
|
|
146
|
-
export
|
|
379
|
+
export interface ForgeWPExportProgress {
|
|
380
|
+
stage: string;
|
|
381
|
+
message: string;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export interface ForgeWPExportOptions {
|
|
147
385
|
themeRoot: string;
|
|
148
386
|
skipBuild?: boolean;
|
|
149
387
|
zip?: boolean;
|
|
150
388
|
packageManager?: string;
|
|
151
|
-
|
|
389
|
+
validate?: boolean;
|
|
390
|
+
strict?: boolean;
|
|
391
|
+
onProgress?: (progress: ForgeWPExportProgress) => void;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export interface ForgeWPExportResult {
|
|
152
395
|
config: ForgeWPThemeConfig;
|
|
153
396
|
outDir: string;
|
|
154
397
|
zipPath: string | null;
|
|
155
398
|
assets: ForgeWPBuildAssets;
|
|
156
|
-
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export function exportTheme(options: ForgeWPExportOptions): Promise<ForgeWPExportResult>;
|
|
402
|
+
|
|
403
|
+
export interface ForgeWPValidationOptions {
|
|
404
|
+
themeRoot: string;
|
|
405
|
+
outDir: string;
|
|
406
|
+
assets: ForgeWPBuildAssets;
|
|
407
|
+
config: ForgeWPThemeConfig;
|
|
408
|
+
strict?: boolean;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export interface ForgeWPValidationResult {
|
|
412
|
+
missing: string[];
|
|
413
|
+
warnings: string[];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export function validateExport(options: ForgeWPValidationOptions): Promise<ForgeWPValidationResult>;
|
|
417
|
+
|
|
418
|
+
export interface ForgeWPHydrationIsland {
|
|
419
|
+
name: string;
|
|
420
|
+
file: string;
|
|
421
|
+
trigger: string;
|
|
422
|
+
preload: string;
|
|
423
|
+
media: string | null;
|
|
424
|
+
connection: string | null;
|
|
425
|
+
clientOnly: boolean;
|
|
426
|
+
smartDiscovered?: boolean;
|
|
427
|
+
rootClassName?: string | null;
|
|
428
|
+
rootClassNameUnresolved?: boolean;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
export function scanForHydrationIslandsWithProps(themeRoot: string): ForgeWPHydrationIsland[];
|
|
432
|
+
|
|
433
|
+
/** Parsed editable field records; extra provider-specific metadata is retained. */
|
|
434
|
+
export interface ForgeWPEditableField {
|
|
435
|
+
type: string;
|
|
436
|
+
label?: string;
|
|
437
|
+
default?: unknown;
|
|
438
|
+
[key: string]: unknown;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export function scanForEditableSchemas(themeRoot: string): Record<string, Record<string, ForgeWPEditableField>>;
|
|
442
|
+
|
|
443
|
+
export interface ForgeWPIslandDiagnostic {
|
|
444
|
+
name: string;
|
|
445
|
+
sizeKb: number;
|
|
446
|
+
isHeavy: boolean;
|
|
447
|
+
chunkPath: string;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export interface ForgeWPHydrationAnalysis {
|
|
451
|
+
heavyCount: number;
|
|
452
|
+
results: ForgeWPIslandDiagnostic[];
|
|
453
|
+
violations?: Array<{
|
|
454
|
+
type: string;
|
|
455
|
+
file: string;
|
|
456
|
+
message: string;
|
|
457
|
+
severity: 'warning' | 'error';
|
|
458
|
+
lineContent?: string;
|
|
459
|
+
}>;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export function analyzeHydrationIslands(themeRoot: string, mapping: Record<string, string>): ForgeWPHydrationAnalysis;
|
|
463
|
+
|
|
464
|
+
export function generateVisualReport(
|
|
465
|
+
themeRoot: string,
|
|
466
|
+
analysis: ForgeWPHydrationAnalysis,
|
|
467
|
+
islandsWithProps: ForgeWPHydrationIsland[],
|
|
468
|
+
config: ForgeWPThemeConfig,
|
|
469
|
+
): string;
|
|
157
470
|
|
|
158
471
|
export function loadConfig(themeRoot: string): Promise<ForgeWPThemeConfig>;
|
|
159
472
|
|
|
@@ -177,3 +490,6 @@ export function resolveFrameworkAdapter(adapterName?: string): string;
|
|
|
177
490
|
export function loadFrameworkAdapter(
|
|
178
491
|
adapterName?: string,
|
|
179
492
|
): Promise<ForgeWPFrameworkAdapterModule>;
|
|
493
|
+
|
|
494
|
+
export function forgewpPageConfigPlugin(): any;
|
|
495
|
+
export function forgewpVirtualPlugin(options?: { projectRoot?: string }): any;
|
package/lib/index.js
CHANGED
|
@@ -7,7 +7,7 @@ export {
|
|
|
7
7
|
findComponentPath,
|
|
8
8
|
getHydrationRollupInputs,
|
|
9
9
|
scanForEditableSchemas,
|
|
10
|
-
} from './hydration
|
|
10
|
+
} from './hydration/index.js';
|
|
11
11
|
export { validateExport } from './validate-export.js';
|
|
12
12
|
export {
|
|
13
13
|
resolveFrameworkAdapter,
|
|
@@ -17,4 +17,5 @@ export {
|
|
|
17
17
|
analyzeHydrationIslands,
|
|
18
18
|
generateVisualReport,
|
|
19
19
|
} from './diagnostics.js';
|
|
20
|
-
|
|
20
|
+
export { forgewpPageConfigPlugin } from './page-config-plugin.js';
|
|
21
|
+
export { forgewpVirtualPlugin } from './virtual-plugin.js';
|