add umd strict and amd strict module formatter, also fix bug with wrong amd module constructor - fixes #415
This commit is contained in:
8
test/fixtures/transformation/es6-modules-amd-strict/exports-default/actual.js
vendored
Normal file
8
test/fixtures/transformation/es6-modules-amd-strict/exports-default/actual.js
vendored
Normal 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 {}
|
||||
17
test/fixtures/transformation/es6-modules-amd-strict/exports-default/expected.js
vendored
Normal file
17
test/fixtures/transformation/es6-modules-amd-strict/exports-default/expected.js
vendored
Normal 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;
|
||||
});
|
||||
0
test/fixtures/transformation/es6-modules-amd-strict/exports-default/untitled
vendored
Normal file
0
test/fixtures/transformation/es6-modules-amd-strict/exports-default/untitled
vendored
Normal file
6
test/fixtures/transformation/es6-modules-amd-strict/exports-from/actual.js
vendored
Normal file
6
test/fixtures/transformation/es6-modules-amd-strict/exports-from/actual.js
vendored
Normal 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";
|
||||
27
test/fixtures/transformation/es6-modules-amd-strict/exports-from/expected.js
vendored
Normal file
27
test/fixtures/transformation/es6-modules-amd-strict/exports-from/expected.js
vendored
Normal 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;
|
||||
});
|
||||
5
test/fixtures/transformation/es6-modules-amd-strict/exports-named/actual.js
vendored
Normal file
5
test/fixtures/transformation/es6-modules-amd-strict/exports-named/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export {foo};
|
||||
export {foo, bar};
|
||||
export {foo as bar};
|
||||
export {foo as default};
|
||||
export {foo as default, bar};
|
||||
11
test/fixtures/transformation/es6-modules-amd-strict/exports-named/expected.js
vendored
Normal file
11
test/fixtures/transformation/es6-modules-amd-strict/exports-named/expected.js
vendored
Normal 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;
|
||||
});
|
||||
9
test/fixtures/transformation/es6-modules-amd-strict/exports-variable/actual.js
vendored
Normal file
9
test/fixtures/transformation/es6-modules-amd-strict/exports-variable/actual.js
vendored
Normal 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 {}
|
||||
17
test/fixtures/transformation/es6-modules-amd-strict/exports-variable/expected.js
vendored
Normal file
17
test/fixtures/transformation/es6-modules-amd-strict/exports-variable/expected.js
vendored
Normal 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;
|
||||
});
|
||||
11
test/fixtures/transformation/es6-modules-amd-strict/hoist-function-exports/actual.js
vendored
Normal file
11
test/fixtures/transformation/es6-modules-amd-strict/hoist-function-exports/actual.js
vendored
Normal 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);
|
||||
15
test/fixtures/transformation/es6-modules-amd-strict/hoist-function-exports/expected.js
vendored
Normal file
15
test/fixtures/transformation/es6-modules-amd-strict/hoist-function-exports/expected.js
vendored
Normal 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);
|
||||
});
|
||||
2
test/fixtures/transformation/es6-modules-amd-strict/imports-default/actual.js
vendored
Normal file
2
test/fixtures/transformation/es6-modules-amd-strict/imports-default/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import foo from "foo";
|
||||
import {default as foo2} from "foo";
|
||||
11
test/fixtures/transformation/es6-modules-amd-strict/imports-default/expected.js
vendored
Normal file
11
test/fixtures/transformation/es6-modules-amd-strict/imports-default/expected.js
vendored
Normal 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);
|
||||
});
|
||||
1
test/fixtures/transformation/es6-modules-amd-strict/imports-glob/actual.js
vendored
Normal file
1
test/fixtures/transformation/es6-modules-amd-strict/imports-glob/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import * as foo from "foo";
|
||||
5
test/fixtures/transformation/es6-modules-amd-strict/imports-glob/expected.js
vendored
Normal file
5
test/fixtures/transformation/es6-modules-amd-strict/imports-glob/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
define(["exports", "foo"], function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var foo = _foo;
|
||||
});
|
||||
1
test/fixtures/transformation/es6-modules-amd-strict/imports-mixing/actual.js
vendored
Normal file
1
test/fixtures/transformation/es6-modules-amd-strict/imports-mixing/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import foo, {baz as xyz} from "foo";
|
||||
11
test/fixtures/transformation/es6-modules-amd-strict/imports-mixing/expected.js
vendored
Normal file
11
test/fixtures/transformation/es6-modules-amd-strict/imports-mixing/expected.js
vendored
Normal 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;
|
||||
});
|
||||
4
test/fixtures/transformation/es6-modules-amd-strict/imports-named/actual.js
vendored
Normal file
4
test/fixtures/transformation/es6-modules-amd-strict/imports-named/actual.js
vendored
Normal 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";
|
||||
10
test/fixtures/transformation/es6-modules-amd-strict/imports-named/expected.js
vendored
Normal file
10
test/fixtures/transformation/es6-modules-amd-strict/imports-named/expected.js
vendored
Normal 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;
|
||||
});
|
||||
3
test/fixtures/transformation/es6-modules-amd-strict/imports/actual.js
vendored
Normal file
3
test/fixtures/transformation/es6-modules-amd-strict/imports/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import "foo";
|
||||
import "foo-bar";
|
||||
import "./directory/foo-bar";
|
||||
3
test/fixtures/transformation/es6-modules-amd-strict/imports/expected.js
vendored
Normal file
3
test/fixtures/transformation/es6-modules-amd-strict/imports/expected.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
"use strict";
|
||||
});
|
||||
1
test/fixtures/transformation/es6-modules-amd-strict/module-name/actual.js
vendored
Normal file
1
test/fixtures/transformation/es6-modules-amd-strict/module-name/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foobar();
|
||||
5
test/fixtures/transformation/es6-modules-amd-strict/module-name/expected.js
vendored
Normal file
5
test/fixtures/transformation/es6-modules-amd-strict/module-name/expected.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
define("es6-modules-amd-strict/module-name/expected", ["exports"], function (exports) {
|
||||
"use strict";
|
||||
|
||||
foobar();
|
||||
});
|
||||
3
test/fixtures/transformation/es6-modules-amd-strict/module-name/options.json
vendored
Normal file
3
test/fixtures/transformation/es6-modules-amd-strict/module-name/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"amdModuleIds": true
|
||||
}
|
||||
3
test/fixtures/transformation/es6-modules-amd-strict/options.json
vendored
Normal file
3
test/fixtures/transformation/es6-modules-amd-strict/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"modules": "amdStrict"
|
||||
}
|
||||
12
test/fixtures/transformation/es6-modules-amd-strict/overview/actual.js
vendored
Normal file
12
test/fixtures/transformation/es6-modules-amd-strict/overview/actual.js
vendored
Normal 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;
|
||||
17
test/fixtures/transformation/es6-modules-amd-strict/overview/expected.js
vendored
Normal file
17
test/fixtures/transformation/es6-modules-amd-strict/overview/expected.js
vendored
Normal 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;
|
||||
});
|
||||
9
test/fixtures/transformation/es6-modules-amd-strict/remap/actual.js
vendored
Normal file
9
test/fixtures/transformation/es6-modules-amd-strict/remap/actual.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export var test = 2;
|
||||
test = 5;
|
||||
test++;
|
||||
|
||||
(function () {
|
||||
var test = 2;
|
||||
test = 3;
|
||||
test++;
|
||||
})();
|
||||
13
test/fixtures/transformation/es6-modules-amd-strict/remap/expected.js
vendored
Normal file
13
test/fixtures/transformation/es6-modules-amd-strict/remap/expected.js
vendored
Normal 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++;
|
||||
})();
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
8
test/fixtures/transformation/es6-modules-umd-strict/exports-default/actual.js
vendored
Normal file
8
test/fixtures/transformation/es6-modules-umd-strict/exports-default/actual.js
vendored
Normal 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 {}
|
||||
23
test/fixtures/transformation/es6-modules-umd-strict/exports-default/expected.js
vendored
Normal file
23
test/fixtures/transformation/es6-modules-umd-strict/exports-default/expected.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(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;
|
||||
});
|
||||
0
test/fixtures/transformation/es6-modules-umd-strict/exports-default/untitled
vendored
Normal file
0
test/fixtures/transformation/es6-modules-umd-strict/exports-default/untitled
vendored
Normal file
6
test/fixtures/transformation/es6-modules-umd-strict/exports-from/actual.js
vendored
Normal file
6
test/fixtures/transformation/es6-modules-umd-strict/exports-from/actual.js
vendored
Normal 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";
|
||||
33
test/fixtures/transformation/es6-modules-umd-strict/exports-from/expected.js
vendored
Normal file
33
test/fixtures/transformation/es6-modules-umd-strict/exports-from/expected.js
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("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;
|
||||
});
|
||||
5
test/fixtures/transformation/es6-modules-umd-strict/exports-named/actual.js
vendored
Normal file
5
test/fixtures/transformation/es6-modules-umd-strict/exports-named/actual.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export {foo};
|
||||
export {foo, bar};
|
||||
export {foo as bar};
|
||||
export {foo as default};
|
||||
export {foo as default, bar};
|
||||
17
test/fixtures/transformation/es6-modules-umd-strict/exports-named/expected.js
vendored
Normal file
17
test/fixtures/transformation/es6-modules-umd-strict/exports-named/expected.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(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;
|
||||
});
|
||||
9
test/fixtures/transformation/es6-modules-umd-strict/exports-variable/actual.js
vendored
Normal file
9
test/fixtures/transformation/es6-modules-umd-strict/exports-variable/actual.js
vendored
Normal 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 {}
|
||||
23
test/fixtures/transformation/es6-modules-umd-strict/exports-variable/expected.js
vendored
Normal file
23
test/fixtures/transformation/es6-modules-umd-strict/exports-variable/expected.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(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;
|
||||
});
|
||||
11
test/fixtures/transformation/es6-modules-umd-strict/hoist-function-exports/actual.js
vendored
Normal file
11
test/fixtures/transformation/es6-modules-umd-strict/hoist-function-exports/actual.js
vendored
Normal 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);
|
||||
21
test/fixtures/transformation/es6-modules-umd-strict/hoist-function-exports/expected.js
vendored
Normal file
21
test/fixtures/transformation/es6-modules-umd-strict/hoist-function-exports/expected.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "./evens"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("./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);
|
||||
});
|
||||
2
test/fixtures/transformation/es6-modules-umd-strict/imports-default/actual.js
vendored
Normal file
2
test/fixtures/transformation/es6-modules-umd-strict/imports-default/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import foo from "foo";
|
||||
import {default as foo2} from "foo";
|
||||
17
test/fixtures/transformation/es6-modules-umd-strict/imports-default/expected.js
vendored
Normal file
17
test/fixtures/transformation/es6-modules-umd-strict/imports-default/expected.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("foo"));
|
||||
}
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var foo = _interopRequire(_foo);
|
||||
|
||||
var foo2 = _interopRequire(_foo);
|
||||
});
|
||||
1
test/fixtures/transformation/es6-modules-umd-strict/imports-glob/actual.js
vendored
Normal file
1
test/fixtures/transformation/es6-modules-umd-strict/imports-glob/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import * as foo from "foo";
|
||||
11
test/fixtures/transformation/es6-modules-umd-strict/imports-glob/expected.js
vendored
Normal file
11
test/fixtures/transformation/es6-modules-umd-strict/imports-glob/expected.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("foo"));
|
||||
}
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var foo = _foo;
|
||||
});
|
||||
1
test/fixtures/transformation/es6-modules-umd-strict/imports-mixing/actual.js
vendored
Normal file
1
test/fixtures/transformation/es6-modules-umd-strict/imports-mixing/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import foo, {baz as xyz} from "foo";
|
||||
17
test/fixtures/transformation/es6-modules-umd-strict/imports-mixing/expected.js
vendored
Normal file
17
test/fixtures/transformation/es6-modules-umd-strict/imports-mixing/expected.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("foo"));
|
||||
}
|
||||
})(function (exports, _foo) {
|
||||
"use strict";
|
||||
|
||||
var _interopRequire = function (obj) {
|
||||
return obj && (obj["default"] || obj);
|
||||
};
|
||||
|
||||
var foo = _interopRequire(_foo);
|
||||
|
||||
var xyz = _foo.baz;
|
||||
});
|
||||
4
test/fixtures/transformation/es6-modules-umd-strict/imports-named/actual.js
vendored
Normal file
4
test/fixtures/transformation/es6-modules-umd-strict/imports-named/actual.js
vendored
Normal 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";
|
||||
16
test/fixtures/transformation/es6-modules-umd-strict/imports-named/expected.js
vendored
Normal file
16
test/fixtures/transformation/es6-modules-umd-strict/imports-named/expected.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("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;
|
||||
});
|
||||
3
test/fixtures/transformation/es6-modules-umd-strict/imports/actual.js
vendored
Normal file
3
test/fixtures/transformation/es6-modules-umd-strict/imports/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import "foo";
|
||||
import "foo-bar";
|
||||
import "./directory/foo-bar";
|
||||
9
test/fixtures/transformation/es6-modules-umd-strict/imports/expected.js
vendored
Normal file
9
test/fixtures/transformation/es6-modules-umd-strict/imports/expected.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("foo"), require("foo-bar"), require("./directory/foo-bar"));
|
||||
}
|
||||
})(function (exports, _foo, _fooBar, _directoryFooBar) {
|
||||
"use strict";
|
||||
});
|
||||
1
test/fixtures/transformation/es6-modules-umd-strict/module-name/actual.js
vendored
Normal file
1
test/fixtures/transformation/es6-modules-umd-strict/module-name/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foobar();
|
||||
11
test/fixtures/transformation/es6-modules-umd-strict/module-name/expected.js
vendored
Normal file
11
test/fixtures/transformation/es6-modules-umd-strict/module-name/expected.js
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("es6-modules-umd-strict/module-name/expected", ["exports"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports);
|
||||
}
|
||||
})(function (exports) {
|
||||
"use strict";
|
||||
|
||||
foobar();
|
||||
});
|
||||
3
test/fixtures/transformation/es6-modules-umd-strict/module-name/options.json
vendored
Normal file
3
test/fixtures/transformation/es6-modules-umd-strict/module-name/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"amdModuleIds": true
|
||||
}
|
||||
3
test/fixtures/transformation/es6-modules-umd-strict/options.json
vendored
Normal file
3
test/fixtures/transformation/es6-modules-umd-strict/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"modules": "umdStrict"
|
||||
}
|
||||
12
test/fixtures/transformation/es6-modules-umd-strict/overview/actual.js
vendored
Normal file
12
test/fixtures/transformation/es6-modules-umd-strict/overview/actual.js
vendored
Normal 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;
|
||||
23
test/fixtures/transformation/es6-modules-umd-strict/overview/expected.js
vendored
Normal file
23
test/fixtures/transformation/es6-modules-umd-strict/overview/expected.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(exports, require("foo"), require("foo-bar"), require("./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;
|
||||
});
|
||||
9
test/fixtures/transformation/es6-modules-umd-strict/remap/actual.js
vendored
Normal file
9
test/fixtures/transformation/es6-modules-umd-strict/remap/actual.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export var test = 2;
|
||||
test = 5;
|
||||
test++;
|
||||
|
||||
(function () {
|
||||
var test = 2;
|
||||
test = 3;
|
||||
test++;
|
||||
})();
|
||||
19
test/fixtures/transformation/es6-modules-umd-strict/remap/expected.js
vendored
Normal file
19
test/fixtures/transformation/es6-modules-umd-strict/remap/expected.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(["exports"], factory);
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(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++;
|
||||
})();
|
||||
});
|
||||
@@ -7,6 +7,17 @@
|
||||
})(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);
|
||||
};
|
||||
@@ -19,5 +30,6 @@
|
||||
exports.test = test;
|
||||
var test2 = exports.test2 = 5;
|
||||
|
||||
module.exports = test;
|
||||
exports["default"] = test;
|
||||
module.exports = _extends(exports["default"], exports);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user