Skip to content

Commit 13bc669

Browse files
committed
Remove typings in favour of npm @types modules
1 parent b1a149d commit 13bc669

File tree

10 files changed

+108
-152
lines changed

10 files changed

+108
-152
lines changed

package.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,23 @@
3333
"vscode-debugprotocol": "^1.7.0"
3434
},
3535
"devDependencies": {
36+
"@types/es6-collections": "^0.5.29",
37+
"@types/es6-promise": "^0.0.32",
38+
"@types/mocha": "^2.2.32",
39+
"@types/node": "^6.0.46",
40+
"@types/source-map": "^0.1.29",
3641
"mocha": "^2.4.5",
37-
"tslint": "^3.5.0",
3842
"typescript": "^2.0.6",
39-
"typings": "^1.0.4",
4043
"vsce": "^1.0.0",
4144
"vscode": "^0.11.x",
4245
"vscode-debugadapter-testsupport": "^1.7.0"
4346
},
4447
"scripts": {
45-
"postinstall": "node ./node_modules/vscode/bin/install && cd src && typings install",
4648
"clean": "git clean -fdx",
49+
"postinstall": "node ./node_modules/vscode/bin/install",
4750
"build": "tsc -p ./src",
4851
"package": "vsce package",
52+
"full-build": "npm run clean && npm install && npm run build && npm run package",
4953
"launch-as-server": "node --nolazy ./out/debug-adapter/webKitDebug.js --server=4712",
5054
"test-mac": "mocha --opts ./src/tests/config/mocha.opts --config ../../src/tests/config/mac.json ./out/tests",
5155
"test-win": "mocha --opts ./src/tests/config/mocha.opts --config ../../src/tests/config/win.json ./out/tests",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Generated by typings
2+
// Source: https://raw.githubusercontent.com/typed-typings/npm-universal-analytics/2d334dadcfdf190456dbbe1ad60ede8c5fd47bfa/index.d.ts
3+
declare module 'universal-analytics' {
4+
function ua (tid: string, cid?: string, options?: ua.Options): ua.Visitor;
5+
6+
namespace ua {
7+
export interface Options {
8+
strictCidFormat?: boolean;
9+
https?: boolean;
10+
requestOptions: RequestOptions;
11+
}
12+
13+
export interface RequestOptions {
14+
headers?: any;
15+
}
16+
17+
export interface MiddlewareOptions {
18+
cookieName?: string;
19+
}
20+
21+
export function middleware (tid: string, options: MiddlewareOptions): (req: any, res: any, next: (err: Error) => any) => void;
22+
23+
export function createFromSession (session: any): ua.Visitor;
24+
25+
export type Callback = (err?: Error, count?: number) => any;
26+
27+
export class Visitor {
28+
constructor (tid: string, cid?: string, options?: Options);
29+
30+
cid: string;
31+
tid: string;
32+
options: Options;
33+
requestOptions: RequestOptions;
34+
35+
debug (debug?: boolean): this;
36+
reset (): this;
37+
38+
send (callback?: Callback): void;
39+
40+
pageview (path: string, callback?: Callback): this;
41+
pageview (params: Object, callback?: Callback): this;
42+
pageview (path: string, hostname: string, callback?: Callback): this;
43+
pageview (path: string, title: string, hostname: string, callback?: Callback): this;
44+
45+
event (category: string, action: string, callback?: Callback): this;
46+
event (category: string, action: string, label: string, callback?: Callback): this;
47+
event (category: string, action: string, label: string, value: any, callback?: Callback): this;
48+
event (category: string, action: string, label: string, value: any, params: Object, callback?: Callback): this;
49+
event (params: Object, callback: Callback): this;
50+
51+
transaction (id: string, callback?: Callback): this;
52+
transaction (id: string, revenue: number, callback?: Callback): this;
53+
transaction (id: string, revenue: number, shipping: number, callback?: Callback): this;
54+
transaction (id: string, revenue: number, shipping: number, taxping: number, callback?: Callback): this;
55+
transaction (id: string, revenue: number, shipping: number, taxping: number, affiliation: string, callback?: Callback): this;
56+
transaction (params: Object, callback?: Callback): this;
57+
58+
item (price: number, callback?: Callback): this;
59+
item (price: number, quantity: number, callback?: Callback): this;
60+
item (price: number, quantity: number, sku: number, callback?: Callback): this;
61+
item (price: number, quantity: number, sku: number, name: string, callback?: Callback): this;
62+
item (price: number, quantity: number, sku: number, name: string, variation: string, callback?: Callback): this;
63+
item (price: number, quantity: number, sku: number, name: string, variation: string, params: Object, callback?: Callback): this;
64+
item (params: Object, callback?: Callback): this;
65+
66+
exception (description: string, callback?: Callback): this;
67+
exception (description: string, fatal:boolean, callback?: Callback): this;
68+
exception (params: Object, callback?: Callback): this;
69+
70+
timing (category: string, callback?: Callback): this;
71+
timing (category: string, variable: string, callback?: Callback): this;
72+
timing (category: string, variable: string, time: number, callback?: Callback): this;
73+
timing (category: string, variable: string, time: number, label: string, callback?: Callback): this;
74+
timing (params: Object, callback?: Callback): this;
75+
}
76+
}
77+
78+
export = ua;
79+
}

src/debug-adapter/adapter/sourceMaps/sourceMaps.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ class SourceMap {
520520
/*
521521
* finds the nearest source location for the given location in the generated file.
522522
*/
523-
public originalPositionFor(line: number, column: number, bias: Bias = Bias.GREATEST_LOWER_BOUND): SourceMap.MappedPosition {
523+
public originalPositionFor(line: number, column: number, bias: Bias = Bias.GREATEST_LOWER_BOUND): sourceMap.MappedPosition {
524524

525525
const mp = this._smc.originalPositionFor(<any>{
526526
line: line,
@@ -538,7 +538,7 @@ class SourceMap {
538538
/*
539539
* finds the nearest location in the generated file for the given source location.
540540
*/
541-
public generatedPositionFor(src: string, line: number, column: number, bias = Bias.GREATEST_LOWER_BOUND): SourceMap.Position {
541+
public generatedPositionFor(src: string, line: number, column: number, bias = Bias.GREATEST_LOWER_BOUND): sourceMap.Position {
542542
if (this._sourcesAreURLs) {
543543
src = 'file:///' + src;
544544
} else if (this._absSourceRoot) {

src/debug-adapter/connection/androidConnection.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ class ResReqNetSocket extends EventEmitter {
7777
that.conn.on('error', e => {
7878
console.error('socket error: ' + e.toString());
7979

80-
if (e.code == 'ECONNREFUSED') {
81-
e.helpString = 'Is node running with --debug port ' + port + '?';
82-
} else if (e.code == 'ECONNRESET') {
83-
e.helpString = 'Check there is no other debugger client attached to port ' + port + '.';
80+
if ((<any>e).code == 'ECONNREFUSED') {
81+
(<any>e).helpString = 'Is node running with --debug port ' + port + '?';
82+
} else if ((<any>e).code == 'ECONNRESET') {
83+
(<any>e).helpString = 'Check there is no other debugger client attached to port ' + port + '.';
8484
}
8585

8686
that.lastError = e.toString();
87-
if (e.helpString) {
88-
that.lastError += '. ' + e.helpString;
87+
if ((<any>e).helpString) {
88+
that.lastError += '. ' + (<any>e).helpString;
8989
}
9090

9191
that.emit('error', e);

src/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ export function activate(context: vscode.ExtensionContext) {
6363
vscode.window.showErrorMessage('Unexpected error executing NativeScript Run command.');
6464
});
6565
tnsProcess.stderr.on('data', data => {
66-
runChannel.append(data);
66+
runChannel.append(data.toString());
6767
});
6868
tnsProcess.stdout.on('data', data => {
69-
runChannel.append(data);
69+
runChannel.append(data.toString());
7070
});
7171
tnsProcess.on('exit', exitCode => {
7272
tnsProcess.stdout.removeAllListeners('data');

src/services/NsCliService.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export class IosProject extends NSProject {
187187

188188
child.stderr.on('data', (data) => {
189189
this.emit('TNS.outputMessage', data, 'error');
190-
this.writeToTnsOutputFile(data);
190+
this.writeToTnsOutputFile(data.toString());
191191
});
192192

193193
child.on('close', (code, signal) => {
@@ -263,7 +263,7 @@ export class AndroidProject extends NSProject {
263263

264264
child.stderr.on('data', function(data) {
265265
that.emit('TNS.outputMessage', data.toString(), 'error');
266-
that.writeToTnsOutputFile(data);
266+
that.writeToTnsOutputFile(data.toString());
267267
});
268268

269269
child.on('close', function(code) {
@@ -299,7 +299,7 @@ export class AndroidProject extends NSProject {
299299

300300
child.stdout.on('data', function(data) {
301301
that.emit('TNS.outputMessage', data.toString(), 'log');
302-
that.writeToTnsOutputFile(data);
302+
that.writeToTnsOutputFile(data.toString());
303303

304304
let regexp = new RegExp("(?:debug port: )([\\d]{5})");
305305

@@ -326,7 +326,7 @@ export class AndroidProject extends NSProject {
326326

327327
child.stderr.on('data', function(data) {
328328
that.emit('TNS.outputMessage', data.toString(), 'error');
329-
that.writeToTnsOutputFile(data);
329+
that.writeToTnsOutputFile(data.toString());
330330
});
331331

332332
child.on('close', function(code) {

src/tests/adapter.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ describe('The adapter', () => {
1212
let config: TestsConfig = context.getTestsConfig();
1313

1414
console.log(`Tests Configuration: ${JSON.stringify(config)}`);
15-
15+
1616
function waitFor(miliseconds) {
1717
return new Promise(r => setTimeout(r, miliseconds));
1818
}
19-
19+
2020
function iosOrAndroid(platform, iosValue, androidValue) {
2121
return platform == 'ios' ? iosValue : androidValue;
2222
}
@@ -289,7 +289,7 @@ describe('The adapter', () => {
289289
let appRoot = context.getAppPath('JsApp');
290290
let filePath = path.join(appRoot, 'app', 'main-view-model.js');
291291
let bpLine = 14;
292-
292+
293293
let firstStepExpected = iosOrAndroid(platform, { path: filePath, line: 3, column: 19 }, { path: filePath, line: 4, column: 4 });
294294
let secondStepExpected = iosOrAndroid(platform, { path: filePath, line: 4, column: 4 }, { path: filePath, line: 7, column: 8 });
295295

@@ -410,23 +410,23 @@ describe('The adapter', () => {
410410
});
411411
});
412412
});
413-
413+
414414
// iOS specifc tests
415415
if (platform == 'ios') {
416416
it(`${meta} should not hang on evaluating watch expression on call frame with unknown source`, () => {
417417
let appRoot = context.getAppPath('JsApp');
418418

419419
let scenario = new Scenario(dc);
420420
scenario.launchRequestArgs = Scenario.getDefaultLaunchArgs(platform, appRoot, config.emulator);
421-
422-
421+
422+
423423
return Promise.all<any>([
424424
scenario.start(),
425425
scenario.client.onNextTime('stopped').then(e => {
426426
return scenario.client.stackTraceRequest({ threadId: e.body.threadId }).then(response => {
427427
let callFrame = response.body.stackFrames.filter(callFrame => !callFrame.source.path && !callFrame.source.sourceReference)[0];
428428
return scenario.client.evaluateRequest({ expression: 'Math.random()', frameId: callFrame.id, context: 'watch' }).then(response => {
429-
assert.fail(undefined, undefined, 'Evaluate request should fail');
429+
assert.fail(undefined, undefined, 'Evaluate request should fail', undefined);
430430
}, response => {
431431
assert.equal(response.message, '-', 'error message mismatch');
432432
});

src/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
},
1313
"files": [
1414
// typescript definitions
15-
"typings/index.d.ts",
1615
"custom-typings/es6-impl/es6-impl.d.ts",
16+
"custom-typings/universal-analytics/ua.d.ts",
1717
"debug-adapter/webKitProtocol.d.ts",
1818

1919
"./debug-adapter/webKitDebug.ts",

src/tslint.json

-111
This file was deleted.

src/typings.json

-16
This file was deleted.

0 commit comments

Comments
 (0)