nitropack-nightly 2.10.0-28638494.93d002b7 → 3.0.0-beta-28638629.b32e0831-nitro-nightly-mirror
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/README.md +1 -1
- package/cli.d.ts +1 -1
- package/config.d.ts +1 -1
- package/core.d.ts +1 -1
- package/dist/cli/index.d.mts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.mjs +1 -18
- package/dist/config/index.d.mts +1 -6
- package/dist/config/index.d.ts +1 -6
- package/dist/config/index.mjs +1 -5
- package/dist/core/index.d.mts +1 -69
- package/dist/core/index.d.ts +1 -69
- package/dist/core/index.mjs +1 -2435
- package/dist/kit/index.d.mts +1 -44
- package/dist/kit/index.d.ts +1 -44
- package/dist/kit/index.mjs +1 -71
- package/dist/meta/index.d.mts +1 -3
- package/dist/meta/index.d.ts +1 -3
- package/dist/meta/index.mjs +1 -3
- package/dist/presets/index.d.mts +1 -1
- package/dist/presets/index.d.ts +1 -2
- package/dist/presets/index.mjs +1 -1
- package/dist/rollup/index.d.mts +1 -5
- package/dist/rollup/index.d.ts +1 -5
- package/dist/rollup/index.mjs +1 -2033
- package/dist/runtime/index.d.mts +1 -0
- package/dist/runtime/index.d.ts +1 -12
- package/dist/runtime/index.mjs +1 -17
- package/dist/types/index.d.mts +1 -260
- package/dist/types/index.d.ts +1 -260
- package/dist/types/index.mjs +1 -1
- package/kit.d.ts +1 -1
- package/meta.d.ts +1 -1
- package/package.json +6 -172
- package/presets.d.ts +1 -1
- package/rollup.d.ts +1 -1
- package/runtime-meta.d.ts +1 -4
- package/runtime-meta.mjs +1 -30
- package/runtime.d.ts +1 -1
- package/types.d.ts +1 -1
- package/dist/cli/build.mjs +0 -47
- package/dist/cli/common.mjs +0 -13
- package/dist/cli/dev.mjs +0 -63
- package/dist/cli/index2.mjs +0 -14
- package/dist/cli/list.mjs +0 -28
- package/dist/cli/prepare.mjs +0 -21
- package/dist/cli/run.mjs +0 -57
- package/dist/presets/_all.gen.d.ts +0 -2
- package/dist/presets/_all.gen.mjs +0 -52
- package/dist/presets/_nitro/base-worker.d.ts +0 -2
- package/dist/presets/_nitro/base-worker.mjs +0 -25
- package/dist/presets/_nitro/nitro-dev.d.ts +0 -2
- package/dist/presets/_nitro/nitro-dev.mjs +0 -19
- package/dist/presets/_nitro/nitro-prerender.d.ts +0 -2
- package/dist/presets/_nitro/nitro-prerender.mjs +0 -17
- package/dist/presets/_nitro/preset.d.ts +0 -2
- package/dist/presets/_nitro/preset.mjs +0 -5
- package/dist/presets/_nitro/runtime/nitro-dev.d.ts +0 -1
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +0 -86
- package/dist/presets/_nitro/runtime/nitro-prerenderer.d.ts +0 -3
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +0 -7
- package/dist/presets/_nitro/runtime/service-worker.d.ts +0 -1
- package/dist/presets/_nitro/runtime/service-worker.mjs +0 -31
- package/dist/presets/_nitro/service-worker.d.ts +0 -2
- package/dist/presets/_nitro/service-worker.mjs +0 -110
- package/dist/presets/_resolve.d.ts +0 -8
- package/dist/presets/_resolve.mjs +0 -44
- package/dist/presets/_static/preset.d.ts +0 -2
- package/dist/presets/_static/preset.mjs +0 -69
- package/dist/presets/_types.gen.d.ts +0 -16
- package/dist/presets/_types.gen.mjs +0 -0
- package/dist/presets/alwaysdata/preset.d.ts +0 -2
- package/dist/presets/alwaysdata/preset.mjs +0 -14
- package/dist/presets/aws-amplify/preset.d.ts +0 -3
- package/dist/presets/aws-amplify/preset.mjs +0 -27
- package/dist/presets/aws-amplify/runtime/aws-amplify.d.ts +0 -1
- package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +0 -13
- package/dist/presets/aws-amplify/types.d.ts +0 -141
- package/dist/presets/aws-amplify/types.mjs +0 -0
- package/dist/presets/aws-amplify/utils.d.ts +0 -2
- package/dist/presets/aws-amplify/utils.mjs +0 -82
- package/dist/presets/aws-lambda/preset.d.ts +0 -2
- package/dist/presets/aws-lambda/preset.mjs +0 -21
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.ts +0 -15
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +0 -53
- package/dist/presets/aws-lambda/runtime/aws-lambda.d.ts +0 -4
- package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +0 -45
- package/dist/presets/azure/preset.d.ts +0 -3
- package/dist/presets/azure/preset.mjs +0 -44
- package/dist/presets/azure/runtime/azure-functions.d.ts +0 -5
- package/dist/presets/azure/runtime/azure-functions.mjs +0 -24
- package/dist/presets/azure/runtime/azure-swa.d.ts +0 -5
- package/dist/presets/azure/runtime/azure-swa.mjs +0 -30
- package/dist/presets/azure/types.d.ts +0 -13
- package/dist/presets/azure/types.mjs +0 -0
- package/dist/presets/azure/utils.d.ts +0 -3
- package/dist/presets/azure/utils.mjs +0 -183
- package/dist/presets/bun/preset.d.ts +0 -2
- package/dist/presets/bun/preset.mjs +0 -17
- package/dist/presets/bun/runtime/bun.d.ts +0 -1
- package/dist/presets/bun/runtime/bun.mjs +0 -32
- package/dist/presets/cleavr/preset.d.ts +0 -2
- package/dist/presets/cleavr/preset.mjs +0 -12
- package/dist/presets/cloudflare/preset.d.ts +0 -3
- package/dist/presets/cloudflare/preset.mjs +0 -145
- package/dist/presets/cloudflare/runtime/cloudflare-module.d.ts +0 -13
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +0 -102
- package/dist/presets/cloudflare/runtime/cloudflare-pages.d.ts +0 -20
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +0 -55
- package/dist/presets/cloudflare/runtime/cloudflare-worker.d.ts +0 -1
- package/dist/presets/cloudflare/runtime/cloudflare-worker.mjs +0 -63
- package/dist/presets/cloudflare/types.d.ts +0 -89
- package/dist/presets/cloudflare/types.mjs +0 -0
- package/dist/presets/cloudflare/types.wrangler.d.ts +0 -974
- package/dist/presets/cloudflare/types.wrangler.mjs +0 -0
- package/dist/presets/cloudflare/utils.d.ts +0 -3
- package/dist/presets/cloudflare/utils.mjs +0 -163
- package/dist/presets/deno/preset.d.ts +0 -2
- package/dist/presets/deno/preset.mjs +0 -148
- package/dist/presets/deno/runtime/_deno-env-polyfill.d.ts +0 -0
- package/dist/presets/deno/runtime/_deno-env-polyfill.mjs +0 -1
- package/dist/presets/deno/runtime/deno-deploy.d.ts +0 -2
- package/dist/presets/deno/runtime/deno-deploy.mjs +0 -32
- package/dist/presets/deno/runtime/deno-server.d.ts +0 -4
- package/dist/presets/deno/runtime/deno-server.mjs +0 -66
- package/dist/presets/digitalocean/preset.d.ts +0 -2
- package/dist/presets/digitalocean/preset.mjs +0 -11
- package/dist/presets/edgio/preset.d.ts +0 -2
- package/dist/presets/edgio/preset.mjs +0 -95
- package/dist/presets/firebase/preset.d.ts +0 -3
- package/dist/presets/firebase/preset.mjs +0 -51
- package/dist/presets/firebase/runtime/firebase-gen-1.d.ts +0 -2
- package/dist/presets/firebase/runtime/firebase-gen-1.mjs +0 -8
- package/dist/presets/firebase/runtime/firebase-gen-2.d.ts +0 -2
- package/dist/presets/firebase/runtime/firebase-gen-2.mjs +0 -15
- package/dist/presets/firebase/runtime/firebase-gen-default.d.ts +0 -1
- package/dist/presets/firebase/runtime/firebase-gen-default.mjs +0 -1
- package/dist/presets/firebase/types.d.ts +0 -37
- package/dist/presets/firebase/types.mjs +0 -0
- package/dist/presets/firebase/utils.d.ts +0 -3
- package/dist/presets/firebase/utils.mjs +0 -50
- package/dist/presets/flightcontrol/preset.d.ts +0 -2
- package/dist/presets/flightcontrol/preset.mjs +0 -11
- package/dist/presets/heroku/preset.d.ts +0 -2
- package/dist/presets/heroku/preset.mjs +0 -11
- package/dist/presets/iis/preset.d.ts +0 -2
- package/dist/presets/iis/preset.mjs +0 -32
- package/dist/presets/iis/utils.d.ts +0 -3
- package/dist/presets/iis/utils.mjs +0 -159
- package/dist/presets/koyeb/preset.d.ts +0 -2
- package/dist/presets/koyeb/preset.mjs +0 -11
- package/dist/presets/netlify/legacy/preset.d.ts +0 -2
- package/dist/presets/netlify/legacy/preset.mjs +0 -142
- package/dist/presets/netlify/legacy/runtime/_deno-env-polyfill.d.ts +0 -0
- package/dist/presets/netlify/legacy/runtime/_deno-env-polyfill.mjs +0 -1
- package/dist/presets/netlify/legacy/runtime/netlify-builder.d.ts +0 -3
- package/dist/presets/netlify/legacy/runtime/netlify-builder.mjs +0 -5
- package/dist/presets/netlify/legacy/runtime/netlify-edge.d.ts +0 -3
- package/dist/presets/netlify/legacy/runtime/netlify-edge.mjs +0 -26
- package/dist/presets/netlify/legacy/runtime/netlify-lambda.d.ts +0 -4
- package/dist/presets/netlify/legacy/runtime/netlify-lambda.mjs +0 -39
- package/dist/presets/netlify/legacy/runtime/netlify.d.ts +0 -4
- package/dist/presets/netlify/legacy/runtime/netlify.mjs +0 -22
- package/dist/presets/netlify/legacy/utils.d.ts +0 -4
- package/dist/presets/netlify/legacy/utils.mjs +0 -113
- package/dist/presets/netlify/preset.d.ts +0 -3
- package/dist/presets/netlify/preset.mjs +0 -127
- package/dist/presets/netlify/runtime/_deno-env-polyfill.d.ts +0 -0
- package/dist/presets/netlify/runtime/_deno-env-polyfill.mjs +0 -1
- package/dist/presets/netlify/runtime/netlify-edge.d.ts +0 -2
- package/dist/presets/netlify/runtime/netlify-edge.mjs +0 -25
- package/dist/presets/netlify/runtime/netlify.d.ts +0 -4
- package/dist/presets/netlify/runtime/netlify.mjs +0 -54
- package/dist/presets/netlify/types.d.ts +0 -12
- package/dist/presets/netlify/types.mjs +0 -0
- package/dist/presets/netlify/utils.d.ts +0 -5
- package/dist/presets/netlify/utils.mjs +0 -94
- package/dist/presets/node/preset.d.ts +0 -2
- package/dist/presets/node/preset.mjs +0 -49
- package/dist/presets/node/runtime/cli.d.ts +0 -1
- package/dist/presets/node/runtime/cli.mjs +0 -21
- package/dist/presets/node/runtime/cluster.d.ts +0 -1
- package/dist/presets/node/runtime/cluster.mjs +0 -60
- package/dist/presets/node/runtime/node-listener.d.ts +0 -6
- package/dist/presets/node/runtime/node-listener.mjs +0 -15
- package/dist/presets/node/runtime/node-server.d.ts +0 -3
- package/dist/presets/node/runtime/node-server.mjs +0 -44
- package/dist/presets/platform.sh/preset.d.ts +0 -2
- package/dist/presets/platform.sh/preset.mjs +0 -11
- package/dist/presets/render.com/preset.d.ts +0 -2
- package/dist/presets/render.com/preset.mjs +0 -11
- package/dist/presets/stormkit/preset.d.ts +0 -2
- package/dist/presets/stormkit/preset.mjs +0 -15
- package/dist/presets/stormkit/runtime/stormkit.d.ts +0 -21
- package/dist/presets/stormkit/runtime/stormkit.mjs +0 -32
- package/dist/presets/vercel/preset.d.ts +0 -3
- package/dist/presets/vercel/preset.mjs +0 -104
- package/dist/presets/vercel/runtime/vercel-edge.d.ts +0 -2
- package/dist/presets/vercel/runtime/vercel-edge.mjs +0 -22
- package/dist/presets/vercel/runtime/vercel.d.ts +0 -4
- package/dist/presets/vercel/runtime/vercel.mjs +0 -17
- package/dist/presets/vercel/types.d.ts +0 -78
- package/dist/presets/vercel/types.mjs +0 -0
- package/dist/presets/vercel/utils.d.ts +0 -5
- package/dist/presets/vercel/utils.mjs +0 -186
- package/dist/presets/winterjs/preset.d.ts +0 -2
- package/dist/presets/winterjs/preset.mjs +0 -20
- package/dist/presets/winterjs/runtime/winterjs.d.ts +0 -1
- package/dist/presets/winterjs/runtime/winterjs.mjs +0 -69
- package/dist/presets/zeabur/preset.d.ts +0 -2
- package/dist/presets/zeabur/preset.mjs +0 -70
- package/dist/presets/zeabur/runtime/zeabur.d.ts +0 -4
- package/dist/presets/zeabur/runtime/zeabur.mjs +0 -8
- package/dist/runtime/app.d.ts +0 -2
- package/dist/runtime/app.mjs +0 -1
- package/dist/runtime/cache.d.ts +0 -1
- package/dist/runtime/cache.mjs +0 -6
- package/dist/runtime/config.d.ts +0 -1
- package/dist/runtime/config.mjs +0 -1
- package/dist/runtime/context.d.ts +0 -1
- package/dist/runtime/context.mjs +0 -1
- package/dist/runtime/database.d.ts +0 -1
- package/dist/runtime/database.mjs +0 -1
- package/dist/runtime/error.d.ts +0 -1
- package/dist/runtime/error.mjs +0 -1
- package/dist/runtime/internal/app.d.ts +0 -3
- package/dist/runtime/internal/app.mjs +0 -152
- package/dist/runtime/internal/cache.d.ts +0 -8
- package/dist/runtime/internal/cache.mjs +0 -329
- package/dist/runtime/internal/client.d.ts +0 -1
- package/dist/runtime/internal/client.mjs +0 -4
- package/dist/runtime/internal/config.d.ts +0 -6
- package/dist/runtime/internal/config.mjs +0 -58
- package/dist/runtime/internal/context.d.ts +0 -12
- package/dist/runtime/internal/context.mjs +0 -17
- package/dist/runtime/internal/database.d.ts +0 -2
- package/dist/runtime/internal/database.mjs +0 -14
- package/dist/runtime/internal/debug.d.ts +0 -2
- package/dist/runtime/internal/debug.mjs +0 -5
- package/dist/runtime/internal/error.d.ts +0 -4
- package/dist/runtime/internal/error.mjs +0 -71
- package/dist/runtime/internal/index.d.ts +0 -6
- package/dist/runtime/internal/index.mjs +0 -16
- package/dist/runtime/internal/lib/http-graceful-shutdown.d.ts +0 -16
- package/dist/runtime/internal/lib/http-graceful-shutdown.mjs +0 -213
- package/dist/runtime/internal/meta.d.ts +0 -2
- package/dist/runtime/internal/meta.mjs +0 -3
- package/dist/runtime/internal/plugin.d.ts +0 -3
- package/dist/runtime/internal/plugin.mjs +0 -4
- package/dist/runtime/internal/renderer.d.ts +0 -2
- package/dist/runtime/internal/renderer.mjs +0 -38
- package/dist/runtime/internal/route-rules.d.ts +0 -14
- package/dist/runtime/internal/route-rules.mjs +0 -67
- package/dist/runtime/internal/routes/openapi.d.ts +0 -3
- package/dist/runtime/internal/routes/openapi.mjs +0 -85
- package/dist/runtime/internal/routes/scalar.d.ts +0 -2
- package/dist/runtime/internal/routes/scalar.mjs +0 -191
- package/dist/runtime/internal/routes/swagger.d.ts +0 -2
- package/dist/runtime/internal/routes/swagger.mjs +0 -39
- package/dist/runtime/internal/shutdown.d.ts +0 -10
- package/dist/runtime/internal/shutdown.mjs +0 -34
- package/dist/runtime/internal/static.d.ts +0 -2
- package/dist/runtime/internal/static.mjs +0 -89
- package/dist/runtime/internal/storage.d.ts +0 -2
- package/dist/runtime/internal/storage.mjs +0 -5
- package/dist/runtime/internal/task.d.ts +0 -17
- package/dist/runtime/internal/task.mjs +0 -73
- package/dist/runtime/internal/timing.d.ts +0 -2
- package/dist/runtime/internal/timing.mjs +0 -29
- package/dist/runtime/internal/utils.azure.d.ts +0 -2
- package/dist/runtime/internal/utils.azure.mjs +0 -51
- package/dist/runtime/internal/utils.d.ts +0 -23
- package/dist/runtime/internal/utils.env.d.ts +0 -7
- package/dist/runtime/internal/utils.env.mjs +0 -39
- package/dist/runtime/internal/utils.lambda.d.ts +0 -12
- package/dist/runtime/internal/utils.lambda.mjs +0 -30
- package/dist/runtime/internal/utils.mjs +0 -129
- package/dist/runtime/plugin.d.ts +0 -1
- package/dist/runtime/plugin.mjs +0 -1
- package/dist/runtime/storage.d.ts +0 -1
- package/dist/runtime/storage.mjs +0 -1
- package/dist/runtime/task.d.ts +0 -1
- package/dist/runtime/task.mjs +0 -1
- package/dist/runtime/utils.d.ts +0 -1
- package/dist/runtime/utils.mjs +0 -1
- package/dist/shared/nitro.DkCt8MDS.d.mts +0 -588
- package/dist/shared/nitro.DkCt8MDS.d.ts +0 -588
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
|
-
import { writeFile } from "node:fs/promises";
|
|
3
|
-
import { joinURL } from "ufo";
|
|
4
|
-
export async function writeAmplifyFiles(nitro) {
|
|
5
|
-
const outDir = nitro.options.output.dir;
|
|
6
|
-
const routes = [];
|
|
7
|
-
let hasWildcardPublicAsset = false;
|
|
8
|
-
if (nitro.options.awsAmplify?.imageOptimization && !nitro.options.static) {
|
|
9
|
-
const { path, cacheControl } = nitro.options.awsAmplify?.imageOptimization || {};
|
|
10
|
-
if (path) {
|
|
11
|
-
routes.push({
|
|
12
|
-
path,
|
|
13
|
-
target: {
|
|
14
|
-
kind: "ImageOptimization",
|
|
15
|
-
cacheControl
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const computeTarget = nitro.options.static ? { kind: "Static" } : { kind: "Compute", src: "default" };
|
|
21
|
-
for (const publicAsset of nitro.options.publicAssets) {
|
|
22
|
-
if (!publicAsset.baseURL || publicAsset.baseURL === "/") {
|
|
23
|
-
hasWildcardPublicAsset = true;
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
routes.push({
|
|
27
|
-
path: `${publicAsset.baseURL.replace(/\/$/, "")}/*`,
|
|
28
|
-
target: {
|
|
29
|
-
kind: "Static",
|
|
30
|
-
cacheControl: publicAsset.maxAge > 0 ? `public, max-age=${publicAsset.maxAge}, immutable` : void 0
|
|
31
|
-
},
|
|
32
|
-
fallback: publicAsset.fallthrough ? computeTarget : void 0
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
if (hasWildcardPublicAsset && !nitro.options.static) {
|
|
36
|
-
routes.push({
|
|
37
|
-
path: "/*.*",
|
|
38
|
-
target: {
|
|
39
|
-
kind: "Static"
|
|
40
|
-
},
|
|
41
|
-
fallback: computeTarget
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
routes.push({
|
|
45
|
-
path: "/*",
|
|
46
|
-
target: computeTarget,
|
|
47
|
-
fallback: hasWildcardPublicAsset && nitro.options.awsAmplify?.catchAllStaticFallback ? {
|
|
48
|
-
kind: "Static"
|
|
49
|
-
} : void 0
|
|
50
|
-
});
|
|
51
|
-
for (const route of routes) {
|
|
52
|
-
if (route.path !== "/*") {
|
|
53
|
-
route.path = joinURL(nitro.options.baseURL, route.path);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
const deployManifest = {
|
|
57
|
-
version: 1,
|
|
58
|
-
routes,
|
|
59
|
-
imageSettings: nitro.options.awsAmplify?.imageSettings || void 0,
|
|
60
|
-
computeResources: nitro.options.static ? void 0 : [
|
|
61
|
-
{
|
|
62
|
-
name: "default",
|
|
63
|
-
entrypoint: "server.js",
|
|
64
|
-
runtime: "nodejs18.x"
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
framework: {
|
|
68
|
-
name: nitro.options.framework.name || "nitro",
|
|
69
|
-
version: nitro.options.framework.version || "0.0.0"
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
await writeFile(
|
|
73
|
-
resolve(outDir, "deploy-manifest.json"),
|
|
74
|
-
JSON.stringify(deployManifest, null, 2)
|
|
75
|
-
);
|
|
76
|
-
if (!nitro.options.static) {
|
|
77
|
-
await writeFile(
|
|
78
|
-
resolve(outDir, "compute/default/server.js"),
|
|
79
|
-
`import("./index.mjs")`
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { defineNitroPreset } from "nitropack/kit";
|
|
2
|
-
const awsLambda = defineNitroPreset(
|
|
3
|
-
{
|
|
4
|
-
entry: "./runtime/aws-lambda"
|
|
5
|
-
},
|
|
6
|
-
{
|
|
7
|
-
name: "aws-lambda",
|
|
8
|
-
url: import.meta.url
|
|
9
|
-
}
|
|
10
|
-
);
|
|
11
|
-
const awsLambdaStreaming = defineNitroPreset(
|
|
12
|
-
{
|
|
13
|
-
extends: "aws-lambda",
|
|
14
|
-
entry: "./runtime/aws-lambda-streaming"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: "aws-lambda-streaming",
|
|
18
|
-
url: import.meta.url
|
|
19
|
-
}
|
|
20
|
-
);
|
|
21
|
-
export default [awsLambda, awsLambdaStreaming];
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { APIGatewayProxyEventV2, Context, APIGatewayProxyStructuredResultV2 } from "aws-lambda";
|
|
3
|
-
import "#nitro-internal-pollyfills";
|
|
4
|
-
declare global {
|
|
5
|
-
namespace awslambda {
|
|
6
|
-
function streamifyResponse(handler: (event: APIGatewayProxyEventV2, responseStream: NodeJS.WritableStream, context: Context) => Promise<void>): any;
|
|
7
|
-
namespace HttpResponseStream {
|
|
8
|
-
function from(stream: NodeJS.WritableStream, metadata: {
|
|
9
|
-
statusCode: APIGatewayProxyStructuredResultV2["statusCode"];
|
|
10
|
-
headers: APIGatewayProxyStructuredResultV2["headers"];
|
|
11
|
-
}): NodeJS.WritableStream;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export declare const handler: any;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import "#nitro-internal-pollyfills";
|
|
2
|
-
import { withQuery } from "ufo";
|
|
3
|
-
import { useNitroApp } from "nitropack/runtime";
|
|
4
|
-
import {
|
|
5
|
-
normalizeLambdaIncomingHeaders,
|
|
6
|
-
normalizeLambdaOutgoingHeaders
|
|
7
|
-
} from "nitropack/runtime/internal";
|
|
8
|
-
const nitroApp = useNitroApp();
|
|
9
|
-
export const handler = awslambda.streamifyResponse(
|
|
10
|
-
async (event, responseStream, context) => {
|
|
11
|
-
const query = {
|
|
12
|
-
...event.queryStringParameters
|
|
13
|
-
};
|
|
14
|
-
const url = withQuery(event.rawPath, query);
|
|
15
|
-
const method = event.requestContext?.http?.method || "get";
|
|
16
|
-
if ("cookies" in event && event.cookies) {
|
|
17
|
-
event.headers.cookie = event.cookies.join(";");
|
|
18
|
-
}
|
|
19
|
-
const r = await nitroApp.localCall({
|
|
20
|
-
event,
|
|
21
|
-
url,
|
|
22
|
-
context,
|
|
23
|
-
headers: normalizeLambdaIncomingHeaders(event.headers),
|
|
24
|
-
method,
|
|
25
|
-
query,
|
|
26
|
-
body: event.isBase64Encoded ? Buffer.from(event.body || "", "base64").toString("utf8") : event.body
|
|
27
|
-
});
|
|
28
|
-
const httpResponseMetadata = {
|
|
29
|
-
statusCode: r.status,
|
|
30
|
-
headers: {
|
|
31
|
-
...normalizeLambdaOutgoingHeaders(r.headers, true),
|
|
32
|
-
"Transfer-Encoding": "chunked"
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
if (r.body) {
|
|
36
|
-
const reader = r.body;
|
|
37
|
-
const writer = awslambda.HttpResponseStream.from(
|
|
38
|
-
responseStream,
|
|
39
|
-
httpResponseMetadata
|
|
40
|
-
);
|
|
41
|
-
await streamToNodeStream(reader.getReader(), responseStream);
|
|
42
|
-
writer.end();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
const streamToNodeStream = async (reader, writer) => {
|
|
47
|
-
let readResult = await reader.read();
|
|
48
|
-
while (!readResult.done) {
|
|
49
|
-
writer.write(readResult.value);
|
|
50
|
-
readResult = await reader.read();
|
|
51
|
-
}
|
|
52
|
-
writer.end();
|
|
53
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, APIGatewayProxyResultV2, Context } from "aws-lambda";
|
|
2
|
-
import "#nitro-internal-pollyfills";
|
|
3
|
-
export declare function handler(event: APIGatewayProxyEvent, context: Context): Promise<APIGatewayProxyResult>;
|
|
4
|
-
export declare function handler(event: APIGatewayProxyEventV2, context: Context): Promise<APIGatewayProxyResultV2>;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import "#nitro-internal-pollyfills";
|
|
2
|
-
import { withQuery } from "ufo";
|
|
3
|
-
import { useNitroApp } from "nitropack/runtime";
|
|
4
|
-
import {
|
|
5
|
-
normalizeLambdaIncomingHeaders,
|
|
6
|
-
normalizeLambdaOutgoingBody,
|
|
7
|
-
normalizeLambdaOutgoingHeaders,
|
|
8
|
-
normalizeCookieHeader
|
|
9
|
-
} from "nitropack/runtime/internal";
|
|
10
|
-
const nitroApp = useNitroApp();
|
|
11
|
-
export async function handler(event, context) {
|
|
12
|
-
const query = {
|
|
13
|
-
...event.queryStringParameters,
|
|
14
|
-
...event.multiValueQueryStringParameters
|
|
15
|
-
};
|
|
16
|
-
const url = withQuery(
|
|
17
|
-
event.path || event.rawPath,
|
|
18
|
-
query
|
|
19
|
-
);
|
|
20
|
-
const method = event.httpMethod || event.requestContext?.http?.method || "get";
|
|
21
|
-
if ("cookies" in event && event.cookies) {
|
|
22
|
-
event.headers.cookie = event.cookies.join(";");
|
|
23
|
-
}
|
|
24
|
-
const r = await nitroApp.localCall({
|
|
25
|
-
event,
|
|
26
|
-
url,
|
|
27
|
-
context,
|
|
28
|
-
headers: normalizeLambdaIncomingHeaders(event.headers),
|
|
29
|
-
method,
|
|
30
|
-
query,
|
|
31
|
-
body: event.isBase64Encoded ? Buffer.from(event.body || "", "base64").toString("utf8") : event.body
|
|
32
|
-
});
|
|
33
|
-
const isApiGwV2 = "cookies" in event || "rawPath" in event;
|
|
34
|
-
const awsBody = await normalizeLambdaOutgoingBody(r.body, r.headers);
|
|
35
|
-
const cookies = normalizeCookieHeader(r.headers["set-cookie"]);
|
|
36
|
-
return {
|
|
37
|
-
...cookies.length > 0 && {
|
|
38
|
-
...isApiGwV2 ? { cookies } : { multiValueHeaders: { "set-cookie": cookies } }
|
|
39
|
-
},
|
|
40
|
-
statusCode: r.status,
|
|
41
|
-
headers: normalizeLambdaOutgoingHeaders(r.headers, true),
|
|
42
|
-
body: awsBody.body,
|
|
43
|
-
isBase64Encoded: awsBody.type === "binary"
|
|
44
|
-
};
|
|
45
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { defineNitroPreset } from "nitropack/kit";
|
|
2
|
-
import { writeFunctionsRoutes, writeSWARoutes } from "./utils.mjs";
|
|
3
|
-
const azure = defineNitroPreset(
|
|
4
|
-
{
|
|
5
|
-
entry: "./runtime/azure-swa",
|
|
6
|
-
output: {
|
|
7
|
-
serverDir: "{{ output.dir }}/server/functions",
|
|
8
|
-
publicDir: "{{ output.dir }}/public/{{ baseURL }}"
|
|
9
|
-
},
|
|
10
|
-
commands: {
|
|
11
|
-
preview: "npx @azure/static-web-apps-cli start ./public --api-location ./server"
|
|
12
|
-
},
|
|
13
|
-
hooks: {
|
|
14
|
-
async compiled(ctx) {
|
|
15
|
-
await writeSWARoutes(ctx);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: "azure-swa",
|
|
21
|
-
aliases: ["azure"],
|
|
22
|
-
stdName: "azure_static",
|
|
23
|
-
url: import.meta.url
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
const azureFunctions = defineNitroPreset(
|
|
27
|
-
{
|
|
28
|
-
serveStatic: true,
|
|
29
|
-
entry: "./runtime/azure-functions",
|
|
30
|
-
commands: {
|
|
31
|
-
deploy: "az functionapp deployment source config-zip -g <resource-group> -n <app-name> --src {{ output.dir }}/deploy.zip"
|
|
32
|
-
},
|
|
33
|
-
hooks: {
|
|
34
|
-
async compiled(ctx) {
|
|
35
|
-
await writeFunctionsRoutes(ctx);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "azure-functions",
|
|
41
|
-
url: import.meta.url
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
export default [azure, azureFunctions];
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import "#nitro-internal-pollyfills";
|
|
2
|
-
import { useNitroApp } from "nitropack/runtime";
|
|
3
|
-
import {
|
|
4
|
-
getAzureParsedCookiesFromHeaders,
|
|
5
|
-
normalizeLambdaOutgoingHeaders
|
|
6
|
-
} from "nitropack/runtime/internal";
|
|
7
|
-
const nitroApp = useNitroApp();
|
|
8
|
-
export async function handle(context, req) {
|
|
9
|
-
const url = "/" + (req.params.url || "");
|
|
10
|
-
const { body, status, statusText, headers } = await nitroApp.localCall({
|
|
11
|
-
url,
|
|
12
|
-
headers: req.headers,
|
|
13
|
-
method: req.method || void 0,
|
|
14
|
-
// https://github.com/Azure/azure-functions-host/issues/293
|
|
15
|
-
body: req.rawBody
|
|
16
|
-
});
|
|
17
|
-
context.res = {
|
|
18
|
-
status,
|
|
19
|
-
// cookies https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=typescript%2Cwindows%2Cazure-cli&pivots=nodejs-model-v4#http-response
|
|
20
|
-
cookies: getAzureParsedCookiesFromHeaders(headers),
|
|
21
|
-
headers: normalizeLambdaOutgoingHeaders(headers, true),
|
|
22
|
-
body: body ? body.toString() : statusText
|
|
23
|
-
};
|
|
24
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import "#nitro-internal-pollyfills";
|
|
2
|
-
import { useNitroApp } from "nitropack/runtime";
|
|
3
|
-
import {
|
|
4
|
-
getAzureParsedCookiesFromHeaders,
|
|
5
|
-
normalizeLambdaOutgoingHeaders
|
|
6
|
-
} from "nitropack/runtime/internal";
|
|
7
|
-
import { parseURL } from "ufo";
|
|
8
|
-
const nitroApp = useNitroApp();
|
|
9
|
-
export async function handle(context, req) {
|
|
10
|
-
let url;
|
|
11
|
-
if (req.headers["x-ms-original-url"]) {
|
|
12
|
-
const parsedURL = parseURL(req.headers["x-ms-original-url"]);
|
|
13
|
-
url = parsedURL.pathname + parsedURL.search;
|
|
14
|
-
} else {
|
|
15
|
-
url = "/api/" + (req.params.url || "");
|
|
16
|
-
}
|
|
17
|
-
const { body, status, headers } = await nitroApp.localCall({
|
|
18
|
-
url,
|
|
19
|
-
headers: req.headers,
|
|
20
|
-
method: req.method || void 0,
|
|
21
|
-
// https://github.com/Azure/azure-functions-host/issues/293
|
|
22
|
-
body: req.rawBody
|
|
23
|
-
});
|
|
24
|
-
context.res = {
|
|
25
|
-
status,
|
|
26
|
-
cookies: getAzureParsedCookiesFromHeaders(headers),
|
|
27
|
-
headers: normalizeLambdaOutgoingHeaders(headers, true),
|
|
28
|
-
body
|
|
29
|
-
};
|
|
30
|
-
}
|
|
File without changes
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { createWriteStream } from "node:fs";
|
|
2
|
-
import archiver from "archiver";
|
|
3
|
-
import { join, resolve } from "pathe";
|
|
4
|
-
import { writeFile } from "nitropack/kit";
|
|
5
|
-
import fsp from "node:fs/promises";
|
|
6
|
-
export async function writeFunctionsRoutes(nitro) {
|
|
7
|
-
const host = {
|
|
8
|
-
version: "2.0",
|
|
9
|
-
extensions: { http: { routePrefix: "" } }
|
|
10
|
-
};
|
|
11
|
-
const functionDefinition = {
|
|
12
|
-
entryPoint: "handle",
|
|
13
|
-
bindings: [
|
|
14
|
-
{
|
|
15
|
-
authLevel: "anonymous",
|
|
16
|
-
type: "httpTrigger",
|
|
17
|
-
direction: "in",
|
|
18
|
-
name: "req",
|
|
19
|
-
route: "{*url}",
|
|
20
|
-
methods: ["delete", "get", "head", "options", "patch", "post", "put"]
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
type: "http",
|
|
24
|
-
direction: "out",
|
|
25
|
-
name: "res"
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
};
|
|
29
|
-
await writeFile(
|
|
30
|
-
resolve(nitro.options.output.serverDir, "function.json"),
|
|
31
|
-
JSON.stringify(functionDefinition)
|
|
32
|
-
);
|
|
33
|
-
await writeFile(
|
|
34
|
-
resolve(nitro.options.output.dir, "host.json"),
|
|
35
|
-
JSON.stringify(host)
|
|
36
|
-
);
|
|
37
|
-
await _zipDirectory(
|
|
38
|
-
nitro.options.output.dir,
|
|
39
|
-
join(nitro.options.output.dir, "deploy.zip")
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
export async function writeSWARoutes(nitro) {
|
|
43
|
-
const host = {
|
|
44
|
-
version: "2.0"
|
|
45
|
-
};
|
|
46
|
-
const supportedNodeVersions = /* @__PURE__ */ new Set(["16", "18", "20"]);
|
|
47
|
-
let nodeVersion = "18";
|
|
48
|
-
try {
|
|
49
|
-
const currentNodeVersion = JSON.parse(
|
|
50
|
-
await fsp.readFile(join(nitro.options.rootDir, "package.json"), "utf8")
|
|
51
|
-
).engines.node;
|
|
52
|
-
if (supportedNodeVersions.has(currentNodeVersion)) {
|
|
53
|
-
nodeVersion = currentNodeVersion;
|
|
54
|
-
}
|
|
55
|
-
} catch {
|
|
56
|
-
const currentNodeVersion = process.versions.node.slice(0, 2);
|
|
57
|
-
if (supportedNodeVersions.has(currentNodeVersion)) {
|
|
58
|
-
nodeVersion = currentNodeVersion;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const config = {
|
|
62
|
-
...nitro.options.azure?.config,
|
|
63
|
-
// Overwrite routes for now, we will add existing routes after generating routes
|
|
64
|
-
routes: [],
|
|
65
|
-
platform: {
|
|
66
|
-
apiRuntime: `node:${nodeVersion}`,
|
|
67
|
-
...nitro.options.azure?.config?.platform
|
|
68
|
-
},
|
|
69
|
-
navigationFallback: {
|
|
70
|
-
rewrite: "/api/server",
|
|
71
|
-
...nitro.options.azure?.config?.navigationFallback
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
const routeFiles = nitro._prerenderedRoutes || [];
|
|
75
|
-
const indexFileExists = routeFiles.some(
|
|
76
|
-
(route) => route.fileName === "/index.html"
|
|
77
|
-
);
|
|
78
|
-
if (!indexFileExists) {
|
|
79
|
-
config.routes.unshift(
|
|
80
|
-
{
|
|
81
|
-
route: "/index.html",
|
|
82
|
-
redirect: "/"
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
route: "/",
|
|
86
|
-
rewrite: "/api/server"
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
const suffix = "/index.html".length;
|
|
91
|
-
for (const { fileName } of routeFiles) {
|
|
92
|
-
if (!fileName || !fileName.endsWith("/index.html")) {
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
config.routes.unshift({
|
|
96
|
-
route: fileName.slice(0, -suffix) || "/",
|
|
97
|
-
rewrite: fileName
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
for (const { fileName } of routeFiles) {
|
|
101
|
-
if (!fileName || !fileName.endsWith(".html") || fileName.endsWith("index.html")) {
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
const route = fileName.slice(0, -".html".length);
|
|
105
|
-
const existingRouteIndex = config.routes.findIndex(
|
|
106
|
-
(_route) => _route.route === route
|
|
107
|
-
);
|
|
108
|
-
if (existingRouteIndex > -1) {
|
|
109
|
-
config.routes.splice(existingRouteIndex, 1);
|
|
110
|
-
}
|
|
111
|
-
config.routes.unshift({
|
|
112
|
-
route,
|
|
113
|
-
rewrite: fileName
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
if (nitro.options.azure?.config && "routes" in nitro.options.azure.config && Array.isArray(nitro.options.azure.config.routes)) {
|
|
117
|
-
for (const customRoute of nitro.options.azure.config.routes.reverse()) {
|
|
118
|
-
const existingRouteMatchIndex = config.routes.findIndex(
|
|
119
|
-
(value) => value.route === customRoute.route
|
|
120
|
-
);
|
|
121
|
-
if (existingRouteMatchIndex === -1) {
|
|
122
|
-
config.routes.unshift(customRoute);
|
|
123
|
-
} else {
|
|
124
|
-
config.routes[existingRouteMatchIndex] = customRoute;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
const functionDefinition = {
|
|
129
|
-
entryPoint: "handle",
|
|
130
|
-
bindings: [
|
|
131
|
-
{
|
|
132
|
-
authLevel: "anonymous",
|
|
133
|
-
type: "httpTrigger",
|
|
134
|
-
direction: "in",
|
|
135
|
-
name: "req",
|
|
136
|
-
route: "{*url}",
|
|
137
|
-
methods: ["delete", "get", "head", "options", "patch", "post", "put"]
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
type: "http",
|
|
141
|
-
direction: "out",
|
|
142
|
-
name: "res"
|
|
143
|
-
}
|
|
144
|
-
]
|
|
145
|
-
};
|
|
146
|
-
await writeFile(
|
|
147
|
-
resolve(nitro.options.output.serverDir, "function.json"),
|
|
148
|
-
JSON.stringify(functionDefinition, null, 2)
|
|
149
|
-
);
|
|
150
|
-
await writeFile(
|
|
151
|
-
resolve(nitro.options.output.serverDir, "../host.json"),
|
|
152
|
-
JSON.stringify(host, null, 2)
|
|
153
|
-
);
|
|
154
|
-
const stubPackageJson = resolve(
|
|
155
|
-
nitro.options.output.serverDir,
|
|
156
|
-
"../package.json"
|
|
157
|
-
);
|
|
158
|
-
await writeFile(stubPackageJson, JSON.stringify({ private: true }));
|
|
159
|
-
await writeFile(
|
|
160
|
-
resolve(nitro.options.rootDir, "staticwebapp.config.json"),
|
|
161
|
-
JSON.stringify(config, null, 2)
|
|
162
|
-
);
|
|
163
|
-
if (!indexFileExists) {
|
|
164
|
-
const baseURLSegments = nitro.options.baseURL.split("/").filter(Boolean);
|
|
165
|
-
const relativePrefix = baseURLSegments.map(() => "..").join("/");
|
|
166
|
-
await writeFile(
|
|
167
|
-
resolve(
|
|
168
|
-
nitro.options.output.publicDir,
|
|
169
|
-
relativePrefix ? `${relativePrefix}/index.html` : "index.html"
|
|
170
|
-
),
|
|
171
|
-
""
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
function _zipDirectory(dir, outfile) {
|
|
176
|
-
const archive = archiver("zip", { zlib: { level: 9 } });
|
|
177
|
-
const stream = createWriteStream(outfile);
|
|
178
|
-
return new Promise((resolve2, reject) => {
|
|
179
|
-
archive.directory(dir, false).on("error", (err) => reject(err)).pipe(stream);
|
|
180
|
-
stream.on("close", () => resolve2(void 0));
|
|
181
|
-
archive.finalize();
|
|
182
|
-
});
|
|
183
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { defineNitroPreset } from "nitropack/kit";
|
|
2
|
-
const bun = defineNitroPreset(
|
|
3
|
-
{
|
|
4
|
-
extends: "node-server",
|
|
5
|
-
entry: "./runtime/bun",
|
|
6
|
-
// https://bun.sh/docs/runtime/modules#resolution
|
|
7
|
-
exportConditions: ["bun", "worker", "node", "import", "default"],
|
|
8
|
-
commands: {
|
|
9
|
-
preview: "bun run ./server/index.mjs"
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
name: "bun",
|
|
14
|
-
url: import.meta.url
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
export default [bun];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "#nitro-internal-pollyfills";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import "#nitro-internal-pollyfills";
|
|
2
|
-
import { useNitroApp } from "nitropack/runtime";
|
|
3
|
-
import { startScheduleRunner } from "nitropack/runtime/internal";
|
|
4
|
-
import wsAdapter from "crossws/adapters/bun";
|
|
5
|
-
const nitroApp = useNitroApp();
|
|
6
|
-
const ws = import.meta._websocket ? wsAdapter(nitroApp.h3App.websocket) : void 0;
|
|
7
|
-
const server = Bun.serve({
|
|
8
|
-
port: process.env.NITRO_PORT || process.env.PORT || 3e3,
|
|
9
|
-
websocket: import.meta._websocket ? ws.websocket : void 0,
|
|
10
|
-
async fetch(req, server2) {
|
|
11
|
-
if (import.meta._websocket && await ws.handleUpgrade(req, server2)) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const url = new URL(req.url);
|
|
15
|
-
let body;
|
|
16
|
-
if (req.body) {
|
|
17
|
-
body = await req.arrayBuffer();
|
|
18
|
-
}
|
|
19
|
-
return nitroApp.localFetch(url.pathname + url.search, {
|
|
20
|
-
host: url.hostname,
|
|
21
|
-
protocol: url.protocol,
|
|
22
|
-
headers: req.headers,
|
|
23
|
-
method: req.method,
|
|
24
|
-
redirect: req.redirect,
|
|
25
|
-
body
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
console.log(`Listening on http://localhost:${server.port}...`);
|
|
30
|
-
if (import.meta._tasks) {
|
|
31
|
-
startScheduleRunner();
|
|
32
|
-
}
|