diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 881362650bc3..962668d1a050 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -17,7 +17,6 @@ "glob": "^5.0.5", "lodash": "^4.2.0", "output-file-sync": "^1.1.0", - "path-exists": "^1.0.0", "path-is-absolute": "^1.0.0", "slash": "^1.0.0", "source-map": "^0.5.0", diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index 6bdb2fc19461..78be975c8885 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -1,5 +1,4 @@ let outputFileSync = require("output-file-sync"); -let pathExists = require("path-exists"); let slash = require("slash"); let path = require("path"); let util = require("./util"); @@ -45,7 +44,7 @@ module.exports = function (commander, filenames) { } function handle(filename) { - if (!pathExists.sync(filename)) return; + if (!fs.existsSync(filename)) return; let stat = fs.statSync(filename); diff --git a/packages/babel-cli/src/babel/file.js b/packages/babel-cli/src/babel/file.js index d2ab659ab84e..1feb8d2aadc3 100644 --- a/packages/babel-cli/src/babel/file.js +++ b/packages/babel-cli/src/babel/file.js @@ -1,5 +1,4 @@ let convertSourceMap = require("convert-source-map"); -let pathExists = require("path-exists"); let sourceMap = require("source-map"); let slash = require("slash"); let path = require("path"); @@ -109,7 +108,7 @@ module.exports = function (commander, filenames, opts) { results = []; _.each(filenames, function (filename) { - if (!pathExists.sync(filename)) return; + if (!fs.existsSync(filename)) return; let stat = fs.statSync(filename); if (stat.isDirectory()) { diff --git a/packages/babel-cli/src/babel/index.js b/packages/babel-cli/src/babel/index.js index 09ef16731e2d..236c2df72aae 100755 --- a/packages/babel-cli/src/babel/index.js +++ b/packages/babel-cli/src/babel/index.js @@ -3,7 +3,7 @@ require("babel-core"); -let pathExists = require("path-exists"); +let fs = require("fs"); let commander = require("commander"); let kebabCase = require("lodash/kebabCase"); let options = require("babel-core").options; @@ -70,7 +70,7 @@ let filenames = commander.args.reduce(function (globbed, input) { filenames = uniq(filenames); each(filenames, function (filename) { - if (!pathExists.sync(filename)) { + if (!fs.existsSync(filename)) { errors.push(filename + " doesn't exist"); } }); diff --git a/packages/babel-cli/test/index.js b/packages/babel-cli/test/index.js index daacda4ee519..61cb19aed949 100644 --- a/packages/babel-cli/test/index.js +++ b/packages/babel-cli/test/index.js @@ -7,7 +7,6 @@ let child = require("child_process"); let path = require("path"); let chai = require("chai"); let fs = require("fs"); -let pathExists = require("path-exists"); let _ = require("lodash"); let fixtureLoc = path.join(__dirname, "fixtures"); @@ -25,7 +24,7 @@ let pluginLocs = [ let readDir = function (loc) { let files = {}; - if (pathExists.sync(loc)) { + if (fs.existsSync(loc)) { _.each(readdir(loc), function (filename) { files[filename] = helper.readFile(path.join(loc, filename)); }); @@ -130,7 +129,7 @@ let buildTest = function (binName, testName, opts) { let clear = function () { process.chdir(__dirname); - if (pathExists.sync(tmpLoc)) rimraf.sync(tmpLoc); + if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc); fs.mkdirSync(tmpLoc); process.chdir(tmpLoc); }; @@ -150,11 +149,11 @@ _.each(fs.readdirSync(fixtureLoc), function (binName) { }; let optionsLoc = path.join(testLoc, "options.json"); - if (pathExists.sync(optionsLoc)) _.merge(opts, require(optionsLoc)); + if (fs.existsSync(optionsLoc)) _.merge(opts, require(optionsLoc)); _.each(["stdout", "stdin", "stderr"], function (key) { let loc = path.join(testLoc, key + ".txt"); - if (pathExists.sync(loc)) { + if (fs.existsSync(loc)) { opts[key] = helper.readFile(loc); } else { opts[key] = opts[key] || ""; @@ -165,7 +164,7 @@ _.each(fs.readdirSync(fixtureLoc), function (binName) { opts.inFiles = readDir(path.join(testLoc, "in-files")); let babelrcLoc = path.join(testLoc, ".babelrc"); - if (pathExists.sync(babelrcLoc)) { + if (fs.existsSync(babelrcLoc)) { // copy .babelrc file to tmp directory opts.inFiles[".babelrc"] = helper.readFile(babelrcLoc); } diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 0e644c503c9a..ac433daae610 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -39,7 +39,6 @@ "json5": "^0.5.0", "lodash": "^4.2.0", "minimatch": "^3.0.2", - "path-exists": "^1.0.0", "path-is-absolute": "^1.0.0", "private": "^0.1.6", "slash": "^1.0.0", diff --git a/packages/babel-core/src/transformation/file/options/build-config-chain.js b/packages/babel-core/src/transformation/file/options/build-config-chain.js index efeb3af8f2e6..02ce7376413a 100644 --- a/packages/babel-core/src/transformation/file/options/build-config-chain.js +++ b/packages/babel-core/src/transformation/file/options/build-config-chain.js @@ -3,7 +3,6 @@ import type Logger from "../logger"; import resolve from "../../../helpers/resolve"; import json5 from "json5"; import isAbsolute from "path-is-absolute"; -import pathExists from "path-exists"; import path from "path"; import fs from "fs"; @@ -17,7 +16,7 @@ const PACKAGE_FILENAME = "package.json"; function exists(filename) { let cached = existsCache[filename]; if (cached == null) { - return existsCache[filename] = pathExists.sync(filename); + return existsCache[filename] = fs.existsSync(filename); } else { return cached; } diff --git a/packages/babel-helper-fixtures/package.json b/packages/babel-helper-fixtures/package.json index ab02ac44aae6..c70c93cfb9b5 100644 --- a/packages/babel-helper-fixtures/package.json +++ b/packages/babel-helper-fixtures/package.json @@ -9,7 +9,6 @@ "dependencies": { "babel-runtime": "^6.9.0", "lodash": "^4.2.0", - "path-exists": "^1.0.0", "try-resolve": "^1.0.0" } } diff --git a/packages/babel-helper-fixtures/src/index.js b/packages/babel-helper-fixtures/src/index.js index 9abbf8845ea4..28481e1d6743 100644 --- a/packages/babel-helper-fixtures/src/index.js +++ b/packages/babel-helper-fixtures/src/index.js @@ -1,4 +1,3 @@ -import pathExists from "path-exists"; import resolve from "try-resolve"; import path from "path"; import fs from "fs"; @@ -132,12 +131,12 @@ export default function get(entryLoc): Array { suite.tests.push(test); let sourceMappingsLoc = taskDir + "/source-mappings.json"; - if (pathExists.sync(sourceMappingsLoc)) { + if (fs.existsSync(sourceMappingsLoc)) { test.sourceMappings = JSON.parse(readFile(sourceMappingsLoc)); } let sourceMapLoc = taskDir + "/source-map.json"; - if (pathExists.sync(sourceMapLoc)) { + if (fs.existsSync(sourceMapLoc)) { test.sourceMap = JSON.parse(readFile(sourceMapLoc)); } } @@ -162,7 +161,7 @@ export function multiple(entryLoc, ignore?: Array) { } export function readFile(filename) { - if (pathExists.sync(filename)) { + if (fs.existsSync(filename)) { let file = _.trimEnd(fs.readFileSync(filename, "utf8")); file = file.replace(/\r\n/g, "\n"); return file; diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index a57f24215b71..d42f4bf9aa1f 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -14,7 +14,6 @@ "home-or-tmp": "^2.0.0", "lodash": "^4.2.0", "mkdirp": "^0.5.1", - "path-exists": "^1.0.0", "source-map-support": "^0.4.2" } } diff --git a/packages/babel-register/src/cache.js b/packages/babel-register/src/cache.js index 8c5177a00c3d..4b08e63ac753 100644 --- a/packages/babel-register/src/cache.js +++ b/packages/babel-register/src/cache.js @@ -2,7 +2,6 @@ import path from "path"; import fs from "fs"; import { sync as mkdirpSync } from "mkdirp"; import homeOrTmp from "home-or-tmp"; -import pathExists from "path-exists"; const FILENAME = process.env.BABEL_CACHE_PATH || path.join(homeOrTmp, ".babel.json"); let data = {}; @@ -37,7 +36,7 @@ export function load() { process.on("exit", save); process.nextTick(save); - if (!pathExists.sync(FILENAME)) return; + if (!fs.existsSync(FILENAME)) return; try { data = JSON.parse(fs.readFileSync(FILENAME));