vite-plugin-vercel 11.0.0 → 11.0.2
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/api-DQ9HQe2a.js +68 -0
- package/dist/api.js +2 -65
- package/dist/index.js +2 -4
- package/dist/{path-DoLvGKnz.js → path-CzW38gOA.js} +1 -3
- package/dist/types.js +1 -1
- package/dist/vite.js +3 -23
- package/package.json +21 -21
- package/dist/assert-vtiLgQIb.js +0 -8
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//#region src/utils/assert.ts
|
|
2
|
+
function assert(condition, errorMessage) {
|
|
3
|
+
if (condition) return;
|
|
4
|
+
throw new Error(`[vite-plugin-vercel] ${errorMessage}`);
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/api.ts
|
|
8
|
+
function createAPI(outfiles, pluginConfig) {
|
|
9
|
+
return {
|
|
10
|
+
getOutFiles() {
|
|
11
|
+
return outfiles;
|
|
12
|
+
},
|
|
13
|
+
get config() {
|
|
14
|
+
pluginConfig.config ??= {};
|
|
15
|
+
return pluginConfig.config;
|
|
16
|
+
},
|
|
17
|
+
get defaultMaxDuration() {
|
|
18
|
+
return pluginConfig.defaultMaxDuration;
|
|
19
|
+
},
|
|
20
|
+
set defaultMaxDuration(value) {
|
|
21
|
+
pluginConfig.defaultMaxDuration = value;
|
|
22
|
+
},
|
|
23
|
+
get expiration() {
|
|
24
|
+
return pluginConfig.expiration;
|
|
25
|
+
},
|
|
26
|
+
set expiration(value) {
|
|
27
|
+
pluginConfig.expiration = value;
|
|
28
|
+
},
|
|
29
|
+
get rewrites() {
|
|
30
|
+
pluginConfig.rewrites ??= [];
|
|
31
|
+
return pluginConfig.rewrites;
|
|
32
|
+
},
|
|
33
|
+
get headers() {
|
|
34
|
+
pluginConfig.headers ??= [];
|
|
35
|
+
return pluginConfig.headers;
|
|
36
|
+
},
|
|
37
|
+
get redirects() {
|
|
38
|
+
pluginConfig.redirects ??= [];
|
|
39
|
+
return pluginConfig.redirects;
|
|
40
|
+
},
|
|
41
|
+
get cleanUrls() {
|
|
42
|
+
return pluginConfig.cleanUrls;
|
|
43
|
+
},
|
|
44
|
+
set cleanUrls(value) {
|
|
45
|
+
pluginConfig.cleanUrls = value;
|
|
46
|
+
},
|
|
47
|
+
get trailingSlash() {
|
|
48
|
+
return pluginConfig.trailingSlash;
|
|
49
|
+
},
|
|
50
|
+
set trailingSlash(value) {
|
|
51
|
+
pluginConfig.trailingSlash = value;
|
|
52
|
+
},
|
|
53
|
+
get defaultSupportsResponseStreaming() {
|
|
54
|
+
return pluginConfig.defaultSupportsResponseStreaming;
|
|
55
|
+
},
|
|
56
|
+
set defaultSupportsResponseStreaming(value) {
|
|
57
|
+
pluginConfig.defaultSupportsResponseStreaming = value;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function getVercelAPI(pluginContextOrServer) {
|
|
62
|
+
const vpv = ("environment" in pluginContextOrServer ? pluginContextOrServer.environment.config : pluginContextOrServer.config).plugins.find((p) => p.name === "vite-plugin-vercel:api");
|
|
63
|
+
assert(vpv, "Could not find vite-plugin-vercel:api plugin");
|
|
64
|
+
assert(vpv.api, "Missing `api`. Make sure vite-plugin-vercel is up-to-date");
|
|
65
|
+
return vpv.api("environment" in pluginContextOrServer ? pluginContextOrServer : void 0);
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { getVercelAPI as n, assert as r, createAPI as t };
|
package/dist/api.js
CHANGED
|
@@ -1,65 +1,2 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
|
|
3
|
-
//#region src/api.ts
|
|
4
|
-
function createAPI(outfiles, pluginConfig) {
|
|
5
|
-
return {
|
|
6
|
-
getOutFiles() {
|
|
7
|
-
return outfiles;
|
|
8
|
-
},
|
|
9
|
-
get config() {
|
|
10
|
-
pluginConfig.config ??= {};
|
|
11
|
-
return pluginConfig.config;
|
|
12
|
-
},
|
|
13
|
-
get defaultMaxDuration() {
|
|
14
|
-
return pluginConfig.defaultMaxDuration;
|
|
15
|
-
},
|
|
16
|
-
set defaultMaxDuration(value) {
|
|
17
|
-
pluginConfig.defaultMaxDuration = value;
|
|
18
|
-
},
|
|
19
|
-
get expiration() {
|
|
20
|
-
return pluginConfig.expiration;
|
|
21
|
-
},
|
|
22
|
-
set expiration(value) {
|
|
23
|
-
pluginConfig.expiration = value;
|
|
24
|
-
},
|
|
25
|
-
get rewrites() {
|
|
26
|
-
pluginConfig.rewrites ??= [];
|
|
27
|
-
return pluginConfig.rewrites;
|
|
28
|
-
},
|
|
29
|
-
get headers() {
|
|
30
|
-
pluginConfig.headers ??= [];
|
|
31
|
-
return pluginConfig.headers;
|
|
32
|
-
},
|
|
33
|
-
get redirects() {
|
|
34
|
-
pluginConfig.redirects ??= [];
|
|
35
|
-
return pluginConfig.redirects;
|
|
36
|
-
},
|
|
37
|
-
get cleanUrls() {
|
|
38
|
-
return pluginConfig.cleanUrls;
|
|
39
|
-
},
|
|
40
|
-
set cleanUrls(value) {
|
|
41
|
-
pluginConfig.cleanUrls = value;
|
|
42
|
-
},
|
|
43
|
-
get trailingSlash() {
|
|
44
|
-
return pluginConfig.trailingSlash;
|
|
45
|
-
},
|
|
46
|
-
set trailingSlash(value) {
|
|
47
|
-
pluginConfig.trailingSlash = value;
|
|
48
|
-
},
|
|
49
|
-
get defaultSupportsResponseStreaming() {
|
|
50
|
-
return pluginConfig.defaultSupportsResponseStreaming;
|
|
51
|
-
},
|
|
52
|
-
set defaultSupportsResponseStreaming(value) {
|
|
53
|
-
pluginConfig.defaultSupportsResponseStreaming = value;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function getVercelAPI(pluginContextOrServer) {
|
|
58
|
-
const vpv = ("environment" in pluginContextOrServer ? pluginContextOrServer.environment.config : pluginContextOrServer.config).plugins.find((p) => p.name === "vite-plugin-vercel:api");
|
|
59
|
-
assert(vpv, "Could not find vite-plugin-vercel:api plugin");
|
|
60
|
-
assert(vpv.api, "Missing `api`. Make sure vite-plugin-vercel is up-to-date");
|
|
61
|
-
return vpv.api("environment" in pluginContextOrServer ? pluginContextOrServer : void 0);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
//#endregion
|
|
65
|
-
export { createAPI, getVercelAPI };
|
|
1
|
+
import { n as getVercelAPI, t as createAPI } from "./api-DQ9HQe2a.js";
|
|
2
|
+
export { createAPI, getVercelAPI };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as pathRelativeTo } from "./path-
|
|
1
|
+
import { t as pathRelativeTo } from "./path-CzW38gOA.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { vercelEndpointExports } from "@vite-plugin-vercel/schemas";
|
|
4
4
|
import { fromNextFs } from "convert-route/next-fs";
|
|
@@ -6,7 +6,6 @@ import { toRou3 } from "convert-route/rou3";
|
|
|
6
6
|
import glob from "fast-glob";
|
|
7
7
|
import { generateCode, loadFile } from "magicast";
|
|
8
8
|
import { normalizePath } from "vite";
|
|
9
|
-
|
|
10
9
|
//#region src/index.ts
|
|
11
10
|
/**
|
|
12
11
|
* Scans the filesystem for entry points.
|
|
@@ -65,6 +64,5 @@ function evalExport(exp) {
|
|
|
65
64
|
if (!exp) return;
|
|
66
65
|
return _eval(isPrimitive(exp) ? exp : generateCode(exp).code);
|
|
67
66
|
}
|
|
68
|
-
|
|
69
67
|
//#endregion
|
|
70
|
-
export { extractExports, getVercelEntries };
|
|
68
|
+
export { extractExports, getVercelEntries };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { normalizePath } from "vite";
|
|
3
|
-
|
|
4
3
|
//#region src/utils/path.ts
|
|
5
4
|
function pathRelativeTo(filePath, rel) {
|
|
6
5
|
return normalizePath(path.relative(normalizePath(path.resolve(rel)), path.resolve(filePath)));
|
|
7
6
|
}
|
|
8
|
-
|
|
9
7
|
//#endregion
|
|
10
|
-
export { pathRelativeTo as t };
|
|
8
|
+
export { pathRelativeTo as t };
|
package/dist/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
package/dist/vite.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t as pathRelativeTo$1 } from "./path-
|
|
2
|
-
import {
|
|
3
|
-
import { createAPI, getVercelAPI } from "./api.js";
|
|
1
|
+
import { t as pathRelativeTo$1 } from "./path-CzW38gOA.js";
|
|
2
|
+
import { n as getVercelAPI, r as assert, t as createAPI } from "./api-DQ9HQe2a.js";
|
|
4
3
|
import { builtinModules } from "node:module";
|
|
5
4
|
import path from "node:path";
|
|
6
5
|
import { vercelOutputConfigSchema, vercelOutputPrerenderConfigSchema, vercelOutputVcConfigSchema } from "@vite-plugin-vercel/schemas";
|
|
@@ -20,7 +19,6 @@ import pLimit from "p-limit";
|
|
|
20
19
|
import { getNodeVersion } from "@vercel/build-utils";
|
|
21
20
|
import { toPathToRegexpV6 } from "convert-route/path-to-regexp-v6";
|
|
22
21
|
import { getTransformedRoutes, mergeRoutes, normalizeRoutes } from "@vercel/routing-utils";
|
|
23
|
-
|
|
24
22
|
//#region src/utils/buildEnvs.ts
|
|
25
23
|
function getBuildEnvNames(pluginConfig) {
|
|
26
24
|
return {
|
|
@@ -29,7 +27,6 @@ function getBuildEnvNames(pluginConfig) {
|
|
|
29
27
|
node: pluginConfig.viteEnvNames?.node ?? "vercel_node"
|
|
30
28
|
};
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
//#endregion
|
|
34
31
|
//#region src/utils/dedupeRoutes.ts
|
|
35
32
|
/**
|
|
@@ -106,13 +103,11 @@ function groupBy(list, fn, selector) {
|
|
|
106
103
|
return acc;
|
|
107
104
|
}, /* @__PURE__ */ new Map());
|
|
108
105
|
}
|
|
109
|
-
|
|
110
106
|
//#endregion
|
|
111
107
|
//#region src/utils/extension.ts
|
|
112
108
|
function removeExtension$1(subject) {
|
|
113
109
|
return subject.replace(/\.[^/.]+$/, "");
|
|
114
110
|
}
|
|
115
|
-
|
|
116
111
|
//#endregion
|
|
117
112
|
//#region src/utils/destination.ts
|
|
118
113
|
function parseViteId(id) {
|
|
@@ -149,7 +144,6 @@ function entryDestinationDefault(root, entry) {
|
|
|
149
144
|
function entryDestination(root, entry, postfix) {
|
|
150
145
|
return `${path.posix.join("functions/", entryDestinationDefault(root, entry))}${postfix}`;
|
|
151
146
|
}
|
|
152
|
-
|
|
153
147
|
//#endregion
|
|
154
148
|
//#region src/plugins/api.ts
|
|
155
149
|
function apiPlugin(pluginConfig) {
|
|
@@ -183,7 +177,6 @@ function apiPlugin(pluginConfig) {
|
|
|
183
177
|
sharedDuringBuild: true
|
|
184
178
|
};
|
|
185
179
|
}
|
|
186
|
-
|
|
187
180
|
//#endregion
|
|
188
181
|
//#region src/utils/edge.ts
|
|
189
182
|
const edgeConditions = [
|
|
@@ -194,7 +187,6 @@ const edgeConditions = [
|
|
|
194
187
|
"import",
|
|
195
188
|
"default"
|
|
196
189
|
];
|
|
197
|
-
|
|
198
190
|
//#endregion
|
|
199
191
|
//#region src/utils/external.ts
|
|
200
192
|
const _external = [
|
|
@@ -205,7 +197,6 @@ const _external = [
|
|
|
205
197
|
"util"
|
|
206
198
|
];
|
|
207
199
|
const edgeExternal = [..._external, ..._external.map((e) => `node:${e}`)];
|
|
208
|
-
|
|
209
200
|
//#endregion
|
|
210
201
|
//#region src/plugins/bundle/basic.ts
|
|
211
202
|
const builtIns = new Set(builtinModules.flatMap((m) => [m, `node:${m}`]));
|
|
@@ -388,7 +379,6 @@ async function cleanup$1(filesToKeep, bundledChunks) {
|
|
|
388
379
|
await rmdir(dir);
|
|
389
380
|
} catch {}
|
|
390
381
|
}
|
|
391
|
-
|
|
392
382
|
//#endregion
|
|
393
383
|
//#region src/plugins/bundle/nf3.ts
|
|
394
384
|
function nf3BundlePlugin(pluginConfig) {
|
|
@@ -494,7 +484,6 @@ function pathRelativeTo(filePath, rel) {
|
|
|
494
484
|
function removeExtension(subject) {
|
|
495
485
|
return subject.replace(/\.[^/.]+$/, "");
|
|
496
486
|
}
|
|
497
|
-
|
|
498
487
|
//#endregion
|
|
499
488
|
//#region src/plugins/clean-outdir.ts
|
|
500
489
|
const outDir$1 = path.posix.join(process.cwd(), ".vercel/output");
|
|
@@ -523,7 +512,6 @@ function cleanOutputDirectory(outdir) {
|
|
|
523
512
|
});
|
|
524
513
|
fs.mkdirSync(outdir, { recursive: true });
|
|
525
514
|
}
|
|
526
|
-
|
|
527
515
|
//#endregion
|
|
528
516
|
//#region src/build.ts
|
|
529
517
|
function getVcConfig(pluginConfig, filename, options) {
|
|
@@ -539,7 +527,6 @@ function getVcConfig(pluginConfig, filename, options) {
|
|
|
539
527
|
supportsResponseStreaming: options.streaming ?? pluginConfig.defaultSupportsResponseStreaming ?? true
|
|
540
528
|
});
|
|
541
529
|
}
|
|
542
|
-
|
|
543
530
|
//#endregion
|
|
544
531
|
//#region src/utils/request.ts
|
|
545
532
|
function getOriginalRequest(request) {
|
|
@@ -560,7 +547,6 @@ function getOriginalRequest(request) {
|
|
|
560
547
|
});
|
|
561
548
|
return newRequest;
|
|
562
549
|
}
|
|
563
|
-
|
|
564
550
|
//#endregion
|
|
565
551
|
//#region src/plugins/loader.ts
|
|
566
552
|
const re_DUMMY = new RegExp(`__DUMMY__$`);
|
|
@@ -717,7 +703,6 @@ export default def;`;
|
|
|
717
703
|
}
|
|
718
704
|
];
|
|
719
705
|
}
|
|
720
|
-
|
|
721
706
|
//#endregion
|
|
722
707
|
//#region src/plugins/react-edge.ts
|
|
723
708
|
function reactEdgePlugin(pluginConfig) {
|
|
@@ -736,7 +721,6 @@ function reactEdgePlugin(pluginConfig) {
|
|
|
736
721
|
}
|
|
737
722
|
};
|
|
738
723
|
}
|
|
739
|
-
|
|
740
724
|
//#endregion
|
|
741
725
|
//#region src/config.ts
|
|
742
726
|
function reorderEnforce(arr) {
|
|
@@ -793,11 +777,9 @@ function getConfig(pluginConfig) {
|
|
|
793
777
|
overrides: { ...pluginConfig.config?.overrides }
|
|
794
778
|
});
|
|
795
779
|
}
|
|
796
|
-
|
|
797
780
|
//#endregion
|
|
798
781
|
//#region src/utils/const.ts
|
|
799
782
|
const virtualEntry = "virtual:vite-plugin-vercel:entry";
|
|
800
|
-
|
|
801
783
|
//#endregion
|
|
802
784
|
//#region src/plugins/setupEnvs.ts
|
|
803
785
|
const outDir = path.posix.join(process.cwd(), ".vercel/output");
|
|
@@ -970,7 +952,6 @@ function cleanupDummy(bundle) {
|
|
|
970
952
|
const dummy = Object.keys(bundle).find((key) => key.includes("_DUMMY_"));
|
|
971
953
|
if (dummy) delete bundle[dummy];
|
|
972
954
|
}
|
|
973
|
-
|
|
974
955
|
//#endregion
|
|
975
956
|
//#region src/plugins/index.ts
|
|
976
957
|
function vercel(pluginConfig = {}) {
|
|
@@ -985,6 +966,5 @@ function vercel(pluginConfig = {}) {
|
|
|
985
966
|
devServer()
|
|
986
967
|
];
|
|
987
968
|
}
|
|
988
|
-
|
|
989
969
|
//#endregion
|
|
990
|
-
export { vercel as default, vercel };
|
|
970
|
+
export { vercel as default, vercel };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-vercel",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -23,34 +23,34 @@
|
|
|
23
23
|
"vite": ">=7.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/node": "^22.19.
|
|
27
|
-
"@universal-middleware/express": "^0.4.
|
|
28
|
-
"@vercel/node": "^5.
|
|
29
|
-
"tsdown": "^0.
|
|
26
|
+
"@types/node": "^22.19.15",
|
|
27
|
+
"@universal-middleware/express": "^0.4.26",
|
|
28
|
+
"@vercel/node": "^5.6.16",
|
|
29
|
+
"tsdown": "^0.21.4",
|
|
30
30
|
"typescript": "^5.9.3",
|
|
31
|
-
"vite": "^7.
|
|
32
|
-
"vitest": "^4.0
|
|
31
|
+
"vite": "^7.3.1",
|
|
32
|
+
"vitest": "^4.1.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@manypkg/find-root": "^3.1.0",
|
|
36
36
|
"@universal-deploy/store": "^0.2.0",
|
|
37
37
|
"@universal-deploy/vite": "^0.1.0",
|
|
38
|
-
"@universal-middleware/core": "^0.4.
|
|
39
|
-
"@universal-middleware/vercel": "^0.4.
|
|
40
|
-
"@vercel/build-utils": "^13.
|
|
41
|
-
"@vercel/nft": "^1.2
|
|
42
|
-
"@vercel/routing-utils": "^
|
|
43
|
-
"convert-route": "^1.
|
|
38
|
+
"@universal-middleware/core": "^0.4.17",
|
|
39
|
+
"@universal-middleware/vercel": "^0.4.31",
|
|
40
|
+
"@vercel/build-utils": "^13.8.1",
|
|
41
|
+
"@vercel/nft": "^1.3.2",
|
|
42
|
+
"@vercel/routing-utils": "^6.0.2",
|
|
43
|
+
"convert-route": "^1.1.1",
|
|
44
44
|
"fast-glob": "^3.3.3",
|
|
45
|
-
"magicast": "^0.5.
|
|
46
|
-
"nf3": "^0.3.
|
|
47
|
-
"oxc-transform": "^0.
|
|
48
|
-
"p-limit": "^7.
|
|
45
|
+
"magicast": "^0.5.2",
|
|
46
|
+
"nf3": "^0.3.11",
|
|
47
|
+
"oxc-transform": "^0.120.0",
|
|
48
|
+
"p-limit": "^7.3.0",
|
|
49
49
|
"path-to-regexp": "^8.3.0",
|
|
50
|
-
"rolldown": "^1.0.0-rc.
|
|
51
|
-
"strip-ansi": "^7.
|
|
52
|
-
"vite-plugin-wasm": "^3.
|
|
53
|
-
"@vite-plugin-vercel/schemas": "^1.
|
|
50
|
+
"rolldown": "^1.0.0-rc.9",
|
|
51
|
+
"strip-ansi": "^7.2.0",
|
|
52
|
+
"vite-plugin-wasm": "^3.6.0",
|
|
53
|
+
"@vite-plugin-vercel/schemas": "^1.1.0"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"dev": "tsdown --watch",
|