diff --git a/src/Declaration.js b/src/Declaration.js index b550cec..021d0bf 100644 --- a/src/Declaration.js +++ b/src/Declaration.js @@ -79,7 +79,7 @@ export class SyntheticNamespaceDeclaration { const members = keys( this.originals ).map( name => { const original = this.originals[ name ]; - if ( original.isReassigned ) { + if ( original.isReassigned && !legacy ) { return `${indentString}get ${name} () { return ${original.getName( es )}; }`; } diff --git a/test/form/legacy-getter/_config.js b/test/form/legacy-getter/_config.js new file mode 100644 index 0000000..591c08e --- /dev/null +++ b/test/form/legacy-getter/_config.js @@ -0,0 +1,7 @@ +module.exports = { + description: 'Does not output getters when in legacy', + options: { + legacy: true, + moduleName: 'foo' + } +}; diff --git a/test/form/legacy-getter/_expected/amd.js b/test/form/legacy-getter/_expected/amd.js new file mode 100644 index 0000000..0dbbff2 --- /dev/null +++ b/test/form/legacy-getter/_expected/amd.js @@ -0,0 +1,25 @@ +define(['exports'], function (exports) { 'use strict'; + + var browserSpecificThing; + + if ('ActiveXObject' in window) { + browserSpecificThing = "InternetExplorerThing"; + } else { + browserSpecificThing = "DecentBrowserThing"; + } + + function foo() {} + + + var browserStuff = (Object.freeze || Object)({ + browserSpecificThing: browserSpecificThing, + foo: foo + }); + + console.log(browserSpecificThing); + + exports.B = browserStuff; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}); diff --git a/test/form/legacy-getter/_expected/cjs.js b/test/form/legacy-getter/_expected/cjs.js new file mode 100644 index 0000000..3a59cff --- /dev/null +++ b/test/form/legacy-getter/_expected/cjs.js @@ -0,0 +1,23 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var browserSpecificThing; + +if ('ActiveXObject' in window) { + browserSpecificThing = "InternetExplorerThing"; +} else { + browserSpecificThing = "DecentBrowserThing"; +} + +function foo() {} + + +var browserStuff = (Object.freeze || Object)({ + browserSpecificThing: browserSpecificThing, + foo: foo +}); + +console.log(browserSpecificThing); + +exports.B = browserStuff; diff --git a/test/form/legacy-getter/_expected/es.js b/test/form/legacy-getter/_expected/es.js new file mode 100644 index 0000000..f2c9a6a --- /dev/null +++ b/test/form/legacy-getter/_expected/es.js @@ -0,0 +1,19 @@ +var browserSpecificThing; + +if ('ActiveXObject' in window) { + browserSpecificThing = "InternetExplorerThing"; +} else { + browserSpecificThing = "DecentBrowserThing"; +} + +function foo() {} + + +var browserStuff = (Object.freeze || Object)({ + browserSpecificThing: browserSpecificThing, + foo: foo +}); + +console.log(browserSpecificThing); + +export { browserStuff as B }; diff --git a/test/form/legacy-getter/_expected/iife.js b/test/form/legacy-getter/_expected/iife.js new file mode 100644 index 0000000..a588fbb --- /dev/null +++ b/test/form/legacy-getter/_expected/iife.js @@ -0,0 +1,24 @@ +(function (exports) { + 'use strict'; + + var browserSpecificThing; + + if ('ActiveXObject' in window) { + browserSpecificThing = "InternetExplorerThing"; + } else { + browserSpecificThing = "DecentBrowserThing"; + } + + function foo() {} + + + var browserStuff = (Object.freeze || Object)({ + browserSpecificThing: browserSpecificThing, + foo: foo + }); + + console.log(browserSpecificThing); + + exports.B = browserStuff; + +}((this.foo = this.foo || {}))); diff --git a/test/form/legacy-getter/_expected/umd.js b/test/form/legacy-getter/_expected/umd.js new file mode 100644 index 0000000..c53a23c --- /dev/null +++ b/test/form/legacy-getter/_expected/umd.js @@ -0,0 +1,29 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.foo = global.foo || {}))); +}(this, (function (exports) { 'use strict'; + + var browserSpecificThing; + + if ('ActiveXObject' in window) { + browserSpecificThing = "InternetExplorerThing"; + } else { + browserSpecificThing = "DecentBrowserThing"; + } + + function foo() {} + + + var browserStuff = (Object.freeze || Object)({ + browserSpecificThing: browserSpecificThing, + foo: foo + }); + + console.log(browserSpecificThing); + + exports.B = browserStuff; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/test/form/legacy-getter/browserStuff.js b/test/form/legacy-getter/browserStuff.js new file mode 100644 index 0000000..9f3d71c --- /dev/null +++ b/test/form/legacy-getter/browserStuff.js @@ -0,0 +1,9 @@ +export var browserSpecificThing; + +if ('ActiveXObject' in window) { + browserSpecificThing = "InternetExplorerThing"; +} else { + browserSpecificThing = "DecentBrowserThing"; +} + +export function foo() {} diff --git a/test/form/legacy-getter/main.js b/test/form/legacy-getter/main.js new file mode 100644 index 0000000..2791550 --- /dev/null +++ b/test/form/legacy-getter/main.js @@ -0,0 +1,4 @@ +import * as B from './browserStuff'; +export {B}; + +console.log(B.browserSpecificThing);