Skip to content

Commit 4e9c59f

Browse files
Update devDependencies (#879)
1 parent d8cff97 commit 4e9c59f

File tree

9 files changed

+1196
-2503
lines changed

9 files changed

+1196
-2503
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
matrix:
2222
os: [ubuntu-latest, windows-latest]
2323
node-version: [10.x, 12.x, 14.x, 15.x]
24-
webpack-version: [latest, next]
24+
webpack-version: [latest, '4']
2525
include:
2626
- node: 14.x
2727
os: ubuntu-latest

package.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"node": ">= 6.9"
1111
},
1212
"dependencies": {
13+
"@ava/babel": "^1.0.1",
1314
"find-cache-dir": "^2.1.0",
1415
"loader-utils": "^1.4.0",
1516
"make-dir": "^2.1.0",
@@ -24,26 +25,26 @@
2425
"@babel/cli": "^7.12.1",
2526
"@babel/core": "^7.12.3",
2627
"@babel/preset-env": "^7.12.1",
27-
"ava": "^2.4.0",
28+
"ava": "^3.13.0",
2829
"babel-eslint": "^10.0.1",
29-
"babel-plugin-istanbul": "^5.1.0",
30-
"babel-plugin-react-intl": "^4.1.19",
31-
"cross-env": "^6.0.0",
32-
"eslint": "^6.5.1",
30+
"babel-plugin-istanbul": "^6.0.0",
31+
"babel-plugin-react-intl": "^8.2.15",
32+
"cross-env": "^7.0.2",
33+
"eslint": "^7.13.0",
3334
"eslint-config-babel": "^9.0.0",
3435
"eslint-config-prettier": "^6.3.0",
35-
"eslint-plugin-flowtype": "^4.3.0",
36+
"eslint-plugin-flowtype": "^5.2.0",
3637
"eslint-plugin-prettier": "^3.0.0",
37-
"husky": "^3.0.7",
38-
"lint-staged": "^9.4.1",
39-
"nyc": "^14.1.1",
40-
"prettier": "^1.15.3",
41-
"react": "^16.0.0",
42-
"react-intl": "^3.3.2",
38+
"husky": "^4.3.0",
39+
"lint-staged": "^10.5.1",
40+
"nyc": "^15.1.0",
41+
"prettier": "^2.1.2",
42+
"react": "^17.0.1",
43+
"react-intl": "^5.9.4",
4344
"react-intl-webpack-plugin": "^0.3.0",
4445
"rimraf": "^3.0.0",
45-
"semver": "7.0.0",
46-
"webpack": "^4.0.0"
46+
"semver": "7.3.2",
47+
"webpack": "^5.4.0"
4748
},
4849
"scripts": {
4950
"clean": "rimraf lib/",
@@ -92,12 +93,11 @@
9293
"!test/fixtures/**/*",
9394
"!test/helpers/**/*"
9495
],
95-
"helpers": [
96-
"**/helpers/**/*"
97-
],
98-
"sources": [
99-
"src/**/*.js"
100-
]
96+
"babel": {
97+
"compileAsTests": [
98+
"test/helpers/**/*"
99+
]
100+
}
101101
},
102102
"lint-staged": {
103103
"scripts/*.js": [

src/cache.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const makeDir = require("make-dir");
3232
* @params {String} filename
3333
* @params {Boolean} compress
3434
*/
35-
const read = async function(filename, compress) {
35+
const read = async function (filename, compress) {
3636
const data = await readFile(filename + (compress ? ".gz" : ""));
3737
const content = compress ? await gunzip(data) : data;
3838

@@ -47,7 +47,7 @@ const read = async function(filename, compress) {
4747
* @params {Boolean} compress
4848
* @params {String} result
4949
*/
50-
const write = async function(filename, compress, result) {
50+
const write = async function (filename, compress, result) {
5151
const content = JSON.stringify(result);
5252

5353
const data = compress ? await gzip(content) : content;
@@ -62,7 +62,7 @@ const write = async function(filename, compress, result) {
6262
*
6363
* @return {String}
6464
*/
65-
const filename = function(source, identifier, options) {
65+
const filename = function (source, identifier, options) {
6666
const hash = crypto.createHash("md4");
6767

6868
const contents = JSON.stringify({ source, options, identifier });
@@ -78,7 +78,7 @@ const filename = function(source, identifier, options) {
7878
* @params {String} directory
7979
* @params {Object} params
8080
*/
81-
const handleCache = async function(directory, params) {
81+
const handleCache = async function (directory, params) {
8282
const {
8383
source,
8484
options = {},
@@ -152,7 +152,7 @@ const handleCache = async function(directory, params) {
152152
* });
153153
*/
154154

155-
module.exports = async function(params) {
155+
module.exports = async function (params) {
156156
let directory;
157157

158158
if (typeof params.cacheDirectory === "string") {

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports.custom = makeLoader;
4141
function makeLoader(callback) {
4242
const overrides = callback ? callback(babel) : undefined;
4343

44-
return function(source, inputSourceMap) {
44+
return function (source, inputSourceMap) {
4545
// Make the loader async
4646
const callback = this.async();
4747

src/transform.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const LoaderError = require("./Error");
44

55
const transform = promisify(babel.transform);
66

7-
module.exports = async function(source, options) {
7+
module.exports = async function (source, options) {
88
let result;
99
try {
1010
result = await transform(source, options);

test/helpers/createTestDirectory.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import path from "path";
2-
import mkdirp from "mkdirp";
2+
import fs from "fs";
33
import rimraf from "rimraf";
44

55
export default function createTestDirectory(baseDirectory, testTitle, cb) {
66
const directory = path.join(baseDirectory, escapeDirectory(testTitle));
77

88
rimraf(directory, err => {
99
if (err) return cb(err);
10-
mkdirp(directory, mkdirErr => cb(mkdirErr, directory));
10+
fs.mkdir(directory, { recursive: true }, mkdirErr =>
11+
cb(mkdirErr, directory),
12+
);
1113
});
1214
}
1315

test/metadata.test.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import test from "ava";
22
import fs from "fs";
33
import path from "path";
4-
import assign from "object-assign";
54
import rimraf from "rimraf";
65
import webpack from "webpack";
76
import createTestDirectory from "./helpers/createTestDirectory";
@@ -26,7 +25,7 @@ const globalConfig = {
2625
loader: babelLoader,
2726
options: {
2827
metadataSubscribers: [ReactIntlPlugin.metadataContextFunctionName],
29-
plugins: [["react-intl", { enforceDescriptions: false }]],
28+
plugins: ["react-intl"],
3029
presets: [],
3130
},
3231
exclude: /node_modules/,
@@ -48,7 +47,7 @@ test.beforeEach.cb(t => {
4847
test.afterEach.cb(t => rimraf(t.context.directory, t.end));
4948

5049
test.cb("should pass metadata code snippet", t => {
51-
const config = assign({}, globalConfig, {
50+
const config = Object.assign({}, globalConfig, {
5251
output: {
5352
path: t.context.directory,
5453
filename: "[id].metadata.js",
@@ -65,7 +64,7 @@ test.cb("should pass metadata code snippet", t => {
6564
t.true(files.length > 0);
6665
fs.readFile(
6766
path.resolve(t.context.directory, "reactIntlMessages.json"),
68-
function(err, data) {
67+
function (err, data) {
6968
t.is(err, null);
7069
const text = data.toString();
7170
const jsonText = JSON.parse(text);
@@ -80,7 +79,7 @@ test.cb("should pass metadata code snippet", t => {
8079
});
8180

8281
test.cb("should not throw error", t => {
83-
const config = assign({}, globalConfig, {
82+
const config = Object.assign({}, globalConfig, {
8483
output: {
8584
path: t.context.directory,
8685
filename: "[id].metadata.js",
@@ -96,7 +95,7 @@ test.cb("should not throw error", t => {
9695
});
9796

9897
test.cb("should throw error", t => {
99-
const config = assign({}, globalConfig, {
98+
const config = Object.assign({}, globalConfig, {
10099
output: {
101100
path: t.context.directory,
102101
filename: "[id].metadata.js",
@@ -113,7 +112,7 @@ test.cb("should throw error", t => {
113112
});
114113

115114
test.cb("should pass metadata code snippet ( cache version )", t => {
116-
const config = assign({}, globalConfig, {
115+
const config = Object.assign({}, globalConfig, {
117116
output: {
118117
path: t.context.directory,
119118
filename: "[id].metadata.js",
@@ -125,7 +124,7 @@ test.cb("should pass metadata code snippet ( cache version )", t => {
125124
loader: babelLoader,
126125
options: {
127126
metadataSubscribers: [ReactIntlPlugin.metadataContextFunctionName],
128-
plugins: [["react-intl", { enforceDescriptions: false }]],
127+
plugins: ["react-intl"],
129128
cacheDirectory: cacheDir,
130129
presets: [],
131130
},
@@ -145,7 +144,7 @@ test.cb("should pass metadata code snippet ( cache version )", t => {
145144
t.true(files.length > 0);
146145
fs.readFile(
147146
path.resolve(t.context.directory, "reactIntlMessages.json"),
148-
function(err, data) {
147+
function (err, data) {
149148
t.is(err, null);
150149
const text = data.toString();
151150
const jsonText = JSON.parse(text);

test/sourcemaps.test.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ test.cb("should output webpack's devtoolModuleFilename option", t => {
141141
devtool: "source-map",
142142
output: {
143143
path: t.context.directory,
144-
devtoolModuleFilenameTemplate: "==[absolute-resource-path]==",
144+
devtoolModuleFilenameTemplate: "=!=!=!=[absolute-resource-path]=!=!=!=",
145145
},
146146
module: {
147147
rules: [
@@ -171,11 +171,17 @@ test.cb("should output webpack's devtoolModuleFilename option", t => {
171171
t.is(err, null);
172172

173173
// The full absolute path is included in the sourcemap properly
174-
t.not(
175-
data
176-
.toString()
177-
.indexOf(JSON.stringify(`==${globalConfig.entry}==`)),
178-
-1,
174+
t.regex(
175+
data.toString(),
176+
new RegExp(
177+
JSON.stringify(
178+
`=!=!=!=${globalConfig.entry.replace(
179+
// Webpack 5, webpack 4, windows, linux, ...
180+
/\\/g,
181+
"(?:/|\\\\)",
182+
)}=!=!=!=`,
183+
),
184+
),
179185
);
180186

181187
t.end();

0 commit comments

Comments
 (0)