@vercel/next 2.9.1-canary.0 → 3.0.0
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/edge-function-source/get-edge-function.js +4 -6
- package/dist/index.js +49565 -6
- package/dist/server-build.js +13 -12
- package/dist/sourcemapped.js +1 -1
- package/dist/utils.js +37 -42
- package/package.json +4 -4
@@ -10,27 +10,25 @@ const to_plain_headers_1 = require("./to-plain-headers");
|
|
10
10
|
* to avoid recomputing them for each function invocation.
|
11
11
|
*/
|
12
12
|
function getNextjsEdgeFunction(params) {
|
13
|
-
var _a;
|
14
13
|
const staticRoutes = params.staticRoutes.map(route => ({
|
15
14
|
regexp: new RegExp(route.namedRegex),
|
16
15
|
page: route.page,
|
17
16
|
}));
|
18
|
-
const dynamicRoutes =
|
17
|
+
const dynamicRoutes = params.dynamicRoutes?.map(route => ({
|
19
18
|
regexp: new RegExp(route.namedRegex),
|
20
19
|
page: route.page,
|
21
|
-
}))
|
20
|
+
})) || [];
|
22
21
|
return async function edgeFunction(request, context) {
|
23
|
-
var _a, _b;
|
24
22
|
let pathname = new URL(request.url).pathname;
|
25
23
|
let pageMatch = {};
|
26
24
|
// Remove the basePath from the URL
|
27
|
-
if (
|
25
|
+
if (params.nextConfig?.basePath) {
|
28
26
|
if (pathname.startsWith(params.nextConfig.basePath)) {
|
29
27
|
pathname = pathname.replace(params.nextConfig.basePath, '') || '/';
|
30
28
|
}
|
31
29
|
}
|
32
30
|
// Remove the locale from the URL
|
33
|
-
if (
|
31
|
+
if (params.nextConfig?.i18n) {
|
34
32
|
for (const locale of params.nextConfig.i18n.locales) {
|
35
33
|
const regexp = new RegExp(`^/${locale}($|/)`, 'i');
|
36
34
|
if (pathname.match(regexp)) {
|