From da721822193c2e2fab4af87bd4a43e939678cc84 Mon Sep 17 00:00:00 2001 From: guybedford Date: Sun, 28 Dec 2014 14:38:52 +0200 Subject: [PATCH 1/3] make modules anonymous --- .../es6-modules-system/exports-default/expected.js | 2 +- .../transformation/es6-modules-system/exports-from/expected.js | 2 +- .../transformation/es6-modules-system/exports-named/expected.js | 2 +- .../es6-modules-system/exports-variable/expected.js | 2 +- .../es6-modules-system/hoist-function-exports/expected.js | 2 +- .../es6-modules-system/imports-default/expected.js | 2 +- .../transformation/es6-modules-system/imports-glob/expected.js | 2 +- .../es6-modules-system/imports-mixing/expected.js | 2 +- .../transformation/es6-modules-system/imports-named/expected.js | 2 +- .../transformation/es6-modules-system/imports/expected.js | 2 +- .../transformation/es6-modules-system/overview/expected.js | 2 +- .../transformation/es6-modules-system/remap/expected.js | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/fixtures/transformation/es6-modules-system/exports-default/expected.js b/test/fixtures/transformation/es6-modules-system/exports-default/expected.js index 4320d66b13..6c2b8c396e 100644 --- a/test/fixtures/transformation/es6-modules-system/exports-default/expected.js +++ b/test/fixtures/transformation/es6-modules-system/exports-default/expected.js @@ -1,4 +1,4 @@ -System.register("es6-modules-system/exports-default/expected", [], function (_export) { +System.register([], function (_export) { _export("default", foo); function foo() {} diff --git a/test/fixtures/transformation/es6-modules-system/exports-from/expected.js b/test/fixtures/transformation/es6-modules-system/exports-from/expected.js index e84f56e0c3..6c42c5ca33 100644 --- a/test/fixtures/transformation/es6-modules-system/exports-from/expected.js +++ b/test/fixtures/transformation/es6-modules-system/exports-from/expected.js @@ -1,4 +1,4 @@ -System.register("es6-modules-system/exports-from/expected", ["foo"], function (_export) { +System.register(["foo"], function (_export) { var _foo; return { setters: [function (m) { diff --git a/test/fixtures/transformation/es6-modules-system/exports-named/expected.js b/test/fixtures/transformation/es6-modules-system/exports-named/expected.js index e297af4bfe..410345bcfa 100644 --- a/test/fixtures/transformation/es6-modules-system/exports-named/expected.js +++ b/test/fixtures/transformation/es6-modules-system/exports-named/expected.js @@ -1,4 +1,4 @@ -System.register("es6-modules-system/exports-named/expected", [], function (_export) { +System.register([], function (_export) { return { setters: [], execute: function () { diff --git a/test/fixtures/transformation/es6-modules-system/exports-variable/expected.js b/test/fixtures/transformation/es6-modules-system/exports-variable/expected.js index a3f1095a16..984e2fb108 100644 --- a/test/fixtures/transformation/es6-modules-system/exports-variable/expected.js +++ b/test/fixtures/transformation/es6-modules-system/exports-variable/expected.js @@ -1,4 +1,4 @@ -System.register("es6-modules-system/exports-variable/expected", [], function (_export) { +System.register([], function (_export) { _export("foo7", foo7); function foo7() {} diff --git a/test/fixtures/transformation/es6-modules-system/hoist-function-exports/expected.js b/test/fixtures/transformation/es6-modules-system/hoist-function-exports/expected.js index de2d3946ce..c407df488a 100644 --- a/test/fixtures/transformation/es6-modules-system/hoist-function-exports/expected.js +++ b/test/fixtures/transformation/es6-modules-system/hoist-function-exports/expected.js @@ -1,4 +1,4 @@ -System.register("es6-modules-system/hoist-function-exports/expected", ["./evens"], function (_export) { +System.register(["./evens"], function (_export) { _export("nextOdd", nextOdd); function nextOdd(n) { diff --git a/test/fixtures/transformation/es6-modules-system/imports-default/expected.js b/test/fixtures/transformation/es6-modules-system/imports-default/expected.js index b94c9036b5..739bb3d898 100644 --- a/test/fixtures/transformation/es6-modules-system/imports-default/expected.js +++ b/test/fixtures/transformation/es6-modules-system/imports-default/expected.js @@ -1,4 +1,4 @@ -System.register("es6-modules-system/imports-default/expected", ["foo"], function (_export) { +System.register([], function (_export) { var _foo; return { setters: [function (m) { diff --git a/test/fixtures/transformation/es6-modules-system/imports-glob/expected.js b/test/fixtures/transformation/es6-modules-system/imports-glob/expected.js index d641fe072e..90b8ff9676 100644 --- a/test/fixtures/transformation/es6-modules-system/imports-glob/expected.js +++ b/test/fixtures/transformation/es6-modules-system/imports-glob/expected.js @@ -1,4 +1,4 @@ -System.register("es6-modules-system/imports-glob/expected", ["foo"], function (_export) { +System.register(["foo"], function (_export) { var _foo; return { setters: [function (m) { diff --git a/test/fixtures/transformation/es6-modules-system/imports-mixing/expected.js b/test/fixtures/transformation/es6-modules-system/imports-mixing/expected.js index 69e5643e12..fa48c8ee8a 100644 --- a/test/fixtures/transformation/es6-modules-system/imports-mixing/expected.js +++ b/test/fixtures/transformation/es6-modules-system/imports-mixing/expected.js @@ -1,4 +1,4 @@ -System.register("es6-modules-system/imports-mixing/expected", ["foo"], function (_export) { +System.register(["foo"], function (_export) { var _foo; return { setters: [function (m) { diff --git a/test/fixtures/transformation/es6-modules-system/imports-named/expected.js b/test/fixtures/transformation/es6-modules-system/imports-named/expected.js index cb3db1ff7a..6a0ac43741 100644 --- a/test/fixtures/transformation/es6-modules-system/imports-named/expected.js +++ b/test/fixtures/transformation/es6-modules-system/imports-named/expected.js @@ -1,4 +1,4 @@ -System.register("es6-modules-system/imports-named/expected", ["foo"], function (_export) { +System.register(["foo"], function (_export) { var _foo; return { setters: [function (m) { diff --git a/test/fixtures/transformation/es6-modules-system/imports/expected.js b/test/fixtures/transformation/es6-modules-system/imports/expected.js index 76236eb64e..97413af25b 100644 --- a/test/fixtures/transformation/es6-modules-system/imports/expected.js +++ b/test/fixtures/transformation/es6-modules-system/imports/expected.js @@ -1,4 +1,4 @@ -System.register("es6-modules-system/imports/expected", ["foo", "foo-bar", "./directory/foo-bar"], function (_export) { +System.register(["foo", "foo-bar", "./directory/foo-bar"], function (_export) { var _foo, _fooBar, _directoryFooBar; return { setters: [function (m) { diff --git a/test/fixtures/transformation/es6-modules-system/overview/expected.js b/test/fixtures/transformation/es6-modules-system/overview/expected.js index 3fa3abda80..f88db05b90 100644 --- a/test/fixtures/transformation/es6-modules-system/overview/expected.js +++ b/test/fixtures/transformation/es6-modules-system/overview/expected.js @@ -1,4 +1,4 @@ -System.register("es6-modules-system/overview/expected", ["foo", "foo-bar", "./directory/foo-bar"], function (_export) { +System.register(["foo", "foo-bar", "./directory/foo-bar"], function (_export) { var _foo, _fooBar, _directoryFooBar; return { setters: [function (m) { diff --git a/test/fixtures/transformation/es6-modules-system/remap/expected.js b/test/fixtures/transformation/es6-modules-system/remap/expected.js index 111c718241..44b7d1f1f8 100644 --- a/test/fixtures/transformation/es6-modules-system/remap/expected.js +++ b/test/fixtures/transformation/es6-modules-system/remap/expected.js @@ -1,4 +1,4 @@ -System.register("es6-modules-system/remap/expected", [], function (_export) { +System.register([], function (_export) { return { setters: [], execute: function () { From cfe05ca10d87c854a88d5edafac90c0735c15f04 Mon Sep 17 00:00:00 2001 From: guybedford Date: Sun, 28 Dec 2014 14:41:32 +0200 Subject: [PATCH 2/3] exported variable declarations hoist along with functions --- .../es6-modules-system/hoist-function-exports/actual.js | 4 +++- .../es6-modules-system/hoist-function-exports/expected.js | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/test/fixtures/transformation/es6-modules-system/hoist-function-exports/actual.js b/test/fixtures/transformation/es6-modules-system/hoist-function-exports/actual.js index 3c40b7d1c1..ea23c63431 100644 --- a/test/fixtures/transformation/es6-modules-system/hoist-function-exports/actual.js +++ b/test/fixtures/transformation/es6-modules-system/hoist-function-exports/actual.js @@ -1,9 +1,11 @@ import { isEven } from "./evens"; export function nextOdd(n) { - return isEven(n) ? n + 1 : n + 2; + return p = isEven(n) ? n + 1 : n + 2; } +export var p = 5; + export var isOdd = (function (isEven) { return function (n) { return !isEven(n); diff --git a/test/fixtures/transformation/es6-modules-system/hoist-function-exports/expected.js b/test/fixtures/transformation/es6-modules-system/hoist-function-exports/expected.js index c407df488a..e74627e56e 100644 --- a/test/fixtures/transformation/es6-modules-system/hoist-function-exports/expected.js +++ b/test/fixtures/transformation/es6-modules-system/hoist-function-exports/expected.js @@ -1,8 +1,10 @@ System.register(["./evens"], function (_export) { + var p; + _export("nextOdd", nextOdd); function nextOdd(n) { - return isEven(n) ? n + 1 : n + 2; + return _export("p", p = isEven(n) ? n + 1 : n + 2); } var _evens; @@ -14,6 +16,8 @@ System.register(["./evens"], function (_export) { "use strict"; var isEven = _evens.isEven; + _export("p", p = 5); + var isOdd = _export("isOdd", (function (isEven) { return function (n) { return !isEven(n); From 295bab544b2cb26c91c798d59ed579bba4cb2494 Mon Sep 17 00:00:00 2001 From: guybedford Date: Sun, 28 Dec 2014 14:42:43 +0200 Subject: [PATCH 3/3] re-exporting in setters --- .../es6-modules-system/exports-from/expected.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/fixtures/transformation/es6-modules-system/exports-from/expected.js b/test/fixtures/transformation/es6-modules-system/exports-from/expected.js index 6c42c5ca33..47083a27f1 100644 --- a/test/fixtures/transformation/es6-modules-system/exports-from/expected.js +++ b/test/fixtures/transformation/es6-modules-system/exports-from/expected.js @@ -3,14 +3,10 @@ System.register(["foo"], function (_export) { return { setters: [function (m) { _foo = m - }], - execute: function () { - "use strict"; for (var i in _foo) { _export(i, _foo[i]) } - _export("foo", _foo.foo); _export("foo", _foo.foo); @@ -24,6 +20,10 @@ System.register(["foo"], function (_export) { _export("default", _foo.foo); _export("bar", _foo.bar); + + }], + execute: function () { + "use strict"; } }; });