Skip to content

Commit 0739e7c

Browse files
authored
Merge pull request #448 from ivogabe/types
Update to @types
2 parents d3e4990 + 7cad2bb commit 0739e7c

24 files changed

+31
-2748
lines changed

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var tsOptions = {
3333
var tsProject = ts.createProject(tsOptions);
3434

3535
var paths = {
36-
scripts: ['lib/**.ts', 'typings/**/**.ts'],
36+
scripts: ['lib/**.ts'],
3737
definitionTypeScript: [findTSDefinition('typescript')],
3838
releaseBeta: 'release-2',
3939
release: 'release'

lib/main.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/// <reference path="../typings/tsd.d.ts" />
2-
31
import * as ts from 'typescript';
42
import * as fs from 'fs';
53
import * as path from 'path';
@@ -51,7 +49,7 @@ function getTypeScript(typescript: typeof ts) {
5149

5250
function getCompilerOptions(settings: compile.Settings, projectPath: string, configFileName: string): ts.CompilerOptions {
5351
let typescript = getTypeScript(settings.typescript);
54-
52+
5553
if (settings.sourceRoot !== undefined) {
5654
console.warn('gulp-typescript: sourceRoot isn\'t supported any more. Use sourceRoot option of gulp-sourcemaps instead.')
5755
}
@@ -66,7 +64,7 @@ function getCompilerOptions(settings: compile.Settings, projectPath: string, con
6664
"your project might work without it",
6765
"The non-standard option sortOutput has been removed as of gulp-typescript 3.0.\nYour project will probably compile without this option.\nOtherwise, if you're using gulp-concat, you should remove gulp-concat and use the outFile option instead.");
6866
}
69-
67+
7068
// Copy settings and remove several options
7169
const newSettings: compile.Settings = {};
7270
for (const option of Object.keys(settings)) {
@@ -81,10 +79,10 @@ function getCompilerOptions(settings: compile.Settings, projectPath: string, con
8179
option === 'inlineSourceMap' ||
8280
option === 'sourceRoot' ||
8381
option === 'inlineSources') continue;
84-
82+
8583
newSettings[option] = settings[option];
8684
}
87-
85+
8886
const result = typescript.convertCompilerOptionsFromJson(newSettings, projectPath, configFileName);
8987
const reporter = _reporter.defaultReporter();
9088
for (const error of result.errors) {

lib/output.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class Output {
5555

5656
const map = JSON.parse(sourceMapContent);
5757
const directory = path.dirname(output.path);
58-
58+
5959
// gulp-sourcemaps docs:
6060
// paths in the generated source map (`file` and `sources`) are relative to `file.base` (e.g. use `file.relative`).
6161
map.file = utils.forwardSlashes(output.relative);
@@ -69,7 +69,7 @@ export class Output {
6969
? this.project.input.getFileNames(true).map(fName => this.project.input.getFile(fName))
7070
: [original];
7171

72-
72+
7373
for (const sourceFile of sourceMapOrigins) {
7474
if (!sourceFile || !sourceFile.gulp || !sourceFile.gulp.sourceMap) continue;
7575

@@ -113,7 +113,7 @@ export class Output {
113113
private getError(info: ts.Diagnostic): reporter.TypeScriptError {
114114
let fileName = info.file && info.file.fileName;
115115
const file = fileName && this.project.input.getFile(fileName);
116-
116+
117117
return utils.getError(info, this.project.typescript, file);
118118
}
119119
diagnostic(info: ts.Diagnostic) {

lib/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ export interface RawSourceMap {
2525
version: string;
2626
sources: string[];
2727
names: string[];
28-
sourcesContent?: string;
28+
sourcesContent?: string[];
2929
mappings: string;
3030
}

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@
5656
"main": "release/main.js",
5757
"typings": "release/main.d.ts",
5858
"dependencies": {
59+
"@types/chalk": "^0.4.31",
60+
"@types/gulp-util": "^3.0.29",
61+
"@types/node": "*",
62+
"@types/source-map": "^0.1.28",
63+
"@types/through2": "^2.0.31",
64+
"@types/vinyl": "^1.2.30",
65+
"@types/vinyl-fs": "0.0.28",
5966
"gulp-util": "~3.0.7",
6067
"source-map": "~0.5.3",
6168
"through2": "~2.0.1",

release/main.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/// <reference path="../typings/tsd.d.ts" />
21
import * as ts from 'typescript';
32
import * as _project from './project';
43
import * as _reporter from './reporter';
@@ -34,6 +33,10 @@ declare module compile {
3433
typescript?: typeof ts;
3534
isolatedModules?: boolean;
3635
rootDir?: string;
36+
rootDirs?: any;
37+
lib?: string[];
38+
experimentalDecorators?: boolean;
39+
[name: string]: any;
3740
sourceRoot?: string;
3841
}
3942
type Project = _project.Project;

release/main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/// <reference path="../typings/tsd.d.ts" />
21
"use strict";
32
var fs = require('fs');
43
var path = require('path');

release/output.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/// <reference types="node" />
12
import * as stream from 'stream';
23
import * as ts from 'typescript';
34
import * as input from './input';

release/project.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/// <reference types="node" />
12
import * as stream from 'stream';
23
import * as ts from 'typescript';
34
import { Reporter } from './reporter';

release/reporter.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/// <reference types="node" />
12
import * as ts from 'typescript';
23
import { VinylFile } from './types';
34
export interface TypeScriptError extends Error {

release/reporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function fullReporter(fullFilename) {
7575
+ ' ' + gutil.colors.red(typescript.flattenDiagnosticMessageText(error.diagnostic.messageText, '\n')));
7676
if (error.tsFile) {
7777
console.error('> ' + gutil.colors.gray('file: ') + (fullFilename ? error.fullFilename : error.relativeFilename) + gutil.colors.gray(':'));
78-
var lines_1 = error.tsFile.text.split(/(\r\n|\r|\n)/);
78+
var lines_1 = error.tsFile.text.split(/(?:\r\n|\r|\n)/);
7979
var logLine = function (lineIndex, errorStart, errorEnd) {
8080
var line = lines_1[lineIndex];
8181
if (errorEnd === undefined)

release/types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ export interface RawSourceMap {
2323
version: string;
2424
sources: string[];
2525
names: string[];
26-
sourcesContent?: string;
26+
sourcesContent?: string[];
2727
mappings: string;
2828
}

test/base/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"compilerOptions": {
3-
"noLib": true
3+
"noLib": true,
4+
"types": []
45
}
56
}

test/bom/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"compilerOptions": {
3-
"module": "amd"
3+
"module": "amd",
4+
"types": []
45
},
56
"files": [
67
"test-bom.ts"

test/out/gulptask.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ module.exports = function(newTS, lib, output, reporter) {
88
declarationFiles: true,
99
out: 'concat.js',
1010
typescript: lib,
11-
target: 'es6'
11+
target: 'es6',
12+
types: []
1213
}, reporter));
1314
tsResult.dts.pipe(gulp.dest(output + '/dts'));
1415
return tsResult.js

tsd.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

typings/chalk/chalk.d.ts

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)