fix(swc): Fix order of passes (#2427)

swc_ecam_transforms_typescript:
 - Preserve more jsx-related imports.

swc:
 - Change pass ordering.
This commit is contained in:
Donny/강동윤 2021-10-14 01:04:49 +09:00 committed by GitHub
parent 5fb5a7058f
commit 51d7a144bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 30 additions and 27 deletions

4
Cargo.lock generated
View File

@ -2324,7 +2324,7 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
[[package]]
name = "swc"
version = "0.68.0"
version = "0.68.1"
dependencies = [
"ahash",
"anyhow",
@ -2970,7 +2970,7 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_typescript"
version = "0.49.0"
version = "0.49.1"
dependencies = [
"serde",
"swc_atoms 0.2.8",

View File

@ -20,7 +20,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc"
repository = "https://github.com/swc-project/swc.git"
version = "0.68.0"
version = "0.68.1"
[lib]
name = "swc"

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_typescript"
repository = "https://github.com/swc-project/swc.git"
version = "0.49.0"
version = "0.49.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -1612,7 +1612,7 @@ where
| ImportSpecifier::Named(ImportNamedSpecifier { ref local, .. })
| ImportSpecifier::Namespace(ImportStarAsSpecifier { ref local, .. }) => {
if let Some(jsx) = &self.jsx {
if local.to_id() == jsx.pragma_id || local.to_id() == jsx.pragma_frag_id {
if local.sym == jsx.pragma_id.0 || local.sym == jsx.pragma_frag_id.0 {
return true;
}
}

View File

@ -280,7 +280,6 @@ impl Options {
);
let pass = chain!(
resolver_with_mark(top_level_mark),
// Decorators may use type information
Optional::new(
decorators(decorators::Config {
@ -303,6 +302,7 @@ impl Options {
),
syntax.typescript()
),
resolver_with_mark(top_level_mark),
custom_before_pass,
// handle jsx
Optional::new(

View File

@ -39,7 +39,7 @@ var MyEnum;
MyEnum["y"] = "yyy";
})(MyEnum || (MyEnum = {
}));
let Xpto = ((_class = class Xpto {
let Xpto1 = ((_class = class Xpto {
constructor(){
_initializerDefineProperty(this, "value", _descriptor, this);
}

View File

@ -39,7 +39,7 @@ function MyDecorator(klass) {
console.log(klass);
};
}
let MyClass = ((_class = class MyClass {
let MyClass1 = ((_class = class MyClass {
constructor(){
_initializerDefineProperty(this, "prop", _descriptor, this);
}
@ -52,4 +52,4 @@ let MyClass = ((_class = class MyClass {
writable: true,
initializer: void 0
}), _class);
console.log(new MyClass());
console.log(new MyClass1());

View File

@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
});
exports.AppController = void 0;
var _common = require("@nestjs/common");
var _appService = require("./app.service");
var _createUserDto = require("./dtos/CreateUserDto");
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
var desc = {
};
@ -30,9 +32,9 @@ function _applyDecoratedDescriptor(target, property, decorators, descriptor, con
}
var _class, _dec, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6;
var _dec7 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "function" && Reflect.metadata("design:paramtypes", [
typeof AppService === "undefined" ? Object : AppService
typeof _appService.AppService === "undefined" ? Object : _appService.AppService
]), _dec8 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "function" && Reflect.metadata("design:type", Function), _dec9 = (0, _common).Controller();
let AppController = _class = _dec9(_class = _dec8(_class = _dec7(((_class = class AppController {
let AppController1 = _class = _dec9(_class = _dec8(_class = _dec7(((_class = class AppController {
async getHello() {
const result = await this.appService.getHello();
return result;
@ -51,11 +53,11 @@ let AppController = _class = _dec9(_class = _dec8(_class = _dec7(((_class = clas
], Object.getOwnPropertyDescriptor(_class.prototype, "getHello"), _class.prototype), _dec3 = (0, _common).Post(), _dec4 = function(target, key) {
return (0, _common).Body()(target, key, 0);
}, _dec5 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "function" && Reflect.metadata("design:type", Function), _dec6 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "function" && Reflect.metadata("design:paramtypes", [
typeof CreateUserDto === "undefined" ? Object : CreateUserDto
typeof _createUserDto.CreateUserDto === "undefined" ? Object : _createUserDto.CreateUserDto
]), _applyDecoratedDescriptor(_class.prototype, "create", [
_dec3,
_dec4,
_dec5,
_dec6
], Object.getOwnPropertyDescriptor(_class.prototype, "create"), _class.prototype), _class)) || _class) || _class) || _class;
exports.AppController = AppController;
exports.AppController = AppController1;

View File

@ -5,7 +5,7 @@ var _dec = typeof Reflect !== "undefined" && typeof Reflect.metadata === "functi
]), _dec1 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "function" && Reflect.metadata("design:type", Function), _dec2 = function(target, key) {
return Inject()(target, undefined, 0);
};
let MyClass1 = _class = _dec2(_class = _dec1(_class = _dec((_class = // not work
let MyClass11 = _class = _dec2(_class = _dec1(_class = _dec((_class = // not work
class MyClass1 {
constructor(param1){
this.param1 = param1;
@ -16,7 +16,7 @@ var _dec5 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "funct
]), _dec6 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "function" && Reflect.metadata("design:type", Function), _dec7 = function(target, key) {
return Inject()(target, undefined, 0);
};
let MyClass2 = _class1 = _dec7(_class1 = _dec6(_class1 = _dec5((_class1 = class MyClass2 {
let MyClass21 = _class1 = _dec7(_class1 = _dec6(_class1 = _dec5((_class1 = class MyClass2 {
constructor(param1){
this.param1 = param1;
}
@ -26,7 +26,7 @@ var _dec8 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "funct
]), _dec9 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "function" && Reflect.metadata("design:type", Function), _dec10 = function(target, key) {
return Inject()(target, undefined, 0);
};
let MyClass3 = _class2 = _dec10(_class2 = _dec9(_class2 = _dec8((_class2 = class MyClass3 {
let MyClass31 = _class2 = _dec10(_class2 = _dec9(_class2 = _dec8((_class2 = class MyClass3 {
constructor(param1){
this.param1 = param1;
}
@ -36,7 +36,7 @@ var _dec11 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "func
]), _dec12 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "function" && Reflect.metadata("design:type", Function), _dec13 = function(target, key) {
return Inject()(target, undefined, 0);
};
let MyClass4 = _class3 = _dec13(_class3 = _dec12(_class3 = _dec11((_class3 = class MyClass4 {
let MyClass41 = _class3 = _dec13(_class3 = _dec12(_class3 = _dec11((_class3 = class MyClass4 {
constructor(param1){
this.param1 = param1;
}
@ -46,7 +46,7 @@ var _dec14 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "func
]), _dec15 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "function" && Reflect.metadata("design:type", Function), _dec16 = function(target, key) {
return Inject()(target, undefined, 0);
};
let MyClass5 = _class4 = _dec16(_class4 = _dec15(_class4 = _dec14((_class4 = class MyClass5 {
let MyClass51 = _class4 = _dec16(_class4 = _dec15(_class4 = _dec14((_class4 = class MyClass5 {
constructor(param1){
this.param1 = param1;
}
@ -59,7 +59,7 @@ var _dec17 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "func
}, _dec20 = function(target, key) {
return Inject()(target, undefined, 0);
};
let MyClass6 = _class5 = _dec20(_class5 = _dec19(_class5 = _dec18(_class5 = _dec17((_class5 = class MyClass6 {
let MyClass61 = _class5 = _dec20(_class5 = _dec19(_class5 = _dec18(_class5 = _dec17((_class5 = class MyClass6 {
constructor(param1, param2){
this.param1 = param1;
this.param2 = param2;

View File

@ -5,7 +5,7 @@ var _dec = typeof Reflect !== "undefined" && typeof Reflect.metadata === "functi
]), _dec1 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "function" && Reflect.metadata("design:type", Function), _dec2 = function(target, key) {
return Inject()(target, undefined, 0);
};
let MyClass1 = _class = _dec2(_class = _dec1(_class = _dec((_class = // work
let MyClass11 = _class = _dec2(_class = _dec1(_class = _dec((_class = // work
class MyClass1 {
constructor(param1){
}
@ -18,7 +18,7 @@ var _dec5 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "funct
}, _dec8 = function(target, key) {
return Inject()(target, undefined, 0);
};
let MyClass2 = _class1 = _dec8(_class1 = _dec7(_class1 = _dec6(_class1 = _dec5((_class1 = class MyClass2 {
let MyClass21 = _class1 = _dec8(_class1 = _dec7(_class1 = _dec6(_class1 = _dec5((_class1 = class MyClass2 {
constructor(param1, param2){
this.param1 = param1;
}
@ -31,7 +31,7 @@ var _dec9 = typeof Reflect !== "undefined" && typeof Reflect.metadata === "funct
}, _dec12 = function(target, key) {
return Inject()(target, undefined, 0);
};
let MyClass3 = _class2 = _dec12(_class2 = _dec11(_class2 = _dec10(_class2 = _dec9((_class2 = class MyClass3 {
let MyClass31 = _class2 = _dec12(_class2 = _dec11(_class2 = _dec10(_class2 = _dec9((_class2 = class MyClass3 {
constructor(param1, param2){
this.param2 = param2;
}

View File

@ -1,5 +1,6 @@
import { Entity, BaseEntity } from 'typeorm';
var _class;
var _dec = Entity();
export let Location = _class = _dec((_class = class Location extends BaseEntity {
let Location1 = _class = _dec((_class = class Location extends BaseEntity {
}) || _class) || _class;
export { Location1 as Location };

View File

@ -2,14 +2,14 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
class ServiceError2 extends Error {
class ServiceError extends Error {
constructor(...args){
super(...args);
this.code = ServiceError2.Code.badResponse;
this.code = ServiceError.Code.badResponse;
this.name = "ServiceError.BadResponse";
}
}
exports.ServiceError = ServiceError2;
exports.ServiceError = ServiceError;
(function(ServiceError1) {
var Code;
(function(Code) {
@ -38,5 +38,5 @@ exports.ServiceError = ServiceError2;
}
ServiceError1.toMessageBody = toMessageBody;
ServiceError1.Code = Code;
})(ServiceError2 || (ServiceError2 = {
})(ServiceError || (ServiceError = {
}));