nitropack-nightly 2.12.0-20250714-235420.f346ecf7 → 2.12.0-20250715-000851.66992d48

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.
@@ -1,4 +1,4 @@
1
- const version = "2.12.0-20250714-235420.f346ecf7";
1
+ const version = "2.12.0-20250715-000851.66992d48";
2
2
 
3
3
  const compatibilityChanges = [
4
4
  {
@@ -44,6 +44,10 @@ const cloudflarePages = defineNitroPreset(
44
44
  hooks: {
45
45
  "build:before": async (nitro) => {
46
46
  await enableNodeCompat(nitro);
47
+ if (!nitro.options.cloudflare.deployConfig) {
48
+ nitro.options.commands.preview = "npx wrangler pages dev {{ output.dir }}";
49
+ nitro.options.commands.deploy = "npx wrangler pages deploy {{ output.dir }}";
50
+ }
47
51
  },
48
52
  async compiled(nitro) {
49
53
  await writeWranglerConfig(nitro, "pages");
@@ -71,6 +75,12 @@ const cloudflarePagesStatic = defineNitroPreset(
71
75
  deploy: "npx wrangler --cwd ./ pages deploy"
72
76
  },
73
77
  hooks: {
78
+ "build:before": async (nitro) => {
79
+ if (!nitro.options.cloudflare.deployConfig) {
80
+ nitro.options.commands.preview = "npx wrangler pages dev {{ output.dir }}";
81
+ nitro.options.commands.deploy = "npx wrangler pages deploy {{ output.dir }}";
82
+ }
83
+ },
74
84
  async compiled(nitro) {
75
85
  await writeCFHeaders(nitro);
76
86
  await writeCFPagesRedirects(nitro);
@@ -126,6 +136,10 @@ const cloudflareModule = defineNitroPreset(
126
136
  hooks: {
127
137
  "build:before": async (nitro) => {
128
138
  await enableNodeCompat(nitro);
139
+ if (!nitro.options.cloudflare.deployConfig) {
140
+ nitro.options.commands.preview = "npx wrangler dev {{ output.serverDir }}/index.mjs --assets {{ output.publicDir }}";
141
+ nitro.options.commands.deploy = "npx wrangler deploy {{ output.serverDir }}/index.mjs --assets {{ output.publicDir }}";
142
+ }
129
143
  },
130
144
  async compiled(nitro) {
131
145
  await writeWranglerConfig(nitro, "module");
@@ -4,13 +4,21 @@ import { writeFile } from "nitropack/kit";
4
4
  import { dirname, relative, resolve } from "pathe";
5
5
  import { joinURL, withoutLeadingSlash } from "ufo";
6
6
  import { isTest } from "std-env";
7
+ const SUPPORTED_NODE_VERSIONS = [18, 20, 22];
8
+ function getSystemNodeVersion() {
9
+ const systemNodeVersion = Number.parseInt(
10
+ process.versions.node.split(".")[0]
11
+ );
12
+ return Number.isNaN(systemNodeVersion) ? 22 : systemNodeVersion;
13
+ }
7
14
  export async function generateFunctionFiles(nitro) {
8
15
  const o11Routes = getObservabilityRoutes(nitro);
9
16
  const buildConfigPath = resolve(nitro.options.output.dir, "config.json");
10
17
  const buildConfig = generateBuildConfig(nitro, o11Routes);
11
18
  await writeFile(buildConfigPath, JSON.stringify(buildConfig, null, 2));
12
- const systemNodeVersion = process.versions.node.split(".")[0];
13
- const runtimeVersion = `nodejs${systemNodeVersion}.x`;
19
+ const systemNodeVersion = getSystemNodeVersion();
20
+ const usedNodeVersion = SUPPORTED_NODE_VERSIONS.find((version) => version >= systemNodeVersion) ?? SUPPORTED_NODE_VERSIONS.at(-1);
21
+ const runtimeVersion = `nodejs${usedNodeVersion}.x`;
14
22
  const functionConfigPath = resolve(
15
23
  nitro.options.output.serverDir,
16
24
  ".vc-config.json"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitropack-nightly",
3
- "version": "2.12.0-20250714-235420.f346ecf7",
3
+ "version": "2.12.0-20250715-000851.66992d48",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "repository": "nitrojs/nitro",
6
6
  "license": "MIT",