nitro 3.0.260522-beta → 3.0.260603-beta

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/_presets.mjs CHANGED
@@ -1897,6 +1897,20 @@ async function resolvePreset(name, opts = {}) {
1897
1897
  if (typeof preset === "function") return preset();
1898
1898
  if (!name && !preset) {
1899
1899
  if (opts?.static) return resolvePreset("static", opts);
1900
+ if (opts.defaultPreset) {
1901
+ if (typeof opts.defaultPreset === "string") return resolvePreset(opts.defaultPreset, {
1902
+ ...opts,
1903
+ defaultPreset: void 0
1904
+ });
1905
+ const config = typeof opts.defaultPreset === "function" ? opts.defaultPreset() : opts.defaultPreset;
1906
+ return {
1907
+ ...config,
1908
+ _meta: {
1909
+ name: "default",
1910
+ ...config._meta
1911
+ }
1912
+ };
1913
+ }
1900
1914
  return resolvePreset({
1901
1915
  deno: "deno",
1902
1916
  bun: "bun"
@@ -18,6 +18,20 @@ export default defineConfig({
18
18
  });
19
19
  ```
20
20
 
21
+ ### `defaultPreset`
22
+
23
+ Customize the preset used as the **fallback** when `preset` is not set and none of the known hosting providers are auto-detected.
24
+
25
+ By default, Nitro falls back to the runtime-based preset (`node`, and `deno` or `bun` when running on those runtimes). An explicit `preset`, the `NITRO_PRESET` environment variable, and auto-detected providers (Vercel, Netlify, Cloudflare Pages, ...) all take precedence over `defaultPreset`.
26
+
27
+ It accepts a preset name or an inline preset definition.
28
+
29
+ ```ts
30
+ export default defineConfig({
31
+ defaultPreset: "node_cluster", // use node_cluster instead of node_server by default
32
+ });
33
+ ```
34
+
21
35
  ### `debug`
22
36
 
23
37
  - Default: `false` (`true` when `DEBUG` environment variable is set)
@@ -2,7 +2,7 @@ import { commonjs } from "../_libs/estree+pluginutils.mjs";
2
2
  import { C12InputConfig, ChokidarOptions, ConfigWatcher, DotenvOptions, ResolvedConfig, WatchConfigOptions } from "../_libs/c12+readdirp+chokidar.mjs";
3
3
  import { CompatibilityDateSpec, CompatibilityDates, DateString } from "../_libs/compatx.mjs";
4
4
  import { ProxyServerOptions } from "../_libs/httpxy.mjs";
5
- import { RawConfig } from "../_libs/jsonc-parser+workers-utils.mjs";
5
+ import { RawConfig } from "../_libs/undici+jsonc-parser.mjs";
6
6
  import { OutputBundleConfig } from "../_libs/common.mjs";
7
7
  import { TSConfig } from "../_libs/pkg-types.mjs";
8
8
  import { Unimport, UnimportPluginOptions } from "../_libs/unplugin+unimport.mjs";
@@ -1030,6 +1030,22 @@ type NitroTypes = {
1030
1030
  interface NitroFrameworkInfo {
1031
1031
  name?: "nitro" | (string & {});
1032
1032
  version?: string;
1033
+ /**
1034
+ * Command shown in build output as the suggested preview command.
1035
+ *
1036
+ * Display-only: Nitro never executes this. Use this when the framework
1037
+ * wraps `nitro preview` with its own CLI (e.g. `npx nuxt preview`).
1038
+ * Defaults to `npx nitro preview`.
1039
+ */
1040
+ previewCommand?: string;
1041
+ /**
1042
+ * Command shown in build output as the suggested deploy command.
1043
+ *
1044
+ * Display-only: Nitro never executes this. Use this when the framework
1045
+ * wraps `nitro deploy` with its own CLI (e.g. `npx nuxt deploy`).
1046
+ * Defaults to `npx nitro deploy --prebuilt`.
1047
+ */
1048
+ deployCommand?: string;
1033
1049
  }
1034
1050
  /**
1035
1051
  * Build info written to `<output.dir>/nitro.json` (production, default
@@ -2031,6 +2047,20 @@ interface NitroOptions extends PresetOptions {
2031
2047
  */
2032
2048
  interface NitroConfig extends Partial<Omit<NitroOptions, "routeRules" | "rollupConfig" | "preset" | "compatibilityDate" | "unenv" | "serverDir" | "_config" | "_c12" | "serverEntry" | "renderer" | "output" | "tracingChannel">>, C12InputConfig<NitroConfig> {
2033
2049
  preset?: PresetNameInput;
2050
+ /**
2051
+ * Customize the preset used as the **fallback** when no `preset` is set and
2052
+ * none of the known hosting providers are auto-detected.
2053
+ *
2054
+ * By default, Nitro falls back to the runtime-based preset (`node`, and
2055
+ * `deno` or `bun` when running on those runtimes). An explicit `preset`,
2056
+ * the `NITRO_PRESET` environment variable, and auto-detected providers
2057
+ * (Vercel, Netlify, Cloudflare Pages, …) all take precedence over this.
2058
+ *
2059
+ * Accepts a preset name or an inline preset definition.
2060
+ *
2061
+ * @see https://nitro.build/config#defaultpreset
2062
+ */
2063
+ defaultPreset?: PresetNameInput | NitroPreset;
2034
2064
  extends?: string | string[] | NitroPreset;
2035
2065
  routeRules?: {
2036
2066
  [path: string]: NitroRouteConfig;
package/dist/vite.mjs CHANGED
@@ -122,8 +122,12 @@ async function buildEnvironments(ctx, builder) {
122
122
  await nitro.hooks.callHook("compiled", nitro);
123
123
  await writeBuildInfo(nitro, output);
124
124
  if (!v && !m) console.log();
125
- nitro.logger.success("You can preview this build using `npx vite preview`");
126
- if (nitro.options.commands.deploy) nitro.logger.success("You can deploy this build using `npx nitro deploy --prebuilt`");
125
+ const previewCommand = nitro.options.framework.previewCommand || "npx vite preview";
126
+ nitro.logger.success(`You can preview this build using \`${previewCommand}\``);
127
+ if (nitro.options.commands.deploy) {
128
+ const deployCommand = nitro.options.framework.deployCommand || "npx nitro deploy --prebuilt";
129
+ nitro.logger.success(`You can deploy this build using \`${deployCommand}\``);
130
+ }
127
131
  }
128
132
  function prodSetup(ctx) {
129
133
  return `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro",
3
- "version": "3.0.260522-beta",
3
+ "version": "3.0.260603-beta",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "keywords": [
6
6
  "api-routes",
@@ -78,8 +78,8 @@
78
78
  "ocache": "^0.1.4",
79
79
  "ofetch": "^2.0.0-alpha.3",
80
80
  "ohash": "^2.0.11",
81
- "rolldown": "^1.0.2",
82
- "srvx": "^0.11.15",
81
+ "rolldown": "^1.0.3",
82
+ "srvx": "^0.11.16",
83
83
  "unenv": "^2.0.0-rc.24",
84
84
  "unstorage": "^2.0.0-alpha.7"
85
85
  },
@@ -88,7 +88,7 @@
88
88
  "@azure/functions": "^3.5.1",
89
89
  "@azure/static-web-apps-cli": "^2.0.9",
90
90
  "@cloudflare/workers-types": "^4.20260521.1",
91
- "@cloudflare/workers-utils": "^0.21.0",
91
+ "@cloudflare/workers-utils": "^0.22.1",
92
92
  "@deno/types": "^0.0.1",
93
93
  "@hiogawa/vite-plugin-fullstack": "^0.0.11",
94
94
  "@netlify/edge-functions": "^3.0.7",
@@ -100,7 +100,7 @@
100
100
  "@rollup/plugin-node-resolve": "^16.0.3",
101
101
  "@rollup/plugin-replace": "^6.0.3",
102
102
  "@scalar/api-reference": "^1.57.2",
103
- "@scalar/openapi-types": "^0.8.0",
103
+ "@scalar/openapi-types": "^0.9.1",
104
104
  "@types/aws-lambda": "^8.10.161",
105
105
  "@types/estree": "^1.0.9",
106
106
  "@types/etag": "^1.8.4",
@@ -109,7 +109,7 @@
109
109
  "@types/node-fetch": "^2.6.13",
110
110
  "@types/semver": "^7.7.1",
111
111
  "@types/xml2js": "^0.4.14",
112
- "@typescript/native-preview": "7.0.0-dev.20260521.1",
112
+ "@typescript/native-preview": "7.0.0-dev.20260602.1",
113
113
  "@vercel/queue": "^0.2.0",
114
114
  "@vitest/coverage-v8": "^4.1.7",
115
115
  "automd": "^0.4.3",
@@ -143,7 +143,7 @@
143
143
  "nypm": "^0.6.6",
144
144
  "obuild": "^0.4.36",
145
145
  "oxc-parser": "link:shims/oxc-parser",
146
- "oxfmt": "^0.51.0",
146
+ "oxfmt": "^0.53.0",
147
147
  "oxlint": "^1.66.0",
148
148
  "pathe": "^2.0.3",
149
149
  "perfect-debounce": "^2.1.0",
@@ -181,8 +181,8 @@
181
181
  "@vercel/queue": "^0.2.0",
182
182
  "dotenv": "*",
183
183
  "giget": "*",
184
- "jiti": "^2.6.1",
185
- "rollup": "^4.60.3",
184
+ "jiti": "^2.7.0",
185
+ "rollup": "^4.60.4",
186
186
  "vite": "^7 || ^8",
187
187
  "xml2js": "^0.6.2",
188
188
  "zephyr-agent": "^0.2.0"
@@ -216,7 +216,7 @@
216
216
  "engines": {
217
217
  "node": "^20.19.0 || >=22.12.0"
218
218
  },
219
- "packageManager": "pnpm@11.1.3",
219
+ "packageManager": "pnpm@11.5.0",
220
220
  "compatiblePackages": {
221
221
  "schemaVersion": 1,
222
222
  "vite": {