Skip to content

Commit 322144c

Browse files
committed
fix dollar signs paths
1 parent d4c9100 commit 322144c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/compiler.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ var tsHandler
1212
var getCompiledPath = require('./get-compiled-path')
1313
var tmpDir = '.ts-node'
1414

15-
var sourceMapSupportPath = require
16-
.resolve('source-map-support')
17-
.replace(/\\/g, '/')
15+
const fixPath = (p) => p.replace(/\\/g, '/').replace(/\$/g, '$$$$')
16+
17+
var sourceMapSupportPath = require.resolve('source-map-support')
1818

1919
var extensions = ['.ts', '.tsx']
2020
var empty = function () {}
@@ -107,20 +107,17 @@ var compiler = {
107107
)
108108
fileData = fileData.replace(
109109
'./get-compiled-path',
110-
path.join(__dirname, 'get-compiled-path').replace(/\\/g, '/')
110+
fixPath(path.join(__dirname, 'get-compiled-path'))
111111
)
112112
fileData = fileData.replace(
113113
'var readyFile',
114114
'var readyFile = "' + compiler.getCompilerReadyFilePath() + '"'
115115
)
116116
fileData = fileData.replace(
117117
'var sourceMapSupportPath',
118-
'var sourceMapSupportPath = "' + sourceMapSupportPath + '"'
119-
)
120-
fileData = fileData.replace(
121-
/__dirname/,
122-
'"' + __dirname.replace(/\\/g, '/') + '"'
118+
'var sourceMapSupportPath = "' + fixPath(sourceMapSupportPath) + '"'
123119
)
120+
fileData = fileData.replace(/__dirname/, '"' + fixPath(__dirname) + '"')
124121
fs.writeFileSync(compiler.getChildHookPath(), fileData)
125122
},
126123
clearErrorCompile: () => {

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,8 @@
7373
"touch": "^1.0.0",
7474
"tsconfig-paths": "^3.3.1",
7575
"typescript": "^3.9.5"
76+
},
77+
"peerDependencies": {
78+
"typescript": "*"
7679
}
7780
}

0 commit comments

Comments
 (0)