nitro 3.0.260429-beta → 3.0.260522-beta
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/THIRD-PARTY-LICENSES.md.gz +0 -0
- package/dist/_build/common.mjs +119 -21
- package/dist/_build/rolldown.mjs +6 -6
- package/dist/_build/rollup.mjs +11 -11
- package/dist/_build/vite.build.mjs +3 -3
- package/dist/_build/vite.dev.mjs +149 -0
- package/dist/_build/vite.env.mjs +177 -0
- package/dist/_chunks/nitro.mjs +239 -12
- package/dist/_chunks/nitro2.mjs +117 -90
- package/dist/_chunks/utils.mjs +4 -4
- package/dist/_common.mjs +1 -1
- package/dist/_dev.d.mts +1 -1
- package/dist/_dev.mjs +5 -5
- package/dist/_libs/c12+rc9.mjs +11 -10
- package/dist/_libs/c12+readdirp+chokidar.d.mts +7 -8
- package/dist/_libs/citty.mjs +1 -1
- package/dist/_libs/common.d.mts +37 -0
- package/dist/_libs/commondir+is-reference.mjs +3 -3
- package/dist/_libs/compatx.d.mts +1 -1
- package/dist/_libs/compatx.mjs +1 -1
- package/dist/_libs/estree+pluginutils.d.mts +1 -1
- package/dist/_libs/estree-walker.mjs +1 -1
- package/dist/_libs/hasown+resolve+deepmerge.mjs +15 -15
- package/dist/_libs/httpxy.d.mts +1 -1
- package/dist/_libs/httpxy.mjs +8 -4
- package/dist/_libs/jsonc-parser+workers-utils.d.mts +1579 -0
- package/dist/_libs/klona.mjs +1 -1
- package/dist/_libs/magic-string.d.mts +1 -1
- package/dist/_libs/mlly.d.mts +1 -1
- package/dist/_libs/nypm+tinyexec.mjs +92 -99
- package/dist/_libs/openapi-types.d.mts +730 -0
- package/dist/_libs/perfect-debounce.mjs +1 -1
- package/dist/_libs/pkg-types.d.mts +1 -1
- package/dist/_libs/plugin-alias.mjs +2 -2
- package/dist/_libs/plugin-inject.mjs +3 -3
- package/dist/_libs/plugin-json.mjs +2 -2
- package/dist/_libs/pluginutils.mjs +16 -5
- package/dist/_libs/readdirp+chokidar.mjs +2 -2
- package/dist/_libs/remapping.mjs +2 -2
- package/dist/_libs/resolve-uri+gen-mapping.mjs +2 -5
- package/dist/_libs/rou3.d.mts +1 -1
- package/dist/_libs/rou3.mjs +1 -1
- package/dist/_libs/std-env.d.mts +1 -1
- package/dist/_libs/tsconfck.mjs +1 -1
- package/dist/_libs/ultrahtml.mjs +1 -1
- package/dist/_libs/{unimport+unplugin+oxc-parser.mjs → unimport+unplugin.mjs} +18 -8
- package/dist/_libs/unplugin+unimport.d.mts +3 -3
- package/dist/_libs/unwasm.d.mts +1 -1
- package/dist/_presets.mjs +117 -91
- package/dist/builder.d.mts +1 -1
- package/dist/builder.mjs +3 -3
- package/dist/cli/_chunks/build.mjs +3 -3
- package/dist/cli/_chunks/common.mjs +1 -1
- package/dist/cli/_chunks/deploy.mjs +2 -2
- package/dist/cli/_chunks/dev.mjs +4 -4
- package/dist/cli/_chunks/docs.mjs +1 -1
- package/dist/cli/_chunks/list.mjs +2 -2
- package/dist/cli/_chunks/prepare.mjs +3 -3
- package/dist/cli/_chunks/preview.mjs +4 -4
- package/dist/cli/_chunks/run.mjs +2 -2
- package/dist/cli/_chunks/task.mjs +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/docs/1.deploy/2.providers/2.aws-amplify.md +3 -3
- package/dist/docs/1.deploy/2.providers/21.vercel.md +6 -0
- package/dist/docs/3.examples/27.vite-ssr-tsr-react.md +1 -1
- package/dist/presets/vercel/runtime/queue.dev.mjs +41 -0
- package/dist/runtime/internal/app.mjs +4 -111
- package/dist/runtime/virtual/app.d.mts +4 -0
- package/dist/runtime/virtual/app.mjs +32 -0
- package/dist/types/index.d.mts +21 -1756
- package/dist/vite.mjs +23 -337
- package/package.json +37 -39
- package/dist/THIRD-PARTY-LICENSES.md +0 -1676
- package/dist/_chunks/nitro3.mjs +0 -136
- package/dist/_chunks/nitro4.mjs +0 -127
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __exportAll } from "../_common.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
var dist_exports = /* @__PURE__ */ __exportAll({ default: () => alias });
|
|
4
4
|
function matches(pattern, importee) {
|
|
@@ -59,4 +59,4 @@ function alias(options = {}) {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
export {
|
|
62
|
+
export { alias, dist_exports };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { __exportAll } from "../_common.mjs";
|
|
2
|
+
import { MagicString, attachScopes, createFilter, makeLegalIdentifier, walk } from "../_build/common.mjs";
|
|
3
3
|
import { sep } from "path";
|
|
4
4
|
var es_exports = /* @__PURE__ */ __exportAll({ default: () => inject });
|
|
5
5
|
var escape = function(str) {
|
|
@@ -128,4 +128,4 @@ function inject(options) {
|
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
|
-
export {
|
|
131
|
+
export { es_exports, inject };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createFilter, dataToEsm } from "../_build/common.mjs";
|
|
2
2
|
function json(options) {
|
|
3
3
|
if (options === void 0) options = {};
|
|
4
4
|
var filter = createFilter(options.include, options.exclude);
|
|
@@ -29,4 +29,4 @@ function json(options) {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
export { json
|
|
32
|
+
export { json };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { __exportAll } from "../_common.mjs";
|
|
2
|
+
import { MagicString, stripLiteral } from "../_build/common.mjs";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import "node:assert";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
|
-
import { isCSSRequest, normalizePath } from "vite";
|
|
9
8
|
import assert$1 from "node:assert/strict";
|
|
10
9
|
function exactRegex(str, flags) {
|
|
11
10
|
return new RegExp(`^${escapeRegex(str)}$`, flags);
|
|
@@ -82,6 +81,13 @@ function slash(p) {
|
|
|
82
81
|
return p.replace(windowsSlashRE, "/");
|
|
83
82
|
}
|
|
84
83
|
const isWindows = typeof process !== "undefined" && process.platform === "win32";
|
|
84
|
+
function normalizePath(id) {
|
|
85
|
+
return path.posix.normalize(isWindows ? slash(id) : id);
|
|
86
|
+
}
|
|
87
|
+
const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
|
88
|
+
function isCSSRequest(request) {
|
|
89
|
+
return CSS_LANGS_RE.test(request);
|
|
90
|
+
}
|
|
85
91
|
function injectQuery(url, queryToInject) {
|
|
86
92
|
const { file, postfix } = splitFileAndPostfix(url);
|
|
87
93
|
return `${isWindows ? slash(file) : file}?${queryToInject}${postfix[0] === "?" ? `&${postfix.slice(1)}` : postfix}`;
|
|
@@ -491,7 +497,12 @@ function collectAssetDepsInner(fileName, bundle) {
|
|
|
491
497
|
};
|
|
492
498
|
}
|
|
493
499
|
function patchViteClientPlugin() {
|
|
494
|
-
|
|
500
|
+
let viteClientPath;
|
|
501
|
+
try {
|
|
502
|
+
viteClientPath = normalizePath(fileURLToPath(import.meta.resolve("vite/dist/client/client.mjs")));
|
|
503
|
+
} catch {
|
|
504
|
+
return null;
|
|
505
|
+
}
|
|
495
506
|
function endIndexOf(code, searchValue) {
|
|
496
507
|
const i = code.lastIndexOf(searchValue);
|
|
497
508
|
return i === -1 ? i : i + searchValue.length;
|
|
@@ -619,4 +630,4 @@ function mergeAssets(...args) {
|
|
|
619
630
|
});
|
|
620
631
|
}
|
|
621
632
|
}
|
|
622
|
-
export { assetsPlugin
|
|
633
|
+
export { assetsPlugin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __exportAll } from "../_common.mjs";
|
|
2
2
|
import { stat, unwatchFile, watch, watchFile } from "node:fs";
|
|
3
3
|
import { lstat, open, readdir, realpath, stat as stat$1 } from "node:fs/promises";
|
|
4
4
|
import { type } from "node:os";
|
|
@@ -1431,4 +1431,4 @@ var chokidar_default = {
|
|
|
1431
1431
|
watch: watch$1,
|
|
1432
1432
|
FSWatcher
|
|
1433
1433
|
};
|
|
1434
|
-
export { watch$1 as
|
|
1434
|
+
export { chokidar_exports, watch$1 as watch };
|
package/dist/_libs/remapping.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GenMapping, TraceMap, decodedMappings, maybeAddSegment, setIgnore, setSourceContent, toDecodedMap, toEncodedMap, traceSegment } from "./resolve-uri+gen-mapping.mjs";
|
|
2
2
|
var SOURCELESS_MAPPING = /* @__PURE__ */ SegmentObject("", -1, -1, "", null, false);
|
|
3
3
|
var EMPTY_SOURCES = [];
|
|
4
4
|
function SegmentObject(source, line, column, name, content, ignore) {
|
|
@@ -110,4 +110,4 @@ function remapping(input, loader, options) {
|
|
|
110
110
|
};
|
|
111
111
|
return new SourceMap(traceMappings(buildSourceMapTree(input, loader)), opts);
|
|
112
112
|
}
|
|
113
|
-
export { remapping
|
|
113
|
+
export { remapping };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { decode, encode } from "../_build/common.mjs";
|
|
2
2
|
const schemeRegex = /^[\w+.-]+:\/\//;
|
|
3
3
|
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
|
4
4
|
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
|
@@ -358,8 +358,6 @@ function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLin
|
|
|
358
358
|
if (skipable && skipSourceless(line, index)) return;
|
|
359
359
|
return insert(line, index, [genColumn]);
|
|
360
360
|
}
|
|
361
|
-
assert(sourceLine);
|
|
362
|
-
assert(sourceColumn);
|
|
363
361
|
const sourcesIndex = put(sources, source);
|
|
364
362
|
const namesIndex = name ? put(names, name) : NO_NAME;
|
|
365
363
|
if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null;
|
|
@@ -377,7 +375,6 @@ function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLin
|
|
|
377
375
|
sourceColumn
|
|
378
376
|
]);
|
|
379
377
|
}
|
|
380
|
-
function assert(_val) {}
|
|
381
378
|
function getIndex(arr, index) {
|
|
382
379
|
for (let i = arr.length; i <= index; i++) arr[i] = [];
|
|
383
380
|
return arr[index];
|
|
@@ -407,4 +404,4 @@ function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIn
|
|
|
407
404
|
if (prev.length === 1) return false;
|
|
408
405
|
return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME);
|
|
409
406
|
}
|
|
410
|
-
export {
|
|
407
|
+
export { GenMapping, TraceMap, decodedMappings, maybeAddSegment, setIgnore, setSourceContent, toDecodedMap, toEncodedMap, traceSegment };
|
package/dist/_libs/rou3.d.mts
CHANGED
package/dist/_libs/rou3.mjs
CHANGED
|
@@ -464,4 +464,4 @@ function serializeData(ctx, value) {
|
|
|
464
464
|
}
|
|
465
465
|
return `$${index}`;
|
|
466
466
|
}
|
|
467
|
-
export {
|
|
467
|
+
export { addRoute, compileRouterToString, createRouter, findAllRoutes, findRoute };
|
package/dist/_libs/std-env.d.mts
CHANGED
package/dist/_libs/tsconfck.mjs
CHANGED
package/dist/_libs/ultrahtml.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { __exportAll, __toESM } from "../_common.mjs";
|
|
2
|
+
import { MagicString, createUnimport, getMagicString, importModule, isAbsolute as isAbsolute$2, isPackageExists, join as join$1, parse as parse$1, require_picomatch, resolve as resolve$1 } from "../_build/common.mjs";
|
|
3
|
+
import { walk } from "./estree-walker.mjs";
|
|
4
|
+
import { remapping } from "./remapping.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import fs, { promises } from "node:fs";
|
|
7
7
|
import path, { basename, dirname, extname, isAbsolute, normalize, resolve } from "node:path";
|
|
8
8
|
import process$1 from "node:process";
|
|
9
|
-
import { parseSync } from "rolldown/utils";
|
|
10
9
|
import { Buffer } from "node:buffer";
|
|
11
10
|
import * as querystring from "node:querystring";
|
|
12
11
|
function createEstreeDetector(parse) {
|
|
@@ -190,13 +189,24 @@ function createVirtualImports(importMap, virtualImports = []) {
|
|
|
190
189
|
};
|
|
191
190
|
}
|
|
192
191
|
var detect_acorn_exports = /* @__PURE__ */ __exportAll({ detectImportsAcorn: () => detectImportsAcorn });
|
|
193
|
-
const detectImportsAcorn = createEstreeDetector((code) => parse$
|
|
192
|
+
const detectImportsAcorn = createEstreeDetector((code) => parse$1(code, {
|
|
194
193
|
sourceType: "module",
|
|
195
194
|
ecmaVersion: "latest",
|
|
196
195
|
locations: true
|
|
197
196
|
}));
|
|
198
197
|
var detect_oxc_exports = /* @__PURE__ */ __exportAll({ detectImportsOxc: () => detectImportsOxc });
|
|
199
|
-
|
|
198
|
+
let detectorPromise;
|
|
199
|
+
async function loadDetector() {
|
|
200
|
+
let parseSync;
|
|
201
|
+
if (isPackageExists("rolldown")) parseSync = (await importModule("rolldown/utils")).parseSync;
|
|
202
|
+
else if (isPackageExists("oxc-parser")) parseSync = (await importModule("oxc-parser")).parseSync;
|
|
203
|
+
else throw new Error("[unimport] the `oxc` parser requires either `rolldown` or `oxc-parser` to be installed.");
|
|
204
|
+
return createEstreeDetector((code) => parseSync("", code, { sourceType: "module" }).program);
|
|
205
|
+
}
|
|
206
|
+
async function detectImportsOxc(code, ctx, options) {
|
|
207
|
+
detectorPromise ??= loadDetector();
|
|
208
|
+
return (await detectorPromise)(code, ctx, options);
|
|
209
|
+
}
|
|
200
210
|
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
201
211
|
function toArray$2(array) {
|
|
202
212
|
array = array || [];
|
|
@@ -1650,4 +1660,4 @@ const unplugin = createUnplugin((options = {}) => {
|
|
|
1650
1660
|
}
|
|
1651
1661
|
};
|
|
1652
1662
|
});
|
|
1653
|
-
export {
|
|
1663
|
+
export { detect_acorn_exports, detect_oxc_exports, unplugin_exports };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { MagicString } from "./magic-string.mjs";
|
|
2
|
+
import { ESMExport } from "./mlly.mjs";
|
|
3
3
|
//#region src/filter.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* A valid `picomatch` glob pattern, or array of patterns.
|
|
@@ -413,4 +413,4 @@ interface UnimportPluginOptions extends UnimportOptions {
|
|
|
413
413
|
*/
|
|
414
414
|
autoImport?: boolean;
|
|
415
415
|
}
|
|
416
|
-
export {
|
|
416
|
+
export { Unimport, type UnimportPluginOptions };
|
package/dist/_libs/unwasm.d.mts
CHANGED
package/dist/_presets.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { R, a, dirname as dirname$1, f, findFile, findNearestFile, glob, i, join as join$1, prettyPath as prettyPath$1, r, readGitConfig, readPackageJSON, relative as relative$1, resolve as resolve$1, resolveModulePath, v, writeFile as writeFile$2 } from "./_build/common.mjs";
|
|
2
|
+
import { formatCompatibilityDate, resolveCompatibilityDatesFromEnv } from "./_libs/compatx.mjs";
|
|
3
|
+
import { Router } from "./_chunks/nitro.mjs";
|
|
4
|
+
import { importDep } from "./_chunks/utils.mjs";
|
|
5
5
|
import { builtinModules } from "node:module";
|
|
6
6
|
import consola from "consola";
|
|
7
7
|
import { presetsDir, runtimeDir, version } from "nitro/meta";
|
|
@@ -223,11 +223,10 @@ async function writeSWARoutes(nitro) {
|
|
|
223
223
|
route: "/",
|
|
224
224
|
rewrite: "/api/server"
|
|
225
225
|
});
|
|
226
|
-
const suffix = 11;
|
|
227
226
|
for (const { fileName } of routeFiles) {
|
|
228
227
|
if (!fileName || !fileName.endsWith("/index.html")) continue;
|
|
229
228
|
config.routes.unshift({
|
|
230
|
-
route: fileName.slice(0, -
|
|
229
|
+
route: fileName.slice(0, -11) || "/",
|
|
231
230
|
rewrite: fileName
|
|
232
231
|
});
|
|
233
232
|
}
|
|
@@ -1486,7 +1485,7 @@ function generateBuildConfig(nitro, o11Routes) {
|
|
|
1486
1485
|
};
|
|
1487
1486
|
return {
|
|
1488
1487
|
src,
|
|
1489
|
-
dest: withLeadingSlash(normalizeRouteDest(key) +
|
|
1488
|
+
dest: withLeadingSlash(normalizeRouteDest(key) + `-isr?${ISR_URL_PARAM}=$${ISR_URL_PARAM}`)
|
|
1490
1489
|
};
|
|
1491
1490
|
}), ...nitro.options.vercel?.functionRules ? Object.keys(nitro.options.vercel.functionRules).map((pattern) => ({
|
|
1492
1491
|
src: joinURL(nitro.options.baseURL, normalizeRouteSrc(pattern)),
|
|
@@ -1617,96 +1616,123 @@ async function writePrerenderConfig(filename, isrConfig, bypassToken) {
|
|
|
1617
1616
|
if (prerenderConfig.allowQuery && !prerenderConfig.allowQuery.includes("__isr_route")) prerenderConfig.allowQuery.push(ISR_URL_PARAM);
|
|
1618
1617
|
await writeFile$1(filename, JSON.stringify(prerenderConfig, null, 2));
|
|
1619
1618
|
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
});
|
|
1658
|
-
|
|
1659
|
-
nitro.
|
|
1660
|
-
|
|
1619
|
+
async function vercelDevModule(nitro) {
|
|
1620
|
+
if (!nitro.options.dev) return;
|
|
1621
|
+
const triggers = nitro.options.vercel?.queues?.triggers;
|
|
1622
|
+
if (!triggers?.length) return;
|
|
1623
|
+
if (nitro.options.devServer.runner !== "vercel") throw new Error(`[vercel:queue] Local queue delivery requires the \`vercel\` dev runner, but \`devServer.runner\` is set to "${nitro.options.devServer.runner}". Remove the \`devServer.runner\` override in your \`nitro.config.ts\` or set it explicitly to \`"vercel"\`.`);
|
|
1624
|
+
nitro.options.runtimeConfig.vercel = {
|
|
1625
|
+
...nitro.options.runtimeConfig.vercel,
|
|
1626
|
+
queues: { triggers: triggers.map((t) => ({ ...t })) }
|
|
1627
|
+
};
|
|
1628
|
+
nitro.options.plugins = nitro.options.plugins || [];
|
|
1629
|
+
nitro.options.plugins.unshift(resolveModulePath("./vercel/runtime/queue.dev", {
|
|
1630
|
+
from: presetsDir,
|
|
1631
|
+
extensions: [".mjs", ".ts"]
|
|
1632
|
+
}));
|
|
1633
|
+
}
|
|
1634
|
+
var preset_default$4 = [
|
|
1635
|
+
defineNitroPreset({
|
|
1636
|
+
entry: "./vercel/runtime/vercel.{format}",
|
|
1637
|
+
manifest: { deploymentId: process.env.VERCEL_DEPLOYMENT_ID },
|
|
1638
|
+
vercel: {
|
|
1639
|
+
skewProtection: !!process.env.VERCEL_SKEW_PROTECTION_ENABLED,
|
|
1640
|
+
cronHandlerRoute: "/_vercel/cron"
|
|
1641
|
+
},
|
|
1642
|
+
output: {
|
|
1643
|
+
dir: "{{ rootDir }}/.vercel/output",
|
|
1644
|
+
serverDir: "{{ output.dir }}/functions/__server.func",
|
|
1645
|
+
publicDir: "{{ output.dir }}/static/{{ baseURL }}"
|
|
1646
|
+
},
|
|
1647
|
+
commands: {
|
|
1648
|
+
preview: "npx srvx --static ../../static ./functions/__server.func/index.mjs",
|
|
1649
|
+
deploy: "npx vercel deploy --prebuilt"
|
|
1650
|
+
},
|
|
1651
|
+
hooks: {
|
|
1652
|
+
"build:before": async (nitro) => {
|
|
1653
|
+
const logger = nitro.logger.withTag("vercel");
|
|
1654
|
+
const runtime = await resolveVercelRuntime(nitro);
|
|
1655
|
+
if (runtime.startsWith("bun") && !nitro.options.exportConditions.includes("bun")) nitro.options.exportConditions.push("bun");
|
|
1656
|
+
logger.info(`Using \`${runtime}\` runtime.`);
|
|
1657
|
+
let serverFormat = nitro.options.vercel?.entryFormat;
|
|
1658
|
+
if (!serverFormat) serverFormat = nitro.routing.routes.routes.flatMap((r) => r.data).some((h) => h.format === "node") ? "node" : "web";
|
|
1659
|
+
logger.info(`Using \`${serverFormat}\` entry format.`);
|
|
1660
|
+
nitro.options.entry = nitro.options.entry.replace("{format}", serverFormat);
|
|
1661
|
+
if (nitro.options.experimental.tasks && Object.keys(nitro.options.scheduledTasks || {}).length > 0) nitro.options.handlers.push({
|
|
1662
|
+
route: nitro.options.vercel.cronHandlerRoute || "/_vercel/cron",
|
|
1661
1663
|
lazy: true,
|
|
1662
|
-
handler: join$1(presetsDir, "vercel/runtime/
|
|
1664
|
+
handler: join$1(presetsDir, "vercel/runtime/cron-handler")
|
|
1663
1665
|
});
|
|
1664
|
-
const
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1666
|
+
const queues = nitro.options.vercel?.queues;
|
|
1667
|
+
if (queues?.triggers?.length) {
|
|
1668
|
+
await importDep({
|
|
1669
|
+
id: "@vercel/queue",
|
|
1670
|
+
dir: nitro.options.rootDir,
|
|
1671
|
+
reason: "Vercel Queues"
|
|
1672
|
+
});
|
|
1673
|
+
const handlerRoute = queues.handlerRoute || "/_vercel/queues/consumer";
|
|
1674
|
+
nitro.options.handlers.push({
|
|
1675
|
+
route: handlerRoute,
|
|
1676
|
+
lazy: true,
|
|
1677
|
+
handler: join$1(presetsDir, "vercel/runtime/queue-handler")
|
|
1678
|
+
});
|
|
1679
|
+
const queueTriggers = queues.triggers.map(({ topic, ...opts }) => ({
|
|
1680
|
+
type: "queue/v2beta",
|
|
1681
|
+
topic,
|
|
1682
|
+
...opts
|
|
1683
|
+
}));
|
|
1684
|
+
nitro.options.vercel ??= {};
|
|
1685
|
+
nitro.options.vercel.functionRules ??= {};
|
|
1686
|
+
const existingRule = nitro.options.vercel.functionRules[handlerRoute];
|
|
1687
|
+
nitro.options.vercel.functionRules[handlerRoute] = {
|
|
1688
|
+
...existingRule,
|
|
1689
|
+
experimentalTriggers: [...existingRule?.experimentalTriggers || [], ...queueTriggers]
|
|
1690
|
+
};
|
|
1691
|
+
}
|
|
1692
|
+
},
|
|
1693
|
+
"rollup:before": (nitro) => {
|
|
1694
|
+
deprecateSWR(nitro);
|
|
1695
|
+
},
|
|
1696
|
+
async compiled(nitro) {
|
|
1697
|
+
await generateFunctionFiles(nitro);
|
|
1676
1698
|
}
|
|
1677
|
-
},
|
|
1678
|
-
"rollup:before": (nitro) => {
|
|
1679
|
-
deprecateSWR(nitro);
|
|
1680
|
-
},
|
|
1681
|
-
async compiled(nitro) {
|
|
1682
|
-
await generateFunctionFiles(nitro);
|
|
1683
1699
|
}
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
},
|
|
1696
|
-
commands: { preview: "npx serve ./static" },
|
|
1697
|
-
hooks: {
|
|
1698
|
-
"rollup:before": (nitro) => {
|
|
1699
|
-
deprecateSWR(nitro);
|
|
1700
|
+
}, {
|
|
1701
|
+
name: "vercel",
|
|
1702
|
+
stdName: "vercel"
|
|
1703
|
+
}),
|
|
1704
|
+
defineNitroPreset({
|
|
1705
|
+
extends: "static",
|
|
1706
|
+
manifest: { deploymentId: process.env.VERCEL_DEPLOYMENT_ID },
|
|
1707
|
+
vercel: { skewProtection: !!process.env.VERCEL_SKEW_PROTECTION_ENABLED },
|
|
1708
|
+
output: {
|
|
1709
|
+
dir: "{{ rootDir }}/.vercel/output",
|
|
1710
|
+
publicDir: "{{ output.dir }}/static/{{ baseURL }}"
|
|
1700
1711
|
},
|
|
1701
|
-
|
|
1702
|
-
|
|
1712
|
+
commands: { preview: "npx serve ./static" },
|
|
1713
|
+
hooks: {
|
|
1714
|
+
"rollup:before": (nitro) => {
|
|
1715
|
+
deprecateSWR(nitro);
|
|
1716
|
+
},
|
|
1717
|
+
async compiled(nitro) {
|
|
1718
|
+
await generateStaticFiles(nitro);
|
|
1719
|
+
}
|
|
1703
1720
|
}
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1721
|
+
}, {
|
|
1722
|
+
name: "vercel-static",
|
|
1723
|
+
stdName: "vercel",
|
|
1724
|
+
static: true
|
|
1725
|
+
}),
|
|
1726
|
+
defineNitroPreset({
|
|
1727
|
+
extends: "nitro-dev",
|
|
1728
|
+
devServer: { runner: "vercel" },
|
|
1729
|
+
modules: [vercelDevModule]
|
|
1730
|
+
}, {
|
|
1731
|
+
name: "vercel-dev",
|
|
1732
|
+
aliases: ["vercel"],
|
|
1733
|
+
dev: true
|
|
1734
|
+
})
|
|
1735
|
+
];
|
|
1710
1736
|
var preset_default$3 = [defineNitroPreset({
|
|
1711
1737
|
extends: "base-worker",
|
|
1712
1738
|
entry: "./winterjs/runtime/winterjs",
|
package/dist/builder.d.mts
CHANGED
package/dist/builder.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { build, copyPublicAssets, getBuildInfo, prepare, writeTypes } from "./_build/common.mjs";
|
|
2
|
+
import { createNitro, listTasks, loadOptions, prerender, runTask } from "./_chunks/nitro.mjs";
|
|
3
|
+
import { createDevServer } from "./_dev.mjs";
|
|
4
4
|
export { build, copyPublicAssets, createDevServer, createNitro, getBuildInfo, listTasks, loadOptions, prepare, prerender, runTask, writeTypes };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { resolve } from "../../_build/common.mjs";
|
|
2
|
+
import { defineCommand } from "../../_libs/citty.mjs";
|
|
3
|
+
import { commonArgs } from "./common.mjs";
|
|
4
4
|
import { build, copyPublicAssets, createNitro, prepare, prerender } from "nitro/builder";
|
|
5
5
|
const buildArgs = {
|
|
6
6
|
...commonArgs,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getBuildInfo, relative, resolve } from "../../_build/common.mjs";
|
|
2
|
+
import { defineCommand } from "../../_libs/citty.mjs";
|
|
3
3
|
import build_default, { buildArgs } from "./build.mjs";
|
|
4
4
|
import consola from "consola";
|
|
5
5
|
import { execSync } from "node:child_process";
|
package/dist/cli/_chunks/dev.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { resolve } from "../../_build/common.mjs";
|
|
2
|
+
import { NitroDevServer } from "../../_dev.mjs";
|
|
3
|
+
import { defineCommand } from "../../_libs/citty.mjs";
|
|
4
|
+
import { commonArgs } from "./common.mjs";
|
|
5
5
|
import { consola as consola$1 } from "consola";
|
|
6
6
|
import { build, createNitro, prepare } from "nitro/builder";
|
|
7
7
|
const hmrKeyRe = /^runtimeConfig\.|routeRules\./;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { resolve } from "../../_build/common.mjs";
|
|
2
|
+
import { defineCommand } from "../../_libs/citty.mjs";
|
|
3
3
|
import { consola as consola$1 } from "consola";
|
|
4
4
|
import { listTasks, loadOptions } from "nitro/builder";
|
|
5
5
|
var list_default = defineCommand({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { resolve } from "../../_build/common.mjs";
|
|
2
|
+
import { defineCommand } from "../../_libs/citty.mjs";
|
|
3
|
+
import { commonArgs } from "./common.mjs";
|
|
4
4
|
import { createNitro, writeTypes } from "nitro/builder";
|
|
5
5
|
var prepare_default = defineCommand({
|
|
6
6
|
meta: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { resolve } from "../../_build/common.mjs";
|
|
2
|
+
import { defineCommand } from "../../_libs/citty.mjs";
|
|
3
|
+
import { startPreview } from "../../_chunks/nitro2.mjs";
|
|
4
|
+
import { commonArgs } from "./common.mjs";
|
|
5
5
|
import { serve } from "srvx";
|
|
6
6
|
import { log } from "srvx/log";
|
|
7
7
|
var preview_default = defineCommand({
|
package/dist/cli/_chunks/run.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { resolve } from "../../_build/common.mjs";
|
|
2
|
+
import { defineCommand } from "../../_libs/citty.mjs";
|
|
3
3
|
import { consola as consola$1 } from "consola";
|
|
4
4
|
import destr from "destr";
|
|
5
5
|
import { loadOptions, runTask } from "nitro/builder";
|