File tree Expand file tree Collapse file tree 7 files changed +39
-4
lines changed
Expand file tree Collapse file tree 7 files changed +39
-4
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ var path = require('path');
33var fs = require ( 'fs' ) ;
44var os = require ( 'os' ) ;
55var textBuffer = require ( 'basarat-text-buffer' ) ;
6+ var typescriptServices_1 = require ( "../typescriptServices" ) ;
67function createScriptInfo ( fileName , text , isOpen ) {
78 if ( isOpen === void 0 ) { isOpen = false ; }
89 var version = 1 ;
@@ -118,11 +119,19 @@ function getScriptSnapShot(scriptInfo) {
118119 getChangeRange : getChangeRange ,
119120 } ;
120121}
122+ function getTypescriptLocation ( ) {
123+ if ( typescriptServices_1 . typescriptServices ) {
124+ return path . dirname ( typescriptServices_1 . typescriptServices ) ;
125+ }
126+ else {
127+ return path . dirname ( require . resolve ( 'ntypescript' ) ) ;
128+ }
129+ }
121130exports . getDefaultLibFilePath = function ( options ) {
122131 var filename = ts . getDefaultLibFileName ( options ) ;
123- return ( path . join ( path . dirname ( require . resolve ( 'ntypescript' ) ) , filename ) ) . split ( '\\' ) . join ( '/' ) ;
132+ return ( path . join ( getTypescriptLocation ( ) , filename ) ) . split ( '\\' ) . join ( '/' ) ;
124133} ;
125- exports . typescriptDirectory = path . dirname ( require . resolve ( 'ntypescript' ) ) . split ( '\\' ) . join ( '/' ) ;
134+ exports . typescriptDirectory = getTypescriptLocation ( ) . split ( '\\' ) . join ( '/' ) ;
126135var LanguageServiceHost = ( function ( ) {
127136 function LanguageServiceHost ( config ) {
128137 var _this = this ;
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+ exports . typescriptServices = '' ;
3+ function setTypescriptServices ( path ) {
4+ exports . typescriptServices = path ;
5+ }
6+ exports . setTypescriptServices = setTypescriptServices ;
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ if (process.argv.length > 2) {
55}
66var makeTypeScriptGlobal_1 = require ( "../typescript/makeTypeScriptGlobal" ) ;
77makeTypeScriptGlobal_1 . makeTsGlobal ( typescriptServices ) ;
8+ var typescriptServices_1 = require ( "../main/lang/typescriptServices" ) ;
9+ typescriptServices_1 . setTypescriptServices ( typescriptServices ) ;
810var workerLib = require ( './lib/workerLib' ) ;
911var child = new workerLib . Child ( ) ;
1012var projectCache = require ( "../main/lang/projectCache" ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import os = require('os')
55import textBuffer = require( 'basarat-text-buffer' ) ;
66
77import tsconfig = require( '../../tsconfig/tsconfig' ) ;
8+ import { typescriptServices } from "../typescriptServices" ;
89
910interface ScriptInfo {
1011 getFileName ( ) : string ;
@@ -203,12 +204,21 @@ function getScriptSnapShot(scriptInfo: ScriptInfo): ts.IScriptSnapshot {
203204 }
204205}
205206
207+ function getTypescriptLocation ( ) {
208+ if ( typescriptServices ) {
209+ return path . dirname ( typescriptServices ) ;
210+ }
211+ else {
212+ return path . dirname ( require . resolve ( 'ntypescript' ) ) ;
213+ }
214+ }
215+
206216export var getDefaultLibFilePath = ( options : ts . CompilerOptions ) => {
207217 var filename = ts . getDefaultLibFileName ( options ) ;
208- return ( path . join ( path . dirname ( require . resolve ( 'ntypescript' ) ) , filename ) ) . split ( '\\' ) . join ( '/' ) ;
218+ return ( path . join ( getTypescriptLocation ( ) , filename ) ) . split ( '\\' ) . join ( '/' ) ;
209219}
210220
211- export var typescriptDirectory = path . dirname ( require . resolve ( 'ntypescript' ) ) . split ( '\\' ) . join ( '/' ) ;
221+ export var typescriptDirectory = getTypescriptLocation ( ) . split ( '\\' ) . join ( '/' ) ;
212222
213223
214224// NOTES:
Original file line number Diff line number Diff line change 1+ export var typescriptServices = '' ;
2+
3+ export function setTypescriptServices ( path : string ) {
4+ typescriptServices = path ;
5+ }
Original file line number Diff line number Diff line change 9292 " ./main/lang/transformers/implementations/nullTransformer.ts" ,
9393 " ./main/lang/transformers/transformer.ts" ,
9494 " ./main/lang/transformers/transformerRegistry.ts" ,
95+ " ./main/lang/typescriptServices.ts" ,
9596 " ./main/lang/utils.ts" ,
9697 " ./main/react/htmltotsx.ts" ,
9798 " ./main/tsconfig/dts-generator.ts" ,
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ if (process.argv.length > 2) {
55// setup typescript
66import { makeTsGlobal } from "../typescript/makeTypeScriptGlobal" ;
77makeTsGlobal ( typescriptServices ) ;
8+ import { setTypescriptServices } from "../main/lang/typescriptServices" ;
9+ setTypescriptServices ( typescriptServices ) ;
810
911import workerLib = require( './lib/workerLib' ) ;
1012
You can’t perform that action at this time.
0 commit comments