Skip to content

Commit 041b9e8

Browse files
committed
chore: minor refactoring
1 parent 3c7cd9d commit 041b9e8

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

packages/open-next/src/build/createServerBundle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ async function generateBundle(
117117
// `node_modules` inside `.next/standalone`, and others inside
118118
// `.next/standalone/package/path` (ie. `.next`, `server.js`).
119119
// We need to output the handler file inside the package path.
120-
const isMonorepo = monorepoRoot !== appPath;
121120
const packagePath = path.relative(monorepoRoot, appBuildOutputPath);
122121
fs.mkdirSync(path.join(outputPath, packagePath), { recursive: true });
123122

@@ -244,6 +243,7 @@ async function generateBundle(
244243
options,
245244
);
246245

246+
const isMonorepo = monorepoRoot !== appPath;
247247
if (isMonorepo) {
248248
addMonorepoEntrypoint(outputPath, packagePath);
249249
}
@@ -301,7 +301,7 @@ function addMonorepoEntrypoint(outputPath: string, packagePath: string) {
301301
const packagePosixPath = packagePath.split(path.sep).join(path.posix.sep);
302302
fs.writeFileSync(
303303
path.join(outputPath, "index.mjs"),
304-
[`export * from "./${packagePosixPath}/index.mjs";`].join(""),
304+
`export * from "./${packagePosixPath}/index.mjs";`,
305305
);
306306
}
307307

packages/open-next/src/build/validateConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export function validateConfig(config: OpenNextConfig) {
9999
}
100100
if (config.dangerous?.disableTagCache) {
101101
logger.warn(
102-
`You've disabled tag cache.
102+
`You've disabled tag cache.
103103
This means that revalidatePath and revalidateTag from next/cache will not work.
104104
It is safe to disable if you only use page router`,
105105
);

packages/open-next/src/overrides/converters/aws-apigw-v2.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import { debug } from "../../adapters/logger";
1111
import { convertToQuery } from "../../core/routing/util";
1212
import { removeUndefinedFromQuery } from "./utils";
1313

14-
// Not sure which one is reallly needed as this is not documented anywhere but server actions redirect are not working without this, it causes a 500 error from cloudfront itself with a 'x-amzErrortype: InternalFailure' header
14+
// Not sure which one is really needed as this is not documented anywhere but server actions redirect are not working without this,
15+
// it causes a 500 error from cloudfront itself with a 'x-amzErrortype: InternalFailure' header
1516
const CloudFrontBlacklistedHeaders = [
1617
"connection",
1718
"expect",

packages/open-next/src/overrides/converters/edge.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ const converter: Converter<
1616
InternalResult | ({ type: "middleware" } & MiddlewareOutputEvent)
1717
> = {
1818
convertFrom: async (event: Request) => {
19-
const searchParams = new URL(event.url).searchParams;
19+
const url = new URL(event.url);
20+
21+
const searchParams = url.searchParams;
2022
const query: Record<string, string | string[]> = {};
2123
for (const [key, value] of searchParams.entries()) {
2224
if (key in query) {
@@ -29,13 +31,13 @@ const converter: Converter<
2931
query[key] = value;
3032
}
3133
}
32-
//Transform body into Buffer
34+
// Transform body into Buffer
3335
const body = await event.arrayBuffer();
3436
const headers: Record<string, string> = {};
3537
event.headers.forEach((value, key) => {
3638
headers[key] = value;
3739
});
38-
const rawPath = new URL(event.url).pathname;
40+
const rawPath = url.pathname;
3941
const method = event.method;
4042
const shouldHaveBody = method !== "GET" && method !== "HEAD";
4143
const cookies: Record<string, string> = Object.fromEntries(
@@ -100,9 +102,10 @@ const converter: Converter<
100102
for (const [key, value] of Object.entries(result.headers)) {
101103
headers.set(key, Array.isArray(value) ? value.join(",") : value);
102104
}
105+
103106
return new Response(result.body as ReadableStream, {
104107
status: result.statusCode,
105-
headers: headers,
108+
headers,
106109
});
107110
},
108111
name: "edge",

0 commit comments

Comments
 (0)