Skip to content

Commit 97c46e9

Browse files
refactor: next (#78)
BREAKING CHANGE: minimum supported webpack version is `5`
1 parent acdfbdc commit 97c46e9

File tree

9 files changed

+2013
-2927
lines changed

9 files changed

+2013
-2927
lines changed

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
matrix:
5757
os: [ubuntu-latest, windows-latest, macos-latest]
5858
node-version: [10.x, 12.x, 14.x]
59-
webpack-version: [4, latest]
59+
webpack-version: [latest]
6060

6161
runs-on: ${{ matrix.os }}
6262

package-lock.json

Lines changed: 1991 additions & 2887 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,36 +39,32 @@
3939
],
4040
"peerDependencies": {
4141
"coffeescript": ">= 2.0.0",
42-
"webpack": "^4.0.0 || ^5.0.0"
43-
},
44-
"dependencies": {
45-
"loader-utils": "^2.0.0",
46-
"schema-utils": "^3.0.0"
42+
"webpack": "^5.0.0"
4743
},
4844
"devDependencies": {
49-
"@babel/cli": "^7.11.6",
50-
"@babel/core": "^7.11.6",
51-
"@babel/preset-env": "^7.11.5",
45+
"@babel/cli": "^7.12.10",
46+
"@babel/core": "^7.12.10",
47+
"@babel/preset-env": "^7.12.11",
5248
"@commitlint/cli": "^11.0.0",
5349
"@commitlint/config-conventional": "^11.0.0",
5450
"@webpack-contrib/defaults": "^6.3.0",
5551
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
56-
"babel-jest": "^26.5.2",
52+
"babel-jest": "^26.6.3",
5753
"coffeescript": "^2.5.1",
58-
"cross-env": "^7.0.2",
54+
"cross-env": "^7.0.3",
5955
"del": "^6.0.0",
6056
"del-cli": "^3.0.1",
61-
"eslint": "^7.10.0",
62-
"eslint-config-prettier": "^6.12.0",
57+
"eslint": "^7.16.0",
58+
"eslint-config-prettier": "^7.1.0",
6359
"eslint-plugin-import": "^2.22.1",
64-
"husky": "^4.3.0",
65-
"jest": "^26.5.2",
66-
"lint-staged": "^10.4.0",
60+
"husky": "^4.3.6",
61+
"jest": "^26.6.3",
62+
"lint-staged": "^10.5.3",
6763
"memfs": "^3.2.0",
6864
"npm-run-all": "^4.1.5",
69-
"prettier": "^2.1.2",
65+
"prettier": "^2.2.1",
7066
"standard-version": "^9.0.0",
71-
"webpack": "^4.44.2"
67+
"webpack": "^5.11.0"
7268
},
7369
"keywords": [
7470
"webpack"

src/index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,13 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
import { validate } from 'schema-utils';
6-
import { getOptions } from 'loader-utils';
75
import coffeescript from 'coffeescript';
86

97
import schema from './options.json';
108
import CoffeeScriptError from './CoffeeScriptError';
119

1210
export default function loader(source) {
13-
const options = getOptions(this);
14-
15-
validate(schema, options, {
16-
name: 'CoffeeScript Loader',
17-
baseDataPath: 'options',
18-
});
19-
11+
const options = this.getOptions(schema);
2012
const callback = this.async();
2113
const useSourceMap =
2214
typeof options.sourceMap === 'boolean' ? options.sourceMap : this.sourceMap;

test/__snapshots__/loader.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ exports[`loader should generate an error on broken code: warnings 1`] = `Array [
1212
exports[`loader should throw an error on invalid CoffeeScript options: errors 1`] = `
1313
Array [
1414
"ModuleBuildError: Module build failed (from \`replaced original path\`):
15-
CoffeeScriptError: Error: Cannot find module '@babel/preset-env1' from ''",
15+
CoffeeScriptError: Error: Cannot resolve module '@babel/preset-env1' from paths [''] from /node_modules/@babel/core/lib/config/files/plugins.js",
1616
]
1717
`;
1818

test/helpers/compile.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export default (compiler) => {
2-
return new Promise((resolve, reject) => {
1+
export default (compiler) =>
2+
new Promise((resolve, reject) => {
33
compiler.run((error, stats) => {
44
if (error) {
55
return reject(error);
@@ -8,4 +8,3 @@ export default (compiler) => {
88
return resolve(stats);
99
});
1010
});
11-
};

test/helpers/getErrors.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
import normalizeErrors from './normalizeErrors';
22

3-
export default (stats) => {
4-
return normalizeErrors(stats.compilation.errors);
5-
};
3+
export default (stats) => normalizeErrors(stats.compilation.errors);

test/helpers/getWarnings.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
import normalizeErrors from './normalizeErrors';
22

3-
export default (stats) => {
4-
return normalizeErrors(stats.compilation.warnings);
5-
};
3+
export default (stats) => normalizeErrors(stats.compilation.warnings);

test/helpers/normalizeErrors.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ function removeCWD(str) {
1414
.replace(new RegExp(cwd, 'g'), '');
1515
}
1616

17-
export default (errors) => {
18-
return errors.map((error) =>
17+
export default (errors) =>
18+
errors.map((error) =>
1919
removeCWD(error.toString().split('\n').slice(0, 2).join('\n'))
2020
);
21-
};

0 commit comments

Comments
 (0)