Skip to content

Commit

Permalink
Merge pull request #448 from ivogabe/types
Browse files Browse the repository at this point in the history
Update to @types
  • Loading branch information
ivogabe committed Oct 26, 2016
2 parents d3e4990 + 7cad2bb commit 0739e7c
Show file tree
Hide file tree
Showing 24 changed files with 31 additions and 2,748 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var tsOptions = {
var tsProject = ts.createProject(tsOptions);

var paths = {
scripts: ['lib/**.ts', 'typings/**/**.ts'],
scripts: ['lib/**.ts'],
definitionTypeScript: [findTSDefinition('typescript')],
releaseBeta: 'release-2',
release: 'release'
Expand Down
10 changes: 4 additions & 6 deletions lib/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference path="../typings/tsd.d.ts" />

import * as ts from 'typescript';
import * as fs from 'fs';
import * as path from 'path';
Expand Down Expand Up @@ -51,7 +49,7 @@ function getTypeScript(typescript: typeof ts) {

function getCompilerOptions(settings: compile.Settings, projectPath: string, configFileName: string): ts.CompilerOptions {
let typescript = getTypeScript(settings.typescript);

if (settings.sourceRoot !== undefined) {
console.warn('gulp-typescript: sourceRoot isn\'t supported any more. Use sourceRoot option of gulp-sourcemaps instead.')
}
Expand All @@ -66,7 +64,7 @@ function getCompilerOptions(settings: compile.Settings, projectPath: string, con
"your project might work without it",
"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.");
}

// Copy settings and remove several options
const newSettings: compile.Settings = {};
for (const option of Object.keys(settings)) {
Expand All @@ -81,10 +79,10 @@ function getCompilerOptions(settings: compile.Settings, projectPath: string, con
option === 'inlineSourceMap' ||
option === 'sourceRoot' ||
option === 'inlineSources') continue;

newSettings[option] = settings[option];
}

const result = typescript.convertCompilerOptionsFromJson(newSettings, projectPath, configFileName);
const reporter = _reporter.defaultReporter();
for (const error of result.errors) {
Expand Down
6 changes: 3 additions & 3 deletions lib/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class Output {

const map = JSON.parse(sourceMapContent);
const directory = path.dirname(output.path);

// gulp-sourcemaps docs:
// paths in the generated source map (`file` and `sources`) are relative to `file.base` (e.g. use `file.relative`).
map.file = utils.forwardSlashes(output.relative);
Expand All @@ -69,7 +69,7 @@ export class Output {
? this.project.input.getFileNames(true).map(fName => this.project.input.getFile(fName))
: [original];


for (const sourceFile of sourceMapOrigins) {
if (!sourceFile || !sourceFile.gulp || !sourceFile.gulp.sourceMap) continue;

Expand Down Expand Up @@ -113,7 +113,7 @@ export class Output {
private getError(info: ts.Diagnostic): reporter.TypeScriptError {
let fileName = info.file && info.file.fileName;
const file = fileName && this.project.input.getFile(fileName);

return utils.getError(info, this.project.typescript, file);
}
diagnostic(info: ts.Diagnostic) {
Expand Down
2 changes: 1 addition & 1 deletion lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ export interface RawSourceMap {
version: string;
sources: string[];
names: string[];
sourcesContent?: string;
sourcesContent?: string[];
mappings: string;
}
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
"main": "release/main.js",
"typings": "release/main.d.ts",
"dependencies": {
"@types/chalk": "^0.4.31",
"@types/gulp-util": "^3.0.29",
"@types/node": "*",
"@types/source-map": "^0.1.28",
"@types/through2": "^2.0.31",
"@types/vinyl": "^1.2.30",
"@types/vinyl-fs": "0.0.28",
"gulp-util": "~3.0.7",
"source-map": "~0.5.3",
"through2": "~2.0.1",
Expand Down
5 changes: 4 additions & 1 deletion release/main.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference path="../typings/tsd.d.ts" />
import * as ts from 'typescript';
import * as _project from './project';
import * as _reporter from './reporter';
Expand Down Expand Up @@ -34,6 +33,10 @@ declare module compile {
typescript?: typeof ts;
isolatedModules?: boolean;
rootDir?: string;
rootDirs?: any;
lib?: string[];
experimentalDecorators?: boolean;
[name: string]: any;
sourceRoot?: string;
}
type Project = _project.Project;
Expand Down
1 change: 0 additions & 1 deletion release/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference path="../typings/tsd.d.ts" />
"use strict";
var fs = require('fs');
var path = require('path');
Expand Down
1 change: 1 addition & 0 deletions release/output.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="node" />
import * as stream from 'stream';
import * as ts from 'typescript';
import * as input from './input';
Expand Down
1 change: 1 addition & 0 deletions release/project.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="node" />
import * as stream from 'stream';
import * as ts from 'typescript';
import { Reporter } from './reporter';
Expand Down
1 change: 1 addition & 0 deletions release/reporter.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="node" />
import * as ts from 'typescript';
import { VinylFile } from './types';
export interface TypeScriptError extends Error {
Expand Down
2 changes: 1 addition & 1 deletion release/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function fullReporter(fullFilename) {
+ ' ' + gutil.colors.red(typescript.flattenDiagnosticMessageText(error.diagnostic.messageText, '\n')));
if (error.tsFile) {
console.error('> ' + gutil.colors.gray('file: ') + (fullFilename ? error.fullFilename : error.relativeFilename) + gutil.colors.gray(':'));
var lines_1 = error.tsFile.text.split(/(\r\n|\r|\n)/);
var lines_1 = error.tsFile.text.split(/(?:\r\n|\r|\n)/);
var logLine = function (lineIndex, errorStart, errorEnd) {
var line = lines_1[lineIndex];
if (errorEnd === undefined)
Expand Down
2 changes: 1 addition & 1 deletion release/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ export interface RawSourceMap {
version: string;
sources: string[];
names: string[];
sourcesContent?: string;
sourcesContent?: string[];
mappings: string;
}
3 changes: 2 additions & 1 deletion test/base/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"noLib": true
"noLib": true,
"types": []
}
}
3 changes: 2 additions & 1 deletion test/bom/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "amd"
"module": "amd",
"types": []
},
"files": [
"test-bom.ts"
Expand Down
3 changes: 2 additions & 1 deletion test/out/gulptask.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ module.exports = function(newTS, lib, output, reporter) {
declarationFiles: true,
out: 'concat.js',
typescript: lib,
target: 'es6'
target: 'es6',
types: []
}, reporter));
tsResult.dts.pipe(gulp.dest(output + '/dts'));
return tsResult.js
Expand Down
30 changes: 0 additions & 30 deletions tsd.json

This file was deleted.

93 changes: 0 additions & 93 deletions typings/chalk/chalk.d.ts

This file was deleted.

Loading

0 comments on commit 0739e7c

Please sign in to comment.