nitro-nightly 3.0.1-20251110-093536-c21a33ba → 3.0.1-20251110-110934-89e686f1

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.
@@ -664,6 +664,24 @@ function nitroResolveIds() {
664
664
  };
665
665
  }
666
666
 
667
+ //#endregion
668
+ //#region src/build/plugins/sourcemap-min.ts
669
+ function sourcemapMinify() {
670
+ return {
671
+ name: "nitro:sourcemap-minify",
672
+ generateBundle(_options, bundle) {
673
+ for (const [key, asset] of Object.entries(bundle)) {
674
+ if (!key.endsWith(".map") || !("source" in asset) || typeof asset.source !== "string") continue;
675
+ const sourcemap = JSON.parse(asset.source);
676
+ delete sourcemap.sourcesContent;
677
+ delete sourcemap.x_google_ignoreList;
678
+ if ((sourcemap.sources || []).some((s) => s.includes("node_modules"))) sourcemap.mappings = "";
679
+ asset.source = JSON.stringify(sourcemap);
680
+ }
681
+ }
682
+ };
683
+ }
684
+
667
685
  //#endregion
668
686
  //#region src/build/plugins.ts
669
687
  function baseBuildPlugins(nitro, base) {
@@ -708,6 +726,7 @@ function baseBuildPlugins(nitro, base) {
708
726
  exportConditions: nitro.options.exportConditions,
709
727
  writePackageJson: true
710
728
  })));
729
+ if (nitro.options.sourcemap && !nitro.options.dev && nitro.options.experimental.sourcemapMinify !== false) plugins.push(sourcemapMinify());
711
730
  return plugins;
712
731
  }
713
732
 
@@ -72,23 +72,6 @@ function oxc(options) {
72
72
  };
73
73
  }
74
74
 
75
- //#endregion
76
- //#region src/build/plugins/sourcemap-min.ts
77
- function sourcemapMinify() {
78
- return {
79
- name: "nitro:sourcemap-minify",
80
- generateBundle(_options, bundle) {
81
- for (const [key, asset] of Object.entries(bundle)) {
82
- if (!key.endsWith(".map") || !("source" in asset) || typeof asset.source !== "string") continue;
83
- const sourcemap = JSON.parse(asset.source);
84
- if (!(sourcemap.sources || []).some((s) => s.includes("node_modules"))) continue;
85
- sourcemap.mappings = "";
86
- asset.source = JSON.stringify(sourcemap);
87
- }
88
- }
89
- };
90
- }
91
-
92
75
  //#endregion
93
76
  //#region src/build/rollup/config.ts
94
77
  const getRollupConfig = (nitro) => {
@@ -184,7 +167,6 @@ const getRollupConfig = (nitro) => {
184
167
  };
185
168
  config = defu(nitro.options.rollupConfig, config);
186
169
  if (config.output.inlineDynamicImports) delete config.output.manualChunks;
187
- if (nitro.options.sourcemap && !nitro.options.dev && nitro.options.experimental.sourcemapMinify !== false) config.plugins.push(sourcemapMinify());
188
170
  return config;
189
171
  };
190
172
 
@@ -29,7 +29,7 @@ import { spawn } from "node:child_process";
29
29
  * - nodeResolve
30
30
  * - commonjs
31
31
  * - esbuild
32
- * - sourcemapMininify
32
+ * - sourcemapMinify
33
33
  * - json
34
34
  * - raw
35
35
  *
@@ -375,6 +375,7 @@ function createNitroEnvironment(ctx) {
375
375
  rollupOptions: ctx.rollupConfig.config,
376
376
  minify: ctx.nitro.options.minify,
377
377
  emptyOutDir: false,
378
+ sourcemap: ctx.nitro.options.sourcemap,
378
379
  commonjsOptions: { ...ctx.nitro.options.commonJS }
379
380
  },
380
381
  resolve: {
@@ -391,6 +392,7 @@ function createServiceEnvironment(ctx, name, serviceConfig) {
391
392
  build: {
392
393
  rollupOptions: { input: serviceConfig.entry },
393
394
  minify: ctx.nitro.options.minify,
395
+ sourcemap: ctx.nitro.options.sourcemap,
394
396
  outDir: join(ctx.nitro.options.buildDir, "vite/services", name),
395
397
  emptyOutDir: true
396
398
  },
package/dist/_presets.mjs CHANGED
@@ -604,6 +604,10 @@ async function generateWorkerName(nitro) {
604
604
  //#region src/presets/cloudflare/dev.ts
605
605
  async function cloudflareDevModule(nitro) {
606
606
  if (!nitro.options.dev) return;
607
+ nitro.options.unenv.push({
608
+ meta: { name: "nitro:cloudflare-dev" },
609
+ alias: { "cloudflare:workers": resolve(presetsDir, "cloudflare/runtime/shims/workers.dev.mjs") }
610
+ });
607
611
  if (!await resolveModulePath("wrangler", {
608
612
  from: nitro.options.nodeModulesDirs,
609
613
  try: true
@@ -658,7 +662,6 @@ const cloudflarePages = defineNitroPreset({
658
662
  publicDir: "{{ output.dir }}/{{ baseURL }}",
659
663
  serverDir: "{{ output.dir }}/_worker.js"
660
664
  },
661
- unenv: [unenvCfExternals],
662
665
  alias: { _mime: "mime/index.js" },
663
666
  wasm: {
664
667
  lazy: false,
@@ -671,6 +674,7 @@ const cloudflarePages = defineNitroPreset({
671
674
  } },
672
675
  hooks: {
673
676
  "build:before": async (nitro) => {
677
+ nitro.options.unenv.push(unenvCfExternals);
674
678
  await enableNodeCompat(nitro);
675
679
  },
676
680
  async compiled(nitro) {
@@ -705,11 +709,7 @@ const cloudflarePagesStatic = defineNitroPreset({
705
709
  });
706
710
  const cloudflareDev = defineNitroPreset({
707
711
  extends: "nitro-dev",
708
- modules: [cloudflareDevModule],
709
- unenv: {
710
- meta: { name: "cloudflare-dev" },
711
- alias: { "cloudflare:workers": resolve$1(presetsDir, "cloudflare/runtime/shims/workers.dev.mjs") }
712
- }
712
+ modules: [cloudflareDevModule]
713
713
  }, {
714
714
  name: "cloudflare-dev",
715
715
  aliases: [
@@ -730,7 +730,6 @@ const cloudflareModule = defineNitroPreset({
730
730
  preview: "npx wrangler --cwd ./ dev",
731
731
  deploy: "npx wrangler --cwd ./ deploy"
732
732
  },
733
- unenv: [unenvCfExternals],
734
733
  rollupConfig: { output: {
735
734
  format: "esm",
736
735
  exports: "named",
@@ -742,6 +741,7 @@ const cloudflareModule = defineNitroPreset({
742
741
  },
743
742
  hooks: {
744
743
  "build:before": async (nitro) => {
744
+ nitro.options.unenv.push(unenvCfExternals);
745
745
  await enableNodeCompat(nitro);
746
746
  },
747
747
  async compiled(nitro) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-nightly",
3
- "version": "3.0.1-20251110-093536-c21a33ba",
3
+ "version": "3.0.1-20251110-110934-89e686f1",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "homepage": "https://nitro.build",
6
6
  "repository": "nitrojs/nitro",