Skip to content

Commit 2272d10

Browse files
committed
fixup! renamed vars (review feedback)
1 parent 9ddf03c commit 2272d10

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

packages/wrangler/src/deployment-bundle/esbuild-plugins/nodejs-compat.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { dedent } from "../../utils/dedent";
55
import type { Plugin } from "esbuild";
66
import type { NodeJSCompatMode } from "miniflare";
77

8+
89
/**
910
* An esbuild plugin that will:
1011
* - mark any `node:...` imports as external
@@ -19,11 +20,11 @@ export const nodejsCompatPlugin = (mode: NodeJSCompatMode): Plugin => ({
1920
const seen = new Set<string>();
2021

2122
// Prevent multiple warnings per package
22-
const warnedPackaged = new Map<string, string[]>();
23+
const warnedPackages = new Map<string, string[]>();
2324

2425
pluginBuild.onStart(() => {
2526
seen.clear();
26-
warnedPackaged.clear();
27+
warnedPackages.clear();
2728
});
2829
pluginBuild.onResolve(
2930
{ filter: /node:.*/ },
@@ -44,9 +45,9 @@ export const nodejsCompatPlugin = (mode: NodeJSCompatMode): Plugin => ({
4445
if (result.errors.length > 0) {
4546
// esbuild couldn't resolve the package
4647
// We should warn the user, but not fail the build
47-
const pathWarnedPackaged = warnedPackaged.get(path) ?? [];
48-
pathWarnedPackaged.push(importer);
49-
warnedPackaged.set(path, pathWarnedPackaged);
48+
const pathWarnedPackages = warnedPackages.get(path) ?? [];
49+
pathWarnedPackages.push(importer);
50+
warnedPackages.set(path, pathWarnedPackages);
5051

5152
return { external: true };
5253
}
@@ -64,10 +65,10 @@ export const nodejsCompatPlugin = (mode: NodeJSCompatMode): Plugin => ({
6465
pluginBuild.onEnd(() => {
6566
if (
6667
pluginBuild.initialOptions.format === "iife" &&
67-
warnedPackaged.size > 0
68+
warnedPackages.size > 0
6869
) {
6970
const paths = new Intl.ListFormat("en-US").format(
70-
Array.from(warnedPackaged.keys())
71+
Array.from(warnedPackages.keys())
7172
.map((p) => `"${p}"`)
7273
.sort()
7374
);
@@ -91,7 +92,7 @@ export const nodejsCompatPlugin = (mode: NodeJSCompatMode): Plugin => ({
9192
// can be collated
9293
pluginBuild.onEnd(() => {
9394
if (mode !== "v1") {
94-
warnedPackaged.forEach((importers: string[], path: string) => {
95+
warnedPackages.forEach((importers: string[], path: string) => {
9596
logger.warn(
9697
dedent`
9798
The package "${path}" wasn't found on the file system but is built into node.
@@ -108,4 +109,4 @@ function toList(items: string[], absWorkingDir: string | undefined): string {
108109
return items
109110
.map((i) => ` - ${chalk.blue(relative(absWorkingDir ?? "/", i))}`)
110111
.join("\n");
111-
}
112+
}

0 commit comments

Comments
 (0)