@@ -12,6 +12,7 @@ import {
12
12
} from "@typescript/ast" ;
13
13
import fs from "node:fs" ;
14
14
import path from "node:path" ;
15
+ import { fileURLToPath } from "node:url" ;
15
16
import { Bench } from "tinybench" ;
16
17
import ts from "typescript" ;
17
18
@@ -124,15 +125,15 @@ console.table(bench.table());
124
125
125
126
function spawnAPI ( ) {
126
127
api = new API ( {
127
- cwd : new URL ( "../../../" , import . meta. url ) . pathname ,
128
- tsserverPath : new URL ( `../../../built/local/tsgo${ process . platform === "win32" ? ".exe" : "" } ` , import . meta. url ) . pathname ,
128
+ cwd : fileURLToPath ( new URL ( "../../../" , import . meta. url ) . toString ( ) ) ,
129
+ tsserverPath : fileURLToPath ( new URL ( `../../../built/local/tsgo${ process . platform === "win32" ? ".exe" : "" } ` , import . meta. url ) . toString ( ) ) ,
129
130
} ) ;
130
131
}
131
132
132
133
function spawnAPIHosted ( ) {
133
134
api = new API ( {
134
- cwd : new URL ( "../../../" , import . meta. url ) . pathname ,
135
- tsserverPath : new URL ( " ../../../built/local/tsgo" , import . meta. url ) . pathname ,
135
+ cwd : fileURLToPath ( new URL ( "../../../" , import . meta. url ) . toString ( ) ) ,
136
+ tsserverPath : fileURLToPath ( new URL ( ` ../../../built/local/tsgo${ process . platform === "win32" ? ".exe" : "" } ` , import . meta. url ) . toString ( ) ) ,
136
137
fs : createNodeFileSystem ( ) ,
137
138
} ) ;
138
139
}
@@ -142,7 +143,7 @@ function loadProject() {
142
143
}
143
144
144
145
function tsCreateProgram ( ) {
145
- const configFileName = new URL ( "../../../_submodules/TypeScript/src/compiler/tsconfig.json" , import . meta. url ) . pathname ;
146
+ const configFileName = fileURLToPath ( new URL ( "../../../_submodules/TypeScript/src/compiler/tsconfig.json" , import . meta. url ) . toString ( ) ) ;
146
147
const configFile = ts . readConfigFile ( configFileName , ts . sys . readFile ) ;
147
148
const parsedCommandLine = ts . parseJsonConfigFileContent ( configFile . config , ts . sys , path . dirname ( configFileName ) ) ;
148
149
const host = ts . createCompilerHost ( parsedCommandLine . options ) ;
@@ -172,7 +173,7 @@ function getProgramTS() {
172
173
}
173
174
174
175
function tsGetProgramTS ( ) {
175
- tsFile = tsProgram . getSourceFile ( new URL ( "../../../_submodules/TypeScript/src/compiler/program.ts" , import . meta. url ) . pathname ) ! ;
176
+ tsFile = tsProgram . getSourceFile ( fileURLToPath ( new URL ( "../../../_submodules/TypeScript/src/compiler/program.ts" , import . meta. url ) . toString ( ) ) ) ! ;
176
177
}
177
178
178
179
function getCheckerTS ( ) {
0 commit comments