-
Notifications
You must be signed in to change notification settings - Fork 280
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
Merged
vladimir-kotikov
merged 11 commits into
microsoft:master
from
itoys:'sourcemap-resolving-multiple-disk'
Jul 31, 2017
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
10bcafb
Patch for multi disk support on Windows(TS Sourcemap)
itoys 385a9a3
Forgotten argument
itoys 9690d5a
Unit test for SourceMapsCombinator
itoys 4b7fb08
Unit test for SourceMapsCombinator
itoys 33a6574
Merge branch 'master' into 'sourcemap-resolving-multiple-disk'
itoys 33a0136
Unit test for SourceMapsCombinator
itoys e01ff62
Merge branch 'master' into 'sourcemap-resolving-multiple-disk'
itoys 253dece
Code style changes
7b3079d
Merge branch 'master' into 'sourcemap-resolving-multiple-disk'
itoys 0145cdf
Code style changes
cbed0b4
Merge branch ''sourcemap-resolving-multiple-disk'' of https://github.…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for details. | ||
class Hello { | ||
constructor (public msg: string) { | ||
} | ||
public sayHello() { | ||
return this.msg; | ||
} | ||
} | ||
|
||
const hello = new Hello("HelloWorld!"); | ||
|
||
console.log(hello.sayHello()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for details. | ||
|
||
import { SourceMapsCombinator } from "../../debugger/sourceMapsCombinator"; | ||
|
||
import * as assert from "assert"; | ||
import * as sinon from "sinon"; | ||
import * as fs from "fs"; | ||
import * as path from "path"; | ||
|
||
suite("sourceMapsCombinator", function () { | ||
let sandbox: Sinon.SinonSandbox; | ||
|
||
setup(() => { | ||
sandbox = sinon.sandbox.create(); | ||
}); | ||
|
||
suiteTeardown(() => { | ||
sandbox.restore(); | ||
}); | ||
|
||
suite("#convert", function () { | ||
test("convert sourcemap", function () { | ||
const pathToJS = "d:/hello.js"; | ||
const pathToTS = "d:/hello.ts"; | ||
const sourcemapPath = "d:/hello.js.map"; | ||
const code = fs.readFileSync(path.resolve(__dirname, "assets/hello.js")); | ||
const mapTS = `{"version":3,"sources":["d:/hello.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM;IACR,YAAY,CAAC,OAAO,GAAG,EAAE,MAAM,CAAC;IAChC;IACA,OAAO,QAAQ,CAAC,EAAE;QACd,OAAO,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO;IACtC;AACJ;;AAEA,MAAM,MAAM,EAAE,IAAI,KAAK,CAAC,gDAAgD,CAAC;;AAEzE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC","file":"hello.js","sourceRoot":""}`; | ||
const codeTS = fs.readFileSync(path.resolve(__dirname, "../../../src/test/debugger/assets/hello.ts")); | ||
|
||
const expected = { | ||
"version": 3, | ||
"sources": [ | ||
"d:/hello.ts", | ||
], | ||
"names": [], | ||
"mappings": "AAAA,IAAA,MAAM,EAAM,CAAA,SAAA,CAAA,EAAA;IACR,SAAA,KAAa,CAAA,GAAA,EAAO;QACpB,IAAA,CAAA,IAAA,EAAA,GAAA;IACA;SACI,CAAA,SAAO,CAAA,SAAc,EAAA,SAAM,CAAA,EAAO;QACtC,OAAA,OAAA,EAAA,IAAA,CAAA,IAAA,EAAA,OAAA;IACJ,CAAA;;AAEA,CAAA,CAAA,CAAA,CAAA;;AAEA,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC", | ||
}; | ||
|
||
let rawBundleSourcemap = { "version": 3, "sources": ["d:/hello.js"], "names": [], "mappings": "AAAA,IAAI,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE;IACrB,SAAS,KAAK,CAAC,GAAG,EAAE;QAChB,IAAI,CAAC,IAAI,EAAE,GAAG;IAClB;IACA,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE;QACnC,OAAO,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO;IACtC,CAAC;IACD,OAAO,KAAK;AAChB,CAAC,CAAC,CAAC,CAAC;AACJ,IAAI,MAAM,EAAE,IAAI,KAAK,CAAC,gDAAgD,CAAC;AACvE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC", "file": "hello.js", "sourceRoot": "" }; | ||
|
||
const stub = sandbox.stub(fs, "readFileSync"); | ||
|
||
stub.withArgs(pathToJS).returns(code); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pls rename |
||
stub.withArgs(sourcemapPath).returns(mapTS); | ||
stub.withArgs(pathToTS).returns(codeTS); | ||
let sourceMapsCombinator = new SourceMapsCombinator(); | ||
let result = sourceMapsCombinator.convert(rawBundleSourcemap); | ||
result.sources = result.sources.map(p => { | ||
return p.replace(/\\/g, "/"); | ||
}); | ||
assert.deepEqual(expected, result); | ||
}); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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