Merge branch 'master' into development

This commit is contained in:
Sebastian McKenzie 2015-07-31 12:45:13 +01:00
commit 2d73acdd54
6 changed files with 32 additions and 22 deletions

View File

@ -6,10 +6,10 @@
"repository": "babel/babel",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"dependencies": {
"core-js": "^0.9.0"
"core-js": "^1.0.0"
},
"devDependencies": {
"babel-plugin-runtime": "^1.0.7",
"regenerator": "^0.8.34"
}
}
}

View File

@ -46,7 +46,7 @@
"bluebird": "^2.9.33",
"chalk": "^1.0.0",
"convert-source-map": "^1.1.0",
"core-js": "^0.9.0",
"core-js": "^1.0.0",
"debug": "^2.1.1",
"detect-indent": "^3.0.0",
"esutils": "^2.0.0",
@ -62,7 +62,7 @@
"path-exists": "^1.0.0",
"path-is-absolute": "^1.0.0",
"private": "^0.1.6",
"regenerator": "0.8.34",
"regenerator": "0.8.35",
"regexpu": "^1.1.2",
"repeating": "^1.1.2",
"resolve": "^1.1.6",
@ -75,4 +75,4 @@
"trim-right": "^1.0.0",
"try-resolve": "^1.0.0"
}
}
}

View File

@ -12,8 +12,11 @@ node scripts/cache-templates
node $BROWSERIFY_CMD -e lib/polyfill.js >dist/polyfill.js
node $UGLIFY_CMD dist/polyfill.js >dist/polyfill.min.js
node $BROWSERIFY_CMD lib/api/browser.js -s babel $BROWSERIFY_IGNORE >dist/browser.js
node $UGLIFY_CMD dist/browser.js >dist/browser.min.js
# Add a Unicode BOM so browsers will interpret the file as UTF-8
printf '\xEF\xBB\xBF' > dist/browser.js
node $BROWSERIFY_CMD lib/api/browser.js -s babel $BROWSERIFY_IGNORE >>dist/browser.js
printf '\xEF\xBB\xBF' > dist/browser.min.js
node $UGLIFY_CMD dist/browser.js >>dist/browser.min.js
node $BROWSERIFY_CMD lib/api/node.js --node $BROWSERIFY_IGNORE >dist/node.js

View File

@ -26,7 +26,10 @@ export var visitor = {
var hasChange = false;
for (var i = 0; i < node.body.length; i++) {
var bodyNode = node.body[i];
if (bodyNode && bodyNode._blockHoist != null) hasChange = true;
if (bodyNode && bodyNode._blockHoist != null) {
hasChange = true;
break;
}
}
if (!hasChange) return;

View File

@ -171,27 +171,26 @@ export function referencesImport(moduleSource, importName) {
if (!binding || binding.kind !== "module") return false;
var path = binding.path;
if (!path.isImportDeclaration()) return false;
var parent = path.parentPath;
if (!parent.isImportDeclaration()) return false;
// check moduleSource
if (path.node.source.value === moduleSource) {
if (parent.node.source.value === moduleSource) {
if (!importName) return true;
} else {
return false;
}
for (var specifier of (path.node.specifiers: Array)) {
if (t.isSpecifierDefault(specifier) && importName === "default") {
return true;
}
if (path.isImportDefaultSpecifier() && importName === "default") {
return true;
}
if (t.isImportNamespaceSpecifier(specifier) && importName === "*") {
return true;
}
if (path.isImportNamespaceSpecifier() && importName === "*") {
return true;
}
if (t.isImportSpecifier(specifier) && specifier.imported.name === importName) {
return true;
}
if (path.isImportSpecifier() && path.node.imported.name === importName) {
return true;
}
return false;

View File

@ -537,8 +537,13 @@ export default class Scope {
}
} else if (path.isClassDeclaration()) {
this.registerBinding("let", path);
} else if (path.isImportDeclaration() || path.isExportDeclaration()) {
this.registerBinding("module", path);
} else if (path.isImportDeclaration()) {
var specifiers = path.get("specifiers");
for (var specifier of (specifiers: Array)) {
this.registerBinding("module", specifier);
}
} else if (path.isExportDeclaration()) {
this.registerBinding("module", path.get("declaration"));
} else {
this.registerBinding("unknown", path);
}