babel-core
Advanced tools
Comparing version 4.7.8 to 4.7.9
@@ -16,2 +16,18 @@ # Changelog | ||
## 4.7.9 | ||
* **Polish** | ||
* Allow `inputSourceMap` to be set to `false` to skip the source map inference. | ||
* Infer computed literal property names. | ||
* **Bug Fix** | ||
* Fix nested labeled for-ofs. | ||
* Fix block scoping `break` colliding with the parent switch case. | ||
* **Internal** | ||
* Upgrade `acorn-babel`. | ||
## 4.7.8 | ||
* **Bug Fix** | ||
* Fix computed classes not properly setting symbols. | ||
## 4.7.7 | ||
@@ -18,0 +34,0 @@ |
@@ -101,3 +101,3 @@ "use strict"; | ||
auxilaryComment: "", | ||
inputSourceMap: false, | ||
inputSourceMap: null, | ||
experimental: false, | ||
@@ -243,6 +243,8 @@ reactCompat: false, | ||
var inputMap = convertSourceMap.fromSource(code); | ||
if (inputMap) { | ||
opts.inputSourceMap = inputMap.toObject(); | ||
code = convertSourceMap.removeComments(code); | ||
if (opts.inputSourceMap === false) { | ||
var inputMap = convertSourceMap.fromSource(code); | ||
if (inputMap) { | ||
opts.inputSourceMap = inputMap.toObject(); | ||
code = convertSourceMap.removeComments(code); | ||
} | ||
} | ||
@@ -249,0 +251,0 @@ |
@@ -117,3 +117,3 @@ "use strict"; | ||
var id; | ||
if (t.isProperty(parent) && parent.kind === "init" && !parent.computed) { | ||
if (t.isProperty(parent) && parent.kind === "init" && (!parent.computed || t.isLiteral(parent.key))) { | ||
// { foo() {} }; | ||
@@ -128,5 +128,12 @@ id = parent.key; | ||
if (!t.isIdentifier(id)) return node; | ||
var name; | ||
if (t.isLiteral(id)) { | ||
name = id.value; | ||
} else if (t.isIdentifier(id)) { | ||
name = id.name; | ||
} else { | ||
return; | ||
} | ||
var name = t.toIdentifier(id.name); | ||
name = t.toIdentifier(name); | ||
id = t.identifier(name); | ||
@@ -133,0 +140,0 @@ |
@@ -91,4 +91,5 @@ "use strict"; | ||
} | ||
var blockScoping = new BlockScoping(node, node.body, parent, scope, file); | ||
blockScoping.run(); | ||
var blockScoping = new BlockScoping(this, node.body, parent, scope, file); | ||
return blockScoping.run(); | ||
} | ||
@@ -245,6 +246,5 @@ | ||
function BlockScoping(loopParent, block, parent, scope, file) { | ||
function BlockScoping(loopPath, block, parent, scope, file) { | ||
_classCallCheck(this, BlockScoping); | ||
this.loopParent = loopParent; | ||
this.parent = parent; | ||
@@ -259,2 +259,8 @@ this.scope = scope; | ||
this.body = []; | ||
if (loopPath) { | ||
this.loopParent = loopPath.parent; | ||
this.loopLabel = t.isLabeledStatement(this.loopParent) && this.loopParent.label; | ||
this.loop = loopPath.node; | ||
} | ||
} | ||
@@ -284,2 +290,6 @@ | ||
} | ||
if (this.loopLabel && !t.isLabeledStatement(this.loopParent)) { | ||
return t.labeledStatement(this.loopLabel, this.loop); | ||
} | ||
}; | ||
@@ -323,7 +333,7 @@ | ||
var loopParent = this.loopParent; | ||
if (loopParent) { | ||
traverseReplace(loopParent.right, loopParent, scope, remaps); | ||
traverseReplace(loopParent.test, loopParent, scope, remaps); | ||
traverseReplace(loopParent.update, loopParent, scope, remaps); | ||
var loop = this.loop; | ||
if (loop) { | ||
traverseReplace(loop.right, loop, scope, remaps); | ||
traverseReplace(loop.test, loop, scope, remaps); | ||
traverseReplace(loop.update, loop, scope, remaps); | ||
} | ||
@@ -344,3 +354,3 @@ | ||
// remap loop heads with colliding variables | ||
if (this.loopParent) { | ||
if (this.loop) { | ||
for (var name in outsideRefs) { | ||
@@ -466,3 +476,3 @@ var id = outsideRefs[name]; | ||
hasReturn: false, | ||
isLoop: !!this.loopParent, | ||
isLoop: !!this.loop, | ||
map: {} | ||
@@ -531,3 +541,3 @@ }; | ||
var loopParent = this.loopParent; | ||
var loop = this.loop; | ||
var retCheck; | ||
@@ -545,4 +555,4 @@ var has = this.has; | ||
if (has.hasBreakContinue) { | ||
if (!loopParent) { | ||
throw new Error("Has no loop parent but we're trying to reassign breaks " + "and continues, something is going wrong here."); | ||
if (!loop) { | ||
throw new Error("Aren't in a loop and we're trying to reassign breaks and continues, something is going wrong here."); | ||
} | ||
@@ -562,2 +572,12 @@ | ||
} else { | ||
// #998 | ||
for (var i = 0; i < cases.length; i++) { | ||
var caseConsequent = cases[i].consequent[0]; | ||
if (t.isBreakStatement(caseConsequent) && !caseConsequent.label) { | ||
var _ref; | ||
caseConsequent.label = (_ref = this, !_ref.loopLabel && (_ref.loopLabel = this.file.scope.generateUidIdentifier("loop")), _ref.loopLabel); | ||
} | ||
} | ||
body.push(this.file.attachAuxiliaryComment(t.switchStatement(ret, cases))); | ||
@@ -564,0 +584,0 @@ } |
@@ -43,7 +43,4 @@ "use strict"; | ||
if (build.replaceParent) { | ||
this.parentPath.node = build.node; | ||
} else { | ||
return build.node; | ||
} | ||
if (build.replaceParent) this.parentPath.node = build.node; | ||
return build.node; | ||
} | ||
@@ -50,0 +47,0 @@ |
{ | ||
"name": "babel-core", | ||
"description": "Turn ES6 code into readable vanilla ES5 with source maps", | ||
"version": "4.7.8", | ||
"version": "4.7.9", | ||
"author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
@@ -26,3 +26,3 @@ "homepage": "https://babeljs.io/", | ||
"dependencies": { | ||
"acorn-babel": "0.11.1-37", | ||
"acorn-babel": "0.11.1-38", | ||
"ast-types": "~0.7.0", | ||
@@ -29,0 +29,0 @@ "chalk": "^1.0.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1933631
191
15940
24
+ Addedacorn-babel@0.11.1-38(transitive)
- Removedacorn-babel@0.11.1-37(transitive)
Updatedacorn-babel@0.11.1-38