Skip to content

Commit b11ae09

Browse files
Merge pull request #243 from NativeScript/fatme/update-vscode-chrome-debugger
chore: update chrome-debug-adapter to latest version
2 parents 61eaca0 + b729a01 commit b11ae09

5 files changed

+14
-11
lines changed

Diff for: package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"semver": "5.6.0",
3030
"universal-analytics": "0.4.15",
3131
"uuid": "3.3.2",
32-
"vscode-chrome-debug-core": "3.23.11",
32+
"vscode-chrome-debug-core": "6.7.45",
3333
"vscode-debugadapter": "1.34.0"
3434
},
3535
"devDependencies": {
@@ -44,8 +44,8 @@
4444
"tslint": "5.10.0",
4545
"tslint-eslint-rules": "5.4.0",
4646
"typescript": "2.6.2",
47-
"vsce": "~1.36.0",
48-
"vscode": "~1.1.10",
47+
"vsce": "1.57.1",
48+
"vscode": "1.1.30",
4949
"vscode-debugprotocol": "1.34.0"
5050
},
5151
"scripts": {

Diff for: src/debug-adapter/nativeScriptDebugAdapter.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class NativeScriptDebugAdapter extends ChromeDebugAdapter {
6565
protected hookConnectionEvents(): void {
6666
super.hookConnectionEvents();
6767

68-
this.chrome.Log.onEntryAdded((params) => this.onEntryAdded(params));
68+
this.chrome.Log.on('entryAdded', (params) => this.onEntryAdded(params));
6969
}
7070

7171
protected onEntryAdded(params: any): void {
@@ -112,7 +112,7 @@ export class NativeScriptDebugAdapter extends ChromeDebugAdapter {
112112

113113
const appDirPath = this.getAppDirPath(transformedArgs.webRoot);
114114

115-
(this.pathTransformer as any).setTransformOptions(args.platform, appDirPath);
115+
(this.pathTransformer as any).setTransformOptions(args.platform, appDirPath, transformedArgs.webRoot);
116116
(ChromeDebugAdapter as any).SET_BREAKPOINTS_TIMEOUT = 20000;
117117

118118
this.isLiveSync = args.watch;

Diff for: src/debug-adapter/nativeScriptPathTransformer.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ export class NativeScriptPathTransformer extends UrlPathTransformer {
1111

1212
private targetPlatform: string;
1313
private appDirPath: string;
14+
private webRoot: string;
1415

15-
public setTransformOptions(targetPlatform: string, appDirPath: string) {
16+
public setTransformOptions(targetPlatform: string, appDirPath: string, webRoot: string) {
1617
this.targetPlatform = targetPlatform.toLowerCase();
1718
this.appDirPath = appDirPath;
19+
this.webRoot = webRoot;
1820
}
1921

20-
protected async targetUrlToClientPath(webRoot: string, scriptUrl: string): Promise<string> {
22+
protected async targetUrlToClientPath(scriptUrl: string): Promise<string> {
2123
if (!scriptUrl) {
2224
return;
2325
}
@@ -50,7 +52,7 @@ export class NativeScriptPathTransformer extends UrlPathTransformer {
5052
relativePath = relativePath.replace('app', this.appDirPath);
5153
}
5254

53-
let absolutePath = path.resolve(path.join(webRoot, relativePath));
55+
let absolutePath = path.resolve(path.join(this.webRoot, relativePath));
5456
let platformSpecificPath = this.getPlatformSpecificPath(absolutePath);
5557

5658
if (platformSpecificPath) {
@@ -59,7 +61,7 @@ export class NativeScriptPathTransformer extends UrlPathTransformer {
5961

6062
if (isAndroid) {
6163
// handle files like /data/data/internal/ts_helpers.ts
62-
absolutePath = path.resolve(path.join(webRoot, 'platforms', this.targetPlatform.toLowerCase(), 'app', 'src', 'main', 'assets', relativePath));
64+
absolutePath = path.resolve(path.join(this.webRoot, 'platforms', this.targetPlatform.toLowerCase(), 'app', 'src', 'main', 'assets', relativePath));
6365
platformSpecificPath = this.getPlatformSpecificPath(absolutePath);
6466

6567
if (platformSpecificPath) {

Diff for: src/debug-adapter/nativeScriptTargetDiscovery.ts

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export class NativeScriptTargetDiscovery extends chromeTargetDiscoveryStrategy.C
1313
id: uuid.v4(),
1414
title: 'NS Debug Target',
1515
type: 'node',
16+
version: null,
1617
webSocketDebuggerUrl: `ws://${address}:${port}`,
1718
});
1819
}

Diff for: src/tests/nativeScriptPathTransformer.tests.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ describe('NativeScriptPathTransformer', () => {
2222
it(`should transform [${test.platform}] device path ${test.scriptUrl} -> ${test.expectedResult}${nsConfigPartInTestName}`, async () => {
2323
(path as any).join = path.win32.join;
2424
(path as any).resolve = path.win32.resolve;
25-
nativeScriptPathTransformer.setTransformOptions(test.platform, test.nsconfig ? test.nsconfig.appPath : null);
25+
nativeScriptPathTransformer.setTransformOptions(test.platform, test.nsconfig ? test.nsconfig.appPath : null, webRoot);
2626

2727
existsSyncStub = sinon
2828
.stub(fs, 'existsSync')
2929
.callsFake((arg: string) => arg === test.existingPath);
30-
const result = await nativeScriptPathTransformer.targetUrlToClientPath(webRoot, test.scriptUrl);
30+
const result = await nativeScriptPathTransformer.targetUrlToClientPath(test.scriptUrl);
3131

3232
assert.equal(result, test.expectedResult);
3333
});

0 commit comments

Comments
 (0)