vite-plugin-vercel 11.0.0-beta.10 → 11.0.0-beta.12
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/index.js +1 -1
- package/dist/vite.js +9 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ async function getVercelEntries(dir, { destination = dir, tryParseExports = true
|
|
|
31
31
|
if (xports?.isr) entry.vercel.isr = xports.isr;
|
|
32
32
|
if (xports?.headers) entry.vercel.headers = xports.headers;
|
|
33
33
|
if (xports?.streaming) entry.vercel.streaming = xports.streaming;
|
|
34
|
-
entry.
|
|
34
|
+
entry.route = entryToRou3(key);
|
|
35
35
|
if (key.includes("[...")) entry.vercel.enforce = "post";
|
|
36
36
|
entryPoints.push(entry);
|
|
37
37
|
}
|
package/dist/vite.js
CHANGED
|
@@ -6,7 +6,7 @@ import { vercelOutputConfigSchema, vercelOutputPrerenderConfigSchema, vercelOutp
|
|
|
6
6
|
import { fromRou3 } from "convert-route/rou3";
|
|
7
7
|
import { BuildEnvironment, createRunnableDevEnvironment, mergeConfig, normalizePath } from "vite";
|
|
8
8
|
import { catchAll, devServer } from "@universal-deploy/store/vite";
|
|
9
|
-
import {
|
|
9
|
+
import { addEntry, getAllEntries } from "@universal-deploy/store";
|
|
10
10
|
import fs, { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
11
11
|
import { copyFile, cp, rmdir, unlink } from "node:fs/promises";
|
|
12
12
|
import { findRoot } from "@manypkg/find-root";
|
|
@@ -37,17 +37,17 @@ function getBuildEnvNames(pluginConfig) {
|
|
|
37
37
|
*/
|
|
38
38
|
function dedupeRoutes() {
|
|
39
39
|
const entriesToKeep = [];
|
|
40
|
-
const entriesGroupedByModuleId = groupBy(
|
|
40
|
+
const entriesGroupedByModuleId = groupBy(getAllEntries(), (e) => e.id);
|
|
41
41
|
for (const entries of entriesGroupedByModuleId.values()) {
|
|
42
42
|
let groupedEntry;
|
|
43
43
|
for (const entry of entries) if (entry.vercel && Object.keys(entry.vercel).length > 0) {
|
|
44
|
-
if (!Array.isArray(entry.
|
|
44
|
+
if (!Array.isArray(entry.route)) entry.route = [entry.route];
|
|
45
45
|
entriesToKeep.push(entry);
|
|
46
46
|
} else if (!groupedEntry) {
|
|
47
47
|
groupedEntry = structuredClone(entry);
|
|
48
|
-
if (!Array.isArray(groupedEntry.
|
|
48
|
+
if (!Array.isArray(groupedEntry.route)) groupedEntry.route = [groupedEntry.route];
|
|
49
49
|
entriesToKeep.push(groupedEntry);
|
|
50
|
-
} else groupedEntry.
|
|
50
|
+
} else groupedEntry.route.push(...[entry.route].flat());
|
|
51
51
|
}
|
|
52
52
|
return entriesToKeep;
|
|
53
53
|
}
|
|
@@ -661,7 +661,7 @@ export default def;`;
|
|
|
661
661
|
source: JSON.stringify(vercelOutputPrerenderConfigSchema.parse(entry.vercel.isr), void 0, 2)
|
|
662
662
|
});
|
|
663
663
|
pluginConfig.rewrites ??= [];
|
|
664
|
-
for (const ir of sortRoutes([entry.
|
|
664
|
+
for (const ir of sortRoutes([entry.route].flat().map((p) => fromRou3(p)))) {
|
|
665
665
|
const source = toPathToRegexpV6(ir);
|
|
666
666
|
pluginConfig.rewrites.push({
|
|
667
667
|
enforce: entry.vercel?.enforce,
|
|
@@ -787,7 +787,9 @@ function setupEnvs(pluginConfig) {
|
|
|
787
787
|
handler() {
|
|
788
788
|
if (!injected) {
|
|
789
789
|
injected = true;
|
|
790
|
-
if (pluginConfig.entries)
|
|
790
|
+
if (pluginConfig.entries) pluginConfig.entries.forEach((entry) => {
|
|
791
|
+
addEntry(entry);
|
|
792
|
+
});
|
|
791
793
|
}
|
|
792
794
|
const outDirOverride = pluginConfig.outDir ? { build: { outDir: pluginConfig.outDir } } : {};
|
|
793
795
|
const environments = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-vercel",
|
|
3
|
-
"version": "11.0.0-beta.
|
|
3
|
+
"version": "11.0.0-beta.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@manypkg/find-root": "^3.1.0",
|
|
36
|
-
"@universal-deploy/store": "^0.0.
|
|
36
|
+
"@universal-deploy/store": "^0.0.8-beta.1",
|
|
37
37
|
"@universal-middleware/core": "^0.4.13",
|
|
38
38
|
"@universal-middleware/vercel": "^0.4.29",
|
|
39
39
|
"@vercel/build-utils": "^13.2.3",
|