Compare commits

..

23 Commits

Author SHA1 Message Date
Sebastian McKenzie
1776b072b0 v2.8.2 2015-01-09 00:08:42 +11:00
Sebastian McKenzie
726fad1b6c move publish-core into publish task 2015-01-09 00:06:21 +11:00
Sebastian McKenzie
23c16b0094 fix github url in no templates directory 2015-01-09 00:06:12 +11:00
Sebastian McKenzie
24f70ee4d0 add alternate core package - fixes #387 2015-01-08 23:31:03 +11:00
Sebastian McKenzie
fe9b0afd95 v2.8.1 2015-01-08 23:14:56 +11:00
Sebastian McKenzie
47695a8710 add 2.8.1 changelog 2015-01-08 23:12:36 +11:00
Sebastian McKenzie
e1c7584280 fix computed accessors on objects 2015-01-08 23:11:58 +11:00
Sebastian McKenzie
3e63e6cd4b v2.8.0 2015-01-08 22:49:23 +11:00
Sebastian McKenzie
ba643680e5 add 2.8.0 changelog 2015-01-08 22:46:16 +11:00
Sebastian McKenzie
611137c7d7 add umd strict and amd strict module formatter, also fix bug with wrong amd module constructor - fixes #415 2015-01-08 22:44:51 +11:00
Sebastian McKenzie
6240e5111f add modules common strict formatter - fixes #418 2015-01-08 22:29:24 +11:00
Sebastian McKenzie
035f667a8f update notes with additional 3.0.0 breaking change and add a reference to the export default issue 2015-01-08 13:09:59 +11:00
Sebastian McKenzie
98985dd253 Merge pull request #416 from monsanto/indent
Add --indent option to change indent width
2015-01-08 12:43:41 +11:00
Christopher Monsanto
0a207903ce Add --indent option to change indent width 2015-01-07 18:27:58 -05:00
Sebastian McKenzie
90437d262b v2.7.4 2015-01-08 01:02:39 +11:00
Sebastian McKenzie
4aba7ec192 fix generation tests and add variable kind length 2015-01-08 01:00:32 +11:00
Sebastian McKenzie
a924c9c218 fix up declarations being split up and use a new algorithm to determine whether or not we should align them 2015-01-08 00:54:01 +11:00
Sebastian McKenzie
a2ed0ea9c5 only align variable declarations if at least one declarator has an init 2015-01-08 00:44:53 +11:00
Sebastian McKenzie
c5cd729c3d add 2.7.4 changelog 2015-01-08 00:40:43 +11:00
Sebastian McKenzie
b065d43a6d add custom level to buffer getIndent 2015-01-08 00:37:46 +11:00
Sebastian McKenzie
281003c7bd properly align multi declarator var declarations - fixes #413 2015-01-08 00:37:32 +11:00
Sebastian McKenzie
6650336c64 inherit assign from declaration in destructuring - fixes #413 2015-01-08 00:37:07 +11:00
Sebastian McKenzie
f904734695 rename prettyPrint to the more descriptive prettyCall 2015-01-08 00:36:40 +11:00
142 changed files with 1052 additions and 49 deletions

1
.gitignore vendored
View File

@@ -10,3 +10,4 @@ test/tmp
/runtime.js
coverage
dist
.package.json

View File

@@ -9,3 +9,4 @@ Makefile
dist
tests.json
CHANGELOG.md
.package.json

View File

@@ -11,6 +11,23 @@
_Note: Gaps between patch versions are faulty/broken releases._
## 2.8.1
* **Bug Fix**
* Fix computed accessors on object literals.
## 2.8.0
* **New Feature**
* Add `commonStrict`, `amdStrict` and `umdStrict` module formatters that remove `module.exports` interop assignment.
* Add `--indent` option to the 6to5 CLI.
## 2.7.4
* **Polish**
* Inherit assignments from their declaration in destructuring.
* Properly align multi-declarator variable declarations.
## 2.7.3
* **Polish**

View File

@@ -6,7 +6,7 @@ MOCHA_CMD = node_modules/mocha/bin/_mocha
export NODE_ENV = test
.PHONY: clean test test-cov test-clean lint test-travis test-simple test-all test-browser publish build bootstrap
.PHONY: clean test test-cov test-clean lint test-travis test-simple test-all test-browser publish build bootstrap publish-core
build:
mkdir -p dist
@@ -85,6 +85,17 @@ publish:
git push --follow-tags
# generate
bin/generate-core-package-json >package2.json
mv package.json .package.json
mv package2.json package.json
npm publish
# restore
rm -rf package.json
mv .package.json package.json
rm -rf templates.json browser.js runtime.js browser-polyfill.js
bootstrap:

View File

@@ -1,8 +1,9 @@
# Notes
* Wildcard exports/imports wont normalise if `export default` is a non-object.
* Wildcard exports/imports wont normalise if `export default` is a non-object. See [#224](https://github.com/6to5/6to5/issues/224).
## 3.0.0 breaking changes
* Remove `allowImportExportEverywhere` option from acorn.
* Remove this shorthand from playground.
* Remove `super()` inside non-constructors - add descriptive error message.

View File

@@ -21,6 +21,7 @@ commander.option("-i, --optional [list]", "List of optional transformers to enab
commander.option("-o, --out-file [out]", "Compile all input files into a single file");
commander.option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory");
commander.option("-c, --remove-comments", "Remove comments from the compiled code", false);
commander.option("-I, --indent [width]", "Indent width [2]", 2);
commander.option("-a, --amd-module-ids", "Insert module id in AMD modules", false); // todo: remove in 3.0.0
commander.option("-m, --module-ids", "Insert module id in modules", false);
@@ -108,7 +109,12 @@ exports.opts = {
optional: commander.optional,
comments: !commander.removeComments,
runtime: commander.runtime,
modules: commander.modules
modules: commander.modules,
format: {
indent: {
style: util.repeat(parseInt(commander.indent))
}
}
};
var fn;

11
bin/generate-core-package-json Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env node
var pkg = require("../package.json");
pkg.name += "-core";
delete pkg.dependencies.chokidar;
delete pkg.optionalDependencies;
delete pkg.devDependencies;
delete pkg.preferGlobal;
delete pkg.scripts;
delete pkg.bin;
console.log(JSON.stringify(pkg, null, " "));

View File

@@ -62,7 +62,7 @@ exports.CallExpression = function (node, print) {
var separator = ",";
if (node._prettyPrint) {
if (node._prettyCall) {
separator += "\n";
this.newline();
this.indent();
@@ -74,7 +74,7 @@ exports.CallExpression = function (node, print) {
separator: separator
});
if (node._prettyPrint) {
if (node._prettyCall) {
this.newline();
this.dedent();
}

View File

@@ -1,4 +1,5 @@
var t = require("../../types");
var util = require("../../util");
var t = require("../../types");
exports.WithStatement = function (node, print) {
this.keyword("with");
@@ -157,7 +158,24 @@ exports.DebuggerStatement = function () {
exports.VariableDeclaration = function (node, print, parent) {
this.push(node.kind + " ");
print.join(node.declarations, { separator: ", " });
var inits = 0;
var noInits = 0;
for (var i in node.declarations) {
if (node.declarations[i].init) {
inits++;
} else {
noInits++;
}
}
var sep = ",";
if (inits > noInits) { // more inits than noinits
sep += "\n" + util.repeat(node.kind.length + 1);
} else {
sep += " ";
}
print.join(node.declarations, { separator: sep });
if (!t.isFor(parent)) {
this.semicolon();

View File

@@ -0,0 +1,12 @@
var util = require("../../util");
module.exports = function (Parent) {
var Constructor = function () {
this.noInteropExport = true;
Parent.apply(this, arguments);
};
util.inherits(Constructor, Parent);
return Constructor;
};

View File

@@ -0,0 +1 @@
module.exports = require("./_strict")(require("./amd"));

View File

@@ -7,8 +7,8 @@ var t = require("../../types");
var _ = require("lodash");
function AMDFormatter() {
DefaultFormatter.apply(this, arguments);
this.ids = {};
CommonFormatter.apply(this, arguments);
this.ids = {};
}
util.inherits(AMDFormatter, DefaultFormatter);
@@ -101,7 +101,7 @@ AMDFormatter.prototype.importSpecifier = function (specifier, node, nodes) {
};
AMDFormatter.prototype.exportDeclaration = function (node) {
if (node.default) {
if (node.default && !this.noInteropExport) {
this.passModuleArg = true;
}

View File

@@ -0,0 +1 @@
module.exports = require("./_strict")(require("./common"));

View File

@@ -61,7 +61,7 @@ CommonJSFormatter.prototype.importDeclaration = function (node, nodes) {
};
CommonJSFormatter.prototype.exportDeclaration = function (node, nodes) {
if (node.default && !this.exportIdentifier) {
if (node.default && !this.noInteropRequire && !this.noInteropExport) {
var declar = node.declaration;
var assign;

View File

@@ -0,0 +1 @@
module.exports = require("./_strict")(require("./umd"));

View File

@@ -38,10 +38,9 @@ UMDFormatter.prototype.transform = function (ast) {
defineArgs = defineArgs.concat(names);
defineArgs = [t.arrayExpression(defineArgs)];
// typeof exports !== "undefined" && typeof module !== "undefined"
var testExports = t.binaryExpression("!==", t.unaryExpression("typeof", t.identifier("exports"), true), t.literal("undefined")),
testModule = t.binaryExpression("!==", t.unaryExpression("typeof", t.identifier("module"), true), t.literal("undefined")),
commonTests = this.passModuleArg ? t.logicalExpression("&&", testExports, testModule) : testExports;
var testExports = util.template("test-exports");
var testModule = util.template("test-module");
var commonTests = this.passModuleArg ? t.logicalExpression("&&", testExports, testModule) : testExports;
var commonArgs = [t.identifier("exports")];
if (this.passModuleArg) commonArgs.push(t.identifier("module"));

View File

@@ -0,0 +1 @@
typeof exports !== "undefined"

View File

@@ -0,0 +1 @@
typeof module !== "undefined"

View File

@@ -31,11 +31,14 @@ transform._ensureTransformerNames = function (type, keys) {
transform.transformers = {};
transform.moduleFormatters = {
common: require("./modules/common"),
system: require("./modules/system"),
ignore: require("./modules/ignore"),
amd: require("./modules/amd"),
umd: require("./modules/umd")
commonStrict: require("./modules/common-strict"),
umdStrict: require("./modules/umd-strict"),
amdStrict: require("./modules/amd-strict"),
common: require("./modules/common"),
system: require("./modules/system"),
ignore: require("./modules/ignore"),
amd: require("./modules/amd"),
umd: require("./modules/umd")
};
_.each({
@@ -57,13 +60,12 @@ _.each({
arrowFunctions: require("./transformers/es6-arrow-functions"),
classes: require("./transformers/es6-classes"),
computedPropertyNames: require("./transformers/es6-computed-property-names"),
objectSpread: require("./transformers/es7-object-spread"),
exponentiationOperator: require("./transformers/es7-exponentiation-operator"),
spread: require("./transformers/es6-spread"),
templateLiterals: require("./transformers/es6-template-literals"),
propertyMethodAssignment: require("./transformers/es6-property-method-assignment"),
computedPropertyNames: require("./transformers/es6-computed-property-names"),
destructuring: require("./transformers/es6-destructuring"),
defaultParameters: require("./transformers/es6-default-parameters"),
forOf: require("./transformers/es6-for-of"),

View File

@@ -210,7 +210,7 @@ Class.prototype.pushMethod = function (node) {
} else {
this.hasInstanceMutators = true;
}
util.pushMutatorMap(mutatorMap, methodName, kind, node);
util.pushMutatorMap(mutatorMap, methodName, kind, node.computed, node);
}
};

View File

@@ -7,7 +7,7 @@ exports.ObjectExpression = function (node, parent, file, scope) {
var i;
for (i in node.properties) {
hasComputed = t.isProperty(node.properties[i], { computed: true });
hasComputed = t.isProperty(node.properties[i], { computed: true, kind: "init" });
if (hasComputed) break;
}
@@ -25,6 +25,8 @@ exports.ObjectExpression = function (node, parent, file, scope) {
for (i in props) {
prop = props[i];
if (prop.kind !== "init") continue;
key = prop.key;
if (!prop.computed && t.isIdentifier(key)) {
@@ -44,7 +46,7 @@ exports.ObjectExpression = function (node, parent, file, scope) {
broken = true;
}
if (!broken || t.isLiteral(t.toComputedKey(prop, prop.key), { value: "__proto__" })) {
if (prop.kind !== "init" || !broken || t.isLiteral(t.toComputedKey(prop, prop.key), { value: "__proto__" })) {
initProps.push(prop);
props[i] = null;
}

View File

@@ -300,10 +300,17 @@ exports.VariableDeclaration = function (node, parent, file, scope) {
file: file,
scope: scope
};
if (t.isPattern(pattern) && patternId) {
pushPattern(opts);
if (+i !== node.declarations.length - 1) {
// we aren't the last declarator so let's just make the
// last transformed node inherit from us
t.inherits(nodes[nodes.length - 1], declar);
}
} else {
nodes.push(buildVariableAssign(opts, declar.id, declar.init));
nodes.push(t.inherits(buildVariableAssign(opts, declar.id, declar.init), declar));
}
}

View File

@@ -53,7 +53,7 @@ exports.ObjectExpression = function (node, parent, file, scope) {
node.properties = node.properties.filter(function (prop) {
if (prop.kind === "get" || prop.kind === "set") {
hasAny = true;
util.pushMutatorMap(mutatorMap, prop.key, prop.kind, prop.value);
util.pushMutatorMap(mutatorMap, prop.key, prop.kind, prop.computed, prop.value);
return false;
} else {
return true;

View File

@@ -166,7 +166,7 @@ exports.XJSElement = {
}
if (callExpr.arguments.length >= 3) {
callExpr._prettyPrint = true;
callExpr._prettyCall = true;
}
return t.inherits(callExpr, node);

View File

@@ -65,12 +65,12 @@ exports.sourceMapToComment = function (map) {
return "//# sourceMappingURL=data:application/json;base64," + base64;
};
exports.pushMutatorMap = function (mutatorMap, key, kind, method) {
exports.pushMutatorMap = function (mutatorMap, key, kind, computed, method) {
var alias;
if (t.isIdentifier(key)) {
alias = key.name;
if (method.computed) alias = "computed:" + alias;
if (computed) alias = "computed:" + alias;
} else if (t.isLiteral(key)) {
alias = String(key.value);
} else {
@@ -86,7 +86,7 @@ exports.pushMutatorMap = function (mutatorMap, key, kind, method) {
mutatorMap[alias] = map;
map._key = key;
if (method.computed) {
if (computed) {
map._computed = true;
}
@@ -256,7 +256,7 @@ var loadTemplates = function () {
if (!fs.existsSync(templatesLoc)) {
throw new Error("no templates directory - this is most likely the " +
"result of a broken `npm publish`. Please report to " +
"https://githut.com/6to5/6to5/issues");
"https://github.com/6to5/6to5/issues");
}
_.each(fs.readdirSync(templatesLoc), function (name) {

View File

@@ -1,7 +1,7 @@
{
"name": "6to5",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "2.7.3",
"version": "2.8.2",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://github.com/6to5/6to5",
"repository": {

View File

@@ -7,4 +7,5 @@ var test = {
* Inside bracket init
*/
"b"]: "2"
}, ok = 42;
},
ok = 42;

View File

@@ -3,6 +3,7 @@ function test() {
// Leading to VariableDeclarator
// Leading to VariableDeclarator
i = 20,
// Leading to VariableDeclarator
// Leading to VariableDeclarator
j = 20;

View File

@@ -5,6 +5,7 @@ function test() {
* Leading to VariableDeclarator
*/
i = 20,
/*
* Leading to VariableDeclarator
* Leading to VariableDeclarator

View File

@@ -1,5 +1,6 @@
function* foo() {
var a = yield wat(), b = 2;
var a = yield wat(),
b = 2;
var c = yield a = b;
yield a, yield b;
yield a = b;

View File

@@ -8,6 +8,9 @@ const foo = "foo";
let foo, bar = "bar";
var foo, bar = "bar";
let foo = "foo", bar = "bar";
var foo = "foo", bar = "bar";
const foo = "foo", bar = "bar";
let foo = "foo",
bar = "bar";
var foo = "foo",
bar = "bar";
const foo = "foo",
bar = "bar";

View File

@@ -1 +1,2 @@
var { x, y } = coords, foo = "bar";
var { x, y } = coords,
foo = "bar";

View File

@@ -0,0 +1,8 @@
export default 42;
export default {};
export default [];
export default foo;
export default function () {}
export default class {}
export default function foo () {}
export default class Foo {}

View File

@@ -0,0 +1,17 @@
define(["exports"], function (exports) {
"use strict";
exports["default"] = foo;
exports["default"] = 42;
exports["default"] = {};
exports["default"] = [];
exports["default"] = foo;
exports["default"] = function () {};
exports["default"] = function () {};
function foo() {}
var Foo = function Foo() {};
exports["default"] = Foo;
});

View File

@@ -0,0 +1,6 @@
export * from "foo";
export {foo} from "foo";
export {foo, bar} from "foo";
export {foo as bar} from "foo";
export {foo as default} from "foo";
export {foo as default, bar} from "foo";

View File

@@ -0,0 +1,27 @@
define(["exports", "foo"], function (exports, _foo) {
"use strict";
var _interopRequireWildcard = function (obj) {
return obj && obj.constructor === Object ? obj : {
"default": obj
};
};
var _exportsWildcard = function (obj) {
for (var i in obj) {
if (exports[i] !== undefined) {
exports[i] = obj[i];
}
}
};
_exportsWildcard(_interopRequireWildcard(_foo));
exports.foo = _foo.foo;
exports.foo = _foo.foo;
exports.bar = _foo.bar;
exports.bar = _foo.foo;
exports["default"] = _foo.foo;
exports["default"] = _foo.foo;
exports.bar = _foo.bar;
});

View File

@@ -0,0 +1,5 @@
export {foo};
export {foo, bar};
export {foo as bar};
export {foo as default};
export {foo as default, bar};

View File

@@ -0,0 +1,11 @@
define(["exports"], function (exports) {
"use strict";
exports.foo = foo;
exports.foo = foo;
exports.bar = bar;
exports.bar = foo;
exports["default"] = foo;
exports["default"] = foo;
exports.bar = bar;
});

View File

@@ -0,0 +1,9 @@
export var foo = 1;
export var foo = 1, bar = 2;
export var foo2 = function () {};
export var foo3;
export let foo4 = 2;
export let foo5;
export const foo6 = 3;
export function foo7 () {}
export class foo8 {}

View File

@@ -0,0 +1,17 @@
define(["exports"], function (exports) {
"use strict";
exports.foo7 = foo7;
var foo = exports.foo = 1;
var foo = exports.foo = 1;
var bar = exports.bar = 2;
var foo2 = exports.foo2 = function () {};
var foo3 = exports.foo3 = undefined;
var foo4 = exports.foo4 = 2;
var foo5 = exports.foo5 = undefined;
var foo6 = exports.foo6 = 3;
function foo7() {}
var foo8 = function foo8() {};
exports.foo8 = foo8;
});

View File

@@ -0,0 +1,11 @@
import { isEven } from "./evens";
export function nextOdd(n) {
return isEven(n) ? n + 1 : n + 2;
}
export var isOdd = (function (isEven) {
return function (n) {
return !isEven(n);
};
})(isEven);

View File

@@ -0,0 +1,15 @@
define(["exports", "./evens"], function (exports, _evens) {
"use strict";
exports.nextOdd = nextOdd;
var isEven = _evens.isEven;
function nextOdd(n) {
return isEven(n) ? n + 1 : n + 2;
}
var isOdd = exports.isOdd = (function (isEven) {
return function (n) {
return !isEven(n);
};
})(isEven);
});

View File

@@ -0,0 +1,2 @@
import foo from "foo";
import {default as foo2} from "foo";

View File

@@ -0,0 +1,11 @@
define(["exports", "foo"], function (exports, _foo) {
"use strict";
var _interopRequire = function (obj) {
return obj && (obj["default"] || obj);
};
var foo = _interopRequire(_foo);
var foo2 = _interopRequire(_foo);
});

View File

@@ -0,0 +1 @@
import * as foo from "foo";

View File

@@ -0,0 +1,5 @@
define(["exports", "foo"], function (exports, _foo) {
"use strict";
var foo = _foo;
});

View File

@@ -0,0 +1 @@
import foo, {baz as xyz} from "foo";

View File

@@ -0,0 +1,11 @@
define(["exports", "foo"], function (exports, _foo) {
"use strict";
var _interopRequire = function (obj) {
return obj && (obj["default"] || obj);
};
var foo = _interopRequire(_foo);
var xyz = _foo.baz;
});

View File

@@ -0,0 +1,4 @@
import {bar} from "foo";
import {bar2, baz} from "foo";
import {bar as baz2} from "foo";
import {bar as baz3, xyz} from "foo";

View File

@@ -0,0 +1,10 @@
define(["exports", "foo"], function (exports, _foo) {
"use strict";
var bar = _foo.bar;
var bar2 = _foo.bar2;
var baz = _foo.baz;
var baz2 = _foo.bar;
var baz3 = _foo.bar;
var xyz = _foo.xyz;
});

View File

@@ -0,0 +1,3 @@
import "foo";
import "foo-bar";
import "./directory/foo-bar";

View File

@@ -0,0 +1,3 @@
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (exports, _foo, _fooBar, _directoryFooBar) {
"use strict";
});

View File

@@ -0,0 +1 @@
foobar();

View File

@@ -0,0 +1,5 @@
define("es6-modules-amd-strict/module-name/expected", ["exports"], function (exports) {
"use strict";
foobar();
});

View File

@@ -0,0 +1,3 @@
{
"amdModuleIds": true
}

View File

@@ -0,0 +1,3 @@
{
"modules": "amdStrict"
}

View File

@@ -0,0 +1,12 @@
import "foo";
import "foo-bar";
import "./directory/foo-bar";
import foo from "foo";
import * as foo2 from "foo";
import {bar} from "foo";
import {foo as bar2} from "foo";
export {test};
export var test2 = 5;
export default test;

View File

@@ -0,0 +1,17 @@
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (exports, _foo, _fooBar, _directoryFooBar) {
"use strict";
var _interopRequire = function (obj) {
return obj && (obj["default"] || obj);
};
var foo = _interopRequire(_foo);
var foo2 = _foo;
var bar = _foo.bar;
var bar2 = _foo.foo;
exports.test = test;
var test2 = exports.test2 = 5;
exports["default"] = test;
});

View File

@@ -0,0 +1,9 @@
export var test = 2;
test = 5;
test++;
(function () {
var test = 2;
test = 3;
test++;
})();

View File

@@ -0,0 +1,13 @@
define(["exports"], function (exports) {
"use strict";
var test = exports.test = 2;
test = exports.test = 5;
test = exports.test += 1;
(function () {
var test = 2;
test = 3;
test++;
})();
});

View File

@@ -1,6 +1,17 @@
define(["exports", "module", "foo", "foo-bar", "./directory/foo-bar"], function (exports, module, _foo, _fooBar, _directoryFooBar) {
"use strict";
var _extends = function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
target[key] = source[key];
}
}
return target;
};
var _interopRequire = function (obj) {
return obj && (obj["default"] || obj);
};
@@ -13,5 +24,6 @@ define(["exports", "module", "foo", "foo-bar", "./directory/foo-bar"], function
exports.test = test;
var test2 = exports.test2 = 5;
module.exports = test;
exports["default"] = test;
module.exports = _extends(exports["default"], exports);
});

View File

@@ -0,0 +1,2 @@
import { foo } from "foo";
var foo;

View File

@@ -0,0 +1,3 @@
{
"throws": "Illegal assignment of module import"
}

View File

@@ -0,0 +1,2 @@
import { foo } from "foo";
foo.bar = 1;

View File

@@ -0,0 +1,3 @@
{
"throws": "Illegal assignment of module import"
}

View File

@@ -0,0 +1,2 @@
import * as foo from "foo";
foo = 1;

View File

@@ -0,0 +1,3 @@
{
"throws": "Illegal assignment of module import"
}

View File

@@ -0,0 +1,2 @@
import * as foo from "foo";
var foo;

View File

@@ -0,0 +1,3 @@
{
"throws": "Illegal assignment of module import"
}

View File

@@ -0,0 +1,2 @@
import { foo as bar } from "foo";
var bar;

View File

@@ -0,0 +1,3 @@
{
"throws": "Illegal assignment of module import"
}

View File

@@ -0,0 +1,2 @@
import { foo as bar } from "foo";
bar = 1;

View File

@@ -0,0 +1,3 @@
{
"throws": "Illegal assignment of module import"
}

View File

@@ -0,0 +1,2 @@
import { foo } from "foo";
import { foo } from "bar";

View File

@@ -0,0 +1,3 @@
{
"throws": "Illegal assignment of module import"
}

View File

@@ -0,0 +1,2 @@
import { foo as bar } from "foo";
import { foo as bar } from "bar";

View File

@@ -0,0 +1,3 @@
{
"throws": "Illegal assignment of module import"
}

View File

@@ -0,0 +1,2 @@
import { foo } from "foo";
foo = 1;

View File

@@ -0,0 +1,3 @@
{
"throws": "Illegal assignment of module import"
}

View File

@@ -0,0 +1,3 @@
export default new Cachier()
export function Cachier(databaseName) {}

View File

@@ -0,0 +1,5 @@
"use strict";
exports.Cachier = Cachier;
exports["default"] = new Cachier();
function Cachier(databaseName) {}

View File

@@ -0,0 +1,8 @@
export default 42;
export default {};
export default [];
export default foo;
export default function () {}
export default class {}
export default function foo () {}
export default class Foo {}

View File

@@ -0,0 +1,15 @@
"use strict";
exports["default"] = foo;
exports["default"] = 42;
exports["default"] = {};
exports["default"] = [];
exports["default"] = foo;
exports["default"] = function () {};
exports["default"] = function () {};
function foo() {}
var Foo = function Foo() {};
exports["default"] = Foo;

View File

@@ -0,0 +1,6 @@
export * from "foo";
export {foo} from "foo";
export {foo, bar} from "foo";
export {foo as bar} from "foo";
export {foo as default} from "foo";
export {foo as default, bar} from "foo";

View File

@@ -0,0 +1,25 @@
"use strict";
var _interopRequireWildcard = function (obj) {
return obj && obj.constructor === Object ? obj : {
"default": obj
};
};
var _exportsWildcard = function (obj) {
for (var i in obj) {
if (exports[i] !== undefined) {
exports[i] = obj[i];
}
}
};
_exportsWildcard(_interopRequireWildcard(require("foo")));
exports.foo = require("foo").foo;
exports.foo = require("foo").foo;
exports.bar = require("foo").bar;
exports.bar = require("foo").foo;
exports["default"] = require("foo").foo;
exports["default"] = require("foo").foo;
exports.bar = require("foo").bar;

View File

@@ -0,0 +1,5 @@
export {foo};
export {foo, bar};
export {foo as bar};
export {foo as default};
export {foo as default, bar};

View File

@@ -0,0 +1,9 @@
"use strict";
exports.foo = foo;
exports.foo = foo;
exports.bar = bar;
exports.bar = foo;
exports["default"] = foo;
exports["default"] = foo;
exports.bar = bar;

View File

@@ -0,0 +1,9 @@
export var foo = 1;
export var foo = 1, bar = 2;
export var foo2 = function () {};
export var foo3;
export let foo4 = 2;
export let foo5;
export const foo6 = 3;
export function foo7 () {}
export class foo8 {}

View File

@@ -0,0 +1,15 @@
"use strict";
exports.foo7 = foo7;
var foo = exports.foo = 1;
var foo = exports.foo = 1;
var bar = exports.bar = 2;
var foo2 = exports.foo2 = function () {};
var foo3 = exports.foo3 = undefined;
var foo4 = exports.foo4 = 2;
var foo5 = exports.foo5 = undefined;
var foo6 = exports.foo6 = 3;
function foo7() {}
var foo8 = function foo8() {};
exports.foo8 = foo8;

View File

@@ -0,0 +1,11 @@
import { isEven } from "./evens";
export function nextOdd(n) {
return isEven(n) ? n + 1 : n + 2;
}
export var isOdd = (function (isEven) {
return function (n) {
return !isEven(n);
};
})(isEven);

View File

@@ -0,0 +1,13 @@
"use strict";
exports.nextOdd = nextOdd;
var isEven = require("./evens").isEven;
function nextOdd(n) {
return isEven(n) ? n + 1 : n + 2;
}
var isOdd = exports.isOdd = (function (isEven) {
return function (n) {
return !isEven(n);
};
})(isEven);

View File

@@ -0,0 +1,2 @@
import foo from "foo";
import {default as foo2} from "foo";

View File

@@ -0,0 +1,9 @@
"use strict";
var _interopRequire = function (obj) {
return obj && (obj["default"] || obj);
};
var foo = _interopRequire(require("foo"));
var foo2 = _interopRequire(require("foo"));

View File

@@ -0,0 +1 @@
import * as foo from "foo";

View File

@@ -0,0 +1,9 @@
"use strict";
var _interopRequireWildcard = function (obj) {
return obj && obj.constructor === Object ? obj : {
"default": obj
};
};
var foo = _interopRequireWildcard(require("foo"));

View File

@@ -0,0 +1 @@
import foo, {baz as xyz} from "foo";

View File

@@ -0,0 +1,9 @@
"use strict";
var _interopRequire = function (obj) {
return obj && (obj["default"] || obj);
};
var foo = _interopRequire(require("foo"));
var xyz = require("foo").baz;

View File

@@ -0,0 +1,4 @@
import {bar} from "foo";
import {bar2, baz} from "foo";
import {bar as baz2} from "foo";
import {bar as baz3, xyz} from "foo";

View File

@@ -0,0 +1,8 @@
"use strict";
var bar = require("foo").bar;
var bar2 = require("foo").bar2;
var baz = require("foo").baz;
var baz2 = require("foo").bar;
var baz3 = require("foo").bar;
var xyz = require("foo").xyz;

Some files were not shown because too many files have changed in this diff Show More