-
Notifications
You must be signed in to change notification settings - Fork 274
Patch for multi disk support on Windows(TS Sourcemap) #493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patch for multi disk support on Windows(TS Sourcemap) #493
Conversation
@itoys, |
Codecov Report
@@ Coverage Diff @@
## master #493 +/- ##
==========================================
+ Coverage 33.87% 34.68% +0.81%
==========================================
Files 65 65
Lines 3312 3321 +9
Branches 382 385 +3
==========================================
+ Hits 1122 1152 +30
+ Misses 2188 2167 -21
Partials 2 2
Continue to review full report at Codecov.
|
src/debugger/sourceMapsCombinator.ts
Outdated
// Hack for source-map-resolve and cutted disk letter | ||
// https://github.com/lydell/source-map-resolve/issues/9 | ||
function readFileSync(diskLetter: string, filePath: string) { | ||
return fs.readFileSync(`${diskLetter}${filePath}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to check if the filePath
is an ablolute path - in this case you'd broke it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is always looks like absolute and trimmed
c:/project/tests/index.js
-> /project/tests/index.js
On unix like systems won't diskLetter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, now it works that way, but I can imagine that when urix
transitive dependency (which has the bug we're trying to workaround) gets updated we'd run into trouble which we could avoid by adding just one additional check
As a general request - please also add a couple of tests to cover this bug |
|
||
const stub = sandbox.stub(fs, "readFileSync"); | ||
|
||
stub.withArgs(pathToJS).returns(code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls rename stub
-> fsReadFileStub
src/debugger/sourceMapsCombinator.ts
Outdated
@@ -6,6 +6,8 @@ import * as path from "path"; | |||
import { SourceMapConsumer, RawSourceMap, SourceMapGenerator, MappingItem, Mapping, Position, MappedPosition } from "source-map"; | |||
import sourceMapResolve = require("source-map-resolve"); | |||
|
|||
const DISK: RegExp = /^[a-z]:/i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DISK
-> DISK_LETTER_RE
#492