@edgeone/opennextjs-pages 0.2.4 → 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 });
@@ -3186,14 +3186,24 @@ var server_default = async (request, _context, topLevelSpan, requestContext) =>
3186
3186
  url: `${realProtocol}://${realHost}${request.url}`,
3187
3187
  headers: headersList
3188
3188
  });
3189
+ let _connection = {};
3190
+ let _socket = {};
3189
3191
  Object.defineProperty(req, "connection", {
3192
+ configurable: true,
3190
3193
  get() {
3191
- return {};
3194
+ return _connection;
3195
+ },
3196
+ set(v) {
3197
+ _connection = v ?? {};
3192
3198
  }
3193
3199
  });
3194
3200
  Object.defineProperty(req, "socket", {
3201
+ configurable: true,
3195
3202
  get() {
3196
- return {};
3203
+ return _socket;
3204
+ },
3205
+ set(v) {
3206
+ _socket = v ?? {};
3197
3207
  }
3198
3208
  });
3199
3209
  disableFaultyTransferEncodingHandling(res);
@@ -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.4";
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.4",
3
+ "version": "0.2.6",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",