swc/tests/fixture/issue-1160/output/entry.ts
Donny/강동윤 76de51333d
fix(es/transforms): Fix for react + typescript (#2422)
swc_common:
 - Add `NoopComments`.
 - Implement `Comments` for `Option<C>` where C: `Comments`.
 - Add some helper methods to `Comments`.
 - Deprecate `CommentsExt`.

swc_ecma_transforms_base:
 - `resolver`: Handle `TsImportEqualsDecl`.

swc_ecma_transforms_react:
 - Reduce useless cloning using `Arc`.
 - Expose API for parsing directives like `@jsxPragma`.

swc_ecma_transforms_typescript:
 - Accept `pragma` and `pragmaFrag`.
 - Support jsx directives.
 - Preserve jsx-related imports.

swc:
 - Optimize `SwcComments`.
 - Run`resolver` before everything else.
2021-10-13 22:29:56 +09:00

59 lines
1.9 KiB
TypeScript

"use strict";
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
var desc = {
};
Object.keys(descriptor).forEach(function(key) {
desc[key] = descriptor[key];
});
desc.enumerable = !!desc.enumerable;
desc.configurable = !!desc.configurable;
if ("value" in desc || desc.initializer) {
desc.writable = true;
}
desc = decorators.slice().reverse().reduce(function(desc, decorator) {
return decorator ? decorator(target, property, desc) || desc : desc;
}, desc);
if (context && desc.initializer !== void 0) {
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
desc.initializer = undefined;
}
if (desc.initializer === void 0) {
Object.defineProperty(target, property, desc);
desc = null;
}
return desc;
}
function _initializerDefineProperty(target, property, descriptor, context) {
if (!descriptor) return;
Object.defineProperty(target, property, {
enumerable: descriptor.enumerable,
configurable: descriptor.configurable,
writable: descriptor.writable,
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
});
}
var _class, _descriptor, _dec, _dec1;
var MyEnum;
(function(MyEnum) {
MyEnum["x"] = "xxx";
MyEnum["y"] = "yyy";
})(MyEnum || (MyEnum = {
}));
let Xpto = ((_class = class Xpto {
constructor(){
_initializerDefineProperty(this, "value", _descriptor, this);
}
}) || _class, _dec = Decorator(), _dec1 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "function" && Reflect.metadata("design:type", String), _descriptor = _applyDecoratedDescriptor(_class.prototype, "value", [
_dec,
_dec1
], {
configurable: true,
enumerable: true,
writable: true,
initializer: void 0
}), _class);
function Decorator() {
return function(...args) {
};
}