@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.cjs CHANGED
@@ -456,7 +456,7 @@ function ethisysContractBPlugin(options = {}) {
456
456
  const externalSpecifiers = new Set(CONTRACT_B_IMPORT_MAP_ALLOWLIST);
457
457
  return {
458
458
  build: {
459
- rollupOptions: {
459
+ rolldownOptions: {
460
460
  input: { worker: slash(workerEntryAbs) },
461
461
  external: (id) => externalSpecifiers.has(id),
462
462
  // CRITICAL: single-file output for the worker bundle. The
@@ -464,7 +464,7 @@ function ethisysContractBPlugin(options = {}) {
464
464
  // chunk splitting or dynamic-import shards would defeat it.
465
465
  output: {
466
466
  format: "es",
467
- inlineDynamicImports: true,
467
+ codeSplitting: false,
468
468
  entryFileNames: `${outputPrefix}[name].js`,
469
469
  chunkFileNames: `${outputPrefix}[name]-[hash].js`,
470
470
  assetFileNames: `${outputPrefix}[name][extname]`
@@ -598,6 +598,48 @@ function ethisysContractBPlugin(options = {}) {
598
598
  };
599
599
  }
600
600
 
601
+ // src/utils/inline-css-sourcemap-log.ts
602
+ var PRE_CSS_POST_PLUGIN = /^(?:@tailwindcss\/vite:|vite:css$)/;
603
+ function isInlineCssSourcemapNoise(log) {
604
+ return log.code === "SOURCEMAP_BROKEN" && PRE_CSS_POST_PLUGIN.test(log.plugin ?? "") && /\.css\?(?:[^#]*&)?inline(?:[&=#]|$)/.test(log.id ?? "");
605
+ }
606
+ function dropInlineCssSourcemapNoise(next) {
607
+ const filtered = (level, log, handler) => {
608
+ if (isInlineCssSourcemapNoise(log)) {
609
+ return;
610
+ }
611
+ if (next) {
612
+ next(level, log, handler);
613
+ return;
614
+ }
615
+ handler(level, log);
616
+ };
617
+ return Object.assign(filtered, { [WRAPPED]: true });
618
+ }
619
+ var WRAPPED = /* @__PURE__ */ Symbol.for("ethisys.vite-plugin.inline-css-sourcemap-noise");
620
+ function wrapResolvedOnLog(config) {
621
+ const writable = config;
622
+ writable.build ??= {};
623
+ writable.build.rolldownOptions ??= {};
624
+ const current = writable.build.rolldownOptions.onLog;
625
+ if (current && current[WRAPPED]) {
626
+ return;
627
+ }
628
+ writable.build.rolldownOptions.onLog = dropInlineCssSourcemapNoise(current);
629
+ }
630
+ function inlineCssSourcemapNoisePlugin() {
631
+ return {
632
+ name: "ethisys-inline-css-sourcemap-noise",
633
+ apply: "build",
634
+ buildStart() {
635
+ const config = this?.environment?.config;
636
+ if (config) {
637
+ wrapResolvedOnLog(config);
638
+ }
639
+ }
640
+ };
641
+ }
642
+
601
643
  // src/utils/strings.ts
602
644
  function slash2(p) {
603
645
  return p.replace(/\\/g, "/");
@@ -1177,7 +1219,8 @@ function makeDefaultBuild(viteBuild) {
1177
1219
  scopePluginCssPlugin(),
1178
1220
  rewriteAliasedExternalImports(),
1179
1221
  // Last, so it sees exactly the bytes the host will fetch.
1180
- assertHostResolvableExternals(ctx.external)
1222
+ assertHostResolvableExternals(ctx.external),
1223
+ inlineCssSourcemapNoisePlugin()
1181
1224
  ],
1182
1225
  resolve: {
1183
1226
  dedupe: [...ctx.dedupe],
@@ -1205,13 +1248,13 @@ function makeDefaultBuild(viteBuild) {
1205
1248
  cssMinify: ctx.cssMinify ?? true,
1206
1249
  reportCompressedSize: ctx.reportCompressedSize ?? false,
1207
1250
  sourcemap: ctx.sourcemap,
1208
- rollupOptions: {
1251
+ rolldownOptions: {
1209
1252
  input: { [ctx.pageId]: ctx.entryId },
1210
1253
  preserveEntrySignatures: "strict",
1211
1254
  external: [...ctx.external],
1212
1255
  output: {
1213
1256
  format: "es",
1214
- inlineDynamicImports: true,
1257
+ codeSplitting: false,
1215
1258
  sourcemapExcludeSources: ctx.sourcemapExcludeSources ?? true,
1216
1259
  entryFileNames: `${ctx.outputPrefix}/[name].js`,
1217
1260
  chunkFileNames: `${ctx.outputPrefix}/[name]-[hash].js`,
@@ -1562,7 +1605,7 @@ function ethisysPlatformReactPagesPlugin(options = {}) {
1562
1605
  // throws on the first hook). Vite minifies production builds by
1563
1606
  // default, so this MUST be forced off for every PlatformReact surface.
1564
1607
  minify: false,
1565
- rollupOptions: {
1608
+ rolldownOptions: {
1566
1609
  // CRITICAL: single-file ESM output per page. The host loads each
1567
1610
  // page via `import(url)` at mount time and reads the declared
1568
1611
  // `exportName` from the resulting module namespace. Chunk-split
@@ -1570,7 +1613,7 @@ function ethisysPlatformReactPagesPlugin(options = {}) {
1570
1613
  // import-map surface to resolve sibling chunks.
1571
1614
  output: {
1572
1615
  format: "es",
1573
- inlineDynamicImports: true,
1616
+ codeSplitting: false,
1574
1617
  entryFileNames: `${outputPrefix}[name].js`,
1575
1618
  chunkFileNames: `${outputPrefix}[name]-[hash].js`,
1576
1619
  assetFileNames: `${outputPrefix}[name][extname]`
@@ -1623,25 +1666,29 @@ function ethisysPlatformReactPagesPlugin(options = {}) {
1623
1666
  }
1624
1667
  const writable = config;
1625
1668
  writable.build ??= {};
1626
- writable.build.rollupOptions ??= {};
1627
- const rollupOptions = writable.build.rollupOptions;
1628
- const existing = rollupOptions.input;
1669
+ writable.build.rolldownOptions ??= {};
1670
+ const rolldownOptions = writable.build.rolldownOptions;
1671
+ const existing = rolldownOptions.input;
1629
1672
  if (existing && typeof existing === "object" && !Array.isArray(existing)) {
1630
- rollupOptions.input = { ...existing, ...input };
1673
+ rolldownOptions.input = { ...existing, ...input };
1631
1674
  } else if (typeof existing === "string") {
1632
- rollupOptions.input = { _entry: existing, ...input };
1675
+ rolldownOptions.input = { _entry: existing, ...input };
1633
1676
  } else if (Array.isArray(existing)) {
1634
1677
  const indexed = {};
1635
1678
  existing.forEach((entry, idx) => {
1636
1679
  indexed[`_entry${idx}`] = entry;
1637
1680
  });
1638
- rollupOptions.input = { ...indexed, ...input };
1681
+ rolldownOptions.input = { ...indexed, ...input };
1639
1682
  } else {
1640
- rollupOptions.input = input;
1683
+ rolldownOptions.input = input;
1641
1684
  }
1642
1685
  },
1643
1686
  buildStart() {
1644
1687
  validate();
1688
+ const config = this?.environment?.config;
1689
+ if (isBuild && config) {
1690
+ wrapResolvedOnLog(config);
1691
+ }
1645
1692
  },
1646
1693
  /**
1647
1694
  * Emit the companion `platform-react-pages.json` listing every declared
@@ -2020,7 +2067,7 @@ var defaultBuild = async (page) => {
2020
2067
  build: {
2021
2068
  outDir: page.outDir,
2022
2069
  emptyOutDir: true,
2023
- rollupOptions: {
2070
+ rolldownOptions: {
2024
2071
  input: path.resolve(page.root, page.entryPath)
2025
2072
  }
2026
2073
  }
@@ -2240,7 +2287,7 @@ function ethisysManifestPlugin(options = {}) {
2240
2287
  }
2241
2288
  return {
2242
2289
  build: {
2243
- rollupOptions: {
2290
+ rolldownOptions: {
2244
2291
  input
2245
2292
  }
2246
2293
  }