@ethisyscore/vite-plugin 1.6.3 → 1.7.1
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/index.cjs +327 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +135 -2
- package/dist/index.d.ts +135 -2
- package/dist/index.js +326 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -136,7 +136,7 @@ declare function validateReactiveRule(rule: unknown, filePath: string): Validati
|
|
|
136
136
|
* mirror the registry exactly; a drift between the two breaks the cross-repo
|
|
137
137
|
* agreement that E4.S4 locks in.
|
|
138
138
|
*/
|
|
139
|
-
declare const CONTRACT_B_SEMANTIC_PRIMITIVES: readonly ["Button", "DataTable", "Form", "EntityPicker", "CommandBar", "Drawer", "Modal", "CanvasSurface", "WebGLSurface"];
|
|
139
|
+
declare const CONTRACT_B_SEMANTIC_PRIMITIVES: readonly ["Button", "DataTable", "Form", "EntityPicker", "CommandBar", "Drawer", "Modal", "CanvasSurface", "WebGLSurface", "Card", "Tabs", "Select", "Alert"];
|
|
140
140
|
/**
|
|
141
141
|
* Non-component import-map entries — the runtime libraries the worker is
|
|
142
142
|
* permitted to resolve via bare specifiers. Authoring constraint: the plugin's
|
|
@@ -219,6 +219,139 @@ interface ContractBPluginOptions {
|
|
|
219
219
|
*/
|
|
220
220
|
declare function ethisysContractBPlugin(options?: ContractBPluginOptions): Plugin;
|
|
221
221
|
|
|
222
|
+
/**
|
|
223
|
+
* A single PlatformReact page declaration extracted from
|
|
224
|
+
* `ui.platformReactPages[]` in the manifest. Aligns with the typed interface
|
|
225
|
+
* defined in `ethisyscore-protocol` RFC 0003.
|
|
226
|
+
*
|
|
227
|
+
* - `id` is the host-side page identifier and the basename of the emitted
|
|
228
|
+
* bundle (e.g. `id: "dashboard"` → `platform-react/dashboard.js`).
|
|
229
|
+
* - `moduleSpecifier` is a host-origin relative path to the page module — the
|
|
230
|
+
* plugin author's source entry that Rollup bundles.
|
|
231
|
+
* - `exportName` is the named export Rollup keeps live in the bundle. The host
|
|
232
|
+
* loader reads `bundle[exportName]` at mount time.
|
|
233
|
+
* - `title` is an optional display label for the host's surface chrome.
|
|
234
|
+
*/
|
|
235
|
+
interface PlatformReactPageDeclaration {
|
|
236
|
+
id?: string;
|
|
237
|
+
moduleSpecifier?: string;
|
|
238
|
+
exportName?: string;
|
|
239
|
+
title?: string;
|
|
240
|
+
[key: string]: unknown;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The subset of a manifest this pass consumes. Manifests are tolerated as a
|
|
244
|
+
* superset — extra fields are ignored so newer-schema manifests still load.
|
|
245
|
+
*/
|
|
246
|
+
interface PlatformReactManifest {
|
|
247
|
+
type?: string;
|
|
248
|
+
ui?: {
|
|
249
|
+
platformReactPages?: PlatformReactPageDeclaration[];
|
|
250
|
+
[key: string]: unknown;
|
|
251
|
+
};
|
|
252
|
+
[key: string]: unknown;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Author-facing options for the PlatformReact Vite pass.
|
|
256
|
+
*/
|
|
257
|
+
interface PlatformReactPluginOptions {
|
|
258
|
+
/**
|
|
259
|
+
* Root directory the manifest path is resolved against. When omitted,
|
|
260
|
+
* Vite's `configResolved` populates it from `config.root`.
|
|
261
|
+
*/
|
|
262
|
+
root?: string;
|
|
263
|
+
/**
|
|
264
|
+
* Manifest path. Relative paths resolve against `root`. Defaults to
|
|
265
|
+
* `feature.manifest.json`.
|
|
266
|
+
*/
|
|
267
|
+
manifestPath?: string;
|
|
268
|
+
/**
|
|
269
|
+
* Output prefix for emitted page assets and the companion manifest.
|
|
270
|
+
* Defaults to `platform-react/`.
|
|
271
|
+
*/
|
|
272
|
+
outputPrefix?: string;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Build-time Vite/Rollup plugin pass for EthisysCore PlatformReact pages
|
|
276
|
+
* (RFC 0003: the high-trust, host-extension tier). For each entry under
|
|
277
|
+
* `ui.platformReactPages[]` in the manifest, registers a Rollup input that
|
|
278
|
+
* emits an ESM bundle the host loads via `import()` at surface mount time.
|
|
279
|
+
*
|
|
280
|
+
* Behaviour:
|
|
281
|
+
* - For each declared page: registers `{ "platform-react/<id>": <moduleSpecifier> }`
|
|
282
|
+
* in Rollup's input table. Output is forced to `format: "es"` and
|
|
283
|
+
* `inlineDynamicImports: true` so each page ships as ONE bundled module.
|
|
284
|
+
* - Emits a `platform-react/platform-react-pages.json` companion asset listing
|
|
285
|
+
* the declared pages so the host (and the `.ccpkg` packaging step) can
|
|
286
|
+
* inspect what the build produced.
|
|
287
|
+
* - When `ui.platformReactPages` is absent or empty: the pass is a no-op.
|
|
288
|
+
* Composition is expected — the recommended template registers this pass
|
|
289
|
+
* alongside Contract A / Contract B so a single Vite config covers every
|
|
290
|
+
* render mode.
|
|
291
|
+
*
|
|
292
|
+
* Origin enforcement of the bundle URL at runtime is the host's responsibility
|
|
293
|
+
* (see `PlatformReactSurfaceMount.tsx` in `coreconnect-web`). This pass only
|
|
294
|
+
* blocks remote/absolute paths at the manifest layer so a malformed manifest
|
|
295
|
+
* fails fast.
|
|
296
|
+
*/
|
|
297
|
+
declare function ethisysPlatformReactPlugin(options?: PlatformReactPluginOptions): Plugin;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* A fully-validated PlatformReact page declaration. All fields are guaranteed
|
|
301
|
+
* present (no `undefined`), `exportName` is defaulted to `"default"`, and the
|
|
302
|
+
* `moduleSpecifier` is guaranteed to exist on disk when `verifyOnDisk: true`
|
|
303
|
+
* was passed to {@link parsePlatformReactPages}.
|
|
304
|
+
*/
|
|
305
|
+
interface ResolvedPlatformReactPage {
|
|
306
|
+
id: string;
|
|
307
|
+
moduleSpecifier: string;
|
|
308
|
+
exportName: string;
|
|
309
|
+
title: string | null;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Options for {@link parsePlatformReactPages}.
|
|
313
|
+
*/
|
|
314
|
+
interface ParsePlatformReactPagesOptions {
|
|
315
|
+
/**
|
|
316
|
+
* Root directory the manifest path and the page module specifiers are
|
|
317
|
+
* resolved against. Defaults to `process.cwd()`.
|
|
318
|
+
*/
|
|
319
|
+
root?: string;
|
|
320
|
+
/**
|
|
321
|
+
* When `true`, every declared `moduleSpecifier` must exist on disk (relative
|
|
322
|
+
* to {@link root}). The default is `false` so the helper can be used to
|
|
323
|
+
* snapshot-test a manifest without checking-out the page source files.
|
|
324
|
+
*/
|
|
325
|
+
verifyOnDisk?: boolean;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Parse + validate `ui.platformReactPages[]` declarations from a manifest
|
|
329
|
+
* file. Designed for plugin authors writing Vitest tests against their own
|
|
330
|
+
* manifest — the helper applies the same shape and uniqueness rules the
|
|
331
|
+
* build-time Vite pass enforces, so a passing unit test gives the same
|
|
332
|
+
* guarantee a green build would.
|
|
333
|
+
*
|
|
334
|
+
* Returns an empty array when the manifest does not exist OR does not
|
|
335
|
+
* declare `ui.platformReactPages` OR declares it as an empty array.
|
|
336
|
+
*
|
|
337
|
+
* Throws on any malformed declaration. The thrown message matches the
|
|
338
|
+
* build-time error so a failing test reads identically to a failing build.
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```ts
|
|
342
|
+
* import { parsePlatformReactPages } from "@ethisyscore/vite-plugin";
|
|
343
|
+
*
|
|
344
|
+
* test("manifest declares dashboard and admin pages", () => {
|
|
345
|
+
* const pages = parsePlatformReactPages("./feature.manifest.json");
|
|
346
|
+
* expect(pages).toEqual([
|
|
347
|
+
* { id: "dashboard", moduleSpecifier: "src/pages/Dashboard.tsx", exportName: "default", title: "Dashboard" },
|
|
348
|
+
* { id: "admin", moduleSpecifier: "src/pages/Admin.tsx", exportName: "AdminPage", title: null },
|
|
349
|
+
* ]);
|
|
350
|
+
* });
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
declare function parsePlatformReactPages(manifestPath: string, options?: ParsePlatformReactPagesOptions): ResolvedPlatformReactPage[];
|
|
354
|
+
|
|
222
355
|
interface EthisysPluginOptions {
|
|
223
356
|
/**
|
|
224
357
|
* Path to the manifest file, relative to Vite's root directory.
|
|
@@ -242,4 +375,4 @@ interface EthisysPluginOptions {
|
|
|
242
375
|
*/
|
|
243
376
|
declare function ethisysManifestPlugin(options?: EthisysPluginOptions): Plugin;
|
|
244
377
|
|
|
245
|
-
export { CONTRACT_B_IMPORT_MAP_ALLOWLIST, CONTRACT_B_RUNTIME_IMPORTS, CONTRACT_B_SEMANTIC_PRIMITIVES, type ContractAManifest, type ContractAPluginOptions, type ContractBManifest, type ContractBPluginOptions, type EthisysPluginOptions, type ManifestReactiveRuleRef, type ManifestResourceRef, type ValidationFailure, type ValidationResult, ethisysContractAPlugin, ethisysContractBPlugin, ethisysManifestPlugin, validateDeclarativeResource, validateReactiveRule };
|
|
378
|
+
export { CONTRACT_B_IMPORT_MAP_ALLOWLIST, CONTRACT_B_RUNTIME_IMPORTS, CONTRACT_B_SEMANTIC_PRIMITIVES, type ContractAManifest, type ContractAPluginOptions, type ContractBManifest, type ContractBPluginOptions, type EthisysPluginOptions, type ManifestReactiveRuleRef, type ManifestResourceRef, type ParsePlatformReactPagesOptions, type PlatformReactManifest, type PlatformReactPageDeclaration, type PlatformReactPluginOptions, type ResolvedPlatformReactPage, type ValidationFailure, type ValidationResult, ethisysContractAPlugin, ethisysContractBPlugin, ethisysManifestPlugin, ethisysPlatformReactPlugin, parsePlatformReactPages, validateDeclarativeResource, validateReactiveRule };
|
package/dist/index.d.ts
CHANGED
|
@@ -136,7 +136,7 @@ declare function validateReactiveRule(rule: unknown, filePath: string): Validati
|
|
|
136
136
|
* mirror the registry exactly; a drift between the two breaks the cross-repo
|
|
137
137
|
* agreement that E4.S4 locks in.
|
|
138
138
|
*/
|
|
139
|
-
declare const CONTRACT_B_SEMANTIC_PRIMITIVES: readonly ["Button", "DataTable", "Form", "EntityPicker", "CommandBar", "Drawer", "Modal", "CanvasSurface", "WebGLSurface"];
|
|
139
|
+
declare const CONTRACT_B_SEMANTIC_PRIMITIVES: readonly ["Button", "DataTable", "Form", "EntityPicker", "CommandBar", "Drawer", "Modal", "CanvasSurface", "WebGLSurface", "Card", "Tabs", "Select", "Alert"];
|
|
140
140
|
/**
|
|
141
141
|
* Non-component import-map entries — the runtime libraries the worker is
|
|
142
142
|
* permitted to resolve via bare specifiers. Authoring constraint: the plugin's
|
|
@@ -219,6 +219,139 @@ interface ContractBPluginOptions {
|
|
|
219
219
|
*/
|
|
220
220
|
declare function ethisysContractBPlugin(options?: ContractBPluginOptions): Plugin;
|
|
221
221
|
|
|
222
|
+
/**
|
|
223
|
+
* A single PlatformReact page declaration extracted from
|
|
224
|
+
* `ui.platformReactPages[]` in the manifest. Aligns with the typed interface
|
|
225
|
+
* defined in `ethisyscore-protocol` RFC 0003.
|
|
226
|
+
*
|
|
227
|
+
* - `id` is the host-side page identifier and the basename of the emitted
|
|
228
|
+
* bundle (e.g. `id: "dashboard"` → `platform-react/dashboard.js`).
|
|
229
|
+
* - `moduleSpecifier` is a host-origin relative path to the page module — the
|
|
230
|
+
* plugin author's source entry that Rollup bundles.
|
|
231
|
+
* - `exportName` is the named export Rollup keeps live in the bundle. The host
|
|
232
|
+
* loader reads `bundle[exportName]` at mount time.
|
|
233
|
+
* - `title` is an optional display label for the host's surface chrome.
|
|
234
|
+
*/
|
|
235
|
+
interface PlatformReactPageDeclaration {
|
|
236
|
+
id?: string;
|
|
237
|
+
moduleSpecifier?: string;
|
|
238
|
+
exportName?: string;
|
|
239
|
+
title?: string;
|
|
240
|
+
[key: string]: unknown;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The subset of a manifest this pass consumes. Manifests are tolerated as a
|
|
244
|
+
* superset — extra fields are ignored so newer-schema manifests still load.
|
|
245
|
+
*/
|
|
246
|
+
interface PlatformReactManifest {
|
|
247
|
+
type?: string;
|
|
248
|
+
ui?: {
|
|
249
|
+
platformReactPages?: PlatformReactPageDeclaration[];
|
|
250
|
+
[key: string]: unknown;
|
|
251
|
+
};
|
|
252
|
+
[key: string]: unknown;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Author-facing options for the PlatformReact Vite pass.
|
|
256
|
+
*/
|
|
257
|
+
interface PlatformReactPluginOptions {
|
|
258
|
+
/**
|
|
259
|
+
* Root directory the manifest path is resolved against. When omitted,
|
|
260
|
+
* Vite's `configResolved` populates it from `config.root`.
|
|
261
|
+
*/
|
|
262
|
+
root?: string;
|
|
263
|
+
/**
|
|
264
|
+
* Manifest path. Relative paths resolve against `root`. Defaults to
|
|
265
|
+
* `feature.manifest.json`.
|
|
266
|
+
*/
|
|
267
|
+
manifestPath?: string;
|
|
268
|
+
/**
|
|
269
|
+
* Output prefix for emitted page assets and the companion manifest.
|
|
270
|
+
* Defaults to `platform-react/`.
|
|
271
|
+
*/
|
|
272
|
+
outputPrefix?: string;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Build-time Vite/Rollup plugin pass for EthisysCore PlatformReact pages
|
|
276
|
+
* (RFC 0003: the high-trust, host-extension tier). For each entry under
|
|
277
|
+
* `ui.platformReactPages[]` in the manifest, registers a Rollup input that
|
|
278
|
+
* emits an ESM bundle the host loads via `import()` at surface mount time.
|
|
279
|
+
*
|
|
280
|
+
* Behaviour:
|
|
281
|
+
* - For each declared page: registers `{ "platform-react/<id>": <moduleSpecifier> }`
|
|
282
|
+
* in Rollup's input table. Output is forced to `format: "es"` and
|
|
283
|
+
* `inlineDynamicImports: true` so each page ships as ONE bundled module.
|
|
284
|
+
* - Emits a `platform-react/platform-react-pages.json` companion asset listing
|
|
285
|
+
* the declared pages so the host (and the `.ccpkg` packaging step) can
|
|
286
|
+
* inspect what the build produced.
|
|
287
|
+
* - When `ui.platformReactPages` is absent or empty: the pass is a no-op.
|
|
288
|
+
* Composition is expected — the recommended template registers this pass
|
|
289
|
+
* alongside Contract A / Contract B so a single Vite config covers every
|
|
290
|
+
* render mode.
|
|
291
|
+
*
|
|
292
|
+
* Origin enforcement of the bundle URL at runtime is the host's responsibility
|
|
293
|
+
* (see `PlatformReactSurfaceMount.tsx` in `coreconnect-web`). This pass only
|
|
294
|
+
* blocks remote/absolute paths at the manifest layer so a malformed manifest
|
|
295
|
+
* fails fast.
|
|
296
|
+
*/
|
|
297
|
+
declare function ethisysPlatformReactPlugin(options?: PlatformReactPluginOptions): Plugin;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* A fully-validated PlatformReact page declaration. All fields are guaranteed
|
|
301
|
+
* present (no `undefined`), `exportName` is defaulted to `"default"`, and the
|
|
302
|
+
* `moduleSpecifier` is guaranteed to exist on disk when `verifyOnDisk: true`
|
|
303
|
+
* was passed to {@link parsePlatformReactPages}.
|
|
304
|
+
*/
|
|
305
|
+
interface ResolvedPlatformReactPage {
|
|
306
|
+
id: string;
|
|
307
|
+
moduleSpecifier: string;
|
|
308
|
+
exportName: string;
|
|
309
|
+
title: string | null;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Options for {@link parsePlatformReactPages}.
|
|
313
|
+
*/
|
|
314
|
+
interface ParsePlatformReactPagesOptions {
|
|
315
|
+
/**
|
|
316
|
+
* Root directory the manifest path and the page module specifiers are
|
|
317
|
+
* resolved against. Defaults to `process.cwd()`.
|
|
318
|
+
*/
|
|
319
|
+
root?: string;
|
|
320
|
+
/**
|
|
321
|
+
* When `true`, every declared `moduleSpecifier` must exist on disk (relative
|
|
322
|
+
* to {@link root}). The default is `false` so the helper can be used to
|
|
323
|
+
* snapshot-test a manifest without checking-out the page source files.
|
|
324
|
+
*/
|
|
325
|
+
verifyOnDisk?: boolean;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Parse + validate `ui.platformReactPages[]` declarations from a manifest
|
|
329
|
+
* file. Designed for plugin authors writing Vitest tests against their own
|
|
330
|
+
* manifest — the helper applies the same shape and uniqueness rules the
|
|
331
|
+
* build-time Vite pass enforces, so a passing unit test gives the same
|
|
332
|
+
* guarantee a green build would.
|
|
333
|
+
*
|
|
334
|
+
* Returns an empty array when the manifest does not exist OR does not
|
|
335
|
+
* declare `ui.platformReactPages` OR declares it as an empty array.
|
|
336
|
+
*
|
|
337
|
+
* Throws on any malformed declaration. The thrown message matches the
|
|
338
|
+
* build-time error so a failing test reads identically to a failing build.
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```ts
|
|
342
|
+
* import { parsePlatformReactPages } from "@ethisyscore/vite-plugin";
|
|
343
|
+
*
|
|
344
|
+
* test("manifest declares dashboard and admin pages", () => {
|
|
345
|
+
* const pages = parsePlatformReactPages("./feature.manifest.json");
|
|
346
|
+
* expect(pages).toEqual([
|
|
347
|
+
* { id: "dashboard", moduleSpecifier: "src/pages/Dashboard.tsx", exportName: "default", title: "Dashboard" },
|
|
348
|
+
* { id: "admin", moduleSpecifier: "src/pages/Admin.tsx", exportName: "AdminPage", title: null },
|
|
349
|
+
* ]);
|
|
350
|
+
* });
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
declare function parsePlatformReactPages(manifestPath: string, options?: ParsePlatformReactPagesOptions): ResolvedPlatformReactPage[];
|
|
354
|
+
|
|
222
355
|
interface EthisysPluginOptions {
|
|
223
356
|
/**
|
|
224
357
|
* Path to the manifest file, relative to Vite's root directory.
|
|
@@ -242,4 +375,4 @@ interface EthisysPluginOptions {
|
|
|
242
375
|
*/
|
|
243
376
|
declare function ethisysManifestPlugin(options?: EthisysPluginOptions): Plugin;
|
|
244
377
|
|
|
245
|
-
export { CONTRACT_B_IMPORT_MAP_ALLOWLIST, CONTRACT_B_RUNTIME_IMPORTS, CONTRACT_B_SEMANTIC_PRIMITIVES, type ContractAManifest, type ContractAPluginOptions, type ContractBManifest, type ContractBPluginOptions, type EthisysPluginOptions, type ManifestReactiveRuleRef, type ManifestResourceRef, type ValidationFailure, type ValidationResult, ethisysContractAPlugin, ethisysContractBPlugin, ethisysManifestPlugin, validateDeclarativeResource, validateReactiveRule };
|
|
378
|
+
export { CONTRACT_B_IMPORT_MAP_ALLOWLIST, CONTRACT_B_RUNTIME_IMPORTS, CONTRACT_B_SEMANTIC_PRIMITIVES, type ContractAManifest, type ContractAPluginOptions, type ContractBManifest, type ContractBPluginOptions, type EthisysPluginOptions, type ManifestReactiveRuleRef, type ManifestResourceRef, type ParsePlatformReactPagesOptions, type PlatformReactManifest, type PlatformReactPageDeclaration, type PlatformReactPluginOptions, type ResolvedPlatformReactPage, type ValidationFailure, type ValidationResult, ethisysContractAPlugin, ethisysContractBPlugin, ethisysManifestPlugin, ethisysPlatformReactPlugin, parsePlatformReactPages, validateDeclarativeResource, validateReactiveRule };
|