-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/module): Fix relativeness check for
jsc.paths
(#8702)
**Related issue:** - Closes #8701
- Loading branch information
Showing
27 changed files
with
456 additions
and
31 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,15 @@ | ||
{ | ||
"$schema": "http://json.schemastore.org/swcrc", | ||
"jsc": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"@app/*": [ | ||
"./src/*" | ||
] | ||
}, | ||
"parser": { | ||
"syntax": "typescript", | ||
"decorators": true | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
crates/swc/tests/fixture/issues-8xxx/8701/1/input/src/app.controller.spec.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,21 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { AppController } from './app.controller'; | ||
import { AppService } from './app.service'; | ||
|
||
describe('AppController', () => { | ||
let app: TestingModule; | ||
|
||
beforeAll(async () => { | ||
app = await Test.createTestingModule({ | ||
controllers: [AppController], | ||
providers: [AppService], | ||
}).compile(); | ||
}); | ||
|
||
describe('getHello', () => { | ||
it('should return "Hello World!"', () => { | ||
const appController = app.get(AppController); | ||
expect(appController.getHello()).toBe('Hello World!'); | ||
}); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
crates/swc/tests/fixture/issues-8xxx/8701/1/input/src/app.controller.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,12 @@ | ||
import { Controller, Get } from '@nestjs/common'; | ||
import { AppService } from './app.service'; | ||
|
||
@Controller() | ||
export class AppController { | ||
constructor(private readonly appService: AppService) {} | ||
|
||
@Get() | ||
getHello(): string { | ||
return this.appService.getHello(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
crates/swc/tests/fixture/issues-8xxx/8701/1/input/src/app.module.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,10 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { AppController } from '@app/app.controller'; | ||
import { AppService } from '@app/app.service'; | ||
|
||
@Module({ | ||
imports: [], | ||
controllers: [AppController], | ||
providers: [AppService], | ||
}) | ||
export class AppModule {} |
8 changes: 8 additions & 0 deletions
8
crates/swc/tests/fixture/issues-8xxx/8701/1/input/src/app.service.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,8 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class AppService { | ||
getHello(): string { | ||
return 'Hello World!'; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
crates/swc/tests/fixture/issues-8xxx/8701/1/input/src/main.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,8 @@ | ||
import { NestFactory } from '@nestjs/core'; | ||
import { AppModule } from './app.module'; | ||
|
||
async function bootstrap() { | ||
const app = await NestFactory.create(AppModule); | ||
await app.listen(3000); | ||
} | ||
bootstrap(); |
37 changes: 37 additions & 0 deletions
37
crates/swc/tests/fixture/issues-8xxx/8701/1/output/src/app.controller.spec.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,37 @@ | ||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; | ||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; | ||
import { Test } from "@nestjs/testing"; | ||
import { AppController } from "./app.controller"; | ||
import { AppService } from "./app.service"; | ||
describe("AppController", function() { | ||
var app; | ||
beforeAll(/*#__PURE__*/ _async_to_generator(function() { | ||
return _ts_generator(this, function(_state) { | ||
switch(_state.label){ | ||
case 0: | ||
return [ | ||
4, | ||
Test.createTestingModule({ | ||
controllers: [ | ||
AppController | ||
], | ||
providers: [ | ||
AppService | ||
] | ||
}).compile() | ||
]; | ||
case 1: | ||
app = _state.sent(); | ||
return [ | ||
2 | ||
]; | ||
} | ||
}); | ||
})); | ||
describe("getHello", function() { | ||
it('should return "Hello World!"', function() { | ||
var appController = app.get(AppController); | ||
expect(appController.getHello()).toBe("Hello World!"); | ||
}); | ||
}); | ||
}); |
28 changes: 28 additions & 0 deletions
28
crates/swc/tests/fixture/issues-8xxx/8701/1/output/src/app.controller.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,28 @@ | ||
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; | ||
import { _ as _create_class } from "@swc/helpers/_/_create_class"; | ||
import { _ as _define_property } from "@swc/helpers/_/_define_property"; | ||
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; | ||
import { Controller, Get } from "@nestjs/common"; | ||
export var AppController = /*#__PURE__*/ function() { | ||
"use strict"; | ||
function AppController(appService) { | ||
_class_call_check(this, AppController); | ||
_define_property(this, "appService", void 0); | ||
this.appService = appService; | ||
} | ||
_create_class(AppController, [ | ||
{ | ||
key: "getHello", | ||
value: function getHello() { | ||
return this.appService.getHello(); | ||
} | ||
} | ||
]); | ||
return AppController; | ||
}(); | ||
_ts_decorate([ | ||
Get() | ||
], AppController.prototype, "getHello", null); | ||
AppController = _ts_decorate([ | ||
Controller() | ||
], AppController); |
20 changes: 20 additions & 0 deletions
20
crates/swc/tests/fixture/issues-8xxx/8701/1/output/src/app.module.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,20 @@ | ||
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; | ||
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; | ||
import { Module } from "@nestjs/common"; | ||
import { AppController } from "./app.controller"; | ||
import { AppService } from "./app.service"; | ||
export var AppModule = function AppModule() { | ||
"use strict"; | ||
_class_call_check(this, AppModule); | ||
}; | ||
AppModule = _ts_decorate([ | ||
Module({ | ||
imports: [], | ||
controllers: [ | ||
AppController | ||
], | ||
providers: [ | ||
AppService | ||
] | ||
}) | ||
], AppModule); |
22 changes: 22 additions & 0 deletions
22
crates/swc/tests/fixture/issues-8xxx/8701/1/output/src/app.service.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,22 @@ | ||
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; | ||
import { _ as _create_class } from "@swc/helpers/_/_create_class"; | ||
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; | ||
import { Injectable } from "@nestjs/common"; | ||
export var AppService = /*#__PURE__*/ function() { | ||
"use strict"; | ||
function AppService() { | ||
_class_call_check(this, AppService); | ||
} | ||
_create_class(AppService, [ | ||
{ | ||
key: "getHello", | ||
value: function getHello() { | ||
return "Hello World!"; | ||
} | ||
} | ||
]); | ||
return AppService; | ||
}(); | ||
AppService = _ts_decorate([ | ||
Injectable() | ||
], AppService); |
34 changes: 34 additions & 0 deletions
34
crates/swc/tests/fixture/issues-8xxx/8701/1/output/src/main.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,34 @@ | ||
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; | ||
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; | ||
import { NestFactory } from "@nestjs/core"; | ||
import { AppModule } from "./app.module"; | ||
function bootstrap() { | ||
return _bootstrap.apply(this, arguments); | ||
} | ||
function _bootstrap() { | ||
_bootstrap = _async_to_generator(function() { | ||
var app; | ||
return _ts_generator(this, function(_state) { | ||
switch(_state.label){ | ||
case 0: | ||
return [ | ||
4, | ||
NestFactory.create(AppModule) | ||
]; | ||
case 1: | ||
app = _state.sent(); | ||
return [ | ||
4, | ||
app.listen(3000) | ||
]; | ||
case 2: | ||
_state.sent(); | ||
return [ | ||
2 | ||
]; | ||
} | ||
}); | ||
}); | ||
return _bootstrap.apply(this, arguments); | ||
} | ||
bootstrap(); |
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
21 changes: 21 additions & 0 deletions
21
crates/swc/tests/projects/issue-8701/src/app.controller.spec.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,21 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { AppController } from './app.controller'; | ||
import { AppService } from './app.service'; | ||
|
||
describe('AppController', () => { | ||
let app: TestingModule; | ||
|
||
beforeAll(async () => { | ||
app = await Test.createTestingModule({ | ||
controllers: [AppController], | ||
providers: [AppService], | ||
}).compile(); | ||
}); | ||
|
||
describe('getHello', () => { | ||
it('should return "Hello World!"', () => { | ||
const appController = app.get(AppController); | ||
expect(appController.getHello()).toBe('Hello World!'); | ||
}); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
crates/swc/tests/projects/issue-8701/src/app.controller.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,12 @@ | ||
import { Controller, Get } from '@nestjs/common'; | ||
import { AppService } from './app.service'; | ||
|
||
@Controller() | ||
export class AppController { | ||
constructor(private readonly appService: AppService) {} | ||
|
||
@Get() | ||
getHello(): string { | ||
return this.appService.getHello(); | ||
} | ||
} |
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 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { AppController } from '@app/app.controller'; | ||
import { AppService } from '@app/app.service'; | ||
@Module({ | ||
imports: [], | ||
controllers: [AppController], | ||
providers: [AppService], | ||
}) | ||
export class AppModule { } |
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,8 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class AppService { | ||
getHello(): string { | ||
return 'Hello World!'; | ||
} | ||
} |
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,8 @@ | ||
import { NestFactory } from '@nestjs/core'; | ||
import { AppModule } from './app.module'; | ||
|
||
async function bootstrap() { | ||
const app = await NestFactory.create(AppModule); | ||
await app.listen(3000); | ||
} | ||
bootstrap(); |
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
Oops, something went wrong.