Compare commits
100 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06a31c419a | ||
|
|
da566110c0 | ||
|
|
c12c4a5c39 | ||
|
|
d114349890 | ||
|
|
8d6ae0e1eb | ||
|
|
cb8b47ee2f | ||
|
|
daf24c5c59 | ||
|
|
cdb2784e75 | ||
|
|
93feabb82e | ||
|
|
982c142bf6 | ||
|
|
de5520a94f | ||
|
|
c239d06f10 | ||
|
|
a5fed376d8 | ||
|
|
e99fd77d89 | ||
|
|
1374863b9c | ||
|
|
e88c28f88b | ||
|
|
7a0fd26f56 | ||
|
|
17583e4807 | ||
|
|
37dd5137ff | ||
|
|
24fced406e | ||
|
|
0ab1362893 | ||
|
|
96506f4249 | ||
|
|
ed747f88bd | ||
|
|
3987545b4f | ||
|
|
148aa3f96d | ||
|
|
0cb5a7c91e | ||
|
|
fc34d5a9b0 | ||
|
|
f8d56d9612 | ||
|
|
737be0e95e | ||
|
|
26e2b392e8 | ||
|
|
708cdfb993 | ||
|
|
8cb3aabefa | ||
|
|
4a87b35d20 | ||
|
|
543554b258 | ||
|
|
afd95cf663 | ||
|
|
87ce4b9cd8 | ||
|
|
6b76f26ed8 | ||
|
|
c2776e63ae | ||
|
|
3f2fe363d1 | ||
|
|
8de28098f4 | ||
|
|
9a28f3fdb1 | ||
|
|
88941b3270 | ||
|
|
3a768db2bf | ||
|
|
320a39f4c4 | ||
|
|
dc98ac7c93 | ||
|
|
6e456f0ec1 | ||
|
|
793090628d | ||
|
|
9ed251cb08 | ||
|
|
480fa7f4e0 | ||
|
|
3e642dfa1b | ||
|
|
d9cbce1862 | ||
|
|
4bd19da3c2 | ||
|
|
7c710a0378 | ||
|
|
56335409d3 | ||
|
|
91d78afc67 | ||
|
|
54c6339f20 | ||
|
|
fdcf64265e | ||
|
|
ffdfb491eb | ||
|
|
eedd431f2b | ||
|
|
db9ed0235f | ||
|
|
6c98d39937 | ||
|
|
20651df3ce | ||
|
|
f3155919fe | ||
|
|
0ac8330899 | ||
|
|
67201e9698 | ||
|
|
c715d96e46 | ||
|
|
b7a08100a6 | ||
|
|
5f91ee8a1a | ||
|
|
bc1abb5103 | ||
|
|
4b9207e5df | ||
|
|
e847f3685f | ||
|
|
d64c2c0c45 | ||
|
|
76d0fb4ba6 | ||
|
|
0f33b7bfbc | ||
|
|
630224e504 | ||
|
|
62980ab6b4 | ||
|
|
d34480b42b | ||
|
|
306de2edbf | ||
|
|
c33e84730d | ||
|
|
20f28aba64 | ||
|
|
9c312607d1 | ||
|
|
33659711c3 | ||
|
|
b154af48a7 | ||
|
|
bad877946f | ||
|
|
dff3751e7f | ||
|
|
23038dcfff | ||
|
|
7c7a7ee17f | ||
|
|
9f467ef7c0 | ||
|
|
a52f9ab346 | ||
|
|
5ccbed585b | ||
|
|
f7c7da7526 | ||
|
|
ed58c80c64 | ||
|
|
d7fb9f67df | ||
|
|
eef6002324 | ||
|
|
32bcf4c3a5 | ||
|
|
86060cb0ce | ||
|
|
66a836d435 | ||
|
|
ecc14c2a31 | ||
|
|
7e9b60fba5 | ||
|
|
313f1e755a |
67
CHANGELOG.md
67
CHANGELOG.md
@@ -13,6 +13,73 @@ _Note: Gaps between patch versions are faulty/broken releases._
|
||||
|
||||
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
|
||||
## 5.0.12
|
||||
|
||||
* **Bug Fix**
|
||||
* Fix incorrect remapping of module references inside of a function id redirection container.
|
||||
|
||||
## 5.0.11
|
||||
|
||||
* **Bug Fix**
|
||||
* Fix new `for...of` loops not properly inheriting their original loop.
|
||||
* **Internal**
|
||||
* Disable scope instance cache.
|
||||
* **Polish**
|
||||
* Allow comments in `.babelrc` JSON.
|
||||
|
||||
## 5.0.9
|
||||
|
||||
* **Polish**
|
||||
* Use `moduleId` for UMD global name if available.
|
||||
* **Bug Fix**
|
||||
* Fix UMD global `module` variable shadowing the `amd`/`common` `module` variable.
|
||||
* Fix Flow param type annotation regression.
|
||||
* Fix function name collision `toString` wrapper. Thanks [@alawatthe](https://github.com/alawatthe)!
|
||||
|
||||
## 5.0.8
|
||||
|
||||
* **Bug Fix**
|
||||
* Fix falsy static class properties not being writable.
|
||||
* Fix block scoping collisions not properly detecting modules and function clashes.
|
||||
* Skip `this` before `super` for derived constructors on functions.
|
||||
|
||||
## 5.0.7
|
||||
|
||||
* **New Feature**
|
||||
* Add `--ignore` and `--only` support to the CLI.
|
||||
* **Bug Fix**
|
||||
* Remove `HOMEPATH` environment variable from home resolution in `babel/register` cache.
|
||||
* **Internal**
|
||||
* Disable WIP path resolution introducing infinite recursion in some code examples.
|
||||
* **Polish**
|
||||
* Add live binding to CommonJS default imports.
|
||||
|
||||
## 5.0.6
|
||||
|
||||
* **Bug Fix**
|
||||
* Fix mangling of import references that collide with properties on `Object.prototype`.
|
||||
* Fix duplicate declarations incorrectly being reported for `var`.
|
||||
|
||||
## 5.0.5
|
||||
|
||||
* **Internal**
|
||||
* Upgrade `core-js`.
|
||||
* **Bug Fix**
|
||||
* Fix arrays not being supported in `util.list`.
|
||||
|
||||
## 5.0.4
|
||||
|
||||
* **Polish**
|
||||
* Check for top level `breakConfig` in `resolveRc`.
|
||||
|
||||
## 5.0.3
|
||||
|
||||
* **Bug Fix**
|
||||
* Make relative location absolute before calling `resolveRc`.
|
||||
* **Internal**
|
||||
* Switch to global UID registry.
|
||||
* Add `breakConfig` option to prevent Babel from erroring when hitting that option.
|
||||
|
||||
## 5.0.1
|
||||
|
||||
* **Bug Fix**
|
||||
|
||||
@@ -35,13 +35,13 @@ This is mostly overkill and you can limit the tests to a select few by directly
|
||||
running them with `mocha`:
|
||||
|
||||
```sh
|
||||
$ mocha test/transformation.js
|
||||
$ mocha test/core/transformation.js
|
||||
```
|
||||
|
||||
Use mocha's `--grep` option to run a subset of tests by name:
|
||||
|
||||
```sh
|
||||
$ mocha test/transformation.js --grep es7
|
||||
$ mocha test/core/transformation.js --grep es7
|
||||
```
|
||||
|
||||
#### Workflow
|
||||
|
||||
2
Makefile
2
Makefile
@@ -111,7 +111,7 @@ publish-cli:
|
||||
bootstrap:
|
||||
npm install
|
||||
npm link
|
||||
cd packages/babel-cli && npm install && npm link
|
||||
cd packages/babel-cli && npm install && npm link && npm link babel-core
|
||||
git submodule update --init
|
||||
cd vendor/regenerator && npm install
|
||||
cd vendor/compat-table && npm install object-assign
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
For questions and support please visit the <a href="https://gitter.im/babel/babel">gitter room</a> or <a href="stackoverflow.com">StackOverflow</a>. The Babel issue tracker is <strong>exclusively</strong> for bug reports and future requests.
|
||||
For questions and support please visit the <a href="https://gitter.im/babel/babel">gitter room</a> or <a href="http://stackoverflow.com/questions/tagged/babeljs">StackOverflow</a>. The Babel issue tracker is <strong>exclusively</strong> for bug reports and future requests.
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-core",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.0.2",
|
||||
"version": "5.0.12",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"repository": "babel/babel",
|
||||
@@ -30,7 +30,7 @@
|
||||
"ast-types": "~0.7.0",
|
||||
"chalk": "^1.0.0",
|
||||
"convert-source-map": "^0.5.0",
|
||||
"core-js": "^0.8.0",
|
||||
"core-js": "^0.8.1",
|
||||
"debug": "^2.1.1",
|
||||
"detect-indent": "^3.0.0",
|
||||
"estraverse": "^1.9.1",
|
||||
@@ -53,6 +53,7 @@
|
||||
"slash": "^1.0.0",
|
||||
"source-map": "^0.4.0",
|
||||
"source-map-support": "^0.2.9",
|
||||
"strip-json-comments": "^1.0.2",
|
||||
"to-fast-properties": "^1.0.0",
|
||||
"trim-right": "^1.0.0"
|
||||
},
|
||||
@@ -65,7 +66,7 @@
|
||||
"esvalid": "^1.1.0",
|
||||
"istanbul": "^0.3.5",
|
||||
"matcha": "^0.6.0",
|
||||
"mocha": "^2.1.0",
|
||||
"mocha": "2.1.0",
|
||||
"rimraf": "^2.2.8",
|
||||
"uglify-js": "^2.4.16"
|
||||
}
|
||||
|
||||
5
packages/babel-cli/README.md
Normal file
5
packages/babel-cli/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# babel-cli
|
||||
|
||||
Babel CLI
|
||||
|
||||
For more information please look at [babel](https://github.com/babel/babel).
|
||||
@@ -4,6 +4,7 @@ var pathIsAbsolute = require("path-is-absolute");
|
||||
var commander = require("commander");
|
||||
var Module = require("module");
|
||||
var babel = require("babel-core");
|
||||
var inspect = require("util").inspect;
|
||||
var path = require("path");
|
||||
var repl = require("repl");
|
||||
var util = require("babel-core").util;
|
||||
@@ -71,7 +72,10 @@ if (program.eval || program.print) {
|
||||
global.require = module.require.bind(module);
|
||||
|
||||
var result = _eval(code, global.__filename);
|
||||
if (program.print) console.log(result);
|
||||
if (program.print) {
|
||||
var output = _.isString(result) ? result : inspect(result);
|
||||
process.stdout.write(output + "\n");
|
||||
}
|
||||
} else {
|
||||
if (program.args.length) {
|
||||
// slice all arguments up to the first filename since they're babel args that we handle
|
||||
|
||||
@@ -28,6 +28,8 @@ module.exports = function (commander, filenames, opts) {
|
||||
};
|
||||
|
||||
var handleFile = function (src, filename) {
|
||||
if (util.shouldIgnore(src)) return;
|
||||
|
||||
if (util.canCompile(filename)) {
|
||||
write(src, filename);
|
||||
} else if (commander.copyFiles) {
|
||||
|
||||
@@ -107,6 +107,8 @@ module.exports = function (commander, filenames, opts) {
|
||||
});
|
||||
|
||||
_.each(_filenames, function (filename) {
|
||||
if (util.shouldIgnore(filename)) return;
|
||||
|
||||
results.push(util.compile(filename));
|
||||
});
|
||||
|
||||
|
||||
@@ -102,12 +102,15 @@ if (errors.length) {
|
||||
|
||||
//
|
||||
|
||||
exports.opts = {};
|
||||
var opts = exports.opts = {};
|
||||
|
||||
each(options, function (opt, key) {
|
||||
exports.opts[key] = commander[key];
|
||||
opts[key] = commander[key];
|
||||
});
|
||||
|
||||
opts.ignore = util.arrayify(opts.ignore, util.regexify);
|
||||
opts.only = util.arrayify(opts.only, util.regexify);
|
||||
|
||||
var fn;
|
||||
|
||||
if (commander.outDir) {
|
||||
|
||||
@@ -16,6 +16,10 @@ exports.readdir = readdir;
|
||||
|
||||
exports.canCompile = util.canCompile;
|
||||
|
||||
exports.shouldIgnore = function (loc) {
|
||||
return util.shouldIgnore(loc, index.opts.ignore, index.opts.only);
|
||||
};
|
||||
|
||||
exports.addSourceMappingUrl = function (code, loc) {
|
||||
return code + "\n//# sourceMappingURL=" + path.basename(loc);
|
||||
};
|
||||
@@ -23,6 +27,8 @@ exports.addSourceMappingUrl = function (code, loc) {
|
||||
exports.transform = function (filename, code, opts) {
|
||||
opts = _.defaults(opts || {}, index.opts);
|
||||
opts.filename = filename;
|
||||
opts.ignore = null;
|
||||
opts.only = null;
|
||||
|
||||
var result = babel.transform(code, opts);
|
||||
result.filename = filename;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "babel",
|
||||
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
|
||||
"version": "5.0.1",
|
||||
"version": "5.0.11",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"repository": "babel/babel",
|
||||
"preferGlobal": true,
|
||||
"dependencies": {
|
||||
"chokidar": "^0.12.6",
|
||||
"babel-core": "^5.0.1",
|
||||
"babel-core": "^5.0.11",
|
||||
"commander": "^2.6.0",
|
||||
"fs-readdir-recursive": "^0.1.0",
|
||||
"output-file-sync": "^1.1.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "babel-runtime",
|
||||
"description": "babel selfContained runtime",
|
||||
"version": "5.0.1",
|
||||
"version": "5.0.11",
|
||||
"repository": "babel/babel",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"dependencies": {
|
||||
|
||||
@@ -250,7 +250,7 @@ pp.parseExprAtom = function(refShorthandDefaultPos) {
|
||||
return this.finishNode(node, type)
|
||||
|
||||
case tt._yield:
|
||||
if (this.inGenerator) unexpected()
|
||||
if (this.inGenerator) this.unexpected()
|
||||
|
||||
case tt._do:
|
||||
if (this.options.features["es7.doExpressions"]) {
|
||||
|
||||
@@ -125,7 +125,9 @@ pp.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
||||
this.expect(close)
|
||||
break
|
||||
} else {
|
||||
elts.push(this.parseAssignableListItemTypes(this.parseMaybeDefault()))
|
||||
var left = this.parseMaybeDefault()
|
||||
this.parseAssignableListItemTypes(left)
|
||||
elts.push(this.parseMaybeDefault(null, left))
|
||||
}
|
||||
}
|
||||
return elts
|
||||
|
||||
@@ -3,7 +3,7 @@ import os from "os";
|
||||
import fs from "fs";
|
||||
|
||||
function getUserHome() {
|
||||
return process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
|
||||
return process.env.HOME || process.env.USERPROFILE;
|
||||
}
|
||||
|
||||
const FILENAME = process.env.BABEL_CACHE_PATH || path.join(getUserHome() || os.tmpdir(), ".babel.json");
|
||||
|
||||
@@ -169,4 +169,8 @@ export function MemberExpression(node, print) {
|
||||
}
|
||||
}
|
||||
|
||||
export { MemberExpression as MetaProperty };
|
||||
export function MetaProperty(node, print) {
|
||||
print(node.meta);
|
||||
this.push(".");
|
||||
print(node.property);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import stripJsonComments from "strip-json-comments";
|
||||
import merge from "lodash/object/merge";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
@@ -24,7 +25,7 @@ export default function (loc, opts = {}) {
|
||||
var json;
|
||||
|
||||
try {
|
||||
json = jsons[content] ||= JSON.parse(content);
|
||||
json = jsons[content] ||= JSON.parse(stripJsonComments(content));
|
||||
} catch (err) {
|
||||
err.message = `${file}: ${err.message}`;
|
||||
throw err;
|
||||
@@ -43,8 +44,11 @@ export default function (loc, opts = {}) {
|
||||
find(up, rel);
|
||||
}
|
||||
}
|
||||
|
||||
find(loc, rel);
|
||||
|
||||
if (opts.breakConfig !== true) {
|
||||
find(loc, rel);
|
||||
}
|
||||
|
||||
|
||||
return opts;
|
||||
};
|
||||
|
||||
@@ -44,6 +44,7 @@ export default class File {
|
||||
this.usedHelpers = {};
|
||||
this.dynamicData = {};
|
||||
this.data = {};
|
||||
this.uids = {};
|
||||
|
||||
this.lastStatements = [];
|
||||
this.log = new Logger(this, opts.filename || "unknown");
|
||||
@@ -89,8 +90,10 @@ export default class File {
|
||||
normalizeOptions(opts: Object) {
|
||||
opts = assign({}, opts);
|
||||
|
||||
if (opts.filename && isAbsolute(opts.filename)) {
|
||||
opts = resolveRc(opts.filename, opts);
|
||||
if (opts.filename) {
|
||||
var rcFilename = opts.filename;
|
||||
if (!isAbsolute(rcFilename)) rcFilename = path.join(process.cwd(), rcFilename);
|
||||
opts = resolveRc(rcFilename, opts);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -419,23 +422,7 @@ export default class File {
|
||||
|
||||
shouldIgnore() {
|
||||
var opts = this.opts;
|
||||
|
||||
var filename = opts.filename;
|
||||
var ignore = opts.ignore;
|
||||
var only = opts.only;
|
||||
|
||||
if (only.length) {
|
||||
for (var i = 0; i < only.length; i++) {
|
||||
if (only[i].test(filename)) return false;
|
||||
}
|
||||
return true;
|
||||
} else if (ignore.length) {
|
||||
for (var i = 0; i < ignore.length; i++) {
|
||||
if (ignore[i].test(filename)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return util.shouldIgnore(opts.filename, opts.ignore, opts.only);
|
||||
}
|
||||
|
||||
parse(code: string) {
|
||||
|
||||
@@ -194,5 +194,13 @@
|
||||
"moduleRoot": {
|
||||
"type": "string",
|
||||
"description": "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"
|
||||
},
|
||||
|
||||
"breakConfig": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"hidden": true,
|
||||
"description": "stop trying to load .babelrc files"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ var wrap = function (state, method, id, scope) {
|
||||
FUNCTION_ID: id,
|
||||
FUNCTION_KEY: scope.generateUidIdentifier(id.name)
|
||||
});
|
||||
template.callee._skipModulesRemap = true;
|
||||
|
||||
// shim in dummy params to retain function arity, if you try to read the
|
||||
// source then you'll get the original since it's proxied so it's all good
|
||||
|
||||
@@ -46,7 +46,11 @@ var remapVisitor = {
|
||||
}
|
||||
}
|
||||
|
||||
if (t.isAssignmentExpression(node)) {
|
||||
if (node._skipModulesRemap) {
|
||||
return this.skip();
|
||||
}
|
||||
|
||||
if (t.isAssignmentExpression(node) && !node._ignoreModulesRemap) {
|
||||
var exported = formatter.getExport(node.left, scope);
|
||||
if (exported) {
|
||||
this.skip();
|
||||
@@ -61,7 +65,6 @@ var importsVisitor = {
|
||||
enter(node, parent, scope, formatter) {
|
||||
formatter.hasLocalImports = true;
|
||||
extend(formatter.localImports, this.getBindingIdentifiers());
|
||||
formatter.bumpImportOccurences(node);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -69,7 +72,7 @@ var importsVisitor = {
|
||||
var exportsVisitor = traverse.explode({
|
||||
ExportDeclaration: {
|
||||
enter(node, parent, scope, formatter) {
|
||||
formatter.hasLocalImports = true;
|
||||
formatter.hasLocalExports = true;
|
||||
|
||||
var declar = this.get("declaration");
|
||||
if (declar.isStatement()) {
|
||||
@@ -96,29 +99,23 @@ var exportsVisitor = traverse.explode({
|
||||
formatter.hasNonDefaultExports = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (node.source) {
|
||||
formatter.bumpImportOccurences(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default class DefaultFormatter {
|
||||
constructor(file) {
|
||||
this.internalRemap = {};
|
||||
|
||||
this.defaultIds = object();
|
||||
this.scope = file.scope;
|
||||
this.file = file;
|
||||
this.ids = object();
|
||||
this.internalRemap = object();
|
||||
this.defaultIds = object();
|
||||
this.scope = file.scope;
|
||||
this.file = file;
|
||||
this.ids = object();
|
||||
|
||||
this.hasNonDefaultExports = false;
|
||||
|
||||
this.hasLocalExports = false;
|
||||
this.hasLocalImports = false;
|
||||
|
||||
this.localImportOccurences = object();
|
||||
this.localExports = object();
|
||||
this.localImports = object();
|
||||
|
||||
@@ -134,15 +131,6 @@ export default class DefaultFormatter {
|
||||
return (t.isExportDefaultDeclaration(node) || t.isSpecifierDefault(node)) && !this.noInteropRequireExport && !this.hasNonDefaultExports;
|
||||
}
|
||||
|
||||
bumpImportOccurences(node) {
|
||||
var source = node.source.value;
|
||||
var occurs = this.localImportOccurences;
|
||||
occurs[source] ||= 0;
|
||||
if (node.specifiers) {
|
||||
occurs[source] += node.specifiers.length;
|
||||
}
|
||||
}
|
||||
|
||||
getLocalExports() {
|
||||
this.file.path.traverse(exportsVisitor, this);
|
||||
}
|
||||
@@ -152,7 +140,7 @@ export default class DefaultFormatter {
|
||||
}
|
||||
|
||||
remapAssignments() {
|
||||
if (this.hasLocalImports) {
|
||||
if (this.hasLocalExports || this.hasLocalImports) {
|
||||
this.file.path.traverse(remapVisitor, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import * as util from "../../util";
|
||||
import * as t from "../../types";
|
||||
|
||||
export default class AMDFormatter extends DefaultFormatter {
|
||||
init = CommonFormatter.prototype.init;
|
||||
init() {
|
||||
CommonFormatter.prototype._init.call(this, this.hasNonDefaultExports);
|
||||
}
|
||||
|
||||
buildDependencyLiterals() {
|
||||
var names = [];
|
||||
@@ -100,15 +102,34 @@ export default class AMDFormatter extends DefaultFormatter {
|
||||
this.internalRemap[specifier.local.name] = ref;
|
||||
}
|
||||
|
||||
exportSpecifier() {
|
||||
CommonFormatter.prototype.exportSpecifier.apply(this, arguments);
|
||||
exportSpecifier(specifier, node, nodes) {
|
||||
if (this.doDefaultExportInterop(specifier)) {
|
||||
nodes.push(util.template("exports-default-assign", {
|
||||
VALUE: specifier.local
|
||||
}, true));
|
||||
} else {
|
||||
CommonFormatter.prototype.exportSpecifier.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
exportDeclaration(node) {
|
||||
exportDeclaration(node, nodes) {
|
||||
if (this.doDefaultExportInterop(node)) {
|
||||
this.passModuleArg = true;
|
||||
|
||||
var declar = node.declaration;
|
||||
var assign = util.template("exports-default-assign", {
|
||||
VALUE: this._pushStatement(declar, nodes)
|
||||
}, true);
|
||||
|
||||
if (t.isFunctionDeclaration(declar)) {
|
||||
// we can hoist this assignment to the top of the file
|
||||
assign._blockHoist = 3;
|
||||
}
|
||||
|
||||
nodes.push(assign);
|
||||
return;
|
||||
}
|
||||
|
||||
CommonFormatter.prototype.exportDeclaration.apply(this, arguments);
|
||||
DefaultFormatter.prototype.exportDeclaration.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,17 @@ import * as t from "../../types";
|
||||
|
||||
export default class CommonJSFormatter extends DefaultFormatter {
|
||||
init() {
|
||||
this._init(this.hasLocalExports);
|
||||
}
|
||||
|
||||
_init(conditional) {
|
||||
var file = this.file;
|
||||
var scope = file.scope;
|
||||
|
||||
scope.rename("module");
|
||||
scope.rename("exports");
|
||||
|
||||
if (!this.noInteropRequireImport && this.hasNonDefaultExports) {
|
||||
if (!this.noInteropRequireImport && conditional) {
|
||||
var templateName = "exports-module-declaration";
|
||||
if (this.file.isLoose("es6.modules")) templateName += "-loose";
|
||||
var declar = util.template(templateName, true);
|
||||
@@ -20,6 +24,20 @@ export default class CommonJSFormatter extends DefaultFormatter {
|
||||
}
|
||||
}
|
||||
|
||||
transform(program) {
|
||||
DefaultFormatter.prototype.transform.apply(this, arguments);
|
||||
|
||||
if (this.hasDefaultOnlyExport) {
|
||||
program.body.push(
|
||||
t.expressionStatement(t.assignmentExpression(
|
||||
"=",
|
||||
t.memberExpression(t.identifier("module"), t.identifier("exports")),
|
||||
t.memberExpression(t.identifier("exports"), t.identifier("default"))
|
||||
))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
importSpecifier(specifier, node, nodes) {
|
||||
var variableName = specifier.local;
|
||||
|
||||
@@ -31,11 +49,15 @@ export default class CommonJSFormatter extends DefaultFormatter {
|
||||
this.internalRemap[variableName.name] = ref;
|
||||
} else {
|
||||
if (this.noInteropRequireImport) {
|
||||
this.internalRemap[variableName.name] = t.memberExpression(ref, t.identifier("default"))
|
||||
this.internalRemap[variableName.name] = t.memberExpression(ref, t.identifier("default"));
|
||||
} else if (!includes(this.file.dynamicImported, node)) {
|
||||
var uid = this.scope.generateUidBasedOnNode(node, "import");
|
||||
|
||||
nodes.push(t.variableDeclaration("var", [
|
||||
t.variableDeclarator(variableName, t.callExpression(this.file.addHelper("interop-require"), [ref]))
|
||||
t.variableDeclarator(uid, t.callExpression(this.file.addHelper("interop-require-wildcard"), [ref]))
|
||||
]));
|
||||
|
||||
this.internalRemap[variableName.name] = t.memberExpression(uid, t.identifier("default"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -64,29 +86,15 @@ export default class CommonJSFormatter extends DefaultFormatter {
|
||||
|
||||
exportSpecifier(specifier, node, nodes) {
|
||||
if (this.doDefaultExportInterop(specifier)) {
|
||||
nodes.push(util.template("exports-default-assign", {
|
||||
VALUE: specifier.local
|
||||
}, true));
|
||||
return;
|
||||
} else {
|
||||
DefaultFormatter.prototype.exportSpecifier.apply(this, arguments);
|
||||
this.hasDefaultOnlyExport = true;
|
||||
}
|
||||
|
||||
DefaultFormatter.prototype.exportSpecifier.apply(this, arguments);
|
||||
}
|
||||
|
||||
exportDeclaration(node, nodes) {
|
||||
if (this.doDefaultExportInterop(node)) {
|
||||
var declar = node.declaration;
|
||||
var assign = util.template("exports-default-assign", {
|
||||
VALUE: this._pushStatement(declar, nodes)
|
||||
}, true);
|
||||
|
||||
if (t.isFunctionDeclaration(declar)) {
|
||||
// we can hoist this assignment to the top of the file
|
||||
assign._blockHoist = 3;
|
||||
}
|
||||
|
||||
nodes.push(assign);
|
||||
return;
|
||||
this.hasDefaultOnlyExport = true;
|
||||
}
|
||||
|
||||
DefaultFormatter.prototype.exportDeclaration.apply(this, arguments);
|
||||
|
||||
@@ -47,8 +47,8 @@ export default class UMDFormatter extends AMDFormatter {
|
||||
|
||||
// globals
|
||||
|
||||
var browserArgs = [t.memberExpression(t.identifier("module"), t.identifier("exports"))];
|
||||
if (this.passModuleArg) browserArgs.push(t.identifier("module"));
|
||||
var browserArgs = [];
|
||||
if (this.passModuleArg) browserArgs.push(t.identifier("mod"));
|
||||
|
||||
for (let name in this.ids) {
|
||||
var id = this.defaultIds[name] || t.identifier(t.toIdentifier(name));
|
||||
@@ -60,12 +60,17 @@ export default class UMDFormatter extends AMDFormatter {
|
||||
var moduleName = this.getModuleName();
|
||||
if (moduleName) defineArgs.unshift(t.literal(moduleName));
|
||||
|
||||
//
|
||||
var globalArg = this.file.opts.basename;
|
||||
if (moduleName) globalArg = moduleName;
|
||||
globalArg = t.identifier(t.toIdentifier(globalArg));
|
||||
|
||||
var runner = util.template("umd-runner-body", {
|
||||
AMD_ARGUMENTS: defineArgs,
|
||||
COMMON_TEST: commonTests,
|
||||
COMMON_ARGUMENTS: commonArgs,
|
||||
BROWSER_ARGUMENTS: browserArgs,
|
||||
GLOBAL_ARG: t.identifier(t.toIdentifier(this.file.opts.basename))
|
||||
GLOBAL_ARG: globalArg
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if (descriptor.value) descriptor.writable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
}
|
||||
|
||||
FUNCTION_ID.toString = function () {
|
||||
return FUNCTION_ID.toString();
|
||||
return FUNCTION_KEY.toString();
|
||||
};
|
||||
|
||||
return FUNCTION_ID;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
}
|
||||
|
||||
FUNCTION_ID.toString = function () {
|
||||
return FUNCTION_ID.toString();
|
||||
return FUNCTION_KEY.toString();
|
||||
}
|
||||
|
||||
return FUNCTION_ID;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
} else if (COMMON_TEST) {
|
||||
factory(COMMON_ARGUMENTS);
|
||||
} else {
|
||||
var module = { exports: {} };
|
||||
factory(BROWSER_ARGUMENTS);
|
||||
global.GLOBAL_ARG = module.exports;
|
||||
var mod = { exports: {} };
|
||||
factory(mod.exports, BROWSER_ARGUMENTS);
|
||||
global.GLOBAL_ARG = mod.exports;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -30,7 +30,7 @@ var collectPropertyReferencesVisitor = {
|
||||
}
|
||||
|
||||
if (this.isReferenced() && scope.getBinding(node.name) === state.scope.getBinding(node.name)) {
|
||||
state.references[node.name] = true;;
|
||||
state.references[node.name] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,18 @@ var verifyConstructorVisitor = traverse.explode({
|
||||
}
|
||||
},
|
||||
|
||||
FunctionDeclaration: {
|
||||
enter() {
|
||||
this.skip();
|
||||
}
|
||||
},
|
||||
|
||||
FunctionExpression: {
|
||||
enter() {
|
||||
this.skip();
|
||||
}
|
||||
},
|
||||
|
||||
ThisExpression: {
|
||||
enter(node, parent, scope, state) {
|
||||
if (state.hasSuper && !state.hasBareSuper) {
|
||||
@@ -158,21 +170,36 @@ class ClassTransformer {
|
||||
|
||||
this.buildBody();
|
||||
|
||||
var decorators = this.node.decorators;
|
||||
var classCheckRef = classRef;
|
||||
|
||||
if (decorators) {
|
||||
classCheckRef = this.scope.generateUidIdentifier(classRef);
|
||||
}
|
||||
|
||||
constructorBody.body.unshift(t.expressionStatement(t.callExpression(file.addHelper("class-call-check"), [
|
||||
t.thisExpression(),
|
||||
classRef
|
||||
classCheckRef
|
||||
])));
|
||||
|
||||
//
|
||||
|
||||
var decorators = this.node.decorators;
|
||||
if (decorators) {
|
||||
if (this.className) {
|
||||
body.push(t.variableDeclaration("var", [
|
||||
t.variableDeclarator(classCheckRef, classRef)
|
||||
]));
|
||||
}
|
||||
|
||||
for (var i = 0; i < decorators.length; i++) {
|
||||
var decorator = decorators[i];
|
||||
body.push(util.template("class-decorator", {
|
||||
|
||||
var decoratorNode = util.template("class-decorator", {
|
||||
DECORATOR: decorator.expression,
|
||||
CLASS_REF: classRef
|
||||
}, true));
|
||||
}, true);
|
||||
decoratorNode.expression._ignoreModulesRemap = true;
|
||||
body.push(decoratorNode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +467,7 @@ class ClassTransformer {
|
||||
file: this.file
|
||||
};
|
||||
|
||||
path.traverse(verifyConstructorVisitor, state);
|
||||
path.get("value").traverse(verifyConstructorVisitor, state);
|
||||
|
||||
this.bareSuper = state.bareSuper;
|
||||
|
||||
|
||||
@@ -332,7 +332,7 @@ class DestructuringTransformer {
|
||||
if (t.isSpreadProperty(prop)) continue;
|
||||
|
||||
var key = prop.key;
|
||||
if (t.isIdentifier(key)) key = t.literal(prop.key.name);
|
||||
if (t.isIdentifier(key) && !prop.computed) key = t.literal(prop.key.name);
|
||||
keys.push(key);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,6 @@ export function ForOfStatement(node, parent, scope, file) {
|
||||
var loop = build.loop;
|
||||
var block = loop.body;
|
||||
|
||||
// inherit comments from the original loop
|
||||
t.inheritsComments(loop, node);
|
||||
|
||||
// ensure that it's a block so we can take all its statements
|
||||
t.ensureBlock(node);
|
||||
|
||||
@@ -32,6 +29,7 @@ export function ForOfStatement(node, parent, scope, file) {
|
||||
block.body = block.body.concat(node.body.body);
|
||||
|
||||
t.inherits(loop, node);
|
||||
t.inherits(loop.body, node.body);
|
||||
|
||||
if (build.replaceParent) {
|
||||
this.parentPath.replaceWithMultiple(build.node);
|
||||
|
||||
@@ -547,6 +547,9 @@ export default class TraversalPath {
|
||||
var binding = this.scope.getBinding(this.node.name);
|
||||
if (!binding || !binding.constant) return;
|
||||
|
||||
// todo: take into consideration infinite recursion #1149
|
||||
return;
|
||||
|
||||
if (binding.path === this) {
|
||||
return this;
|
||||
} else {
|
||||
|
||||
@@ -80,7 +80,7 @@ export default class Scope {
|
||||
if (cached && cached.parent === parent) {
|
||||
return cached;
|
||||
} else {
|
||||
path.setData("scope", this);
|
||||
//path.setData("scope", this);
|
||||
}
|
||||
|
||||
this.parent = parent;
|
||||
@@ -135,7 +135,7 @@ export default class Scope {
|
||||
uid = this._generateUid(name, i);
|
||||
i++;
|
||||
} while (this.hasBinding(uid) || this.hasGlobal(uid) || this.hasUid(uid));
|
||||
this.getFunctionParent().uids[uid] = true;
|
||||
this.file.uids[uid] = true;
|
||||
return uid;
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ export default class Scope {
|
||||
hasUid(name): boolean {
|
||||
var scope = this;
|
||||
do {
|
||||
if (scope.uids[name]) return true;
|
||||
if (scope.file.uids[name]) return true;
|
||||
scope = scope.parent;
|
||||
} while (scope);
|
||||
return false;
|
||||
@@ -237,10 +237,15 @@ export default class Scope {
|
||||
var local = this.getOwnBindingInfo(name);
|
||||
if (!local) return;
|
||||
|
||||
|
||||
if (kind === "param") return;
|
||||
if (kind === "hoisted" && local.kind === "let") return;
|
||||
|
||||
if (local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param") {
|
||||
var duplicate = false;
|
||||
duplicate ||= kind === "let" || kind === "const" || local.kind === "let" || local.kind === "const" || local.kind === "module";
|
||||
duplicate ||= local.kind === "param" && (kind === "let" || kind === "const");
|
||||
|
||||
if (duplicate) {
|
||||
throw this.file.errorWithNode(id, messages.get("scopeDuplicateDeclaration", name), TypeError);
|
||||
}
|
||||
}
|
||||
@@ -434,8 +439,7 @@ export default class Scope {
|
||||
|
||||
info = this.block._scopeInfo = {
|
||||
bindings: object(),
|
||||
globals: object(),
|
||||
uids: object()
|
||||
globals: object()
|
||||
};
|
||||
|
||||
extend(this, info);
|
||||
@@ -473,6 +477,15 @@ export default class Scope {
|
||||
this.traverse(path.get("body").node, blockVariableVisitor, this);
|
||||
}
|
||||
|
||||
// Program, Function - var variables
|
||||
|
||||
if (path.isProgram() || path.isFunction()) {
|
||||
this.traverse(path.node, functionVariableVisitor, {
|
||||
blockId: path.get("id").node,
|
||||
scope: this
|
||||
});
|
||||
}
|
||||
|
||||
// Program, BlockStatement, Function - let variables
|
||||
|
||||
if (path.isBlockStatement() || path.isProgram()) {
|
||||
@@ -491,15 +504,6 @@ export default class Scope {
|
||||
this.registerBinding("let", path);
|
||||
}
|
||||
|
||||
// Program, Function - var variables
|
||||
|
||||
if (path.isProgram() || path.isFunction()) {
|
||||
this.traverse(path.node, functionVariableVisitor, {
|
||||
blockId: path.get("id").node,
|
||||
scope: this
|
||||
});
|
||||
}
|
||||
|
||||
// Program
|
||||
|
||||
if (path.isProgram()) {
|
||||
@@ -658,7 +662,7 @@ export default class Scope {
|
||||
if (!name) return false;
|
||||
if (this.hasOwnBinding(name)) return true;
|
||||
if (this.parentHasBinding(name)) return true;
|
||||
if (this.uids[name]) return true;
|
||||
if (this.file.uids[name]) return true;
|
||||
if (includes(Scope.globals, name)) return true;
|
||||
if (includes(Scope.contextVariables, name)) return true;
|
||||
return false;
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"CallExpression": ["callee", "arguments"],
|
||||
"CatchClause": ["param", "body"],
|
||||
"ClassBody": ["body"],
|
||||
"ClassDeclaration": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements"],
|
||||
"ClassExpression": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements"],
|
||||
"ClassDeclaration": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements", "decorators"],
|
||||
"ClassExpression": ["id", "body", "superClass", "typeParameters", "superTypeParameters", "implements", "decorators"],
|
||||
"ComprehensionBlock": ["left", "right", "body"],
|
||||
"ComprehensionExpression": ["filter", "blocks", "body"],
|
||||
"ConditionalExpression": ["test", "consequent", "alternate"],
|
||||
@@ -40,12 +40,12 @@
|
||||
"LogicalExpression": ["left", "right"],
|
||||
"MemberExpression": ["object", "property"],
|
||||
"MetaProperty": ["meta", "property"],
|
||||
"MethodDefinition": ["key", "value"],
|
||||
"MethodDefinition": ["key", "value", "decorators"],
|
||||
"NewExpression": ["callee", "arguments"],
|
||||
"ObjectExpression": ["properties"],
|
||||
"ObjectPattern": ["properties", "typeAnnotation"],
|
||||
"Program": ["body"],
|
||||
"Property": ["key", "value"],
|
||||
"Property": ["key", "value", "decorators"],
|
||||
"RestElement": ["argument", "typeAnnotation"],
|
||||
"ReturnStatement": ["argument"],
|
||||
"SequenceExpression": ["expressions"],
|
||||
|
||||
@@ -55,7 +55,15 @@ export function resolveRelative(loc: string) {
|
||||
}
|
||||
|
||||
export function list(val: string): Array<string> {
|
||||
return val ? val.split(",") : [];
|
||||
if (!val) {
|
||||
return [];
|
||||
} else if (Array.isArray(val)) {
|
||||
return val;
|
||||
} else if (typeof val === "string") {
|
||||
return val.split(",");
|
||||
} else {
|
||||
return [val];
|
||||
}
|
||||
}
|
||||
|
||||
export function regexify(val: any): RegExp {
|
||||
@@ -85,6 +93,21 @@ export function booleanify(val: any): boolean {
|
||||
return val;
|
||||
}
|
||||
|
||||
export function shouldIgnore(filename, ignore, only) {
|
||||
if (only.length) {
|
||||
for (var i = 0; i < only.length; i++) {
|
||||
if (only[i].test(filename)) return false;
|
||||
}
|
||||
return true;
|
||||
} else if (ignore.length) {
|
||||
for (var i = 0; i < ignore.length; i++) {
|
||||
if (ignore[i].test(filename)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var templateVisitor = {
|
||||
enter(node, parent, scope, nodes) {
|
||||
if (t.isExpressionStatement(node)) {
|
||||
|
||||
@@ -10959,7 +10959,7 @@ var fbTestFixture = {
|
||||
}
|
||||
},
|
||||
},
|
||||
'Bounded Polymorphism': {
|
||||
'Bounded Polymorphism': {
|
||||
'class A<T: Foo> {}': {
|
||||
type: 'ClassDeclaration',
|
||||
id: {
|
||||
|
||||
@@ -70,6 +70,7 @@ var buildTest = function (binName, testName, opts) {
|
||||
|
||||
return function (callback) {
|
||||
this.timeout(5000);
|
||||
clear();
|
||||
saveInFiles(opts.inFiles);
|
||||
|
||||
var args = [binLoc].concat(opts.args);
|
||||
@@ -109,11 +110,11 @@ var buildTest = function (binName, testName, opts) {
|
||||
};
|
||||
};
|
||||
|
||||
before(function () {
|
||||
var clear = function () {
|
||||
if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc);
|
||||
fs.mkdirSync(tmpLoc);
|
||||
process.chdir(tmpLoc);
|
||||
});
|
||||
};
|
||||
|
||||
_.each(fs.readdirSync(fixtureLoc), function (binName) {
|
||||
if (binName[0] === ".") return;
|
||||
|
||||
@@ -12,10 +12,7 @@ suite("browserify", function() {
|
||||
assert.ok(bundle.length, "bundle output code");
|
||||
|
||||
// ensure that the code runs without throwing an exception
|
||||
vm.runInNewContext("var global = this;\n" + bundle, {
|
||||
setInterval: function () {},
|
||||
setTimeout: function () {}
|
||||
});
|
||||
vm.runInNewContext("var global = this;\n" + bundle, {});
|
||||
done();
|
||||
})
|
||||
})
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
bar;
|
||||
3
test/core/fixtures/bin/babel/--ignore/options.json
Normal file
3
test/core/fixtures/bin/babel/--ignore/options.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--ignore", "src/foo/*"]
|
||||
}
|
||||
1
test/core/fixtures/bin/babel/--ignore/stdout.txt
Normal file
1
test/core/fixtures/bin/babel/--ignore/stdout.txt
Normal file
@@ -0,0 +1 @@
|
||||
src/bar/index.js -> lib/bar/index.js
|
||||
@@ -0,0 +1 @@
|
||||
bar;
|
||||
3
test/core/fixtures/bin/babel/--only/options.json
Normal file
3
test/core/fixtures/bin/babel/--only/options.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--only", "src/bar/*"]
|
||||
}
|
||||
1
test/core/fixtures/bin/babel/--only/stdout.txt
Normal file
1
test/core/fixtures/bin/babel/--only/stdout.txt
Normal file
@@ -0,0 +1 @@
|
||||
src/bar/index.js -> lib/bar/index.js
|
||||
@@ -11,17 +11,17 @@ function one() {
|
||||
one(1, 2);
|
||||
|
||||
function two() {
|
||||
var _arguments = arguments;
|
||||
var _arguments2 = arguments;
|
||||
|
||||
var inner = function inner() {
|
||||
return _arguments;
|
||||
return _arguments2;
|
||||
};
|
||||
|
||||
var another = function another() {
|
||||
var _arguments2 = arguments;
|
||||
var _arguments3 = arguments;
|
||||
|
||||
var inner2 = function inner2() {
|
||||
return _arguments2;
|
||||
return _arguments3;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -30,20 +30,20 @@ function two() {
|
||||
two(1, 2);
|
||||
|
||||
function three() {
|
||||
var _arguments = arguments;
|
||||
var _arguments4 = arguments;
|
||||
|
||||
var fn = function fn() {
|
||||
return _arguments[0] + "bar";
|
||||
return _arguments4[0] + "bar";
|
||||
};
|
||||
return fn();
|
||||
}
|
||||
three("foo");
|
||||
|
||||
function four() {
|
||||
var _arguments = arguments;
|
||||
var _arguments5 = arguments;
|
||||
|
||||
var fn = function fn() {
|
||||
return _arguments[0].foo + "bar";
|
||||
return _arguments5[0].foo + "bar";
|
||||
};
|
||||
return fn();
|
||||
}
|
||||
@@ -66,4 +66,4 @@ function six(obj) {
|
||||
};
|
||||
return fn();
|
||||
}
|
||||
six();
|
||||
six();
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
_loop: for (var i in nums) {
|
||||
_loop2: for (var i in nums) {
|
||||
var _ret = _loop(i);
|
||||
|
||||
switch (_ret) {
|
||||
@@ -24,7 +24,7 @@
|
||||
continue;
|
||||
|
||||
case "break":
|
||||
break _loop;
|
||||
break _loop2;
|
||||
|
||||
default:
|
||||
if (typeof _ret === "object") return _ret.v;
|
||||
|
||||
@@ -20,11 +20,11 @@ var Test = (function (_Foo) {
|
||||
babelHelpers.inherits(Test, _Foo);
|
||||
|
||||
Test.prototype.test = function test() {
|
||||
var _Foo$prototype$test, _Foo$prototype$test2;
|
||||
var _Foo$prototype$test3, _Foo$prototype$test4;
|
||||
|
||||
_Foo.prototype.test.call(this);
|
||||
(_Foo$prototype$test = _Foo.prototype.test).call.apply(_Foo$prototype$test, [this].concat(babelHelpers.slice.call(arguments)));
|
||||
(_Foo$prototype$test2 = _Foo.prototype.test).call.apply(_Foo$prototype$test2, [this, "test"].concat(babelHelpers.slice.call(arguments)));
|
||||
(_Foo$prototype$test3 = _Foo.prototype.test).call.apply(_Foo$prototype$test3, [this].concat(babelHelpers.slice.call(arguments)));
|
||||
(_Foo$prototype$test4 = _Foo.prototype.test).call.apply(_Foo$prototype$test4, [this, "test"].concat(babelHelpers.slice.call(arguments)));
|
||||
};
|
||||
|
||||
Test.foo = function foo() {
|
||||
|
||||
@@ -21,21 +21,21 @@ var Test = (function (_Foo) {
|
||||
babelHelpers.createClass(Test, [{
|
||||
key: "test",
|
||||
value: function test() {
|
||||
var _babelHelpers$get;
|
||||
var _babelHelpers$get3;
|
||||
|
||||
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this).call(this);
|
||||
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this).apply(this, arguments);
|
||||
(_babelHelpers$get = babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this)).call.apply(_babelHelpers$get, [this, "test"].concat(babelHelpers.slice.call(arguments)));
|
||||
(_babelHelpers$get3 = babelHelpers.get(Object.getPrototypeOf(Test.prototype), "test", this)).call.apply(_babelHelpers$get3, [this, "test"].concat(babelHelpers.slice.call(arguments)));
|
||||
}
|
||||
}], [{
|
||||
key: "foo",
|
||||
value: function foo() {
|
||||
var _babelHelpers$get;
|
||||
var _babelHelpers$get4;
|
||||
|
||||
babelHelpers.get(Object.getPrototypeOf(Test), "foo", this).call(this);
|
||||
babelHelpers.get(Object.getPrototypeOf(Test), "foo", this).apply(this, arguments);
|
||||
(_babelHelpers$get = babelHelpers.get(Object.getPrototypeOf(Test), "foo", this)).call.apply(_babelHelpers$get, [this, "test"].concat(babelHelpers.slice.call(arguments)));
|
||||
(_babelHelpers$get4 = babelHelpers.get(Object.getPrototypeOf(Test), "foo", this)).call.apply(_babelHelpers$get4, [this, "test"].concat(babelHelpers.slice.call(arguments)));
|
||||
}
|
||||
}]);
|
||||
return Test;
|
||||
})(Foo);
|
||||
})(Foo);
|
||||
@@ -1,4 +1,5 @@
|
||||
var z = {};
|
||||
var { ...x } = z;
|
||||
var { x, ...y } = z;
|
||||
var { [x]: x, ...y } = z;
|
||||
(function({ x, ...y }) { })
|
||||
|
||||
@@ -4,6 +4,8 @@ var z = {};
|
||||
var x = babelHelpers.objectWithoutProperties(z, []);
|
||||
var x = z.x;
|
||||
var y = babelHelpers.objectWithoutProperties(z, ["x"]);
|
||||
var x = z[x];
|
||||
var y = babelHelpers.objectWithoutProperties(z, [x]);
|
||||
|
||||
(function (_ref) {
|
||||
var x = _ref.x;
|
||||
|
||||
@@ -9,29 +9,29 @@ function somethingAdvanced(_ref) {
|
||||
var y2 = _ref$bottomRight.y;
|
||||
}
|
||||
|
||||
function unpackObject(_ref) {
|
||||
var title = _ref.title;
|
||||
var author = _ref.author;
|
||||
function unpackObject(_ref2) {
|
||||
var title = _ref2.title;
|
||||
var author = _ref2.author;
|
||||
|
||||
return title + " " + author;
|
||||
}
|
||||
|
||||
console.log(unpackObject({ title: "title", author: "author" }));
|
||||
|
||||
var unpackArray = function unpackArray(_ref, _ref3) {
|
||||
var _ref2 = babelHelpers.slicedToArray(_ref, 3);
|
||||
|
||||
var a = _ref2[0];
|
||||
var b = _ref2[1];
|
||||
var c = _ref2[2];
|
||||
|
||||
var unpackArray = function unpackArray(_ref3, _ref4) {
|
||||
var _ref32 = babelHelpers.slicedToArray(_ref3, 3);
|
||||
|
||||
var x = _ref32[0];
|
||||
var y = _ref32[1];
|
||||
var z = _ref32[2];
|
||||
var a = _ref32[0];
|
||||
var b = _ref32[1];
|
||||
var c = _ref32[2];
|
||||
|
||||
var _ref42 = babelHelpers.slicedToArray(_ref4, 3);
|
||||
|
||||
var x = _ref42[0];
|
||||
var y = _ref42[1];
|
||||
var z = _ref42[2];
|
||||
|
||||
return a + b + c;
|
||||
};
|
||||
|
||||
console.log(unpackArray(["hello", ", ", "world"], [1, 2, 3]));
|
||||
console.log(unpackArray(["hello", ", ", "world"], [1, 2, 3]));
|
||||
@@ -2,13 +2,16 @@
|
||||
|
||||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
|
||||
|
||||
module.exports = foo;
|
||||
module.exports = 42;
|
||||
module.exports = {};
|
||||
module.exports = [];
|
||||
module.exports = foo;
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = foo;
|
||||
exports["default"] = 42;
|
||||
exports["default"] = {};
|
||||
exports["default"] = [];
|
||||
exports["default"] = foo;
|
||||
|
||||
module.exports = function () {};
|
||||
exports["default"] = function () {};
|
||||
|
||||
var _default = (function () {
|
||||
var _class = function _default() {
|
||||
@@ -18,7 +21,7 @@ var _default = (function () {
|
||||
return _class;
|
||||
})();
|
||||
|
||||
module.exports = _default;
|
||||
exports["default"] = _default;
|
||||
|
||||
function foo() {}
|
||||
|
||||
@@ -26,5 +29,6 @@ var Foo = function Foo() {
|
||||
_classCallCheck(this, Foo);
|
||||
};
|
||||
|
||||
module.exports = Foo;
|
||||
module.exports = foo;
|
||||
exports["default"] = Foo;
|
||||
exports["default"] = foo;
|
||||
module.exports = exports["default"];
|
||||
@@ -1,12 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
var foo = _interopRequire(_foo);
|
||||
var _foo2 = _interopRequireWildcard(_foo);
|
||||
|
||||
var foo2 = _interopRequire(_foo);
|
||||
var _foo22 = _interopRequireWildcard(_foo);
|
||||
|
||||
foo;
|
||||
foo2;
|
||||
_foo2["default"];
|
||||
_foo22["default"];
|
||||
@@ -1,10 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
|
||||
var _foo$xyz = require("foo");
|
||||
|
||||
var foo = _interopRequire(_foo$xyz);
|
||||
var _foo$xyz2 = _interopRequireWildcard(_foo$xyz);
|
||||
|
||||
foo;
|
||||
_foo$xyz.baz;
|
||||
_foo$xyz2["default"];
|
||||
_foo$xyz.baz;
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
|
||||
|
||||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
@@ -16,7 +14,7 @@ require("./directory/foo-bar");
|
||||
|
||||
var _foo = require("foo2");
|
||||
|
||||
var foo = _interopRequire(_foo);
|
||||
var _foo2 = _interopRequireWildcard(_foo);
|
||||
|
||||
var _import = require("foo3");
|
||||
|
||||
@@ -32,4 +30,4 @@ var test = 5;
|
||||
exports.test = test;
|
||||
_bar.bar;
|
||||
_bar2.foo;
|
||||
foo;
|
||||
_foo2["default"];
|
||||
@@ -39,4 +39,4 @@ System.register([], function (_export) {
|
||||
_export("f", _export("e", d = 4));
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
@@ -4,11 +4,11 @@
|
||||
} else if (typeof exports !== "undefined" && typeof module !== "undefined") {
|
||||
factory(exports, module);
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports, module);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports, mod);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports, module) {
|
||||
"use strict";
|
||||
@@ -41,4 +41,4 @@
|
||||
|
||||
module.exports = Foo;
|
||||
module.exports = foo;
|
||||
});
|
||||
});
|
||||
@@ -4,11 +4,11 @@
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("foo"));
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports, global.foo);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports, global.foo);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports);
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports) {
|
||||
"use strict";
|
||||
@@ -23,4 +23,4 @@
|
||||
exports["default"] = foo;
|
||||
exports["default"] = foo;
|
||||
exports.bar = bar;
|
||||
});
|
||||
});
|
||||
@@ -4,11 +4,11 @@
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports);
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports) {
|
||||
"use strict";
|
||||
@@ -43,4 +43,4 @@
|
||||
};
|
||||
|
||||
exports.foo8 = foo8;
|
||||
});
|
||||
});
|
||||
@@ -4,12 +4,12 @@
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports);
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports);
|
||||
global.myCustomModuleName = mod.exports;
|
||||
}
|
||||
})(this, function (exports) {
|
||||
"use strict";
|
||||
});
|
||||
});
|
||||
@@ -4,11 +4,11 @@
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("./evens"));
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports, global.evens);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports, global.evens);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports, _evens) {
|
||||
"use strict";
|
||||
@@ -28,4 +28,4 @@
|
||||
};
|
||||
})(_evens.isEven);
|
||||
exports.isOdd = isOdd;
|
||||
});
|
||||
});
|
||||
@@ -4,11 +4,11 @@
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("foo"));
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports, global.foo);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports, global.foo);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports, _foo) {
|
||||
"use strict";
|
||||
@@ -21,4 +21,4 @@
|
||||
|
||||
_foo2;
|
||||
_foo22;
|
||||
});
|
||||
});
|
||||
@@ -4,14 +4,14 @@
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("foo"));
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports, global.foo);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports, global.foo);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
_foo;
|
||||
});
|
||||
});
|
||||
@@ -4,11 +4,11 @@
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("foo"));
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports, global.foo);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports, global.foo);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports, _foo) {
|
||||
"use strict";
|
||||
@@ -18,4 +18,4 @@
|
||||
var _foo2 = _interopRequire(_foo);
|
||||
|
||||
_foo.baz;
|
||||
});
|
||||
});
|
||||
@@ -4,11 +4,11 @@
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("foo"));
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports, global.foo);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports, global.foo);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports, _foo) {
|
||||
"use strict";
|
||||
@@ -19,4 +19,4 @@
|
||||
_foo.bar;
|
||||
_foo.bar;
|
||||
_foo.xyz;
|
||||
});
|
||||
});
|
||||
@@ -4,12 +4,12 @@
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("foo"), require("foo-bar"), require("./directory/foo-bar"));
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports, global.foo, global.fooBar, global.directoryFooBar);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports, global.foo, global.fooBar, global.directoryFooBar);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
"use strict";
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
foobar();
|
||||
@@ -0,0 +1,17 @@
|
||||
(function (global, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("MyLib", ["exports"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports);
|
||||
} else {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(mod.exports);
|
||||
global.MyLib = mod.exports;
|
||||
}
|
||||
})(this, function (exports) {
|
||||
"use strict";
|
||||
|
||||
foobar();
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"moduleId": "MyLib"
|
||||
}
|
||||
@@ -4,14 +4,14 @@
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports);
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports);
|
||||
global.es6ModulesUmdModuleNameExpected = mod.exports;
|
||||
}
|
||||
})(this, function (exports) {
|
||||
"use strict";
|
||||
|
||||
foobar();
|
||||
});
|
||||
});
|
||||
@@ -4,11 +4,11 @@
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("foo"), require("foo-bar"), require("./directory/foo-bar"));
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports, global.foo2, global.fooBar, global.directoryFooBar);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports, global.foo2, global.fooBar, global.directoryFooBar);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
"use strict";
|
||||
@@ -29,4 +29,4 @@
|
||||
|
||||
_foo.bar;
|
||||
_foo.foo;
|
||||
});
|
||||
});
|
||||
@@ -4,11 +4,11 @@
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports);
|
||||
} else {
|
||||
var module = {
|
||||
var mod = {
|
||||
exports: {}
|
||||
};
|
||||
factory(module.exports);
|
||||
global.actual = module.exports;
|
||||
factory(mod.exports);
|
||||
global.actual = mod.exports;
|
||||
}
|
||||
})(this, function (exports) {
|
||||
"use strict";
|
||||
@@ -42,4 +42,4 @@
|
||||
exports.f = d;
|
||||
|
||||
exports.f = exports.e = d = 4;
|
||||
});
|
||||
});
|
||||
@@ -9,8 +9,8 @@ var x = function x(foo) {
|
||||
};
|
||||
|
||||
var y = function y(foo) {
|
||||
for (var _len = arguments.length, bar = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
bar[_key - 1] = arguments[_key];
|
||||
for (var _len2 = arguments.length, bar = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
||||
bar[_key2 - 1] = arguments[_key2];
|
||||
}
|
||||
|
||||
var x = function z(bar) {
|
||||
@@ -19,8 +19,8 @@ var y = function y(foo) {
|
||||
};
|
||||
|
||||
var b = function b(x, y) {
|
||||
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||||
args[_key - 2] = arguments[_key];
|
||||
for (var _len3 = arguments.length, args = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
||||
args[_key3 - 2] = arguments[_key3];
|
||||
}
|
||||
|
||||
console.log(args[0]);
|
||||
@@ -29,8 +29,8 @@ var b = function b(x, y) {
|
||||
};
|
||||
|
||||
var z = function z(foo) {
|
||||
for (var _len = arguments.length, bar = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
bar[_key - 1] = arguments[_key];
|
||||
for (var _len4 = arguments.length, bar = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
||||
bar[_key4 - 1] = arguments[_key4];
|
||||
}
|
||||
|
||||
var x = function x() {
|
||||
@@ -39,18 +39,18 @@ var z = function z(foo) {
|
||||
};
|
||||
|
||||
var a = function a(foo) {
|
||||
for (var _len = arguments.length, bar = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
bar[_key - 1] = arguments[_key];
|
||||
for (var _len5 = arguments.length, bar = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
|
||||
bar[_key5 - 1] = arguments[_key5];
|
||||
}
|
||||
|
||||
return bar.join(",");
|
||||
};
|
||||
|
||||
var b = function b(foo) {
|
||||
for (var _len = arguments.length, bar = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
bar[_key - 1] = arguments[_key];
|
||||
for (var _len6 = arguments.length, bar = Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
||||
bar[_key6 - 1] = arguments[_key6];
|
||||
}
|
||||
|
||||
var join = "join";
|
||||
return bar[join];
|
||||
};
|
||||
};
|
||||
@@ -43,21 +43,21 @@
|
||||
} finally {}
|
||||
})(1000000) === "foo";
|
||||
|
||||
(function f(_x) {
|
||||
var _again = true;
|
||||
(function f(_x2) {
|
||||
var _again2 = true;
|
||||
|
||||
_function: while (_again) {
|
||||
_again = false;
|
||||
var n = _x;
|
||||
_function2: while (_again2) {
|
||||
_again2 = false;
|
||||
var n = _x2;
|
||||
|
||||
if (n <= 0) {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
try {} finally {
|
||||
_x = n - 1;
|
||||
_again = true;
|
||||
continue _function;
|
||||
_x2 = n - 1;
|
||||
_again2 = true;
|
||||
continue _function2;
|
||||
}
|
||||
}
|
||||
})(1000000) === "foo";
|
||||
@@ -0,0 +1,9 @@
|
||||
class Foo {
|
||||
static num = 0;
|
||||
static str = "foo";
|
||||
}
|
||||
|
||||
assert.equal(Foo.num, 0);
|
||||
assert.equal(Foo.num = 1, 1);
|
||||
assert.equal(Foo.str, "foo");
|
||||
assert.equal(Foo.str = "bar", "bar");
|
||||
@@ -0,0 +1,6 @@
|
||||
import foo from "foo";
|
||||
|
||||
@foo
|
||||
export default class Foo {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
var _foo2 = babelHelpers.interopRequireWildcard(_foo);
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, _Foo);
|
||||
}
|
||||
|
||||
var _Foo = Foo;
|
||||
Foo = _foo2["default"](Foo) || Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
exports["default"] = Foo;
|
||||
module.exports = exports["default"];
|
||||
@@ -12,3 +12,10 @@ var Foo2 = @bar class Foo {
|
||||
var Bar2 = @foo @bar class Bar {
|
||||
|
||||
};
|
||||
|
||||
@foo
|
||||
class Baz{
|
||||
constructor(baz) {
|
||||
this.baz = baz;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,18 +2,20 @@
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
babelHelpers.classCallCheck(this, _Foo);
|
||||
}
|
||||
|
||||
var _Foo = Foo;
|
||||
Foo = foo(Foo) || Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
var Bar = (function () {
|
||||
function Bar() {
|
||||
babelHelpers.classCallCheck(this, Bar);
|
||||
babelHelpers.classCallCheck(this, _Bar);
|
||||
}
|
||||
|
||||
var _Bar = Bar;
|
||||
Bar = foo(Bar) || Bar;
|
||||
Bar = bar(Bar) || Bar;
|
||||
return Bar;
|
||||
@@ -21,19 +23,33 @@ var Bar = (function () {
|
||||
|
||||
var Foo2 = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
babelHelpers.classCallCheck(this, _Foo2);
|
||||
}
|
||||
|
||||
var _Foo2 = Foo;
|
||||
Foo = bar(Foo) || Foo;
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
var Bar2 = (function () {
|
||||
function Bar() {
|
||||
babelHelpers.classCallCheck(this, Bar);
|
||||
babelHelpers.classCallCheck(this, _Bar2);
|
||||
}
|
||||
|
||||
var _Bar2 = Bar;
|
||||
Bar = foo(Bar) || Bar;
|
||||
Bar = bar(Bar) || Bar;
|
||||
return Bar;
|
||||
})();
|
||||
})();
|
||||
|
||||
var Baz = (function () {
|
||||
function Baz(baz) {
|
||||
babelHelpers.classCallCheck(this, _Baz);
|
||||
|
||||
this.baz = baz;
|
||||
}
|
||||
|
||||
var _Baz = Baz;
|
||||
Baz = foo(Baz) || Baz;
|
||||
return Baz;
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _foo2 = require("bar");
|
||||
|
||||
var _foo = babelHelpers.interopRequire(_foo2);
|
||||
var _foo3 = babelHelpers.interopRequireWildcard(_foo2);
|
||||
|
||||
exports.foo = _foo;
|
||||
exports.foo = _foo3["default"];
|
||||
@@ -89,7 +89,7 @@ var a: Promise<bool>[]
|
||||
var a:(...rest:Array<number>) => number
|
||||
var identity: <T>(x: T) => T
|
||||
var identity: <T>(x: T, ...y:T[]) => T
|
||||
import type foo from "bar";
|
||||
import type foo4 from "bar";
|
||||
import type { foo2, bar } from "baz";
|
||||
import type { foo as bar2 } from "baz";
|
||||
import type from "foo";
|
||||
|
||||
3
test/core/fixtures/transformation/misc/options.json
Normal file
3
test/core/fixtures/transformation/misc/options.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"externalHelpers": true
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
function foo(bar) {
|
||||
var bar = bar[0];
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
function foo(bar) {
|
||||
var bar = bar[0];
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Foo extends Bar {
|
||||
constructor (options) {
|
||||
let parentOptions = {};
|
||||
parentOptions.init = function () {
|
||||
this;
|
||||
};
|
||||
super(parentOptions);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function (_Bar) {
|
||||
function Foo(options) {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
|
||||
var parentOptions = {};
|
||||
parentOptions.init = function () {
|
||||
this;
|
||||
};
|
||||
babelHelpers.get(Object.getPrototypeOf(Foo.prototype), "constructor", this).call(this, parentOptions);
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
return Foo;
|
||||
})(Bar);
|
||||
@@ -0,0 +1,3 @@
|
||||
function test(x: string = "hi"): string {
|
||||
return x;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
function test() {
|
||||
var x = arguments[0] === undefined ? "hi" : arguments[0];
|
||||
|
||||
return x;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
function foo() {
|
||||
let input = ['a', 'b', 'c']
|
||||
let output = {}
|
||||
|
||||
for (let c of input) {
|
||||
let name = c
|
||||
output[name] = name
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
function foo() {
|
||||
var input = ['a', 'b', 'c'];
|
||||
var output = {};
|
||||
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var c = _step.value;
|
||||
|
||||
var _name = c;
|
||||
output[_name] = _name;
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator['return']) {
|
||||
_iterator['return']();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
const bug = 1;
|
||||
|
||||
function foo() {}
|
||||
|
||||
function bar() {
|
||||
var bug;
|
||||
bug = 2;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var bug = 1;
|
||||
|
||||
function foo() {}
|
||||
|
||||
function bar() {
|
||||
var bug;
|
||||
bug = 2;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
import toString from "foo";
|
||||
toString;
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var _toString = require("foo");
|
||||
|
||||
var _toString2 = babelHelpers.interopRequireWildcard(_toString);
|
||||
|
||||
_toString2["default"];
|
||||
@@ -11,9 +11,9 @@ function render(text) {
|
||||
var Foo2 = require("Foo");
|
||||
|
||||
function createComponent(text) {
|
||||
var _ref = <Foo2>{text}</Foo2>;
|
||||
var _ref2 = <Foo2>{text}</Foo2>;
|
||||
|
||||
return function render() {
|
||||
return _ref;
|
||||
return _ref2;
|
||||
};
|
||||
}
|
||||
@@ -6,8 +6,8 @@ function render() {
|
||||
return _ref;
|
||||
}
|
||||
|
||||
var _ref = <div className="foo"><input type="checkbox" checked={true} /></div>;
|
||||
var _ref2 = <div className="foo"><input type="checkbox" checked={true} /></div>;
|
||||
|
||||
function render() {
|
||||
return _ref;
|
||||
return _ref2;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user