@edgeone/opennextjs-pages 0.2.6 → 0.2.8
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/routes.js
CHANGED
|
@@ -103,7 +103,6 @@ function getServerRoutes(staticRoutes, prerenderManifest, basePath = "") {
|
|
|
103
103
|
if (route.namedRegex) {
|
|
104
104
|
let src = convertNamedRegexToSrc(route.namedRegex, basePath);
|
|
105
105
|
if (src) {
|
|
106
|
-
src = src.replace(/\(\?:\/\)\?\$$/, "$");
|
|
107
106
|
routes.push({ src });
|
|
108
107
|
}
|
|
109
108
|
} else if (route.regex) {
|
|
@@ -112,28 +111,51 @@ function getServerRoutes(staticRoutes, prerenderManifest, basePath = "") {
|
|
|
112
111
|
if (basePath && !src.startsWith(`^${basePath}`)) {
|
|
113
112
|
src = src.replace(/^\^/, `^${basePath}`);
|
|
114
113
|
}
|
|
115
|
-
src = src.replace(/\(\?:\/\)\?\$$/, "$");
|
|
116
114
|
routes.push({ src });
|
|
117
115
|
}
|
|
118
116
|
}
|
|
119
117
|
}
|
|
120
118
|
return routes;
|
|
121
119
|
}
|
|
122
|
-
function
|
|
120
|
+
function getAppRoutes(appPathsManifest, basePath = "", existingPaths = /* @__PURE__ */ new Set()) {
|
|
123
121
|
if (!appPathsManifest) {
|
|
124
122
|
return [];
|
|
125
123
|
}
|
|
126
124
|
const routes = [];
|
|
125
|
+
const emitted = /* @__PURE__ */ new Set();
|
|
127
126
|
for (const routePath of Object.keys(appPathsManifest)) {
|
|
128
|
-
if (routePath.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
127
|
+
if (routePath.startsWith("/_")) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
let pagePath;
|
|
131
|
+
if (routePath.endsWith("/route")) {
|
|
132
|
+
pagePath = routePath.replace(/\/route$/, "");
|
|
133
|
+
} else if (routePath.endsWith("/page")) {
|
|
134
|
+
pagePath = routePath.replace(/\/page$/, "") || "/";
|
|
135
|
+
} else {
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
pagePath = pagePath.replace(/\/\([^)]+\)/g, "");
|
|
139
|
+
if (!pagePath) pagePath = "/";
|
|
140
|
+
if (pagePath.includes("@")) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (pagePath.includes("[")) {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (pagePath === "/") {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (existingPaths.has(pagePath)) {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (emitted.has(pagePath)) {
|
|
153
|
+
continue;
|
|
136
154
|
}
|
|
155
|
+
emitted.add(pagePath);
|
|
156
|
+
const escapedPath = pagePath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
157
|
+
const src = `^${basePath}${escapedPath}(?:/)?$`;
|
|
158
|
+
routes.push({ src });
|
|
137
159
|
}
|
|
138
160
|
return routes;
|
|
139
161
|
}
|
|
@@ -345,9 +367,10 @@ var createRouteMeta = async (ctx) => {
|
|
|
345
367
|
if (dataRoutes.length > 0) {
|
|
346
368
|
routes.push(...getDataRoutes(dataRoutes, basePath));
|
|
347
369
|
}
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
370
|
+
const existingPaths = new Set(staticRoutes.map((r) => r.page));
|
|
371
|
+
const appRoutes = getAppRoutes(appPathsManifest, basePath, existingPaths);
|
|
372
|
+
if (appRoutes.length > 0) {
|
|
373
|
+
routes.push(...appRoutes);
|
|
351
374
|
}
|
|
352
375
|
routes.push({
|
|
353
376
|
src: `^${basePath}/.*$`
|
|
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(tags_handler_exports);
|
|
|
28
28
|
|
|
29
29
|
// package.json
|
|
30
30
|
var name = "@edgeone/opennextjs-pages";
|
|
31
|
-
var version = "0.2.
|
|
31
|
+
var version = "0.2.7";
|
|
32
32
|
|
|
33
33
|
// src/run/handlers/tags-handler.cts
|
|
34
34
|
var import_request_context = require("./request-context.cjs");
|