@ethisyscore/vite-plugin 1.122.0 → 1.123.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.d.cts CHANGED
@@ -198,7 +198,7 @@ interface ContractBPluginOptions {
198
198
  * Behaviour:
199
199
  * - For `renderMode: "remote-runtime"`: declares a single ESM worker entry as
200
200
  * the Rollup input table. The output is forced to `format: "es"` and
201
- * `inlineDynamicImports: true` so a Contract B plugin always ships as ONE
201
+ * `codeSplitting: false` so a Contract B plugin always ships as ONE
202
202
  * bundled module — no chunk splitting, no shared chunks, no async imports
203
203
  * spread across multiple files. This is the precondition for E4.S4's
204
204
  * frozen import map.
@@ -299,7 +299,7 @@ interface PlatformReactPluginOptions {
299
299
  * Behaviour:
300
300
  * - For each declared page: registers `{ "platform-react/<id>": <moduleSpecifier> }`
301
301
  * in Rollup's input table. Output is forced to `format: "es"` and
302
- * `inlineDynamicImports: true` so each page ships as ONE bundled module.
302
+ * `codeSplitting: false` so each page ships as ONE bundled module.
303
303
  * - Emits a `platform-react/platform-react-pages.json` companion asset listing
304
304
  * the declared pages so the host (and the `.ccpkg` packaging step) can
305
305
  * inspect what the build produced.
@@ -592,7 +592,7 @@ interface PlatformReactBuildSummary {
592
592
  * while a feature component pulls in the `components/ui/dialog` wrapper of the
593
593
  * same name). The host loader handles `import * as X`, plain `import { Y }`,
594
594
  * default imports, and aliased EXPORTS — but throws "Unexpected identifier 'as'"
595
- * on aliased named IMPORTS `{ X as Y }`. In a final `inlineDynamicImports`
595
+ * on aliased named IMPORTS `{ X as Y }`. In a final single-chunk
596
596
  * bundle every remaining `import { … } from "…"` is an EXTERNAL import, so
597
597
  * rewriting any that contain `as` into `import * as ns from "…"; const local =
598
598
  * ns.imported, …;` is safe and removes the only construct the loader rejects.
@@ -644,8 +644,8 @@ declare function virtualPageEntry(page: PlatformReactPageInput, config: {
644
644
  * per-asset SHA-256 `platform-react-digest-map.json` the host's verified loader
645
645
  * and the `.ccpkg` packaging step read.
646
646
  *
647
- * Each PlatformReact page must be ONE bundle (`inlineDynamicImports: true`), and
648
- * Rollup rejects that with more than one input — so this runs one Vite sub-build
647
+ * Each PlatformReact page must be ONE bundle (`codeSplitting: false`), and
648
+ * the bundler rejects that with more than one input — so this runs one Vite sub-build
649
649
  * per surface, each with a single synthesised virtual entry (see
650
650
  * {@link virtualPageEntry}). The generic seams (host externals, dedupe, the
651
651
  * host-loader aliased-import rewrite, the digest/summary contract) live here;
package/dist/index.d.ts CHANGED
@@ -198,7 +198,7 @@ interface ContractBPluginOptions {
198
198
  * Behaviour:
199
199
  * - For `renderMode: "remote-runtime"`: declares a single ESM worker entry as
200
200
  * the Rollup input table. The output is forced to `format: "es"` and
201
- * `inlineDynamicImports: true` so a Contract B plugin always ships as ONE
201
+ * `codeSplitting: false` so a Contract B plugin always ships as ONE
202
202
  * bundled module — no chunk splitting, no shared chunks, no async imports
203
203
  * spread across multiple files. This is the precondition for E4.S4's
204
204
  * frozen import map.
@@ -299,7 +299,7 @@ interface PlatformReactPluginOptions {
299
299
  * Behaviour:
300
300
  * - For each declared page: registers `{ "platform-react/<id>": <moduleSpecifier> }`
301
301
  * in Rollup's input table. Output is forced to `format: "es"` and
302
- * `inlineDynamicImports: true` so each page ships as ONE bundled module.
302
+ * `codeSplitting: false` so each page ships as ONE bundled module.
303
303
  * - Emits a `platform-react/platform-react-pages.json` companion asset listing
304
304
  * the declared pages so the host (and the `.ccpkg` packaging step) can
305
305
  * inspect what the build produced.
@@ -592,7 +592,7 @@ interface PlatformReactBuildSummary {
592
592
  * while a feature component pulls in the `components/ui/dialog` wrapper of the
593
593
  * same name). The host loader handles `import * as X`, plain `import { Y }`,
594
594
  * default imports, and aliased EXPORTS — but throws "Unexpected identifier 'as'"
595
- * on aliased named IMPORTS `{ X as Y }`. In a final `inlineDynamicImports`
595
+ * on aliased named IMPORTS `{ X as Y }`. In a final single-chunk
596
596
  * bundle every remaining `import { … } from "…"` is an EXTERNAL import, so
597
597
  * rewriting any that contain `as` into `import * as ns from "…"; const local =
598
598
  * ns.imported, …;` is safe and removes the only construct the loader rejects.
@@ -644,8 +644,8 @@ declare function virtualPageEntry(page: PlatformReactPageInput, config: {
644
644
  * per-asset SHA-256 `platform-react-digest-map.json` the host's verified loader
645
645
  * and the `.ccpkg` packaging step read.
646
646
  *
647
- * Each PlatformReact page must be ONE bundle (`inlineDynamicImports: true`), and
648
- * Rollup rejects that with more than one input — so this runs one Vite sub-build
647
+ * Each PlatformReact page must be ONE bundle (`codeSplitting: false`), and
648
+ * the bundler rejects that with more than one input — so this runs one Vite sub-build
649
649
  * per surface, each with a single synthesised virtual entry (see
650
650
  * {@link virtualPageEntry}). The generic seams (host externals, dedupe, the
651
651
  * host-loader aliased-import rewrite, the digest/summary contract) live here;
package/dist/index.js CHANGED
@@ -454,7 +454,7 @@ function ethisysContractBPlugin(options = {}) {
454
454
  const externalSpecifiers = new Set(CONTRACT_B_IMPORT_MAP_ALLOWLIST);
455
455
  return {
456
456
  build: {
457
- rollupOptions: {
457
+ rolldownOptions: {
458
458
  input: { worker: slash(workerEntryAbs) },
459
459
  external: (id) => externalSpecifiers.has(id),
460
460
  // CRITICAL: single-file output for the worker bundle. The
@@ -462,7 +462,7 @@ function ethisysContractBPlugin(options = {}) {
462
462
  // chunk splitting or dynamic-import shards would defeat it.
463
463
  output: {
464
464
  format: "es",
465
- inlineDynamicImports: true,
465
+ codeSplitting: false,
466
466
  entryFileNames: `${outputPrefix}[name].js`,
467
467
  chunkFileNames: `${outputPrefix}[name]-[hash].js`,
468
468
  assetFileNames: `${outputPrefix}[name][extname]`
@@ -596,6 +596,48 @@ function ethisysContractBPlugin(options = {}) {
596
596
  };
597
597
  }
598
598
 
599
+ // src/utils/inline-css-sourcemap-log.ts
600
+ var PRE_CSS_POST_PLUGIN = /^(?:@tailwindcss\/vite:|vite:css$)/;
601
+ function isInlineCssSourcemapNoise(log) {
602
+ return log.code === "SOURCEMAP_BROKEN" && PRE_CSS_POST_PLUGIN.test(log.plugin ?? "") && /\.css\?(?:[^#]*&)?inline(?:[&=#]|$)/.test(log.id ?? "");
603
+ }
604
+ function dropInlineCssSourcemapNoise(next) {
605
+ const filtered = (level, log, handler) => {
606
+ if (isInlineCssSourcemapNoise(log)) {
607
+ return;
608
+ }
609
+ if (next) {
610
+ next(level, log, handler);
611
+ return;
612
+ }
613
+ handler(level, log);
614
+ };
615
+ return Object.assign(filtered, { [WRAPPED]: true });
616
+ }
617
+ var WRAPPED = /* @__PURE__ */ Symbol.for("ethisys.vite-plugin.inline-css-sourcemap-noise");
618
+ function wrapResolvedOnLog(config) {
619
+ const writable = config;
620
+ writable.build ??= {};
621
+ writable.build.rolldownOptions ??= {};
622
+ const current = writable.build.rolldownOptions.onLog;
623
+ if (current && current[WRAPPED]) {
624
+ return;
625
+ }
626
+ writable.build.rolldownOptions.onLog = dropInlineCssSourcemapNoise(current);
627
+ }
628
+ function inlineCssSourcemapNoisePlugin() {
629
+ return {
630
+ name: "ethisys-inline-css-sourcemap-noise",
631
+ apply: "build",
632
+ buildStart() {
633
+ const config = this?.environment?.config;
634
+ if (config) {
635
+ wrapResolvedOnLog(config);
636
+ }
637
+ }
638
+ };
639
+ }
640
+
599
641
  // src/utils/strings.ts
600
642
  function slash2(p) {
601
643
  return p.replace(/\\/g, "/");
@@ -1175,7 +1217,8 @@ function makeDefaultBuild(viteBuild) {
1175
1217
  scopePluginCssPlugin(),
1176
1218
  rewriteAliasedExternalImports(),
1177
1219
  // Last, so it sees exactly the bytes the host will fetch.
1178
- assertHostResolvableExternals(ctx.external)
1220
+ assertHostResolvableExternals(ctx.external),
1221
+ inlineCssSourcemapNoisePlugin()
1179
1222
  ],
1180
1223
  resolve: {
1181
1224
  dedupe: [...ctx.dedupe],
@@ -1203,13 +1246,13 @@ function makeDefaultBuild(viteBuild) {
1203
1246
  cssMinify: ctx.cssMinify ?? true,
1204
1247
  reportCompressedSize: ctx.reportCompressedSize ?? false,
1205
1248
  sourcemap: ctx.sourcemap,
1206
- rollupOptions: {
1249
+ rolldownOptions: {
1207
1250
  input: { [ctx.pageId]: ctx.entryId },
1208
1251
  preserveEntrySignatures: "strict",
1209
1252
  external: [...ctx.external],
1210
1253
  output: {
1211
1254
  format: "es",
1212
- inlineDynamicImports: true,
1255
+ codeSplitting: false,
1213
1256
  sourcemapExcludeSources: ctx.sourcemapExcludeSources ?? true,
1214
1257
  entryFileNames: `${ctx.outputPrefix}/[name].js`,
1215
1258
  chunkFileNames: `${ctx.outputPrefix}/[name]-[hash].js`,
@@ -1560,7 +1603,7 @@ function ethisysPlatformReactPagesPlugin(options = {}) {
1560
1603
  // throws on the first hook). Vite minifies production builds by
1561
1604
  // default, so this MUST be forced off for every PlatformReact surface.
1562
1605
  minify: false,
1563
- rollupOptions: {
1606
+ rolldownOptions: {
1564
1607
  // CRITICAL: single-file ESM output per page. The host loads each
1565
1608
  // page via `import(url)` at mount time and reads the declared
1566
1609
  // `exportName` from the resulting module namespace. Chunk-split
@@ -1568,7 +1611,7 @@ function ethisysPlatformReactPagesPlugin(options = {}) {
1568
1611
  // import-map surface to resolve sibling chunks.
1569
1612
  output: {
1570
1613
  format: "es",
1571
- inlineDynamicImports: true,
1614
+ codeSplitting: false,
1572
1615
  entryFileNames: `${outputPrefix}[name].js`,
1573
1616
  chunkFileNames: `${outputPrefix}[name]-[hash].js`,
1574
1617
  assetFileNames: `${outputPrefix}[name][extname]`
@@ -1621,25 +1664,29 @@ function ethisysPlatformReactPagesPlugin(options = {}) {
1621
1664
  }
1622
1665
  const writable = config;
1623
1666
  writable.build ??= {};
1624
- writable.build.rollupOptions ??= {};
1625
- const rollupOptions = writable.build.rollupOptions;
1626
- const existing = rollupOptions.input;
1667
+ writable.build.rolldownOptions ??= {};
1668
+ const rolldownOptions = writable.build.rolldownOptions;
1669
+ const existing = rolldownOptions.input;
1627
1670
  if (existing && typeof existing === "object" && !Array.isArray(existing)) {
1628
- rollupOptions.input = { ...existing, ...input };
1671
+ rolldownOptions.input = { ...existing, ...input };
1629
1672
  } else if (typeof existing === "string") {
1630
- rollupOptions.input = { _entry: existing, ...input };
1673
+ rolldownOptions.input = { _entry: existing, ...input };
1631
1674
  } else if (Array.isArray(existing)) {
1632
1675
  const indexed = {};
1633
1676
  existing.forEach((entry, idx) => {
1634
1677
  indexed[`_entry${idx}`] = entry;
1635
1678
  });
1636
- rollupOptions.input = { ...indexed, ...input };
1679
+ rolldownOptions.input = { ...indexed, ...input };
1637
1680
  } else {
1638
- rollupOptions.input = input;
1681
+ rolldownOptions.input = input;
1639
1682
  }
1640
1683
  },
1641
1684
  buildStart() {
1642
1685
  validate();
1686
+ const config = this?.environment?.config;
1687
+ if (isBuild && config) {
1688
+ wrapResolvedOnLog(config);
1689
+ }
1643
1690
  },
1644
1691
  /**
1645
1692
  * Emit the companion `platform-react-pages.json` listing every declared
@@ -2018,7 +2065,7 @@ var defaultBuild = async (page) => {
2018
2065
  build: {
2019
2066
  outDir: page.outDir,
2020
2067
  emptyOutDir: true,
2021
- rollupOptions: {
2068
+ rolldownOptions: {
2022
2069
  input: resolve(page.root, page.entryPath)
2023
2070
  }
2024
2071
  }
@@ -2238,7 +2285,7 @@ function ethisysManifestPlugin(options = {}) {
2238
2285
  }
2239
2286
  return {
2240
2287
  build: {
2241
- rollupOptions: {
2288
+ rolldownOptions: {
2242
2289
  input
2243
2290
  }
2244
2291
  }