Socket
Socket
Sign inDemoInstall

@babel/core

Package Overview
Dependencies
Maintainers
6
Versions
192
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/core - npm Package Compare versions

Comparing version 7.15.0 to 7.15.4

2

lib/index.js

@@ -248,3 +248,3 @@ "use strict";

const version = "7.15.0";
const version = "7.15.4";
exports.version = version;

@@ -251,0 +251,0 @@ const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs", ".cjs"]);

@@ -38,6 +38,6 @@ "use strict";

function t() {
function _t() {
const data = require("@babel/types");
t = function () {
_t = function () {
return data;

@@ -51,3 +51,25 @@ };

const buildUmdWrapper = replacements => (0, _template().default)`
const {
arrayExpression,
assignmentExpression,
binaryExpression,
blockStatement,
callExpression,
cloneNode,
conditionalExpression,
exportNamedDeclaration,
exportSpecifier,
expressionStatement,
functionExpression,
identifier,
memberExpression,
objectExpression,
program,
stringLiteral,
unaryExpression,
variableDeclaration,
variableDeclarator
} = _t();
const buildUmdWrapper = replacements => _template().default.statement`
(function (root, factory) {

@@ -67,7 +89,7 @@ if (typeof define === "function" && define.amd) {

function buildGlobal(allowlist) {
const namespace = t().identifier("babelHelpers");
const namespace = identifier("babelHelpers");
const body = [];
const container = t().functionExpression(null, [t().identifier("global")], t().blockStatement(body));
const tree = t().program([t().expressionStatement(t().callExpression(container, [t().conditionalExpression(t().binaryExpression("===", t().unaryExpression("typeof", t().identifier("global")), t().stringLiteral("undefined")), t().identifier("self"), t().identifier("global"))]))]);
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().assignmentExpression("=", t().memberExpression(t().identifier("global"), namespace), t().objectExpression([])))]));
const container = functionExpression(null, [identifier("global")], blockStatement(body));
const tree = program([expressionStatement(callExpression(container, [conditionalExpression(binaryExpression("===", unaryExpression("typeof", identifier("global")), stringLiteral("undefined")), identifier("self"), identifier("global"))]))]);
body.push(variableDeclaration("var", [variableDeclarator(namespace, assignmentExpression("=", memberExpression(identifier("global"), namespace), objectExpression([])))]));
buildHelpers(body, namespace, allowlist);

@@ -80,20 +102,20 @@ return tree;

const refs = buildHelpers(body, null, allowlist);
body.unshift(t().exportNamedDeclaration(null, Object.keys(refs).map(name => {
return t().exportSpecifier(t().cloneNode(refs[name]), t().identifier(name));
body.unshift(exportNamedDeclaration(null, Object.keys(refs).map(name => {
return exportSpecifier(cloneNode(refs[name]), identifier(name));
})));
return t().program(body, [], "module");
return program(body, [], "module");
}
function buildUmd(allowlist) {
const namespace = t().identifier("babelHelpers");
const namespace = identifier("babelHelpers");
const body = [];
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().identifier("global"))]));
body.push(variableDeclaration("var", [variableDeclarator(namespace, identifier("global"))]));
buildHelpers(body, namespace, allowlist);
return t().program([buildUmdWrapper({
FACTORY_PARAMETERS: t().identifier("global"),
BROWSER_ARGUMENTS: t().assignmentExpression("=", t().memberExpression(t().identifier("root"), namespace), t().objectExpression([])),
COMMON_ARGUMENTS: t().identifier("exports"),
AMD_ARGUMENTS: t().arrayExpression([t().stringLiteral("exports")]),
return program([buildUmdWrapper({
FACTORY_PARAMETERS: identifier("global"),
BROWSER_ARGUMENTS: assignmentExpression("=", memberExpression(identifier("root"), namespace), objectExpression([])),
COMMON_ARGUMENTS: identifier("exports"),
AMD_ARGUMENTS: arrayExpression([stringLiteral("exports")]),
FACTORY_BODY: body,
UMD_ROOT: t().identifier("this")
UMD_ROOT: identifier("this")
})]);

@@ -103,8 +125,8 @@ }

function buildVar(allowlist) {
const namespace = t().identifier("babelHelpers");
const namespace = identifier("babelHelpers");
const body = [];
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().objectExpression([]))]));
const tree = t().program(body);
body.push(variableDeclaration("var", [variableDeclarator(namespace, objectExpression([]))]));
const tree = program(body);
buildHelpers(body, namespace, allowlist);
body.push(t().expressionStatement(namespace));
body.push(expressionStatement(namespace));
return tree;

@@ -115,3 +137,3 @@ }

const getHelperReference = name => {
return namespace ? t().memberExpression(namespace, t().identifier(name)) : t().identifier(`_${name}`);
return namespace ? memberExpression(namespace, identifier(name)) : identifier(`_${name}`);
};

@@ -118,0 +140,0 @@

@@ -38,6 +38,6 @@ "use strict";

function t() {
function _t() {
const data = require("@babel/types");
t = function () {
_t = function () {
return data;

@@ -69,2 +69,7 @@ };

const {
cloneNode,
interpreterDirective
} = _t();
const errorVisitor = {

@@ -127,3 +132,3 @@ enter(path, state) {

if (value) {
this.path.get("interpreter").replaceWith(t().interpreterDirective(value));
this.path.get("interpreter").replaceWith(interpreterDirective(value));
} else {

@@ -175,3 +180,3 @@ this.path.get("interpreter").remove();

const declar = this.declarations[name];
if (declar) return t().cloneNode(declar);
if (declar) return cloneNode(declar);
const generator = this.get("helperGenerator");

@@ -178,0 +183,0 @@

@@ -38,6 +38,6 @@ "use strict";

function t() {
function _t() {
const data = require("@babel/types");
t = function () {
_t = function () {
return data;

@@ -65,2 +65,7 @@ };

const {
file,
traverseFast
} = _t();
const debug = _debug()("babel:transform:file");

@@ -75,3 +80,3 @@

if (ast.type === "Program") {
ast = t().file(ast, [], []);
ast = file(ast, [], []);
} else if (ast.type !== "File") {

@@ -159,3 +164,3 @@ throw new Error("AST root must be a Program or File node");

let lastComment = null;
t().traverseFast(ast, node => {
traverseFast(ast, node => {
[node.leadingComments, lastComment] = extractCommentsFromList(regex, node.leadingComments, lastComment);

@@ -162,0 +167,0 @@ [node.innerComments, lastComment] = extractCommentsFromList(regex, node.innerComments, lastComment);

@@ -34,4 +34,6 @@ "use strict";

parserOpts: Object.assign({
sourceType: _path().extname(filenameRelative) === ".mjs" ? "module" : sourceType,
sourceFileName: filename,
sourceType: _path().extname(filenameRelative) === ".mjs" ? "module" : sourceType
}, sourceFileName !== "unknown" && {
sourceFilename: sourceFileName
}, {
plugins: []

@@ -38,0 +40,0 @@ }, opts.parserOpts),

{
"name": "@babel/core",
"version": "7.15.0",
"version": "7.15.4",
"description": "Babel compiler core.",

@@ -52,10 +52,10 @@ "main": "./lib/index.js",

"@babel/code-frame": "^7.14.5",
"@babel/generator": "^7.15.0",
"@babel/helper-compilation-targets": "^7.15.0",
"@babel/helper-module-transforms": "^7.15.0",
"@babel/helpers": "^7.14.8",
"@babel/parser": "^7.15.0",
"@babel/template": "^7.14.5",
"@babel/traverse": "^7.15.0",
"@babel/types": "^7.15.0",
"@babel/generator": "^7.15.4",
"@babel/helper-compilation-targets": "^7.15.4",
"@babel/helper-module-transforms": "^7.15.4",
"@babel/helpers": "^7.15.4",
"@babel/parser": "^7.15.4",
"@babel/template": "^7.15.4",
"@babel/traverse": "^7.15.4",
"@babel/types": "^7.15.4",
"convert-source-map": "^1.7.0",

@@ -70,3 +70,3 @@ "debug": "^4.1.0",

"@babel/helper-transform-fixture-test-runner": "7.15.0",
"@babel/plugin-transform-modules-commonjs": "7.15.0",
"@babel/plugin-transform-modules-commonjs": "7.15.4",
"@types/convert-source-map": "^1.5.1",

@@ -73,0 +73,0 @@ "@types/debug": "^4.1.0",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc