Skip to content

Commit

Permalink
Remove caller option check (#1007)
Browse files Browse the repository at this point in the history
* Remove caller option check

Babel 7.12+ supports .caller options

* update deps

* add Node 20 to CI matrix

* Update yarn to 3.6.4
  • Loading branch information
JLHwung authored Nov 17, 2023
1 parent c9d65eb commit a186b8b
Show file tree
Hide file tree
Showing 6 changed files with 903 additions and 926 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [14, 16, 18]
node-version: [14, 16, 18, 20]
webpack-version: ['5']
include:
- node-version: "14.15.0" # The minimum supported node version
Expand Down
426 changes: 213 additions & 213 deletions .yarn/releases/yarn-3.6.1.cjs → .yarn/releases/yarn-3.6.4.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
yarnPath: .yarn/releases/yarn-3.6.1.cjs
yarnPath: .yarn/releases/yarn-3.6.4.cjs
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
},
"devDependencies": {
"@ava/babel": "^1.0.1",
"@babel/cli": "^7.22.9",
"@babel/core": "^7.22.9",
"@babel/eslint-parser": "^7.22.9",
"@babel/preset-env": "^7.22.9",
"@babel/cli": "^7.23.0",
"@babel/core": "^7.23.3",
"@babel/eslint-parser": "^7.23.3",
"@babel/preset-env": "^7.23.3",
"ava": "^3.13.0",
"babel-plugin-react-intl": "^8.2.25",
"c8": "^8.0.0",
Expand All @@ -38,7 +38,7 @@
"react-intl-webpack-plugin": "^0.3.0",
"rimraf": "^5.0.1",
"semver": "7.5.2",
"webpack": "^5.74.0"
"webpack": "^5.89.0"
},
"scripts": {
"clean": "rimraf lib/",
Expand Down Expand Up @@ -118,5 +118,5 @@
"git add yarn.lock"
]
},
"packageManager": "[email protected].1"
"packageManager": "[email protected].4"
}
27 changes: 0 additions & 27 deletions src/injectCaller.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
const babel = require("@babel/core");

module.exports = function injectCaller(opts, target) {
if (!supportsCallerOption()) return opts;

return Object.assign({}, opts, {
caller: Object.assign(
{
Expand All @@ -25,26 +21,3 @@ module.exports = function injectCaller(opts, target) {
),
});
};

// TODO: We can remove this eventually, I'm just adding it so that people have
// a little time to migrate to the newer RCs of @babel/core without getting
// hard-to-diagnose errors about unknown 'caller' options.
let supportsCallerOptionFlag = undefined;
function supportsCallerOption() {
if (supportsCallerOptionFlag === undefined) {
try {
// Rather than try to match the Babel version, we just see if it throws
// when passed a 'caller' flag, and use that to decide if it is supported.
babel.loadPartialConfig({
caller: undefined,
babelrc: false,
configFile: false,
});
supportsCallerOptionFlag = true;
} catch (err) {
supportsCallerOptionFlag = false;
}
}

return supportsCallerOptionFlag;
}
Loading

0 comments on commit a186b8b

Please sign in to comment.