[babel 8] Remove make-dir polyfill for fs.mkdirSync (#13828)

* [babel 8] Remove `make-dir` polyfill for `fs.makeDitSync`

* `yarn`

* fix

* Inject polyfills in jest tests when needed
This commit is contained in:
Nicolò Ribaudo 2021-10-11 07:01:30 +02:00 committed by GitHub
parent 49a0d65be1
commit 6880898510
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 15 deletions

View File

@ -104,10 +104,12 @@ module.exports = function (api) {
targets = { node: nodeVersion };
needsPolyfillsForOldNode = true;
break;
case "test":
targets = { node: "current" };
needsPolyfillsForOldNode = true;
break;
case "development":
envOpts.debug = true;
// fall through
case "test":
targets = { node: "current" };
break;
}

View File

@ -28,7 +28,7 @@
"convert-source-map": "^1.1.0",
"fs-readdir-recursive": "^1.1.0",
"glob": "^7.0.0",
"make-dir": "^2.1.0",
"make-dir": "condition:BABEL_8_BREAKING ? : ^2.1.0",
"slash": "condition:BABEL_8_BREAKING ? ^3.0.0 : ^2.0.0",
"source-map": "^0.5.0"
},

View File

@ -1,7 +1,6 @@
import readdir from "fs-readdir-recursive";
import * as helper from "@babel/helper-fixtures";
import rimraf from "rimraf";
import { sync as makeDirSync } from "make-dir";
import child from "child_process";
import path from "path";
import fs from "fs";
@ -22,7 +21,7 @@ const fileFilter = function (x) {
};
const outputFileSync = function (filePath, data) {
makeDirSync(path.dirname(filePath));
fs.mkdirSync(path.dirname(filePath), { recursive: true });
fs.writeFileSync(filePath, data);
};

View File

@ -38,7 +38,7 @@
"@babel/helper-fixtures": "workspace:*",
"@babel/runtime": "workspace:*",
"fs-readdir-recursive": "^1.0.0",
"make-dir": "^2.1.0",
"make-dir": "condition:BABEL_8_BREAKING ? : ^2.1.0",
"rimraf": "^3.0.0"
},
"bin": {

View File

@ -1,7 +1,6 @@
import readdir from "fs-readdir-recursive";
import * as helper from "@babel/helper-fixtures";
import rimraf from "rimraf";
import { sync as makeDirSync } from "make-dir";
import child from "child_process";
import path from "path";
import fs from "fs";
@ -20,7 +19,7 @@ const fileFilter = function (x) {
};
const outputFileSync = function (filePath, data) {
makeDirSync(path.dirname(filePath));
fs.mkdirSync(path.dirname(filePath), { recursive: true });
fs.writeFileSync(filePath, data);
};

View File

@ -40,7 +40,7 @@
"@babel/runtime-corejs3": "workspace:*",
"@babel/template": "workspace:*",
"@babel/types": "workspace:*",
"make-dir": "^2.1.0"
"make-dir": "condition:BABEL_8_BREAKING ? : ^2.1.0"
},
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-runtime",
"engines": {

View File

@ -19,7 +19,7 @@
"dependencies": {
"clone-deep": "^4.0.1",
"find-cache-dir": "condition:BABEL_8_BREAKING ? ^3.3.1 : ^2.0.0",
"make-dir": "^2.1.0",
"make-dir": "condition:BABEL_8_BREAKING ? : ^2.1.0",
"pirates": "^4.0.0",
"source-map-support": "^0.5.16"
},

View File

@ -134,7 +134,7 @@ __metadata:
convert-source-map: ^1.1.0
fs-readdir-recursive: ^1.1.0
glob: ^7.0.0
make-dir: ^2.1.0
make-dir: "condition:BABEL_8_BREAKING ? : ^2.1.0"
rimraf: ^3.0.0
slash: "condition:BABEL_8_BREAKING ? ^3.0.0 : ^2.0.0"
source-map: ^0.5.0
@ -972,7 +972,7 @@ __metadata:
commander: ^4.0.1
core-js: ^3.16.0
fs-readdir-recursive: ^1.0.0
make-dir: ^2.1.0
make-dir: "condition:BABEL_8_BREAKING ? : ^2.1.0"
node-environment-flags: ^1.0.5
regenerator-runtime: ^0.13.4
rimraf: ^3.0.0
@ -2872,7 +2872,7 @@ __metadata:
babel-plugin-polyfill-corejs2: ^0.2.2
babel-plugin-polyfill-corejs3: ^0.2.5
babel-plugin-polyfill-regenerator: ^0.2.2
make-dir: ^2.1.0
make-dir: "condition:BABEL_8_BREAKING ? : ^2.1.0"
semver: "condition:BABEL_8_BREAKING ? ^7.3.4 : ^6.3.0"
peerDependencies:
"@babel/core": ^7.0.0-0
@ -3366,7 +3366,7 @@ __metadata:
browserify: ^16.5.2
clone-deep: ^4.0.1
find-cache-dir: "condition:BABEL_8_BREAKING ? ^3.3.1 : ^2.0.0"
make-dir: ^2.1.0
make-dir: "condition:BABEL_8_BREAKING ? : ^2.1.0"
pirates: ^4.0.0
source-map-support: ^0.5.16
peerDependencies:
@ -11190,7 +11190,7 @@ fsevents@^1.2.7:
languageName: node
linkType: hard
"make-dir@npm:^2.0.0, make-dir@npm:^2.1.0":
"make-dir-BABEL_8_BREAKING-false@npm:make-dir@^2.1.0, make-dir@npm:^2.0.0, make-dir@npm:^2.1.0":
version: 2.1.0
resolution: "make-dir@npm:2.1.0"
dependencies:
@ -11200,6 +11200,15 @@ fsevents@^1.2.7:
languageName: node
linkType: hard
"make-dir@condition:BABEL_8_BREAKING ? : ^2.1.0":
version: 0.0.0-condition-86eacd
resolution: "make-dir@condition:BABEL_8_BREAKING?:^2.1.0#86eacd"
dependencies:
make-dir-BABEL_8_BREAKING-false: "npm:make-dir@^2.1.0"
checksum: 98e37a75730bfb08722d3eac1295aa8a73960791e662f16491c49397f193f44ce2ac32938b71059b43ae9ff48003610edeeb2c59ac86c20d4b21d02a6dcc54a0
languageName: node
linkType: hard
"make-dir@npm:^3.0.0, make-dir@npm:^3.0.2":
version: 3.1.0
resolution: "make-dir@npm:3.1.0"