-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(transform): enhanced support of different transpilers (#19)
* chore: fixtures for collectExportsAndImports * chore: fixtures based collectExportsAndImports tests * chore: reorder expectations in collectExportsAndImports.test.ts * fix(transform): collectExportsAndImports for some old transpilers * fix(transform): collectExportsAndImports for more old transpilers * chore(fixtures-generator): do not save failed tsc builds * chore: changeset * chore: fix collectExportsAndImports tests for Windows
- Loading branch information
Showing
805 changed files
with
19,918 additions
and
831 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@wyw-in-js/transform': patch | ||
'wyw-in-js': patch | ||
--- | ||
|
||
Fixtures generator and enhanced support of different transpilers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/transform/src/__tests__/__fixtures__/collectExportsAndImports/export_class.input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export class Foo {} |
1 change: 1 addition & 0 deletions
1
.../transform/src/__tests__/__fixtures__/collectExportsAndImports/export_class/asIs.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export class Foo {} |
15 changes: 15 additions & 0 deletions
15
...es__/collectExportsAndImports/export_class/babelCommonJSWithLastCoreAndTSC-7_0_0.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { | ||
value: true, | ||
}); | ||
exports.Foo = void 0; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError('Cannot call a class as a function'); | ||
} | ||
} | ||
var Foo = function Foo() { | ||
_classCallCheck(this, Foo); | ||
}; | ||
exports.Foo = Foo; |
63 changes: 63 additions & 0 deletions
63
...s__/collectExportsAndImports/export_class/babelCommonJSWithLastCoreAndTSC-7_16_5.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict'; | ||
|
||
function _typeof(o) { | ||
'@babel/helpers - typeof'; | ||
return ( | ||
(_typeof = | ||
'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator | ||
? function (o) { | ||
return typeof o; | ||
} | ||
: function (o) { | ||
return o && | ||
'function' == typeof Symbol && | ||
o.constructor === Symbol && | ||
o !== Symbol.prototype | ||
? 'symbol' | ||
: typeof o; | ||
}), | ||
_typeof(o) | ||
); | ||
} | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true, | ||
}); | ||
exports.Foo = void 0; | ||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ('value' in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
Object.defineProperty(Constructor, 'prototype', { writable: false }); | ||
return Constructor; | ||
} | ||
function _toPropertyKey(arg) { | ||
var key = _toPrimitive(arg, 'string'); | ||
return _typeof(key) === 'symbol' ? key : String(key); | ||
} | ||
function _toPrimitive(input, hint) { | ||
if (_typeof(input) !== 'object' || input === null) return input; | ||
var prim = input[Symbol.toPrimitive]; | ||
if (prim !== undefined) { | ||
var res = prim.call(input, hint || 'default'); | ||
if (_typeof(res) !== 'object') return res; | ||
throw new TypeError('@@toPrimitive must return a primitive value.'); | ||
} | ||
return (hint === 'string' ? String : Number)(input); | ||
} | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError('Cannot call a class as a function'); | ||
} | ||
} | ||
var Foo = /*#__PURE__*/ _createClass(function Foo() { | ||
_classCallCheck(this, Foo); | ||
}); | ||
exports.Foo = Foo; |
62 changes: 62 additions & 0 deletions
62
...s__/collectExportsAndImports/export_class/babelCommonJSWithLastCoreAndTSC-7_23_2.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use strict'; | ||
|
||
function _typeof(o) { | ||
'@babel/helpers - typeof'; | ||
return ( | ||
(_typeof = | ||
'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator | ||
? function (o) { | ||
return typeof o; | ||
} | ||
: function (o) { | ||
return o && | ||
'function' == typeof Symbol && | ||
o.constructor === Symbol && | ||
o !== Symbol.prototype | ||
? 'symbol' | ||
: typeof o; | ||
}), | ||
_typeof(o) | ||
); | ||
} | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true, | ||
}); | ||
exports.Foo = void 0; | ||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ('value' in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
Object.defineProperty(Constructor, 'prototype', { writable: false }); | ||
return Constructor; | ||
} | ||
function _toPropertyKey(arg) { | ||
var key = _toPrimitive(arg, 'string'); | ||
return _typeof(key) === 'symbol' ? key : String(key); | ||
} | ||
function _toPrimitive(input, hint) { | ||
if (_typeof(input) !== 'object' || input === null) return input; | ||
var prim = input[Symbol.toPrimitive]; | ||
if (prim !== undefined) { | ||
var res = prim.call(input, hint || 'default'); | ||
if (_typeof(res) !== 'object') return res; | ||
throw new TypeError('@@toPrimitive must return a primitive value.'); | ||
} | ||
return (hint === 'string' ? String : Number)(input); | ||
} | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError('Cannot call a class as a function'); | ||
} | ||
} | ||
var Foo = (exports.Foo = /*#__PURE__*/ _createClass(function Foo() { | ||
_classCallCheck(this, Foo); | ||
})); |
18 changes: 18 additions & 0 deletions
18
...res__/collectExportsAndImports/export_class/babelCommonJSWithOldCoreAndTSC-7_0_0.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { | ||
value: true, | ||
}); | ||
exports.Foo = void 0; | ||
|
||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError('Cannot call a class as a function'); | ||
} | ||
} | ||
|
||
var Foo = function Foo() { | ||
_classCallCheck(this, Foo); | ||
}; | ||
|
||
exports.Foo = Foo; |
34 changes: 34 additions & 0 deletions
34
...es__/collectExportsAndImports/export_class/babelCommonJSWithOldCoreAndTSC-7_16_5.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { | ||
value: true, | ||
}); | ||
exports.Foo = void 0; | ||
|
||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ('value' in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
|
||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
|
||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError('Cannot call a class as a function'); | ||
} | ||
} | ||
|
||
var Foo = /*#__PURE__*/ _createClass(function Foo() { | ||
_classCallCheck(this, Foo); | ||
}); | ||
|
||
exports.Foo = Foo; |
32 changes: 32 additions & 0 deletions
32
...es__/collectExportsAndImports/export_class/babelCommonJSWithOldCoreAndTSC-7_23_2.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { | ||
value: true, | ||
}); | ||
exports.Foo = void 0; | ||
|
||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ('value' in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
|
||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
|
||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError('Cannot call a class as a function'); | ||
} | ||
} | ||
|
||
var Foo = (exports.Foo = /*#__PURE__*/ _createClass(function Foo() { | ||
_classCallCheck(this, Foo); | ||
})); |
18 changes: 18 additions & 0 deletions
18
...sts__/__fixtures__/collectExportsAndImports/export_class/esbuildCommonJS-0_12_26.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
var __defProp = Object.defineProperty; | ||
var __markAsModule = (target) => | ||
__defProp(target, '__esModule', { value: true }); | ||
var __require = | ||
typeof require !== 'undefined' | ||
? require | ||
: (x) => { | ||
throw new Error('Dynamic require of "' + x + '" is not supported'); | ||
}; | ||
var __export = (target, all) => { | ||
__markAsModule(target); | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
__export(exports, { | ||
Foo: () => Foo, | ||
}); | ||
class Foo {} |
14 changes: 14 additions & 0 deletions
14
...sts__/__fixtures__/collectExportsAndImports/export_class/esbuildCommonJS-0_13_11.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var __defProp = Object.defineProperty; | ||
var __reflectGet = Reflect.get; | ||
var __reflectSet = Reflect.set; | ||
var __markAsModule = (target) => | ||
__defProp(target, '__esModule', { value: true }); | ||
var __export = (target, all) => { | ||
__markAsModule(target); | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
__export(exports, { | ||
Foo: () => Foo, | ||
}); | ||
class Foo {} |
27 changes: 27 additions & 0 deletions
27
...sts__/__fixtures__/collectExportsAndImports/export_class/esbuildCommonJS-0_14_27.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if ((from && typeof from === 'object') || typeof from === 'function') { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { | ||
get: () => from[key], | ||
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable, | ||
}); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => | ||
__copyProps(__defProp({}, '__esModule', { value: true }), mod); | ||
var source_exports = {}; | ||
__export(source_exports, { | ||
Foo: () => Foo, | ||
}); | ||
module.exports = __toCommonJS(source_exports); | ||
class Foo {} |
41 changes: 41 additions & 0 deletions
41
...ests__/__fixtures__/collectExportsAndImports/export_class/esbuildCommonJS-0_14_5.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __markAsModule = (target) => | ||
__defProp(target, '__esModule', { value: true }); | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __reExport = (target, module2, copyDefault, desc) => { | ||
if ( | ||
(module2 && typeof module2 === 'object') || | ||
typeof module2 === 'function' | ||
) { | ||
for (let key of __getOwnPropNames(module2)) | ||
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== 'default')) | ||
__defProp(target, key, { | ||
get: () => module2[key], | ||
enumerable: | ||
!(desc = __getOwnPropDesc(module2, key)) || desc.enumerable, | ||
}); | ||
} | ||
return target; | ||
}; | ||
var __toCommonJS = /* @__PURE__ */ ((cache) => { | ||
return (module2, temp) => { | ||
return ( | ||
(cache && cache.get(module2)) || | ||
((temp = __reExport(__markAsModule({}), module2, 1)), | ||
cache && cache.set(module2, temp), | ||
temp) | ||
); | ||
}; | ||
})(typeof WeakMap !== 'undefined' ? /* @__PURE__ */ new WeakMap() : 0); | ||
var source_exports = {}; | ||
__export(source_exports, { | ||
Foo: () => Foo, | ||
}); | ||
class Foo {} | ||
module.exports = __toCommonJS(source_exports); |
12 changes: 12 additions & 0 deletions
12
...ests__/__fixtures__/collectExportsAndImports/export_class/esbuildCommonJS-0_8_17.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
var __defProp = Object.defineProperty; | ||
var __markAsModule = (target) => | ||
__defProp(target, '__esModule', { value: true }); | ||
var __export = (target, all) => { | ||
__markAsModule(target); | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
__export(exports, { | ||
Foo: () => Foo, | ||
}); | ||
class Foo {} |
12 changes: 12 additions & 0 deletions
12
...ests__/__fixtures__/collectExportsAndImports/export_class/esbuildCommonJS-0_8_43.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
var __defProp = Object.defineProperty; | ||
var __markAsModule = (target) => | ||
__defProp(target, '__esModule', { value: true }); | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
__markAsModule(exports); | ||
__export(exports, { | ||
Foo: () => Foo, | ||
}); | ||
class Foo {} |
6 changes: 6 additions & 0 deletions
6
...s__/__fixtures__/collectExportsAndImports/export_class/swcCommonJSES2015-1_2_130.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true, | ||
}); | ||
class Foo {} | ||
exports.Foo = Foo; |
9 changes: 9 additions & 0 deletions
9
...s__/__fixtures__/collectExportsAndImports/export_class/swcCommonJSES2015-1_2_206.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true, | ||
}); | ||
Object.defineProperty(exports, 'Foo', { | ||
get: () => Foo, | ||
enumerable: true, | ||
}); | ||
class Foo {} |
Oops, something went wrong.