nitropack-nightly 2.12.0-20250714-160324.f380b6c6 → 2.12.0-20250715-000039.a3743968
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/core/index.mjs +28 -4
- package/dist/meta/index.mjs +1 -1
- package/dist/presets/_nitro/service-worker.mjs +1 -1
- package/dist/presets/_static/preset.mjs +2 -2
- package/dist/presets/aws-amplify/preset.mjs +1 -1
- package/dist/presets/azure/preset.mjs +1 -1
- package/dist/presets/azure/runtime/azure-swa.mjs +2 -1
- package/dist/presets/bun/preset.mjs +1 -1
- package/dist/presets/cloudflare/preset-legacy.mjs +2 -2
- package/dist/presets/cloudflare/preset.mjs +14 -0
- package/dist/presets/deno/preset.mjs +1 -1
- package/dist/presets/node/preset.mjs +2 -2
- package/dist/presets/vercel/preset.mjs +1 -1
- package/dist/presets/vercel/utils.mjs +2 -2
- package/dist/presets/zeabur/preset.mjs +1 -1
- package/package.json +1 -1
package/dist/core/index.mjs
CHANGED
|
@@ -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 \`${
|
|
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 \`${
|
|
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
|
};
|
package/dist/meta/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ const _static = defineNitroPreset(
|
|
|
12
12
|
crawlLinks: true
|
|
13
13
|
},
|
|
14
14
|
commands: {
|
|
15
|
-
preview: "npx serve
|
|
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
|
|
28
|
+
deploy: "npx gh-pages --dotfiles -d {{ output.publicDir }}"
|
|
29
29
|
},
|
|
30
30
|
prerender: {
|
|
31
31
|
routes: [
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
41
|
+
preview: "npx wrangler dev {{ output.serverDir }}/index.mjs --site {{ output.publicDir }}",
|
|
42
42
|
deploy: "npx wrangler deploy"
|
|
43
43
|
},
|
|
44
44
|
rollupConfig: {
|
|
@@ -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");
|
|
@@ -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>
|
|
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
|
|
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
|
|
60
|
+
preview: "Run with node {{ output.serverDir }}/index.mjs [route]"
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
{
|
|
@@ -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 =
|
|
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,7 +218,7 @@ export function deprecateSWR(nitro) {
|
|
|
218
218
|
function _hasProp(obj, prop) {
|
|
219
219
|
return obj && typeof obj === "object" && prop in obj;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function getObservabilityRoutes(nitro) {
|
|
222
222
|
const routePatterns = [
|
|
223
223
|
.../* @__PURE__ */ new Set([
|
|
224
224
|
...nitro.options.ssrRoutes || [],
|
package/package.json
CHANGED