Merge branch 'development'
This commit is contained in:
@@ -73,26 +73,8 @@ function buildVar(namespace, builder) {
|
||||
}
|
||||
|
||||
function buildHelpers(body, namespace, whitelist) {
|
||||
function shouldIgnore(name) {
|
||||
if (!whitelist) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check for the raw name
|
||||
if (whitelist.indexOf(name) >= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// typeof -> _typeof
|
||||
if (name[0] === "_" && whitelist.indexOf(name.slice(1)) >= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
each(helpers.list, function (name) {
|
||||
if (shouldIgnore(name)) return;
|
||||
if (whitelist && whitelist.indexOf(name) >= 0) return;
|
||||
|
||||
let key = t.identifier(t.toIdentifier(name));
|
||||
body.push(t.expressionStatement(
|
||||
|
||||
@@ -274,8 +274,7 @@ export default class File extends Store {
|
||||
let res = generator(name);
|
||||
if (res) return res;
|
||||
} else if (runtime) {
|
||||
let id = t.identifier(t.toIdentifier(name));
|
||||
return t.memberExpression(runtime, id);
|
||||
return t.memberExpression(runtime, t.identifier(name));
|
||||
}
|
||||
|
||||
let ref = getHelper(name);
|
||||
|
||||
@@ -6,6 +6,7 @@ import * as t from "babel-types";
|
||||
import n from "../node";
|
||||
|
||||
const SCIENTIFIC_NOTATION = /e/i;
|
||||
const ZERO_DECIMAL_INTEGER = /\.0+$/;
|
||||
|
||||
export function UnaryExpression(node: Object) {
|
||||
let needsSpace = /[a-z]$/.test(node.operator);
|
||||
@@ -208,7 +209,7 @@ export function MemberExpression(node: Object) {
|
||||
} else {
|
||||
if (t.isLiteral(node.object) && !t.isTemplateLiteral(node.object)) {
|
||||
let val = this.getPossibleRaw(node.object) || this._stringLiteral(node.object);
|
||||
if (isInteger(+val) && !SCIENTIFIC_NOTATION.test(val) && !this.endsWith(".")) {
|
||||
if (isInteger(+val) && !SCIENTIFIC_NOTATION.test(val) && !ZERO_DECIMAL_INTEGER.test(val) && !this.endsWith(".")) {
|
||||
this.push(".");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,3 +9,5 @@ foo[test()][bar()];
|
||||
|
||||
0..toString();
|
||||
0.5.toString();
|
||||
1.0.toString();
|
||||
1.000.toString();
|
||||
|
||||
@@ -9,3 +9,5 @@ foo[test()][bar()];
|
||||
|
||||
0..toString();
|
||||
0.5.toString();
|
||||
1.0.toString();
|
||||
1.000.toString();
|
||||
|
||||
@@ -7,6 +7,8 @@ export function get(name) {
|
||||
return fn().expression;
|
||||
}
|
||||
|
||||
export let list = Object.keys(helpers).filter(name => name !== "__esModule");
|
||||
export let list = Object.keys(helpers)
|
||||
.map(name => name[0] === "_" ? name.slice(1) : name)
|
||||
.filter(name => name !== "__esModule");
|
||||
|
||||
export default get;
|
||||
|
||||
@@ -6,11 +6,11 @@ module.exports = {
|
||||
require("babel-plugin-syntax-jsx"),
|
||||
require("babel-plugin-transform-react-display-name"),
|
||||
],
|
||||
env: {
|
||||
/*env: {
|
||||
development: {
|
||||
plugins: [
|
||||
require("babel-plugin-transform-react-jsx-source")
|
||||
]
|
||||
}
|
||||
}
|
||||
}*/
|
||||
};
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
"path-exists": "^1.0.0",
|
||||
"lodash": "^3.10.0",
|
||||
"source-map-support": "^0.2.10",
|
||||
"babel-core": "^6.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.1.4",
|
||||
"babel-runtime": "^5.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user