diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-08-30 17:21:18 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-08-30 17:21:18 +0800 |
| commit | efbc2ffe6a1ee5ec38a4396305561d6515d0943e (patch) | |
| tree | 2b4c94f18f2c792dfda813050755d5c0273fae22 /node_modules/@babel/cli/lib/babel/util.js | |
| parent | 43acceb75957c880a5ba5a31aae221394a36d5f6 (diff) | |
node fixes, updates
Diffstat (limited to 'node_modules/@babel/cli/lib/babel/util.js')
| -rw-r--r-- | node_modules/@babel/cli/lib/babel/util.js | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/node_modules/@babel/cli/lib/babel/util.js b/node_modules/@babel/cli/lib/babel/util.js index 79ab3281..5a1005f9 100644 --- a/node_modules/@babel/cli/lib/babel/util.js +++ b/node_modules/@babel/cli/lib/babel/util.js @@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.addSourceMappingUrl = addSourceMappingUrl; +exports.alphasort = alphasort; exports.chmod = chmod; exports.compile = compile; exports.debounce = debounce; @@ -43,21 +44,26 @@ function _fs() { return data; } var watcher = require("./watcher.js"); -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } +function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } +function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } function chmod(src, dest) { try { _fs().chmodSync(dest, _fs().statSync(src).mode); - } catch (err) { + } catch (_) { console.warn(`Cannot change permissions of ${dest}`); } } +function alphasort(a, b) { + return a.localeCompare(b, "en"); +} function readdir(dirname, includeDotfiles, filter) { - return _fsReaddirRecursive()(dirname, (filename, index, currentDirectory) => { - const stat = _fs().statSync(_path().join(currentDirectory, filename)); - if (stat.isDirectory()) return true; - return (includeDotfiles || filename[0] !== ".") && (!filter || filter(filename)); - }); + { + return _fsReaddirRecursive()("", (filename, index, currentDirectory) => { + const stat = _fs().statSync(_path().join(currentDirectory, filename)); + if (stat.isDirectory()) return true; + return (includeDotfiles || filename[0] !== ".") && (!filter || filter(filename)); + }, [], dirname); + } } function readdirForCompilable(dirname, includeDotfiles, altExts) { return readdir(dirname, includeDotfiles, function (filename) { @@ -114,17 +120,22 @@ function _compile() { return _compile.apply(this, arguments); } function deleteDir(path) { - if (_fs().existsSync(path)) { - _fs().readdirSync(path).forEach(function (file) { - const curPath = path + "/" + file; - if (_fs().lstatSync(curPath).isDirectory()) { - deleteDir(curPath); - } else { - _fs().unlinkSync(curPath); - } - }); - _fs().rmdirSync(path); - } + (_fs().rmSync || function d(p) { + if (_fs().existsSync(p)) { + _fs().readdirSync(p).forEach(function (f) { + const c = p + "/" + f; + if (_fs().lstatSync(c).isDirectory()) { + d(c); + } else { + _fs().unlinkSync(c); + } + }); + _fs().rmdirSync(p); + } + })(path, { + force: true, + recursive: true + }); } process.on("uncaughtException", function (err) { console.error(err); |
