Skip to content

Commit b9c7910

Browse files
authored
Merge pull request NativeScript#3623 from NativeScript/hdeshev/modules25-docs
Fix the docs build
2 parents 79e6881 + 8bd3429 commit b9c7910

28 files changed

+4583
-149
lines changed

apps/references.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
/// <reference path="../tns-platform-declarations/ios.d.ts" />
33

44
/// <reference path="../tns-core-modules/tns-core-modules.d.ts" />
5+
/// <reference path="../tns-core-modules/lib.core.d.ts" />
6+
/// <reference path="../tns-core-modules/lib.dom.d.ts" />
7+
58
/// <reference path="../tns-core-modules/ui/styling/css-selector-parser.d.ts" />

gruntfile.js

Lines changed: 19 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ module.exports = function(grunt) {
9191
var angularExcludes = angularConflicts.map(function(file) {
9292
return '!' + file;
9393
});
94+
var nonES6Files = [
95+
'es-collections.d.ts',
96+
'es6-promise.d.ts',
97+
'es6.d.ts',
98+
'weakmap.d.ts',
99+
];
100+
var es6Excludes = nonES6Files.map(function(file) {
101+
return '!' + file;
102+
});
94103
var dtsFiles = grunt.file.expand({cwd: srcDir }, [
95104
"**/*.d.ts",
96105
//Exclude the d.ts files in the apps folder - these are part of the apps and are already packed there!
@@ -108,13 +117,13 @@ module.exports = function(grunt) {
108117
"!tns-core-modules.base.d.ts",
109118
"!references.d.ts",
110119
"!webworker.es2016.d.ts"
111-
].concat(localCfg.defaultExcludes).concat(angularExcludes));
120+
].concat(localCfg.defaultExcludes).concat(es6Excludes).concat(angularExcludes));
112121
dtsFiles.sort();
113122

114123
writeDtsFile(dtsFiles, outDir, 'tns-core-modules/tns-core-modules.base.d.ts');
115124
var es6Files = angularConflicts.concat(['tns-core-modules.base.d.ts']);
116125
writeDtsFile(es6Files, outDir, 'tns-core-modules/tns-core-modules.es6.d.ts');
117-
var allFiles = angularConflicts.concat(['tns-core-modules.base.d.ts']);
126+
var allFiles = angularConflicts.concat(nonES6Files).concat(['tns-core-modules.base.d.ts']);
118127
writeDtsFile(allFiles, outDir, 'tns-core-modules/tns-core-modules.d.ts');
119128
}
120129

@@ -312,59 +321,6 @@ module.exports = function(grunt) {
312321
dest: "<%= grunt.option('path') %>/node_modules/tns-core-modules/",
313322
}
314323
},
315-
ts: {
316-
build: {
317-
tsconfig: {
318-
tsconfig: 'tsconfig.json',
319-
passThrough: true,
320-
},
321-
outDir: localCfg.outDir,
322-
dest: localCfg.outDir,
323-
options: tsOptions
324-
},
325-
buildNodeTests: {
326-
src: [
327-
'tns-core-modules/js-libs/easysax/**/*.ts',
328-
'tns-core-modules/module.d.ts',
329-
'tns-core-modules/xml/**/*.ts',
330-
'tns-core-modules/lib.core.d.ts',
331-
'tns-core-modules/lib.dom.d.ts',
332-
'tns-core-modules/es-collections.d.ts',
333-
'tns-core-modules/declarations.d.ts',
334-
'tns-core-modules/es6-promise.d.ts',
335-
'node-tests/**/*.ts'
336-
],
337-
outDir: localCfg.outDir,
338-
dest: localCfg.outDir,
339-
options: tsOptions
340-
},
341-
buildDts: {
342-
src: [
343-
'tns-core-modules/**/*.d.ts',
344-
'!org.nativescript.widgets.d.ts',
345-
'!**/*.android.d.ts',
346-
'!**/node_modules/**/*',
347-
'!**/platforms/**/*',
348-
'!bin/**/*',
349-
'!**/references.d.ts',
350-
'!tns-core-modules/references.d.ts',
351-
'!tns-core-modules/android17.d.ts',
352-
'!tns-core-modules/ios/**/*',
353-
'!tns-core-modules/org.nativescript.widgets.d.ts',
354-
],
355-
outDir: localCfg.outDir,
356-
dest: localCfg.outDir,
357-
options: tsOptions
358-
},
359-
testCombinedDts: {
360-
src: [
361-
path.join(localCfg.outTnsCoreModules, 'tns-core-modules.d.ts'),
362-
],
363-
outDir: localCfg.outDir,
364-
dest: localCfg.outDir,
365-
options: Object.assign({}, tsOptions, { noLib: false })
366-
}
367-
},
368324
tslint: {
369325
build: {
370326
files: {
@@ -391,6 +347,10 @@ module.exports = function(grunt) {
391347
callback: assignGitSHA
392348
}
393349
},
350+
compileAll: "npm run compile-all",
351+
compileNodeTests: "npm run compile-node-tests",
352+
compileCheckBaseDts: "npm run compile-check-base-dts",
353+
compileCheckCombinedDts: "npm run compile-check-combined-dts",
394354
},
395355
simplemocha: {
396356
node: {
@@ -422,7 +382,6 @@ module.exports = function(grunt) {
422382

423383
grunt.loadNpmTasks("grunt-contrib-clean");
424384
grunt.loadNpmTasks("grunt-contrib-copy");
425-
grunt.loadNpmTasks("grunt-ts");
426385
grunt.loadNpmTasks("grunt-tslint");
427386
grunt.loadNpmTasks("grunt-exec");
428387
grunt.loadNpmTasks("grunt-shell");
@@ -437,8 +396,8 @@ module.exports = function(grunt) {
437396
]);
438397

439398
grunt.registerTask("compile-ts", [
440-
"ts:buildDts",
441-
"ts:build",
399+
"shell:compileCheckBaseDts",
400+
"shell:compileAll",
442401
"clean:typeScriptLeftovers",
443402
"copy:childPackageFiles"
444403
]);
@@ -499,12 +458,12 @@ module.exports = function(grunt) {
499458
"copy:definitionFiles",
500459
"copy:jsLibs",
501460
"generate-tns-core-modules-dts",
502-
"ts:testCombinedDts",
461+
"shell:compileCheckCombinedDts",
503462
]);
504463

505464
grunt.registerTask("node-tests", [
506465
"clean:nodeTests",
507-
"ts:buildNodeTests",
466+
"shell:compileNodeTests",
508467
"copy:childPackageFiles",
509468
"copy:jsLibs",
510469
"env:nodeTests",

node-tests/test-angular-xml.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {assert} from "chai";
2-
import * as xmlModule from "xml";
3-
var xml: typeof xmlModule = require("../tns-core-modules/xml");
2+
//TODO: use a path mapping to the "xml" module after upgrading to TS 2.1
3+
var xml = require("../tns-core-modules/xml");
44

55
describe("angular xml parser", () => {
66
let last_element = null;
77
let last_attrs = null;
88
let parser = null;
99

1010
beforeEach(() => {
11-
parser = new xml.XmlParser(function (event: xmlModule.ParserEvent) {
11+
parser = new xml.XmlParser(function (event) {
1212
switch (event.eventType) {
1313
case xml.ParserEventType.StartElement:
1414
last_element = event.elementName;

node-tests/test-xml.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {assert} from "chai";
2-
import * as xmlModule from "xml";
3-
var xml: typeof xmlModule = require("../tns-core-modules/xml");
2+
//TODO: use a path mapping to the "xml" module after upgrading to TS 2.1
3+
var xml = require("../tns-core-modules/xml");
44

55
describe("xml parser", () => {
66
let last_element = null;
@@ -9,7 +9,7 @@ describe("xml parser", () => {
99
let parser = null;
1010

1111
beforeEach(() => {
12-
parser = new xml.XmlParser(function (event: xmlModule.ParserEvent) {
12+
parser = new xml.XmlParser(function (event) {
1313
switch (event.eventType) {
1414
case xml.ParserEventType.StartElement:
1515
last_element = event.elementName;

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"grunt-exec": "1.0.1",
1818
"grunt-mkdir": "1.0.0",
1919
"grunt-shell": "2.1.0",
20-
"grunt-ts": "6.0.0-beta.11",
2120
"grunt-simple-mocha": "0.4.1",
2221
"grunt-tslint": "4.0.0",
2322
"grunt-typedoc": "0.2.4",
@@ -29,11 +28,15 @@
2928
"time-grunt": "1.3.0",
3029
"tslint": "^4.4.2",
3130
"typedoc": "0.4.5",
32-
"typescript": "~2.1.5"
31+
"typescript": "~2.0.10"
3332
},
3433
"scripts": {
3534
"setup": "npm run dev-link-tns-platform-declarations && npm run dev-link-tns-core-modules && npm run dev-link-tests && npm run dev-link-apps",
3635
"tsc": "tsc",
36+
"compile-all": "tsc -p tsconfig.json --outDir bin/dist",
37+
"compile-check-base-dts": "tsc -p tsconfig.base-dts.json",
38+
"compile-node-tests": "tsc -p tsconfig.node-tests.json --outDir bin/dist/node-tests",
39+
"compile-check-combined-dts": "tsc -p tsconfig.combined-dts.json",
3740
"tsc-w": "tsc --skipLibCheck -w",
3841
"dev-tsc-tns-platform-declarations": "tsc -p tns-platform-declarations",
3942
"dev-tsc-tests": "tsc -p tests",

tests/app/ui/animation/animation-tests.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {Label} from "ui/label";
55
import {StackLayout} from "ui/layouts/stack-layout";
66
import colorModule = require("color");
77
import enums = require("ui/enums");
8-
import { AnimationPromise } from "ui/animation";
98

109
// >> animation-require
1110
import animation = require("ui/animation");
@@ -106,7 +105,7 @@ export function test_CancellingAnimate(done) {
106105
}
107106
// << (hide)
108107
});
109-
(<AnimationPromise>animation1).cancel();
108+
animation1.cancel();
110109
// << animation-cancel2
111110
}
112111

@@ -485,4 +484,4 @@ function assertIOSNativeTransformIsCorrect(view: viewModule.View) {
485484
TKUnit.assert(false, errorMessage);
486485
}
487486
}
488-
}
487+
}

tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"version": "2.4.0"
1010
},
1111
"tns-android": {
12-
"version": "2.5.0"
12+
"version": "2.4.1"
1313
}
1414
},
1515
"dependencies": {
@@ -24,4 +24,4 @@
2424
"lazy": "1.0.11",
2525
"typescript": "~2.0.10"
2626
}
27-
}
27+
}

tests/references.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
/// <reference path="../tns-platform-declarations/ios.d.ts" />
33

44
/// <reference path="../tns-core-modules/tns-core-modules.d.ts" />
5+
/// <reference path="../tns-core-modules/lib.core.d.ts" />
6+
/// <reference path="../tns-core-modules/lib.dom.d.ts" />
7+
58
/// <reference path="../tns-core-modules/ui/styling/css-selector-parser.d.ts" />

tns-core-modules/declarations.d.ts

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,6 @@ declare class Headers {
4242
set(name: string, value: string): void;
4343
}
4444

45-
interface Blob {
46-
readonly size: number;
47-
readonly type: string;
48-
msClose(): void;
49-
msDetachStream(): any;
50-
slice(start?: number, end?: number, contentType?: string): Blob;
51-
}
52-
53-
declare var Blob: {
54-
prototype: Blob;
55-
new (blobParts?: any[], options?: BlobPropertyBag): Blob;
56-
}
57-
58-
interface BlobPropertyBag {
59-
type?: string;
60-
endings?: string;
61-
}
62-
6345
declare class Body {
6446
bodyUsed: boolean;
6547
/*
@@ -98,6 +80,10 @@ declare type RequestInfo = Request|string;
9880

9981
declare function fetch(url: string, init?: RequestInit): Promise<Response>;
10082

83+
interface XMLHttpRequest {
84+
send(data?: FormData): void;
85+
}
86+
10187
interface Console {
10288
time(reportName: string): void;
10389
timeEnd(reportName: string): void;
@@ -180,7 +166,3 @@ declare var exports: any;
180166
interface Array<T> {
181167
filter<U extends T>(pred: (a: T) => a is U): U[];
182168
}
183-
184-
//Dialogs
185-
declare function alert(message?: any): void;
186-
declare function confirm(message?: string): boolean;

tns-core-modules/es-collections.d.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/* tslint:disable */
2+
/////////////////////////////
3+
/// IE11 ECMAScript Extensions
4+
/////////////////////////////
5+
6+
interface List<T> extends Array<T> {}
7+
8+
interface Map<K, V> {
9+
clear(): void;
10+
delete(key: K): boolean;
11+
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
12+
get(key: K): V;
13+
has(key: K): boolean;
14+
set(key: K, value: V): Map<K, V>;
15+
size: number;
16+
keys(): Array<K>;
17+
values(): Array<V>;
18+
}
19+
declare var Map: {
20+
new <K, V>(): Map<K, V>;
21+
22+
// needed by Angular
23+
// alexeagle: PATCHED
24+
new<K, V>(m: Map<K, V>): Map<K, V>;
25+
new<K, V>(l: List<any>): Map<K, V>;
26+
prototype: Map<any, any>;
27+
}
28+
29+
//For compatibility - some libs insist on the Map/Set types being named that way
30+
declare type MapConstructor = typeof Map;
31+
declare type SetConstructor = typeof Set;
32+
33+
interface Set<T> {
34+
add(value: T): Set<T>;
35+
clear(): void;
36+
delete(value: T): boolean;
37+
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
38+
has(value: T): boolean;
39+
size: number;
40+
}
41+
declare var Set: {
42+
new <T>(): Set<T>;
43+
44+
// needed by Angular
45+
// alexeagle PATCHED
46+
new<T>(s: Set<T>): Set<T>;
47+
new<T>(l: List<T>): Set<T>;
48+
prototype: Set<any>;
49+
}
50+
51+
//Compatibility interfaces for rxjs
52+
interface IteratorResult<T> {
53+
done: boolean;
54+
value?: T;
55+
}
56+
57+
interface Iterator<T> {
58+
next(value?: any): IteratorResult<T>;
59+
return?(value?: any): IteratorResult<T>;
60+
throw?(e?: any): IteratorResult<T>;
61+
}

0 commit comments

Comments
 (0)