Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-core

Package Overview
Dependencies
Maintainers
1
Versions
257
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 4.7.1 to 4.7.2

11

CHANGELOG.md

@@ -16,2 +16,13 @@ # Changelog

## 4.7.2
* **New Feature**
* `"both"` option for `sourceMap`.
* Add output types to external helpers. Thanks [@neVERberleRfellerER](https://github.com/neVERberleRfellerER)!
* **Bug Fix**
* Fix node duplication sometimes resulting in a recursion error.
* Ignore `break`s within cases inside `for...of`.
* **Polish**
* Split up variable declarations and export declarations to allow easier transformation.
## 4.7.0

@@ -18,0 +29,0 @@

2

lib/babel/api/register/node.js

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

result = babel.transformFileSync(filename, extend(opts, {
sourceMap: true,
sourceMap: "both",
ast: false

@@ -77,0 +77,0 @@ }));

@@ -11,2 +11,4 @@ "use strict";

var messages = _interopRequireWildcard(require("./messages"));
var util = _interopRequireWildcard(require("./util"));

@@ -16,5 +18,3 @@

module.exports = function (whitelist) {
var namespace = t.identifier("babelHelpers");
function buildGlobal(namespace, builder) {
var body = [];

@@ -26,5 +26,54 @@ var container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body));

buildHelpers(body, namespace, whitelist);
builder(body);
return tree;
}
function buildUmd(namespace, builder) {
var body = [];
body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.identifier("global"))]));
builder(body);
var container = util.template("umd-commonjs-strict", {
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.literal("exports")]),
FACTORY_BODY: body,
UMD_ROOT: t.identifier("this")
});
return t.program([container]);
}
function buildVar(namespace, builder) {
var body = [];
body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.objectExpression({}))]));
builder(body);
return t.program(body);
}
module.exports = function (whitelist) {
var outputType = arguments[1] === undefined ? "global" : arguments[1];
var namespace = t.identifier("babelHelpers");
var builder = function builder(body) {
return buildHelpers(body, namespace, whitelist);
};
var tree;
var build = ({
global: buildGlobal,
umd: buildUmd,
"var": buildVar
})[outputType];
if (build) {
tree = build(namespace, builder);
} else {
throw new Error(messages.get("unsupportedOutputType", outputType));
}
return generator(tree).code;
};

@@ -30,3 +30,4 @@ "use strict";

codeGeneratorDeopt: "Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.",
missingTemplatesDirectory: "no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues"
missingTemplatesDirectory: "no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues",
unsupportedOutputType: "Unsupported output type $1"
};

@@ -33,0 +34,0 @@

@@ -302,3 +302,7 @@ "use strict";

this.moduleFormatter.importSpecifier(specifiers[0], declar, this.dynamicImports);
if (this.transformers["es6.modules"].canRun()) {
this.moduleFormatter.importSpecifier(specifiers[0], declar, this.dynamicImports);
} else {
this.dynamicImports.push(declar);
}
}

@@ -521,4 +525,7 @@

if (opts.sourceMap === "inline") {
if (opts.sourceMap === "inline" || opts.sourceMap === "both") {
result.code += "\n" + convertSourceMap.fromObject(result.map).toComment();
}
if (opts.sourceMap === "both") {
result.map = null;

@@ -525,0 +532,0 @@ }

@@ -5,5 +5,7 @@ "use strict";

module.exports = build;
var t = _interopRequire(require("../../types"));
module.exports = function build(node, buildBody) {
function build(node, buildBody) {
var self = node.blocks.shift();

@@ -24,2 +26,2 @@ if (!self) return;

return t.forOfStatement(t.variableDeclaration("let", [t.variableDeclarator(self.left)]), self.right, t.blockStatement([child]));
};
}

@@ -58,4 +58,4 @@ "use strict";

var importsVisitor = {
enter: function enter(node, parent, scope, formatter) {
if (t.isImportDeclaration(node)) {
ImportDeclaration: {
enter: function enter(node, parent, scope, formatter) {
formatter.hasLocalImports = true;

@@ -69,5 +69,5 @@ extend(formatter.localImports, t.getBindingIdentifiers(node));

var exportsVisitor = {
enter: function enter(node, parent, scope, formatter) {
var declar = node && node.declaration;
if (t.isExportDeclaration(node)) {
ExportDeclaration: {
enter: function enter(node, parent, scope, formatter) {
var declar = node.declaration;
formatter.hasLocalImports = true;

@@ -74,0 +74,0 @@

@@ -65,2 +65,5 @@ "use strict";

// break statements mean something different in this context
if (t.isSwitchCase(parent)) return;
var ret = t.expressionStatement(t.callExpression(t.memberExpression(state.iteratorKey, t.identifier("return")), []));

@@ -67,0 +70,0 @@ ret = state.wrapReturn(ret);

@@ -10,4 +10,2 @@ "use strict";

function Program(program, parent, scope, file) {
if (!file.transformers["es6.modules"].canRun()) return;
strict.wrap(program, function () {

@@ -17,2 +15,4 @@ program.body = file.dynamicImports.concat(program.body);

if (!file.transformers["es6.modules"].canRun()) return;
if (file.moduleFormatter.transform) {

@@ -19,0 +19,0 @@ file.moduleFormatter.transform(program);

@@ -60,2 +60,12 @@ "use strict";

return [getDeclar(), node];
} else if (t.isVariableDeclaration(declar)) {
var specifiers = [];
var bindings = t.getBindingIdentifiers(declar);
for (var key in bindings) {
var id = bindings[key];
specifiers.push(t.exportSpecifier(id, id));
}
return [declar, t.exportDeclaration(null, specifiers)];
}

@@ -62,0 +72,0 @@ }

@@ -5,4 +5,8 @@ "use strict";

var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
exports.JSXElement = JSXElement;
var react = _interopRequireWildcard(require("../../helpers/react"));
var t = _interopRequire(require("../../../types"));

@@ -14,2 +18,6 @@

enter: function enter(node, parent, scope, state) {
if (t.isJSXIdentifier(node) && react.isCompatTag(node.name)) {
return;
}
if (t.isJSXIdentifier(node) || t.isIdentifier(node)) {

@@ -49,7 +57,32 @@ // direct references that we need to track to hoist this to the highest scope we can

console.log(state);
if (!state.isImmutable) return;
if (!state.isImmutable) return;
var lastCompatibleScope = scope;
var checkScope = scope;
crawl: do {
for (var i = 0; i < state.identifiers.length; i++) {
if (!checkScope.hasBinding(state.identifiers[i])) {
break crawl;
}
}
lastCompatibleScope = checkScope;
} while (checkScope = checkScope.parent);
// same scope, nothing we can do about it
if (lastCompatibleScope === scope) return;
var uid = scope.generateUidIdentifier("ref");
var scopeBlock = lastCompatibleScope.block;
if (t.isFunction(scopeBlock)) {
scopeBlock = scopeBlock.body;
}
if (t.isBlockStatement(scopeBlock) || t.isProgram(scopeBlock)) {
scopeBlock.body.unshift(t.variableDeclaration("var", [t.variableDeclarator(uid, node)]));
return uid;
}
}
exports.__esModule = true;

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

// check if the input Literal `source` is an alternate casing of "react"
var check = function check(source, file) {
function check(source, file) {
if (t.isLiteral(source)) {

@@ -25,3 +25,3 @@ var name = source.value;

}
};
}

@@ -28,0 +28,0 @@ function CallExpression(node, parent, scope, file) {

@@ -19,3 +19,2 @@ "use strict";

this.parentPath = parentPath;
this.scope = scope;

@@ -22,0 +21,0 @@ this.state = state;

@@ -18,6 +18,5 @@ "use strict";

var TraversalPath = (function () {
function TraversalPath(parentPath, parent, container) {
function TraversalPath(parent, container) {
_classCallCheck(this, TraversalPath);
this.parentPath = parentPath;
this.container = container;

@@ -44,7 +43,7 @@ this.parent = parent;

if (!path) {
path = new TraversalPath(parentPath, parent, container);
path = new TraversalPath(parent, container);
paths.push(path);
}
path.setContext(context, key);
path.setContext(parentPath, context, key);

@@ -77,3 +76,3 @@ return path;

TraversalPath.prototype.setContext = function setContext(context, key) {
TraversalPath.prototype.setContext = function setContext(parentPath, context, key) {
this.shouldRemove = false;

@@ -83,2 +82,3 @@ this.shouldSkip = false;

this.parentPath = parentPath;
this.context = context;

@@ -85,0 +85,0 @@ this.state = context.state;

@@ -164,18 +164,2 @@ "use strict";

/*
* Shallowly checks to see if the passed `node` is falsy.
*
* @param {Object} node
* @returns {Boolean}
*/
t.isFalsyExpression = function (node) {
if (t.isLiteral(node)) {
return !node.value;
} else if (t.isIdentifier(node)) {
return node.name === "undefined";
}
return false;
};
/**

@@ -475,2 +459,4 @@ * Turn an array of statement `nodes` into a `SequenceExpression`.

for (var key in node) {
if (key[0] === "_") continue;
var val = node[key];

@@ -477,0 +463,0 @@

{
"name": "babel-core",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "4.7.1",
"version": "4.7.2",
"author": "Sebastian McKenzie <sebmck@gmail.com>",

@@ -6,0 +6,0 @@ "homepage": "https://babeljs.io/",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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