Skip to content

Commit

Permalink
Update devDependencies (#879)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Nov 9, 2020
1 parent d8cff97 commit 4e9c59f
Show file tree
Hide file tree
Showing 9 changed files with 1,196 additions and 2,503 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [10.x, 12.x, 14.x, 15.x]
webpack-version: [latest, next]
webpack-version: [latest, '4']
include:
- node: 14.x
os: ubuntu-latest
Expand Down
40 changes: 20 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"node": ">= 6.9"
},
"dependencies": {
"@ava/babel": "^1.0.1",

This comment has been minimized.

Copy link
@realityking

realityking Nov 10, 2020

Contributor

@nicolo-ribaudo Was this supposed to be a dev dependency?

This breaks installing with engine-strict=true on any Node version before 10.18

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Nov 10, 2020

Author Member

Will release a fix today, I'm also adding a test to ensure that we keep compat with Node.js 6.

"find-cache-dir": "^2.1.0",
"loader-utils": "^1.4.0",
"make-dir": "^2.1.0",
Expand All @@ -24,26 +25,26 @@
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"@babel/preset-env": "^7.12.1",
"ava": "^2.4.0",
"ava": "^3.13.0",
"babel-eslint": "^10.0.1",
"babel-plugin-istanbul": "^5.1.0",
"babel-plugin-react-intl": "^4.1.19",
"cross-env": "^6.0.0",
"eslint": "^6.5.1",
"babel-plugin-istanbul": "^6.0.0",
"babel-plugin-react-intl": "^8.2.15",
"cross-env": "^7.0.2",
"eslint": "^7.13.0",
"eslint-config-babel": "^9.0.0",
"eslint-config-prettier": "^6.3.0",
"eslint-plugin-flowtype": "^4.3.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-prettier": "^3.0.0",
"husky": "^3.0.7",
"lint-staged": "^9.4.1",
"nyc": "^14.1.1",
"prettier": "^1.15.3",
"react": "^16.0.0",
"react-intl": "^3.3.2",
"husky": "^4.3.0",
"lint-staged": "^10.5.1",
"nyc": "^15.1.0",
"prettier": "^2.1.2",
"react": "^17.0.1",
"react-intl": "^5.9.4",
"react-intl-webpack-plugin": "^0.3.0",
"rimraf": "^3.0.0",
"semver": "7.0.0",
"webpack": "^4.0.0"
"semver": "7.3.2",
"webpack": "^5.4.0"
},
"scripts": {
"clean": "rimraf lib/",
Expand Down Expand Up @@ -92,12 +93,11 @@
"!test/fixtures/**/*",
"!test/helpers/**/*"
],
"helpers": [
"**/helpers/**/*"
],
"sources": [
"src/**/*.js"
]
"babel": {
"compileAsTests": [
"test/helpers/**/*"
]
}
},
"lint-staged": {
"scripts/*.js": [
Expand Down
10 changes: 5 additions & 5 deletions src/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const makeDir = require("make-dir");
* @params {String} filename
* @params {Boolean} compress
*/
const read = async function(filename, compress) {
const read = async function (filename, compress) {
const data = await readFile(filename + (compress ? ".gz" : ""));
const content = compress ? await gunzip(data) : data;

Expand All @@ -47,7 +47,7 @@ const read = async function(filename, compress) {
* @params {Boolean} compress
* @params {String} result
*/
const write = async function(filename, compress, result) {
const write = async function (filename, compress, result) {
const content = JSON.stringify(result);

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

const contents = JSON.stringify({ source, options, identifier });
Expand All @@ -78,7 +78,7 @@ const filename = function(source, identifier, options) {
* @params {String} directory
* @params {Object} params
*/
const handleCache = async function(directory, params) {
const handleCache = async function (directory, params) {
const {
source,
options = {},
Expand Down Expand Up @@ -152,7 +152,7 @@ const handleCache = async function(directory, params) {
* });
*/

module.exports = async function(params) {
module.exports = async function (params) {
let directory;

if (typeof params.cacheDirectory === "string") {
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports.custom = makeLoader;
function makeLoader(callback) {
const overrides = callback ? callback(babel) : undefined;

return function(source, inputSourceMap) {
return function (source, inputSourceMap) {
// Make the loader async
const callback = this.async();

Expand Down
2 changes: 1 addition & 1 deletion src/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const LoaderError = require("./Error");

const transform = promisify(babel.transform);

module.exports = async function(source, options) {
module.exports = async function (source, options) {
let result;
try {
result = await transform(source, options);
Expand Down
6 changes: 4 additions & 2 deletions test/helpers/createTestDirectory.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import path from "path";
import mkdirp from "mkdirp";
import fs from "fs";
import rimraf from "rimraf";

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

rimraf(directory, err => {
if (err) return cb(err);
mkdirp(directory, mkdirErr => cb(mkdirErr, directory));
fs.mkdir(directory, { recursive: true }, mkdirErr =>
cb(mkdirErr, directory),
);
});
}

Expand Down
17 changes: 8 additions & 9 deletions test/metadata.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import test from "ava";
import fs from "fs";
import path from "path";
import assign from "object-assign";
import rimraf from "rimraf";
import webpack from "webpack";
import createTestDirectory from "./helpers/createTestDirectory";
Expand All @@ -26,7 +25,7 @@ const globalConfig = {
loader: babelLoader,
options: {
metadataSubscribers: [ReactIntlPlugin.metadataContextFunctionName],
plugins: [["react-intl", { enforceDescriptions: false }]],
plugins: ["react-intl"],
presets: [],
},
exclude: /node_modules/,
Expand All @@ -48,7 +47,7 @@ test.beforeEach.cb(t => {
test.afterEach.cb(t => rimraf(t.context.directory, t.end));

test.cb("should pass metadata code snippet", t => {
const config = assign({}, globalConfig, {
const config = Object.assign({}, globalConfig, {
output: {
path: t.context.directory,
filename: "[id].metadata.js",
Expand All @@ -65,7 +64,7 @@ test.cb("should pass metadata code snippet", t => {
t.true(files.length > 0);
fs.readFile(
path.resolve(t.context.directory, "reactIntlMessages.json"),
function(err, data) {
function (err, data) {
t.is(err, null);
const text = data.toString();
const jsonText = JSON.parse(text);
Expand All @@ -80,7 +79,7 @@ test.cb("should pass metadata code snippet", t => {
});

test.cb("should not throw error", t => {
const config = assign({}, globalConfig, {
const config = Object.assign({}, globalConfig, {
output: {
path: t.context.directory,
filename: "[id].metadata.js",
Expand All @@ -96,7 +95,7 @@ test.cb("should not throw error", t => {
});

test.cb("should throw error", t => {
const config = assign({}, globalConfig, {
const config = Object.assign({}, globalConfig, {
output: {
path: t.context.directory,
filename: "[id].metadata.js",
Expand All @@ -113,7 +112,7 @@ test.cb("should throw error", t => {
});

test.cb("should pass metadata code snippet ( cache version )", t => {
const config = assign({}, globalConfig, {
const config = Object.assign({}, globalConfig, {
output: {
path: t.context.directory,
filename: "[id].metadata.js",
Expand All @@ -125,7 +124,7 @@ test.cb("should pass metadata code snippet ( cache version )", t => {
loader: babelLoader,
options: {
metadataSubscribers: [ReactIntlPlugin.metadataContextFunctionName],
plugins: [["react-intl", { enforceDescriptions: false }]],
plugins: ["react-intl"],
cacheDirectory: cacheDir,
presets: [],
},
Expand All @@ -145,7 +144,7 @@ test.cb("should pass metadata code snippet ( cache version )", t => {
t.true(files.length > 0);
fs.readFile(
path.resolve(t.context.directory, "reactIntlMessages.json"),
function(err, data) {
function (err, data) {
t.is(err, null);
const text = data.toString();
const jsonText = JSON.parse(text);
Expand Down
18 changes: 12 additions & 6 deletions test/sourcemaps.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ test.cb("should output webpack's devtoolModuleFilename option", t => {
devtool: "source-map",
output: {
path: t.context.directory,
devtoolModuleFilenameTemplate: "==[absolute-resource-path]==",
devtoolModuleFilenameTemplate: "=!=!=!=[absolute-resource-path]=!=!=!=",
},
module: {
rules: [
Expand Down Expand Up @@ -171,11 +171,17 @@ test.cb("should output webpack's devtoolModuleFilename option", t => {
t.is(err, null);

// The full absolute path is included in the sourcemap properly
t.not(
data
.toString()
.indexOf(JSON.stringify(`==${globalConfig.entry}==`)),
-1,
t.regex(
data.toString(),
new RegExp(
JSON.stringify(
`=!=!=!=${globalConfig.entry.replace(
// Webpack 5, webpack 4, windows, linux, ...
/\\/g,
"(?:/|\\\\)",
)}=!=!=!=`,
),
),
);

t.end();
Expand Down
Loading

0 comments on commit 4e9c59f

Please sign in to comment.