Skip to content

Commit ed762dc

Browse files
authored
chore!: minimum supported Node.js version is 18.12.0 (#151)
1 parent 59a7497 commit ed762dc

11 files changed

+7757
-16699
lines changed

.github/workflows/nodejs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
strategy:
6161
matrix:
6262
os: [ubuntu-latest, windows-latest, macos-latest]
63-
node-version: [14.x, 16.x, 18.x, 20.x]
63+
node-version: [18.x, 20.x, 21.x]
6464
webpack-version: [latest]
6565

6666
runs-on: ${{ matrix.os }}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ module.exports = {
131131
executableFile: path.resolve(
132132
__dirname,
133133
"fixtures",
134-
"executableFile.js"
134+
"executableFile.js",
135135
),
136136
},
137137
},

babel.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = (api) => {
1010
"@babel/preset-env",
1111
{
1212
targets: {
13-
node: "14.15.0",
13+
node: "18.12.0",
1414
},
1515
},
1616
],

package-lock.json

+7,668-16,610
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"main": "dist/cjs.js",
1515
"engines": {
16-
"node": ">= 14.15.0"
16+
"node": ">= 18.12.0"
1717
},
1818
"scripts": {
1919
"start": "npm run build -- -w",
@@ -24,7 +24,7 @@
2424
"security": "npm audit --production",
2525
"lint:prettier": "prettier --list-different .",
2626
"lint:js": "eslint --cache .",
27-
"lint:spelling": "cspell \"**/*.*\"",
27+
"lint:spelling": "cspell --no-must-find-files --cache --quiet \"**/*.*\"",
2828
"lint": "npm-run-all -l -p \"lint:**\"",
2929
"fix:js": "npm run lint:js -- --fix",
3030
"fix:prettier": "npm run lint:prettier -- --write",
@@ -46,26 +46,26 @@
4646
"devDependencies": {
4747
"@babel/cli": "^7.23.4",
4848
"@babel/core": "^7.23.7",
49-
"@babel/preset-env": "^7.23.7",
50-
"@commitlint/cli": "^17.7.2",
51-
"@commitlint/config-conventional": "^17.7.0",
49+
"@babel/preset-env": "^7.23.8",
50+
"@commitlint/cli": "^18.4.4",
51+
"@commitlint/config-conventional": "^18.4.4",
5252
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
5353
"cross-env": "^7.0.3",
54-
"cspell": "^6.31.2",
55-
"del": "^6.1.1",
56-
"del-cli": "^4.0.1",
54+
"cspell": "^8.3.2",
55+
"del": "^7.1.0",
56+
"del-cli": "^5.1.0",
5757
"eslint": "^8.56.0",
58-
"eslint-config-prettier": "^8.9.0",
58+
"eslint-config-prettier": "^9.1.0",
5959
"eslint-plugin-import": "^2.29.1",
6060
"figlet": "^1.7.0",
6161
"husky": "^8.0.3",
6262
"jest": "^29.7.0",
63-
"lint-staged": "^13.2.3",
64-
"memfs": "^3.5.1",
63+
"lint-staged": "^15.2.0",
64+
"memfs": "^4.6.0",
6565
"modernizr": "^3.13.0",
6666
"npm-run-all": "^4.1.5",
67-
"prettier": "^2.8.8",
68-
"standard-version": "^9.3.2",
67+
"prettier": "^3.2.2",
68+
"standard-version": "^9.5.0",
6969
"webpack": "^5.89.0"
7070
},
7171
"keywords": [

src/index.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ function processResult(loaderContext, result) {
2323
if (!result || typeof result !== "object" || "code" in result === false) {
2424
loaderContext.callback(
2525
new Error(
26-
`The returned result of module "${loaderContext.resource}" is not an object with a "code" property`
27-
)
26+
`The returned result of module "${loaderContext.resource}" is not an object with a "code" property`,
27+
),
2828
);
2929

3030
return;
@@ -36,23 +36,23 @@ function processResult(loaderContext, result) {
3636
) {
3737
loaderContext.callback(
3838
new Error(
39-
`The returned code of module "${loaderContext.resource}" is neither a string nor an instance of Buffer`
40-
)
39+
`The returned code of module "${loaderContext.resource}" is neither a string nor an instance of Buffer`,
40+
),
4141
);
4242

4343
return;
4444
}
4545

4646
(result.dependencies || []).forEach((dep) =>
47-
loaderContext.addDependency(dep)
47+
loaderContext.addDependency(dep),
4848
);
4949

5050
(result.contextDependencies || []).forEach((dep) =>
51-
loaderContext.addContextDependency(dep)
51+
loaderContext.addContextDependency(dep),
5252
);
5353

5454
(result.buildDependencies || []).forEach((dep) =>
55-
loaderContext.addBuildDependency(dep)
55+
loaderContext.addBuildDependency(dep),
5656
);
5757

5858
// Defaults to false which is a good default here because we assume that
@@ -63,7 +63,7 @@ function processResult(loaderContext, result) {
6363
null,
6464
result.code,
6565
result.sourceMap || null,
66-
result.ast || null
66+
result.ast || null,
6767
);
6868
}
6969

@@ -121,8 +121,8 @@ export default async function loader(content) {
121121
if (typeof func !== "function") {
122122
callback(
123123
new Error(
124-
`Module "${this.resource}" does not export a function as default`
125-
)
124+
`Module "${this.resource}" does not export a function as default`,
125+
),
126126
);
127127
return;
128128
}

test/executableFile.test.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe("executableFile option", () => {
2222
executableFile: path.resolve(
2323
__dirname,
2424
"fixtures",
25-
"executableFile.js"
25+
"executableFile.js",
2626
),
2727
},
2828
},
@@ -34,15 +34,15 @@ describe("executableFile option", () => {
3434
},
3535
],
3636
},
37-
}
37+
},
3838
);
3939
const stats = await compile(compiler);
4040

4141
expect(readAsset("val-loader.js", compiler, stats)).toMatchSnapshot(
42-
"result"
42+
"result",
4343
);
4444
expect(normalizeErrors(stats.compilation.warnings)).toMatchSnapshot(
45-
"warnings"
45+
"warnings",
4646
);
4747
expect(normalizeErrors(stats.compilation.errors)).toMatchSnapshot("errors");
4848
});
@@ -67,7 +67,7 @@ describe("executableFile option", () => {
6767
executableFile: path.resolve(
6868
__dirname,
6969
"fixtures",
70-
"executableFileES.mjs"
70+
"executableFileES.mjs",
7171
),
7272
},
7373
},
@@ -79,15 +79,15 @@ describe("executableFile option", () => {
7979
},
8080
],
8181
},
82-
}
82+
},
8383
);
8484
const stats = await compile(compiler);
8585

8686
expect(readAsset("val-loader.js", compiler, stats)).toMatchSnapshot(
87-
"result"
87+
"result",
8888
);
8989
expect(normalizeErrors(stats.compilation.warnings)).toMatchSnapshot(
90-
"warnings"
90+
"warnings",
9191
);
9292
expect(normalizeErrors(stats.compilation.errors)).toMatchSnapshot("errors");
9393
});
@@ -111,7 +111,7 @@ describe("executableFile option", () => {
111111
executableFile: path.resolve(
112112
__dirname,
113113
"fixtures",
114-
"error-require.js"
114+
"error-require.js",
115115
),
116116
},
117117
},
@@ -123,12 +123,12 @@ describe("executableFile option", () => {
123123
},
124124
],
125125
},
126-
}
126+
},
127127
);
128128
const stats = await compile(compiler);
129129

130130
expect(normalizeErrors(stats.compilation.warnings)).toMatchSnapshot(
131-
"warnings"
131+
"warnings",
132132
);
133133
expect(normalizeErrors(stats.compilation.errors)).toMatchSnapshot("errors");
134134
});

test/helpers/execute.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ export default (code) => {
88
const module = new Module(resource, parentModule);
99
// eslint-disable-next-line no-underscore-dangle
1010
module.paths = Module._nodeModulePaths(
11-
path.resolve(__dirname, "../fixtures")
11+
path.resolve(__dirname, "../fixtures"),
1212
);
1313
module.filename = resource;
1414

1515
// eslint-disable-next-line no-underscore-dangle
1616
module._compile(
1717
`let __export__;${code};module.exports = __export__;`,
18-
resource
18+
resource,
1919
);
2020

2121
return module.exports;

test/helpers/helperLoader.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ function rel(p) {
66

77
export default function helperLoader(content, map, meta) {
88
const dependencies = this.getDependencies().map((dependency) =>
9-
rel(dependency).replace(/\\/g, "/")
9+
rel(dependency).replace(/\\/g, "/"),
1010
);
1111
const contextDependencies = this.getContextDependencies().map((dependency) =>
12-
rel(dependency).replace(/\\/g, "/")
12+
rel(dependency).replace(/\\/g, "/"),
1313
);
1414

1515
const buildDependencies = Array.from(
16-
this._module.buildInfo.buildDependencies || []
16+
this._module.buildInfo.buildDependencies || [],
1717
).map((dependency) => rel(dependency).replace(/\\/g, "/"));
1818
const json = JSON.stringify(
1919
{
@@ -25,7 +25,7 @@ export default function helperLoader(content, map, meta) {
2525
buildDependencies,
2626
},
2727
null,
28-
" "
28+
" ",
2929
)
3030
.replace(/\u2028/g, "\\u2028")
3131
.replace(/\u2029/g, "\\u2029");

test/helpers/normalizeErrors.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ function removeCWD(str) {
1414
.replace(new RegExp(cwd, "g"), "")
1515
.replace(
1616
/Cannot read property 'get' of undefined/,
17-
"Cannot read properties of undefined (reading 'get')"
17+
"Cannot read properties of undefined (reading 'get')",
1818
);
1919
}
2020

2121
export default (errors) =>
2222
errors.map((error) =>
23-
removeCWD(error.toString().split("\n").slice(0, 2).join("\n"))
23+
removeCWD(error.toString().split("\n").slice(0, 2).join("\n")),
2424
);

0 commit comments

Comments
 (0)