Merge branch 'master' into 2.0.0
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
* when found, before invoking the "real" _6to5-node(1) executable.
|
||||
*/
|
||||
|
||||
var spawn = require("child_process").spawn;
|
||||
var args = ["--harmony", __dirname + "/_6to5-node"];
|
||||
|
||||
process.argv.slice(2).forEach(function(arg){
|
||||
@@ -49,13 +48,21 @@ process.argv.slice(2).forEach(function(arg){
|
||||
}
|
||||
});
|
||||
|
||||
var proc = spawn(process.argv[0], args, { stdio: "inherit" });
|
||||
proc.on("exit", function (code, signal) {
|
||||
process.on("exit", function () {
|
||||
if (signal) {
|
||||
process.kill(process.pid, signal);
|
||||
} else {
|
||||
process.exit(code);
|
||||
}
|
||||
try {
|
||||
var kexec = require("kexec");
|
||||
kexec(process.argv[0], args);
|
||||
} catch (err) {
|
||||
if (err.code !== "MODULE_NOT_FOUND") throw err;
|
||||
|
||||
var child_process = require("child_process");
|
||||
var proc = child_process.spawn(process.argv[0], args, { stdio: "inherit" });
|
||||
proc.on("exit", function (code, signal) {
|
||||
process.on("exit", function () {
|
||||
if (signal) {
|
||||
process.kill(process.pid, signal);
|
||||
} else {
|
||||
process.exit(code);
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,3 +39,10 @@ class Bar extends Foo {
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 6to5-node
|
||||
|
||||
It is necessary to manually install `kexec` package on Unix-like OSes for
|
||||
`6to5-node` to correctly handle signals.
|
||||
|
||||
**It is not recommended to use `6to5-node` with a process manager (`supervisord`, `upstart`, `systemd`, ...) without first installing `kexec`!**
|
||||
|
||||
@@ -74,21 +74,16 @@ AMDFormatter.prototype.import = function (node) {
|
||||
|
||||
AMDFormatter.prototype.importSpecifier = function (specifier, node, nodes) {
|
||||
var key = t.getSpecifierName(specifier);
|
||||
var id = specifier.id;
|
||||
|
||||
// import foo from "foo";
|
||||
if (specifier.default) {
|
||||
id = t.identifier("default");
|
||||
}
|
||||
|
||||
var ref;
|
||||
var ref = this._push(node);
|
||||
|
||||
if (t.isImportBatchSpecifier(specifier)) {
|
||||
// import * as bar from "foo";
|
||||
ref = this._push(node);
|
||||
} else {
|
||||
} else if (specifier.default) {
|
||||
// import foo from "foo";
|
||||
ref = t.memberExpression(this._push(node), id, false);
|
||||
ref = t.callExpression(this.file.addDeclaration("interop-require"), [ref]);
|
||||
} else {
|
||||
// import {foo} from "foo";
|
||||
ref = t.memberExpression(ref, specifier.id, false);
|
||||
}
|
||||
|
||||
nodes.push(t.variableDeclaration("var", [
|
||||
|
||||
@@ -61,5 +61,8 @@
|
||||
"mocha": "1.21.4",
|
||||
"rimraf": "2.2.8",
|
||||
"uglify-js": "2.4.15"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"kexec": "^0.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var foo = _foo["default"];
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var foo = _interopRequire(_foo);
|
||||
|
||||
var foo = _foo["default"];
|
||||
});
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var foo = _foo["default"];
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var foo = _interopRequire(_foo);
|
||||
|
||||
var xyz = _foo.baz;
|
||||
});
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
"use strict";
|
||||
|
||||
var foo = _foo["default"];
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var foo = _interopRequire(_foo);
|
||||
|
||||
var foo = _foo;
|
||||
var bar = _foo.bar;
|
||||
var bar = _foo.foo;
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var foo = _foo["default"];
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var foo = _interopRequire(_foo);
|
||||
|
||||
var foo = _foo["default"];
|
||||
});
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var foo = _foo["default"];
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var foo = _interopRequire(_foo);
|
||||
|
||||
var xyz = _foo.baz;
|
||||
});
|
||||
|
||||
@@ -7,7 +7,12 @@
|
||||
})(function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
"use strict";
|
||||
|
||||
var foo = _foo["default"];
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var foo = _interopRequire(_foo);
|
||||
|
||||
var foo = _foo;
|
||||
var bar = _foo.bar;
|
||||
var bar = _foo.foo;
|
||||
|
||||
Reference in New Issue
Block a user