aboutsummaryrefslogtreecommitdiff
path: root/node_modules/gulp-typescript
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/gulp-typescript
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
downloadwallet-core-bbff7403fbf46f9ad92240ac213df8d30ef31b64.tar.xz
update packages
Diffstat (limited to 'node_modules/gulp-typescript')
-rw-r--r--node_modules/gulp-typescript/.gitmodules10
-rw-r--r--node_modules/gulp-typescript/.npmignore8
-rw-r--r--node_modules/gulp-typescript/.travis.yml4
-rw-r--r--node_modules/gulp-typescript/package.json49
-rw-r--r--node_modules/gulp-typescript/readme.md67
-rw-r--r--node_modules/gulp-typescript/release/compiler.d.ts13
-rw-r--r--node_modules/gulp-typescript/release/compiler.js189
-rw-r--r--node_modules/gulp-typescript/release/host.d.ts1
-rw-r--r--node_modules/gulp-typescript/release/host.js60
-rw-r--r--node_modules/gulp-typescript/release/input.d.ts15
-rw-r--r--node_modules/gulp-typescript/release/input.js218
-rw-r--r--node_modules/gulp-typescript/release/main.d.ts1
-rw-r--r--node_modules/gulp-typescript/release/main.js67
-rw-r--r--node_modules/gulp-typescript/release/output.d.ts12
-rw-r--r--node_modules/gulp-typescript/release/output.js210
-rw-r--r--node_modules/gulp-typescript/release/project.d.ts5
-rw-r--r--node_modules/gulp-typescript/release/project.js123
-rw-r--r--node_modules/gulp-typescript/release/reporter.d.ts7
-rw-r--r--node_modules/gulp-typescript/release/reporter.js70
-rw-r--r--node_modules/gulp-typescript/release/types.d.ts23
-rw-r--r--node_modules/gulp-typescript/release/utils.d.ts1
-rw-r--r--node_modules/gulp-typescript/release/utils.js47
22 files changed, 625 insertions, 575 deletions
diff --git a/node_modules/gulp-typescript/.gitmodules b/node_modules/gulp-typescript/.gitmodules
index f9d899281..34fb8eee9 100644
--- a/node_modules/gulp-typescript/.gitmodules
+++ b/node_modules/gulp-typescript/.gitmodules
@@ -5,3 +5,13 @@
[submodule "typescript/2.3"]
path = typescript/2.3
url = https://github.com/Microsoft/TypeScript.git
+[submodule "2.9"]
+ path = 2.9
+ url = https://github.com/Microsoft/TypeScript
+[submodule "typescript/2.9"]
+ path = typescript/2.9
+ url = https://github.com/Microsoft/TypeScript
+[submodule "typescript/2.7"]
+ path = typescript/2.7
+ url = https://github.com/Microsoft/TypeScript.git
+ branch = release-2.7
diff --git a/node_modules/gulp-typescript/.npmignore b/node_modules/gulp-typescript/.npmignore
deleted file mode 100644
index d41b8095b..000000000
--- a/node_modules/gulp-typescript/.npmignore
+++ /dev/null
@@ -1,8 +0,0 @@
-definitions
-gulpfile.js
-lib
-release-2
-test
-typescript
-typings
-.vscode \ No newline at end of file
diff --git a/node_modules/gulp-typescript/.travis.yml b/node_modules/gulp-typescript/.travis.yml
index 6e3d5dc54..947f27fa8 100644
--- a/node_modules/gulp-typescript/.travis.yml
+++ b/node_modules/gulp-typescript/.travis.yml
@@ -1,6 +1,6 @@
language: node_js
node_js:
- - "0.12"
- - "0.10"
+ - "node"
+ - "lts/*"
notifications:
email: false
diff --git a/node_modules/gulp-typescript/package.json b/node_modules/gulp-typescript/package.json
index e11f56693..ae3d50c7d 100644
--- a/node_modules/gulp-typescript/package.json
+++ b/node_modules/gulp-typescript/package.json
@@ -1,6 +1,6 @@
{
"name": "gulp-typescript",
- "version": "3.2.3",
+ "version": "5.0.0-alpha.3",
"description": "A typescript compiler for gulp with incremental compilation support.",
"homepage": "https://github.com/ivogabe/gulp-typescript",
"bugs": "https://github.com/ivogabe/gulp-typescript/issues",
@@ -51,37 +51,42 @@
{
"name": "Yui Tanglertsampan",
"email": "yuisu@microsoft.com"
+ },
+ {
+ "name": "Rogier Schouten",
+ "email": "github@workingcode.ninja"
}
],
"main": "release/main.js",
"types": "release/main.d.ts",
"typings": "release/main.d.ts",
"dependencies": {
- "gulp-util": "~3.0.7",
- "source-map": "~0.5.3",
- "through2": "~2.0.1",
- "vinyl-fs": "~2.4.3"
+ "ansi-colors": "^2.0.2",
+ "plugin-error": "^1.0.1",
+ "source-map": "^0.7.3",
+ "through2": "^2.0.3",
+ "vinyl-fs": "^3.0.3",
+ "vinyl": "^2.1.0"
},
"devDependencies": {
- "@types/chalk": "0.4.31",
- "@types/gulp-util": "3.0.31",
- "@types/node": "7.0.22",
- "@types/source-map": "0.5.0",
- "@types/through2": "2.0.33",
- "@types/vinyl": "2.0.0",
- "@types/vinyl-fs": "2.4.5",
- "gulp": "~3.9.1",
- "gulp-concat": "~2.6.0",
- "gulp-diff": "~1.0.0",
- "gulp-header": "~1.7.1",
- "gulp-plumber": "~1.1.0",
- "gulp-sourcemaps": "~1.6.0",
- "merge-stream": "~1.0.0",
- "rimraf": "~2.5.2",
- "typescript": "2.4.1"
+ "@types/node": "^8.5.2",
+ "@types/plugin-error": "^0.1.0",
+ "@types/source-map": "^0.5.2",
+ "@types/through2": "^2.0.33",
+ "@types/vinyl": "^2.0.2",
+ "@types/vinyl-fs": "^2.4.8",
+ "gulp": "^4.0.0",
+ "gulp-concat": "^2.6.1",
+ "gulp-diff": "^1.0.0",
+ "gulp-header": "^2.0.5",
+ "gulp-plumber": "^1.2.0",
+ "gulp-sourcemaps": "^2.6.4",
+ "merge-stream": "^1.0.1",
+ "rimraf": "^2.6.2",
+ "typescript": "^3.0.0-dev.20180609"
},
"peerDependencies": {
- "typescript": "~2.0.3 || >=2.0.0-dev || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev"
+ "typescript": "~2.7.1 || >=2.8.0-dev || >=2.9.0-dev || ~3.0.0 || >=3.0.0-dev || >=3.1.0-dev"
},
"scripts": {
"test": "gulp"
diff --git a/node_modules/gulp-typescript/readme.md b/node_modules/gulp-typescript/readme.md
index 41bf62b4b..808254310 100644
--- a/node_modules/gulp-typescript/readme.md
+++ b/node_modules/gulp-typescript/readme.md
@@ -56,11 +56,21 @@ Almost all options from TypeScript are supported.
See the [TypeScript wiki](https://www.typescriptlang.org/docs/handbook/compiler-options.html) for a complete list.
These options are not supported:
-- Sourcemap options (`sourceMap`, `inlineSourceMap`, `inlineSources`, `sourceRoot`) - Use [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) instead.
+- Sourcemap options (`sourceMap`, `inlineSourceMap`, `inlineSources`, `sourceRoot`, `declarationMap`) - Use [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) instead.
- `watch` - Use `gulp.watch` instead. See the paragraph "Incremental compilation".
- `project` - See "Using `tsconfig.json`".
- Obvious: `help`, `version`
+API overview
+------------
+gulp-typescript can be imported using `const ts = require('gulp-typescript');`. It provides the following functions:
+
+- `ts(options?)` - Returns a gulp stream that compiles TypeScript files using the specified options.
+- `ts.createProject(options?)`, `ts.createProject(tsconfig filename, options?)` - Returns a project. The intended usage is to create a project outside of a task with `const tsProject = ts.createProject(..);`. Within a task, `tsProject()` can be used to compile a stream of TypeScript files.
+- `tsProject.src()` - Returns a stream containing the source files (.ts) from a tsconfig file. It can only be used if you create a project with a `tsconfig.json` file. It is a replacement for `gulp.src(..)`.
+
+Both `ts(..)` and `tsProject()` provide sub-streams that only contain the JavaScript or declaration files. An example is shown later in the readme.
+
Basic Usage
----------
Below is a minimal `gulpfile.js` which will compile all TypeScript file in folder `src` and emit a single output file called `output.js` in `built/local`. To invoke, simple run `gulp`.
@@ -100,11 +110,11 @@ gulp.task('scripts', function() {
In many situations, some plugins need to be executed on the JavaScript files.
For these situations, the stream has sub-streams, namely a JavaScript stream (`tsResult.js`) and a definition file stream (`tsResult.dts`).
You need to set the `declaration` option to generate definition files.
-If you don't need the definition files, you can use a configuration as seen in the first example.
+If you don't need the definition files, you can use a configuration as seen in the first example, and you don't need to store the result into a variable as `tsResult`.
Incremental compilation
-----------------------
-Instead of calling `ts(options)`, you can create a project first, and then call `tsProject()`. An example:
+Instead of calling `ts(options)`, you can create a project first outside of the task. Inside the task, you should then use `tsProject()`. An example:
```javascript
var gulp = require('gulp');
var ts = require('gulp-typescript');
@@ -115,13 +125,9 @@ var tsProject = ts.createProject({
});
gulp.task('scripts', function() {
- var tsResult = gulp.src('lib/*.ts')
- .pipe(tsProject());
-
- return merge([ // Merge the two output streams, so this task is finished when the IO of both operations is done.
- tsResult.dts.pipe(gulp.dest('release/definitions')),
- tsResult.js.pipe(gulp.dest('release/js'))
- ]);
+ return gulp.src('lib/*.ts')
+ .pipe(tsProject())
+ .pipe(gulp.dest('dist'));
});
gulp.task('watch', ['scripts'], function() {
@@ -131,7 +137,7 @@ gulp.task('watch', ['scripts'], function() {
When you run `gulp watch`, the source will be compiled as usual. Then, when you make a change and save the file, your TypeScript files will be compiled in about half the time.
You must create the project outside of the task. You can't use the same project in multiple tasks.
-Instead, create multiple projects or use a single task to compile your sources.
+Instead, create multiple projects or use a single task to compile your sources. Usually it is not worth to create different tasks for the client side, backend or tests.
Using `tsconfig.json`
-------------
@@ -175,8 +181,9 @@ var tsProject = ts.createProject('tsconfig.json', {
Source maps
----------
-Example of ```gulpfile.js``` which will compile typescript to javascript as well as generate
-associated sourcemap.
+gulp-typescript supports source maps by the usage of the gulp-sourcemaps plugin. It works for both JavaScript and definition (`.d.ts`) files. You don't have to set `sourceMap` or `declarationMap` in your configuration. When you use gulp-sourcemaps, they will be generated automatically.
+
+Configuring the paths of source maps can be hard. The easiest way to get working source maps is to inline the sources of your TypeScript files in the source maps. This will of course increase the size of the source maps. The following example demonstrates this approach:
```javascript
var gulp = require('gulp')
@@ -184,23 +191,45 @@ var ts = require('gulp-typescript');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('scripts', function() {
- var tsResult = gulp.src('lib/*.ts')
+ return gulp.src('lib/*.ts')
.pipe(sourcemaps.init()) // This means sourcemaps will be generated
.pipe(ts({
// ...
- }));
-
- return tsResult.js
+ }))
.pipe( ... ) // You can use other plugins that also support gulp-sourcemaps
.pipe(sourcemaps.write()) // Now the sourcemaps are added to the .js file
- .pipe(gulp.dest('release/js'));
+ .pipe(gulp.dest('dist'));
});
```
+
+When you are not inlining the source content, you should specify the `sourceRoot` property. It can be configured with the following rule:
+
+- If you don't provide the `outDir` option to TypeScript, the `sourceRoot` option of gulp-sourcemaps should be the relative path from the `gulp.dest` path to the source directory (from `gulp.src`)
+- If you set the `outDir` option to the same value as the directory in `gulp.dest`, you should set the `sourceRoot` to `./`.
+- If you set the `outDir` option to a different value, there is no easy rule to configure gulp-sourcemaps. I'd advise to change the value of outDir if possible.
+
+Furthermore you should set `includeContent: false`. Here's an example where `outDir` isn't set:
+```js
+gulp.task('scripts', function() {
+ return gulp.src('lib/*.ts')
+ .pipe(sourcemaps.init())
+ .pipe(ts({
+ // ...
+ }))
+ .pipe(sourcemaps.write('.', { includeContent: false, sourceRoot: '../lib' }))
+ .pipe(gulp.dest('dist'));
+});
+```
+
+Some examples can be found in [ivogabe/gulp-typescript-sourcemaps-demo](https://github.com/ivogabe/gulp-typescript-sourcemaps-demo).
+
For more information, see [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps).
Reporters
---------
-You can specify a custom reporter as the second argument of the main function, or as the only argument when using a `tsProject`:
+By default, errors are logged to the console and the build crashes on compiler errors. In watch mode, the build does not throw, meaning that consequent builds are still ran. If you do not want to crash the gulp process, you must catch the error. You then need to add `.on('error', () => {})` after `.pipe(tsProject())` or `.pipe(ts(..))`.
+
+If you want to change the way that messages are logged to the console (or some other output), you can provide a reporter. You can specify a custom reporter as the second argument of the main function, or as the only argument when using a `tsProject`:
```javascript
ts(options, reporter);
tsProject(reporter);
diff --git a/node_modules/gulp-typescript/release/compiler.d.ts b/node_modules/gulp-typescript/release/compiler.d.ts
index 62685b46c..63f6bff7d 100644
--- a/node_modules/gulp-typescript/release/compiler.d.ts
+++ b/node_modules/gulp-typescript/release/compiler.d.ts
@@ -18,11 +18,11 @@ export declare class ProjectCompiler implements ICompiler {
prepare(project: ProjectInfo): void;
inputFile(file: File): void;
inputDone(): void;
- private attachContentToFile(file, fileName, content);
- private emit(result, callback);
- private emitFile({file, jsFileName, dtsFileName, jsContent, dtsContent, jsMapContent}, currentDirectory);
- private reportDiagnostics(diagnostics);
- private removeSourceMapComment(content);
+ private attachContentToFile;
+ private emit;
+ private emitFile;
+ private reportDiagnostics;
+ private removeSourceMapComment;
}
export declare class FileCompiler implements ICompiler {
host: Host;
@@ -31,7 +31,8 @@ export declare class FileCompiler implements ICompiler {
private previousOutput;
private compilationResult;
prepare(project: ProjectInfo): void;
- private write(file, fileName, diagnostics, content, sourceMap);
+ private write;
inputFile(file: File): void;
inputDone(): void;
}
+//# sourceMappingURL=compiler.d.ts.map \ No newline at end of file
diff --git a/node_modules/gulp-typescript/release/compiler.js b/node_modules/gulp-typescript/release/compiler.js
index 982448679..5e3c37620 100644
--- a/node_modules/gulp-typescript/release/compiler.js
+++ b/node_modules/gulp-typescript/release/compiler.js
@@ -1,42 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-var path = require("path");
-var input_1 = require("./input");
-var host_1 = require("./host");
-var reporter_1 = require("./reporter");
-var utils = require("./utils");
+const path = require("path");
+const input_1 = require("./input");
+const host_1 = require("./host");
+const reporter_1 = require("./reporter");
+const utils = require("./utils");
/**
* Compiles a whole project, with full type checking
*/
-var ProjectCompiler = (function () {
- function ProjectCompiler() {
- }
- ProjectCompiler.prototype.prepare = function (project) {
+class ProjectCompiler {
+ prepare(project) {
this.project = project;
this.hasSourceMap = false;
- };
- ProjectCompiler.prototype.inputFile = function (file) {
+ }
+ inputFile(file) {
if (file.gulp.sourceMap)
this.hasSourceMap = true;
- };
- ProjectCompiler.prototype.inputDone = function () {
- var _this = this;
+ }
+ inputDone() {
if (!this.project.input.firstSourceFile) {
- this.project.output.finish(reporter_1.emptyCompilationResult());
+ this.project.output.finish(reporter_1.emptyCompilationResult(this.project.options.noEmit));
return;
}
- var rootFilenames = this.project.input.getFileNames(true);
+ const rootFilenames = this.project.input.getFileNames(true);
if (!this.project.singleOutput) {
if (this.project.options.rootDir === undefined) {
- this.project.options.rootDir = utils.getCommonBasePathOfArray(rootFilenames.filter(function (fileName) { return fileName.substr(-5) !== ".d.ts"; })
- .map(function (fileName) { return _this.project.input.getFile(fileName).gulp.base; }));
+ this.project.options.rootDir = utils.getCommonBasePathOfArray(rootFilenames.filter(fileName => fileName.substr(-5) !== ".d.ts")
+ .map(fileName => this.project.input.getFile(fileName).gulp.base));
}
}
this.project.options.sourceMap = this.hasSourceMap;
- var currentDirectory = utils.getCommonBasePathOfArray(rootFilenames.map(function (fileName) { return _this.project.input.getFile(fileName).gulp.cwd; }));
+ const currentDirectory = utils.getCommonBasePathOfArray(rootFilenames.map(fileName => this.project.input.getFile(fileName).gulp.cwd));
this.host = new host_1.Host(this.project.typescript, currentDirectory, this.project.input, this.project.options);
- this.program = this.project.typescript.createProgram(rootFilenames, this.project.options, this.host, this.program);
- var result = reporter_1.emptyCompilationResult();
+ // Calling `createProgram` with an object is only supported in 3.0. Only call this overload
+ // if we have project references (also only supported in 3.0)
+ this.program = this.project.projectReferences
+ ? this.project.typescript.createProgram({
+ rootNames: rootFilenames,
+ options: this.project.options,
+ projectReferences: this.project.projectReferences,
+ host: this.host,
+ oldProgram: this.program
+ })
+ : this.project.typescript.createProgram(rootFilenames, this.project.options, this.host, this.program);
+ const result = reporter_1.emptyCompilationResult(this.project.options.noEmit);
result.optionsErrors = this.reportDiagnostics(this.program.getOptionsDiagnostics());
result.syntaxErrors = this.reportDiagnostics(this.program.getSyntacticDiagnostics());
result.globalErrors = this.reportDiagnostics(this.program.getGlobalDiagnostics());
@@ -45,47 +52,51 @@ var ProjectCompiler = (function () {
result.declarationErrors = this.program.getDeclarationDiagnostics().length;
}
if (this.project.singleOutput) {
- var output_1 = {
+ const output = {
file: undefined
};
- this.emit(result, function (fileName, content) {
- _this.attachContentToFile(output_1, fileName, content);
+ this.emit(result, (fileName, content) => {
+ this.attachContentToFile(output, fileName, content);
});
- this.emitFile(output_1, currentDirectory);
+ this.emitFile(output, currentDirectory);
}
else {
- var output_2 = {};
- var input = this.host.input.getFileNames(true);
- for (var i = 0; i < input.length; i++) {
- var fileName = utils.normalizePath(input[i]);
- var file = this.project.input.getFile(fileName);
- output_2[fileName] = { file: file };
+ const output = {};
+ const input = this.host.input.getFileNames(true);
+ for (let i = 0; i < input.length; i++) {
+ const fileName = utils.normalizePath(input[i]);
+ const file = this.project.input.getFile(fileName);
+ output[fileName] = { file };
}
- this.emit(result, function (fileName, content, writeByteOrderMark, onError, sourceFiles) {
+ this.emit(result, (fileName, content, writeByteOrderMark, onError, sourceFiles) => {
if (sourceFiles.length !== 1) {
throw new Error("Failure: sourceFiles in WriteFileCallback should have length 1, got " + sourceFiles.length);
}
- var fileNameOriginal = utils.normalizePath(sourceFiles[0].fileName);
- var file = output_2[fileNameOriginal];
+ const fileNameOriginal = utils.normalizePath(sourceFiles[0].fileName);
+ const file = output[fileNameOriginal];
if (!file)
return;
- _this.attachContentToFile(file, fileName, content);
+ this.attachContentToFile(file, fileName, content);
});
- for (var i = 0; i < input.length; i++) {
- var fileName = utils.normalizePath(input[i]);
- this.emitFile(output_2[fileName], currentDirectory);
+ for (let i = 0; i < input.length; i++) {
+ const fileName = utils.normalizePath(input[i]);
+ this.emitFile(output[fileName], currentDirectory);
}
}
this.project.output.finish(result);
- };
- ProjectCompiler.prototype.attachContentToFile = function (file, fileName, content) {
- var _a = utils.splitExtension(fileName, ['d.ts']), extension = _a[1];
+ }
+ attachContentToFile(file, fileName, content) {
+ const [, extension] = utils.splitExtension(fileName, ['d.ts', 'd.ts.map']);
switch (extension) {
case 'js':
case 'jsx':
file.jsFileName = fileName;
file.jsContent = content;
break;
+ case 'd.ts.map':
+ file.dtsMapFileName = fileName;
+ file.dtsMapContent = content;
+ break;
case 'd.ts':
file.dtsFileName = fileName;
file.dtsContent = content;
@@ -94,28 +105,27 @@ var ProjectCompiler = (function () {
file.jsMapContent = content;
break;
}
- };
- ProjectCompiler.prototype.emit = function (result, callback) {
- var emitOutput = this.program.emit(undefined, callback);
+ }
+ emit(result, callback) {
+ const emitOutput = this.program.emit(undefined, callback);
result.emitErrors += emitOutput.diagnostics.length;
this.reportDiagnostics(emitOutput.diagnostics);
result.emitSkipped = emitOutput.emitSkipped;
- };
- ProjectCompiler.prototype.emitFile = function (_a, currentDirectory) {
- var file = _a.file, jsFileName = _a.jsFileName, dtsFileName = _a.dtsFileName, jsContent = _a.jsContent, dtsContent = _a.dtsContent, jsMapContent = _a.jsMapContent;
+ }
+ emitFile({ file, jsFileName, dtsFileName, dtsMapFileName, jsContent, dtsContent, dtsMapContent, jsMapContent }, currentDirectory) {
if (!jsFileName)
return;
- var base;
- var baseDeclarations;
+ let base;
+ let baseDeclarations;
if (file) {
base = file.gulp.base;
if (this.project.options.outDir) {
- var baseRelative = path.relative(this.project.options.rootDir, base);
+ const baseRelative = path.relative(this.project.options.rootDir, base);
base = path.join(this.project.options.outDir, baseRelative);
}
baseDeclarations = base;
if (this.project.options.declarationDir) {
- var baseRelative = path.relative(this.project.options.rootDir, file.gulp.base);
+ const baseRelative = path.relative(this.project.options.rootDir, file.gulp.base);
baseDeclarations = path.join(this.project.options.declarationDir, baseRelative);
}
}
@@ -124,9 +134,12 @@ var ProjectCompiler = (function () {
baseDeclarations = base;
}
else {
- var outFile = this.project.options.out;
- base = jsFileName.substring(0, jsFileName.length - outFile.length);
+ base = this.project.directory;
baseDeclarations = base;
+ jsFileName = path.resolve(base, jsFileName);
+ if (dtsFileName !== undefined) {
+ dtsFileName = path.resolve(base, dtsFileName);
+ }
}
if (jsContent !== undefined) {
if (jsMapContent !== undefined) {
@@ -135,82 +148,78 @@ var ProjectCompiler = (function () {
this.project.output.writeJs(base, jsFileName, jsContent, jsMapContent, file ? file.gulp.cwd : currentDirectory, file);
}
if (dtsContent !== undefined) {
- this.project.output.writeDts(baseDeclarations, dtsFileName, dtsContent, file ? file.gulp.cwd : currentDirectory);
+ this.project.output.writeDts(baseDeclarations, dtsFileName, dtsContent, dtsMapContent, file ? file.gulp.cwd : currentDirectory, file);
}
- };
- ProjectCompiler.prototype.reportDiagnostics = function (diagnostics) {
- for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) {
- var error = diagnostics_1[_i];
+ }
+ reportDiagnostics(diagnostics) {
+ for (const error of diagnostics) {
this.project.output.diagnostic(error);
}
return diagnostics.length;
- };
- ProjectCompiler.prototype.removeSourceMapComment = function (content) {
+ }
+ removeSourceMapComment(content) {
// By default the TypeScript automaticly inserts a source map comment.
// This should be removed because gulp-sourcemaps takes care of that.
// The comment is always on the last line, so it's easy to remove it
// (But the last line also ends with a \n, so we need to look for the \n before the other)
- var index = content.lastIndexOf('\n', content.length - 2);
+ const index = content.lastIndexOf('\n', content.length - 2);
return content.substring(0, index) + '\n';
- };
- return ProjectCompiler;
-}());
+ }
+}
exports.ProjectCompiler = ProjectCompiler;
-var FileCompiler = (function () {
- function FileCompiler() {
+class FileCompiler {
+ constructor() {
this.output = {};
this.previousOutput = {};
this.compilationResult = undefined;
}
- FileCompiler.prototype.prepare = function (project) {
+ prepare(project) {
this.project = project;
this.project.input.noParse = true;
- this.compilationResult = reporter_1.emptyCompilationResult();
- };
- FileCompiler.prototype.write = function (file, fileName, diagnostics, content, sourceMap) {
- this.output[file.fileNameNormalized] = { fileName: fileName, diagnostics: diagnostics, content: content, sourceMap: sourceMap };
- for (var _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) {
- var error = diagnostics_2[_i];
+ this.compilationResult = reporter_1.emptyCompilationResult(this.project.options.noEmit);
+ }
+ write(file, fileName, diagnostics, content, sourceMap) {
+ this.output[file.fileNameNormalized] = { fileName, diagnostics, content, sourceMap };
+ for (const error of diagnostics) {
this.project.output.diagnostic(error);
}
this.compilationResult.transpileErrors += diagnostics.length;
this.project.output.writeJs(file.gulp.base, fileName, content, sourceMap, file.gulp.cwd, file);
- };
- FileCompiler.prototype.inputFile = function (file) {
+ }
+ inputFile(file) {
if (file.fileNameNormalized.substr(file.fileNameNormalized.length - 5) === '.d.ts') {
return; // Don't compile definition files
}
if (this.project.input.getFileChange(file.fileNameOriginal).state === input_1.FileChangeState.Equal) {
// Not changed, re-use old file.
- var old = this.previousOutput[file.fileNameNormalized];
+ const old = this.previousOutput[file.fileNameNormalized];
this.write(file, old.fileName, old.diagnostics, old.content, old.sourceMap);
return;
}
- var diagnostics = [];
- var outputString = this.project.typescript.transpile(file.content, this.project.options, file.fileNameOriginal, diagnostics);
- var index = outputString.lastIndexOf('\n');
- var mapString = outputString.substring(index + 1);
+ const diagnostics = [];
+ const outputString = this.project.typescript.transpile(file.content, this.project.options, file.fileNameOriginal, diagnostics);
+ let index = outputString.lastIndexOf('\n');
+ let mapString = outputString.substring(index + 1);
if (mapString.substring(0, 1) === '\r')
mapString = mapString.substring(1);
- var start = '//# sourceMappingURL=data:application/json;base64,';
+ const start = '//# sourceMappingURL=data:application/json;base64,';
if (mapString.substring(0, start.length) !== start) {
- console.error('Couldn\'t read the sourceMap generated by TypeScript. This is likely an issue with gulp-typescript.');
+ console.log('Couldn\'t read the sourceMap generated by TypeScript. This is likely an issue with gulp-typescript.');
return;
}
mapString = mapString.substring(start.length);
- var map = JSON.parse(new Buffer(mapString, 'base64').toString());
+ let map = JSON.parse(Buffer.from(mapString, 'base64').toString());
// TODO: Set paths correctly
// map.sourceRoot = path.resolve(file.gulp.cwd, file.gulp.base);
// map.sources[0] = path.relative(map.sourceRoot, file.gulp.path);
- var fileNameExtensionless = utils.splitExtension(file.fileNameOriginal)[0];
- var _a = utils.splitExtension(map.file), extension = _a[1]; // js or jsx
+ const [fileNameExtensionless] = utils.splitExtension(file.fileNameOriginal);
+ const [, extension] = utils.splitExtension(map.file); // js or jsx
this.write(file, fileNameExtensionless + '.' + extension, diagnostics, outputString.substring(0, index), JSON.stringify(map));
- };
- FileCompiler.prototype.inputDone = function () {
+ }
+ inputDone() {
this.project.output.finish(this.compilationResult);
this.previousOutput = this.output;
this.output = {};
- };
- return FileCompiler;
-}());
+ }
+}
exports.FileCompiler = FileCompiler;
diff --git a/node_modules/gulp-typescript/release/host.d.ts b/node_modules/gulp-typescript/release/host.d.ts
index fb6523fb1..e497ff045 100644
--- a/node_modules/gulp-typescript/release/host.d.ts
+++ b/node_modules/gulp-typescript/release/host.d.ts
@@ -20,3 +20,4 @@ export declare class Host implements ts.CompilerHost {
getDirectories: (path: string) => string[];
directoryExists: (path: string) => boolean;
}
+//# sourceMappingURL=host.d.ts.map \ No newline at end of file
diff --git a/node_modules/gulp-typescript/release/host.js b/node_modules/gulp-typescript/release/host.js
index 3af3fa419..51ca3e0d8 100644
--- a/node_modules/gulp-typescript/release/host.js
+++ b/node_modules/gulp-typescript/release/host.js
@@ -1,55 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-var utils = require("./utils");
-var Host = (function () {
- function Host(typescript, currentDirectory, input, options) {
- var _this = this;
- this.getCurrentDirectory = function () {
- return _this.currentDirectory;
+const utils = require("./utils");
+class Host {
+ constructor(typescript, currentDirectory, input, options) {
+ this.getCurrentDirectory = () => {
+ return this.currentDirectory;
};
- this.writeFile = function (fileName, data, writeByteOrderMark, onError) { };
- this.fileExists = function (fileName) {
- var sourceFile = _this.input.getFile(fileName);
+ this.writeFile = (fileName, data, writeByteOrderMark, onError) => { };
+ this.fileExists = (fileName) => {
+ let sourceFile = this.input.getFile(fileName);
if (sourceFile)
return true;
- return _this.fallback.fileExists(fileName);
+ return this.fallback.fileExists(fileName);
};
- this.readFile = function (fileName) {
- var sourceFile = _this.input.getFile(fileName);
+ this.readFile = (fileName) => {
+ let sourceFile = this.input.getFile(fileName);
if (sourceFile)
return sourceFile.content;
- return _this.fallback.readFile(fileName);
+ return this.fallback.readFile(fileName);
};
- this.getSourceFile = function (fileName, languageVersion, onError) {
+ this.getSourceFile = (fileName, languageVersion, onError) => {
// TODO: Cache lib.d.ts files between compilations
- var sourceFile = _this.input.getFile(fileName);
+ let sourceFile = this.input.getFile(fileName);
if (sourceFile)
return sourceFile.ts;
- return _this.fallback.getSourceFile(fileName, languageVersion, onError);
+ return this.fallback.getSourceFile(fileName, languageVersion, onError);
};
- this.realpath = function (path) { return _this.fallback.realpath(path); };
- this.getDirectories = function (path) { return _this.fallback.getDirectories(path); };
- this.directoryExists = function (path) { return _this.fallback.directoryExists(path); };
+ this.realpath = (path) => this.fallback.realpath(path);
+ this.getDirectories = (path) => this.fallback.getDirectories(path);
+ this.directoryExists = (path) => this.fallback.directoryExists(path);
this.typescript = typescript;
this.fallback = typescript.createCompilerHost(options);
this.currentDirectory = currentDirectory;
this.input = input;
}
- Host.prototype.getNewLine = function () {
+ getNewLine() {
return '\n';
- };
- Host.prototype.useCaseSensitiveFileNames = function () {
+ }
+ useCaseSensitiveFileNames() {
return false;
- };
- Host.prototype.getCanonicalFileName = function (filename) {
+ }
+ getCanonicalFileName(filename) {
return utils.normalizePath(filename);
- };
- Host.prototype.getDefaultLibFileName = function (options) {
+ }
+ getDefaultLibFileName(options) {
return this.fallback.getDefaultLibFileName(options);
- };
- Host.prototype.getDefaultLibLocation = function () {
+ }
+ getDefaultLibLocation() {
return this.fallback.getDefaultLibLocation();
- };
- return Host;
-}());
+ }
+}
exports.Host = Host;
diff --git a/node_modules/gulp-typescript/release/input.d.ts b/node_modules/gulp-typescript/release/input.d.ts
index 8aef76867..84c974287 100644
--- a/node_modules/gulp-typescript/release/input.d.ts
+++ b/node_modules/gulp-typescript/release/input.d.ts
@@ -1,16 +1,16 @@
import * as ts from 'typescript';
import * as utils from './utils';
-import { VinylFile } from './types';
+import * as VinylFile from 'vinyl';
export declare enum FileChangeState {
New = 0,
Equal = 1,
Modified = 2,
Deleted = 3,
- NotFound = 4,
+ NotFound = 4
}
export declare enum FileKind {
Source = 0,
- Config = 1,
+ Config = 1
}
export interface FileChange {
previous: File;
@@ -38,11 +38,11 @@ export declare class FileDictionary {
constructor(typescript: typeof ts);
addGulp(gFile: VinylFile): File;
addContent(fileName: string, content: string): File;
- private addFile(file);
+ private addFile;
getFile(name: string): File;
initTypeScriptSourceFile: (file: File) => void;
getFileNames(onlyGulp?: boolean): string[];
- private getSourceFileNames(onlyGulp?);
+ private getSourceFileNames;
commonBasePath: string;
commonSourceDirectory: string;
}
@@ -57,8 +57,8 @@ export declare class FileCache {
addGulp(gFile: VinylFile): File;
addContent(fileName: string, content: string): File;
reset(): void;
- private createDictionary();
- private initTypeScriptSourceFile(file);
+ private createDictionary;
+ private initTypeScriptSourceFile;
getFile(name: string): File;
getFileChange(name: string): FileChange;
getFileNames(onlyGulp?: boolean): string[];
@@ -67,3 +67,4 @@ export declare class FileCache {
commonSourceDirectory: string;
isChanged(onlyGulp?: boolean): boolean;
}
+//# sourceMappingURL=input.d.ts.map \ No newline at end of file
diff --git a/node_modules/gulp-typescript/release/input.js b/node_modules/gulp-typescript/release/input.js
index e6baeed62..09abebec8 100644
--- a/node_modules/gulp-typescript/release/input.js
+++ b/node_modules/gulp-typescript/release/input.js
@@ -1,7 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-var path = require("path");
-var utils = require("./utils");
+const path = require("path");
+const utils = require("./utils");
var FileChangeState;
(function (FileChangeState) {
FileChangeState[FileChangeState["New"] = 0] = "New";
@@ -18,20 +18,20 @@ var FileKind;
var File;
(function (File) {
function fromContent(fileName, content) {
- var kind = FileKind.Source;
+ let kind = FileKind.Source;
if (path.extname(fileName).toLowerCase() === 'json')
kind = FileKind.Config;
return {
fileNameNormalized: utils.normalizePath(fileName),
fileNameOriginal: fileName,
- content: content,
- kind: kind
+ content,
+ kind
};
}
File.fromContent = fromContent;
function fromGulp(file) {
- var str = file.contents.toString('utf8');
- var data = fromContent(file.path, str);
+ let str = file.contents.toString('utf8');
+ let data = fromContent(file.path, str);
data.gulp = file;
return data;
}
@@ -57,19 +57,19 @@ var File;
}
File.getChangeState = getChangeState;
})(File = exports.File || (exports.File = {}));
-var FileDictionary = (function () {
- function FileDictionary(typescript) {
+class FileDictionary {
+ constructor(typescript) {
this.files = {};
this.firstSourceFile = undefined;
this.typescript = typescript;
}
- FileDictionary.prototype.addGulp = function (gFile) {
+ addGulp(gFile) {
return this.addFile(File.fromGulp(gFile));
- };
- FileDictionary.prototype.addContent = function (fileName, content) {
+ }
+ addContent(fileName, content) {
return this.addFile(File.fromContent(fileName, content));
- };
- FileDictionary.prototype.addFile = function (file) {
+ }
+ addFile(file) {
if (file.kind === FileKind.Source) {
this.initTypeScriptSourceFile(file);
if (!this.firstSourceFile)
@@ -77,69 +77,57 @@ var FileDictionary = (function () {
}
this.files[file.fileNameNormalized] = file;
return file;
- };
- FileDictionary.prototype.getFile = function (name) {
+ }
+ getFile(name) {
return this.files[utils.normalizePath(name)];
- };
- FileDictionary.prototype.getFileNames = function (onlyGulp) {
- if (onlyGulp === void 0) { onlyGulp = false; }
- var fileNames = [];
- for (var fileName in this.files) {
+ }
+ getFileNames(onlyGulp = false) {
+ const fileNames = [];
+ for (const fileName in this.files) {
if (!this.files.hasOwnProperty(fileName))
continue;
- var file = this.files[fileName];
+ let file = this.files[fileName];
if (onlyGulp && !file.gulp)
continue;
fileNames.push(file.fileNameOriginal);
}
return fileNames;
- };
- FileDictionary.prototype.getSourceFileNames = function (onlyGulp) {
- var fileNames = this.getFileNames(onlyGulp);
- var sourceFileNames = fileNames
- .filter(function (fileName) { return fileName.substr(fileName.length - 5).toLowerCase() !== '.d.ts'; });
+ }
+ getSourceFileNames(onlyGulp) {
+ const fileNames = this.getFileNames(onlyGulp);
+ const sourceFileNames = fileNames
+ .filter(fileName => fileName.substr(fileName.length - 5).toLowerCase() !== '.d.ts');
if (sourceFileNames.length === 0) {
// Only definition files, so we will calculate the common base path based on the
// paths of the definition files.
return fileNames;
}
return sourceFileNames;
- };
- Object.defineProperty(FileDictionary.prototype, "commonBasePath", {
- get: function () {
- var _this = this;
- var fileNames = this.getSourceFileNames(true);
- return utils.getCommonBasePathOfArray(fileNames.map(function (fileName) {
- var file = _this.files[utils.normalizePath(fileName)];
- return path.resolve(process.cwd(), file.gulp.base);
- }));
- },
- // This empty setter will prevent that TS emits 'readonly' modifier.
- // 'readonly' is not supported in current stable release.
- set: function (value) { },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(FileDictionary.prototype, "commonSourceDirectory", {
- get: function () {
- var _this = this;
- var fileNames = this.getSourceFileNames();
- return utils.getCommonBasePathOfArray(fileNames.map(function (fileName) {
- var file = _this.files[utils.normalizePath(fileName)];
- return path.dirname(file.fileNameNormalized);
- }));
- },
- // This empty setter will prevent that TS emits 'readonly' modifier.
- // 'readonly' is not supported in current stable release.
- set: function (value) { },
- enumerable: true,
- configurable: true
- });
- return FileDictionary;
-}());
+ }
+ get commonBasePath() {
+ const fileNames = this.getSourceFileNames(true);
+ return utils.getCommonBasePathOfArray(fileNames.map(fileName => {
+ const file = this.files[utils.normalizePath(fileName)];
+ return path.resolve(process.cwd(), file.gulp.base);
+ }));
+ }
+ // This empty setter will prevent that TS emits 'readonly' modifier.
+ // 'readonly' is not supported in current stable release.
+ set commonBasePath(value) { }
+ get commonSourceDirectory() {
+ const fileNames = this.getSourceFileNames();
+ return utils.getCommonBasePathOfArray(fileNames.map(fileName => {
+ const file = this.files[utils.normalizePath(fileName)];
+ return path.dirname(file.fileNameNormalized);
+ }));
+ }
+ // This empty setter will prevent that TS emits 'readonly' modifier.
+ // 'readonly' is not supported in current stable release.
+ set commonSourceDirectory(value) { }
+}
exports.FileDictionary = FileDictionary;
-var FileCache = (function () {
- function FileCache(typescript, options) {
+class FileCache {
+ constructor(typescript, options) {
this.previous = undefined;
this.noParse = false; // true when using a file based compiler.
this.version = 0;
@@ -147,100 +135,82 @@ var FileCache = (function () {
this.options = options;
this.createDictionary();
}
- FileCache.prototype.addGulp = function (gFile) {
+ addGulp(gFile) {
return this.current.addGulp(gFile);
- };
- FileCache.prototype.addContent = function (fileName, content) {
+ }
+ addContent(fileName, content) {
return this.current.addContent(fileName, content);
- };
- FileCache.prototype.reset = function () {
+ }
+ reset() {
this.version++;
this.previous = this.current;
this.createDictionary();
- };
- FileCache.prototype.createDictionary = function () {
- var _this = this;
+ }
+ createDictionary() {
this.current = new FileDictionary(this.typescript);
- this.current.initTypeScriptSourceFile = function (file) { return _this.initTypeScriptSourceFile(file); };
- };
- FileCache.prototype.initTypeScriptSourceFile = function (file) {
+ this.current.initTypeScriptSourceFile = (file) => this.initTypeScriptSourceFile(file);
+ }
+ initTypeScriptSourceFile(file) {
if (this.noParse)
return;
if (this.previous) {
- var previous = this.previous.getFile(file.fileNameOriginal);
+ let previous = this.previous.getFile(file.fileNameOriginal);
if (File.equal(previous, file)) {
file.ts = previous.ts; // Re-use previous source file.
return;
}
}
file.ts = this.typescript.createSourceFile(file.fileNameOriginal, file.content, this.options.target);
- };
- FileCache.prototype.getFile = function (name) {
+ }
+ getFile(name) {
return this.current.getFile(name);
- };
- FileCache.prototype.getFileChange = function (name) {
- var previous;
+ }
+ getFileChange(name) {
+ let previous;
if (this.previous) {
previous = this.previous.getFile(name);
}
- var current = this.current.getFile(name);
+ let current = this.current.getFile(name);
return {
- previous: previous,
- current: current,
+ previous,
+ current,
state: File.getChangeState(previous, current)
};
- };
- FileCache.prototype.getFileNames = function (onlyGulp) {
- if (onlyGulp === void 0) { onlyGulp = false; }
+ }
+ getFileNames(onlyGulp = false) {
return this.current.getFileNames(onlyGulp);
- };
- Object.defineProperty(FileCache.prototype, "firstSourceFile", {
- get: function () {
- return this.current.firstSourceFile;
- },
- // This empty setter will prevent that TS emits 'readonly' modifier.
- // 'readonly' is not supported in current stable release.
- set: function (value) { },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(FileCache.prototype, "commonBasePath", {
- get: function () {
- return this.current.commonBasePath;
- },
- set: function (value) { },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(FileCache.prototype, "commonSourceDirectory", {
- get: function () {
- return this.current.commonSourceDirectory;
- },
- set: function (value) { },
- enumerable: true,
- configurable: true
- });
- FileCache.prototype.isChanged = function (onlyGulp) {
- if (onlyGulp === void 0) { onlyGulp = false; }
+ }
+ get firstSourceFile() {
+ return this.current.firstSourceFile;
+ }
+ // This empty setter will prevent that TS emits 'readonly' modifier.
+ // 'readonly' is not supported in current stable release.
+ set firstSourceFile(value) { }
+ get commonBasePath() {
+ return this.current.commonBasePath;
+ }
+ set commonBasePath(value) { }
+ get commonSourceDirectory() {
+ return this.current.commonSourceDirectory;
+ }
+ set commonSourceDirectory(value) { }
+ isChanged(onlyGulp = false) {
if (!this.previous)
return true;
- var files = this.getFileNames(onlyGulp);
- var oldFiles = this.previous.getFileNames(onlyGulp);
+ const files = this.getFileNames(onlyGulp);
+ const oldFiles = this.previous.getFileNames(onlyGulp);
if (files.length !== oldFiles.length)
return true;
- for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
- var fileName = files_1[_i];
+ for (const fileName of files) {
if (oldFiles.indexOf(fileName) === -1)
return true;
}
- for (var _a = 0, files_2 = files; _a < files_2.length; _a++) {
- var fileName = files_2[_a];
- var change = this.getFileChange(fileName);
+ for (const fileName of files) {
+ const change = this.getFileChange(fileName);
if (change.state !== FileChangeState.Equal)
return true;
}
return false;
- };
- return FileCache;
-}());
+ }
+}
exports.FileCache = FileCache;
diff --git a/node_modules/gulp-typescript/release/main.d.ts b/node_modules/gulp-typescript/release/main.d.ts
index 07ef31735..6626469c8 100644
--- a/node_modules/gulp-typescript/release/main.d.ts
+++ b/node_modules/gulp-typescript/release/main.d.ts
@@ -47,3 +47,4 @@ declare module compile {
function filter(...args: any[]): void;
}
export = compile;
+//# sourceMappingURL=main.d.ts.map \ No newline at end of file
diff --git a/node_modules/gulp-typescript/release/main.js b/node_modules/gulp-typescript/release/main.js
index a04448e8c..c080bb19e 100644
--- a/node_modules/gulp-typescript/release/main.js
+++ b/node_modules/gulp-typescript/release/main.js
@@ -8,15 +8,15 @@ var __rest = (this && this.__rest) || function (s, e) {
t[p[i]] = s[p[i]];
return t;
};
-var path = require("path");
-var _project = require("./project");
-var utils = require("./utils");
-var _reporter = require("./reporter");
+const path = require("path");
+const _project = require("./project");
+const utils = require("./utils");
+const _reporter = require("./reporter");
function compile(param, theReporter) {
if (arguments.length >= 3) {
utils.deprecate("Reporter are now passed as the second argument", "remove the second argument", "Filters have been removed as of gulp-typescript 3.0.\nThe reporter is now passed as the second argument instead of the third argument.");
}
- var proj;
+ let proj;
if (typeof param === "function") {
proj = param;
if (arguments.length >= 2) {
@@ -43,7 +43,7 @@ function getTypeScript(typescript) {
}
}
function checkAndNormalizeSettings(settings) {
- var declarationFiles = settings.declarationFiles, noExternalResolve = settings.noExternalResolve, sortOutput = settings.sortOutput, typescript = settings.typescript, standardSettings = __rest(settings, ["declarationFiles", "noExternalResolve", "sortOutput", "typescript"]);
+ const { declarationFiles, noExternalResolve, sortOutput, typescript } = settings, standardSettings = __rest(settings, ["declarationFiles", "noExternalResolve", "sortOutput", "typescript"]);
if (settings.sourceRoot !== undefined) {
console.warn('gulp-typescript: sourceRoot isn\'t supported any more. Use sourceRoot option of gulp-sourcemaps instead.');
}
@@ -58,18 +58,21 @@ function checkAndNormalizeSettings(settings) {
}
return standardSettings;
}
-function normalizeCompilerOptions(options) {
+function normalizeCompilerOptions(options, typescript) {
options.sourceMap = true;
options.suppressOutputPathCheck = true;
options.inlineSourceMap = false;
options.sourceRoot = undefined;
options.inlineSources = false;
+ // For TS >=2.9, we set `declarationMap` to true, if `declaration` is set.
+ // We check for this version by checking whether `createFileLevelUniqueName` exists.
+ if ("createFileLevelUniqueName" in typescript && options.declaration && !options.isolatedModules) {
+ options.declarationMap = true;
+ }
}
-function reportErrors(errors, typescript, ignore) {
- if (ignore === void 0) { ignore = []; }
- var reporter = _reporter.defaultReporter();
- for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) {
- var error = errors_1[_i];
+function reportErrors(errors, typescript, ignore = []) {
+ const reporter = _reporter.defaultReporter();
+ for (const error of errors) {
if (ignore.indexOf(error.code) !== -1)
continue;
reporter.error(utils.getError(error, typescript), typescript);
@@ -78,16 +81,19 @@ function reportErrors(errors, typescript, ignore) {
(function (compile) {
compile.reporter = _reporter;
function createProject(fileNameOrSettings, settings) {
- var tsConfigFileName = undefined;
- var tsConfigContent = undefined;
- var projectDirectory = process.cwd();
- var typescript;
- var compilerOptions;
- var fileName;
- var rawConfig;
+ let tsConfigFileName = undefined;
+ let tsConfigContent = undefined;
+ let projectDirectory = process.cwd();
+ let typescript;
+ let compilerOptions;
+ let projectReferences;
+ let fileName;
+ let rawConfig;
if (fileNameOrSettings !== undefined) {
if (typeof fileNameOrSettings === 'string') {
fileName = fileNameOrSettings;
+ tsConfigFileName = path.resolve(process.cwd(), fileName);
+ projectDirectory = path.dirname(tsConfigFileName);
if (settings === undefined)
settings = {};
}
@@ -96,37 +102,32 @@ function reportErrors(errors, typescript, ignore) {
}
typescript = getTypeScript(settings.typescript);
settings = checkAndNormalizeSettings(settings);
- var settingsResult = typescript.convertCompilerOptionsFromJson(settings, projectDirectory);
+ const settingsResult = typescript.convertCompilerOptionsFromJson(settings, projectDirectory);
if (settingsResult.errors) {
reportErrors(settingsResult.errors, typescript);
}
compilerOptions = settingsResult.options;
- if (fileName) {
- tsConfigFileName = path.resolve(process.cwd(), fileNameOrSettings);
- projectDirectory = path.dirname(tsConfigFileName);
- var tsConfig = typescript.readConfigFile(tsConfigFileName, typescript.sys.readFile);
+ if (fileName !== undefined) {
+ let tsConfig = typescript.readConfigFile(tsConfigFileName, typescript.sys.readFile);
if (tsConfig.error) {
console.log(tsConfig.error.messageText);
}
- var parsed = typescript.parseJsonConfigFileContent(tsConfig.config || {}, getTsconfigSystem(typescript), path.resolve(projectDirectory), compilerOptions, path.basename(tsConfigFileName));
+ let parsed = typescript.parseJsonConfigFileContent(tsConfig.config || {}, getTsconfigSystem(typescript), path.resolve(projectDirectory), compilerOptions, path.basename(tsConfigFileName));
rawConfig = parsed.raw;
tsConfigContent = parsed.raw;
if (parsed.errors) {
reportErrors(parsed.errors, typescript, [18003]);
}
compilerOptions = parsed.options;
+ projectReferences = parsed.projectReferences;
}
}
- normalizeCompilerOptions(compilerOptions);
- var project = _project.setupProject(projectDirectory, tsConfigFileName, rawConfig, tsConfigContent, compilerOptions, typescript);
+ normalizeCompilerOptions(compilerOptions, typescript);
+ const project = _project.setupProject(projectDirectory, tsConfigFileName, rawConfig, tsConfigContent, compilerOptions, projectReferences, typescript);
return project;
}
compile.createProject = createProject;
- function filter() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
+ function filter(...args) {
utils.deprecate('ts.filter() is deprecated', 'soon you can use tsProject.resolve()', 'Filters have been removed as of gulp-typescript 3.0.\nSoon tsProject.resolve() will be available as an alternative.\nSee https://github.com/ivogabe/gulp-typescript/issues/190.');
}
compile.filter = filter;
@@ -134,7 +135,7 @@ function reportErrors(errors, typescript, ignore) {
function getTsconfigSystem(typescript) {
return {
useCaseSensitiveFileNames: typescript.sys.useCaseSensitiveFileNames,
- readDirectory: function () { return []; },
+ readDirectory: () => [],
fileExists: typescript.sys.fileExists,
readFile: typescript.sys.readFile
};
diff --git a/node_modules/gulp-typescript/release/output.d.ts b/node_modules/gulp-typescript/release/output.d.ts
index f486037d4..2d471bf81 100644
--- a/node_modules/gulp-typescript/release/output.d.ts
+++ b/node_modules/gulp-typescript/release/output.d.ts
@@ -11,11 +11,17 @@ export declare class Output {
streamFull: stream.Readable;
streamJs: stream.Readable;
streamDts: stream.Readable;
+ private pendingIO;
writeJs(base: string, fileName: string, content: string, sourceMapContent: string, cwd: string, original: input.File): void;
- writeDts(base: string, fileName: string, content: string, cwd: string): void;
- private applySourceMap(sourceMapContent, original, output);
+ private writeJsAsync;
+ writeDts(base: string, fileName: string, content: string, declarationMapContent: string, cwd: string, original: input.File): void;
+ private writeDtsAsync;
+ private applySourceMap;
+ private pipeRejection;
finish(result: reporter.CompilationResult): void;
- private getError(info);
+ private mightFinish;
+ private getError;
diagnostic(info: ts.Diagnostic): void;
error(error: reporter.TypeScriptError): void;
}
+//# sourceMappingURL=output.d.ts.map \ No newline at end of file
diff --git a/node_modules/gulp-typescript/release/output.js b/node_modules/gulp-typescript/release/output.js
index 7ee2ad925..3b9a00758 100644
--- a/node_modules/gulp-typescript/release/output.js
+++ b/node_modules/gulp-typescript/release/output.js
@@ -1,108 +1,154 @@
"use strict";
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
Object.defineProperty(exports, "__esModule", { value: true });
-var path = require("path");
-var sourceMap = require("source-map");
-var gutil = require("gulp-util");
-var utils = require("./utils");
-var Output = (function () {
- function Output(_project, streamFull, streamJs, streamDts) {
+const path = require("path");
+const sourceMap = require("source-map");
+const VinylFile = require("vinyl");
+const utils = require("./utils");
+const reporter = require("./reporter");
+class Output {
+ constructor(_project, streamFull, streamJs, streamDts) {
+ // Number of pending IO operatrions
+ this.pendingIO = 0;
this.project = _project;
this.streamFull = streamFull;
this.streamJs = streamJs;
this.streamDts = streamDts;
}
- Output.prototype.writeJs = function (base, fileName, content, sourceMapContent, cwd, original) {
- var file = new gutil.File({
- path: fileName,
- contents: new Buffer(content),
- cwd: cwd,
- base: base
+ writeJs(base, fileName, content, sourceMapContent, cwd, original) {
+ this.pipeRejection(this.writeJsAsync(base, fileName, content, sourceMapContent, cwd, original), this.streamJs);
+ }
+ writeJsAsync(base, fileName, content, sourceMapContent, cwd, original) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const file = new VinylFile({
+ path: fileName,
+ contents: Buffer.from(content),
+ cwd,
+ base
+ });
+ this.pendingIO++;
+ yield this.applySourceMap(sourceMapContent, original, file).then(appliedSourceMap => {
+ if (appliedSourceMap)
+ file.sourceMap = JSON.parse(appliedSourceMap);
+ this.streamFull.push(file);
+ this.streamJs.push(file);
+ this.pendingIO--;
+ this.mightFinish();
+ });
});
- var appliedSourceMap = this.applySourceMap(sourceMapContent, original, file);
- if (appliedSourceMap)
- file.sourceMap = JSON.parse(appliedSourceMap);
- this.streamFull.push(file);
- this.streamJs.push(file);
- };
- Output.prototype.writeDts = function (base, fileName, content, cwd) {
- var file = new gutil.File({
- path: fileName,
- contents: new Buffer(content),
- cwd: cwd,
- base: base
+ }
+ writeDts(base, fileName, content, declarationMapContent, cwd, original) {
+ this.pipeRejection(this.writeDtsAsync(base, fileName, content, declarationMapContent, cwd, original), this.streamDts);
+ }
+ writeDtsAsync(base, fileName, content, declarationMapContent, cwd, original) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const file = new VinylFile({
+ path: fileName,
+ contents: Buffer.from(content),
+ cwd,
+ base
+ });
+ this.pendingIO++;
+ yield this.applySourceMap(declarationMapContent, original, file).then(appliedSourceMap => {
+ if (appliedSourceMap)
+ file.sourceMap = JSON.parse(appliedSourceMap);
+ this.streamFull.push(file);
+ this.streamDts.push(file);
+ this.pendingIO--;
+ this.mightFinish();
+ });
});
- this.streamFull.push(file);
- this.streamDts.push(file);
- };
- Output.prototype.applySourceMap = function (sourceMapContent, original, output) {
- var _this = this;
- if (sourceMapContent === undefined)
- return undefined;
- var map = JSON.parse(sourceMapContent);
- var 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);
- map.sources = map.sources.map(relativeToOutput);
- delete map.sourceRoot;
- var generator = sourceMap.SourceMapGenerator.fromSourceMap(new sourceMap.SourceMapConsumer(map));
- var sourceMapOrigins = this.project.singleOutput
- ? this.project.input.getFileNames(true).map(function (fName) { return _this.project.input.getFile(fName); })
- : [original];
- for (var _i = 0, sourceMapOrigins_1 = sourceMapOrigins; _i < sourceMapOrigins_1.length; _i++) {
- var sourceFile = sourceMapOrigins_1[_i];
- if (!sourceFile || !sourceFile.gulp || !sourceFile.gulp.sourceMap)
- continue;
- var inputOriginalMap = sourceFile.gulp.sourceMap;
- var inputMap = typeof inputOriginalMap === 'object' ? inputOriginalMap : JSON.parse(inputOriginalMap);
- // We should only apply the input mappings if the input mapping isn't empty,
- // since `generator.applySourceMap` has a really bad performance on big inputs.
- if (inputMap.mappings !== '') {
- var consumer = new sourceMap.SourceMapConsumer(inputMap);
- generator.applySourceMap(consumer);
+ }
+ applySourceMap(sourceMapContent, original, output) {
+ return __awaiter(this, void 0, void 0, function* () {
+ if (sourceMapContent === undefined)
+ return undefined;
+ 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);
+ map.sources = map.sources.map(relativeToOutput);
+ delete map.sourceRoot;
+ const consumer = yield new sourceMap.SourceMapConsumer(map);
+ const generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer);
+ const sourceMapOrigins = this.project.singleOutput
+ ? 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;
+ const inputOriginalMap = sourceFile.gulp.sourceMap;
+ const inputMap = typeof inputOriginalMap === 'object' ? inputOriginalMap : JSON.parse(inputOriginalMap);
+ // We should only apply the input mappings if the input mapping isn't empty,
+ // since `generator.applySourceMap` has a really bad performance on big inputs.
+ if (inputMap.mappings !== '') {
+ const inputConsumer = yield new sourceMap.SourceMapConsumer(inputMap);
+ generator.applySourceMap(inputConsumer);
+ inputConsumer.destroy();
+ }
+ if (!inputMap.sources || !inputMap.sourcesContent)
+ continue;
+ for (let i = 0; i < inputMap.sources.length; i++) {
+ const absolute = path.resolve(sourceFile.gulp.base, inputMap.sources[i]);
+ const relative = path.relative(output.base, absolute);
+ generator.setSourceContent(utils.forwardSlashes(relative), inputMap.sourcesContent[i]);
+ }
}
- if (!inputMap.sources || !inputMap.sourcesContent)
- continue;
- for (var i = 0; i < inputMap.sources.length; i++) {
- var absolute = path.resolve(sourceFile.gulp.base, inputMap.sources[i]);
- var relative = path.relative(output.base, absolute);
- generator.setSourceContent(utils.forwardSlashes(relative), inputMap.sourcesContent[i]);
+ consumer.destroy();
+ return generator.toString();
+ function relativeToOutput(fileName) {
+ const absolute = path.resolve(directory, fileName);
+ return utils.forwardSlashes(path.relative(output.base, absolute));
}
- }
- return generator.toString();
- function relativeToOutput(fileName) {
- var absolute = path.resolve(directory, fileName);
- return utils.forwardSlashes(path.relative(output.base, absolute));
- }
- };
- Output.prototype.finish = function (result) {
+ });
+ }
+ // Avoids UnhandledPromiseRejectionWarning in NodeJS
+ pipeRejection(promise, alternateStream) {
+ promise.catch(err => {
+ this.streamFull.emit("error", err);
+ alternateStream.emit("error", err);
+ });
+ }
+ finish(result) {
this.result = result;
+ this.mightFinish();
+ }
+ mightFinish() {
+ if (this.result === undefined || this.pendingIO !== 0)
+ return;
if (this.project.reporter.finish)
- this.project.reporter.finish(result);
+ this.project.reporter.finish(this.result);
+ if (reporter.countErrors(this.result) !== 0) {
+ this.streamFull.emit('error', new Error("TypeScript: Compilation failed"));
+ }
this.streamFull.emit('finish');
- this.streamJs.emit('finish');
- this.streamDts.emit('finish');
this.streamFull.push(null);
this.streamJs.push(null);
this.streamDts.push(null);
- };
- Output.prototype.getError = function (info) {
- var fileName = info.file && info.file.fileName;
- var file = fileName && this.project.input.getFile(fileName);
+ }
+ getError(info) {
+ let fileName = info.file && info.file.fileName;
+ const file = fileName && this.project.input.getFile(fileName);
return utils.getError(info, this.project.typescript, file);
- };
- Output.prototype.diagnostic = function (info) {
+ }
+ diagnostic(info) {
this.error(this.getError(info));
- };
- Output.prototype.error = function (error) {
+ }
+ error(error) {
if (!error)
return;
// call reporter callback
if (this.project.reporter.error)
this.project.reporter.error(error, this.project.typescript);
// & emit the error on the stream.
- this.streamFull.emit('error', error);
- };
- return Output;
-}());
+ }
+}
exports.Output = Output;
diff --git a/node_modules/gulp-typescript/release/project.d.ts b/node_modules/gulp-typescript/release/project.d.ts
index a79e6d6ef..f16bdc60c 100644
--- a/node_modules/gulp-typescript/release/project.d.ts
+++ b/node_modules/gulp-typescript/release/project.d.ts
@@ -15,6 +15,7 @@ export interface Project {
readonly rawConfig: any;
readonly config: TsConfig;
readonly options: ts.CompilerOptions;
+ readonly projectReferences: ReadonlyArray<ts.ProjectReference> | undefined;
}
export interface ProjectInfo {
input: FileCache;
@@ -22,12 +23,14 @@ export interface ProjectInfo {
compiler: ICompiler;
singleOutput: boolean;
options: ts.CompilerOptions;
+ projectReferences: ReadonlyArray<ts.ProjectReference>;
typescript: typeof ts;
directory: string;
reporter: Reporter;
}
-export declare function setupProject(projectDirectory: string, configFileName: string, rawConfig: any, config: TsConfig, options: ts.CompilerOptions, typescript: typeof ts): Project;
+export declare function setupProject(projectDirectory: string, configFileName: string, rawConfig: any, config: TsConfig, options: ts.CompilerOptions, projectReferences: ReadonlyArray<ts.ProjectReference>, typescript: typeof ts): Project;
export interface ICompileStream extends NodeJS.ReadWriteStream {
js: stream.Readable;
dts: stream.Readable;
}
+//# sourceMappingURL=project.d.ts.map \ No newline at end of file
diff --git a/node_modules/gulp-typescript/release/project.js b/node_modules/gulp-typescript/release/project.js
index dad38f93b..642b90fb8 100644
--- a/node_modules/gulp-typescript/release/project.js
+++ b/node_modules/gulp-typescript/release/project.js
@@ -1,14 +1,4 @@
"use strict";
-var __extends = (this && this.__extends) || (function () {
- var extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
-})();
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -19,41 +9,41 @@ var __rest = (this && this.__rest) || function (s, e) {
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
-var stream = require("stream");
-var vfs = require("vinyl-fs");
-var path = require("path");
-var gutil = require("gulp-util");
-var utils = require("./utils");
-var reporter_1 = require("./reporter");
-var input_1 = require("./input");
-var output_1 = require("./output");
-var compiler_1 = require("./compiler");
-function setupProject(projectDirectory, configFileName, rawConfig, config, options, typescript) {
- var input = new input_1.FileCache(typescript, options);
- var compiler = options.isolatedModules ? new compiler_1.FileCompiler() : new compiler_1.ProjectCompiler();
- var running = false;
+const stream = require("stream");
+const vfs = require("vinyl-fs");
+const path = require("path");
+const PluginError = require("plugin-error");
+const utils = require("./utils");
+const reporter_1 = require("./reporter");
+const input_1 = require("./input");
+const output_1 = require("./output");
+const compiler_1 = require("./compiler");
+function setupProject(projectDirectory, configFileName, rawConfig, config, options, projectReferences, typescript) {
+ const input = new input_1.FileCache(typescript, options);
+ const compiler = options.isolatedModules ? new compiler_1.FileCompiler() : new compiler_1.ProjectCompiler();
+ let running = false;
if (options.isolatedModules) {
options.newLine = typescript.NewLineKind.LineFeed;
options.sourceMap = false;
options.declaration = false;
options.inlineSourceMap = true;
}
- var project = function (reporter) {
+ const project = (reporter) => {
if (running) {
throw new Error('gulp-typescript: A project cannot be used in two compilations at the same time. Create multiple projects with createProject instead.');
}
running = true;
input.reset();
compiler.prepare(projectInfo);
- var stream = new CompileStream(projectInfo);
+ const stream = new CompileStream(projectInfo);
projectInfo.output = new output_1.Output(projectInfo, stream, stream.js, stream.dts);
projectInfo.reporter = reporter || reporter_1.defaultReporter();
- stream.on('finish', function () {
+ stream.on('finish', () => {
running = false;
});
return stream;
};
- var singleOutput = options.out !== undefined || options.outFile !== undefined;
+ const singleOutput = options.out !== undefined || options.outFile !== undefined;
project.src = src;
project.typescript = typescript;
project.projectDirectory = projectDirectory;
@@ -61,12 +51,14 @@ function setupProject(projectDirectory, configFileName, rawConfig, config, optio
project.rawConfig = rawConfig;
project.config = config;
project.options = options;
- var projectInfo = {
- input: input,
- singleOutput: singleOutput,
- compiler: compiler,
- options: options,
- typescript: typescript,
+ project.projectReferences = projectReferences;
+ const projectInfo = {
+ input,
+ singleOutput,
+ compiler,
+ options,
+ projectReferences,
+ typescript,
directory: projectDirectory,
// Set when `project` is called
output: undefined,
@@ -79,35 +71,29 @@ function src() {
if (arguments.length >= 1) {
utils.message("tsProject.src() takes no arguments", "Use gulp.src(..) if you need to specify a glob");
}
- var base;
+ let base;
if (this.options["rootDir"]) {
base = path.resolve(this.projectDirectory, this.options["rootDir"]);
}
- var _a = this.rawConfig, _extends = _a.extends, config = __rest(_a, ["extends"]);
- var _b = this.typescript.parseJsonConfigFileContent(config, this.typescript.sys, path.resolve(this.projectDirectory), undefined, path.basename(this.configFileName)), fileNames = _b.fileNames, errors = _b.errors;
- for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) {
- var error = errors_1[_i];
+ const _a = this.rawConfig, { extends: _extends } = _a, config = __rest(_a, ["extends"]);
+ const { fileNames, errors } = this.typescript.parseJsonConfigFileContent(config, this.typescript.sys, path.resolve(this.projectDirectory), undefined, path.basename(this.configFileName));
+ for (const error of errors) {
console.log(error.messageText);
}
if (base === undefined)
- base = utils.getCommonBasePathOfArray(fileNames.filter(function (file) { return file.substr(-5) !== ".d.ts"; })
- .map(function (file) { return path.dirname(file); }));
- var vinylOptions = { base: base, allowEmpty: true };
+ base = utils.getCommonBasePathOfArray(fileNames.filter(file => file.substr(-5) !== ".d.ts")
+ .map(file => path.dirname(file)));
+ const vinylOptions = { base, allowEmpty: true };
return vfs.src(fileNames, vinylOptions);
}
-var CompileStream = (function (_super) {
- __extends(CompileStream, _super);
- function CompileStream(project) {
- var _this = _super.call(this, { objectMode: true }) || this;
- _this.js = new CompileOutputStream();
- _this.dts = new CompileOutputStream();
- _this.project = project;
- // Prevent "Unhandled stream error in pipe" when a compilation error occurs.
- _this.on('error', function () { });
- return _this;
+class CompileStream extends stream.Duplex {
+ constructor(project) {
+ super({ objectMode: true });
+ this.js = new CompileOutputStream();
+ this.dts = new CompileOutputStream();
+ this.project = project;
}
- CompileStream.prototype._write = function (file, encoding, cb) {
- if (cb === void 0) { cb = function (err) { }; }
+ _write(file, encoding, cb = (err) => { }) {
if (!file)
return cb();
if (file.isNull()) {
@@ -115,15 +101,15 @@ var CompileStream = (function (_super) {
return;
}
if (file.isStream()) {
- return cb(new gutil.PluginError('gulp-typescript', 'Streaming not supported'));
+ return cb(new PluginError('gulp-typescript', 'Streaming not supported'));
}
- var inputFile = this.project.input.addGulp(file);
+ const inputFile = this.project.input.addGulp(file);
this.project.compiler.inputFile(inputFile);
cb();
- };
- CompileStream.prototype._read = function () {
- };
- CompileStream.prototype.end = function (chunk, encoding, callback) {
+ }
+ _read() {
+ }
+ end(chunk, encoding, callback) {
if (typeof chunk === 'function') {
this._write(null, null, chunk);
}
@@ -134,15 +120,12 @@ var CompileStream = (function (_super) {
this._write(chunk, encoding, callback);
}
this.project.compiler.inputDone();
- };
- return CompileStream;
-}(stream.Duplex));
-var CompileOutputStream = (function (_super) {
- __extends(CompileOutputStream, _super);
- function CompileOutputStream() {
- return _super.call(this, { objectMode: true }) || this;
}
- CompileOutputStream.prototype._read = function () {
- };
- return CompileOutputStream;
-}(stream.Readable));
+}
+class CompileOutputStream extends stream.Readable {
+ constructor() {
+ super({ objectMode: true });
+ }
+ _read() {
+ }
+}
diff --git a/node_modules/gulp-typescript/release/reporter.d.ts b/node_modules/gulp-typescript/release/reporter.d.ts
index 3dba518e1..5de7a1ec1 100644
--- a/node_modules/gulp-typescript/release/reporter.d.ts
+++ b/node_modules/gulp-typescript/release/reporter.d.ts
@@ -1,5 +1,5 @@
import * as ts from 'typescript';
-import { VinylFile } from './types';
+import * as VinylFile from 'vinyl';
export interface TypeScriptError extends Error {
fullFilename?: string;
relativeFilename?: string;
@@ -28,14 +28,17 @@ export interface CompilationResult {
semanticErrors: number;
declarationErrors: number;
emitErrors: number;
+ noEmit: boolean;
emitSkipped: boolean;
}
-export declare function emptyCompilationResult(): CompilationResult;
+export declare function emptyCompilationResult(noEmit: boolean): CompilationResult;
export interface Reporter {
error?: (error: TypeScriptError, typescript: typeof ts) => void;
finish?: (results: CompilationResult) => void;
}
+export declare function countErrors(results: CompilationResult): number;
export declare function nullReporter(): Reporter;
export declare function defaultReporter(): Reporter;
export declare function longReporter(): Reporter;
export declare function fullReporter(fullFilename?: boolean): Reporter;
+//# sourceMappingURL=reporter.d.ts.map \ No newline at end of file
diff --git a/node_modules/gulp-typescript/release/reporter.js b/node_modules/gulp-typescript/release/reporter.js
index 52a3a70a1..f8af2e116 100644
--- a/node_modules/gulp-typescript/release/reporter.js
+++ b/node_modules/gulp-typescript/release/reporter.js
@@ -1,7 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-var gutil = require("gulp-util");
-function emptyCompilationResult() {
+const colors = require("ansi-colors");
+function emptyCompilationResult(noEmit) {
return {
transpileErrors: 0,
optionsErrors: 0,
@@ -10,16 +10,27 @@ function emptyCompilationResult() {
semanticErrors: 0,
declarationErrors: 0,
emitErrors: 0,
+ noEmit,
emitSkipped: false
};
}
exports.emptyCompilationResult = emptyCompilationResult;
+function countErrors(results) {
+ return results.transpileErrors
+ + results.optionsErrors
+ + results.syntaxErrors
+ + results.globalErrors
+ + results.semanticErrors
+ + results.declarationErrors
+ + results.emitErrors;
+}
+exports.countErrors = countErrors;
function defaultFinishHandler(results) {
- var hasError = false;
- var showErrorCount = function (count, type) {
+ let hasError = false;
+ const showErrorCount = (count, type) => {
if (count === 0)
return;
- gutil.log('TypeScript:', gutil.colors.magenta(count.toString()), (type !== '' ? type + ' ' : '') + (count === 1 ? 'error' : 'errors'));
+ console.log('TypeScript:', colors.magenta(count.toString()), (type !== '' ? type + ' ' : '') + (count === 1 ? 'error' : 'errors'));
hasError = true;
};
showErrorCount(results.transpileErrors, '');
@@ -29,11 +40,13 @@ function defaultFinishHandler(results) {
showErrorCount(results.semanticErrors, 'semantic');
showErrorCount(results.declarationErrors, 'declaration');
showErrorCount(results.emitErrors, 'emit');
- if (results.emitSkipped) {
- gutil.log('TypeScript: emit', gutil.colors.red('failed'));
- }
- else if (hasError) {
- gutil.log('TypeScript: emit', gutil.colors.cyan('succeeded'), '(with errors)');
+ if (!results.noEmit) {
+ if (results.emitSkipped) {
+ console.log('TypeScript: emit', colors.red('failed'));
+ }
+ else if (hasError) {
+ console.log('TypeScript: emit', colors.cyan('succeeded'), '(with errors)');
+ }
}
}
function nullReporter() {
@@ -42,50 +55,49 @@ function nullReporter() {
exports.nullReporter = nullReporter;
function defaultReporter() {
return {
- error: function (error) {
- console.error(error.message);
+ error: (error) => {
+ console.log(error.message);
},
finish: defaultFinishHandler
};
}
exports.defaultReporter = defaultReporter;
function longReporter() {
- var typescript = require('typescript');
+ const typescript = require('typescript');
return {
- error: function (error) {
+ error: (error) => {
if (error.tsFile) {
- console.error('[' + gutil.colors.gray('gulp-typescript') + '] ' + gutil.colors.red(error.fullFilename
+ console.log('[' + colors.gray('gulp-typescript') + '] ' + colors.red(error.fullFilename
+ '(' + error.startPosition.line + ',' + error.startPosition.character + '): ')
+ 'error TS' + error.diagnostic.code + ' ' + typescript.flattenDiagnosticMessageText(error.diagnostic.messageText, '\n'));
}
else {
- console.error(error.message);
+ console.log(error.message);
}
},
finish: defaultFinishHandler
};
}
exports.longReporter = longReporter;
-function fullReporter(fullFilename) {
- if (fullFilename === void 0) { fullFilename = false; }
+function fullReporter(fullFilename = false) {
return {
- error: function (error, typescript) {
- console.error('[' + gutil.colors.gray('gulp-typescript') + '] '
- + gutil.colors.bgRed(error.diagnostic.code + '')
- + ' ' + gutil.colors.red(typescript.flattenDiagnosticMessageText(error.diagnostic.messageText, '\n')));
+ error: (error, typescript) => {
+ console.log('[' + colors.gray('gulp-typescript') + '] '
+ + colors.bgRed(error.diagnostic.code + '')
+ + ' ' + 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 logLine = function (lineIndex, errorStart, errorEnd) {
- var line = lines_1[lineIndex];
+ console.log('> ' + colors.gray('file: ') + (fullFilename ? error.fullFilename : error.relativeFilename) + colors.gray(':'));
+ const lines = error.tsFile.text.split(/(?:\r\n|\r|\n)/);
+ const logLine = (lineIndex, errorStart, errorEnd) => {
+ const line = lines[lineIndex];
if (errorEnd === undefined)
errorEnd = line.length;
- console.error('> ' + gutil.colors.gray('[' + lineIndex + '] ')
+ console.log('> ' + colors.gray('[' + lineIndex + '] ')
+ line.substring(0, errorStart)
- + gutil.colors.red(line.substring(errorStart, errorEnd))
+ + colors.red(line.substring(errorStart, errorEnd))
+ line.substring(errorEnd));
};
- for (var i = error.startPosition.line; i <= error.endPosition.line; i++) {
+ for (let i = error.startPosition.line; i <= error.endPosition.line; i++) {
logLine(i, i === error.startPosition.line ? error.startPosition.character - 1 : 0, i === error.endPosition.line ? error.endPosition.character - 1 : undefined);
}
}
diff --git a/node_modules/gulp-typescript/release/types.d.ts b/node_modules/gulp-typescript/release/types.d.ts
index b1c0e1076..11e884710 100644
--- a/node_modules/gulp-typescript/release/types.d.ts
+++ b/node_modules/gulp-typescript/release/types.d.ts
@@ -4,25 +4,4 @@ export interface TsConfig {
exclude?: string[];
compilerOptions?: any;
}
-export interface VinylFile {
- cwd: string;
- base: string;
- path: string;
- stat: {};
- contents: {};
- sourceMap?: any;
- relative: string;
- isBuffer(): boolean;
- isStream(): boolean;
- isNull(): boolean;
- isDirectory(): boolean;
-}
-export interface RawSourceMap {
- file: string;
- sourceRoot?: string;
- version: number;
- sources: string[];
- names: string[];
- sourcesContent?: string[];
- mappings: string;
-}
+//# sourceMappingURL=types.d.ts.map \ No newline at end of file
diff --git a/node_modules/gulp-typescript/release/utils.d.ts b/node_modules/gulp-typescript/release/utils.d.ts
index 263b102d9..382785bd6 100644
--- a/node_modules/gulp-typescript/release/utils.d.ts
+++ b/node_modules/gulp-typescript/release/utils.d.ts
@@ -21,3 +21,4 @@ export declare function getCommonBasePathOfArray(paths: string[]): string;
export declare function getError(info: ts.Diagnostic, typescript: typeof ts, file?: File): reporter.TypeScriptError;
export declare function deprecate(title: string, alternative: string, description?: string): void;
export declare function message(title: string, alternative: string, description?: string): void;
+//# sourceMappingURL=utils.d.ts.map \ No newline at end of file
diff --git a/node_modules/gulp-typescript/release/utils.js b/node_modules/gulp-typescript/release/utils.js
index 39888f216..488e76bfc 100644
--- a/node_modules/gulp-typescript/release/utils.js
+++ b/node_modules/gulp-typescript/release/utils.js
@@ -1,7 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-var path = require("path");
-var gutil = require("gulp-util");
+const path = require("path");
+const colors = require("ansi-colors");
function forwardSlashes(fileName) {
return fileName.replace(/\\/g, '/');
}
@@ -18,16 +18,15 @@ exports.normalizePath = normalizePath;
*/
function splitExtension(fileName, knownExtensions) {
if (knownExtensions) {
- for (var _i = 0, knownExtensions_1 = knownExtensions; _i < knownExtensions_1.length; _i++) {
- var ext_1 = knownExtensions_1[_i];
- var index_1 = fileName.length - ext_1.length - 1;
- if (fileName.substr(index_1) === '.' + ext_1) {
- return [fileName.substr(0, index_1), ext_1];
+ for (const ext of knownExtensions) {
+ const index = fileName.length - ext.length - 1;
+ if (fileName.substr(index) === '.' + ext) {
+ return [fileName.substr(0, index), ext];
}
}
}
- var ext = path.extname(fileName).toLowerCase().substr(1);
- var index = fileName.length - ext.length;
+ const ext = path.extname(fileName).toLowerCase().substr(1);
+ const index = fileName.length - ext.length;
return [fileName.substr(0, index - 1), ext];
}
exports.splitExtension = splitExtension;
@@ -35,10 +34,10 @@ exports.splitExtension = splitExtension;
* Finds the common base path of two directories
*/
function getCommonBasePath(a, b) {
- var aSplit = a.split(/\\|\//); // Split on '/' or '\'.
- var bSplit = b.split(/\\|\//);
- var commonLength = 0;
- for (var i = 0; i < aSplit.length && i < bSplit.length; i++) {
+ const aSplit = a.split(/\\|\//); // Split on '/' or '\'.
+ const bSplit = b.split(/\\|\//);
+ let commonLength = 0;
+ for (let i = 0; i < aSplit.length && i < bSplit.length; i++) {
if (aSplit[i] !== bSplit[i])
break;
commonLength += aSplit[i].length + 1;
@@ -53,10 +52,10 @@ function getCommonBasePathOfArray(paths) {
}
exports.getCommonBasePathOfArray = getCommonBasePathOfArray;
function getError(info, typescript, file) {
- var err = new Error();
+ const err = new Error();
err.name = 'TypeScript error';
err.diagnostic = info;
- var codeAndMessageText = typescript.DiagnosticCategory[info.category].toLowerCase() +
+ const codeAndMessageText = typescript.DiagnosticCategory[info.category].toLowerCase() +
' TS' +
info.code +
': ' +
@@ -65,7 +64,7 @@ function getError(info, typescript, file) {
err.message = codeAndMessageText;
return err;
}
- var fileName = info.file.fileName;
+ let fileName = info.file.fileName;
if (file) {
err.tsFile = file.ts;
err.fullFilename = file.fileNameOriginal;
@@ -81,8 +80,8 @@ function getError(info, typescript, file) {
else {
err.fullFilename = info.file.fileName;
}
- var startPos = typescript.getLineAndCharacterOfPosition(info.file, info.start);
- var endPos = typescript.getLineAndCharacterOfPosition(info.file, info.start + info.length);
+ const startPos = typescript.getLineAndCharacterOfPosition(info.file, info.start);
+ const endPos = typescript.getLineAndCharacterOfPosition(info.file, info.start + info.length);
err.startPosition = {
position: info.start,
line: startPos.line,
@@ -93,23 +92,23 @@ function getError(info, typescript, file) {
line: endPos.line,
character: endPos.character
};
- err.message = gutil.colors.red(fileName + '(' + (startPos.line + 1) + ',' + (startPos.character + 1) + '): ').toString()
+ err.message = colors.red(fileName + '(' + (startPos.line + 1) + ',' + (startPos.character + 1) + '): ').toString()
+ codeAndMessageText;
return err;
}
exports.getError = getError;
function deprecate(title, alternative, description) {
message(title, alternative, description);
- console.log(' ' + gutil.colors.gray('More information: ' + gutil.colors.underline('http://dev.ivogabe.com/gulp-typescript-3/')));
+ console.log(' ' + colors.gray('More information: ' + colors.underline('http://dev.ivogabe.com/gulp-typescript-3/')));
}
exports.deprecate = deprecate;
function message(title, alternative, description) {
- console.log(gutil.colors.red('gulp-typescript').toString() +
- gutil.colors.gray(': ') +
+ console.log(colors.red('gulp-typescript').toString() +
+ colors.gray(': ') +
title +
- gutil.colors.gray(' - ') +
+ colors.gray(' - ') +
alternative);
if (description)
- console.log(' ' + gutil.colors.gray(description.replace(/\n/g, '\n ')));
+ console.log(' ' + colors.gray(description.replace(/\n/g, '\n ')));
}
exports.message = message;