Browse Source

Merge pull request #1069 from IvanSanchez/no-legacy-getter

Do not output getter defs when in legacy mode
legacy-quote-reserved-properties
Rich Harris 8 years ago
committed by GitHub
parent
commit
07eb86c56a
  1. 2
      src/Declaration.js
  2. 7
      test/form/legacy-getter/_config.js
  3. 25
      test/form/legacy-getter/_expected/amd.js
  4. 23
      test/form/legacy-getter/_expected/cjs.js
  5. 19
      test/form/legacy-getter/_expected/es.js
  6. 24
      test/form/legacy-getter/_expected/iife.js
  7. 29
      test/form/legacy-getter/_expected/umd.js
  8. 9
      test/form/legacy-getter/browserStuff.js
  9. 4
      test/form/legacy-getter/main.js

2
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 )}; }`;
}

7
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'
}
};

25
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 });
});

23
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;

19
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 };

24
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 || {})));

29
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 });
})));

9
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() {}

4
test/form/legacy-getter/main.js

@ -0,0 +1,4 @@
import * as B from './browserStuff';
export {B};
console.log(B.browserSpecificThing);
Loading…
Cancel
Save