nitro-nightly 3.0.1-20251210-155254-4d2e6b8a → 3.0.1-20251210-165820-f6618025

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.
@@ -3,7 +3,6 @@ import { O as relative, o as debounce, w as join } from "../_libs/c12.mjs";
3
3
  import "../_libs/@jridgewell/gen-mapping.mjs";
4
4
  import "../_libs/@pi0/vite-plugin-fullstack.mjs";
5
5
  import "../_libs/acorn.mjs";
6
- import { d as sanitizeFilePath } from "../_libs/local-pkg.mjs";
7
6
  import "../_libs/unimport.mjs";
8
7
  import "../_libs/@rollup/plugin-commonjs.mjs";
9
8
  import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
@@ -12,7 +11,7 @@ import { i as scanHandlers, n as writeTypes } from "../_nitro2.mjs";
12
11
  import "../_libs/mime.mjs";
13
12
  import { n as writeBuildInfo } from "./shared2.mjs";
14
13
  import { a as watch$1 } from "../_libs/chokidar.mjs";
15
- import { n as getChunkName, r as baseBuildConfig, t as baseBuildPlugins } from "./shared3.mjs";
14
+ import { a as baseBuildConfig, i as libChunkName, n as NODE_MODULES_RE, r as getChunkName, t as baseBuildPlugins } from "./shared3.mjs";
16
15
  import "../_libs/etag.mjs";
17
16
  import "../_libs/@jridgewell/remapping.mjs";
18
17
  import "../_libs/@rollup/plugin-replace.mjs";
@@ -54,7 +53,11 @@ const getRolldownConfig = (nitro) => {
54
53
  }
55
54
  },
56
55
  onwarn(warning, warn) {
57
- if (!["CIRCULAR_DEPENDENCY", "EVAL"].includes(warning.code || "") && !warning.message.includes("Unsupported source map comment")) warn(warning);
56
+ if (![
57
+ "CIRCULAR_DEPENDENCY",
58
+ "EVAL",
59
+ "EMPTY_CHUNK"
60
+ ].includes(warning.code || "") && !warning.message.includes("Unsupported source map comment")) warn(warning);
58
61
  },
59
62
  treeshake: { moduleSideEffects(id) {
60
63
  return nitro.options.moduleSideEffects.some((p) => id.startsWith(p));
@@ -62,11 +65,14 @@ const getRolldownConfig = (nitro) => {
62
65
  output: {
63
66
  format: "esm",
64
67
  entryFileNames: "index.mjs",
65
- chunkFileNames: (chunk) => getChunkName(nitro, chunk.moduleIds),
68
+ chunkFileNames: (chunk) => getChunkName(chunk, nitro),
69
+ advancedChunks: { groups: [{
70
+ test: NODE_MODULES_RE,
71
+ name: (id) => libChunkName(id)
72
+ }] },
66
73
  dir: nitro.options.output.serverDir,
67
74
  inlineDynamicImports: nitro.options.inlineDynamicImports,
68
75
  minify: nitro.options.minify,
69
- sanitizeFileName: sanitizeFilePath,
70
76
  sourcemap: nitro.options.sourcemap,
71
77
  sourcemapIgnoreList(relativePath) {
72
78
  return relativePath.includes("node_modules");
@@ -74,6 +80,8 @@ const getRolldownConfig = (nitro) => {
74
80
  }
75
81
  };
76
82
  config = defu(nitro.options.rollupConfig, config);
83
+ const outputConfig = config.output;
84
+ if (outputConfig.inlineDynamicImports || outputConfig.format === "iife") delete outputConfig.advancedChunks;
77
85
  return config;
78
86
  };
79
87
 
@@ -3,7 +3,6 @@ import { C as isAbsolute, O as relative, o as debounce, w as join } from "../_li
3
3
  import "../_libs/@jridgewell/gen-mapping.mjs";
4
4
  import "../_libs/@pi0/vite-plugin-fullstack.mjs";
5
5
  import "../_libs/acorn.mjs";
6
- import { d as sanitizeFilePath } from "../_libs/local-pkg.mjs";
7
6
  import "../_libs/unimport.mjs";
8
7
  import { t as commonjs } from "../_libs/@rollup/plugin-commonjs.mjs";
9
8
  import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
@@ -14,7 +13,7 @@ import { n as writeBuildInfo } from "./shared2.mjs";
14
13
  import { a as watch$1 } from "../_libs/chokidar.mjs";
15
14
  import { t as alias } from "../_libs/@rollup/plugin-alias.mjs";
16
15
  import { t as inject } from "../_libs/@rollup/plugin-inject.mjs";
17
- import { n as getChunkName, r as baseBuildConfig, t as baseBuildPlugins } from "./shared3.mjs";
16
+ import { a as baseBuildConfig, i as libChunkName, n as NODE_MODULES_RE, r as getChunkName, t as baseBuildPlugins } from "./shared3.mjs";
18
17
  import "../_libs/etag.mjs";
19
18
  import "../_libs/@jridgewell/remapping.mjs";
20
19
  import "../_libs/@rollup/plugin-replace.mjs";
@@ -94,7 +93,8 @@ const getRollupConfig = (nitro) => {
94
93
  if (![
95
94
  "EVAL",
96
95
  "CIRCULAR_DEPENDENCY",
97
- "THIS_IS_UNDEFINED"
96
+ "THIS_IS_UNDEFINED",
97
+ "EMPTY_CHUNK"
98
98
  ].includes(warning.code || "") && !warning.message.includes("Unsupported source map comment")) rollupWarn(warning);
99
99
  },
100
100
  treeshake: { moduleSideEffects(id) {
@@ -103,17 +103,21 @@ const getRollupConfig = (nitro) => {
103
103
  output: {
104
104
  format: "esm",
105
105
  entryFileNames: "index.mjs",
106
- chunkFileNames: (chunk) => getChunkName(nitro, chunk.moduleIds),
106
+ chunkFileNames: (chunk) => getChunkName(chunk, nitro),
107
107
  dir: nitro.options.output.serverDir,
108
108
  inlineDynamicImports: nitro.options.inlineDynamicImports,
109
109
  generatedCode: { constBindings: true },
110
- sanitizeFileName: sanitizeFilePath,
111
110
  sourcemap: nitro.options.sourcemap,
112
111
  sourcemapExcludeSources: true,
113
- sourcemapIgnoreList: (id) => id.includes("node_modules")
112
+ sourcemapIgnoreList: (id) => id.includes("node_modules"),
113
+ manualChunks(id) {
114
+ if (NODE_MODULES_RE.test(id)) return libChunkName(id);
115
+ }
114
116
  }
115
117
  };
116
118
  config = defu(nitro.options.rollupConfig, config);
119
+ const outputConfig = config.output;
120
+ if (outputConfig.inlineDynamicImports || outputConfig.format === "iife") delete outputConfig.manualChunks;
117
121
  return config;
118
122
  };
119
123
 
@@ -1,6 +1,5 @@
1
1
  import { i as __toESM } from "../_rolldown.mjs";
2
2
  import { C as isAbsolute, O as relative, T as normalize, h as resolveModulePath, k as resolve, w as join } from "../_libs/c12.mjs";
3
- import { s as parseNodeModulePath } from "../_libs/local-pkg.mjs";
4
3
  import { i as unplugin } from "../_libs/unimport.mjs";
5
4
  import { t as glob } from "../_libs/tinyglobby.mjs";
6
5
  import { i as a, r as T, t as A } from "../_libs/std-env.mjs";
@@ -111,10 +110,17 @@ function resolveAliases(_aliases) {
111
110
  //#endregion
112
111
  //#region src/build/chunks.ts
113
112
  const virtualRe = /^\0|^virtual:/;
114
- function getChunkName(nitro, moduleIds) {
115
- const ids = moduleIds.filter((id) => !virtualRe.test(id));
113
+ const NODE_MODULES_RE$1 = /node_modules[/\\][^.]/;
114
+ function libChunkName(id) {
115
+ return `_libs/${id.match(/.*(?:[/\\])node_modules(?:[/\\])(?<package>@[^/\\]+[/\\][^/\\]+|[^/\\.][^/\\]*)/)?.groups?.package || "common"}`;
116
+ }
117
+ function getChunkName(chunk, nitro) {
118
+ if (chunk.name.startsWith("_libs/")) return `${chunk.name}.mjs`;
119
+ if (chunk.name === "rolldown-runtime") return "_runtime/rolldown.mjs";
120
+ if (chunk.moduleIds.length === 0) return `_chunks/${chunk.name}.mjs`;
121
+ const ids = chunk.moduleIds.filter((id) => !virtualRe.test(id));
116
122
  if (ids.length === 0) {
117
- if (moduleIds.every((id) => id.includes("virtual:raw"))) return `_raw/[name].mjs`;
123
+ if (chunk.moduleIds.every((id) => id.includes("virtual:raw"))) return `_raw/[name].mjs`;
118
124
  return `_virtual/[name].mjs`;
119
125
  }
120
126
  if (ids.every((id) => id.endsWith(".wasm"))) return `_wasm/[name].mjs`;
@@ -127,12 +133,7 @@ function getChunkName(nitro, moduleIds) {
127
133
  if (routeHandler?.route) return `_routes/${routeToFsPath(routeHandler.route)}.mjs`;
128
134
  if (Object.entries(nitro.options.tasks).find(([_, task]) => task.handler === mainId)) return `_tasks/[name].mjs`;
129
135
  }
130
- if (ids.every((id) => id.includes("node_modules"))) {
131
- if (ids.length > 3) return `_lib/[hash].mjs`;
132
- const pkgNames = [...new Set(ids.map((id) => parseNodeModulePath(id)?.name?.replace(/^@.+\//, "")).filter((id) => id && !id.startsWith(".")).sort())].join("+");
133
- return `_lib/${pkgNames.length < 50 ? pkgNames : "[hash]"}.mjs`;
134
- }
135
- return `_/[hash].mjs`;
136
+ return `_chunks/[name].mjs`;
136
137
  }
137
138
  function routeToFsPath(route) {
138
139
  return route.split("/").slice(1).map((s) => `${s.replace(/[:*]+/g, "$").replace(/[^$a-zA-Z0-9_.[\]/]/g, "_")}`).join("/") || "index";
@@ -1107,4 +1108,4 @@ function baseBuildPlugins(nitro, base) {
1107
1108
  }
1108
1109
 
1109
1110
  //#endregion
1110
- export { getChunkName as n, baseBuildConfig as r, baseBuildPlugins as t };
1111
+ export { baseBuildConfig as a, libChunkName as i, NODE_MODULES_RE$1 as n, getChunkName as r, baseBuildPlugins as t };
@@ -1,6 +1,5 @@
1
1
  import { C as isAbsolute$1, O as relative$1, b as basename$1, h as resolveModulePath, k as resolve$1, o as debounce, w as join$1, x as dirname$1 } from "../_libs/c12.mjs";
2
2
  import { t as assetsPlugin } from "../_libs/@pi0/vite-plugin-fullstack.mjs";
3
- import { d as sanitizeFilePath } from "../_libs/local-pkg.mjs";
4
3
  import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
5
4
  import { i as a, r as T } from "../_libs/std-env.mjs";
6
5
  import { a as copyPublicAssets, i as prepare, s as createNitro } from "../_nitro.mjs";
@@ -11,7 +10,7 @@ import { i as NodeEnvRunner, r as NitroDevApp } from "../_dev.mjs";
11
10
  import { a as watch$1 } from "../_libs/chokidar.mjs";
12
11
  import { t as alias } from "../_libs/@rollup/plugin-alias.mjs";
13
12
  import { t as inject } from "../_libs/@rollup/plugin-inject.mjs";
14
- import { n as getChunkName, r as baseBuildConfig, t as baseBuildPlugins } from "./shared3.mjs";
13
+ import { a as baseBuildConfig, i as libChunkName, n as NODE_MODULES_RE, r as getChunkName, t as baseBuildPlugins } from "./shared3.mjs";
15
14
  import consola$1 from "consola";
16
15
  import { join, resolve } from "node:path";
17
16
  import { existsSync, watch } from "node:fs";
@@ -24,19 +23,6 @@ import { DevEnvironment } from "vite";
24
23
  import { spawn } from "node:child_process";
25
24
 
26
25
  //#region src/build/vite/rollup.ts
27
- /**
28
- * Removed from base rollup config:
29
- * - nodeResolve
30
- * - commonjs
31
- * - esbuild
32
- * - sourcemapMinify
33
- * - json
34
- * - raw
35
- *
36
- * TODO: Reuse with rollup:
37
- * - chunkFileNames
38
- * - moduleSideEffects
39
- */
40
26
  const getViteRollupConfig = (ctx) => {
41
27
  const nitro$1 = ctx.nitro;
42
28
  const base = baseBuildConfig(nitro$1);
@@ -56,11 +42,16 @@ const getViteRollupConfig = (ctx) => {
56
42
  output: {
57
43
  format: "esm",
58
44
  entryFileNames: "index.mjs",
59
- chunkFileNames: (chunk) => getChunkName(nitro$1, chunk.moduleIds),
45
+ chunkFileNames: (chunk) => getChunkName(chunk, nitro$1),
46
+ ...ctx._isRolldown ? { advancedChunks: { groups: [{
47
+ test: NODE_MODULES_RE,
48
+ name: (id) => libChunkName(id)
49
+ }] } } : { manualChunks(id) {
50
+ if (NODE_MODULES_RE.test(id)) return libChunkName(id);
51
+ } },
60
52
  inlineDynamicImports: nitro$1.options.inlineDynamicImports,
61
53
  dir: nitro$1.options.output.serverDir,
62
54
  generatedCode: { ...ctx._isRolldown ? {} : { constBindings: true } },
63
- sanitizeFileName: sanitizeFilePath,
64
55
  ...ctx._isRolldown ? {} : { sourcemapExcludeSources: true },
65
56
  sourcemapIgnoreList: (id) => id.includes("node_modules")
66
57
  }
@@ -1183,13 +1183,6 @@ function fileURLToPath$1(id) {
1183
1183
  function pathToFileURL$1(id) {
1184
1184
  return pathToFileURL(fileURLToPath$1(id)).toString();
1185
1185
  }
1186
- const INVALID_CHAR_RE = /[\u0000-\u001F"#$&*+,/:;<=>?@[\]^`{|}\u007F]+/g;
1187
- function sanitizeURIComponent(name = "", replacement = "_") {
1188
- return name.replace(INVALID_CHAR_RE, replacement).replace(/%../g, replacement);
1189
- }
1190
- function sanitizeFilePath(filePath = "") {
1191
- return filePath.replace(/\?.*$/, "").split(/[/\\]/g).map((p) => sanitizeURIComponent(p)).join("/").replace(/^([A-Za-z])_\//, "$1:/");
1192
- }
1193
1186
  function normalizeid(id) {
1194
1187
  if (typeof id !== "string") id = id.toString();
1195
1188
  if (/(?:node|data|http|https|file):/.test(id)) return id;
@@ -1683,4 +1676,4 @@ const isPackageListed = quansync(function* (name, cwd$1) {
1683
1676
  const isPackageListedSync = isPackageListed.sync;
1684
1677
 
1685
1678
  //#endregion
1686
- export { findTypeExports as a, parseStaticImport as c, sanitizeFilePath as d, findStaticImports as i, resolve$1 as l, detectSyntax as n, lookupNodeModuleSubpath as o, findExports as r, parseNodeModulePath as s, resolveModule as t, resolveModuleExportNames as u };
1679
+ export { findTypeExports as a, parseStaticImport as c, findStaticImports as i, resolve$1 as l, detectSyntax as n, lookupNodeModuleSubpath as o, findExports as r, parseNodeModulePath as s, resolveModule as t, resolveModuleExportNames as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-nightly",
3
- "version": "3.0.1-20251210-155254-4d2e6b8a",
3
+ "version": "3.0.1-20251210-165820-f6618025",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "homepage": "https://nitro.build",
6
6
  "repository": "nitrojs/nitro",