nitropack-nightly 2.12.0-20250714-151334.b56c4684 → 2.12.0-20250714-235420.f346ecf7

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.
@@ -39,6 +39,7 @@ import { generateTypes, resolveSchema } from 'untyped';
39
39
  import { version } from 'nitropack/meta';
40
40
  import { gzipSize } from 'gzip-size';
41
41
  import prettyBytes from 'pretty-bytes';
42
+ import { getProperty } from 'dot-prop';
42
43
  import zlib from 'node:zlib';
43
44
  import { walk, parse } from 'ultrahtml';
44
45
  import { createError, getRequestURL, getRequestHeader, getResponseHeader, getRequestHeaders, setResponseHeaders, setResponseStatus, send, eventHandler, getRequestIP, toNodeListener, createApp, fromNodeMiddleware } from 'h3';
@@ -1647,15 +1648,19 @@ async function buildProduction(nitro, rollupConfig) {
1647
1648
  };
1648
1649
  if (buildInfo.commands.preview) {
1649
1650
  nitro.logger.success(
1650
- `You can preview this build using \`${rewriteRelativePaths(
1651
- buildInfo.commands.preview
1651
+ `You can preview this build using \`${_compilePathCommandTemplate(
1652
+ rewriteRelativePaths(buildInfo.commands.preview),
1653
+ nitro.options,
1654
+ nitro.options.rootDir
1652
1655
  )}\``
1653
1656
  );
1654
1657
  }
1655
1658
  if (buildInfo.commands.deploy) {
1656
1659
  nitro.logger.success(
1657
- `You can deploy this build using \`${rewriteRelativePaths(
1658
- buildInfo.commands.deploy
1660
+ `You can deploy this build using \`${_compilePathCommandTemplate(
1661
+ rewriteRelativePaths(buildInfo.commands.deploy),
1662
+ nitro.options,
1663
+ nitro.options.rootDir
1659
1664
  )}\``
1660
1665
  );
1661
1666
  }
@@ -1681,6 +1686,22 @@ async function _snapshot(nitro) {
1681
1686
  })
1682
1687
  );
1683
1688
  }
1689
+ function _compilePathCommandTemplate(contents, data, base) {
1690
+ if (!contents.includes("{{")) {
1691
+ return contents;
1692
+ }
1693
+ return contents.replace(/{{ ?([\w.]+) ?}}/g, (_, match) => {
1694
+ let val = getProperty(data, match);
1695
+ if (val) {
1696
+ val = relative(base, val);
1697
+ } else {
1698
+ consola$1.warn(
1699
+ `cannot resolve template param '${match}' in ${contents.slice(0, 20)}`
1700
+ );
1701
+ }
1702
+ return val || `${match}`;
1703
+ });
1704
+ }
1684
1705
 
1685
1706
  async function build(nitro) {
1686
1707
  await nitro.hooks.callHook("build:before", nitro);
@@ -1984,6 +2005,9 @@ async function prerender(nitro) {
1984
2005
  ...nitro.options._config,
1985
2006
  static: false,
1986
2007
  rootDir: nitro.options.rootDir,
2008
+ output: {
2009
+ serverDir: "{{ buildDir }}/prerender"
2010
+ },
1987
2011
  logLevel: 0,
1988
2012
  preset: "nitro-prerender"
1989
2013
  };
@@ -1,5 +1,5 @@
1
1
  import { NitroPreset, NitroPresetMeta, Nitro } from 'nitropack/types';
2
- import { N as NitroModule } from '../shared/nitro.Befw1Azc.mjs';
2
+ import { N as NitroModule } from '../shared/nitro.DLF2_KRt.mjs';
3
3
  import 'consola';
4
4
  import 'h3';
5
5
  import 'hookable';
@@ -1,5 +1,5 @@
1
1
  import { NitroPreset, NitroPresetMeta, Nitro } from 'nitropack/types';
2
- import { N as NitroModule } from '../shared/nitro.Befw1Azc.js';
2
+ import { N as NitroModule } from '../shared/nitro.DLF2_KRt.js';
3
3
  import 'consola';
4
4
  import 'h3';
5
5
  import 'hookable';
@@ -1,4 +1,4 @@
1
- const version = "2.12.0-20250714-151334.b56c4684";
1
+ const version = "2.12.0-20250714-235420.f346ecf7";
2
2
 
3
3
  const compatibilityChanges = [
4
4
  {
@@ -11,7 +11,7 @@ const serviceWorker = defineNitroPreset(
11
11
  serverDir: "{{ output.dir }}/public/server"
12
12
  },
13
13
  commands: {
14
- preview: "npx serve ./public"
14
+ preview: "npx serve {{ output.publicDir }}"
15
15
  },
16
16
  hooks: {
17
17
  "prerender:generate"(route, nitro) {
@@ -12,7 +12,7 @@ const _static = defineNitroPreset(
12
12
  crawlLinks: true
13
13
  },
14
14
  commands: {
15
- preview: "npx serve ./public"
15
+ preview: "npx serve {{ output.publicDir }}"
16
16
  }
17
17
  },
18
18
  {
@@ -25,7 +25,7 @@ const githubPages = defineNitroPreset(
25
25
  {
26
26
  extends: "static",
27
27
  commands: {
28
- deploy: "npx gh-pages --dotfiles -d ./public"
28
+ deploy: "npx gh-pages --dotfiles -d {{ output.publicDir }}"
29
29
  },
30
30
  prerender: {
31
31
  routes: [
@@ -10,7 +10,7 @@ const awsAmplify = defineNitroPreset(
10
10
  publicDir: "{{ output.dir }}/static{{ baseURL }}"
11
11
  },
12
12
  commands: {
13
- preview: "node ./compute/default/server.js"
13
+ preview: "node {{ output.serverDir }}/server.js"
14
14
  },
15
15
  hooks: {
16
16
  async compiled(nitro) {
@@ -8,7 +8,7 @@ const azure = defineNitroPreset(
8
8
  publicDir: "{{ output.dir }}/public/{{ baseURL }}"
9
9
  },
10
10
  commands: {
11
- preview: "npx @azure/static-web-apps-cli start ./public --api-location ./server"
11
+ preview: "npx @azure/static-web-apps-cli start {{ output.publicDir }} --api-location {{ output.serverDir }}"
12
12
  },
13
13
  hooks: {
14
14
  async compiled(ctx) {
@@ -18,8 +18,9 @@ export async function handle(context, req) {
18
18
  url,
19
19
  headers: req.headers,
20
20
  method: req.method || void 0,
21
+ // https://github.com/Azure/azure-functions-nodejs-worker/issues/294
21
22
  // https://github.com/Azure/azure-functions-host/issues/293
22
- body: req.rawBody
23
+ body: req.bufferBody ?? req.rawBody
23
24
  });
24
25
  context.res = {
25
26
  status,
@@ -6,7 +6,7 @@ const bun = defineNitroPreset(
6
6
  // https://bun.sh/docs/runtime/modules#resolution
7
7
  exportConditions: ["bun", "worker", "node", "import", "default"],
8
8
  commands: {
9
- preview: "bun run ./server/index.mjs"
9
+ preview: "bun run {{ output.serverDir }}/index.mjs"
10
10
  }
11
11
  },
12
12
  {
@@ -7,7 +7,7 @@ const cloudflare = defineNitroPreset(
7
7
  entry: "./runtime/cloudflare-worker",
8
8
  exportConditions: ["workerd"],
9
9
  commands: {
10
- preview: "npx wrangler dev ./server/index.mjs --site ./public",
10
+ preview: "npx wrangler dev {{ output.serverDir }}/index.mjs --site {{ output.publicDir }}",
11
11
  deploy: "npx wrangler deploy"
12
12
  },
13
13
  wasm: {
@@ -38,7 +38,7 @@ const cloudflareModuleLegacy = defineNitroPreset(
38
38
  entry: "./runtime/cloudflare-module-legacy",
39
39
  exportConditions: ["workerd"],
40
40
  commands: {
41
- preview: "npx wrangler dev ./server/index.mjs --site ./public",
41
+ preview: "npx wrangler dev {{ output.serverDir }}/index.mjs --site {{ output.publicDir }}",
42
42
  deploy: "npx wrangler deploy"
43
43
  },
44
44
  rollupConfig: {
@@ -12,7 +12,7 @@ const denoDeploy = defineNitroPreset(
12
12
  serveStatic: "deno",
13
13
  commands: {
14
14
  preview: "",
15
- deploy: "cd ./ && deployctl deploy --project=<project_name> server/index.ts"
15
+ deploy: "cd ./ && deployctl deploy --project=<project_name> {{ output.serverDir }}/index.ts"
16
16
  },
17
17
  unenv: unenvDenoPreset,
18
18
  rollupConfig: {
@@ -17,7 +17,7 @@ const nodeServer = defineNitroPreset(
17
17
  entry: "./runtime/node-server",
18
18
  serveStatic: true,
19
19
  commands: {
20
- preview: "node ./server/index.mjs"
20
+ preview: "node {{ output.serverDir }}/index.mjs"
21
21
  }
22
22
  },
23
23
  {
@@ -57,7 +57,7 @@ const cli = defineNitroPreset(
57
57
  extends: "node",
58
58
  entry: "./runtime/cli",
59
59
  commands: {
60
- preview: "Run with node ./server/index.mjs [route]"
60
+ preview: "Run with node {{ output.serverDir }}/index.mjs [route]"
61
61
  }
62
62
  },
63
63
  {
@@ -90,7 +90,7 @@ const vercelStatic = defineNitroPreset(
90
90
  publicDir: "{{ output.dir }}/static/{{ baseURL }}"
91
91
  },
92
92
  commands: {
93
- preview: "npx serve ./static"
93
+ preview: "npx serve {{ output.publicDir }}"
94
94
  },
95
95
  hooks: {
96
96
  "rollup:before": (nitro) => {
@@ -5,7 +5,7 @@ import { dirname, relative, resolve } from "pathe";
5
5
  import { joinURL, withoutLeadingSlash } from "ufo";
6
6
  import { isTest } from "std-env";
7
7
  export async function generateFunctionFiles(nitro) {
8
- const o11Routes = getObservibilityRoutes(nitro);
8
+ const o11Routes = getObservabilityRoutes(nitro);
9
9
  const buildConfigPath = resolve(nitro.options.output.dir, "config.json");
10
10
  const buildConfig = generateBuildConfig(nitro, o11Routes);
11
11
  await writeFile(buildConfigPath, JSON.stringify(buildConfig, null, 2));
@@ -218,11 +218,12 @@ export function deprecateSWR(nitro) {
218
218
  function _hasProp(obj, prop) {
219
219
  return obj && typeof obj === "object" && prop in obj;
220
220
  }
221
- function getObservibilityRoutes(nitro) {
221
+ function getObservabilityRoutes(nitro) {
222
222
  const routePatterns = [
223
- ...new Set(
224
- [...nitro.scannedHandlers, ...nitro.options.handlers].filter((h) => !h.middleware && h.route).map((h) => h.route)
225
- )
223
+ .../* @__PURE__ */ new Set([
224
+ ...nitro.options.ssrRoutes || [],
225
+ ...[...nitro.scannedHandlers, ...nitro.options.handlers].filter((h) => !h.middleware && h.route).map((h) => h.route)
226
+ ])
226
227
  ];
227
228
  const staticRoutes = [];
228
229
  const dynamicRoutes = [];
@@ -58,7 +58,7 @@ const zeaburStatic = defineNitroPreset(
58
58
  publicDir: "{{ output.dir }}/static"
59
59
  },
60
60
  commands: {
61
- preview: "npx serve ./static"
61
+ preview: "npx serve {{ output.publicDir }}"
62
62
  }
63
63
  },
64
64
  {
@@ -988,6 +988,7 @@ interface NitroOptions extends PresetOptions {
988
988
  bundledStorage: string[];
989
989
  timing: boolean;
990
990
  renderer?: string;
991
+ ssrRoutes: string[];
991
992
  serveStatic: boolean | "node" | "deno" | "inline";
992
993
  noPublicDir: boolean;
993
994
  /**
@@ -988,6 +988,7 @@ interface NitroOptions extends PresetOptions {
988
988
  bundledStorage: string[];
989
989
  timing: boolean;
990
990
  renderer?: string;
991
+ ssrRoutes: string[];
991
992
  serveStatic: boolean | "node" | "deno" | "inline";
992
993
  noPublicDir: boolean;
993
994
  /**
@@ -1,7 +1,7 @@
1
1
  import { App, Router, H3Event, RouterMethod } from 'h3';
2
2
  import { FetchRequest, FetchOptions, FetchResponse } from 'ofetch';
3
- import { a as NitroOptions, b as NitroConfig, N as NitroModule } from '../shared/nitro.Befw1Azc.mjs';
4
- export { A as AppConfig, C as CacheEntry, c as CacheOptions, d as CachedEventHandlerOptions, e as CompressOptions, g as DatabaseConnectionConfig, h as DatabaseConnectionConfigs, D as DatabaseConnectionName, l as DevServerOptions, I as EsbuildOptions, O as HTTPStatusCode, L as LoadConfigOptions, u as Nitro, y as NitroBuildInfo, q as NitroDevEventHandler, n as NitroDevServer, v as NitroDynamicConfig, r as NitroErrorHandler, p as NitroEventHandler, x as NitroFrameworkInfo, s as NitroHooks, t as NitroModuleInput, k as NitroOpenAPIConfig, E as NitroPreset, F as NitroPresetMeta, Q as NitroRouteConfig, o as NitroRouteMeta, T as NitroRouteRules, j as NitroRuntimeConfig, i as NitroRuntimeConfigApp, w as NitroTypes, m as NitroWorker, J as NodeExternalsOptions, B as PrerenderGenerateRoute, z as PrerenderRoute, P as PublicAssetDir, M as RawOptions, R as ResponseCacheEntry, G as RollupConfig, H as RollupVirtualOptions, S as ServerAssetDir, K as ServerAssetOptions, f as StorageMounts, V as VirtualModule } from '../shared/nitro.Befw1Azc.mjs';
3
+ import { a as NitroOptions, b as NitroConfig, N as NitroModule } from '../shared/nitro.DLF2_KRt.mjs';
4
+ export { A as AppConfig, C as CacheEntry, c as CacheOptions, d as CachedEventHandlerOptions, e as CompressOptions, g as DatabaseConnectionConfig, h as DatabaseConnectionConfigs, D as DatabaseConnectionName, l as DevServerOptions, I as EsbuildOptions, O as HTTPStatusCode, L as LoadConfigOptions, u as Nitro, y as NitroBuildInfo, q as NitroDevEventHandler, n as NitroDevServer, v as NitroDynamicConfig, r as NitroErrorHandler, p as NitroEventHandler, x as NitroFrameworkInfo, s as NitroHooks, t as NitroModuleInput, k as NitroOpenAPIConfig, E as NitroPreset, F as NitroPresetMeta, Q as NitroRouteConfig, o as NitroRouteMeta, T as NitroRouteRules, j as NitroRuntimeConfig, i as NitroRuntimeConfigApp, w as NitroTypes, m as NitroWorker, J as NodeExternalsOptions, B as PrerenderGenerateRoute, z as PrerenderRoute, P as PublicAssetDir, M as RawOptions, R as ResponseCacheEntry, G as RollupConfig, H as RollupVirtualOptions, S as ServerAssetDir, K as ServerAssetOptions, f as StorageMounts, V as VirtualModule } from '../shared/nitro.DLF2_KRt.mjs';
5
5
  import { Hookable } from 'hookable';
6
6
  import { NitroRuntimeHooks as NitroRuntimeHooks$1 } from 'nitropack';
7
7
  import { AbstractRequest, AbstractResponse } from 'node-mock-http';
@@ -1,7 +1,7 @@
1
1
  import { App, Router, H3Event, RouterMethod } from 'h3';
2
2
  import { FetchRequest, FetchOptions, FetchResponse } from 'ofetch';
3
- import { a as NitroOptions, b as NitroConfig, N as NitroModule } from '../shared/nitro.Befw1Azc.js';
4
- export { A as AppConfig, C as CacheEntry, c as CacheOptions, d as CachedEventHandlerOptions, e as CompressOptions, g as DatabaseConnectionConfig, h as DatabaseConnectionConfigs, D as DatabaseConnectionName, l as DevServerOptions, I as EsbuildOptions, O as HTTPStatusCode, L as LoadConfigOptions, u as Nitro, y as NitroBuildInfo, q as NitroDevEventHandler, n as NitroDevServer, v as NitroDynamicConfig, r as NitroErrorHandler, p as NitroEventHandler, x as NitroFrameworkInfo, s as NitroHooks, t as NitroModuleInput, k as NitroOpenAPIConfig, E as NitroPreset, F as NitroPresetMeta, Q as NitroRouteConfig, o as NitroRouteMeta, T as NitroRouteRules, j as NitroRuntimeConfig, i as NitroRuntimeConfigApp, w as NitroTypes, m as NitroWorker, J as NodeExternalsOptions, B as PrerenderGenerateRoute, z as PrerenderRoute, P as PublicAssetDir, M as RawOptions, R as ResponseCacheEntry, G as RollupConfig, H as RollupVirtualOptions, S as ServerAssetDir, K as ServerAssetOptions, f as StorageMounts, V as VirtualModule } from '../shared/nitro.Befw1Azc.js';
3
+ import { a as NitroOptions, b as NitroConfig, N as NitroModule } from '../shared/nitro.DLF2_KRt.js';
4
+ export { A as AppConfig, C as CacheEntry, c as CacheOptions, d as CachedEventHandlerOptions, e as CompressOptions, g as DatabaseConnectionConfig, h as DatabaseConnectionConfigs, D as DatabaseConnectionName, l as DevServerOptions, I as EsbuildOptions, O as HTTPStatusCode, L as LoadConfigOptions, u as Nitro, y as NitroBuildInfo, q as NitroDevEventHandler, n as NitroDevServer, v as NitroDynamicConfig, r as NitroErrorHandler, p as NitroEventHandler, x as NitroFrameworkInfo, s as NitroHooks, t as NitroModuleInput, k as NitroOpenAPIConfig, E as NitroPreset, F as NitroPresetMeta, Q as NitroRouteConfig, o as NitroRouteMeta, T as NitroRouteRules, j as NitroRuntimeConfig, i as NitroRuntimeConfigApp, w as NitroTypes, m as NitroWorker, J as NodeExternalsOptions, B as PrerenderGenerateRoute, z as PrerenderRoute, P as PublicAssetDir, M as RawOptions, R as ResponseCacheEntry, G as RollupConfig, H as RollupVirtualOptions, S as ServerAssetDir, K as ServerAssetOptions, f as StorageMounts, V as VirtualModule } from '../shared/nitro.DLF2_KRt.js';
5
5
  import { Hookable } from 'hookable';
6
6
  import { NitroRuntimeHooks as NitroRuntimeHooks$1 } from 'nitropack';
7
7
  import { AbstractRequest, AbstractResponse } from 'node-mock-http';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitropack-nightly",
3
- "version": "2.12.0-20250714-151334.b56c4684",
3
+ "version": "2.12.0-20250714-235420.f346ecf7",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "repository": "nitrojs/nitro",
6
6
  "license": "MIT",