Compare commits

...

18 Commits

Author SHA1 Message Date
Sebastian McKenzie
9108422f99 v5.5.2 2015-06-05 12:03:38 +01:00
Sebastian McKenzie
9e8f4b25ca add missing semicolon 2015-06-05 12:02:30 +01:00
Sebastian McKenzie
1cecd24823 make experimental warning more scary 2015-06-05 12:01:52 +01:00
Sebastian McKenzie
97f6e1469b add 5.5.2 changelog 2015-06-05 12:01:44 +01:00
Sebastian McKenzie
ec46eaf224 add scary experimental warning for people who use obscure transformers that are still WIP 2015-06-05 11:55:09 +01:00
Sebastian McKenzie
a102692103 when using babel/register always use the cwd - fixes #1689 2015-06-05 11:54:52 +01:00
Sebastian McKenzie
0376ec8ff0 t.isPure -> this.isPure - fixes #1688 2015-06-05 11:33:25 +01:00
Sebastian McKenzie
5932a07610 5.5.1 2015-06-05 09:57:21 +01:00
Sebastian McKenzie
6110b0c0b3 v5.5.1 2015-06-05 09:56:27 +01:00
Sebastian McKenzie
365e221d95 fix deoptValue binding boolean - fixes #1687 2015-06-05 09:55:47 +01:00
Sebastian McKenzie
acbc4859c0 only remove ClassProperty in flow transformer when it has no value 2015-06-05 09:53:59 +01:00
Sebastian McKenzie
55750e05e7 Revert "enable es6.spec.symbols by default"
This reverts commit f3acedbf08.
2015-06-05 09:44:22 +01:00
Sebastian McKenzie
ba9c4db673 finish 5.5.1 changelog - ref #1686 2015-06-05 09:43:34 +01:00
Sebastian McKenzie
ba8a63a69e remove trailing json comma 2015-06-05 09:42:53 +01:00
Sebastian McKenzie
25581981b5 always remove ClassProperty nodes in flow transformer - fixes #1686 2015-06-05 09:42:46 +01:00
Sebastian McKenzie
02a6feed73 update template literal parsing to properly handle newlines 2015-06-05 09:36:37 +01:00
Sebastian McKenzie
f3acedbf08 enable es6.spec.symbols by default 2015-06-05 08:43:41 +01:00
Sebastian McKenzie
35ab4ffaab 5.5.0 2015-06-05 08:12:17 +01:00
17 changed files with 61 additions and 38 deletions

View File

@@ -13,6 +13,19 @@ _Note: Gaps between patch versions are faulty/broken releases._
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
## 5.5.2
* **Bug Fix**
* Fix `NodePath#isPure` on `Property` nodes.
* Use cwd instead of entry file directory when working out relative directory for `babel/register`.
* **Internal**
* Add scary warning for those few who choose to use the WIP experimental transformers.
## 5.5.1
* **Bug Fix**
* Remove `ClassProperty` nodes always in the `Flow` transformer. This is fine now since class properties aren't supported in any engine that supports classes but the `es7.classProperties` transformer will need to be updated in the future to desugar to ES6 classes instead of relying on the `es6.classes` transformer from being ran.
## 5.5.0
* **Bug Fix**

View File

@@ -1,7 +1,7 @@
{
"name": "babel-core",
"description": "A compiler for writing next generation JavaScript",
"version": "5.5.0",
"version": "5.5.2",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"license": "MIT",

View File

@@ -1,14 +1,14 @@
{
"name": "babel",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "5.4.7",
"version": "5.5.1",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"license": "MIT",
"repository": "babel/babel",
"preferGlobal": true,
"dependencies": {
"babel-core": "^5.4.7",
"babel-core": "^5.5.1",
"chokidar": "^1.0.0",
"commander": "^2.6.0",
"convert-source-map": "^1.1.0",

View File

@@ -1,7 +1,7 @@
{
"name": "babel-runtime",
"description": "babel selfContained runtime",
"version": "5.4.7",
"version": "5.5.1",
"license": "MIT",
"repository": "babel/babel",
"author": "Sebastian McKenzie <sebmck@gmail.com>",

View File

@@ -513,7 +513,7 @@ pp.parseNew = function() {
pp.parseTemplateElement = function() {
let elem = this.startNode()
elem.value = {
raw: this.input.slice(this.start, this.end),
raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, '\n'),
cooked: this.value
}
this.next()

View File

@@ -577,11 +577,15 @@ pp.readTmplToken = function() {
} else if (isNewLine(ch)) {
out += this.input.slice(chunkStart, this.pos)
++this.pos
if (ch === 13 && this.input.charCodeAt(this.pos) === 10) {
++this.pos
out += "\n"
} else {
out += String.fromCharCode(ch)
switch (ch) {
case 13:
if (this.input.charCodeAt(this.pos) === 10) ++this.pos;
case 10:
out += "\n";
break;
default:
out += String.fromCharCode(ch);
break;
}
if (this.options.locations) {
++this.curLine

View File

@@ -38,7 +38,7 @@ var only;
var oldHandlers = {};
var maps = {};
var cwd = require.main ? require.main.filename : process.cwd();
var cwd = process.cwd();
var getRelativePath = function (filename){
return path.relative(cwd, filename);

View File

@@ -16,6 +16,10 @@ export default class Logger {
return parts;
}
warn(msg) {
console.warn(this._buildMessage(msg));
}
error(msg: string, Constructor = Error) {
throw new Constructor(this._buildMessage(msg));
}

View File

@@ -47,7 +47,8 @@
},
"experimental": {
"deprecated": "use `--stage 0`/`{ stage: 0 }` instead"
"description": "allow use of experimental transformers",
"default": false
},
"highlightCode": {

View File

@@ -13,6 +13,12 @@ export default class TransformerPass {
this.handlers = transformer.handlers;
this.file = file;
this.key = transformer.key;
if (this.canTransform() && transformer.metadata.experimental && !file.opts.experimental) {
file.log.warn(`THE TRANSFORMER ${this.key} HAS BEEN MARKED AS EXPERIMENTAL AND IS WIP. USE AT YOUR OWN RISK. ` +
"THIS WILL HIGHLY LIKELY BREAK YOUR CODE SO USE WITH **EXTREME** CAUTION. ENABLE THE " +
"`experimental` OPTION TO IGNORE THIS WARNING.");
}
}
canTransform(): boolean {

View File

@@ -2,7 +2,8 @@ import * as t from "../../../types";
export var metadata = {
optional: true,
group: "builtin-prepass"
group: "builtin-prepass",
experimental: true
};
export function AssignmentExpression() {

View File

@@ -19,7 +19,8 @@ function toStatements(node) {
export var metadata = {
optional: true,
group: "builtin-pre"
group: "builtin-pre",
experimental: true
};
export function ReferencedIdentifier(node, parent, scope) {

View File

@@ -8,6 +8,7 @@ export function Flow(node) {
export function ClassProperty(node) {
node.typeAnnotation = null;
if (!node.value) this.dangerouslyRemove();
}
export function Class(node) {

View File

@@ -20,7 +20,7 @@ export default class Binding {
deoptValue() {
this.clearValue();
this.deoptValue = true;
this.hasDeoptedValue = true;
}
/**
@@ -28,7 +28,7 @@ export default class Binding {
*/
setValue(value) {
if (this.deoptValue) return;
if (this.hasDeoptedValue) return;
this.hasValue = true;
this.value = value;
}
@@ -38,9 +38,9 @@ export default class Binding {
*/
clearValue() {
this.deoptValue = false;
this.hasValue = false;
this.value = null;
this.hasDeoptedValue = false;
this.hasValue = false;
this.value = null;
}
/**

View File

@@ -585,8 +585,8 @@ export default class Scope {
}
return true;
} else if (t.isProperty(node)) {
if (node.computed && !t.isPure(node.key, constantsOnly)) return false;
return t.isPure(node.value, constantsOnly);
if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
return this.isPure(node.value, constantsOnly);
} else {
return t.isPure(node);
}

View File

@@ -813,7 +813,7 @@ test("`\\n\\r\\b\\v\\t\\f\\\n\\\r\n`", {
type: "TemplateLiteral",
quasis: [{
type: "TemplateElement",
value: {raw: "\\n\\r\\b\\v\\t\\f\\\n\\\r\n", cooked: "\n\r\b\u000b\t\f"},
value: {raw: "\\n\\r\\b\\v\\t\\f\\\n\\\n", cooked: "\n\r\b\u000b\t\f"},
tail: true,
loc: {
start: {line: 1, column: 1},
@@ -841,7 +841,7 @@ test("`\\n\\r\\b\\v\\t\\f\\\n\\\r\n`", {
locations: true
});
test("`\n\r\n`", {
test("`\n\r\n\r`", {
type: "Program",
body: [{
type: "ExpressionStatement",
@@ -849,27 +849,27 @@ test("`\n\r\n`", {
type: "TemplateLiteral",
quasis: [{
type: "TemplateElement",
value: {raw: "\n\r\n", cooked: "\n\n"},
value: {raw: "\n\n\n", cooked: "\n\n\n"},
tail: true,
loc: {
start: {line: 1, column: 1},
end: {line: 3, column: 0}
end: {line: 4, column: 0}
}
}],
expressions: [],
loc: {
start: {line: 1, column: 0},
end: {line: 3, column: 1}
end: {line: 4, column: 1}
}
},
loc: {
start: {line: 1, column: 0},
end: {line: 3, column: 1}
end: {line: 4, column: 1}
}
}],
loc: {
start: {line: 1, column: 0},
end: {line: 3, column: 1}
end: {line: 4, column: 1}
}
}, {
ecmaVersion: 6,
@@ -14134,8 +14134,6 @@ test('function normal(x, y = 10) {}', {
}]
}, {ecmaVersion: 6});
test("'use strict'; function f([x,,z]) {}", {}, {ecmaVersion: 6});
// test preserveParens option with arrow functions
test("() => 42", {
type: "Program",

View File

@@ -64,14 +64,8 @@ class Foo8 {
"bar"() {}
}
function foo(requiredParam, optParam) {}
class Foo9 {
prop1;
prop2;
}
class Foo10 {
static prop1;
prop2;
}
class Foo9 {}
class Foo10 {}
var x = 4;
class Array {
concat(items) {}