Socket
Socket
Sign inDemoInstall

@babel/cli

Package Overview
Dependencies
7
Maintainers
4
Versions
118
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.21.4-esm.4 to 7.21.5

28

lib/babel-external-helpers.js

@@ -1,3 +0,17 @@

import commander from "commander";
import { buildExternalHelpers } from "@babel/core";
"use strict";
function _commander() {
const data = require("commander");
_commander = function () {
return data;
};
return data;
}
function _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
function collect(value, previousValue) {

@@ -12,8 +26,8 @@ if (typeof value !== "string") return previousValue;

}
commander.option("-l, --whitelist [whitelist]", "Whitelist of helpers to ONLY include", collect);
commander.option("-t, --output-type [type]", "Type of output (global|umd|var)", "global");
commander.usage("[options]");
commander.parse(process.argv);
console.log(buildExternalHelpers(commander.whitelist, commander.outputType));
_commander().option("-l, --whitelist [whitelist]", "Whitelist of helpers to ONLY include", collect);
_commander().option("-t, --output-type [type]", "Type of output (global|umd|var)", "global");
_commander().usage("[options]");
_commander().parse(process.argv);
console.log((0, _core().buildExternalHelpers)(_commander().whitelist, _commander().outputType));
//# sourceMappingURL=babel-external-helpers.js.map

@@ -0,8 +1,32 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _slash() {
const data = require("slash");
_slash = function () {
return data;
};
return data;
}
function _path() {
const data = require("path");
_path = function () {
return data;
};
return data;
}
function _fs() {
const data = require("fs");
_fs = function () {
return data;
};
return data;
}
var util = require("./util");
var watcher = require("./watcher");
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); }); }; }
import slash from "slash";
import path from "path";
import fs from "fs";
import * as util from "./util.js";
import * as watcher from "./watcher.js";
const FILE_TYPE = Object.freeze({

@@ -15,8 +39,8 @@ NON_COMPILABLE: "NON_COMPILABLE",

function outputFileSync(filePath, data) {
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? fs.mkdirSync : require("make-dir").sync)(path.dirname(filePath), {
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(_path().dirname(filePath), {
recursive: true
});
fs.writeFileSync(filePath, data);
_fs().writeFileSync(filePath, data);
}
export default function (_x) {
function _default(_x) {
return _ref.apply(this, arguments);

@@ -34,11 +58,11 @@ }

_write = _asyncToGenerator(function* (src, base) {
let relative = path.relative(base, src);
let relative = _path().relative(base, src);
if (!util.isCompilableExtension(relative, cliOptions.extensions)) {
return FILE_TYPE.NON_COMPILABLE;
}
relative = util.withExtension(relative, cliOptions.keepFileExtension ? path.extname(relative) : cliOptions.outFileExtension);
relative = util.withExtension(relative, cliOptions.keepFileExtension ? _path().extname(relative) : cliOptions.outFileExtension);
const dest = getDest(relative, base);
try {
const res = yield util.compile(src, Object.assign({}, babelOptions, {
sourceFileName: slash(path.relative(dest + "/..", src))
sourceFileName: _slash()(_path().relative(dest + "/..", src))
}));

@@ -58,3 +82,3 @@ if (!res) return FILE_TYPE.IGNORED;

}
res.map.file = path.basename(relative);
res.map.file = _path().basename(relative);
outputFileSync(mapLoc, JSON.stringify(res.map));

@@ -66,3 +90,3 @@ }

if (cliOptions.verbose) {
console.log(path.relative(process.cwd(), src) + " -> " + dest);
console.log(_path().relative(process.cwd(), src) + " -> " + dest);
}

@@ -82,5 +106,5 @@ return FILE_TYPE.COMPILED;

if (cliOptions.relative) {
return path.join(base, cliOptions.outDir, filename);
return _path().join(base, cliOptions.outDir, filename);
}
return path.join(cliOptions.outDir, filename);
return _path().join(cliOptions.outDir, filename);
}

@@ -94,5 +118,5 @@ function handleFile(_x4, _x5) {

if (cliOptions.copyFiles && written === FILE_TYPE.NON_COMPILABLE || cliOptions.copyIgnored && written === FILE_TYPE.IGNORED) {
const filename = path.relative(base, src);
const filename = _path().relative(base, src);
const dest = getDest(filename, base);
outputFileSync(dest, fs.readFileSync(src));
outputFileSync(dest, _fs().readFileSync(src));
util.chmod(src, dest);

@@ -109,4 +133,4 @@ }

_handle = _asyncToGenerator(function* (filenameOrDir) {
if (!fs.existsSync(filenameOrDir)) return 0;
const stat = fs.statSync(filenameOrDir);
if (!_fs().existsSync(filenameOrDir)) return 0;
const stat = _fs().statSync(filenameOrDir);
if (stat.isDirectory()) {

@@ -117,3 +141,3 @@ const dirname = filenameOrDir;

for (const filename of files) {
const src = path.join(dirname, filename);
const src = _path().join(dirname, filename);
const written = yield handleFile(src, dirname);

@@ -125,3 +149,3 @@ if (written) count += 1;

const filename = filenameOrDir;
const written = yield handleFile(filename, path.dirname(filename));
const written = yield handleFile(filename, _path().dirname(filename));
return written ? 1 : 0;

@@ -150,3 +174,3 @@ }

}
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? fs.mkdirSync : require("make-dir").sync)(cliOptions.outDir, {
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(cliOptions.outDir, {
recursive: true

@@ -171,13 +195,13 @@ });

const base = filenames[0];
const absoluteBase = path.resolve(base);
const absoluteBase = _path().resolve(base);
getBase = filename => {
return filename === absoluteBase ? path.dirname(base) : base;
return filename === absoluteBase ? _path().dirname(base) : base;
};
} else {
const filenameToBaseMap = new Map(filenames.map(filename => {
const absoluteFilename = path.resolve(filename);
return [absoluteFilename, path.dirname(filename)];
const absoluteFilename = _path().resolve(filename);
return [absoluteFilename, _path().dirname(filename)];
}));
const absoluteFilenames = new Map(filenames.map(filename => {
const absoluteFilename = path.resolve(filename);
const absoluteFilename = _path().resolve(filename);
return [absoluteFilename, filename];

@@ -187,3 +211,3 @@ }));

sep
} = path;
} = _path();
getBase = filename => {

@@ -190,0 +214,0 @@ const base = filenameToBaseMap.get(filename);

@@ -0,11 +1,47 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
function _convertSourceMap() {
const data = require("convert-source-map");
_convertSourceMap = function () {
return data;
};
return data;
}
function _traceMapping() {
const data = require("@jridgewell/trace-mapping");
_traceMapping = function () {
return data;
};
return data;
}
function _slash() {
const data = require("slash");
_slash = function () {
return data;
};
return data;
}
function _path() {
const data = require("path");
_path = function () {
return data;
};
return data;
}
function _fs() {
const data = require("fs");
_fs = function () {
return data;
};
return data;
}
var util = require("./util");
var watcher = require("./watcher");
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); }); }; }
import convertSourceMap from "convert-source-map";
import { AnyMap, encodedMap } from "@jridgewell/trace-mapping";
import slash from "slash";
import path from "path";
import fs from "fs";
import * as util from "./util.js";
import * as watcher from "./watcher.js";
export default function (_x) {
function _default(_x) {
return _ref.apply(this, arguments);

@@ -41,5 +77,5 @@ }

}
const map = new AnyMap({
const map = new (_traceMapping().AnyMap)({
version: 3,
file: cliOptions.sourceMapTarget || path.basename(cliOptions.outFile || "") || "stdout",
file: cliOptions.sourceMapTarget || _path().basename(cliOptions.outFile || "") || "stdout",
sections: mapSections

@@ -49,3 +85,3 @@ });

if (babelOptions.sourceMaps === "inline" || !cliOptions.outFile && babelOptions.sourceMaps) {
code += "\n" + convertSourceMap.fromObject(encodedMap(map)).toComment();
code += "\n" + _convertSourceMap().fromObject((0, _traceMapping().encodedMap)(map)).toComment();
}

@@ -69,3 +105,3 @@ return {

if (cliOptions.outFile) {
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? fs.mkdirSync : require("make-dir").sync)(path.dirname(cliOptions.outFile), {
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(_path().dirname(cliOptions.outFile), {
recursive: true

@@ -84,5 +120,5 @@ });

}
fs.writeFileSync(mapLoc, JSON.stringify(encodedMap(result.map)));
_fs().writeFileSync(mapLoc, JSON.stringify((0, _traceMapping().encodedMap)(result.map)));
}
fs.writeFileSync(cliOptions.outFile, result.code);
_fs().writeFileSync(cliOptions.outFile, result.code);
} else {

@@ -126,8 +162,8 @@ process.stdout.write(result.code + "\n");

filenames.forEach(function (filename) {
if (!fs.existsSync(filename)) return;
const stat = fs.statSync(filename);
if (!_fs().existsSync(filename)) return;
const stat = _fs().statSync(filename);
if (stat.isDirectory()) {
const dirname = filename;
util.readdirForCompilable(filename, cliOptions.includeDotfiles, cliOptions.extensions).forEach(function (filename) {
_filenames.push(path.join(dirname, filename));
_filenames.push(_path().join(dirname, filename));
});

@@ -141,5 +177,5 @@ } else {

if (cliOptions.outFile) {
sourceFilename = path.relative(path.dirname(cliOptions.outFile), sourceFilename);
sourceFilename = _path().relative(_path().dirname(cliOptions.outFile), sourceFilename);
}
sourceFilename = slash(sourceFilename);
sourceFilename = _slash()(sourceFilename);
try {

@@ -146,0 +182,0 @@ return yield util.compile(filename, Object.assign({}, babelOptions, {

#!/usr/bin/env node
import parseArgv from "./options.js";
import dirCommand from "./dir.js";
import fileCommand from "./file.js";
const opts = parseArgv(process.argv);
"use strict";
var _options = require("./options");
var _dir = require("./dir");
var _file = require("./file");
const opts = (0, _options.default)(process.argv);
if (opts) {
const fn = opts.cliOptions.outDir ? dirCommand : fileCommand;
const fn = opts.cliOptions.outDir ? _dir.default : _file.default;
fn(opts).catch(err => {

@@ -9,0 +11,0 @@ console.error(err);

@@ -1,53 +0,83 @@

import fs from "fs";
import commander from "commander";
import { version, DEFAULT_EXTENSIONS } from "@babel/core";
import glob from "glob";
commander.option("-f, --filename [filename]", "The filename to use when reading from stdin. This will be used in source-maps, errors etc.");
commander.option("--presets [list]", "A comma-separated list of preset names.", collect);
commander.option("--plugins [list]", "A comma-separated list of plugin names.", collect);
commander.option("--config-file [path]", "Path to a .babelrc file to use.");
commander.option("--env-name [name]", "The name of the 'env' to use when loading configs and plugins. " + "Defaults to the value of BABEL_ENV, or else NODE_ENV, or else 'development'.");
commander.option("--root-mode [mode]", "The project-root resolution mode. " + "One of 'root' (the default), 'upward', or 'upward-optional'.");
commander.option("--source-type [script|module]", "");
commander.option("--no-babelrc", "Whether or not to look up .babelrc and .babelignore files.");
commander.option("--ignore [list]", "List of glob paths to **not** compile.", collect);
commander.option("--only [list]", "List of glob paths to **only** compile.", collect);
commander.option("--no-highlight-code", "Enable or disable ANSI syntax highlighting of code frames. (on by default)");
commander.option("--no-comments", "Write comments to generated output. (true by default)");
commander.option("--retain-lines", "Retain line numbers. This will result in really ugly code.");
commander.option("--compact [true|false|auto]", "Do not include superfluous whitespace characters and line terminators.", booleanify);
commander.option("--minified", "Save as many bytes when printing. (false by default)");
commander.option("--auxiliary-comment-before [string]", "Print a comment before any injected non-user code.");
commander.option("--auxiliary-comment-after [string]", "Print a comment after any injected non-user code.");
commander.option("-s, --source-maps [true|false|inline|both]", "", booleanify, undefined);
commander.option("--source-map-target [string]", "Set `file` on returned source map.");
commander.option("--source-file-name [string]", "Set `sources[0]` on returned source map.");
commander.option("--source-root [filename]", "The root from which all sources are relative.");
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = parseArgv;
function _fs() {
const data = require("fs");
_fs = function () {
return data;
};
return data;
}
function _commander() {
const data = require("commander");
_commander = function () {
return data;
};
return data;
}
function _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
function _glob() {
const data = require("glob");
_glob = function () {
return data;
};
return data;
}
_commander().option("-f, --filename [filename]", "The filename to use when reading from stdin. This will be used in source-maps, errors etc.");
_commander().option("--presets [list]", "A comma-separated list of preset names.", collect);
_commander().option("--plugins [list]", "A comma-separated list of plugin names.", collect);
_commander().option("--config-file [path]", "Path to a .babelrc file to use.");
_commander().option("--env-name [name]", "The name of the 'env' to use when loading configs and plugins. " + "Defaults to the value of BABEL_ENV, or else NODE_ENV, or else 'development'.");
_commander().option("--root-mode [mode]", "The project-root resolution mode. " + "One of 'root' (the default), 'upward', or 'upward-optional'.");
_commander().option("--source-type [script|module]", "");
_commander().option("--no-babelrc", "Whether or not to look up .babelrc and .babelignore files.");
_commander().option("--ignore [list]", "List of glob paths to **not** compile.", collect);
_commander().option("--only [list]", "List of glob paths to **only** compile.", collect);
_commander().option("--no-highlight-code", "Enable or disable ANSI syntax highlighting of code frames. (on by default)");
_commander().option("--no-comments", "Write comments to generated output. (true by default)");
_commander().option("--retain-lines", "Retain line numbers. This will result in really ugly code.");
_commander().option("--compact [true|false|auto]", "Do not include superfluous whitespace characters and line terminators.", booleanify);
_commander().option("--minified", "Save as many bytes when printing. (false by default)");
_commander().option("--auxiliary-comment-before [string]", "Print a comment before any injected non-user code.");
_commander().option("--auxiliary-comment-after [string]", "Print a comment after any injected non-user code.");
_commander().option("-s, --source-maps [true|false|inline|both]", "", booleanify, undefined);
_commander().option("--source-map-target [string]", "Set `file` on returned source map.");
_commander().option("--source-file-name [string]", "Set `sources[0]` on returned source map.");
_commander().option("--source-root [filename]", "The root from which all sources are relative.");
{
commander.option("--module-root [filename]", "Optional prefix for the AMD module formatter that will be prepended to the filename on module definitions.");
commander.option("-M, --module-ids", "Insert an explicit id for modules.");
commander.option("--module-id [string]", "Specify a custom name for module ids.");
_commander().option("--module-root [filename]", "Optional prefix for the AMD module formatter that will be prepended to the filename on module definitions.");
_commander().option("-M, --module-ids", "Insert an explicit id for modules.");
_commander().option("--module-id [string]", "Specify a custom name for module ids.");
}
commander.option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been the input. [" + DEFAULT_EXTENSIONS.join() + "]", collect);
commander.option("--keep-file-extension", "Preserve the file extensions of the input files.");
commander.option("-w, --watch", "Recompile files on changes.");
commander.option("--skip-initial-build", "Do not compile files before watching.");
commander.option("-o, --out-file [out]", "Compile all input files into a single file.");
commander.option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory.");
commander.option("--relative", "Compile into an output directory relative to input directory or file. Requires --out-dir [out]");
commander.option("-D, --copy-files", "When compiling a directory copy over non-compilable files.");
commander.option("--include-dotfiles", "Include dotfiles when compiling and copying non-compilable files.");
commander.option("--no-copy-ignored", "Exclude ignored files when copying non-compilable files.");
commander.option("--verbose", "Log everything. This option conflicts with --quiet");
commander.option("--quiet", "Don't log anything. This option conflicts with --verbose");
commander.option("--delete-dir-on-start", "Delete the out directory before compilation.");
commander.option("--out-file-extension [string]", "Use a specific extension for the output files");
commander.version("7.21.4-esm.4" + " (@babel/core " + version + ")");
commander.usage("[options] <files ...>");
commander.action(() => {});
export default function parseArgv(args) {
commander.parse(args);
_commander().option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been the input. [" + _core().DEFAULT_EXTENSIONS.join() + "]", collect);
_commander().option("--keep-file-extension", "Preserve the file extensions of the input files.");
_commander().option("-w, --watch", "Recompile files on changes.");
_commander().option("--skip-initial-build", "Do not compile files before watching.");
_commander().option("-o, --out-file [out]", "Compile all input files into a single file.");
_commander().option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory.");
_commander().option("--relative", "Compile into an output directory relative to input directory or file. Requires --out-dir [out]");
_commander().option("-D, --copy-files", "When compiling a directory copy over non-compilable files.");
_commander().option("--include-dotfiles", "Include dotfiles when compiling and copying non-compilable files.");
_commander().option("--no-copy-ignored", "Exclude ignored files when copying non-compilable files.");
_commander().option("--verbose", "Log everything. This option conflicts with --quiet");
_commander().option("--quiet", "Don't log anything. This option conflicts with --verbose");
_commander().option("--delete-dir-on-start", "Delete the out directory before compilation.");
_commander().option("--out-file-extension [string]", "Use a specific extension for the output files");
_commander().version("7.21.5" + " (@babel/core " + _core().version + ")");
_commander().usage("[options] <files ...>");
_commander().action(() => {});
function parseArgv(args) {
_commander().parse(args);
const errors = [];
let filenames = commander.args.reduce(function (globbed, input) {
let files = glob.sync(input);
let filenames = _commander().args.reduce(function (globbed, input) {
let files = _glob().sync(input);
if (!files.length) files = [input];

@@ -59,17 +89,17 @@ globbed.push(...files);

filenames.forEach(function (filename) {
if (!fs.existsSync(filename)) {
if (!_fs().existsSync(filename)) {
errors.push(filename + " does not exist");
}
});
if (commander.outDir && !filenames.length) {
if (_commander().outDir && !filenames.length) {
errors.push("--out-dir requires filenames");
}
if (commander.outFile && commander.outDir) {
if (_commander().outFile && _commander().outDir) {
errors.push("--out-file and --out-dir cannot be used together");
}
if (commander.relative && !commander.outDir) {
if (_commander().relative && !_commander().outDir) {
errors.push("--relative requires --out-dir usage");
}
if (commander.watch) {
if (!commander.outFile && !commander.outDir) {
if (_commander().watch) {
if (!_commander().outFile && !_commander().outDir) {
errors.push("--watch requires --out-file or --out-dir");

@@ -81,15 +111,15 @@ }

}
if (commander.skipInitialBuild && !commander.watch) {
if (_commander().skipInitialBuild && !_commander().watch) {
errors.push("--skip-initial-build requires --watch");
}
if (commander.deleteDirOnStart && !commander.outDir) {
if (_commander().deleteDirOnStart && !_commander().outDir) {
errors.push("--delete-dir-on-start requires --out-dir");
}
if (commander.verbose && commander.quiet) {
if (_commander().verbose && _commander().quiet) {
errors.push("--verbose and --quiet cannot be used together");
}
if (!commander.outDir && filenames.length === 0 && typeof commander.filename !== "string" && commander.babelrc !== false) {
if (!_commander().outDir && filenames.length === 0 && typeof _commander().filename !== "string" && _commander().babelrc !== false) {
errors.push("stdin compilation requires either -f/--filename [filename] or --no-babelrc");
}
if (commander.keepFileExtension && commander.outFileExtension) {
if (_commander().keepFileExtension && _commander().outFileExtension) {
errors.push("--out-file-extension cannot be used with --keep-file-extension");

@@ -104,3 +134,3 @@ }

}
const opts = commander.opts();
const opts = _commander().opts();
const babelOptions = {

@@ -107,0 +137,0 @@ presets: opts.presets,

@@ -0,11 +1,51 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addSourceMappingUrl = addSourceMappingUrl;
exports.chmod = chmod;
exports.compile = compile;
exports.debounce = debounce;
exports.deleteDir = deleteDir;
exports.hasDataSourcemap = hasDataSourcemap;
exports.isCompilableExtension = isCompilableExtension;
exports.readdir = readdir;
exports.readdirForCompilable = readdirForCompilable;
exports.transformRepl = transformRepl;
exports.withExtension = withExtension;
function _fsReaddirRecursive() {
const data = require("fs-readdir-recursive");
_fsReaddirRecursive = function () {
return data;
};
return data;
}
function babel() {
const data = require("@babel/core");
babel = function () {
return data;
};
return data;
}
function _path() {
const data = require("path");
_path = function () {
return data;
};
return data;
}
function _fs() {
const data = require("fs");
_fs = function () {
return data;
};
return data;
}
var watcher = require("./watcher");
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); }); }; }
import readdirRecursive from "fs-readdir-recursive";
import * as babel from "@babel/core";
import path from "path";
import fs from "fs";
import * as watcher from "./watcher.js";
export function chmod(src, dest) {
function chmod(src, dest) {
try {
fs.chmodSync(dest, fs.statSync(src).mode);
_fs().chmodSync(dest, _fs().statSync(src).mode);
} catch (err) {

@@ -15,5 +55,5 @@ console.warn(`Cannot change permissions of ${dest}`);

}
export function readdir(dirname, includeDotfiles, filter) {
return readdirRecursive(dirname, (filename, index, currentDirectory) => {
const stat = fs.statSync(path.join(currentDirectory, filename));
function readdir(dirname, includeDotfiles, filter) {
return _fsReaddirRecursive()(dirname, (filename, index, currentDirectory) => {
const stat = _fs().statSync(_path().join(currentDirectory, filename));
if (stat.isDirectory()) return true;

@@ -23,3 +63,3 @@ return (includeDotfiles || filename[0] !== ".") && (!filter || filter(filename));

}
export function readdirForCompilable(dirname, includeDotfiles, altExts) {
function readdirForCompilable(dirname, includeDotfiles, altExts) {
return readdir(dirname, includeDotfiles, function (filename) {

@@ -29,11 +69,11 @@ return isCompilableExtension(filename, altExts);

}
export function isCompilableExtension(filename, altExts) {
const exts = altExts || babel.DEFAULT_EXTENSIONS;
const ext = path.extname(filename);
function isCompilableExtension(filename, altExts) {
const exts = altExts || babel().DEFAULT_EXTENSIONS;
const ext = _path().extname(filename);
return exts.includes(ext);
}
export function addSourceMappingUrl(code, loc) {
return code + "\n//# sourceMappingURL=" + path.basename(loc);
function addSourceMappingUrl(code, loc) {
return code + "\n//# sourceMappingURL=" + _path().basename(loc);
}
export function hasDataSourcemap(code) {
function hasDataSourcemap(code) {
const pos = code.lastIndexOf("\n", code.length - 2);

@@ -45,3 +85,3 @@ return pos != -1 && code.lastIndexOf("//# sourceMappingURL") < pos;

};
export function transformRepl(filename, code, opts) {
function transformRepl(filename, code, opts) {
opts = Object.assign({}, opts, {

@@ -52,3 +92,3 @@ caller: CALLER,

return new Promise((resolve, reject) => {
babel.transform(code, opts, (err, result) => {
babel().transform(code, opts, (err, result) => {
if (err) reject(err);else resolve(result);

@@ -58,3 +98,3 @@ });

}
export function compile(_x, _x2) {
function compile(_x, _x2) {
return _compile.apply(this, arguments);

@@ -68,3 +108,3 @@ }

const result = yield new Promise((resolve, reject) => {
babel.transformFile(filename, opts, (err, result) => {
babel().transformFile(filename, opts, (err, result) => {
if (err) reject(err);else resolve(result);

@@ -83,13 +123,13 @@ });

}
export function deleteDir(path) {
if (fs.existsSync(path)) {
fs.readdirSync(path).forEach(function (file) {
function deleteDir(path) {
if (_fs().existsSync(path)) {
_fs().readdirSync(path).forEach(function (file) {
const curPath = path + "/" + file;
if (fs.lstatSync(curPath).isDirectory()) {
if (_fs().lstatSync(curPath).isDirectory()) {
deleteDir(curPath);
} else {
fs.unlinkSync(curPath);
_fs().unlinkSync(curPath);
}
});
fs.rmdirSync(path);
_fs().rmdirSync(path);
}

@@ -101,7 +141,7 @@ }

});
export function withExtension(filename, ext = ".js") {
const newBasename = path.basename(filename, path.extname(filename)) + ext;
return path.join(path.dirname(filename), newBasename);
function withExtension(filename, ext = ".js") {
const newBasename = _path().basename(filename, _path().extname(filename)) + ext;
return _path().join(_path().dirname(filename), newBasename);
}
export function debounce(fn, time) {
function debounce(fn, time) {
let timer;

@@ -108,0 +148,0 @@ function debounced() {

@@ -1,3 +0,18 @@

import { createRequire } from "module";
import path from "path";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.enable = enable;
exports.onFilesChange = onFilesChange;
exports.startWatcher = startWatcher;
exports.updateExternalDependencies = updateExternalDependencies;
exports.watch = watch;
function _path() {
const data = require("path");
_path = function () {
return data;
};
return data;
}
const fileToDeps = new Map();

@@ -9,3 +24,3 @@ const depToFiles = new Map();

let hasStarted = false;
export function enable({
function enable({
enableGlobbing

@@ -29,3 +44,3 @@ }) {

}
export function startWatcher() {
function startWatcher() {
hasStarted = true;

@@ -40,3 +55,3 @@ for (const dep of watchQueue) {

}
export function watch(filename) {
function watch(filename) {
if (!isWatchMode) {

@@ -46,8 +61,8 @@ throw new Error("Internal Babel error: .watch called when not in watch mode.");

if (!hasStarted) {
watchQueue.add(path.resolve(filename));
watchQueue.add(_path().resolve(filename));
} else {
watcher.add(path.resolve(filename));
watcher.add(_path().resolve(filename));
}
}
export function onFilesChange(callback) {
function onFilesChange(callback) {
if (!isWatchMode) {

@@ -59,10 +74,10 @@ throw new Error("Internal Babel error: .onFilesChange called when not in watch mode.");

if (event !== "change" && event !== "add") return;
const absoluteFile = path.resolve(filename);
const absoluteFile = _path().resolve(filename);
callback([absoluteFile, ...((_depToFiles$get = depToFiles.get(absoluteFile)) != null ? _depToFiles$get : [])], event, absoluteFile);
});
}
export function updateExternalDependencies(filename, dependencies) {
function updateExternalDependencies(filename, dependencies) {
if (!isWatchMode) return;
const absFilename = path.resolve(filename);
const absDependencies = new Set(Array.from(dependencies, dep => path.resolve(dep)));
const absFilename = _path().resolve(filename);
const absDependencies = new Set(Array.from(dependencies, dep => _path().resolve(dep)));
const deps = fileToDeps.get(absFilename);

@@ -111,3 +126,2 @@ if (deps) {

function requireChokidar() {
const require = createRequire(import.meta.url);
try {

@@ -114,0 +128,0 @@ return parseInt(process.versions.node) >= 8 ? require("chokidar") : require("@nicolo-ribaudo/chokidar-2");

{
"name": "@babel/cli",
"version": "7.21.4-esm.4",
"version": "7.21.5",
"description": "Babel command line.",

@@ -40,7 +40,7 @@ "author": "The Babel Team (https://babel.dev/team)",

"peerDependencies": {
"@babel/core": "^7.0.0-0 || ^7.21.4-esm.2"
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "7.21.4-esm.4",
"@babel/helper-fixtures": "7.21.4-esm.4",
"@babel/core": "^7.21.5",
"@babel/helper-fixtures": "^7.21.5",
"@types/fs-readdir-recursive": "^1.1.0",

@@ -58,3 +58,3 @@ "@types/glob": "^7.2.0",

},
"type": "module"
"type": "commonjs"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc