@edgeone/opennextjs-pages 0.0.1 → 0.0.2
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.
|
@@ -99,17 +99,20 @@ var getHandlerFile = async (ctx) => {
|
|
|
99
99
|
"{{useRegionalBlobs}}": ctx.useRegionalBlobs.toString()
|
|
100
100
|
};
|
|
101
101
|
if (ctx.relativeAppDir.length !== 0) {
|
|
102
|
-
const
|
|
102
|
+
const template2 = await readFile(join(templatesDir, "handler-monorepo.tmpl.js"), "utf-8");
|
|
103
103
|
console.log("ctx.lambdaWorkingDirectory", ctx.lambdaWorkingDirectory);
|
|
104
104
|
console.log("ctx.nextServerHandler", ctx.nextServerHandler);
|
|
105
105
|
templateVariables["{{cwd}}"] = posixJoin(ctx.lambdaWorkingDirectory);
|
|
106
106
|
templateVariables["{{nextServerHandler}}"] = posixJoin(ctx.nextServerHandler);
|
|
107
|
-
return applyTemplateVariables(
|
|
107
|
+
return applyTemplateVariables(template2, templateVariables);
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
let runtime_shim = "";
|
|
110
|
+
const getRuntimeShim = ctx.getRuntimeShim;
|
|
111
|
+
if (getRuntimeShim) {
|
|
112
|
+
runtime_shim = getRuntimeShim();
|
|
113
|
+
}
|
|
114
|
+
const template = await readFile(join(templatesDir, "handler.tmpl.js"), "utf-8");
|
|
115
|
+
return applyTemplateVariables(runtime_shim + template, templateVariables);
|
|
113
116
|
};
|
|
114
117
|
var writeHandlerFile = async (ctx) => {
|
|
115
118
|
const handler = await getHandlerFile(ctx);
|
|
@@ -34,6 +34,7 @@ var PluginContext = class {
|
|
|
34
34
|
/** Absolute path of the next runtime plugin directory */
|
|
35
35
|
pluginDir = PLUGIN_DIR;
|
|
36
36
|
serverlessWrapHandler;
|
|
37
|
+
getRuntimeShim;
|
|
37
38
|
get relPublishDir() {
|
|
38
39
|
return this.constants.PUBLISH_DIR ?? join(this.constants.PACKAGE_PATH || "", DEFAULT_PUBLISH_DIR);
|
|
39
40
|
}
|
|
@@ -168,6 +169,7 @@ var PluginContext = class {
|
|
|
168
169
|
this.pluginVersion = this.packageJSON.version;
|
|
169
170
|
this.utils = options.utils;
|
|
170
171
|
this.serverlessWrapHandler = options.serverlessWrapHandler;
|
|
172
|
+
this.getRuntimeShim = options.getRuntimeShim;
|
|
171
173
|
}
|
|
172
174
|
/** Resolves a path correctly with mono repository awareness for .edgeone directories mainly */
|
|
173
175
|
resolveFromPackagePath(...args) {
|
|
@@ -35,7 +35,12 @@ async function handleResponse(res, response, passHeaders = {}) {
|
|
|
35
35
|
// 删除 eop-client-geo 头部
|
|
36
36
|
response.headers.delete('eop-client-geo');
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
// 处理 set-cookie 头部
|
|
39
|
+
if (response.headers.has('set-cookie')) {
|
|
40
|
+
const cookieArr = response.headers.getSetCookie();
|
|
41
|
+
|
|
42
|
+
headers['set-cookie'] = cookieArr;
|
|
43
|
+
}
|
|
39
44
|
// 检查是否是流式响应
|
|
40
45
|
const isStream = response.body && (
|
|
41
46
|
response.headers.get('content-type')?.includes('text/event-stream') ||
|
|
@@ -30,6 +30,12 @@ import { getTracer } from './.edgeone/dist/run/handlers/tracer.cjs';
|
|
|
30
30
|
// 删除 eop-client-geo 头部
|
|
31
31
|
response.headers.delete('eop-client-geo');
|
|
32
32
|
}
|
|
33
|
+
// 处理 set-cookie 头部
|
|
34
|
+
if (response.headers.has('set-cookie')) {
|
|
35
|
+
const cookieArr = response.headers.getSetCookie();
|
|
36
|
+
|
|
37
|
+
headers['set-cookie'] = cookieArr;
|
|
38
|
+
}
|
|
33
39
|
|
|
34
40
|
// 检查是否是流式响应
|
|
35
41
|
const isStream = response.body && (
|
|
@@ -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.0.
|
|
31
|
+
var version = "0.0.2";
|
|
32
32
|
|
|
33
33
|
// src/run/handlers/tags-handler.cts
|
|
34
34
|
var import_request_context = require("./request-context.cjs");
|