nitro-nightly 4.0.0-20251030-091344-d4418b98 → 4.0.0-20251030-122334-09c1a7a8
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/_build/common.mjs +763 -0
- package/dist/_build/rolldown.mjs +216 -0
- package/dist/_build/rollup.mjs +359 -0
- package/dist/_build/vite.build.mjs +67 -0
- package/dist/_build/vite.plugin.mjs +762 -0
- package/dist/_chunks/B-7HiF0V.mjs +1303 -0
- package/dist/_chunks/B3asVbT4.mjs +151 -0
- package/dist/_chunks/B5ooyfLk.mjs +372 -0
- package/dist/_chunks/DXMHy5ca.mjs +43 -0
- package/dist/_dev.d.mts +12 -0
- package/dist/_dev.mjs +675 -0
- package/dist/_libs/acorn.mjs +5034 -0
- package/dist/_libs/c12.mjs +2798 -0
- package/dist/_libs/chokidar.mjs +1560 -0
- package/dist/_libs/citty.mjs +333 -0
- package/dist/_libs/commondir.mjs +22 -0
- package/dist/_libs/compatx.mjs +46 -0
- package/dist/_libs/confbox.mjs +2920 -0
- package/dist/_libs/debug.mjs +848 -0
- package/dist/_libs/deepmerge.mjs +86 -0
- package/dist/_libs/depd.mjs +314 -0
- package/dist/_libs/dot-prop.mjs +138 -0
- package/dist/_libs/duplexer.mjs +71 -0
- package/dist/_libs/ee-first.mjs +68 -0
- package/dist/_libs/encodeurl.mjs +49 -0
- package/dist/_libs/escape-html.mjs +58 -0
- package/dist/_libs/escape-string-regexp.mjs +8 -0
- package/dist/_libs/estree-walker.mjs +330 -0
- package/dist/_libs/etag.mjs +75 -0
- package/dist/{_chunks/_deps → _libs}/fdir.mjs +49 -104
- package/dist/_libs/fresh.mjs +85 -0
- package/dist/_libs/function-bind.mjs +63 -0
- package/dist/_libs/gen-mapping.mjs +612 -0
- package/dist/_libs/giget.mjs +19076 -0
- package/dist/_libs/gzip-size.mjs +21 -0
- package/dist/_libs/hasown.mjs +14 -0
- package/dist/_libs/http-errors.mjs +436 -0
- package/dist/_libs/httpxy.mjs +410 -0
- package/dist/_libs/is-core-module.mjs +220 -0
- package/dist/_libs/is-module.mjs +13 -0
- package/dist/_libs/is-reference.mjs +32 -0
- package/dist/{_chunks/_deps → _libs}/js-tokens.mjs +83 -112
- package/dist/_libs/klona.mjs +90 -0
- package/dist/_libs/knitwork.mjs +124 -0
- package/dist/_libs/local-pkg.mjs +1686 -0
- package/dist/{_chunks/_deps → _libs}/magic-string.mjs +272 -629
- package/dist/_libs/mime-db.mjs +7642 -0
- package/dist/_libs/mime-types.mjs +162 -0
- package/dist/_libs/mime.mjs +1391 -0
- package/dist/_libs/node-fetch-native.mjs +173 -0
- package/dist/_libs/on-finished.mjs +170 -0
- package/dist/_libs/parseurl.mjs +103 -0
- package/dist/_libs/path-parse.mjs +47 -0
- package/dist/_libs/pathe.mjs +41 -0
- package/dist/_libs/picomatch.mjs +1673 -0
- package/dist/_libs/plugin-alias.mjs +64 -0
- package/dist/_libs/plugin-commonjs.mjs +1489 -0
- package/dist/_libs/plugin-inject.mjs +135 -0
- package/dist/_libs/plugin-json.mjs +36 -0
- package/dist/_libs/plugin-node-resolve.mjs +1553 -0
- package/dist/_libs/plugin-replace.mjs +104 -0
- package/dist/_libs/pretty-bytes.mjs +116 -0
- package/dist/_libs/range-parser.mjs +102 -0
- package/dist/_libs/remapping.mjs +117 -0
- package/dist/{_chunks/_deps → _libs}/rou3.mjs +7 -22
- package/dist/_libs/send.mjs +857 -0
- package/dist/_libs/serve-static.mjs +124 -0
- package/dist/_libs/std-env.mjs +158 -0
- package/dist/_libs/strip-literal.mjs +51 -0
- package/dist/{_chunks/_deps → _libs}/tinyglobby.mjs +32 -33
- package/dist/_libs/ultrahtml.mjs +138 -0
- package/dist/_libs/unimport.mjs +3520 -0
- package/dist/_libs/untyped.mjs +271 -0
- package/dist/_libs/unwasm.mjs +5825 -0
- package/dist/{_chunks/_deps/@pi0 → _libs}/vite-plugin-fullstack.mjs +28 -42
- package/dist/_presets.mjs +1723 -0
- package/dist/builder.d.mts +37 -35
- package/dist/builder.mjs +45 -117
- package/dist/cli/_chunks/build.mjs +43 -0
- package/dist/cli/_chunks/common.mjs +15 -0
- package/dist/cli/_chunks/detect-acorn.mjs +12 -0
- package/dist/cli/_chunks/dev.mjs +79 -0
- package/dist/cli/_chunks/dist.mjs +3 -0
- package/dist/cli/_chunks/dist2.mjs +4 -0
- package/dist/cli/_chunks/esm.mjs +3 -0
- package/dist/cli/_chunks/json5.mjs +4 -0
- package/dist/cli/_chunks/jsonc.mjs +4 -0
- package/dist/cli/_chunks/list.mjs +27 -0
- package/dist/cli/_chunks/multipart-parser.mjs +6 -0
- package/dist/cli/_chunks/prepare.mjs +19 -0
- package/dist/cli/_chunks/run.mjs +55 -0
- package/dist/cli/_chunks/task.mjs +16 -0
- package/dist/cli/_chunks/toml.mjs +4 -0
- package/dist/cli/_chunks/yaml.mjs +4 -0
- package/dist/cli/index.d.mts +1 -1
- package/dist/cli/index.mjs +19 -18
- package/dist/presets/_nitro/runtime/nitro-dev.d.mts +1 -0
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +42 -33
- package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +2 -2
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +4 -8
- package/dist/presets/_nitro/runtime/service-worker.d.mts +1 -0
- package/dist/presets/_nitro/runtime/service-worker.mjs +14 -11
- package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +1 -0
- package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +6 -5
- package/dist/presets/aws-lambda/runtime/_utils.d.mts +8 -13
- package/dist/presets/aws-lambda/runtime/_utils.mjs +95 -81
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +1 -2
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +25 -27
- package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +7 -7
- package/dist/presets/azure/runtime/_utils.mjs +43 -43
- package/dist/presets/azure/runtime/azure-swa.d.mts +2 -2
- package/dist/presets/azure/runtime/azure-swa.mjs +22 -21
- package/dist/presets/bun/runtime/bun.d.mts +1 -0
- package/dist/presets/bun/runtime/bun.mjs +18 -17
- package/dist/presets/cloudflare/runtime/_module-handler.d.mts +10 -7
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +78 -87
- package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +6 -14
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +53 -58
- package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +1 -7
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +12 -14
- package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +12 -12
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +35 -39
- package/dist/presets/cloudflare/runtime/plugin.dev.d.mts +2 -2
- package/dist/presets/cloudflare/runtime/plugin.dev.mjs +86 -76
- package/dist/presets/deno/runtime/deno-deploy.d.mts +1 -0
- package/dist/presets/deno/runtime/deno-deploy.mjs +12 -11
- package/dist/presets/deno/runtime/deno-server.d.mts +2 -1
- package/dist/presets/deno/runtime/deno-server.mjs +31 -39
- package/dist/presets/netlify/runtime/netlify-edge.d.mts +2 -1
- package/dist/presets/netlify/runtime/netlify-edge.mjs +14 -11
- package/dist/presets/netlify/runtime/netlify.mjs +11 -17
- package/dist/presets/node/runtime/node-cluster.mjs +49 -48
- package/dist/presets/node/runtime/node-middleware.d.mts +3 -2
- package/dist/presets/node/runtime/node-middleware.mjs +7 -6
- package/dist/presets/node/runtime/node-server.mjs +33 -23
- package/dist/presets/standard/runtime/server.d.mts +1 -3
- package/dist/presets/standard/runtime/server.mjs +1 -3
- package/dist/presets/stormkit/runtime/stormkit.d.mts +13 -13
- package/dist/presets/stormkit/runtime/stormkit.mjs +20 -20
- package/dist/presets/vercel/runtime/vercel.d.mts +3 -3
- package/dist/presets/vercel/runtime/vercel.mjs +15 -14
- package/dist/presets/winterjs/runtime/winterjs.d.mts +2 -0
- package/dist/presets/winterjs/runtime/winterjs.mjs +72 -68
- package/dist/presets/zeabur/runtime/zeabur.d.mts +1 -1
- package/dist/runtime/index.d.mts +12 -1
- package/dist/runtime/index.mjs +12 -7
- package/dist/runtime/internal/app.mjs +175 -162
- package/dist/runtime/internal/cache.d.mts +10 -4
- package/dist/runtime/internal/cache.mjs +247 -216
- package/dist/runtime/internal/context.d.mts +9 -9
- package/dist/runtime/internal/context.mjs +17 -10
- package/dist/runtime/internal/database.mjs +8 -10
- package/dist/runtime/internal/error/dev.d.mts +5 -4
- package/dist/runtime/internal/error/dev.mjs +106 -105
- package/dist/runtime/internal/error/prod.d.mts +2 -2
- package/dist/runtime/internal/error/prod.mjs +48 -52
- package/dist/runtime/internal/error/utils.d.mts +4 -4
- package/dist/runtime/internal/error/utils.mjs +1 -1
- package/dist/runtime/internal/index.d.mts +2 -0
- package/dist/runtime/internal/index.mjs +2 -0
- package/dist/runtime/internal/lib/http-graceful-shutdown.d.mts +14 -14
- package/dist/runtime/internal/lib/http-graceful-shutdown.mjs +248 -209
- package/dist/runtime/internal/meta.d.mts +1 -1
- package/dist/runtime/internal/meta.mjs +1 -1
- package/dist/runtime/internal/plugin.d.mts +2 -2
- package/dist/runtime/internal/plugin.mjs +1 -1
- package/dist/runtime/internal/renderer.mjs +39 -31
- package/dist/runtime/internal/route-rules.d.mts +8 -8
- package/dist/runtime/internal/route-rules.mjs +53 -51
- package/dist/runtime/internal/routes/dev-tasks.d.mts +1 -30
- package/dist/runtime/internal/routes/dev-tasks.mjs +15 -17
- package/dist/runtime/internal/routes/openapi.d.mts +1 -0
- package/dist/runtime/internal/routes/openapi.mjs +81 -87
- package/dist/runtime/internal/routes/renderer-template.d.mts +1 -1
- package/dist/runtime/internal/routes/renderer-template.dev.d.mts +1 -2
- package/dist/runtime/internal/routes/renderer-template.dev.mjs +10 -17
- package/dist/runtime/internal/routes/renderer-template.mjs +1 -1
- package/dist/runtime/internal/routes/scalar.d.mts +1 -0
- package/dist/runtime/internal/routes/scalar.mjs +22 -23
- package/dist/runtime/internal/routes/swagger.d.mts +1 -0
- package/dist/runtime/internal/routes/swagger.mjs +9 -11
- package/dist/runtime/internal/runtime-config.d.mts +4 -4
- package/dist/runtime/internal/runtime-config.mjs +40 -35
- package/dist/runtime/internal/shutdown.d.mts +2 -7
- package/dist/runtime/internal/shutdown.mjs +30 -29
- package/dist/runtime/internal/static.mjs +63 -74
- package/dist/runtime/internal/storage.mjs +2 -2
- package/dist/runtime/internal/task.d.mts +6 -6
- package/dist/runtime/internal/task.mjs +56 -59
- package/dist/runtime/internal/utils.d.mts +1 -1
- package/dist/runtime/internal/utils.mjs +4 -10
- package/dist/types/index.d.mts +2566 -3851
- package/dist/types/index.mjs +1 -1
- package/dist/vite.d.mts +61 -51
- package/dist/vite.mjs +55 -132
- package/package.json +10 -10
- package/dist/_build/build.mjs +0 -368
- package/dist/_build/build2.mjs +0 -556
- package/dist/_build/info.mjs +0 -1002
- package/dist/_build/prepare.mjs +0 -1511
- package/dist/_build/snapshot.mjs +0 -185
- package/dist/_build/vite.mjs +0 -959
- package/dist/_build/vite2.mjs +0 -149
- package/dist/_chunks/_deps/@jridgewell/gen-mapping.mjs +0 -189
- package/dist/_chunks/_deps/@jridgewell/remapping.mjs +0 -137
- package/dist/_chunks/_deps/@jridgewell/resolve-uri.mjs +0 -231
- package/dist/_chunks/_deps/@jridgewell/sourcemap-codec.mjs +0 -173
- package/dist/_chunks/_deps/@jridgewell/trace-mapping.mjs +0 -170
- package/dist/_chunks/_deps/@rollup/plugin-alias.mjs +0 -89
- package/dist/_chunks/_deps/@rollup/plugin-commonjs.mjs +0 -2376
- package/dist/_chunks/_deps/@rollup/plugin-inject.mjs +0 -212
- package/dist/_chunks/_deps/@rollup/plugin-json.mjs +0 -37
- package/dist/_chunks/_deps/@rollup/plugin-node-resolve.mjs +0 -1386
- package/dist/_chunks/_deps/@rollup/plugin-replace.mjs +0 -133
- package/dist/_chunks/_deps/@rollup/pluginutils.mjs +0 -346
- package/dist/_chunks/_deps/acorn.mjs +0 -6225
- package/dist/_chunks/_deps/c12.mjs +0 -510
- package/dist/_chunks/_deps/chokidar.mjs +0 -1428
- package/dist/_chunks/_deps/citty.mjs +0 -460
- package/dist/_chunks/_deps/commondir.mjs +0 -77
- package/dist/_chunks/_deps/compatx.mjs +0 -76
- package/dist/_chunks/_deps/confbox.mjs +0 -300
- package/dist/_chunks/_deps/debug.mjs +0 -885
- package/dist/_chunks/_deps/deepmerge.mjs +0 -147
- package/dist/_chunks/_deps/depd.mjs +0 -550
- package/dist/_chunks/_deps/dot-prop.mjs +0 -282
- package/dist/_chunks/_deps/dotenv.mjs +0 -555
- package/dist/_chunks/_deps/duplexer.mjs +0 -1
- package/dist/_chunks/_deps/ee-first.mjs +0 -104
- package/dist/_chunks/_deps/encodeurl.mjs +0 -69
- package/dist/_chunks/_deps/escape-html.mjs +0 -87
- package/dist/_chunks/_deps/escape-string-regexp.mjs +0 -13
- package/dist/_chunks/_deps/estree-walker.mjs +0 -433
- package/dist/_chunks/_deps/etag.mjs +0 -147
- package/dist/_chunks/_deps/exsolve.mjs +0 -1416
- package/dist/_chunks/_deps/fresh.mjs +0 -145
- package/dist/_chunks/_deps/function-bind.mjs +0 -106
- package/dist/_chunks/_deps/giget.mjs +0 -451
- package/dist/_chunks/_deps/gzip-size.mjs +0 -19
- package/dist/_chunks/_deps/hasown.mjs +0 -19
- package/dist/_chunks/_deps/http-errors.mjs +0 -307
- package/dist/_chunks/_deps/httpxy.mjs +0 -580
- package/dist/_chunks/_deps/inherits.mjs +0 -57
- package/dist/_chunks/_deps/is-core-module.mjs +0 -596
- package/dist/_chunks/_deps/is-module.mjs +0 -25
- package/dist/_chunks/_deps/is-reference.mjs +0 -31
- package/dist/_chunks/_deps/klona.mjs +0 -137
- package/dist/_chunks/_deps/knitwork.mjs +0 -172
- package/dist/_chunks/_deps/local-pkg.mjs +0 -163
- package/dist/_chunks/_deps/mime-db.mjs +0 -11685
- package/dist/_chunks/_deps/mime-types.mjs +0 -287
- package/dist/_chunks/_deps/mime.mjs +0 -1172
- package/dist/_chunks/_deps/mlly.mjs +0 -2413
- package/dist/_chunks/_deps/ms.mjs +0 -172
- package/dist/_chunks/_deps/node-fetch-native.mjs +0 -3
- package/dist/_chunks/_deps/nypm.mjs +0 -219
- package/dist/_chunks/_deps/on-finished.mjs +0 -246
- package/dist/_chunks/_deps/parseurl.mjs +0 -168
- package/dist/_chunks/_deps/path-parse.mjs +0 -85
- package/dist/_chunks/_deps/pathe.mjs +0 -251
- package/dist/_chunks/_deps/perfect-debounce.mjs +0 -88
- package/dist/_chunks/_deps/picomatch.mjs +0 -2144
- package/dist/_chunks/_deps/pkg-types.mjs +0 -247
- package/dist/_chunks/_deps/pretty-bytes.mjs +0 -180
- package/dist/_chunks/_deps/quansync.mjs +0 -99
- package/dist/_chunks/_deps/range-parser.mjs +0 -171
- package/dist/_chunks/_deps/rc9.mjs +0 -219
- package/dist/_chunks/_deps/readdirp.mjs +0 -245
- package/dist/_chunks/_deps/resolve.mjs +0 -1260
- package/dist/_chunks/_deps/send.mjs +0 -1022
- package/dist/_chunks/_deps/serve-static.mjs +0 -228
- package/dist/_chunks/_deps/setprototypeof.mjs +0 -26
- package/dist/_chunks/_deps/statuses.mjs +0 -457
- package/dist/_chunks/_deps/std-env.mjs +0 -3
- package/dist/_chunks/_deps/strip-literal.mjs +0 -67
- package/dist/_chunks/_deps/supports-color.mjs +0 -44
- package/dist/_chunks/_deps/tinyexec.mjs +0 -552
- package/dist/_chunks/_deps/toidentifier.mjs +0 -41
- package/dist/_chunks/_deps/ultrahtml.mjs +0 -3
- package/dist/_chunks/_deps/unimport.mjs +0 -2267
- package/dist/_chunks/_deps/unplugin-utils.mjs +0 -65
- package/dist/_chunks/_deps/unplugin.mjs +0 -1294
- package/dist/_chunks/_deps/untyped.mjs +0 -375
- package/dist/_chunks/_deps/unwasm.mjs +0 -6959
- package/dist/_chunks/_deps/webpack-virtual-modules.mjs +0 -360
- package/dist/_chunks/_presets/_all.mjs +0 -59
- package/dist/_chunks/_presets/_nitro.mjs +0 -74
- package/dist/_chunks/_presets/_resolve.mjs +0 -64
- package/dist/_chunks/_presets/_static.mjs +0 -69
- package/dist/_chunks/_presets/_types.mjs +0 -3
- package/dist/_chunks/_presets/_utils.mjs +0 -31
- package/dist/_chunks/_presets/alwaysdata.mjs +0 -17
- package/dist/_chunks/_presets/aws-amplify.mjs +0 -111
- package/dist/_chunks/_presets/aws-lambda.mjs +0 -23
- package/dist/_chunks/_presets/azure.mjs +0 -162
- package/dist/_chunks/_presets/bun.mjs +0 -19
- package/dist/_chunks/_presets/cleavr.mjs +0 -15
- package/dist/_chunks/_presets/cloudflare.mjs +0 -608
- package/dist/_chunks/_presets/deno.mjs +0 -196
- package/dist/_chunks/_presets/digitalocean.mjs +0 -14
- package/dist/_chunks/_presets/firebase.mjs +0 -47
- package/dist/_chunks/_presets/flightcontrol.mjs +0 -14
- package/dist/_chunks/_presets/genezio.mjs +0 -13
- package/dist/_chunks/_presets/heroku.mjs +0 -14
- package/dist/_chunks/_presets/iis.mjs +0 -194
- package/dist/_chunks/_presets/index.mjs +0 -62
- package/dist/_chunks/_presets/koyeb.mjs +0 -14
- package/dist/_chunks/_presets/netlify.mjs +0 -241
- package/dist/_chunks/_presets/node.mjs +0 -54
- package/dist/_chunks/_presets/platform.mjs +0 -14
- package/dist/_chunks/_presets/render.mjs +0 -14
- package/dist/_chunks/_presets/standard.mjs +0 -23
- package/dist/_chunks/_presets/stormkit.mjs +0 -18
- package/dist/_chunks/_presets/vercel.mjs +0 -375
- package/dist/_chunks/_presets/winterjs.mjs +0 -22
- package/dist/_chunks/_presets/zeabur.mjs +0 -69
- package/dist/_chunks/_presets/zerops.mjs +0 -27
- package/dist/_chunks/app.mjs +0 -600
- package/dist/_chunks/builder.mjs +0 -648
- package/dist/_chunks/server.mjs +0 -256
- package/dist/_cli/build.mjs +0 -49
- package/dist/_cli/common.mjs +0 -13
- package/dist/_cli/dev.mjs +0 -121
- package/dist/_cli/index.mjs +0 -16
- package/dist/_cli/list.mjs +0 -33
- package/dist/_cli/prepare.mjs +0 -23
- package/dist/_cli/run.mjs +0 -59
- package/dist/presets/cloudflare/runtime/shims/workers.dev.d.mts +0 -21
- package/dist/runtime/internal/empty.d.mts +0 -0
- package/dist/runtime/internal/vite/dev-entry.d.mts +0 -1
- package/dist/runtime/internal/vite/dev-worker.d.mts +0 -1
- package/dist/runtime/internal/vite/prod-setup.d.mts +0 -4
- package/dist/runtime/internal/vite/ssr-renderer.d.mts +0 -4
- /package/lib/{indexd.mts → index.d.mts} +0 -0
|
@@ -1,608 +0,0 @@
|
|
|
1
|
-
import { w as writeFile, d as defineNitroPreset } from './_utils.mjs';
|
|
2
|
-
import { presetsDir } from 'nitro/runtime/meta';
|
|
3
|
-
import { existsSync, promises } from 'node:fs';
|
|
4
|
-
import { readFile } from 'node:fs/promises';
|
|
5
|
-
import { relative, dirname, extname, resolve as resolve$1 } from 'node:path';
|
|
6
|
-
import { c as findNearestFile, d as readGitConfig, r as readPackageJSON, e as findFile } from '../_deps/pkg-types.mjs';
|
|
7
|
-
import { defu } from 'defu';
|
|
8
|
-
import { p } from '../_deps/std-env.mjs';
|
|
9
|
-
import { g as glob } from '../_deps/tinyglobby.mjs';
|
|
10
|
-
import { withoutLeadingSlash, withTrailingSlash, joinURL, withLeadingSlash, hasProtocol } from 'ufo';
|
|
11
|
-
import { j as join, r as resolve } from '../_deps/pathe.mjs';
|
|
12
|
-
import { Q, b as h } from '../_deps/confbox.mjs';
|
|
13
|
-
import { h as fileURLToPath } from '../_deps/mlly.mjs';
|
|
14
|
-
import { r as resolveModulePath } from '../_deps/exsolve.mjs';
|
|
15
|
-
|
|
16
|
-
const builtnNodeModules = [
|
|
17
|
-
"node:_http_agent",
|
|
18
|
-
"node:_http_client",
|
|
19
|
-
"node:_http_common",
|
|
20
|
-
// Missing exports: CRLF, HTTPParser, freeParser, isLenient, parsers, prepareError
|
|
21
|
-
"node:_http_incoming",
|
|
22
|
-
// Missing exports: readStart, readStop
|
|
23
|
-
"node:_http_outgoing",
|
|
24
|
-
"node:_http_server",
|
|
25
|
-
"node:_stream_duplex",
|
|
26
|
-
"node:_stream_passthrough",
|
|
27
|
-
"node:_stream_readable",
|
|
28
|
-
"node:_stream_transform",
|
|
29
|
-
"node:_stream_writable",
|
|
30
|
-
"node:_tls_common",
|
|
31
|
-
"node:_tls_wrap",
|
|
32
|
-
// Missing exports: Server, createServer
|
|
33
|
-
"node:assert",
|
|
34
|
-
// Missing exports: Assert, CallTracker
|
|
35
|
-
"node:assert/strict",
|
|
36
|
-
// Missing exports: Assert, CallTracker
|
|
37
|
-
"node:async_hooks",
|
|
38
|
-
"node:buffer",
|
|
39
|
-
"node:constants",
|
|
40
|
-
// Missing exports: O_DIRECT, O_NOATIME, RTLD_DEEPBIND, SIGPOLL, SIGPWR, SIGSTKFLT, defaultCipherList
|
|
41
|
-
"node:crypto",
|
|
42
|
-
// Missing exports: argon2, argon2Sync, decapsulate, encapsulate
|
|
43
|
-
"node:diagnostics_channel",
|
|
44
|
-
"node:dns",
|
|
45
|
-
// Missing exports: resolveTlsa
|
|
46
|
-
"node:dns/promises",
|
|
47
|
-
// Missing exports: resolveTlsa
|
|
48
|
-
"node:events",
|
|
49
|
-
// Missing exports: captureRejections, init
|
|
50
|
-
"node:fs",
|
|
51
|
-
// Missing exports: Utf8Stream, mkdtempDisposableSync
|
|
52
|
-
"node:fs/promises",
|
|
53
|
-
// Missing exports: mkdtempDisposable
|
|
54
|
-
"node:http",
|
|
55
|
-
"node:http2",
|
|
56
|
-
"node:https",
|
|
57
|
-
"node:module",
|
|
58
|
-
"node:net",
|
|
59
|
-
"node:os",
|
|
60
|
-
"node:path",
|
|
61
|
-
"node:path/posix",
|
|
62
|
-
"node:path/win32",
|
|
63
|
-
"node:process",
|
|
64
|
-
"node:querystring",
|
|
65
|
-
"node:stream",
|
|
66
|
-
"node:stream/consumers",
|
|
67
|
-
"node:stream/promises",
|
|
68
|
-
"node:stream/web",
|
|
69
|
-
"node:string_decoder",
|
|
70
|
-
"node:test",
|
|
71
|
-
// Missing exports: after, afterEach, assert, before, beforeEach, describe, it, only, run, skip, snapshot, suite, test, todo
|
|
72
|
-
"node:timers",
|
|
73
|
-
"node:timers/promises",
|
|
74
|
-
"node:tls",
|
|
75
|
-
// Missing exports: getCACertificates, setDefaultCACertificates
|
|
76
|
-
"node:url",
|
|
77
|
-
// Missing exports: URLPattern, fileURLToPathBuffer
|
|
78
|
-
"node:util",
|
|
79
|
-
// Missing exports: diff, setTraceSigInt
|
|
80
|
-
"node:util/types",
|
|
81
|
-
"node:zlib"
|
|
82
|
-
// Missing exports: ZstdCompress, ZstdDecompress, createZstdCompress, createZstdDecompress, zstdCompress, zstdCompressSync, zstdDecompress, zstdDecompressSync
|
|
83
|
-
];
|
|
84
|
-
|
|
85
|
-
const unencCfNodeCompat = {
|
|
86
|
-
meta: {
|
|
87
|
-
name: "nitro:cloudflare-node-compat"
|
|
88
|
-
},
|
|
89
|
-
external: builtnNodeModules,
|
|
90
|
-
alias: {
|
|
91
|
-
...Object.fromEntries(
|
|
92
|
-
builtnNodeModules.flatMap((m) => [
|
|
93
|
-
[m, m],
|
|
94
|
-
[m.replace("node:", ""), m]
|
|
95
|
-
])
|
|
96
|
-
)
|
|
97
|
-
},
|
|
98
|
-
inject: {
|
|
99
|
-
global: "unenv/polyfill/globalthis",
|
|
100
|
-
process: "node:process",
|
|
101
|
-
clearImmediate: ["node:timers", "clearImmediate"],
|
|
102
|
-
setImmediate: ["node:timers", "setImmediate"],
|
|
103
|
-
Buffer: ["node:buffer", "Buffer"]
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
const unenvCfExternals = {
|
|
107
|
-
meta: {
|
|
108
|
-
name: "nitro:cloudflare-externals"
|
|
109
|
-
},
|
|
110
|
-
external: [
|
|
111
|
-
"cloudflare:email",
|
|
112
|
-
"cloudflare:sockets",
|
|
113
|
-
"cloudflare:workers",
|
|
114
|
-
"cloudflare:workflows"
|
|
115
|
-
]
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
async function writeCFRoutes(nitro) {
|
|
119
|
-
const _cfPagesConfig = nitro.options.cloudflare?.pages || {};
|
|
120
|
-
const routes = {
|
|
121
|
-
version: _cfPagesConfig.routes?.version || 1,
|
|
122
|
-
include: _cfPagesConfig.routes?.include || ["/*"],
|
|
123
|
-
exclude: _cfPagesConfig.routes?.exclude || []
|
|
124
|
-
};
|
|
125
|
-
const writeRoutes = () => writeFile(
|
|
126
|
-
resolve(nitro.options.output.dir, "_routes.json"),
|
|
127
|
-
JSON.stringify(routes, void 0, 2),
|
|
128
|
-
true
|
|
129
|
-
);
|
|
130
|
-
if (_cfPagesConfig.defaultRoutes === false) {
|
|
131
|
-
await writeRoutes();
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const explicitPublicAssets = nitro.options.publicAssets.filter(
|
|
135
|
-
(dir, index, array) => {
|
|
136
|
-
if (dir.fallthrough || !dir.baseURL) {
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
const normalizedBase = withoutLeadingSlash(dir.baseURL);
|
|
140
|
-
return !array.some(
|
|
141
|
-
(otherDir, otherIndex) => otherIndex !== index && normalizedBase.startsWith(
|
|
142
|
-
withoutLeadingSlash(withTrailingSlash(otherDir.baseURL))
|
|
143
|
-
)
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
routes.exclude.push(
|
|
148
|
-
...explicitPublicAssets.map((asset) => joinURL(nitro.options.baseURL, asset.baseURL || "/", "*")).sort(comparePaths)
|
|
149
|
-
);
|
|
150
|
-
const publicAssetFiles = await glob("**", {
|
|
151
|
-
cwd: nitro.options.output.dir,
|
|
152
|
-
absolute: false,
|
|
153
|
-
dot: true,
|
|
154
|
-
ignore: [
|
|
155
|
-
"_worker.js",
|
|
156
|
-
"_worker.js.map",
|
|
157
|
-
"nitro.json",
|
|
158
|
-
...routes.exclude.map(
|
|
159
|
-
(path) => withoutLeadingSlash(path.replace(/\/\*$/, "/**"))
|
|
160
|
-
)
|
|
161
|
-
]
|
|
162
|
-
});
|
|
163
|
-
routes.exclude.push(
|
|
164
|
-
...publicAssetFiles.map(
|
|
165
|
-
(i) => withLeadingSlash(i).replace(/\/index\.html$/, "").replace(/\.html$/, "") || "/"
|
|
166
|
-
).sort(comparePaths)
|
|
167
|
-
);
|
|
168
|
-
routes.exclude.splice(100 - routes.include.length);
|
|
169
|
-
await writeRoutes();
|
|
170
|
-
}
|
|
171
|
-
function comparePaths(a, b) {
|
|
172
|
-
return a.split("/").length - b.split("/").length || a.localeCompare(b);
|
|
173
|
-
}
|
|
174
|
-
async function writeCFHeaders(nitro, outdir) {
|
|
175
|
-
const headersPath = join(
|
|
176
|
-
outdir === "public" ? nitro.options.output.publicDir : nitro.options.output.dir,
|
|
177
|
-
"_headers"
|
|
178
|
-
);
|
|
179
|
-
const contents = [];
|
|
180
|
-
const rules = Object.entries(nitro.options.routeRules).sort(
|
|
181
|
-
(a, b) => b[0].split(/\/(?!\*)/).length - a[0].split(/\/(?!\*)/).length
|
|
182
|
-
);
|
|
183
|
-
for (const [path, routeRules] of rules.filter(
|
|
184
|
-
([_, routeRules2]) => routeRules2.headers
|
|
185
|
-
)) {
|
|
186
|
-
const headers = [
|
|
187
|
-
joinURL(nitro.options.baseURL, path.replace("/**", "/*")),
|
|
188
|
-
...Object.entries({ ...routeRules.headers }).map(
|
|
189
|
-
([header, value]) => ` ${header}: ${value}`
|
|
190
|
-
)
|
|
191
|
-
].join("\n");
|
|
192
|
-
contents.push(headers);
|
|
193
|
-
}
|
|
194
|
-
if (existsSync(headersPath)) {
|
|
195
|
-
const currentHeaders = await readFile(headersPath, "utf8");
|
|
196
|
-
if (/^\/\* /m.test(currentHeaders)) {
|
|
197
|
-
nitro.logger.info(
|
|
198
|
-
"Not adding Nitro fallback to `_headers` (as an existing fallback was found)."
|
|
199
|
-
);
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
nitro.logger.info(
|
|
203
|
-
"Adding Nitro fallback to `_headers` to handle all unmatched routes."
|
|
204
|
-
);
|
|
205
|
-
contents.unshift(currentHeaders);
|
|
206
|
-
}
|
|
207
|
-
await writeFile(headersPath, contents.join("\n"), true);
|
|
208
|
-
}
|
|
209
|
-
async function writeCFPagesRedirects(nitro) {
|
|
210
|
-
const redirectsPath = join(nitro.options.output.dir, "_redirects");
|
|
211
|
-
const staticFallback = existsSync(
|
|
212
|
-
join(nitro.options.output.publicDir, "404.html")
|
|
213
|
-
) ? `${joinURL(nitro.options.baseURL, "/*")} ${joinURL(nitro.options.baseURL, "/404.html")} 404` : "";
|
|
214
|
-
const contents = [staticFallback];
|
|
215
|
-
const rules = Object.entries(nitro.options.routeRules).sort(
|
|
216
|
-
(a, b) => a[0].split(/\/(?!\*)/).length - b[0].split(/\/(?!\*)/).length
|
|
217
|
-
);
|
|
218
|
-
for (const [key, routeRules] of rules.filter(
|
|
219
|
-
([_, routeRules2]) => routeRules2.redirect
|
|
220
|
-
)) {
|
|
221
|
-
const code = routeRules.redirect.status;
|
|
222
|
-
const from = joinURL(nitro.options.baseURL, key.replace("/**", "/*"));
|
|
223
|
-
const to = hasProtocol(routeRules.redirect.to, { acceptRelative: true }) ? routeRules.redirect.to : joinURL(nitro.options.baseURL, routeRules.redirect.to);
|
|
224
|
-
contents.unshift(`${from} ${to} ${code}`);
|
|
225
|
-
}
|
|
226
|
-
if (existsSync(redirectsPath)) {
|
|
227
|
-
const currentRedirects = await readFile(redirectsPath, "utf8");
|
|
228
|
-
if (/^\/\* /m.test(currentRedirects)) {
|
|
229
|
-
nitro.logger.info(
|
|
230
|
-
"Not adding Nitro fallback to `_redirects` (as an existing fallback was found)."
|
|
231
|
-
);
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
nitro.logger.info(
|
|
235
|
-
"Adding Nitro fallback to `_redirects` to handle all unmatched routes."
|
|
236
|
-
);
|
|
237
|
-
contents.unshift(currentRedirects);
|
|
238
|
-
}
|
|
239
|
-
await writeFile(redirectsPath, contents.join("\n"), true);
|
|
240
|
-
}
|
|
241
|
-
async function enableNodeCompat(nitro) {
|
|
242
|
-
nitro.options.cloudflare ??= {};
|
|
243
|
-
if (nitro.options.cloudflare.deployConfig === void 0 && p === "cloudflare_workers") {
|
|
244
|
-
nitro.options.cloudflare.deployConfig = true;
|
|
245
|
-
}
|
|
246
|
-
if (nitro.options.cloudflare.nodeCompat === void 0) {
|
|
247
|
-
const { config } = await readWranglerConfig(nitro);
|
|
248
|
-
const userCompatibilityFlags = new Set(config?.compatibility_flags || []);
|
|
249
|
-
if (userCompatibilityFlags.has("nodejs_compat") || userCompatibilityFlags.has("nodejs_compat_v2") || nitro.options.cloudflare.deployConfig) {
|
|
250
|
-
nitro.options.cloudflare.nodeCompat = true;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
if (!nitro.options.cloudflare.nodeCompat) {
|
|
254
|
-
if (nitro.options.cloudflare.nodeCompat === void 0) {
|
|
255
|
-
nitro.logger.warn("[cloudflare] Node.js compatibility is not enabled.");
|
|
256
|
-
}
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
nitro.options.unenv.push(unencCfNodeCompat);
|
|
260
|
-
}
|
|
261
|
-
const extensionParsers = {
|
|
262
|
-
".json": h,
|
|
263
|
-
".jsonc": h,
|
|
264
|
-
".toml": Q
|
|
265
|
-
};
|
|
266
|
-
async function readWranglerConfig(nitro) {
|
|
267
|
-
const configPath = await findNearestFile(
|
|
268
|
-
["wrangler.json", "wrangler.jsonc", "wrangler.toml"],
|
|
269
|
-
{
|
|
270
|
-
startingFrom: nitro.options.rootDir
|
|
271
|
-
}
|
|
272
|
-
).catch(() => void 0);
|
|
273
|
-
if (!configPath) {
|
|
274
|
-
return {};
|
|
275
|
-
}
|
|
276
|
-
const userConfigText = await readFile(configPath, "utf8");
|
|
277
|
-
const parser = extensionParsers[extname(configPath)];
|
|
278
|
-
if (!parser) {
|
|
279
|
-
throw new Error(`Unsupported config file format: ${configPath}`);
|
|
280
|
-
}
|
|
281
|
-
const config = parser(userConfigText);
|
|
282
|
-
return { configPath, config };
|
|
283
|
-
}
|
|
284
|
-
async function writeWranglerConfig(nitro, cfTarget) {
|
|
285
|
-
if (!nitro.options.cloudflare?.deployConfig) {
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
const wranglerConfigDir = nitro.options.output.serverDir;
|
|
289
|
-
const wranglerConfigPath = join(wranglerConfigDir, "wrangler.json");
|
|
290
|
-
const defaults = {};
|
|
291
|
-
const overrides = {};
|
|
292
|
-
defaults.compatibility_date = nitro.options.compatibilityDate.cloudflare || nitro.options.compatibilityDate.default;
|
|
293
|
-
if (cfTarget === "pages") {
|
|
294
|
-
overrides.pages_build_output_dir = relative(
|
|
295
|
-
wranglerConfigDir,
|
|
296
|
-
nitro.options.output.dir
|
|
297
|
-
);
|
|
298
|
-
} else {
|
|
299
|
-
overrides.main = relative(
|
|
300
|
-
wranglerConfigDir,
|
|
301
|
-
join(nitro.options.output.serverDir, "index.mjs")
|
|
302
|
-
);
|
|
303
|
-
overrides.assets = {
|
|
304
|
-
binding: "ASSETS",
|
|
305
|
-
directory: relative(
|
|
306
|
-
wranglerConfigDir,
|
|
307
|
-
resolve(
|
|
308
|
-
nitro.options.output.publicDir,
|
|
309
|
-
"..".repeat(nitro.options.baseURL.split("/").filter(Boolean).length)
|
|
310
|
-
)
|
|
311
|
-
)
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
const { config: userConfig = {} } = await readWranglerConfig(nitro);
|
|
315
|
-
const ctxConfig = nitro.options.cloudflare?.wrangler || {};
|
|
316
|
-
for (const key in overrides) {
|
|
317
|
-
if (key in userConfig || key in ctxConfig) {
|
|
318
|
-
nitro.logger.warn(
|
|
319
|
-
`[cloudflare] Wrangler config \`${key}\`${key in ctxConfig ? "set by config or modules" : ""} is overridden and will be ignored.`
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
const wranglerConfig = defu(
|
|
324
|
-
overrides,
|
|
325
|
-
ctxConfig,
|
|
326
|
-
userConfig,
|
|
327
|
-
defaults
|
|
328
|
-
);
|
|
329
|
-
if (!wranglerConfig.name) {
|
|
330
|
-
wranglerConfig.name = await generateWorkerName(nitro);
|
|
331
|
-
nitro.logger.info(
|
|
332
|
-
`Using auto generated worker name: \`${wranglerConfig.name}\``
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
const compatFlags = new Set(wranglerConfig.compatibility_flags || []);
|
|
336
|
-
if (nitro.options.cloudflare?.nodeCompat) {
|
|
337
|
-
if (compatFlags.has("nodejs_compat_v2") && compatFlags.has("no_nodejs_compat_v2")) {
|
|
338
|
-
nitro.logger.warn(
|
|
339
|
-
"[cloudflare] Wrangler config `compatibility_flags` contains both `nodejs_compat_v2` and `no_nodejs_compat_v2`. Ignoring `nodejs_compat_v2`."
|
|
340
|
-
);
|
|
341
|
-
compatFlags.delete("nodejs_compat_v2");
|
|
342
|
-
}
|
|
343
|
-
if (compatFlags.has("nodejs_compat_v2")) {
|
|
344
|
-
nitro.logger.warn(
|
|
345
|
-
"[cloudflare] Please consider replacing `nodejs_compat_v2` with `nodejs_compat` in your `compatibility_flags` or USE IT AT YOUR OWN RISK as it can cause issues with nitro."
|
|
346
|
-
);
|
|
347
|
-
} else {
|
|
348
|
-
compatFlags.add("nodejs_compat");
|
|
349
|
-
compatFlags.add("no_nodejs_compat_v2");
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
wranglerConfig.compatibility_flags = [...compatFlags];
|
|
353
|
-
await writeFile(
|
|
354
|
-
wranglerConfigPath,
|
|
355
|
-
JSON.stringify(wranglerConfig, null, 2),
|
|
356
|
-
true
|
|
357
|
-
);
|
|
358
|
-
const configPath = join(
|
|
359
|
-
nitro.options.rootDir,
|
|
360
|
-
".wrangler/deploy/config.json"
|
|
361
|
-
);
|
|
362
|
-
await writeFile(
|
|
363
|
-
configPath,
|
|
364
|
-
JSON.stringify({
|
|
365
|
-
configPath: relative(dirname(configPath), wranglerConfigPath)
|
|
366
|
-
}),
|
|
367
|
-
true
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
async function generateWorkerName(nitro) {
|
|
371
|
-
const gitConfig = await readGitConfig(nitro.options.rootDir).catch(
|
|
372
|
-
() => void 0
|
|
373
|
-
);
|
|
374
|
-
const gitRepo = gitConfig?.remote?.origin?.url?.replace(/\.git$/, "").match(/[/:]([^/]+\/[^/]+)$/)?.[1];
|
|
375
|
-
const pkgJSON = await readPackageJSON(nitro.options.rootDir).catch(
|
|
376
|
-
() => void 0
|
|
377
|
-
);
|
|
378
|
-
const pkgName = pkgJSON?.name;
|
|
379
|
-
const subpath = relative(nitro.options.workspaceDir, nitro.options.rootDir);
|
|
380
|
-
return `${gitRepo || pkgName}/${subpath}`.toLowerCase().replace(/[^a-zA-Z0-9-]/g, "-").replace(/-$/, "");
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
async function cloudflareDevModule(nitro) {
|
|
384
|
-
if (!nitro.options.dev) {
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
const wranglerPath = await resolveModulePath("wrangler", {
|
|
388
|
-
from: nitro.options.nodeModulesDirs,
|
|
389
|
-
try: true
|
|
390
|
-
});
|
|
391
|
-
if (!wranglerPath) {
|
|
392
|
-
nitro.logger.warn(
|
|
393
|
-
"Wrangler is not installed. Please install it using `npx nypm i wrangler` to enable dev emulation."
|
|
394
|
-
);
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
const config = {
|
|
398
|
-
// compatibility with legacy nitro-cloudflare-dev module
|
|
399
|
-
...nitro.options.cloudflareDev,
|
|
400
|
-
...nitro.options.cloudflare?.dev
|
|
401
|
-
};
|
|
402
|
-
let configPath = config.configPath;
|
|
403
|
-
if (!configPath) {
|
|
404
|
-
configPath = await findFile(
|
|
405
|
-
["wrangler.json", "wrangler.jsonc", "wrangler.toml"],
|
|
406
|
-
{
|
|
407
|
-
startingFrom: nitro.options.srcDir
|
|
408
|
-
}
|
|
409
|
-
).catch(() => void 0);
|
|
410
|
-
}
|
|
411
|
-
const persistDir = resolve$1(
|
|
412
|
-
nitro.options.rootDir,
|
|
413
|
-
config.persistDir || ".wrangler/state/v3"
|
|
414
|
-
);
|
|
415
|
-
const gitIgnorePath = await findFile(".gitignore", {
|
|
416
|
-
startingFrom: nitro.options.rootDir
|
|
417
|
-
}).catch(() => void 0);
|
|
418
|
-
if (gitIgnorePath && persistDir === ".wrangler/state/v3") {
|
|
419
|
-
const gitIgnore = await promises.readFile(gitIgnorePath, "utf8");
|
|
420
|
-
if (!gitIgnore.includes(".wrangler/state/v3")) {
|
|
421
|
-
await promises.writeFile(gitIgnorePath, gitIgnore + "\n.wrangler/state/v3\n").catch(() => {
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
nitro.options.runtimeConfig.wrangler = {
|
|
426
|
-
...nitro.options.runtimeConfig.wrangler,
|
|
427
|
-
configPath,
|
|
428
|
-
persistDir,
|
|
429
|
-
environment: config.environment
|
|
430
|
-
};
|
|
431
|
-
nitro.options.externals.inline = nitro.options.externals.inline || [];
|
|
432
|
-
nitro.options.externals.inline.push(
|
|
433
|
-
fileURLToPath(new URL("runtime/", import.meta.url))
|
|
434
|
-
);
|
|
435
|
-
nitro.options.plugins = nitro.options.plugins || [];
|
|
436
|
-
nitro.options.plugins.unshift(
|
|
437
|
-
resolveModulePath("./cloudflare/runtime/plugin.dev", {
|
|
438
|
-
from: presetsDir,
|
|
439
|
-
extensions: [".mjs", ".ts"]
|
|
440
|
-
})
|
|
441
|
-
);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
const cloudflarePages = defineNitroPreset(
|
|
445
|
-
{
|
|
446
|
-
extends: "base-worker",
|
|
447
|
-
entry: "./cloudflare/runtime/cloudflare-pages",
|
|
448
|
-
exportConditions: ["workerd"],
|
|
449
|
-
commands: {
|
|
450
|
-
preview: "npx wrangler --cwd ./ pages dev",
|
|
451
|
-
deploy: "npx wrangler --cwd ./ pages deploy"
|
|
452
|
-
},
|
|
453
|
-
output: {
|
|
454
|
-
dir: "{{ rootDir }}/dist",
|
|
455
|
-
publicDir: "{{ output.dir }}/{{ baseURL }}",
|
|
456
|
-
serverDir: "{{ output.dir }}/_worker.js"
|
|
457
|
-
},
|
|
458
|
-
unenv: [unenvCfExternals],
|
|
459
|
-
alias: {
|
|
460
|
-
// Hotfix: Cloudflare appends /index.html if mime is not found and things like ico are not in standard lite.js!
|
|
461
|
-
// https://github.com/nitrojs/nitro/pull/933
|
|
462
|
-
_mime: "mime/index.js"
|
|
463
|
-
},
|
|
464
|
-
wasm: {
|
|
465
|
-
lazy: false,
|
|
466
|
-
esmImport: true
|
|
467
|
-
},
|
|
468
|
-
rollupConfig: {
|
|
469
|
-
output: {
|
|
470
|
-
entryFileNames: "index.js",
|
|
471
|
-
format: "esm",
|
|
472
|
-
inlineDynamicImports: false
|
|
473
|
-
}
|
|
474
|
-
},
|
|
475
|
-
hooks: {
|
|
476
|
-
"build:before": async (nitro) => {
|
|
477
|
-
await enableNodeCompat(nitro);
|
|
478
|
-
},
|
|
479
|
-
async compiled(nitro) {
|
|
480
|
-
await writeWranglerConfig(nitro, "pages");
|
|
481
|
-
await writeCFRoutes(nitro);
|
|
482
|
-
await writeCFHeaders(nitro, "output");
|
|
483
|
-
await writeCFPagesRedirects(nitro);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
name: "cloudflare-pages",
|
|
489
|
-
stdName: "cloudflare_pages"
|
|
490
|
-
}
|
|
491
|
-
);
|
|
492
|
-
const cloudflarePagesStatic = defineNitroPreset(
|
|
493
|
-
{
|
|
494
|
-
extends: "static",
|
|
495
|
-
output: {
|
|
496
|
-
dir: "{{ rootDir }}/dist",
|
|
497
|
-
publicDir: "{{ output.dir }}/{{ baseURL }}"
|
|
498
|
-
},
|
|
499
|
-
commands: {
|
|
500
|
-
preview: "npx wrangler --cwd ./ pages dev",
|
|
501
|
-
deploy: "npx wrangler --cwd ./ pages deploy"
|
|
502
|
-
},
|
|
503
|
-
hooks: {
|
|
504
|
-
async compiled(nitro) {
|
|
505
|
-
await writeCFHeaders(nitro, "output");
|
|
506
|
-
await writeCFPagesRedirects(nitro);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
name: "cloudflare-pages-static",
|
|
512
|
-
stdName: "cloudflare_pages",
|
|
513
|
-
static: true
|
|
514
|
-
}
|
|
515
|
-
);
|
|
516
|
-
const cloudflareDev = defineNitroPreset(
|
|
517
|
-
{
|
|
518
|
-
extends: "nitro-dev",
|
|
519
|
-
modules: [cloudflareDevModule],
|
|
520
|
-
esbuild: {
|
|
521
|
-
options: {
|
|
522
|
-
target: "es2022"
|
|
523
|
-
}
|
|
524
|
-
},
|
|
525
|
-
unenv: {
|
|
526
|
-
meta: {
|
|
527
|
-
name: "cloudflare-dev"
|
|
528
|
-
},
|
|
529
|
-
alias: {
|
|
530
|
-
"cloudflare:workers": resolve(
|
|
531
|
-
presetsDir,
|
|
532
|
-
"cloudflare/runtime/shims/workers.dev.mjs"
|
|
533
|
-
)
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
},
|
|
537
|
-
{
|
|
538
|
-
name: "cloudflare-dev",
|
|
539
|
-
aliases: ["cloudflare-module", "cloudflare-durable", "cloudflare-pages"],
|
|
540
|
-
compatibilityDate: "2025-07-13",
|
|
541
|
-
dev: true
|
|
542
|
-
}
|
|
543
|
-
);
|
|
544
|
-
const cloudflareModule = defineNitroPreset(
|
|
545
|
-
{
|
|
546
|
-
extends: "base-worker",
|
|
547
|
-
entry: "./cloudflare/runtime/cloudflare-module",
|
|
548
|
-
output: {
|
|
549
|
-
publicDir: "{{ output.dir }}/public/{{ baseURL }}"
|
|
550
|
-
},
|
|
551
|
-
exportConditions: ["workerd"],
|
|
552
|
-
commands: {
|
|
553
|
-
preview: "npx wrangler --cwd ./ dev",
|
|
554
|
-
deploy: "npx wrangler --cwd ./ deploy"
|
|
555
|
-
},
|
|
556
|
-
unenv: [unenvCfExternals],
|
|
557
|
-
rollupConfig: {
|
|
558
|
-
output: {
|
|
559
|
-
format: "esm",
|
|
560
|
-
exports: "named",
|
|
561
|
-
inlineDynamicImports: false
|
|
562
|
-
}
|
|
563
|
-
},
|
|
564
|
-
wasm: {
|
|
565
|
-
lazy: false,
|
|
566
|
-
esmImport: true
|
|
567
|
-
},
|
|
568
|
-
hooks: {
|
|
569
|
-
"build:before": async (nitro) => {
|
|
570
|
-
await enableNodeCompat(nitro);
|
|
571
|
-
},
|
|
572
|
-
async compiled(nitro) {
|
|
573
|
-
await writeWranglerConfig(nitro, "module");
|
|
574
|
-
await writeCFHeaders(nitro, "public");
|
|
575
|
-
await writeFile(
|
|
576
|
-
resolve(nitro.options.output.dir, "package.json"),
|
|
577
|
-
JSON.stringify({ private: true, main: "./server/index.mjs" }, null, 2)
|
|
578
|
-
);
|
|
579
|
-
await writeFile(
|
|
580
|
-
resolve(nitro.options.output.dir, "package-lock.json"),
|
|
581
|
-
JSON.stringify({ lockfileVersion: 1 }, null, 2)
|
|
582
|
-
);
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
},
|
|
586
|
-
{
|
|
587
|
-
name: "cloudflare-module",
|
|
588
|
-
stdName: "cloudflare_workers"
|
|
589
|
-
}
|
|
590
|
-
);
|
|
591
|
-
const cloudflareDurable = defineNitroPreset(
|
|
592
|
-
{
|
|
593
|
-
extends: "cloudflare-module",
|
|
594
|
-
entry: "./cloudflare/runtime/cloudflare-durable"
|
|
595
|
-
},
|
|
596
|
-
{
|
|
597
|
-
name: "cloudflare-durable"
|
|
598
|
-
}
|
|
599
|
-
);
|
|
600
|
-
const _cloudflare = [
|
|
601
|
-
cloudflarePages,
|
|
602
|
-
cloudflarePagesStatic,
|
|
603
|
-
cloudflareModule,
|
|
604
|
-
cloudflareDurable,
|
|
605
|
-
cloudflareDev
|
|
606
|
-
];
|
|
607
|
-
|
|
608
|
-
export { _cloudflare as _ };
|