nitro-nightly 3.0.1-20251109-233730-ab0fad99 → 3.0.1-20251110-003232-dd65b3e6

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.
@@ -98,7 +98,6 @@ function baseBuildConfig(nitro) {
98
98
  ].filter(Boolean);
99
99
  const { env } = defineEnv({
100
100
  nodeCompat: isNodeless,
101
- npmShims: true,
102
101
  resolve: true,
103
102
  presets: nitro.options.unenv,
104
103
  overrides: { alias: nitro.options.alias }
@@ -28,7 +28,7 @@ import { n as baseBuildConfig, r as replace, t as baseBuildPlugins } from "./com
28
28
  import "../_libs/remapping.mjs";
29
29
  import "../_libs/unwasm.mjs";
30
30
  import "../_libs/etag.mjs";
31
- import { n as raw, t as generateFSTree } from "../_chunks/CNxJ25Zn.mjs";
31
+ import { n as raw, t as generateFSTree } from "../_chunks/DJgsNglP.mjs";
32
32
  import "../_libs/duplexer.mjs";
33
33
  import "../_libs/gzip-size.mjs";
34
34
  import "../_libs/pretty-bytes.mjs";
@@ -30,7 +30,7 @@ import { n as baseBuildConfig, r as replace, t as baseBuildPlugins } from "./com
30
30
  import "../_libs/remapping.mjs";
31
31
  import "../_libs/unwasm.mjs";
32
32
  import "../_libs/etag.mjs";
33
- import { n as raw, t as generateFSTree } from "../_chunks/CNxJ25Zn.mjs";
33
+ import { n as raw, t as generateFSTree } from "../_chunks/DJgsNglP.mjs";
34
34
  import "../_libs/duplexer.mjs";
35
35
  import "../_libs/gzip-size.mjs";
36
36
  import "../_libs/pretty-bytes.mjs";
@@ -13,7 +13,7 @@ import "../_libs/tinyglobby.mjs";
13
13
  import "../_libs/compatx.mjs";
14
14
  import "../_libs/klona.mjs";
15
15
  import { r as a } from "../_libs/std-env.mjs";
16
- import "../_chunks/Bb_Lq1zU.mjs";
16
+ import "../_chunks/CzeQHoGT.mjs";
17
17
  import "../_libs/escape-string-regexp.mjs";
18
18
  import "../_libs/tsconfck.mjs";
19
19
  import "../_libs/dot-prop.mjs";
@@ -43,7 +43,7 @@ import "../_libs/vite-plugin-fullstack.mjs";
43
43
 
44
44
  //#region src/build/vite/build.ts
45
45
  async function viteBuild(nitro$1) {
46
- if (nitro$1.options.dev) throw new Error("Nitro vite builder is not supported in development mode. Please use `vite dev` instead.");
46
+ if (nitro$1.options.dev) throw new Error("Nitro dev CLI does not supports vite. Please use `vite dev` instead.");
47
47
  const { createBuilder } = nitro$1.options.builder === "rolldown-vite" ? await import("rolldown-vite").catch(() => import("vite")) : await import("vite");
48
48
  await (await createBuilder({
49
49
  base: nitro$1.options.rootDir,
@@ -2,7 +2,7 @@ import { C as join$1, D as relative$1, O as resolve$1, S as isAbsolute$1, b as d
2
2
  import { f as sanitizeFilePath } from "../_libs/local-pkg.mjs";
3
3
  import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
4
4
  import { n as T, r as a } from "../_libs/std-env.mjs";
5
- import { a as createNitro, n as prepare, r as copyPublicAssets } from "../_chunks/Bb_Lq1zU.mjs";
5
+ import { a as createNitro, n as prepare, r as copyPublicAssets } from "../_chunks/CzeQHoGT.mjs";
6
6
  import { n as prettyPath } from "../_chunks/DTJoprWj.mjs";
7
7
  import { i as scanHandlers } from "../_chunks/CYzvH-lo.mjs";
8
8
  import { n as writeBuildInfo, t as getBuildInfo } from "./common.mjs";
@@ -12,6 +12,7 @@ import { i as scanHandlers, r as scanAndSyncOptions, t as runParallel } from "./
12
12
  import { a as findRoute, i as findAllRoutes, n as addRoute, r as createRouter, t as compileRouterToString } from "../_libs/rou3.mjs";
13
13
  import { t as src_default } from "../_libs/mime.mjs";
14
14
  import { n as z, t as P } from "../_libs/ultrahtml.mjs";
15
+ import { createRequire } from "node:module";
15
16
  import consola$1, { consola } from "consola";
16
17
  import { Hookable, createDebugger } from "hookable";
17
18
  import { existsSync, promises } from "node:fs";
@@ -515,33 +516,59 @@ async function resolveUnenv(options) {
515
516
 
516
517
  //#endregion
517
518
  //#region src/config/resolvers/builder.ts
519
+ const VALID_BUILDERS = [
520
+ "rollup",
521
+ "rolldown",
522
+ "vite",
523
+ "rolldown-vite"
524
+ ];
518
525
  async function resolveBuilder(options) {
519
- if (!options.builder) options.builder = process.env.NITRO_BUILDER || "rollup";
520
- switch (options.builder) {
521
- case "rollup":
522
- try {
523
- await import("rollup");
524
- } catch {
525
- throw new Error(`Builder "rollup" is not available. Make sure to install "rollup" package.`);
526
- }
527
- break;
528
- case "rolldown":
529
- try {
530
- await import("rolldown");
531
- } catch {
532
- throw new Error(`Builder "rolldown" is not available. Make sure to install "rolldown" package.`);
533
- }
534
- break;
535
- case "vite":
536
- case "rolldown-vite":
537
- try {
538
- await import("vite");
539
- } catch {
540
- throw new Error(`Builder "vite" is not available. Make sure to install "vite" package.`);
541
- }
542
- break;
543
- default: throw new Error(`Builder "${options.builder}" is not supported.`);
526
+ options.builder ??= process.env.NITRO_BUILDER;
527
+ if (options.builder) {
528
+ if (!VALID_BUILDERS.includes(options.builder)) throw new Error(`Invalid nitro builder "${options.builder}". Valid builders are: ${VALID_BUILDERS.join(", ")}.`);
529
+ const pkg = options.builder === "rolldown-vite" ? "vite" : options.builder;
530
+ if (!isPkgInstalled(pkg, options.rootDir)) {
531
+ if (!await consola$1.prompt(`Nitro builder package \`${pkg}\` is not installed. Would you like to install it?`, {
532
+ type: "confirm",
533
+ default: true,
534
+ cancel: "null"
535
+ })) throw new Error(`Nitro builder package "${options.builder}" is not installed. Please install it in your project dependencies.`);
536
+ await installPkg(pkg, options.rootDir);
537
+ }
538
+ return;
539
+ }
540
+ for (const pkg of [
541
+ "rolldown",
542
+ "rollup",
543
+ "vite"
544
+ ]) if (isPkgInstalled(pkg, options.rootDir)) {
545
+ options.builder = pkg;
546
+ return;
544
547
  }
548
+ const pkgToInstall = await consola$1.prompt(`No nitro builder specified. Which builder would you like to install?`, {
549
+ type: "select",
550
+ cancel: "null",
551
+ options: VALID_BUILDERS.map((b) => ({
552
+ label: b,
553
+ value: b
554
+ }))
555
+ });
556
+ if (!pkgToInstall) throw new Error(`No nitro builder specified. Please install one of the following packages: ${VALID_BUILDERS.join(", ")} and set it as the builder in your nitro config or via the NITRO_BUILDER environment variable.`);
557
+ await installPkg(pkgToInstall, options.rootDir);
558
+ options.builder = pkgToInstall;
559
+ }
560
+ const require = createRequire(process.cwd() + "/_index.js");
561
+ function isPkgInstalled(pkg, root) {
562
+ try {
563
+ require.resolve(pkg, { paths: [root] });
564
+ return true;
565
+ } catch {
566
+ return false;
567
+ }
568
+ }
569
+ async function installPkg(pkg, root) {
570
+ const { addDevDependency } = await import("../cli/_chunks/dist4.mjs");
571
+ return addDevDependency(pkg === "rolldown-vite" ? "vite@npm:rolldown-vite" : pkg, { cwd: root });
545
572
  }
546
573
 
547
574
  //#endregion
@@ -2576,7 +2576,7 @@ async function resolveConfig(source, options, sourceOptions = {}) {
2576
2576
  const customProviderKeys = Object.keys(sourceOptions.giget?.providers || {}).map((key) => `${key}:`);
2577
2577
  const gigetPrefixes = customProviderKeys.length > 0 ? [.../* @__PURE__ */ new Set([...customProviderKeys, ...GIGET_PREFIXES])] : GIGET_PREFIXES;
2578
2578
  if (options.giget !== false && gigetPrefixes.some((prefix) => source.startsWith(prefix))) {
2579
- const { downloadTemplate } = await import("../cli/_chunks/dist4.mjs");
2579
+ const { downloadTemplate } = await import("../cli/_chunks/dist5.mjs");
2580
2580
  const { digest } = await import("ohash");
2581
2581
  const cloneName = source.replace(/\W+/g, "_").split("_").splice(0, 3).join("_") + "_" + digest(source).slice(0, 10).replace(/[-_]/g, "");
2582
2582
  let cloneDir;
@@ -1,5 +1,5 @@
1
1
  import { i as __toESM, n as __require, r as __toDynamicImportESM, t as __commonJS } from "../_chunks/Bqks5huO.mjs";
2
- import { C as join$2, O as resolve$2, b as dirname$2, w as normalize$2, y as basename$2 } from "./c12.mjs";
2
+ import { C as join$2, O as resolve$2, b as dirname$2, f as readPackageJSON, w as normalize$2, y as basename$2 } from "./c12.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { delimiter, dirname, normalize, resolve } from "node:path";
5
5
  import { cwd } from "node:process";
@@ -704,6 +704,15 @@ async function resolveOperationOptions(options = {}) {
704
704
  dry: options.dry ?? false
705
705
  };
706
706
  }
707
+ function getWorkspaceArgs(options) {
708
+ if (!options.workspace) return [];
709
+ const workspacePkg = typeof options.workspace === "string" && options.workspace !== "" ? options.workspace : void 0;
710
+ if (options.packageManager.name === "pnpm") return workspacePkg ? ["--filter", workspacePkg] : ["--workspace-root"];
711
+ if (options.packageManager.name === "npm") return workspacePkg ? ["-w", workspacePkg] : ["--workspaces"];
712
+ if (options.packageManager.name === "yarn") if (!options.packageManager.majorVersion || options.packageManager.majorVersion === "1") return workspacePkg ? ["--cwd", workspacePkg] : ["-W"];
713
+ else return workspacePkg ? ["workspace", workspacePkg] : [];
714
+ return [];
715
+ }
707
716
  function parsePackageManagerField(packageManager) {
708
717
  const [name, _version] = (packageManager || "").split("@");
709
718
  const [version, buildMeta] = _version?.split("+") || [];
@@ -806,6 +815,58 @@ async function installDependencies(options = {}) {
806
815
  args: commandArgs
807
816
  } };
808
817
  }
818
+ async function addDependency(name, options = {}) {
819
+ const resolvedOptions = await resolveOperationOptions(options);
820
+ const names = Array.isArray(name) ? name : [name];
821
+ if (resolvedOptions.packageManager.name === "deno") {
822
+ for (let i$9 = 0; i$9 < names.length; i$9++) if (!/^(npm|jsr|file):.+$/.test(names[i$9])) names[i$9] = `npm:${names[i$9]}`;
823
+ }
824
+ if (names.length === 0) return {};
825
+ const args = (resolvedOptions.packageManager.name === "yarn" ? [
826
+ ...getWorkspaceArgs(resolvedOptions),
827
+ resolvedOptions.global && resolvedOptions.packageManager.majorVersion === "1" ? "global" : "",
828
+ "add",
829
+ resolvedOptions.dev ? "-D" : "",
830
+ ...names
831
+ ] : [
832
+ resolvedOptions.packageManager.name === "npm" ? "install" : "add",
833
+ ...getWorkspaceArgs(resolvedOptions),
834
+ resolvedOptions.dev ? "-D" : "",
835
+ resolvedOptions.global ? "-g" : "",
836
+ ...names
837
+ ]).filter(Boolean);
838
+ if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, args, {
839
+ cwd: resolvedOptions.cwd,
840
+ silent: resolvedOptions.silent
841
+ });
842
+ if (!resolvedOptions.dry && options.installPeerDependencies) {
843
+ const existingPkg = await readPackageJSON(resolvedOptions.cwd);
844
+ const peerDeps = [];
845
+ const peerDevDeps = [];
846
+ for (const _name of names) {
847
+ const pkgName = _name.match(/^(.[^@]+)/)?.[0];
848
+ const pkg = await readPackageJSON(pkgName, { url: resolvedOptions.cwd }).catch(() => ({}));
849
+ if (!pkg.peerDependencies || pkg.name !== pkgName) continue;
850
+ for (const [peerDependency, version] of Object.entries(pkg.peerDependencies)) {
851
+ if (pkg.peerDependenciesMeta?.[peerDependency]?.optional) continue;
852
+ if (existingPkg.dependencies?.[peerDependency] || existingPkg.devDependencies?.[peerDependency]) continue;
853
+ (pkg.peerDependenciesMeta?.[peerDependency]?.dev ? peerDevDeps : peerDeps).push(`${peerDependency}@${version}`);
854
+ }
855
+ }
856
+ if (peerDeps.length > 0) await addDependency(peerDeps, { ...resolvedOptions });
857
+ if (peerDevDeps.length > 0) await addDevDependency(peerDevDeps, { ...resolvedOptions });
858
+ }
859
+ return { exec: {
860
+ command: resolvedOptions.packageManager.command,
861
+ args
862
+ } };
863
+ }
864
+ async function addDevDependency(name, options = {}) {
865
+ return await addDependency(name, {
866
+ ...options,
867
+ dev: true
868
+ });
869
+ }
809
870
 
810
871
  //#endregion
811
872
  //#region node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs
@@ -19225,4 +19286,4 @@ async function downloadTemplate(input, options = {}) {
19225
19286
  var import_proxy = /* @__PURE__ */ __toESM(require_proxy(), 1);
19226
19287
 
19227
19288
  //#endregion
19228
- export { require_node_fetch_native_DhEqb06g as i, registryProvider as n, require_node as r, downloadTemplate as t };
19289
+ export { addDependency as a, installDependencies as c, require_node_fetch_native_DhEqb06g as i, packageManagers as l, registryProvider as n, addDevDependency as o, require_node as r, detectPackageManager as s, downloadTemplate as t };
package/dist/builder.mjs CHANGED
@@ -13,7 +13,7 @@ import "./_libs/tinyglobby.mjs";
13
13
  import "./_libs/compatx.mjs";
14
14
  import "./_libs/klona.mjs";
15
15
  import "./_libs/std-env.mjs";
16
- import { a as createNitro, c as loadOptions, i as build, n as prepare, o as listTasks, r as copyPublicAssets, s as runTask, t as prerender } from "./_chunks/Bb_Lq1zU.mjs";
16
+ import { a as createNitro, c as loadOptions, i as build, n as prepare, o as listTasks, r as copyPublicAssets, s as runTask, t as prerender } from "./_chunks/CzeQHoGT.mjs";
17
17
  import "./_libs/escape-string-regexp.mjs";
18
18
  import "./_libs/tsconfck.mjs";
19
19
  import "./_libs/dot-prop.mjs";
@@ -1,4 +1,4 @@
1
1
  import "../../_libs/c12.mjs";
2
- import { n as registryProvider, t as downloadTemplate } from "../../_libs/giget.mjs";
2
+ import { a as addDependency, c as installDependencies, l as packageManagers, o as addDevDependency, s as detectPackageManager } from "../../_libs/giget.mjs";
3
3
 
4
- export { downloadTemplate, registryProvider };
4
+ export { addDependency, addDevDependency, detectPackageManager, installDependencies, packageManagers };
@@ -0,0 +1,4 @@
1
+ import "../../_libs/c12.mjs";
2
+ import { n as registryProvider, t as downloadTemplate } from "../../_libs/giget.mjs";
3
+
4
+ export { downloadTemplate, registryProvider };
package/dist/vite.mjs CHANGED
@@ -13,7 +13,7 @@ import "./_libs/tinyglobby.mjs";
13
13
  import "./_libs/compatx.mjs";
14
14
  import "./_libs/klona.mjs";
15
15
  import "./_libs/std-env.mjs";
16
- import "./_chunks/Bb_Lq1zU.mjs";
16
+ import "./_chunks/CzeQHoGT.mjs";
17
17
  import "./_libs/escape-string-regexp.mjs";
18
18
  import "./_libs/tsconfck.mjs";
19
19
  import "./_libs/dot-prop.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-nightly",
3
- "version": "3.0.1-20251109-233730-ab0fad99",
3
+ "version": "3.0.1-20251110-003232-dd65b3e6",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "homepage": "https://nitro.build",
6
6
  "repository": "nitrojs/nitro",
@@ -67,7 +67,6 @@
67
67
  "ohash": "^2.0.11",
68
68
  "oxc-minify": "^0.96.0",
69
69
  "oxc-transform": "^0.96.0",
70
- "rollup": "^4.53.1",
71
70
  "srvx": "^0.9.5",
72
71
  "undici": "^7.16.0",
73
72
  "unenv": "^2.0.0-rc.24",
@@ -78,6 +77,7 @@
78
77
  "@azure/static-web-apps-cli": "^2.0.7",
79
78
  "@cloudflare/workers-types": "^4.20251109.0",
80
79
  "@deno/types": "^0.0.1",
80
+ "rollup": "^4.53.1",
81
81
  "@hiogawa/vite-plugin-fullstack": "npm:@pi0/vite-plugin-fullstack@0.0.5-pr-1297",
82
82
  "@netlify/edge-functions": "^3.0.2",
83
83
  "@netlify/functions": "^5.1.0",
@@ -129,6 +129,7 @@
129
129
  "mime": "^4.1.0",
130
130
  "miniflare": "^4.20251105.0",
131
131
  "mlly": "^1.8.0",
132
+ "nypm": "^0.6.2",
132
133
  "obuild": "^0.4.1",
133
134
  "pathe": "^2.0.3",
134
135
  "perfect-debounce": "^2.0.0",
@@ -164,12 +165,16 @@
164
165
  "peerDependencies": {
165
166
  "rolldown": "*",
166
167
  "vite": "^7",
168
+ "rollup": "^4",
167
169
  "xml2js": "^0.6.2"
168
170
  },
169
171
  "peerDependenciesMeta": {
170
172
  "rolldown": {
171
173
  "optional": true
172
174
  },
175
+ "rollup": {
176
+ "optional": true
177
+ },
173
178
  "vite": {
174
179
  "optional": true
175
180
  },
@@ -177,7 +182,7 @@
177
182
  "optional": true
178
183
  }
179
184
  },
180
- "packageManager": "pnpm@10.17.1",
185
+ "packageManager": "pnpm@10.21.0",
181
186
  "engines": {
182
187
  "node": "^20.19.0 || >=22.12.0"
183
188
  }
File without changes