Skip to content

Commit e7e648f

Browse files
committed
GitButler WIP Commit
fixup! biome
1 parent 214b095 commit e7e648f

28 files changed

+80
-78
lines changed

packages/open-next/src/adapters/dynamo-provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async function insert(
5656
const parsedData = data.map((item) => ({
5757
tag: item.tag.S,
5858
path: item.path.S,
59-
revalidatedAt: parseInt(item.revalidatedAt.N),
59+
revalidatedAt: Number.parseInt(item.revalidatedAt.N),
6060
}));
6161

6262
await tagCache.writeTags(parsedData);

packages/open-next/src/adapters/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function parseNumberFromEnv(
3131
return envValue;
3232
}
3333

34-
const parsedValue = parseInt(envValue);
34+
const parsedValue = Number.parseInt(envValue);
3535

3636
return isNaN(parsedValue) ? undefined : parsedValue;
3737
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import fs from "node:fs";
22
import path from "node:path";
33

44
import logger from "../logger.js";
5-
import {
6-
type MiddlewareInfo,
7-
type MiddlewareManifest,
5+
import type {
6+
MiddlewareInfo,
7+
MiddlewareManifest,
88
} from "../types/next-types.js";
99
import { buildEdgeBundle } from "./edge/createEdgeBundle.js";
1010
import * as buildHelper from "./helper.js";

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

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -210,31 +210,35 @@ async function generateBundle(
210210
];
211211

212212
const outfileExt = fnOptions.runtime === "deno" ? "ts" : "mjs";
213-
await buildHelper.esbuildAsync({
214-
entryPoints: [
215-
path.join(options.openNextDistDir, "adapters", "server-adapter.js"),
216-
],
217-
external: ["next", "./middleware.mjs", "./next-server.runtime.prod.js"],
218-
outfile: path.join(outputPath, packagePath, `index.${outfileExt}`),
219-
banner: {
220-
js: [
221-
`globalThis.monorepoPackagePath = "${packagePath}";`,
222-
"import process from 'node:process';",
223-
"import { Buffer } from 'node:buffer';",
224-
"import { createRequire as topLevelCreateRequire } from 'module';",
225-
"const require = topLevelCreateRequire(import.meta.url);",
226-
"import bannerUrl from 'url';",
227-
"const __dirname = bannerUrl.fileURLToPath(new URL('.', import.meta.url));",
228-
name === "default" ? "" : `globalThis.fnName = "${name}";`,
229-
].join(""),
213+
await buildHelper.esbuildAsync(
214+
{
215+
entryPoints: [
216+
path.join(options.openNextDistDir, "adapters", "server-adapter.js"),
217+
],
218+
external: ["next", "./middleware.mjs", "./next-server.runtime.prod.js"],
219+
outfile: path.join(outputPath, packagePath, `index.${outfileExt}`),
220+
banner: {
221+
js: [
222+
`globalThis.monorepoPackagePath = "${packagePath}";`,
223+
"import process from 'node:process';",
224+
"import { Buffer } from 'node:buffer';",
225+
"import { createRequire as topLevelCreateRequire } from 'module';",
226+
"const require = topLevelCreateRequire(import.meta.url);",
227+
"import bannerUrl from 'url';",
228+
"const __dirname = bannerUrl.fileURLToPath(new URL('.', import.meta.url));",
229+
name === "default" ? "" : `globalThis.fnName = "${name}";`,
230+
].join(""),
231+
},
232+
plugins,
233+
alias: {
234+
...(isBundled
235+
? {
236+
"next/dist/server/next-server.js":
237+
"./next-server.runtime.prod.js",
238+
}
239+
: {}),
240+
},
230241
},
231-
plugins,
232-
alias: {
233-
...(isBundled
234-
? { "next/dist/server/next-server.js": "./next-server.runtime.prod.js" }
235-
: undefined),
236-
}
237-
},
238242
options,
239243
);
240244

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export function traverseFiles(
189189
root: string,
190190
conditionFn: (paths: TraversePath) => boolean,
191191
callbackFn: (paths: TraversePath) => void,
192-
searchingDir: string = "",
192+
searchingDir = "",
193193
) {
194194
fs.readdirSync(path.join(root, searchingDir)).forEach((file) => {
195195
const relativePath = path.join(searchingDir, file);

packages/open-next/src/core/patchAsyncStorage.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ const mod = require("module");
33
const resolveFilename = mod._resolveFilename;
44

55
export function patchAsyncStorage() {
6-
mod._resolveFilename = function (
6+
mod._resolveFilename = ((
77
originalResolveFilename: typeof resolveFilename,
88
request: string,
99
parent: any,
1010
isMain: boolean,
1111
options: any,
12-
) {
12+
) => {
1313
if (
1414
request.endsWith("static-generation-async-storage.external") ||
1515
request.endsWith("static-generation-async-storage.external.js")
@@ -35,5 +35,5 @@ export function patchAsyncStorage() {
3535
);
3636

3737
// We use `bind` here to avoid referencing outside variables to create potential memory leaks.
38-
}.bind(null, resolveFilename);
38+
}).bind(null, resolveFilename);
3939
}

packages/open-next/src/core/require-hooks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,21 @@ function isApp() {
132132
}
133133

134134
export function applyOverride() {
135-
mod._resolveFilename = function (
135+
mod._resolveFilename = ((
136136
originalResolveFilename: typeof resolveFilename,
137137
requestMapApp: Map<string, string>,
138138
requestMapPage: Map<string, string>,
139139
request: string,
140140
parent: any,
141141
isMain: boolean,
142142
options: any,
143-
) {
143+
) => {
144144
const hookResolved = isApp()
145145
? requestMapApp.get(request)
146146
: requestMapPage.get(request);
147147
if (hookResolved) request = hookResolved;
148148
return originalResolveFilename.call(mod, request, parent, isMain, options);
149149

150150
// We use `bind` here to avoid referencing outside variables to create potential memory leaks.
151-
}.bind(null, resolveFilename, hookPropertyMapApp, hookPropertyMapPage);
151+
}).bind(null, resolveFilename, hookPropertyMapApp, hookPropertyMapPage);
152152
}

packages/open-next/src/core/routing/i18n/accept-header.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function parse(
5454
throw new Error(`Invalid ${options.type} header`);
5555
}
5656

57-
let token = params[0].toLowerCase();
57+
const token = params[0].toLowerCase();
5858
if (!token) {
5959
throw new Error(`Invalid ${options.type} header`);
6060
}
@@ -74,7 +74,7 @@ function parse(
7474
throw new Error(`Invalid ${options.type} header`);
7575
}
7676

77-
const score = parseFloat(value);
77+
const score = Number.parseFloat(value);
7878
if (score === 0) {
7979
continue;
8080
}

packages/open-next/src/core/routing/matcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export function handleRewrites<T extends RewriteDefinition>(
207207
const toDestinationQuery = compile(
208208
escapeRegex(encodePlusQueryString ?? "") ?? "",
209209
);
210-
let params = {
210+
const params = {
211211
// params for the source
212212
...getParamsFromSource(match(escapeRegex(rewrite?.source) ?? ""))(
213213
pathToUse,

packages/open-next/src/core/routing/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ export function generateMessageGroupId(rawPath: string) {
406406
const randomFloat = ((t ^ (t >>> 14)) >>> 0) / 4294967296;
407407
// This will generate a random int between 0 and MAX_REVALIDATE_CONCURRENCY
408408
// This means that we could have 1000 revalidate request at the same time
409-
const maxConcurrency = parseInt(
409+
const maxConcurrency = Number.parseInt(
410410
process.env.MAX_REVALIDATE_CONCURRENCY ?? "10",
411411
);
412412
const randomInt = Math.floor(randomFloat * maxConcurrency);
@@ -455,7 +455,7 @@ export function fixISRHeaders(headers: OutgoingHttpHeaders) {
455455
debug("cache-control", cacheControl, globalThis.lastModified, Date.now());
456456
if (typeof cacheControl !== "string") return;
457457
const match = cacheControl.match(regex);
458-
const sMaxAge = match ? parseInt(match[1]) : undefined;
458+
const sMaxAge = match ? Number.parseInt(match[1]) : undefined;
459459

460460
// 31536000 is the default s-maxage value for SSG pages
461461
if (sMaxAge && sMaxAge !== 31536000) {

0 commit comments

Comments
 (0)