Skip to content
This repository was archived by the owner on Dec 1, 2019. It is now read-only.

Commit 27e55e2

Browse files
committed
customTranformersPath
1 parent 468b3f7 commit 27e55e2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/checker/runtime.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re
8282
let ignoreDiagnostics: {[id: number]: boolean} = {};
8383
let instanceName: string;
8484
let context: string;
85+
let getCustomTransformers: ()=>ts.CustomTransformers | undefined;
8586

8687
function ensureFile(fileName: string) {
8788
if (!files[fileName]) {
@@ -136,6 +137,7 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re
136137

137138
class Host implements ts.LanguageServiceHost {
138139
filesRegex: RegExp;
140+
getCustomTransformers=getCustomTransformers;
139141

140142
constructor(filesRegex: RegExp) {
141143
this.filesRegex = filesRegex;
@@ -231,13 +233,17 @@ function createChecker(receive: (cb: (msg: Req) => void) => void, send: (msg: Re
231233
directoryExists(path: string) {
232234
return compiler.sys.directoryExists(path);
233235
}
234-
getCustomTransformers=loaderConfig.getCustomTransformers
235236
}
236237

237238
function processInit({seq, payload}: Init.Request) {
238239
compiler = require(payload.compilerInfo.compilerPath);
239240
compilerInfo = payload.compilerInfo;
240241
loaderConfig = payload.loaderConfig;
242+
243+
if (loaderConfig.customTranformersPath !== undefined) {
244+
getCustomTransformers = require(loaderConfig.customTranformersPath)
245+
}
246+
241247
compilerConfig = payload.compilerConfig;
242248
compilerOptions = compilerConfig.options;
243249
webpackOptions = payload.webpackOptions;

src/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface LoaderConfig {
2424
cacheDirectory?: string;
2525
entryFileIsJs?: boolean;
2626
debug?: boolean;
27-
getCustomTransformers?(): ts.CustomTransformers | undefined;
27+
customTranformersPath?: string;
2828
}
2929

3030
export interface OutputFile {

0 commit comments

Comments
 (0)