Socket
Socket
Sign inDemoInstall

@babel/node

Package Overview
Dependencies
149
Maintainers
4
Versions
107
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.15.4 to 7.22.10

lib/_babel-node.js.map

90

lib/_babel-node.js
"use strict";
var _commander = require("commander");
var _module = _interopRequireWildcard(require("module"), true);
var _util = require("util");
var _path = require("path");
var _repl = require("repl");
var babel = require("@babel/core");
var _vm = require("vm");
require("core-js/stable");
require("core-js/stable/index");
require("regenerator-runtime/runtime");
var _register = require("@babel/register");
var _url = require("url");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const program = new _commander.Command("babel-node");
function collect(value, previousValue) {
if (typeof value !== "string") return previousValue;
const values = value.split(",");
if (previousValue) {

@@ -39,6 +24,4 @@ previousValue.push(...values);

}
return values;
}
program.option("-e, --eval [script]", "Evaluate script");

@@ -56,3 +39,3 @@ program.option("--no-babelrc", "Specify whether or not to use .babelrc and .babelignore files");

program.option("-b, --presets [string]", "", collect);
program.version("7.15.4");
program.version("7.22.10");
program.usage("[options] [ -e script | script.js ] [arguments]");

@@ -74,3 +57,2 @@ program.parse(process.argv);

};
for (const key of Object.keys(babelOptions)) {

@@ -81,5 +63,3 @@ if (babelOptions[key] === undefined) {

}
(0, _register.default)(babelOptions);
const replPlugin = ({

@@ -89,6 +69,2 @@ types: t

visitor: {
ModuleDeclaration(path) {
throw path.buildCodeFrameError("Modules aren't supported in the REPL");
},
VariableDeclaration(path) {

@@ -99,15 +75,20 @@ if (path.node.kind !== "var") {

},
Program(path) {
if (path.get("body").some(child => child.isExpressionStatement())) return;
let hasExpressionStatement;
for (const bodyPath of path.get("body")) {
if (bodyPath.isExpressionStatement()) {
hasExpressionStatement = true;
} else if (bodyPath.isExportDeclaration() || bodyPath.isImportDeclaration()) {
throw bodyPath.buildCodeFrameError("Modules aren't supported in the REPL");
}
}
if (hasExpressionStatement) return;
path.pushContainer("body", t.expressionStatement(t.identifier("undefined")));
}
}
});
const _eval = function (code, filename) {
code = code.trim();
if (!code) return undefined;
code = babel.transform(code, {
code = babel.transformSync(code, {
filename: filename,

@@ -121,3 +102,2 @@ presets: program.presets,

};
if (program.eval || program.print) {

@@ -134,5 +114,3 @@ let code = program.eval;

global.require = module.require.bind(module);
const result = _eval(code, global.__filename);
if (program.print) {

@@ -152,3 +130,2 @@ const output = typeof result === "string" ? result : (0, _util.inspect)(result);

}
if (arg[0] === "-") {

@@ -158,10 +135,7 @@ const parsedOption = program.options.find(option => {

});
if (parsedOption === undefined) {
return;
}
const optionName = parsedOption.attributeName();
const parsedArg = program[optionName];
if (optionName === "require" || parsedArg && parsedArg !== true) {

@@ -178,10 +152,7 @@ ignoreNext = true;

const filename = args[0];
if (!_path.isAbsolute(filename)) {
args[0] = _path.join(process.cwd(), filename);
}
process.argv = ["node", ...args];
process.execArgv.push(__filename);
_module.default.runMain();

@@ -193,3 +164,2 @@ } else {

}
function requireArgs() {

@@ -201,3 +171,2 @@ if (program.require) {

let f = M._findPath(r, M._nodeModulePaths(b).concat(b));
if (f) return f;

@@ -212,3 +181,15 @@ f = new Error(`Cannot resolve module '${r}'`);

}
function replEval(code, context, filename, callback) {
let err;
let result;
try {
if (code[0] === "(" && code[code.length - 1] === ")") {
code = code.slice(1, -1);
}
result = _eval(code, filename);
} catch (e) {
err = e;
}
callback(err, result);
}
function replStart() {

@@ -223,23 +204,8 @@ const replServer = _repl.start({

});
const NODE_REPL_HISTORY = process.env.NODE_REPL_HISTORY;
{
replServer.setupHistory == null ? void 0 : replServer.setupHistory(process.env.NODE_REPL_HISTORY, () => {});
replServer.setupHistory == null ? void 0 : replServer.setupHistory(NODE_REPL_HISTORY, () => {});
}
}
function replEval(code, context, filename, callback) {
let err;
let result;
try {
if (code[0] === "(" && code[code.length - 1] === ")") {
code = code.slice(1, -1);
}
result = _eval(code, filename);
} catch (e) {
err = e;
}
callback(err, result);
}
//# sourceMappingURL=_babel-node.js.map
"use strict";
var _v8flags = require("v8flags");
var _path = require("path");
var _child_process = require("child_process");
var _url = require("url");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
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); }); }; }
const args = [_path.join(_path.dirname(__filename), "_babel-node")];

@@ -23,3 +15,2 @@ let babelArgs = process.argv.slice(2);

const argSeparator = babelArgs.indexOf("--");
if (argSeparator > -1) {

@@ -29,74 +20,58 @@ userArgs = babelArgs.slice(argSeparator);

}
function getNormalizedV8Flag(arg) {
const matches = arg.match(/--(?:no)?(.+)/);
if (matches) {
return `--${matches[1].replace(/-/g, "_")}`;
}
return arg;
}
const aliases = new Map([["-d", "--debug"], ["-gc", "--expose-gc"]]);
_v8flags(function () {
var _ref = _asyncToGenerator(function* (err, v8Flags) {
for (let i = 0; i < babelArgs.length; i++) {
const arg = babelArgs[i];
const flag = arg.split("=")[0];
if (flag === "-r" || flag === "--require") {
args.push(flag);
args.push(babelArgs[++i]);
} else if (aliases.has(flag)) {
args.unshift(aliases.get(flag));
} else if (flag === "debug" || flag === "inspect" || v8Flags.indexOf(getNormalizedV8Flag(flag)) >= 0 || (process.allowedNodeEnvironmentFlags || require("node-environment-flags")).has(flag)) {
args.unshift(arg);
} else {
args.push(arg);
}
_v8flags(_asyncToGenerator(function* (err, v8Flags) {
for (let i = 0; i < babelArgs.length; i++) {
const arg = babelArgs[i];
const flag = arg.split("=")[0];
if (flag === "-r" || flag === "--require") {
args.push(flag);
args.push(babelArgs[++i]);
} else if (aliases.has(flag)) {
args.unshift(aliases.get(flag));
} else if (flag === "debug" || flag === "inspect" || v8Flags.indexOf(getNormalizedV8Flag(flag)) >= 0 || (process.allowedNodeEnvironmentFlags || require("node-environment-flags")).has(flag)) {
args.unshift(arg);
} else {
args.push(arg);
}
if (argSeparator > -1) {
args.push(...userArgs);
}
if (argSeparator > -1) {
args.push(...userArgs);
}
try {
const {
default: kexec
} = yield Promise.resolve().then(() => _interopRequireWildcard(require("kexec")));
kexec(process.argv[0], args);
} catch (err) {
if (err.code !== "ERR_MODULE_NOT_FOUND" && err.code !== "MODULE_NOT_FOUND" && err.code !== "UNDECLARED_DEPENDENCY") {
throw err;
}
try {
const {
default: kexec
} = yield Promise.resolve().then(() => _interopRequireWildcard(require("kexec")));
kexec(process.argv[0], args);
} catch (err) {
if (err.code !== "ERR_MODULE_NOT_FOUND" && err.code !== "MODULE_NOT_FOUND" && err.code !== "UNDECLARED_DEPENDENCY") {
throw err;
}
const shouldPassthroughIPC = process.send !== undefined;
const proc = _child_process.spawn(process.argv[0], args, {
stdio: shouldPassthroughIPC ? ["inherit", "inherit", "inherit", "ipc"] : "inherit"
const shouldPassthroughIPC = process.send !== undefined;
const proc = _child_process.spawn(process.argv[0], args, {
stdio: shouldPassthroughIPC ? ["inherit", "inherit", "inherit", "ipc"] : "inherit"
});
proc.on("exit", function (code, signal) {
process.on("exit", function () {
if (signal) {
process.kill(process.pid, signal);
} else {
process.exitCode = code != null ? code : undefined;
}
});
proc.on("exit", function (code, signal) {
process.on("exit", function () {
if (signal) {
process.kill(process.pid, signal);
} else {
process.exitCode = code;
}
});
});
if (shouldPassthroughIPC) {
proc.on("message", message => process.send(message));
}
process.on("SIGINT", () => proc.kill("SIGINT"));
});
if (shouldPassthroughIPC) {
proc.on("message", message => process.send(message));
}
});
process.on("SIGINT", () => proc.kill("SIGINT"));
process.on("SIGTERM", () => proc.kill("SIGTERM"));
}
}));
return function (_x, _x2) {
return _ref.apply(this, arguments);
};
}());
//# sourceMappingURL=babel-node.js.map
{
"name": "@babel/node",
"version": "7.15.4",
"version": "7.22.10",
"description": "Babel command line",

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

"dependencies": {
"@babel/register": "^7.15.3",
"@babel/register": "^7.22.5",
"commander": "^4.0.1",
"core-js": "^3.16.0",
"core-js": "^3.30.2",
"node-environment-flags": "^1.0.5",
"regenerator-runtime": "^0.13.4",
"regenerator-runtime": "^0.14.0",
"v8flags": "^3.1.1"

@@ -38,5 +38,7 @@ },

"devDependencies": {
"@babel/core": "7.15.4",
"@babel/helper-fixtures": "7.14.5",
"@babel/runtime": "7.15.4",
"@babel/core": "^7.22.10",
"@babel/helper-fixtures": "^7.22.9",
"@babel/preset-env": "^7.22.10",
"@babel/runtime": "^7.22.10",
"@types/v8flags": "^3.1.1",
"fs-readdir-recursive": "^1.0.0",

@@ -51,3 +53,4 @@ "make-dir": "^2.1.0",

"node": ">=6.9.0"
}
},
"type": "commonjs"
}

@@ -5,3 +5,3 @@ # @babel/node

See our website [@babel/node](https://babeljs.io/docs/en/babel-node) for more information.
See our website [@babel/node](https://babeljs.io/docs/babel-node) for more information.

@@ -8,0 +8,0 @@ ## Install

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