Skip to content

Commit c43e71c

Browse files
committedJan 9, 2023
chore: Update dependencies and find-babel-config to fix json5 vulnerabilities (#441)
Update find-babel-config to v2 to fix json5 vulnerabilities BREAKING CHANGE: Remove support for Node < 16
1 parent f2daf06 commit c43e71c

File tree

7 files changed

+13996
-14173
lines changed

7 files changed

+13996
-14173
lines changed
 

‎.babelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"@babel/preset-env",
55
{
66
"targets": {
7-
"node": 8
7+
"node": 16
88
},
99
"loose": true
1010
}

‎.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
node-version: [10.x, 12.x, 14.x, 15.x]
15+
node-version: [16.x, 18.x, 19.x]
1616

1717
steps:
1818
- uses: actions/checkout@v1

‎appveyor.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
environment:
22
matrix:
3-
- nodejs_version: '8'
4-
- nodejs_version: '9'
5-
- nodejs_version: '10'
6-
- nodejs_version: '11'
3+
- nodejs_version: '16'
4+
- nodejs_version: '18'
5+
- nodejs_version: '19'
76
install:
87
- ps: Install-Product node $env:nodejs_version
98
- set CI=true

‎package-lock.json

+13,609-13,663
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+14-15
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"url": "https://github.com/tleunen/babel-plugin-module-resolver.git"
99
},
1010
"engines": {
11-
"node": ">= 8.0.0"
11+
"node": ">= 16"
1212
},
1313
"files": [
1414
"lib"
@@ -33,27 +33,27 @@
3333
"import"
3434
],
3535
"dependencies": {
36-
"find-babel-config": "^1.2.0",
37-
"glob": "^7.1.6",
36+
"find-babel-config": "^2.0.0",
37+
"glob": "^8.0.3",
3838
"pkg-up": "^3.1.0",
39-
"reselect": "^4.0.0",
40-
"resolve": "^1.13.1"
39+
"reselect": "^4.1.7",
40+
"resolve": "^1.22.1"
4141
},
4242
"devDependencies": {
43-
"@babel/cli": "^7.7.5",
44-
"@babel/core": "^7.7.5",
45-
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
46-
"@babel/plugin-transform-modules-commonjs": "^7.7.5",
47-
"@babel/preset-env": "^7.7.6",
43+
"@babel/cli": "^7.20.7",
44+
"@babel/core": "^7.20.12",
45+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
46+
"@babel/plugin-transform-modules-commonjs": "^7.20.11",
47+
"@babel/preset-env": "^7.20.2",
4848
"babel-core": "^7.0.0-bridge.0",
49-
"babel-jest": "^24.9.0",
50-
"common-tags": "^1.8.0",
49+
"babel-jest": "^29.3.1",
50+
"common-tags": "^1.8.2",
5151
"eslint": "^6.7.2",
5252
"eslint-config-airbnb-base": "^14.0.0",
5353
"eslint-config-prettier": "^6.7.0",
5454
"eslint-plugin-import": "^2.19.1",
5555
"husky": "^4.3.6",
56-
"jest": "^24.9.0",
56+
"jest": "^29.3.1",
5757
"lint-staged": "^10.5.3",
5858
"prettier-eslint-cli": "^5.0.0",
5959
"standard-version": "^9.0.0"
@@ -75,8 +75,7 @@
7575
},
7676
"lint-staged": {
7777
"*.{js}": [
78-
"prettier-eslint --write",
79-
"git add"
78+
"prettier-eslint --write"
8079
]
8180
},
8281
"jest": {

‎src/resolvePath.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import path from 'path';
33
import { warn } from './log';
44
import mapToRelative from './mapToRelative';
55
import normalizeOptions from './normalizeOptions';
6-
import { nodeResolvePath, replaceExtension, isRelativePath, toLocalPath, toPosixPath } from './utils';
6+
import {
7+
nodeResolvePath,
8+
replaceExtension,
9+
isRelativePath,
10+
toLocalPath,
11+
toPosixPath,
12+
} from './utils';
713

814
function getRelativePath(sourcePath, currentFile, absFileInRoot, opts) {
915
const realSourceFileExtension = path.extname(absFileInRoot);
@@ -21,8 +27,9 @@ function findPathInRoots(sourcePath, { extensions, root }) {
2127
// Search the source path inside every custom root directory
2228
let resolvedSourceFile;
2329

24-
root.some((basedir) => {
30+
root.some(basedir => {
2531
resolvedSourceFile = nodeResolvePath(`./${sourcePath}`, basedir, extensions);
32+
2633
return resolvedSourceFile !== null;
2734
});
2835

@@ -77,9 +84,7 @@ function resolvePathFromAliasConfig(sourcePath, currentFile, opts) {
7784
}
7885

7986
if (isRelativePath(aliasedSourceFile)) {
80-
return toLocalPath(toPosixPath(
81-
mapToRelative(opts.cwd, currentFile, aliasedSourceFile)),
82-
);
87+
return toLocalPath(toPosixPath(mapToRelative(opts.cwd, currentFile, aliasedSourceFile)));
8388
}
8489

8590
if (process.env.NODE_ENV !== 'production') {
@@ -89,10 +94,7 @@ function resolvePathFromAliasConfig(sourcePath, currentFile, opts) {
8994
return aliasedSourceFile;
9095
}
9196

92-
const resolvers = [
93-
resolvePathFromAliasConfig,
94-
resolvePathFromRootConfig,
95-
];
97+
const resolvers = [resolvePathFromAliasConfig, resolvePathFromRootConfig];
9698

9799
export default function resolvePath(sourcePath, currentFile, opts) {
98100
if (isRelativePath(sourcePath)) {
@@ -106,7 +108,7 @@ export default function resolvePath(sourcePath, currentFile, opts) {
106108
const absoluteCurrentFile = path.resolve(currentFile);
107109
let resolvedPath = null;
108110

109-
resolvers.some((resolver) => {
111+
resolvers.some(resolver => {
110112
resolvedPath = resolver(sourcePath, absoluteCurrentFile, normalizedOpts);
111113
return resolvedPath !== null;
112114
});

‎test/index.test.js

+356-479
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.