@edgeone/opennextjs-pages 0.2.5 → 0.2.6

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.
@@ -214,7 +214,7 @@ var PluginContext = class {
214
214
  async getPagesManifest() {
215
215
  return JSON.parse(await readFile(join(this.publishDir, "server/pages-manifest.json"), "utf-8"));
216
216
  }
217
- // 获取 next api manifest
217
+ // 获取 next api manifest
218
218
  async getAppPathRoutesManifest() {
219
219
  const manifestPath = join(this.publishDir, "app-path-routes-manifest.json");
220
220
  try {
@@ -226,6 +226,17 @@ var PluginContext = class {
226
226
  return {};
227
227
  }
228
228
  }
229
+ async getAppPathsManifest() {
230
+ const manifestPath = join(this.publishDir, "server/app-paths-manifest.json");
231
+ try {
232
+ if (!existsSync(manifestPath)) {
233
+ return null;
234
+ }
235
+ return JSON.parse(await readFile(manifestPath, "utf-8"));
236
+ } catch (error) {
237
+ return null;
238
+ }
239
+ }
229
240
  /**
230
241
  * Uses various heuristics to try to find the .next dir.
231
242
  * Works by looking for BUILD_ID, so requires the site to have been built
@@ -127,6 +127,9 @@ function getApiRoutes(appPathsManifest, basePath = "") {
127
127
  for (const routePath of Object.keys(appPathsManifest)) {
128
128
  if (routePath.includes("/api/") && routePath.endsWith("/route")) {
129
129
  const apiPath = routePath.replace(/\/route$/, "");
130
+ if (apiPath.includes("[")) {
131
+ continue;
132
+ }
130
133
  const escapedPath = apiPath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
131
134
  const src = `^${basePath}${escapedPath}$`;
132
135
  routes.push({ src });
@@ -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.5";
31
+ var version = "0.2.6";
32
32
 
33
33
  // src/run/handlers/tags-handler.cts
34
34
  var import_request_context = require("./request-context.cjs");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeone/opennextjs-pages",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",