@ethisyscore/vite-plugin 1.16.0 → 1.18.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/index.cjs +238 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +165 -2
- package/dist/index.d.ts +165 -2
- package/dist/index.js +235 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin } from 'vite';
|
|
1
|
+
import { Plugin, InlineConfig } from 'vite';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Reference from the plugin manifest to an SDUI resource JSON file.
|
|
@@ -352,6 +352,169 @@ interface ParsePlatformReactPagesOptions {
|
|
|
352
352
|
*/
|
|
353
353
|
declare function parsePlatformReactPages(manifestPath: string, options?: ParsePlatformReactPagesOptions): ResolvedPlatformReactPage[];
|
|
354
354
|
|
|
355
|
+
/**
|
|
356
|
+
* Specifiers the host realm provides at runtime — never bundled into a page.
|
|
357
|
+
* A `components/ui/*` abstraction that re-exports `@mui/material` therefore
|
|
358
|
+
* costs zero bundle weight and shares the host's MUI singleton + theme.
|
|
359
|
+
*/
|
|
360
|
+
declare const PLATFORM_REACT_EXTERNALS: readonly string[];
|
|
361
|
+
/**
|
|
362
|
+
* Bundled deps that MUST resolve to a single copy. When a bundled dep (e.g.
|
|
363
|
+
* `@tanstack/react-query`) is imported by BOTH the plugin's own hooks and the
|
|
364
|
+
* SDK foundation (aliased cross-repo to a sibling `dist`), the bundler otherwise
|
|
365
|
+
* resolves two copies — one per repo's `node_modules`. Two module instances =
|
|
366
|
+
* two React contexts, so a provider in one is invisible to a consumer in the
|
|
367
|
+
* other (the classic "No QueryClient set"). Pin them to one copy.
|
|
368
|
+
*/
|
|
369
|
+
declare const PLATFORM_REACT_DEDUPE: readonly string[];
|
|
370
|
+
/** A `resolve.alias` entry (string or regex find), as Vite accepts. */
|
|
371
|
+
interface PlatformReactAlias {
|
|
372
|
+
find: string | RegExp;
|
|
373
|
+
replacement: string;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* One surface declared in `feature.manifest.json` (`ui.platformReactPages[]`).
|
|
377
|
+
* `views` is the page's `useView` manifest slice — the adapter-view modules it
|
|
378
|
+
* renders by name (`{ DayView: "src/adapter/<feature>/DayView.tsx" }`). It rides
|
|
379
|
+
* along as an open extra field the SDK's manifest readers ignore.
|
|
380
|
+
*/
|
|
381
|
+
interface PlatformReactPageInput {
|
|
382
|
+
id: string;
|
|
383
|
+
moduleSpecifier: string;
|
|
384
|
+
exportName?: string;
|
|
385
|
+
title?: string | null;
|
|
386
|
+
views?: Record<string, string>;
|
|
387
|
+
}
|
|
388
|
+
/** The fully-resolved per-page build context handed to the (injectable) builder. */
|
|
389
|
+
interface PlatformReactBuildContext {
|
|
390
|
+
pageId: string;
|
|
391
|
+
/** Virtual entry module id (`\0virtual:surface/<id>`). */
|
|
392
|
+
entryId: string;
|
|
393
|
+
/** Rollup plugin that resolves + loads the synthesised virtual entry. */
|
|
394
|
+
surfacePlugin: Plugin;
|
|
395
|
+
root: string;
|
|
396
|
+
outDir: string;
|
|
397
|
+
outputPrefix: string;
|
|
398
|
+
external: readonly string[];
|
|
399
|
+
dedupe: readonly string[];
|
|
400
|
+
alias: PlatformReactAlias[];
|
|
401
|
+
plugins: Plugin[];
|
|
402
|
+
target: string;
|
|
403
|
+
minify: boolean;
|
|
404
|
+
sourcemap: boolean;
|
|
405
|
+
}
|
|
406
|
+
/** Low-level Vite `build` function. Defaults to a dynamic `import("vite")`. */
|
|
407
|
+
type ViteBuildFn = (config: InlineConfig) => Promise<unknown>;
|
|
408
|
+
/** Injectable per-page builder. Defaults to a real Vite library build. */
|
|
409
|
+
type PlatformReactViteBuild = (ctx: PlatformReactBuildContext) => Promise<void>;
|
|
410
|
+
interface BuildPlatformReactPagesOptions {
|
|
411
|
+
/** Root the manifest + `src/…` paths resolve against. Default `process.cwd()`. */
|
|
412
|
+
root?: string;
|
|
413
|
+
/** Manifest path (relative to `root`). Default `feature.manifest.json`. */
|
|
414
|
+
manifestPath?: string;
|
|
415
|
+
/** Inline manifest object (test injection). When omitted, read from disk. */
|
|
416
|
+
manifest?: unknown;
|
|
417
|
+
/** Output directory the bundles + companion JSON land in. Default `dist`. */
|
|
418
|
+
outDir?: string;
|
|
419
|
+
/** Sub-directory + summary/digest key prefix. Default `platform-react`. */
|
|
420
|
+
outputPrefix?: string;
|
|
421
|
+
/** Plugin-specific `resolve.alias` entries (contracts, router shim, `@/`, …). */
|
|
422
|
+
alias?: PlatformReactAlias[];
|
|
423
|
+
/** Plugin-specific Vite plugins (e.g. `react()`, `tailwindcss()`). */
|
|
424
|
+
plugins?: Plugin[];
|
|
425
|
+
/** Bundled deps to dedupe. Default {@link PLATFORM_REACT_DEDUPE}. */
|
|
426
|
+
dedupe?: readonly string[];
|
|
427
|
+
/** Host externals. Default {@link PLATFORM_REACT_EXTERNALS}. */
|
|
428
|
+
external?: readonly string[];
|
|
429
|
+
/** Module specifier the generated entry imports `definePluginPage` from. */
|
|
430
|
+
definePluginPageSpecifier?: string;
|
|
431
|
+
/** Source dir stripped when rewriting manifest paths to the alias. Default `src`. */
|
|
432
|
+
srcDir?: string;
|
|
433
|
+
/** Alias prefix manifest `src/…` paths are rewritten to. Default `@` (→ `@/…`). */
|
|
434
|
+
aliasPrefix?: string;
|
|
435
|
+
/** Rollup build target. Default `es2022`. */
|
|
436
|
+
target?: string;
|
|
437
|
+
/** Minify output. Default `false` (digest stability + debuggability). */
|
|
438
|
+
minify?: boolean;
|
|
439
|
+
/** Emit sourcemaps. Default `true`. */
|
|
440
|
+
sourcemap?: boolean;
|
|
441
|
+
/** Wipe `outDir` before building. Default `true`. */
|
|
442
|
+
clean?: boolean;
|
|
443
|
+
/** Progress logger. Default `console`. */
|
|
444
|
+
logger?: Pick<Console, "log" | "warn">;
|
|
445
|
+
/** Low-level Vite `build` (production override so the CONSUMER's vite is used). */
|
|
446
|
+
viteBuild?: ViteBuildFn;
|
|
447
|
+
/** Injectable per-page builder (test injection — skips Vite entirely). */
|
|
448
|
+
build?: PlatformReactViteBuild;
|
|
449
|
+
/** Injectable bundle reader for digesting. Default `fs.readFileSync` (utf-8). */
|
|
450
|
+
readFile?: (path: string) => string;
|
|
451
|
+
/** Injectable file writer. Default `fs.writeFileSync` (creating dirs). */
|
|
452
|
+
writeFile?: (path: string, contents: string) => void;
|
|
453
|
+
}
|
|
454
|
+
interface PlatformReactBuildSummary {
|
|
455
|
+
pages: Array<{
|
|
456
|
+
id: string;
|
|
457
|
+
exportName: string;
|
|
458
|
+
title: string | null;
|
|
459
|
+
bundlePath: string;
|
|
460
|
+
source: string;
|
|
461
|
+
}>;
|
|
462
|
+
digests: Array<{
|
|
463
|
+
path: string;
|
|
464
|
+
sha256: string;
|
|
465
|
+
}>;
|
|
466
|
+
summaryPath: string | null;
|
|
467
|
+
digestMapPath: string | null;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Rollup output pass: rewrite aliased named imports from host externals into the
|
|
471
|
+
* namespace-import form the host's PlatformReact loader accepts.
|
|
472
|
+
*
|
|
473
|
+
* esbuild emits `import { Dialog as Dialog$1 } from "@mui/material"` to
|
|
474
|
+
* deconflict a name collision (an adapter view imports MUI `Dialog` directly
|
|
475
|
+
* while a feature component pulls in the `components/ui/dialog` wrapper of the
|
|
476
|
+
* same name). The host loader handles `import * as X`, plain `import { Y }`,
|
|
477
|
+
* default imports, and aliased EXPORTS — but throws "Unexpected identifier 'as'"
|
|
478
|
+
* on aliased named IMPORTS `{ X as Y }`. In a final `inlineDynamicImports`
|
|
479
|
+
* bundle every remaining `import { … } from "…"` is an EXTERNAL import, so
|
|
480
|
+
* rewriting any that contain `as` into `import * as ns from "…"; const local =
|
|
481
|
+
* ns.imported, …;` is safe and removes the only construct the loader rejects.
|
|
482
|
+
* Runs in `renderChunk`, before the host-verified digest is computed.
|
|
483
|
+
*/
|
|
484
|
+
declare function rewriteAliasedExternalImports(): Plugin;
|
|
485
|
+
/**
|
|
486
|
+
* Synthesise one isolated PlatformReact entry per surface straight from its
|
|
487
|
+
* manifest declaration: `definePluginPage(Page, { …views })`, importing ONLY
|
|
488
|
+
* that surface's page (`moduleSpecifier`) + adapter views (`views`) so each
|
|
489
|
+
* bundle stays self-contained. Returned as a Rollup virtual module so there are
|
|
490
|
+
* no physical per-page entry files — the manifest is the single source of truth.
|
|
491
|
+
* `src/…` paths are rewritten to the alias the build resolves (e.g. `@/…`).
|
|
492
|
+
*/
|
|
493
|
+
declare function virtualPageEntry(page: PlatformReactPageInput, config: {
|
|
494
|
+
definePluginPageSpecifier: string;
|
|
495
|
+
toAlias: (p: string) => string;
|
|
496
|
+
}): {
|
|
497
|
+
id: string;
|
|
498
|
+
plugin: Plugin;
|
|
499
|
+
};
|
|
500
|
+
/**
|
|
501
|
+
* Build every `ui.platformReactPages[]` surface as its own self-contained ESM
|
|
502
|
+
* bundle and emit the companion `platform-react-pages.json` summary + the
|
|
503
|
+
* per-asset SHA-256 `platform-react-digest-map.json` the host's verified loader
|
|
504
|
+
* and the `.ccpkg` packaging step read.
|
|
505
|
+
*
|
|
506
|
+
* Each PlatformReact page must be ONE bundle (`inlineDynamicImports: true`), and
|
|
507
|
+
* Rollup rejects that with more than one input — so this runs one Vite sub-build
|
|
508
|
+
* per surface, each with a single synthesised virtual entry (see
|
|
509
|
+
* {@link virtualPageEntry}). The generic seams (host externals, dedupe, the
|
|
510
|
+
* host-loader aliased-import rewrite, the digest/summary contract) live here;
|
|
511
|
+
* the plugin supplies only its `alias` entries + `plugins` (and, in production,
|
|
512
|
+
* its own `viteBuild` so the consumer's Vite is used, not the SDK's).
|
|
513
|
+
*
|
|
514
|
+
* No-op (returns empty) when no pages are declared.
|
|
515
|
+
*/
|
|
516
|
+
declare function buildPlatformReactPages(options?: BuildPlatformReactPagesOptions): Promise<PlatformReactBuildSummary>;
|
|
517
|
+
|
|
355
518
|
/** One emitted artifact from a per-page Vite sub-build. */
|
|
356
519
|
type IframeBuildOutputItem = {
|
|
357
520
|
type: "chunk";
|
|
@@ -443,4 +606,4 @@ interface EthisysPluginOptions {
|
|
|
443
606
|
*/
|
|
444
607
|
declare function ethisysManifestPlugin(options?: EthisysPluginOptions): Plugin;
|
|
445
608
|
|
|
446
|
-
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 IframeBuildContext, type IframeBuildOutputItem, type IframeBuildResult, type IframeSandboxBuildSummary, type IframeSandboxPluginOptions, type IframeViteBuild, type ManifestReactiveRuleRef, type ManifestResourceRef, type ParsePlatformReactPagesOptions, type PlatformReactManifest, type PlatformReactPageDeclaration, type PlatformReactPluginOptions, type ResolvedPlatformReactPage, type ValidationFailure, type ValidationResult, buildIframeSandboxPages, ethisysContractAPlugin, ethisysContractBPlugin, ethisysIframeSandboxPlugin, ethisysManifestPlugin, ethisysPlatformReactPlugin, parsePlatformReactPages, validateDeclarativeResource, validateReactiveRule };
|
|
609
|
+
export { type BuildPlatformReactPagesOptions, CONTRACT_B_IMPORT_MAP_ALLOWLIST, CONTRACT_B_RUNTIME_IMPORTS, CONTRACT_B_SEMANTIC_PRIMITIVES, type ContractAManifest, type ContractAPluginOptions, type ContractBManifest, type ContractBPluginOptions, type EthisysPluginOptions, type IframeBuildContext, type IframeBuildOutputItem, type IframeBuildResult, type IframeSandboxBuildSummary, type IframeSandboxPluginOptions, type IframeViteBuild, type ManifestReactiveRuleRef, type ManifestResourceRef, PLATFORM_REACT_DEDUPE, PLATFORM_REACT_EXTERNALS, type ParsePlatformReactPagesOptions, type PlatformReactAlias, type PlatformReactBuildContext, type PlatformReactBuildSummary, type PlatformReactManifest, type PlatformReactPageDeclaration, type PlatformReactPageInput, type PlatformReactPluginOptions, type PlatformReactViteBuild, type ResolvedPlatformReactPage, type ValidationFailure, type ValidationResult, type ViteBuildFn, buildIframeSandboxPages, buildPlatformReactPages, ethisysContractAPlugin, ethisysContractBPlugin, ethisysIframeSandboxPlugin, ethisysManifestPlugin, ethisysPlatformReactPlugin, parsePlatformReactPages, rewriteAliasedExternalImports, validateDeclarativeResource, validateReactiveRule, virtualPageEntry };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin } from 'vite';
|
|
1
|
+
import { Plugin, InlineConfig } from 'vite';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Reference from the plugin manifest to an SDUI resource JSON file.
|
|
@@ -352,6 +352,169 @@ interface ParsePlatformReactPagesOptions {
|
|
|
352
352
|
*/
|
|
353
353
|
declare function parsePlatformReactPages(manifestPath: string, options?: ParsePlatformReactPagesOptions): ResolvedPlatformReactPage[];
|
|
354
354
|
|
|
355
|
+
/**
|
|
356
|
+
* Specifiers the host realm provides at runtime — never bundled into a page.
|
|
357
|
+
* A `components/ui/*` abstraction that re-exports `@mui/material` therefore
|
|
358
|
+
* costs zero bundle weight and shares the host's MUI singleton + theme.
|
|
359
|
+
*/
|
|
360
|
+
declare const PLATFORM_REACT_EXTERNALS: readonly string[];
|
|
361
|
+
/**
|
|
362
|
+
* Bundled deps that MUST resolve to a single copy. When a bundled dep (e.g.
|
|
363
|
+
* `@tanstack/react-query`) is imported by BOTH the plugin's own hooks and the
|
|
364
|
+
* SDK foundation (aliased cross-repo to a sibling `dist`), the bundler otherwise
|
|
365
|
+
* resolves two copies — one per repo's `node_modules`. Two module instances =
|
|
366
|
+
* two React contexts, so a provider in one is invisible to a consumer in the
|
|
367
|
+
* other (the classic "No QueryClient set"). Pin them to one copy.
|
|
368
|
+
*/
|
|
369
|
+
declare const PLATFORM_REACT_DEDUPE: readonly string[];
|
|
370
|
+
/** A `resolve.alias` entry (string or regex find), as Vite accepts. */
|
|
371
|
+
interface PlatformReactAlias {
|
|
372
|
+
find: string | RegExp;
|
|
373
|
+
replacement: string;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* One surface declared in `feature.manifest.json` (`ui.platformReactPages[]`).
|
|
377
|
+
* `views` is the page's `useView` manifest slice — the adapter-view modules it
|
|
378
|
+
* renders by name (`{ DayView: "src/adapter/<feature>/DayView.tsx" }`). It rides
|
|
379
|
+
* along as an open extra field the SDK's manifest readers ignore.
|
|
380
|
+
*/
|
|
381
|
+
interface PlatformReactPageInput {
|
|
382
|
+
id: string;
|
|
383
|
+
moduleSpecifier: string;
|
|
384
|
+
exportName?: string;
|
|
385
|
+
title?: string | null;
|
|
386
|
+
views?: Record<string, string>;
|
|
387
|
+
}
|
|
388
|
+
/** The fully-resolved per-page build context handed to the (injectable) builder. */
|
|
389
|
+
interface PlatformReactBuildContext {
|
|
390
|
+
pageId: string;
|
|
391
|
+
/** Virtual entry module id (`\0virtual:surface/<id>`). */
|
|
392
|
+
entryId: string;
|
|
393
|
+
/** Rollup plugin that resolves + loads the synthesised virtual entry. */
|
|
394
|
+
surfacePlugin: Plugin;
|
|
395
|
+
root: string;
|
|
396
|
+
outDir: string;
|
|
397
|
+
outputPrefix: string;
|
|
398
|
+
external: readonly string[];
|
|
399
|
+
dedupe: readonly string[];
|
|
400
|
+
alias: PlatformReactAlias[];
|
|
401
|
+
plugins: Plugin[];
|
|
402
|
+
target: string;
|
|
403
|
+
minify: boolean;
|
|
404
|
+
sourcemap: boolean;
|
|
405
|
+
}
|
|
406
|
+
/** Low-level Vite `build` function. Defaults to a dynamic `import("vite")`. */
|
|
407
|
+
type ViteBuildFn = (config: InlineConfig) => Promise<unknown>;
|
|
408
|
+
/** Injectable per-page builder. Defaults to a real Vite library build. */
|
|
409
|
+
type PlatformReactViteBuild = (ctx: PlatformReactBuildContext) => Promise<void>;
|
|
410
|
+
interface BuildPlatformReactPagesOptions {
|
|
411
|
+
/** Root the manifest + `src/…` paths resolve against. Default `process.cwd()`. */
|
|
412
|
+
root?: string;
|
|
413
|
+
/** Manifest path (relative to `root`). Default `feature.manifest.json`. */
|
|
414
|
+
manifestPath?: string;
|
|
415
|
+
/** Inline manifest object (test injection). When omitted, read from disk. */
|
|
416
|
+
manifest?: unknown;
|
|
417
|
+
/** Output directory the bundles + companion JSON land in. Default `dist`. */
|
|
418
|
+
outDir?: string;
|
|
419
|
+
/** Sub-directory + summary/digest key prefix. Default `platform-react`. */
|
|
420
|
+
outputPrefix?: string;
|
|
421
|
+
/** Plugin-specific `resolve.alias` entries (contracts, router shim, `@/`, …). */
|
|
422
|
+
alias?: PlatformReactAlias[];
|
|
423
|
+
/** Plugin-specific Vite plugins (e.g. `react()`, `tailwindcss()`). */
|
|
424
|
+
plugins?: Plugin[];
|
|
425
|
+
/** Bundled deps to dedupe. Default {@link PLATFORM_REACT_DEDUPE}. */
|
|
426
|
+
dedupe?: readonly string[];
|
|
427
|
+
/** Host externals. Default {@link PLATFORM_REACT_EXTERNALS}. */
|
|
428
|
+
external?: readonly string[];
|
|
429
|
+
/** Module specifier the generated entry imports `definePluginPage` from. */
|
|
430
|
+
definePluginPageSpecifier?: string;
|
|
431
|
+
/** Source dir stripped when rewriting manifest paths to the alias. Default `src`. */
|
|
432
|
+
srcDir?: string;
|
|
433
|
+
/** Alias prefix manifest `src/…` paths are rewritten to. Default `@` (→ `@/…`). */
|
|
434
|
+
aliasPrefix?: string;
|
|
435
|
+
/** Rollup build target. Default `es2022`. */
|
|
436
|
+
target?: string;
|
|
437
|
+
/** Minify output. Default `false` (digest stability + debuggability). */
|
|
438
|
+
minify?: boolean;
|
|
439
|
+
/** Emit sourcemaps. Default `true`. */
|
|
440
|
+
sourcemap?: boolean;
|
|
441
|
+
/** Wipe `outDir` before building. Default `true`. */
|
|
442
|
+
clean?: boolean;
|
|
443
|
+
/** Progress logger. Default `console`. */
|
|
444
|
+
logger?: Pick<Console, "log" | "warn">;
|
|
445
|
+
/** Low-level Vite `build` (production override so the CONSUMER's vite is used). */
|
|
446
|
+
viteBuild?: ViteBuildFn;
|
|
447
|
+
/** Injectable per-page builder (test injection — skips Vite entirely). */
|
|
448
|
+
build?: PlatformReactViteBuild;
|
|
449
|
+
/** Injectable bundle reader for digesting. Default `fs.readFileSync` (utf-8). */
|
|
450
|
+
readFile?: (path: string) => string;
|
|
451
|
+
/** Injectable file writer. Default `fs.writeFileSync` (creating dirs). */
|
|
452
|
+
writeFile?: (path: string, contents: string) => void;
|
|
453
|
+
}
|
|
454
|
+
interface PlatformReactBuildSummary {
|
|
455
|
+
pages: Array<{
|
|
456
|
+
id: string;
|
|
457
|
+
exportName: string;
|
|
458
|
+
title: string | null;
|
|
459
|
+
bundlePath: string;
|
|
460
|
+
source: string;
|
|
461
|
+
}>;
|
|
462
|
+
digests: Array<{
|
|
463
|
+
path: string;
|
|
464
|
+
sha256: string;
|
|
465
|
+
}>;
|
|
466
|
+
summaryPath: string | null;
|
|
467
|
+
digestMapPath: string | null;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Rollup output pass: rewrite aliased named imports from host externals into the
|
|
471
|
+
* namespace-import form the host's PlatformReact loader accepts.
|
|
472
|
+
*
|
|
473
|
+
* esbuild emits `import { Dialog as Dialog$1 } from "@mui/material"` to
|
|
474
|
+
* deconflict a name collision (an adapter view imports MUI `Dialog` directly
|
|
475
|
+
* while a feature component pulls in the `components/ui/dialog` wrapper of the
|
|
476
|
+
* same name). The host loader handles `import * as X`, plain `import { Y }`,
|
|
477
|
+
* default imports, and aliased EXPORTS — but throws "Unexpected identifier 'as'"
|
|
478
|
+
* on aliased named IMPORTS `{ X as Y }`. In a final `inlineDynamicImports`
|
|
479
|
+
* bundle every remaining `import { … } from "…"` is an EXTERNAL import, so
|
|
480
|
+
* rewriting any that contain `as` into `import * as ns from "…"; const local =
|
|
481
|
+
* ns.imported, …;` is safe and removes the only construct the loader rejects.
|
|
482
|
+
* Runs in `renderChunk`, before the host-verified digest is computed.
|
|
483
|
+
*/
|
|
484
|
+
declare function rewriteAliasedExternalImports(): Plugin;
|
|
485
|
+
/**
|
|
486
|
+
* Synthesise one isolated PlatformReact entry per surface straight from its
|
|
487
|
+
* manifest declaration: `definePluginPage(Page, { …views })`, importing ONLY
|
|
488
|
+
* that surface's page (`moduleSpecifier`) + adapter views (`views`) so each
|
|
489
|
+
* bundle stays self-contained. Returned as a Rollup virtual module so there are
|
|
490
|
+
* no physical per-page entry files — the manifest is the single source of truth.
|
|
491
|
+
* `src/…` paths are rewritten to the alias the build resolves (e.g. `@/…`).
|
|
492
|
+
*/
|
|
493
|
+
declare function virtualPageEntry(page: PlatformReactPageInput, config: {
|
|
494
|
+
definePluginPageSpecifier: string;
|
|
495
|
+
toAlias: (p: string) => string;
|
|
496
|
+
}): {
|
|
497
|
+
id: string;
|
|
498
|
+
plugin: Plugin;
|
|
499
|
+
};
|
|
500
|
+
/**
|
|
501
|
+
* Build every `ui.platformReactPages[]` surface as its own self-contained ESM
|
|
502
|
+
* bundle and emit the companion `platform-react-pages.json` summary + the
|
|
503
|
+
* per-asset SHA-256 `platform-react-digest-map.json` the host's verified loader
|
|
504
|
+
* and the `.ccpkg` packaging step read.
|
|
505
|
+
*
|
|
506
|
+
* Each PlatformReact page must be ONE bundle (`inlineDynamicImports: true`), and
|
|
507
|
+
* Rollup rejects that with more than one input — so this runs one Vite sub-build
|
|
508
|
+
* per surface, each with a single synthesised virtual entry (see
|
|
509
|
+
* {@link virtualPageEntry}). The generic seams (host externals, dedupe, the
|
|
510
|
+
* host-loader aliased-import rewrite, the digest/summary contract) live here;
|
|
511
|
+
* the plugin supplies only its `alias` entries + `plugins` (and, in production,
|
|
512
|
+
* its own `viteBuild` so the consumer's Vite is used, not the SDK's).
|
|
513
|
+
*
|
|
514
|
+
* No-op (returns empty) when no pages are declared.
|
|
515
|
+
*/
|
|
516
|
+
declare function buildPlatformReactPages(options?: BuildPlatformReactPagesOptions): Promise<PlatformReactBuildSummary>;
|
|
517
|
+
|
|
355
518
|
/** One emitted artifact from a per-page Vite sub-build. */
|
|
356
519
|
type IframeBuildOutputItem = {
|
|
357
520
|
type: "chunk";
|
|
@@ -443,4 +606,4 @@ interface EthisysPluginOptions {
|
|
|
443
606
|
*/
|
|
444
607
|
declare function ethisysManifestPlugin(options?: EthisysPluginOptions): Plugin;
|
|
445
608
|
|
|
446
|
-
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 IframeBuildContext, type IframeBuildOutputItem, type IframeBuildResult, type IframeSandboxBuildSummary, type IframeSandboxPluginOptions, type IframeViteBuild, type ManifestReactiveRuleRef, type ManifestResourceRef, type ParsePlatformReactPagesOptions, type PlatformReactManifest, type PlatformReactPageDeclaration, type PlatformReactPluginOptions, type ResolvedPlatformReactPage, type ValidationFailure, type ValidationResult, buildIframeSandboxPages, ethisysContractAPlugin, ethisysContractBPlugin, ethisysIframeSandboxPlugin, ethisysManifestPlugin, ethisysPlatformReactPlugin, parsePlatformReactPages, validateDeclarativeResource, validateReactiveRule };
|
|
609
|
+
export { type BuildPlatformReactPagesOptions, CONTRACT_B_IMPORT_MAP_ALLOWLIST, CONTRACT_B_RUNTIME_IMPORTS, CONTRACT_B_SEMANTIC_PRIMITIVES, type ContractAManifest, type ContractAPluginOptions, type ContractBManifest, type ContractBPluginOptions, type EthisysPluginOptions, type IframeBuildContext, type IframeBuildOutputItem, type IframeBuildResult, type IframeSandboxBuildSummary, type IframeSandboxPluginOptions, type IframeViteBuild, type ManifestReactiveRuleRef, type ManifestResourceRef, PLATFORM_REACT_DEDUPE, PLATFORM_REACT_EXTERNALS, type ParsePlatformReactPagesOptions, type PlatformReactAlias, type PlatformReactBuildContext, type PlatformReactBuildSummary, type PlatformReactManifest, type PlatformReactPageDeclaration, type PlatformReactPageInput, type PlatformReactPluginOptions, type PlatformReactViteBuild, type ResolvedPlatformReactPage, type ValidationFailure, type ValidationResult, type ViteBuildFn, buildIframeSandboxPages, buildPlatformReactPages, ethisysContractAPlugin, ethisysContractBPlugin, ethisysIframeSandboxPlugin, ethisysManifestPlugin, ethisysPlatformReactPlugin, parsePlatformReactPages, rewriteAliasedExternalImports, validateDeclarativeResource, validateReactiveRule, virtualPageEntry };
|