Skip to content

Commit

Permalink
fix(transform): enhanced support of different transpilers (#19)
Browse files Browse the repository at this point in the history
* 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
Anber authored Nov 7, 2023
1 parent 126ba8a commit 4b869aa
Show file tree
Hide file tree
Showing 805 changed files with 19,918 additions and 831 deletions.
6 changes: 6 additions & 0 deletions .changeset/dry-kids-live.md
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.
1 change: 1 addition & 0 deletions packages/transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"babel-plugin-module-resolver": "^4.1.0",
"dedent": "^1.5.1",
"esbuild": "^0.15.16",
"glob": "^10.3.10",
"strip-ansi": "^5.2.0",
"typescript": "^5.2.2"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export class Foo {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export class Foo {}
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;
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;
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);
}));
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;
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;
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);
}));
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 {}
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 {}
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 {}
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);
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 {}
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 {}
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;
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 {}
Loading

0 comments on commit 4b869aa

Please sign in to comment.