Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db6fab2c8f | ||
|
|
d92deb52b6 | ||
|
|
b8b70f2f4a | ||
|
|
a8a3f6d34d | ||
|
|
9847d226e1 | ||
|
|
3d48a16305 | ||
|
|
3d24cc9ae5 | ||
|
|
5acc58dd68 | ||
|
|
74aaf848ed | ||
|
|
1f2f4ce4f3 |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-core",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.2.7",
|
||||
"version": "5.2.9",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"repository": "babel/babel",
|
||||
|
||||
@@ -27,9 +27,14 @@ module.exports = function (commander, filenames, opts) {
|
||||
|
||||
if (result.map) {
|
||||
var consumer = new sourceMap.SourceMapConsumer(result.map);
|
||||
var sourceFilename = filename;
|
||||
|
||||
map._sources.add(filename);
|
||||
map.setSourceContent(filename, result.actual);
|
||||
if (commander.outFile) {
|
||||
sourceFilename = path.relative(path.dirname(commander.outFile), sourceFilename);
|
||||
}
|
||||
|
||||
map._sources.add(sourceFilename);
|
||||
map.setSourceContent(sourceFilename, result.actual);
|
||||
|
||||
consumer.eachMapping(function (mapping) {
|
||||
map._mappings.add({
|
||||
@@ -37,7 +42,7 @@ module.exports = function (commander, filenames, opts) {
|
||||
generatedColumn: mapping.generatedColumn,
|
||||
originalLine: mapping.originalLine,
|
||||
originalColumn: mapping.originalColumn,
|
||||
source: filename
|
||||
source: sourceFilename
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "babel",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.2.6",
|
||||
"version": "5.2.7",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"repository": "babel/babel",
|
||||
"preferGlobal": true,
|
||||
"dependencies": {
|
||||
"babel-core": "^5.2.6",
|
||||
"babel-core": "^5.2.7",
|
||||
"chokidar": "^1.0.0",
|
||||
"commander": "^2.6.0",
|
||||
"convert-source-map": "^1.1.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-runtime",
|
||||
"description": "babel selfContained runtime",
|
||||
"version": "5.2.6",
|
||||
"version": "5.2.7",
|
||||
"repository": "babel/babel",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"dependencies": {
|
||||
|
||||
@@ -14,7 +14,6 @@ export { default as TransformerPipeline } from "../transformation/transformer-pi
|
||||
export { default as traverse } from "../traversal";
|
||||
export { default as buildExternalHelpers } from "../tools/build-external-helpers";
|
||||
export { version } from "../../../package";
|
||||
export { all as parse } from "../helpers/parse";
|
||||
|
||||
import * as t from "../types";
|
||||
export { t as types };
|
||||
@@ -56,3 +55,20 @@ export function transformFileSync(filename: string, opts?: Object = {}) {
|
||||
opts.filename = filename;
|
||||
return transform(fs.readFileSync(filename), opts);
|
||||
}
|
||||
|
||||
export function parse(code, opts = {}) {
|
||||
opts.allowHashBang = true;
|
||||
opts.sourceType = "module";
|
||||
opts.ecmaVersion = Infinity;
|
||||
opts.plugins = {
|
||||
flow: true,
|
||||
jsx: true
|
||||
};
|
||||
opts.features = {};
|
||||
|
||||
for (var key in transform.pipeline.transformers) {
|
||||
opts.features[key] = true;
|
||||
}
|
||||
|
||||
return acorn.parse(code, opts);
|
||||
}
|
||||
|
||||
@@ -32,20 +32,3 @@ export default function (code, opts = {}) {
|
||||
ast = normalizeAst(ast, comments, tokens);
|
||||
return ast;
|
||||
}
|
||||
|
||||
export function all(code, opts = {}) {
|
||||
opts.allowHashBang = true;
|
||||
opts.sourceType = "module";
|
||||
opts.ecmaVersion = Infinity;
|
||||
opts.plugins = {
|
||||
flow: true,
|
||||
jsx: true
|
||||
};
|
||||
opts.features = {};
|
||||
|
||||
for (var key in transform.pipeline.transformers) {
|
||||
opts.features[key] = true;
|
||||
}
|
||||
|
||||
return acorn.parse(code, opts);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import groupBy from "lodash/collection/groupBy";
|
||||
import flatten from "lodash/array/flatten";
|
||||
import values from "lodash/object/values";
|
||||
import sortBy from "lodash/collection/sortBy";
|
||||
|
||||
// Priority:
|
||||
//
|
||||
@@ -18,14 +16,14 @@ export var BlockStatement = {
|
||||
}
|
||||
if (!hasChange) return;
|
||||
|
||||
var nodePriorities = groupBy(node.body, function (bodyNode) {
|
||||
node.body = sortBy(node.body, function(bodyNode){
|
||||
var priority = bodyNode && bodyNode._blockHoist;
|
||||
if (priority == null) priority = 1;
|
||||
if (priority === true) priority = 2;
|
||||
return priority;
|
||||
});
|
||||
|
||||
node.body = flatten(values(nodePriorities).reverse());
|
||||
// Higher priorities should move toward the top.
|
||||
return -1 * priority;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import isNumber from "lodash/lang/isNumber";
|
||||
import isRegExp from "lodash/lang/isRegExp";
|
||||
import isString from "lodash/lang/isString";
|
||||
import codeFrame from "../../helpers/code-frame";
|
||||
import { all as parse } from "../../helpers/parse";
|
||||
import parse from "../../helpers/parse";
|
||||
import traverse from "../index";
|
||||
import includes from "lodash/collection/includes";
|
||||
import assign from "lodash/object/assign";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var generate = require("../../lib/babel/generation");
|
||||
var assert = require("assert");
|
||||
var helper = require("./_helper");
|
||||
var parse = require("../../lib/babel/helpers/parse").default;
|
||||
var parse = require("../../lib/babel/helpers/parse");
|
||||
var chai = require("chai");
|
||||
var t = require("../../lib/babel/types");
|
||||
var _ = require("lodash");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var assert = require("assert");
|
||||
var util = require("../../lib/babel/util");
|
||||
var parse = require("../../lib/babel/helpers/parse").default;
|
||||
var parse = require("../../lib/babel/helpers/parse");
|
||||
var t = require("../../lib/babel/types");
|
||||
|
||||
suite("util", function () {
|
||||
|
||||
Reference in New Issue
Block a user