diff --git a/package.json b/package.json index 7fb8a19..db12e6c 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "eslint": "^1.7.1", "estree-walker": "^0.2.0", "istanbul": "^0.4.0", - "magic-string": "^0.8.0", + "magic-string": "^0.10.0", "mocha": "^2.3.3", "remap-istanbul": "^0.4.0", "rollup": "^0.20.2", diff --git a/src/finalisers/iife.js b/src/finalisers/iife.js index 9236821..7c1c5d0 100644 --- a/src/finalisers/iife.js +++ b/src/finalisers/iife.js @@ -3,8 +3,22 @@ import { getName } from '../utils/map-helpers.js'; import getInteropBlock from './shared/getInteropBlock.js'; import getExportBlock from './shared/getExportBlock.js'; +function setupNamespace ( keypath ) { + let parts = keypath.split( '.' ); // TODO support e.g. `foo['something-hyphenated']`? + + parts.pop(); + + let acc = 'this'; + + return parts + .map( part => ( acc += `.${part}`, `${acc} = ${acc} || {};` ) ) + .join( '\n' ) + '\n'; +} + export default function iife ( bundle, magicString, { exportMode, indentString }, options ) { const globalNames = options.globals || blank(); + const name = options.moduleName; + const isNamespaced = name && ~name.indexOf( '.' ); let dependencies = bundle.externalModules.map( module => { return globalNames[ module.id ] || module.name; @@ -12,12 +26,12 @@ export default function iife ( bundle, magicString, { exportMode, indentString } let args = bundle.externalModules.map( getName ); - if ( exportMode !== 'none' && !options.moduleName ) { + if ( exportMode !== 'none' && !name ) { throw new Error( 'You must supply options.moduleName for IIFE bundles' ); } if ( exportMode === 'named' ) { - dependencies.unshift( `(this.${options.moduleName} = {})` ); + dependencies.unshift( `(this.${name} = {})` ); args.unshift( 'exports' ); } @@ -26,7 +40,11 @@ export default function iife ( bundle, magicString, { exportMode, indentString } let outro = `\n\n})(${dependencies});`; if ( exportMode === 'default' ) { - intro = `var ${options.moduleName} = ${intro}`; + intro = ( isNamespaced ? `this.` : `var ` ) + `${name} = ${intro}`; + } + + if ( isNamespaced ) { + intro = setupNamespace( name ) + intro; } // var foo__default = 'default' in foo ? foo['default'] : foo; diff --git a/src/finalisers/umd.js b/src/finalisers/umd.js index 85fba7b..fd296e7 100644 --- a/src/finalisers/umd.js +++ b/src/finalisers/umd.js @@ -3,6 +3,17 @@ import { getName, quoteId, req } from '../utils/map-helpers.js'; import getInteropBlock from './shared/getInteropBlock.js'; import getExportBlock from './shared/getExportBlock.js'; +function setupNamespace ( name ) { + const parts = name.split( '.' ); + parts.pop(); + + let acc = 'global'; + return parts + .map( part => ( acc += `.${part}`, `${acc} = ${acc} || {}` ) ) + .concat( `global.${name}` ) + .join( ', ' ); +} + export default function umd ( bundle, magicString, { exportMode, indentString }, options ) { if ( exportMode !== 'none' && !options.moduleName ) { throw new Error( 'You must supply options.moduleName for UMD bundles' ); @@ -21,7 +32,7 @@ export default function umd ( bundle, magicString, { exportMode, indentString }, if ( exportMode === 'named' ) { amdDeps.unshift( `'exports'` ); cjsDeps.unshift( `exports` ); - globalDeps.unshift( `(global.${options.moduleName} = {})` ); + globalDeps.unshift( `(${setupNamespace(options.moduleName)} = {})` ); args.unshift( 'exports' ); } @@ -31,7 +42,7 @@ export default function umd ( bundle, magicString, { exportMode, indentString }, ( amdDeps.length ? `[${amdDeps.join( ', ' )}], ` : `` ); const cjsExport = exportMode === 'default' ? `module.exports = ` : ``; - const defaultExport = exportMode === 'default' ? `global.${options.moduleName} = ` : ''; + const defaultExport = exportMode === 'default' ? `${setupNamespace(options.moduleName)} = ` : ''; const useStrict = options.useStrict !== false ? ` 'use strict';` : ``; diff --git a/test/form/namespaced-default-exports/_config.js b/test/form/namespaced-default-exports/_config.js new file mode 100644 index 0000000..e45824d --- /dev/null +++ b/test/form/namespaced-default-exports/_config.js @@ -0,0 +1,6 @@ +module.exports = { + description: 'creates namespaced module names', + options: { + moduleName: 'foo.bar.baz' + } +}; diff --git a/test/form/namespaced-default-exports/_expected/amd.js b/test/form/namespaced-default-exports/_expected/amd.js new file mode 100644 index 0000000..70cc3c4 --- /dev/null +++ b/test/form/namespaced-default-exports/_expected/amd.js @@ -0,0 +1,7 @@ +define(function () { 'use strict'; + + var main = 42; + + return main; + +}); \ No newline at end of file diff --git a/test/form/namespaced-default-exports/_expected/cjs.js b/test/form/namespaced-default-exports/_expected/cjs.js new file mode 100644 index 0000000..cc51dcb --- /dev/null +++ b/test/form/namespaced-default-exports/_expected/cjs.js @@ -0,0 +1,5 @@ +'use strict'; + +var main = 42; + +module.exports = main; \ No newline at end of file diff --git a/test/form/namespaced-default-exports/_expected/es6.js b/test/form/namespaced-default-exports/_expected/es6.js new file mode 100644 index 0000000..b953a15 --- /dev/null +++ b/test/form/namespaced-default-exports/_expected/es6.js @@ -0,0 +1,3 @@ +var main = 42; + +export default main; \ No newline at end of file diff --git a/test/form/namespaced-default-exports/_expected/iife.js b/test/form/namespaced-default-exports/_expected/iife.js new file mode 100644 index 0000000..1869f2d --- /dev/null +++ b/test/form/namespaced-default-exports/_expected/iife.js @@ -0,0 +1,9 @@ +this.foo = this.foo || {}; +this.foo.bar = this.foo.bar || {}; +this.foo.bar.baz = (function () { 'use strict'; + + var main = 42; + + return main; + +})(); diff --git a/test/form/namespaced-default-exports/_expected/umd.js b/test/form/namespaced-default-exports/_expected/umd.js new file mode 100644 index 0000000..5d69d93 --- /dev/null +++ b/test/form/namespaced-default-exports/_expected/umd.js @@ -0,0 +1,11 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + global.foo = global.foo || {}, global.foo.bar = global.foo.bar || {}, global.foo.bar.baz = factory(); +}(this, function () { 'use strict'; + + var main = 42; + + return main; + +})); diff --git a/test/form/namespaced-default-exports/main.js b/test/form/namespaced-default-exports/main.js new file mode 100644 index 0000000..7a4e8a7 --- /dev/null +++ b/test/form/namespaced-default-exports/main.js @@ -0,0 +1 @@ +export default 42; diff --git a/test/form/namespaced-named-exports/_config.js b/test/form/namespaced-named-exports/_config.js new file mode 100644 index 0000000..e45824d --- /dev/null +++ b/test/form/namespaced-named-exports/_config.js @@ -0,0 +1,6 @@ +module.exports = { + description: 'creates namespaced module names', + options: { + moduleName: 'foo.bar.baz' + } +}; diff --git a/test/form/namespaced-named-exports/_expected/amd.js b/test/form/namespaced-named-exports/_expected/amd.js new file mode 100644 index 0000000..21429fd --- /dev/null +++ b/test/form/namespaced-named-exports/_expected/amd.js @@ -0,0 +1,7 @@ +define(['exports'], function (exports) { 'use strict'; + + var answer = 42; + + exports.answer = answer; + +}); \ No newline at end of file diff --git a/test/form/namespaced-named-exports/_expected/cjs.js b/test/form/namespaced-named-exports/_expected/cjs.js new file mode 100644 index 0000000..4b8935f --- /dev/null +++ b/test/form/namespaced-named-exports/_expected/cjs.js @@ -0,0 +1,5 @@ +'use strict'; + +var answer = 42; + +exports.answer = answer; \ No newline at end of file diff --git a/test/form/namespaced-named-exports/_expected/es6.js b/test/form/namespaced-named-exports/_expected/es6.js new file mode 100644 index 0000000..e590d7b --- /dev/null +++ b/test/form/namespaced-named-exports/_expected/es6.js @@ -0,0 +1,3 @@ +var answer = 42; + +export { answer }; \ No newline at end of file diff --git a/test/form/namespaced-named-exports/_expected/iife.js b/test/form/namespaced-named-exports/_expected/iife.js new file mode 100644 index 0000000..74e1d58 --- /dev/null +++ b/test/form/namespaced-named-exports/_expected/iife.js @@ -0,0 +1,9 @@ +this.foo = this.foo || {}; +this.foo.bar = this.foo.bar || {}; +(function (exports) { 'use strict'; + + var answer = 42; + + exports.answer = answer; + +})((this.foo.bar.baz = {})); diff --git a/test/form/namespaced-named-exports/_expected/umd.js b/test/form/namespaced-named-exports/_expected/umd.js new file mode 100644 index 0000000..81a3688 --- /dev/null +++ b/test/form/namespaced-named-exports/_expected/umd.js @@ -0,0 +1,11 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + factory((global.foo = global.foo || {}, global.foo.bar = global.foo.bar || {}, global.foo.bar.baz = {})); +}(this, function (exports) { 'use strict'; + + var answer = 42; + + exports.answer = answer; + +})); diff --git a/test/form/namespaced-named-exports/main.js b/test/form/namespaced-named-exports/main.js new file mode 100644 index 0000000..96100ae --- /dev/null +++ b/test/form/namespaced-named-exports/main.js @@ -0,0 +1 @@ +export var answer = 42; diff --git a/test/form/sourcemaps-inline/_expected/amd.js b/test/form/sourcemaps-inline/_expected/amd.js index e6aaf48..8e5165c 100644 --- a/test/form/sourcemaps-inline/_expected/amd.js +++ b/test/form/sourcemaps-inline/_expected/amd.js @@ -14,4 +14,4 @@ define(function () { 'use strict'; bar(); }); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW1kLmpzIiwic291cmNlcyI6WyIuLi9mb28uanMiLCIuLi9iYXIuanMiLCIuLi9tYWluLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGZvbyAoKSB7XG5cdGNvbnNvbGUubG9nKCAnaGVsbG8gZnJvbSBmb28uanMnICk7XG59XG4iLCJleHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBiYXIgKCkge1xuXHRjb25zb2xlLmxvZyggJ2hlbGxvIGZyb20gYmFyLmpzJyApO1xufVxuIiwiaW1wb3J0IGZvbyBmcm9tICcuL2Zvbyc7XG5pbXBvcnQgYmFyIGZyb20gJy4vYmFyJztcblxuY29uc29sZS5sb2coICdoZWxsbyBmcm9tIG1haW4uanMnICk7XG5cbmZvbygpO1xuYmFyKCk7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Q0FBZSxTQUFTLEdBQUcsSUFBSTtFQUM5QixPQUFPLENBQUMsR0FBRyxFQUFFLG1CQUFtQixFQUFFOzs7Q0NEcEIsU0FBUyxHQUFHLElBQUk7RUFDOUIsT0FBTyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsRUFBRTs7O0NDRW5DLE9BQU8sQ0FBQyxHQUFHLEVBQUUsb0JBQW9CLEVBQUU7O0NBRW5DLEdBQUcsRUFBRTtDQUNMLEdBQUcsRUFBRSw7OyJ9 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW1kLmpzIiwic291cmNlcyI6WyIuLi9mb28uanMiLCIuLi9iYXIuanMiLCIuLi9tYWluLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGZvbyAoKSB7XG5cdGNvbnNvbGUubG9nKCAnaGVsbG8gZnJvbSBmb28uanMnICk7XG59XG4iLCJleHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBiYXIgKCkge1xuXHRjb25zb2xlLmxvZyggJ2hlbGxvIGZyb20gYmFyLmpzJyApO1xufVxuIiwiaW1wb3J0IGZvbyBmcm9tICcuL2Zvbyc7XG5pbXBvcnQgYmFyIGZyb20gJy4vYmFyJztcblxuY29uc29sZS5sb2coICdoZWxsbyBmcm9tIG1haW4uanMnICk7XG5cbmZvbygpO1xuYmFyKCk7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Q0FBZSxTQUFTLEdBQUcsSUFBSTtBQUMvQixDQUFBLENBQUMsT0FBTyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsRUFBRSxDQUFDO0FBQ3BDLENBQUEsQ0FBQzs7Q0NGYyxTQUFTLEdBQUcsSUFBSTtBQUMvQixDQUFBLENBQUMsT0FBTyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsRUFBRSxDQUFDO0FBQ3BDLENBQUEsQ0FBQzs7Q0NDRCxPQUFPLENBQUMsR0FBRyxFQUFFLG9CQUFvQixFQUFFLENBQUM7O0FBRXBDLENBQUEsR0FBRyxFQUFFLENBQUM7QUFDTixDQUFBLEdBQUcsRUFBRSxDQUFDLDs7In0= \ No newline at end of file diff --git a/test/form/sourcemaps-inline/_expected/cjs.js b/test/form/sourcemaps-inline/_expected/cjs.js index 1f995ee..353cf97 100644 --- a/test/form/sourcemaps-inline/_expected/cjs.js +++ b/test/form/sourcemaps-inline/_expected/cjs.js @@ -12,4 +12,4 @@ console.log( 'hello from main.js' ); foo(); bar(); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2pzLmpzIiwic291cmNlcyI6WyIuLi9mb28uanMiLCIuLi9iYXIuanMiLCIuLi9tYWluLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGZvbyAoKSB7XG5cdGNvbnNvbGUubG9nKCAnaGVsbG8gZnJvbSBmb28uanMnICk7XG59XG4iLCJleHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBiYXIgKCkge1xuXHRjb25zb2xlLmxvZyggJ2hlbGxvIGZyb20gYmFyLmpzJyApO1xufVxuIiwiaW1wb3J0IGZvbyBmcm9tICcuL2Zvbyc7XG5pbXBvcnQgYmFyIGZyb20gJy4vYmFyJztcblxuY29uc29sZS5sb2coICdoZWxsbyBmcm9tIG1haW4uanMnICk7XG5cbmZvbygpO1xuYmFyKCk7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBZSxTQUFTLEdBQUcsSUFBSTtDQUM5QixPQUFPLENBQUMsR0FBRyxFQUFFLG1CQUFtQixFQUFFOzs7QUNEcEIsU0FBUyxHQUFHLElBQUk7Q0FDOUIsT0FBTyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsRUFBRTs7O0FDRW5DLE9BQU8sQ0FBQyxHQUFHLEVBQUUsb0JBQW9CLEVBQUU7O0FBRW5DLEdBQUcsRUFBRTtBQUNMLEdBQUcsRUFBRSJ9 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2pzLmpzIiwic291cmNlcyI6WyIuLi9mb28uanMiLCIuLi9iYXIuanMiLCIuLi9tYWluLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGZvbyAoKSB7XG5cdGNvbnNvbGUubG9nKCAnaGVsbG8gZnJvbSBmb28uanMnICk7XG59XG4iLCJleHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBiYXIgKCkge1xuXHRjb25zb2xlLmxvZyggJ2hlbGxvIGZyb20gYmFyLmpzJyApO1xufVxuIiwiaW1wb3J0IGZvbyBmcm9tICcuL2Zvbyc7XG5pbXBvcnQgYmFyIGZyb20gJy4vYmFyJztcblxuY29uc29sZS5sb2coICdoZWxsbyBmcm9tIG1haW4uanMnICk7XG5cbmZvbygpO1xuYmFyKCk7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBZSxTQUFTLEdBQUcsSUFBSTtDQUM5QixPQUFPLENBQUMsR0FBRyxFQUFFLG1CQUFtQixFQUFFLENBQUM7Q0FDbkM7O0FDRmMsU0FBUyxHQUFHLElBQUk7Q0FDOUIsT0FBTyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsRUFBRSxDQUFDO0NBQ25DOztBQ0NELE9BQU8sQ0FBQyxHQUFHLEVBQUUsb0JBQW9CLEVBQUUsQ0FBQzs7QUFFcEMsR0FBRyxFQUFFLENBQUM7QUFDTixHQUFHLEVBQUUsQ0FBQyJ9 \ No newline at end of file diff --git a/test/form/sourcemaps-inline/_expected/es6.js b/test/form/sourcemaps-inline/_expected/es6.js index 3374dfb..c07d67a 100644 --- a/test/form/sourcemaps-inline/_expected/es6.js +++ b/test/form/sourcemaps-inline/_expected/es6.js @@ -10,4 +10,4 @@ console.log( 'hello from main.js' ); foo(); bar(); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXM2LmpzIiwic291cmNlcyI6WyIuLi9mb28uanMiLCIuLi9iYXIuanMiLCIuLi9tYWluLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGZvbyAoKSB7XG5cdGNvbnNvbGUubG9nKCAnaGVsbG8gZnJvbSBmb28uan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XSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQWUsU0FBUyxHQUFHLElBQUk7Q0FDOUIsT0FBTyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsRUFBRSxDQUFDO0NBQ25DOztBQ0ZjLFNBQVMsR0FBRyxJQUFJO0NBQzlCLE9BQU8sQ0FBQyxHQUFHLEVBQUUsbUJBQW1CLEVBQUUsQ0FBQztDQUNuQzs7QUNDRCxPQUFPLENBQUMsR0FBRyxFQUFFLG9CQUFvQixFQUFFLENBQUM7O0FBRXBDLEdBQUcsRUFBRSxDQUFDO0FBQ04sR0FBRyxFQUFFLENBQUMifQ== \ No newline at end of file diff --git a/test/form/sourcemaps-inline/_expected/iife.js b/test/form/sourcemaps-inline/_expected/iife.js index f38c6ef..c02953f 100644 --- a/test/form/sourcemaps-inline/_expected/iife.js +++ b/test/form/sourcemaps-inline/_expected/iife.js @@ -14,4 +14,4 @@ bar(); })(); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWlmZS5qcyIsInNvdXJjZXMiOlsiLi4vZm9vLmpzIiwiLi4vYmFyLmpzIiwiLi4vbWFpbi5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBmb28gKCkge1xuXHRjb25zb2xlLmxvZyggJ2hlbGxvIGZyb20gZm9vLmpzJyApO1xufVxuIiwiZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gYmFyICgpIHtcblx0Y29uc29sZS5sb2coICdoZWxsbyBmcm9tIGJhci5qcycgKTtcbn1cbiIsImltcG9ydCBmb28gZnJvbSAnLi9mb28nO1xuaW1wb3J0IGJhciBmcm9tICcuL2Jhcic7XG5cbmNvbnNvbGUubG9nKCAnaGVsbG8gZnJvbSBtYWluLmpzJyApO1xuXG5mb28oKTtcbmJhcigpO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0NBQWUsU0FBUyx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TyxDQUFDLEdBQUcsRUFBRSxvQkFBb0IsRUFBRSxDQUFDOztBQUVwQyxDQUFBLEdBQUcsRUFBRSxDQUFDO0FBQ04sQ0FBQSxHQUFHLEVBQUUsQ0FBQyw7OyJ9 \ No newline at end of file diff --git a/test/form/sourcemaps-inline/_expected/umd.js b/test/form/sourcemaps-inline/_expected/umd.js index a63cd7a..e331a57 100644 --- a/test/form/sourcemaps-inline/_expected/umd.js +++ b/test/form/sourcemaps-inline/_expected/umd.js @@ -18,4 +18,4 @@ bar(); })); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW1kLmpzIiwic291cmNlcyI6WyIuLi9mb28uanMiLCIuLi9iYXIuanMiLCIuLi9tYWluLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGZvbyAoKSB7XG5cdGNvbnNvbGUubG9nKCAnaGVsbG8gZnJvbSBmb28uanMnICk7XG59XG4iLCJleHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBiYXIgKCkge1xuXHRjb25zb2xlLmxvZyggJ2hlbGxvIGZyb20gYmFyLmpzJyApO1xufVxuIiwiaW1wb3J0IGZvbyBmcm9tICcuL2Zvbyc7XG5pbXBvcnQgYmFyIGZyb20gJy4vYmFyJztcblxuY29uc29sZS5sb2coICdoZWxsbyBmcm9tIG1haW4uanMnICk7XG5cbmZvbygpO1xuYmFyKCk7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0NBQWUsU0FBUyxHQUFHLElBQUk7RUFDOUIsT0FBTyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsRUFBRTs7O0NDRHBCLFNBQVMsR0FBRyxJQUFJO0VBQzlCLE9BQU8sQ0FBQyxHQUFHLEVBQUUsbUJBQW1CLEVBQUU7OztDQ0VuQyxPQUFPLENBQUMsR0FBRyxFQUFFLG9CQUFvQixFQUFFOztDQUVuQyxHQUFHLEVBQUU7Q0FDTCxHQUFHLEVBQUUsOzsifQ== +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidW1kLmpzIiwic291cmNlcyI6WyIuLi9mb28uanMiLCIuLi9iYXIuanMiLCIuLi9tYWluLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGZvbyAoKSB7XG5cdGNvbnNvbGUubG9nKCAnaGVsbG8gZnJvbSBmb28uanMnICk7XG59XG4iLCJleHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBiYXIgKCkge1xuXHRjb25zb2xlLmxvZyggJ2hlbGxvIGZyb20gYmFyLmpzJyApO1xufVxuIiwiaW1wb3J0IGZvbyBmcm9tICcuL2Zvbyc7XG5pbXBvcnQgYmFyIGZyb20gJy4vYmFyJztcblxuY29uc29sZS5sb2coICdoZWxsbyBmcm9tIG1haW4uanMnICk7XG5cbmZvbygpO1xuYmFyKCk7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0NBQWUsU0FBUyxHQUFHLElBQUk7QUFDL0IsQ0FBQSxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsbUJBQW1CLEVBQUUsQ0FBQztBQUNwQyxDQUFBLENBQUM7O0NDRmMsU0FBUyxHQUFHLElBQUk7QUFDL0IsQ0FBQSxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsbUJBQW1CLEVBQUUsQ0FBQztBQUNwQyxDQUFBLENBQUM7O0NDQ0QsT0FBTyxDQUFDLEdBQUcsRUFBRSxvQkFBb0IsRUFBRSxDQUFDOztBQUVwQyxDQUFBLEdBQUcsRUFBRSxDQUFDO0FBQ04sQ0FBQSxHQUFHLEVBQUUsQ0FBQyw7OyJ9 \ No newline at end of file diff --git a/test/form/sourcemaps/_expected/amd.js b/test/form/sourcemaps/_expected/amd.js index e142f3a..9bff88f 100644 --- a/test/form/sourcemaps/_expected/amd.js +++ b/test/form/sourcemaps/_expected/amd.js @@ -14,4 +14,4 @@ define(function () { 'use strict'; bar(); }); -//# sourceMappingURL=amd.js.map +//# sourceMappingURL=amd.js.map \ No newline at end of file diff --git a/test/form/sourcemaps/_expected/amd.js.map b/test/form/sourcemaps/_expected/amd.js.map index 2b2f6e2..ee23d64 100644 --- a/test/form/sourcemaps/_expected/amd.js.map +++ b/test/form/sourcemaps/_expected/amd.js.map @@ -1 +1 @@ -{"version":3,"file":"amd.js","sources":["../foo.js","../bar.js","../main.js"],"sourcesContent":["export default function foo () {\n\tconsole.log( 'hello from foo.js' );\n}\n","export default function bar () {\n\tconsole.log( 'hello from bar.js' );\n}\n","import foo from './foo';\nimport bar from './bar';\n\nconsole.log( 'hello from main.js' );\n\nfoo();\nbar();\n"],"names":[],"mappings":";;CAAe,SAAS,GAAG,IAAI;EAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE;;;CCDpB,SAAS,GAAG,IAAI;EAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE;;;CCEnC,OAAO,CAAC,GAAG,EAAE,oBAAoB,EAAE;;CAEnC,GAAG,EAAE;CACL,GAAG,EAAE,;;"} +{"version":3,"file":"amd.js","sources":["../foo.js","../bar.js","../main.js"],"sourcesContent":["export default function foo () {\n\tconsole.log( 'hello from foo.js' );\n}\n","export default function bar () {\n\tconsole.log( 'hello from bar.js' );\n}\n","import foo from './foo';\nimport bar from './bar';\n\nconsole.log( 'hello from main.js' );\n\nfoo();\nbar();\n"],"names":[],"mappings":";;CAAe,SAAS,GAAG,IAAI;AAC/B,CAAA,CAAC,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;AACpC,CAAA,CAAC;;CCFc,SAAS,GAAG,IAAI;AAC/B,CAAA,CAAC,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;AACpC,CAAA,CAAC;;CCCD,OAAO,CAAC,GAAG,EAAE,oBAAoB,EAAE,CAAC;;AAEpC,CAAA,GAAG,EAAE,CAAC;AACN,CAAA,GAAG,EAAE,CAAC,;;"} \ No newline at end of file diff --git a/test/form/sourcemaps/_expected/cjs.js b/test/form/sourcemaps/_expected/cjs.js index d0b846e..2da97d6 100644 --- a/test/form/sourcemaps/_expected/cjs.js +++ b/test/form/sourcemaps/_expected/cjs.js @@ -12,4 +12,4 @@ console.log( 'hello from main.js' ); foo(); bar(); -//# sourceMappingURL=cjs.js.map +//# sourceMappingURL=cjs.js.map \ No newline at end of file diff --git a/test/form/sourcemaps/_expected/cjs.js.map b/test/form/sourcemaps/_expected/cjs.js.map index 452d9f3..c47010a 100644 --- a/test/form/sourcemaps/_expected/cjs.js.map +++ b/test/form/sourcemaps/_expected/cjs.js.map @@ -1 +1 @@ -{"version":3,"file":"cjs.js","sources":["../foo.js","../bar.js","../main.js"],"sourcesContent":["export default function foo () {\n\tconsole.log( 'hello from foo.js' );\n}\n","export default function bar () {\n\tconsole.log( 'hello from bar.js' );\n}\n","import foo from './foo';\nimport bar from './bar';\n\nconsole.log( 'hello from main.js' );\n\nfoo();\nbar();\n"],"names":[],"mappings":";;AAAe,SAAS,GAAG,IAAI;CAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE;;;ACDpB,SAAS,GAAG,IAAI;CAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE;;;ACEnC,OAAO,CAAC,GAAG,EAAE,oBAAoB,EAAE;;AAEnC,GAAG,EAAE;AACL,GAAG,EAAE"} +{"version":3,"file":"cjs.js","sources":["../foo.js","../bar.js","../main.js"],"sourcesContent":["export default function foo () {\n\tconsole.log( 'hello from foo.js' );\n}\n","export default function bar () {\n\tconsole.log( 'hello from bar.js' );\n}\n","import foo from './foo';\nimport bar from './bar';\n\nconsole.log( 'hello from main.js' );\n\nfoo();\nbar();\n"],"names":[],"mappings":";;AAAe,SAAS,GAAG,IAAI;CAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;CACnC;;ACFc,SAAS,GAAG,IAAI;CAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;CACnC;;ACCD,OAAO,CAAC,GAAG,EAAE,oBAAoB,EAAE,CAAC;;AAEpC,GAAG,EAAE,CAAC;AACN,GAAG,EAAE,CAAC"} \ No newline at end of file diff --git a/test/form/sourcemaps/_expected/es6.js b/test/form/sourcemaps/_expected/es6.js index 02c1e2d..f1d6ef7 100644 --- a/test/form/sourcemaps/_expected/es6.js +++ b/test/form/sourcemaps/_expected/es6.js @@ -10,4 +10,4 @@ console.log( 'hello from main.js' ); foo(); bar(); -//# sourceMappingURL=es6.js.map +//# sourceMappingURL=es6.js.map \ No newline at end of file diff --git a/test/form/sourcemaps/_expected/es6.js.map b/test/form/sourcemaps/_expected/es6.js.map index 6489227..2b48a49 100644 --- a/test/form/sourcemaps/_expected/es6.js.map +++ b/test/form/sourcemaps/_expected/es6.js.map @@ -1 +1 @@ -{"version":3,"file":"es6.js","sources":["../foo.js","../bar.js","../main.js"],"sourcesContent":["export default function foo () {\n\tconsole.log( 'hello from foo.js' );\n}\n","export default function bar () {\n\tconsole.log( 'hello from bar.js' );\n}\n","import foo from './foo';\nimport bar from './bar';\n\nconsole.log( 'hello from main.js' );\n\nfoo();\nbar();\n"],"names":[],"mappings":"AAAe,SAAS,GAAG,IAAI;CAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE;;;ACDpB,SAAS,GAAG,IAAI;CAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE;;;ACEnC,OAAO,CAAC,GAAG,EAAE,oBAAoB,EAAE;;AAEnC,GAAG,EAAE;AACL,GAAG,EAAE"} +{"version":3,"file":"es6.js","sources":["../foo.js","../bar.js","../main.js"],"sourcesContent":["export default function foo () {\n\tconsole.log( 'hello from foo.js' );\n}\n","export default function bar () {\n\tconsole.log( 'hello from bar.js' );\n}\n","import foo from './foo';\nimport bar from './bar';\n\nconsole.log( 'hello from main.js' );\n\nfoo();\nbar();\n"],"names":[],"mappings":"AAAe,SAAS,GAAG,IAAI;CAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;CACnC;;ACFc,SAAS,GAAG,IAAI;CAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;CACnC;;ACCD,OAAO,CAAC,GAAG,EAAE,oBAAoB,EAAE,CAAC;;AAEpC,GAAG,EAAE,CAAC;AACN,GAAG,EAAE,CAAC"} \ No newline at end of file diff --git a/test/form/sourcemaps/_expected/iife.js b/test/form/sourcemaps/_expected/iife.js index d8004cd..683379d 100644 --- a/test/form/sourcemaps/_expected/iife.js +++ b/test/form/sourcemaps/_expected/iife.js @@ -14,4 +14,4 @@ bar(); })(); -//# sourceMappingURL=iife.js.map +//# sourceMappingURL=iife.js.map \ No newline at end of file diff --git a/test/form/sourcemaps/_expected/iife.js.map b/test/form/sourcemaps/_expected/iife.js.map index 6b91b81..bdf6170 100644 --- a/test/form/sourcemaps/_expected/iife.js.map +++ b/test/form/sourcemaps/_expected/iife.js.map @@ -1 +1 @@ -{"version":3,"file":"iife.js","sources":["../foo.js","../bar.js","../main.js"],"sourcesContent":["export default function foo () {\n\tconsole.log( 'hello from foo.js' );\n}\n","export default function bar () {\n\tconsole.log( 'hello from bar.js' );\n}\n","import foo from './foo';\nimport bar from './bar';\n\nconsole.log( 'hello from main.js' );\n\nfoo();\nbar();\n"],"names":[],"mappings":";;CAAe,SAAS,GAAG,IAAI;EAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE;;;CCDpB,SAAS,GAAG,IAAI;EAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE;;;CCEnC,OAAO,CAAC,GAAG,EAAE,oBAAoB,EAAE;;CAEnC,GAAG,EAAE;CACL,GAAG,EAAE,;;"} +{"version":3,"file":"iife.js","sources":["../foo.js","../bar.js","../main.js"],"sourcesContent":["export default function foo () {\n\tconsole.log( 'hello from foo.js' );\n}\n","export default function bar () {\n\tconsole.log( 'hello from bar.js' );\n}\n","import foo from './foo';\nimport bar from './bar';\n\nconsole.log( 'hello from main.js' );\n\nfoo();\nbar();\n"],"names":[],"mappings":";;CAAe,SAAS,GAAG,IAAI;AAC/B,CAAA,CAAC,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;AACpC,CAAA,CAAC;;CCFc,SAAS,GAAG,IAAI;AAC/B,CAAA,CAAC,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;AACpC,CAAA,CAAC;;CCCD,OAAO,CAAC,GAAG,EAAE,oBAAoB,EAAE,CAAC;;AAEpC,CAAA,GAAG,EAAE,CAAC;AACN,CAAA,GAAG,EAAE,CAAC,;;"} \ No newline at end of file diff --git a/test/form/sourcemaps/_expected/umd.js b/test/form/sourcemaps/_expected/umd.js index 21b30a3..224c196 100644 --- a/test/form/sourcemaps/_expected/umd.js +++ b/test/form/sourcemaps/_expected/umd.js @@ -18,4 +18,4 @@ bar(); })); -//# sourceMappingURL=umd.js.map +//# sourceMappingURL=umd.js.map \ No newline at end of file diff --git a/test/form/sourcemaps/_expected/umd.js.map b/test/form/sourcemaps/_expected/umd.js.map index 08e949a..aadbe17 100644 --- a/test/form/sourcemaps/_expected/umd.js.map +++ b/test/form/sourcemaps/_expected/umd.js.map @@ -1 +1 @@ -{"version":3,"file":"umd.js","sources":["../foo.js","../bar.js","../main.js"],"sourcesContent":["export default function foo () {\n\tconsole.log( 'hello from foo.js' );\n}\n","export default function bar () {\n\tconsole.log( 'hello from bar.js' );\n}\n","import foo from './foo';\nimport bar from './bar';\n\nconsole.log( 'hello from main.js' );\n\nfoo();\nbar();\n"],"names":[],"mappings":";;;;;;CAAe,SAAS,GAAG,IAAI;EAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE;;;CCDpB,SAAS,GAAG,IAAI;EAC9B,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE;;;CCEnC,OAAO,CAAC,GAAG,EAAE,oBAAoB,EAAE;;CAEnC,GAAG,EAAE;CACL,GAAG,EAAE,;;"} +{"version":3,"file":"umd.js","sources":["../foo.js","../bar.js","../main.js"],"sourcesContent":["export default function foo () {\n\tconsole.log( 'hello from foo.js' );\n}\n","export default function bar () {\n\tconsole.log( 'hello from bar.js' );\n}\n","import foo from './foo';\nimport bar from './bar';\n\nconsole.log( 'hello from main.js' );\n\nfoo();\nbar();\n"],"names":[],"mappings":";;;;;;CAAe,SAAS,GAAG,IAAI;AAC/B,CAAA,CAAC,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;AACpC,CAAA,CAAC;;CCFc,SAAS,GAAG,IAAI;AAC/B,CAAA,CAAC,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,CAAC;AACpC,CAAA,CAAC;;CCCD,OAAO,CAAC,GAAG,EAAE,oBAAoB,EAAE,CAAC;;AAEpC,CAAA,GAAG,EAAE,CAAC;AACN,CAAA,GAAG,EAAE,CAAC,;;"} \ No newline at end of file