diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..af6434b6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "typescript.tsdk": "node_modules/typescript/lib" +} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 326c9a46..b186bacd 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -57,7 +57,7 @@ gulp.task('clean-release', function(cb) { // Compile sources gulp.task('scripts', ['clean'], function() { var tsResult = gulp.src(paths.scripts.concat(paths.definitionTypeScript)) - .pipe(ts(tsProject)); + .pipe(tsProject()); return mergeStream(tsResult.js, tsResult.dts) .pipe(gulp.dest(paths.releaseBeta)); @@ -96,7 +96,7 @@ gulp.task('typecheck-dev', function() { ])).pipe(ts(tsOptions)); }); -gulp.task('typecheck', ['typecheck-1.4', 'typecheck-1.5', 'typecheck-1.6', 'typecheck-dev']); +gulp.task('typecheck', [/* 'typecheck-1.4', 'typecheck-1.5', 'typecheck-1.6', */ 'typecheck-dev']); // Tests @@ -105,12 +105,12 @@ function runTest(name, callback) { var newTS = require('./release-2/main'); // We run every test on multiple typescript versions: var libs = [ - ['1.8', undefined], - ['dev', require(tsVersions.dev)], - ['1.4', require(tsVersions.release14)], + ['2.0', undefined], + ['dev', require(tsVersions.dev)] + /* ['1.4', require(tsVersions.release14)], ['1.5', require(tsVersions.release15)], ['1.6', require(tsVersions.release16)], - ['1.7', require(tsVersions.release17)] + ['1.7', require(tsVersions.release17)] */ ]; var test = require('./test/' + name + '/gulptask.js'); diff --git a/lib/compiler.ts b/lib/compiler.ts index 6bb4698a..b0b774d4 100644 --- a/lib/compiler.ts +++ b/lib/compiler.ts @@ -1,25 +1,16 @@ import * as ts from 'typescript'; import * as path from 'path'; import { RawSourceMap } from './types'; -import * as tsApi from './tsapi'; import { File, FileChangeState } from './input'; -import { Output, OutputFileKind } from './output'; import { Host } from './host'; -import { Project } from './project'; -import { Filter } from './filter'; +import { ProjectInfo } from './project'; import { CompilationResult, emptyCompilationResult } from './reporter'; import * as utils from './utils'; export interface ICompiler { - prepare(_project: Project): void; - inputFile(file: File); - inputDone(); - /** - * Corrects the paths in the sourcemap. - * Returns true when the file is located - * under the base path. - */ - correctSourceMap(map: RawSourceMap): boolean; + prepare(project: ProjectInfo): void; + inputFile(file: File): void; + inputDone(): void; } /** @@ -27,11 +18,11 @@ export interface ICompiler { */ export class ProjectCompiler implements ICompiler { host: Host; - project: Project; + project: ProjectInfo; program: ts.Program; - prepare(_project: Project) { - this.project = _project; + prepare(project: ProjectInfo) { + this.project = project; } inputFile(file: File) { } @@ -42,142 +33,123 @@ export class ProjectCompiler implements ICompiler { return; } - let root = this.project.input.commonBasePath; - let rootFilenames: string[] = this.project.input.getFileNames(true); + const rootFilenames: string[] = this.project.input.getFileNames(true); if (!this.project.singleOutput) { - // Add an empty file under the root. - // This will make sure the commonSourceDirectory, calculated by TypeScript, won't point to a subdirectory of the root. - // We cannot use the `rootDir` option here, since that gives errors if the commonSourceDirectory points to a - // directory containing the rootDir instead of the rootDir, which will break the build when using `noEmitOnError`. - // The empty file is filtered out later on. - let emptyFileName = path.join(this.project.options['rootDir'] ? path.resolve(this.project.projectDirectory, this.project.options['rootDir']) : root, '________________empty.ts'); - rootFilenames.push(emptyFileName); - this.project.input.addContent(emptyFileName, ''); - } - - if (!this.project.input.isChanged(true)) { - // Re-use old output - const old = this.project.previousOutput; - - for (const error of old.errors) { - this.project.output.error(error); + if (this.project.options.rootDir === undefined) { + this.project.options.rootDir = utils.getCommonBasePathOfArray( + rootFilenames.filter(fileName => fileName.substr(-5) !== ".d.ts") + .map(fileName => this.project.input.getFile(fileName).gulp.base) + ); } + } - for (const fileName of Object.keys(old.files)) { - const file = old.files[fileName]; - this.project.output.write(file.fileName + '.' + file.extension[OutputFileKind.JavaScript], file.content[OutputFileKind.JavaScript]); - this.project.output.write(file.fileName + '.' + file.extension[OutputFileKind.SourceMap], file.content[OutputFileKind.SourceMap]); - if (file.content[OutputFileKind.Definitions] !== undefined) { - this.project.output.write(file.fileName + '.' + file.extension[OutputFileKind.Definitions], file.content[OutputFileKind.Definitions]); - } - } - - this.project.output.finish(old.results); + const currentDirectory = utils.getCommonBasePathOfArray( + rootFilenames.map(fileName => this.project.input.getFile(fileName).gulp.cwd) + ); - return; - } - - this.project.options.sourceRoot = root; - this.host = new Host( this.project.typescript, - this.project.currentDirectory, + currentDirectory, this.project.input, - !this.project.noExternalResolve, - this.project.options.target >= ts.ScriptTarget.ES6 ? 'lib.es6.d.ts' : 'lib.d.ts' + this.project.options ); - if (this.project.filterSettings !== undefined) { - let filter = new Filter(this.project, this.project.filterSettings); - rootFilenames = rootFilenames.filter((fileName) => filter.match(fileName)); - } + this.program = this.project.typescript.createProgram(rootFilenames, this.project.options, this.host, this.program); + const preEmitDiagnostics = this.project.typescript.getPreEmitDiagnostics(this.program); - // Creating a program to compile the sources - // We cast to `tsApi.CreateProgram` so we can pass the old program as an extra argument. - // TS 1.6+ will try to reuse program structure (if possible) - this.program = ( this.project.typescript.createProgram)(rootFilenames, this.project.options, this.host, this.program); + const result = emptyCompilationResult(); + result.optionsErrors = this.program.getOptionsDiagnostics().length; + result.syntaxErrors = this.program.getSyntacticDiagnostics().length; + result.globalErrors = this.program.getGlobalDiagnostics().length; + result.semanticErrors = this.program.getSemanticDiagnostics().length; + if (this.project.options.declaration) { + result.declarationErrors = this.program.getDeclarationDiagnostics().length; + } - const [errors, result] = tsApi.getDiagnosticsAndEmit(this.program); + this.reportDiagnostics(preEmitDiagnostics); - for (let i = 0; i < errors.length; i++) { - this.project.output.diagnostic(errors[i]); - } + const emitOutput = this.program.emit(); + result.emitErrors = emitOutput.diagnostics.length; + result.emitSkipped = emitOutput.emitSkipped; - for (const fileName in this.host.output) { - if (!this.host.output.hasOwnProperty(fileName)) continue; - - let content = this.host.output[fileName] - const [, extension] = utils.splitExtension(fileName); - if (extension === 'js' || extension === 'jsx') { - content = this.removeSourceMapComment(content); - } + if (this.project.singleOutput) { + this.emitFile(result, currentDirectory); + } else { + // Emit files one by one + for (const fileName of this.host.input.getFileNames(true)) { + const file = this.project.input.getFile(fileName); - this.project.output.write(fileName, content); + this.emitFile(result, currentDirectory, file); + } } this.project.output.finish(result); } - - private _commonBaseDiff: [number, string]; - /** - * Calculates the difference between the common base directory calculated based on the base paths of the input files - * and the common source directory calculated by TypeScript. - */ - private get commonBaseDiff(): [number, string] { - if (this._commonBaseDiff) return this._commonBaseDiff; - - const expected = this.project.input.commonBasePath; - const real = this.project.input.commonSourceDirectory; - - const length = real.length - expected.length; - - this._commonBaseDiff = [length, real.substring(real.length - length)] - - if (length > 0) { - this._commonBaseDiff = [length, real.substring(real.length - length)]; + + private emitFile(result: CompilationResult, currentDirectory: string, file?: File) { + let jsFileName: string; + let dtsFileName: string; + let jsContent: string; + let dtsContent: string; + let jsMapContent: string; + + const emitOutput = this.program.emit(file && file.ts, (fileName: string, content: string) => { + const [, extension] = utils.splitExtension(fileName, ['d.ts']); + switch (extension) { + case 'js': + case 'jsx': + jsFileName = fileName; + jsContent = this.removeSourceMapComment(content); + break; + case 'd.ts': + dtsFileName = fileName; + dtsContent = content; + break; + case 'map': + jsMapContent = content; + break; + } + }); + + result.emitErrors += emitOutput.diagnostics.length; + this.reportDiagnostics(emitOutput.diagnostics); + + let base: string; + let baseDeclarations: string; + if (file) { + base = file.gulp.base; + if (this.project.options.outDir) { + const baseRelative = path.relative(this.project.options.rootDir, base); + base = path.join(this.project.options.outDir, baseRelative); + } + baseDeclarations = base; + if (this.project.options.declarationDir) { + const baseRelative = path.relative(this.project.options.rootDir, file.gulp.base); + baseDeclarations = path.join(this.project.options.declarationDir, baseRelative); + } } else { - this._commonBaseDiff = [length, expected.substring(expected.length + length)]; + const outFile = this.project.options.outFile || this.project.options.out; + base = jsFileName.substring(0, jsFileName.length - outFile.length); } - - if (this._commonBaseDiff[1] === '/' || this._commonBaseDiff[1] === '\\') { - this._commonBaseDiff = [0, '']; + + if (jsContent !== undefined) { + 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); + } + + if (emitOutput.emitSkipped) { + result.emitSkipped = true; } - - return this._commonBaseDiff; } - // This empty setter will prevent that TS emits 'readonly' modifier. - // 'readonly' is not supported in current stable release. - private set commonBaseDiff(value) {} - - correctSourceMap(map: RawSourceMap) { - const [diffLength, diff] = this.commonBaseDiff; - - if (this.project.singleOutput) return true; - - if (diffLength < 0) { - // There were files added outside of the common base. - let outsideRoot = false; - map.sources = map.sources.map(fileName => { - const fullPath = path.join(this.project.input.commonSourceDirectory, fileName); - const fullPathNormalized = utils.normalizePath(fullPath); - let relative = path.relative(utils.normalizePath(this.project.input.commonBasePath), fullPathNormalized); - const first2 = relative.substring(0, 2); - const first3 = relative.substring(0, 3); - if (first3 === '../' || first3 === '..\\') { - outsideRoot = true; - } else if (first2 === './' || first2 === '.\\') { - relative = relative.substring(2); - } - return path.normalize(fullPath).substring(fullPathNormalized.length - relative.length); - }); - - if (outsideRoot) return false; + private reportDiagnostics(diagnostics: ts.Diagnostic[]) { + for (const error of diagnostics) { + this.project.output.diagnostic(error); } - - return true; } - + private removeSourceMapComment(content: string): string { // By default the TypeScript automaticly inserts a source map comment. // This should be removed because gulp-sourcemaps takes care of that. @@ -188,21 +160,38 @@ export class ProjectCompiler implements ICompiler { } } +interface FileResult { + fileName: string; + diagnostics: ts.Diagnostic[]; + content: string; + sourceMap: string; +} export class FileCompiler implements ICompiler { host: Host; - project: Project; - program: ts.Program; - - private errorsPerFile: utils.Map = {}; - private previousErrorsPerFile: utils.Map = {}; + project: ProjectInfo; + + private output: utils.Map = {}; + private previousOutput: utils.Map = {}; + private compilationResult: CompilationResult = undefined; - prepare(_project: Project) { - this.project = _project; + prepare(project: ProjectInfo) { + this.project = project; this.project.input.noParse = true; this.compilationResult = emptyCompilationResult(); } + private write(file: File, fileName: string, diagnostics: ts.Diagnostic[], content: string, sourceMap: string) { + 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); + } + inputFile(file: File) { if (file.fileNameNormalized.substr(file.fileNameNormalized.length - 5) === '.d.ts') { return; // Don't compile definition files @@ -211,39 +200,19 @@ export class FileCompiler implements ICompiler { if (this.project.input.getFileChange(file.fileNameOriginal).state === FileChangeState.Equal) { // Not changed, re-use old file. - const old = this.project.previousOutput; - - const diagnostics = this.previousErrorsPerFile[file.fileNameNormalized] - for (const error of diagnostics) { - this.project.output.diagnostic(error); - } - this.compilationResult.transpileErrors += diagnostics.length; - this.errorsPerFile[file.fileNameNormalized] = this.previousErrorsPerFile[file.fileNameNormalized]; - - for (const fileName of Object.keys(old.files)) { - const oldFile = old.files[fileName]; - if (oldFile.original.fileNameNormalized !== file.fileNameNormalized) continue; - - this.project.output.write(oldFile.fileName + '.' + oldFile.extension[OutputFileKind.JavaScript], oldFile.content[OutputFileKind.JavaScript]); - this.project.output.write(oldFile.fileName + '.' + oldFile.extension[OutputFileKind.SourceMap], oldFile.content[OutputFileKind.SourceMap]); - } + const old = this.previousOutput[file.fileNameNormalized]; + this.write(file, old.fileName, old.diagnostics, old.content, old.sourceMap); return; } const diagnostics: ts.Diagnostic[] = []; - const outputString = tsApi.transpile( - this.project.typescript, + const outputString = this.project.typescript.transpile( file.content, this.project.options, file.fileNameOriginal, diagnostics ); - for (const diagnostic of diagnostics) { - this.project.output.diagnostic(diagnostic); - } - this.compilationResult.transpileErrors += diagnostics.length; - let index = outputString.lastIndexOf('\n') let mapString = outputString.substring(index + 1); if (mapString.substring(0, 1) === '\r') mapString = mapString.substring(1); @@ -257,26 +226,20 @@ export class FileCompiler implements ICompiler { mapString = mapString.substring(start.length); let map: RawSourceMap = JSON.parse(new Buffer(mapString, 'base64').toString()); - map.sourceRoot = path.resolve(file.gulp.cwd, file.gulp.base) - map.sources[0] = path.relative(map.sourceRoot, file.gulp.path); + // TODO: Set paths correctly + // map.sourceRoot = path.resolve(file.gulp.cwd, file.gulp.base); + // map.sources[0] = path.relative(map.sourceRoot, file.gulp.path); const [fileNameExtensionless] = utils.splitExtension(file.fileNameOriginal); const [, extension] = utils.splitExtension(map.file); // js or jsx - this.project.output.write(fileNameExtensionless + '.' + extension, outputString.substring(0, index)); - this.project.output.write(fileNameExtensionless + '.' + extension + '.map', JSON.stringify(map)); - - this.errorsPerFile[file.fileNameNormalized] = diagnostics; + this.write(file, fileNameExtensionless + '.' + extension, diagnostics, outputString.substring(0, index), JSON.stringify(map)); } inputDone() { this.project.output.finish(this.compilationResult); - this.previousErrorsPerFile = this.errorsPerFile; - this.errorsPerFile = {}; + this.previousOutput = this.output; + this.output = {}; } - - correctSourceMap(map: RawSourceMap) { - return true; - } -} \ No newline at end of file +} diff --git a/lib/filter.ts b/lib/filter.ts deleted file mode 100644 index 9e9a30cf..00000000 --- a/lib/filter.ts +++ /dev/null @@ -1,98 +0,0 @@ -import * as ts from 'typescript'; -import * as tsApi from './tsapi'; -import * as path from 'path'; -import { Project } from './project'; -import * as main from './main'; -import { File } from './input'; -import * as utils from './utils'; - -export class Filter { - project: Project; - constructor(project: Project, filters: main.FilterSettings) { - this.project = project; - - if (filters.referencedFrom !== undefined) { - this.referencedFrom = this.mapFilenamesToFiles(filters.referencedFrom); - - this.referencedFromAll = []; - - const addReference = (file: File) => { - if (this.referencedFromAll.indexOf(file.fileNameNormalized) !== -1) return; - - this.referencedFromAll.push(file.fileNameNormalized); - - for (let i = 0; i < file.ts.referencedFiles.length; i++) { - let ref = tsApi.getFileName(file.ts.referencedFiles[i]); - ref = utils.normalizePath(path.join(path.dirname(tsApi.getFileName(file.ts)), ref)); - - const refFile = this.project.input.getFile(ref); - if (refFile) addReference(refFile); - } - }; - - for (let i = 0; i < this.referencedFrom.length; i++) { - addReference(this.referencedFrom[i]); - } - } - } - - private mapFilenamesToFiles(filenames: string[]) { - const files: File[] = []; - for (let i = 0; i < filenames.length; i++) { - const file = this.getFile(filenames[i]); - if (file === undefined) { - console.log('gulp-typescript: Could not find file ' + filenames[i]); - } else { - files.push(file); - } - } - return files; - } - - private getFile(searchFileName: string): File { - const fileNames = this.project.input.getFileNames(true); - for (const fileName of fileNames) { - const file = this.project.input.getFile(fileName); - if (!file || !file.gulp) continue; - const base = path.resolve( - process.cwd(), - file.gulp.base - ) + '/'; - if (path.resolve(base, searchFileName) === file.gulp.path) { - return file; - } - } - return undefined; - } - - private referencedFrom: File[] = undefined; - private referencedFromAll: string[] = undefined; - - match(fileName: string) { - let fileNameExtensionless = utils.splitExtension(fileName)[0]; - let outputFile = this.project.output.files[utils.normalizePath(fileNameExtensionless)]; - let file: File; - - if (!outputFile) { - file = this.project.input.getFile(fileName); - if (!file) { - console.log('gulp-typescript: Could not find file ' + fileName + '. Make sure you don\'t rename a file before you pass it to ts.filter()'); - return false; - } - } else { - file = outputFile.original; - } - - if (this.referencedFrom !== undefined) { - if (!this.matchReferencedFrom(fileName, file)) { - return false; - } - } - - return true; - } - - private matchReferencedFrom(filename: string, file: File) { - return this.referencedFromAll.indexOf(file.fileNameNormalized) !== -1; - } -} diff --git a/lib/host.ts b/lib/host.ts index af4de5bd..8ab829e8 100644 --- a/lib/host.ts +++ b/lib/host.ts @@ -1,14 +1,10 @@ import * as ts from 'typescript'; -import * as tsApi from './tsapi'; -import { Project } from './project'; -import { File, FileCache } from './input'; +import { FileCache } from './input'; import * as utils from './utils'; -import * as fs from 'fs'; -import * as path from 'path'; -const libDirectory = '__lib/'; export class Host implements ts.CompilerHost { - static libDefault: utils.Map = {}; + // TODO: Cache lib.d.ts between compilations. Old code: + /* static libDefault: utils.Map = {}; static getLibDefault(typescript: typeof ts, libFileName: string, originalFileName: string) { let fileName: string; for (const i in require.cache) { @@ -28,34 +24,20 @@ export class Host implements ts.CompilerHost { const content = fs.readFileSync(fileName).toString('utf8'); return this.libDefault[fileName] = tsApi.createSourceFile(typescript, originalFileName, content, typescript.ScriptTarget.ES3); // Will also work for ES5 & 6 - } + } */ typescript: typeof ts; + fallback: ts.CompilerHost; currentDirectory: string; - private externalResolve: boolean; - private libFileName: string; input: FileCache; - output: utils.Map; - constructor(typescript: typeof ts, currentDirectory: string, input: FileCache, externalResolve: boolean, libFileName: string) { + constructor(typescript: typeof ts, currentDirectory: string, input: FileCache, options: ts.CompilerOptions) { this.typescript = typescript; + this.fallback = typescript.createCompilerHost(options); this.currentDirectory = currentDirectory; this.input = input; - - this.externalResolve = externalResolve; - this.libFileName = libFileName; - - const fallback = typescript.createCompilerHost({}); - this.realpath = fallback['realpath']; - this.getDirectories = fallback['getDirectories']; - - this.reset(); - } - - private reset() { - this.output = {}; } getNewLine() { @@ -71,90 +53,42 @@ export class Host implements ts.CompilerHost { getCanonicalFileName(filename: string) { return utils.normalizePath(filename); } - getDefaultLibFilename() { - return '__lib.d.ts'; - } - getDefaultLibFileName() { - return '__lib.d.ts'; + getDefaultLibFileName(options: ts.CompilerOptions) { + return this.fallback.getDefaultLibFileName(options); } getDefaultLibLocation() { - return libDirectory; + return this.fallback.getDefaultLibLocation(); } - writeFile = (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) => { - this.output[fileName] = data; - } - - fileExists(fileName: string) { - if (fileName === '__lib.d.ts') { - return true; - } + writeFile = (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) => {} + fileExists = (fileName: string) => { let sourceFile = this.input.getFile(fileName); if (sourceFile) return true; - if (this.externalResolve) { - try { - const stat = fs.statSync(fileName); - if (!stat) return false; - return stat.isFile(); - } catch (ex) { - - } - } - return false; + return this.fallback.fileExists(fileName); } - readFile(fileName: string) { - const normalizedFileName = utils.normalizePath(fileName); - + readFile = (fileName: string) => { let sourceFile = this.input.getFile(fileName); if (sourceFile) return sourceFile.content; - if (this.externalResolve) { - // Read the whole file (and cache contents) to prevent race conditions. - let text: string; - try { - text = fs.readFileSync(fileName).toString('utf8'); - } catch (ex) { - return undefined; - } - return text; - } - return undefined; + return this.fallback.readFile(fileName); } getSourceFile = (fileName: string, languageVersion: ts.ScriptTarget, onError?: (message: string) => void): ts.SourceFile => { - if (fileName === '__lib.d.ts') { - return Host.getLibDefault(this.typescript, this.libFileName, fileName); - } - if (fileName.substring(0, libDirectory.length) === libDirectory) { - try { - return Host.getLibDefault(this.typescript, fileName.substring(libDirectory.length), fileName); - } catch (e) {} - try { - return Host.getLibDefault(this.typescript, 'lib.' + fileName.substring(libDirectory.length), fileName); - } catch (e) {} - return undefined; - } - + // TODO: Cache lib.d.ts files between compilations let sourceFile = this.input.getFile(fileName); if (sourceFile) return sourceFile.ts; - if (this.externalResolve) { - let text: string; - try { - text = fs.readFileSync(fileName).toString('utf8'); - } catch (ex) { - return undefined; - } - this.input.addContent(fileName, text); + return this.fallback.getSourceFile(fileName, languageVersion, onError); + } - let sourceFile = this.input.getFile(fileName); - if (sourceFile) return sourceFile.ts; - } + realpath = (path: string) => { + return this.fallback.realpath(path); + } + + getDirectories = (path: string) => { + return this.fallback.getDirectories(path); } - - realpath: any; - getDirectories: any; } diff --git a/lib/input.ts b/lib/input.ts index 72fee1a1..afaa23b4 100644 --- a/lib/input.ts +++ b/lib/input.ts @@ -1,6 +1,5 @@ import * as ts from 'typescript'; import * as path from 'path'; -import * as tsApi from './tsapi'; import * as utils from './utils'; import { VinylFile } from './types'; @@ -192,7 +191,7 @@ export class FileCache { return; } } - file.ts = tsApi.createSourceFile(this.typescript, file.fileNameOriginal, file.content, this.options.target, this.version + '') + file.ts = this.typescript.createSourceFile(file.fileNameOriginal, file.content, this.options.target); } getFile(name: string) { diff --git a/lib/main.ts b/lib/main.ts index 70badcb6..c74bf607 100644 --- a/lib/main.ts +++ b/lib/main.ts @@ -1,272 +1,100 @@ +/// + import * as ts from 'typescript'; import * as fs from 'fs'; -import * as gutil from 'gulp-util'; import * as path from 'path'; -import * as stream from 'stream'; -import * as project from './project'; +import * as gutil from 'gulp-util'; +import * as _project from './project'; import * as utils from './utils'; -import * as _filter from './filter'; import * as _reporter from './reporter'; -import * as compiler from './compiler'; -import * as tsApi from './tsapi'; -import * as through2 from 'through2'; -import { VinylFile, TsConfig } from './types'; - -const PLUGIN_NAME = 'gulp-typescript'; - -class CompileStream extends stream.Duplex { - constructor(proj: project.Project) { - super({objectMode: true}); - - this.project = proj; - - // Backwards compatibility - this.js = this; - - // Prevent "Unhandled stream error in pipe" when compilation error occurs. - this.on('error', () => {}); - } - - private project: project.Project; - - _write(file: any, encoding, cb: (err?) => void); - _write(file: VinylFile, encoding, cb = (err?) => {}) { - if (!file) return cb(); - - if (file.isNull()) { - cb(); - return; - } - if (file.isStream()) { - return cb(new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported')); - } - - const isFirstFile = this.project.input.firstSourceFile === undefined; - - const inputFile = this.project.input.addGulp(file); - - if (isFirstFile) { - this.project.currentDirectory = this.project.input.firstSourceFile.gulp.cwd; - } - - this.project.compiler.inputFile(inputFile); - - cb(); - } - _read() { - - } - - end(chunk?, encoding?, callback?) { - if (typeof chunk === 'function') { - this._write(null, null, chunk); - } else if (typeof encoding === 'function') { - this._write(chunk, null, encoding); - } else { - this._write(chunk, encoding, callback); - } - - this.project.compiler.inputDone(); - } - - js: stream.Readable; - dts: stream.Readable = new CompileOutputStream(); -} -class CompileOutputStream extends stream.Readable { - constructor() { - super({objectMode: true}); - } - - _read() { +import { TsConfig } from './types'; +function compile(): compile.CompileStream; +function compile(proj: _project.Project, theReporter?: _reporter.Reporter): compile.CompileStream; +function compile(settings: compile.Settings, theReporter?: _reporter.Reporter): compile.CompileStream; +function compile(param?: any, theReporter?: _reporter.Reporter): compile.CompileStream { + if (arguments.length >= 3) { + 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."); } -} -function compile(): compile.CompileStream; -function compile(proj: project.Project, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter): compile.CompileStream; -function compile(settings: compile.Settings, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter): compile.CompileStream; -function compile(param?: any, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter): compile.CompileStream { - let proj: project.Project; - if (param instanceof project.Project) { + let proj: _project.Project; + if (typeof param === "function") { proj = param; - if (proj.running) { - throw new Error('gulp-typescript: A project cannot be used in two compilations at the same time. Create multiple projects with createProject instead.'); + if (arguments.length >= 2) { + deprecate("ts(tsProject, ...) has been deprecated", + "use .pipe(tsProject(reporter)) instead", + "As of gulp-typescript 3.0, .pipe(ts(tsProject, ...)) should be written as .pipe(tsProject(reporter))."); + } else { + deprecate("ts(tsProject) has been deprecated", + "use .pipe(tsProject(reporter)) instead", + "As of gulp-typescript 3.0, .pipe(ts(tsProject)) should be written as .pipe(tsProject())."); } - proj.running = true; } else { proj = compile.createProject(param || {}); } - - const inputStream = new CompileStream(proj); - - proj.reset(inputStream.js, inputStream.dts); - proj.filterSettings = filters; - proj.reporter = theReporter || _reporter.defaultReporter(); - - proj.compiler.prepare(proj); - - return inputStream; + return proj(theReporter); } -type Enum = utils.Map; -function createEnumMap(input: Enum): utils.Map { - const map: utils.Map = {}; - const keys = Object.keys(input); - - for (const key of keys) { - let value = input[key]; - if (typeof value === 'number') { - map[key.toLowerCase()] = value; - } +function getTypeScript(typescript: typeof ts) { + if (typescript) return typescript; + try { + return require('typescript'); + } catch (e) { + deprecate("TypeScript not installed", + "install with `npm install typescript --save-dev`", + "As of gulp-typescript 3.0, TypeScript isn't bundled with gulp-typescript any more.\nInstall the latest stable version with `npm install typescript --save-dev`\nor a nightly with `npm install typescript@next --save-dev`"); + throw new Error("TypeScript not installed"); } - - return map; -} - -function getScriptTarget(typescript: typeof ts, language: string) { - const map: utils.Map = createEnumMap(( typescript).ScriptTarget); - return map[language.toLowerCase()]; } -function getModuleKind(typescript: typeof ts, moduleName: string) { - const map: utils.Map = createEnumMap(( typescript).ModuleKind); - return map[moduleName.toLowerCase()]; -} - -function getModuleResolution(typescript: typeof ts, kind: string) { - if (( typescript).ModuleResolutionKind === undefined) { - return undefined; // Not supported in TS1.4 & 1.5 - } - // Enum member name is NodeJs, while option name is `node` - if (kind === 'node') kind = 'nodejs'; - const map: utils.Map = createEnumMap(( typescript).ModuleResolutionKind); - return map[kind.toLowerCase()]; -} - -function getJsxEmit(typescript: typeof ts, jsx: string) { - if (( typescript).JsxEmit === undefined) { - return undefined; // Not supported in TS1.4 & 1.5 - } - const map: utils.Map = createEnumMap(( typescript).JsxEmit); - return map[jsx.toLowerCase()]; -} - - function getCompilerOptions(settings: compile.Settings, projectPath: string, configFileName: string): ts.CompilerOptions { - var typescript = settings.typescript || ts; + 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.') } - - // Try to use `convertCompilerOptionsFromJson` to convert options. - if ((typescript).convertCompilerOptionsFromJson) { - // Copy settings and remove several options - const newSettings: compile.Settings = {}; - for (const option of Object.keys(settings)) { - if (option === 'declarationFiles') { - newSettings.declaration = settings.declarationFiles; - continue; - } - if (option === 'noExternalResolve' || - option === 'sortOutput' || - option === 'typescript' || - option === 'sourceMap' || - option === 'inlineSourceMap') continue; - - newSettings[option] = settings[option]; - } - - const result = (typescript).convertCompilerOptionsFromJson(newSettings, projectPath, configFileName); - const reporter = _reporter.defaultReporter(); - for (const error of result.errors) { - reporter.error(utils.getError(error, typescript), typescript); - } - result.options.sourceMap = true; - ( result.options).suppressOutputPathCheck = true; - return result.options; - } - - // Legacy conversion - const tsSettings: ts.CompilerOptions = {}; - - for (const key in settings) { - if (!Object.hasOwnProperty.call(settings, key)) continue; - if (key === 'noExternalResolve' || - key === 'declarationFiles' || - key === 'sortOutput' || - key === 'typescript' || - key === 'target' || // Target, module, moduleResolution, sourceRoot & jsx are added below - key === 'module' || - key === 'moduleResolution' || - key === 'jsx' || - key === 'sourceRoot' || - key === 'sourceMap' || - key === 'inlineSourceMap') continue; - tsSettings[key] = settings[key]; + if (settings.noExternalResolve !== undefined) { + deprecate("noExternalResolve is deprecated", + "use noResolve instead", + "The non-standard option noExternalResolve has been removed as of gulp-typescript 3.0.\nUse noResolve instead."); } - - if (typeof settings.target === 'string') { - tsSettings.target = getScriptTarget(typescript, settings.target); - } else if (typeof settings.target === 'number') { - tsSettings.target = settings.target; - } - if (typeof settings.module === 'string') { - tsSettings.module = getModuleKind(typescript, settings.module); - } else if (typeof settings.module === 'number') { - tsSettings.module = settings.module; - } - if (typeof settings.jsx === 'string') { - // jsx is not supported in TS1.4 & 1.5, so we cannot do `tsSettings.jsx = `, but we have to use brackets. - tsSettings['jsx'] = getJsxEmit(typescript, settings.jsx); - } else if (typeof settings.jsx === 'number') { - tsSettings['jsx'] = settings.jsx; + if (settings.sortOutput !== undefined) { + deprecate("sortOutput is deprecated", + "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."); } - if (typeof settings.moduleResolution === 'string') { - // moduleResolution is not supported in TS1.4 & 1.5, so we cannot do `tsSettings.moduleResolution = `, but we have to use brackets. - tsSettings['moduleResolution'] = getModuleResolution(typescript, settings.moduleResolution); - } else if (typeof settings.moduleResolution === 'number') { - tsSettings['moduleResolution'] = settings.moduleResolution; - } - - if (tsApi.isTS14(typescript)) { - if (tsSettings.target === undefined) { - // TS 1.4 has a bug that the target needs to be set. - tsSettings.target = ts.ScriptTarget.ES3; - } - if (tsSettings.module === undefined) { - // Same bug in TS 1.4 as previous comment. - tsSettings.module = ts.ModuleKind.None; + + // Copy settings and remove several options + const newSettings: compile.Settings = {}; + for (const option of Object.keys(settings)) { + if (option === 'declarationFiles') { + newSettings.declaration = settings.declarationFiles; + continue; } + if (option === 'noExternalResolve' || + option === 'sortOutput' || + option === 'typescript' || + option === 'sourceMap' || + option === 'inlineSourceMap') continue; + + newSettings[option] = settings[option]; } - - if (settings.declarationFiles !== undefined) { - tsSettings.declaration = settings.declarationFiles; - } - - tsSettings.sourceMap = true; - - // Suppress errors when providing `allowJs` without `outDir`. - ( tsSettings).suppressOutputPathCheck = true; - - if (( tsSettings).baseUrl) { - ( tsSettings).baseUrl = path.resolve(projectPath, ( tsSettings).baseUrl); - } - if (( tsSettings).rootDirs) { - ( tsSettings).rootDirs = ( tsSettings).rootDirs.map( - dir => path.resolve(projectPath, dir) - ); + + const result = typescript.convertCompilerOptionsFromJson(newSettings, projectPath, configFileName); + const reporter = _reporter.defaultReporter(); + for (const error of result.errors) { + reporter.error(utils.getError(error, typescript), typescript); } + result.options.sourceMap = true; + (result.options as any).suppressOutputPathCheck = true; - return tsSettings; + return result.options; } module compile { - export interface CompileStream extends stream.Readable { - js: stream.Readable; - dts: stream.Readable; - } export interface Settings { out?: string; outFile?: string; @@ -306,10 +134,8 @@ module compile { // Unsupported by gulp-typescript sourceRoot?: string; // Use sourceRoot in gulp-sourcemaps instead } - export interface FilterSettings { - referencedFrom: string[]; - } - export import Project = project.Project; + export type Project = _project.Project; + export type CompileStream = _project.ICompileStream; export import reporter = _reporter; export function createProject(settings?: Settings); @@ -320,12 +146,12 @@ module compile { let projectDirectory = process.cwd(); if (fileNameOrSettings !== undefined) { if (typeof fileNameOrSettings === 'string') { - tsConfigFileName = fileNameOrSettings; - projectDirectory = path.dirname(fileNameOrSettings); - // load file and strip BOM, since JSON.parse fails to parse if there's a BOM present - let tsConfigText = fs.readFileSync(fileNameOrSettings).toString(); - const typescript = (settings && settings.typescript) || ts; - const tsConfig = tsApi.parseTsConfig(typescript, tsConfigFileName, tsConfigText); + tsConfigFileName = path.resolve(process.cwd(), fileNameOrSettings); + projectDirectory = path.dirname(tsConfigFileName); + // Load file and strip BOM, since JSON.parse fails to parse if there's a BOM present + let tsConfigText = fs.readFileSync(tsConfigFileName).toString(); + const typescript = getTypeScript(settings && settings.typescript); + const tsConfig = typescript.parseConfigFileTextToJson(tsConfigFileName, tsConfigText); tsConfigContent = tsConfig.config || {}; if (tsConfig.error) { console.log(tsConfig.error.messageText); @@ -347,38 +173,27 @@ module compile { } } - const project = new Project(tsConfigFileName, projectDirectory, tsConfigContent, getCompilerOptions(settings, projectDirectory, tsConfigFileName), settings.noExternalResolve ? true : false, settings.sortOutput ? true : false, settings.typescript); - - // Isolated modules are only supported when using TS1.5+ - if (project.options['isolatedModules'] && !tsApi.isTS14(project.typescript)) { - if (project.options.out !== undefined || project.options['outFile'] !== undefined || project.sortOutput) { - console.warn('You cannot combine option `isolatedModules` with `out`, `outFile` or `sortOutput`'); - } - - project.options['newLine'] = (ts).NewLineKind.LineFeed; //new line option/kind fails TS1.4 typecheck - project.options.sourceMap = false; - project.options.declaration = false; - project.options['inlineSourceMap'] = true; - project.compiler = new compiler.FileCompiler(); - } else { - project.compiler = new compiler.ProjectCompiler(); - } + const project = _project.setupProject(projectDirectory, tsConfigContent, getCompilerOptions(settings, projectDirectory, tsConfigFileName), getTypeScript(settings.typescript)); return project; } - export function filter(project: Project, filters: FilterSettings): NodeJS.ReadWriteStream { - let filterObj: _filter.Filter = undefined; - return through2.obj(function (file: gutil.File, encoding, callback: () => void) { - if (!filterObj) { // Make sure we create the filter object when the compilation is complete. - filterObj = new _filter.Filter(project, filters); - } - - if (filterObj.match(file.path)) this.push(file); - - callback(); - }); + export function filter(...args: any[]) { + 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.'); } } +function deprecate(title: string, alternative: string, description: string) { + console.log( + gutil.colors.red('gulp-typescript').toString() + + gutil.colors.gray(': ') + + title + + gutil.colors.gray(' - ') + + alternative); + if (description) console.log(' ' + gutil.colors.gray(description.replace(/\n/g, '\n '))); + console.log(' ' + gutil.colors.gray('More information: ' + gutil.colors.underline('http://dev.ivogabe.com/gulp-typescript-3/'))); +} + export = compile; diff --git a/lib/output.ts b/lib/output.ts index cb1f2f90..7cbdb4cf 100644 --- a/lib/output.ts +++ b/lib/output.ts @@ -5,255 +5,111 @@ import * as sourceMap from 'source-map'; import * as gutil from 'gulp-util'; import * as utils from './utils'; import * as input from './input'; -import * as tsApi from './tsapi'; import * as reporter from './reporter'; import * as project from './project'; import { VinylFile, RawSourceMap } from './types'; -import { ProjectCompiler } from "./compiler"; - -export interface OutputFile { - fileName: string; - original: input.File; - sourceMapOrigins: input.File[]; - extension: { [ kind: number /* OutputFileKind */ ]: string }; - content: { [ kind: number /* OutputFileKind */ ]: string }; - pushed: boolean; - skipPush: boolean; - sourceMapsApplied: boolean; - sourceMap: RawSourceMap; - sourceMapString: string; -} - -export enum OutputFileKind { - JavaScript, - SourceMap, - Definitions -} export class Output { - static knownExtensions: string[] = ['js', 'jsx', 'js.map', 'jsx.map', 'd.ts']; - - constructor(_project: project.Project, streamJs: stream.Readable, streamDts: stream.Readable) { + constructor(_project: project.ProjectInfo, streamFull: stream.Readable, streamJs: stream.Readable, streamDts: stream.Readable) { this.project = _project; + this.streamFull = streamFull; this.streamJs = streamJs; this.streamDts = streamDts; } - project: project.Project; - files: utils.Map = {}; - errors: reporter.TypeScriptError[] = []; - results: reporter.CompilationResult; + project: project.ProjectInfo; + result: reporter.CompilationResult; + // .js and .d.ts files + streamFull: stream.Readable; + // .js files streamJs: stream.Readable; + // .d.ts files streamDts: stream.Readable; - write(fileName: string, content: string) { - const [fileNameExtensionless, extension] = utils.splitExtension(fileName, Output.knownExtensions); - let kind: OutputFileKind; - - switch (extension) { - case 'js': - case 'jsx': - kind = OutputFileKind.JavaScript; - break; - case 'js.map': - case 'jsx.map': - kind = OutputFileKind.SourceMap; - break; - case 'd.ts': // .d.ts - kind = OutputFileKind.Definitions; - break; - } - this.addOrMergeFile(fileNameExtensionless, extension, kind, content); + writeJs(base: string, fileName: string, content: string, sourceMapContent: string, cwd: string, original: input.File) { + const file = new gutil.File({ + path: fileName, + contents: new Buffer(content), + cwd, + base + }); + const appliedSourceMap = this.applySourceMap(sourceMapContent, original, file); + if (appliedSourceMap) file.sourceMap = JSON.parse(appliedSourceMap); + this.streamFull.push(file); + this.streamJs.push(file); } - /** - * Adds the file to the `this.files`. - * If there is already a file with the specified `fileName`, it will be merged. - * This method should be called 3 times, 1 time for each `OutputFileKind`. - * @param fileName The extensionless filename. - */ - private addOrMergeFile(fileName: string, extension: string, kind: OutputFileKind, content: string) { - let file = this.files[utils.normalizePath(fileName)]; - if (file) { - file.extension[kind] = extension; - file.content[kind] = content; - - if (file.content[OutputFileKind.JavaScript] !== undefined - && file.content[OutputFileKind.SourceMap] !== undefined - && (file.content[OutputFileKind.Definitions] !== undefined || !this.project.options.declaration)) { - - file.sourceMap = JSON.parse(file.content[OutputFileKind.SourceMap]); - if (!this.project.compiler.correctSourceMap(file.sourceMap)) { - file.skipPush = true; - return; - } - - if (this.project.singleOutput) { - file.original = this.project.input.firstSourceFile; - file.sourceMapOrigins = this.project.input.getFileNames(true).map(fName => this.project.input.getFile(fName)); - } else { - const originalFileName = path.resolve(file.sourceMap.sourceRoot, file.sourceMap.sources[0]); - file.original = this.project.input.getFile(originalFileName); - - if (!file.original) { - console.error(`Could not find input file ${ originalFileName }. This is probably an issue of gulp-typescript.` - + `\nPlease report it at https://github.com/ivogabe/gulp-typescript/issues` - + `\nDebug information: \nsourceRoot = ${ JSON.stringify(file.sourceMap.sourceRoot) }\nsources = ${ JSON.stringify(file.sourceMap.sources) }`); - file.skipPush = true; - file.sourceMapOrigins = []; - } else { - file.skipPush = !file.original.gulp; - file.sourceMapOrigins = [file.original]; - } - const [, jsExtension] = utils.splitExtension(file.sourceMap.file); // js or jsx - const [filePath, ] = utils.splitExtension(originalFileName); - const outputFileName = `${filePath}.${jsExtension}`; - - // Fix the output filename in the source map, which must be relative - // to the source root or it won't work correctly in gulp-sourcemaps if - // there are more transformations down in the pipeline. - file.sourceMap.file = path.relative(file.sourceMap.sourceRoot, outputFileName); - } - - this.applySourceMaps(file); - - if (!this.project.sortOutput) { // if sortOutput is enabled, emit is done in the `finish` method - this.emit(file); - } - } - - return; - } - - this.files[utils.normalizePath(fileName)] = { - fileName, - original: undefined, - sourceMapOrigins: undefined, - extension: { - [ kind ]: extension - }, - content: { - [ kind ]: content - }, - pushed: false, - skipPush: undefined, - sourceMapsApplied: false, - sourceMap: undefined, - sourceMapString: undefined - }; + writeDts(base: string, fileName: string, content: string, cwd: string) { + const file = new gutil.File({ + path: fileName, + contents: new Buffer(content), + cwd, + base + }); + this.streamFull.push(file); + this.streamDts.push(file); } - private applySourceMaps(file: OutputFile) { - if (file.sourceMapsApplied || file.skipPush || !file.original.gulp.sourceMap) return; + private applySourceMap(sourceMapContent: string, original: input.File, output: VinylFile) { + 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 = output.relative; + map.sources = map.sources.map(relativeToOutput); - file.sourceMapsApplied = true; - const map = file.sourceMap; - map.file = map.file.replace(/\\/g, '/'); delete map.sourceRoot; - map.sources = map.sources.map((path) => path.replace(/\\/g, '/')); const generator = sourceMap.SourceMapGenerator.fromSourceMap(new sourceMap.SourceMapConsumer(map)); - for (const sourceFile of file.sourceMapOrigins) { + + 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: RawSourceMap = 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. - */ + // 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 consumer = new sourceMap.SourceMapConsumer(inputMap); - generator.applySourceMap(consumer); + generator.applySourceMap(consumer, sourceFile.fileNameOriginal, sourceFile.gulp.base); } if (!inputMap.sources || !inputMap.sourcesContent) continue; - for (const i in inputMap.sources) { - generator.setSourceContent(inputMap.sources[i], inputMap.sourcesContent[i]); - } - } - file.sourceMapString = generator.toString(); - } - - private emit(file: OutputFile) { - if (file.skipPush) return; - let root: string; - if ((this.project.typescript).convertCompilerOptionsFromJson !== undefined && this.project.options.out === undefined) { - root = ''; - } else if (this.project.singleOutput) { - root = this.project.input.commonBasePath; - } else if (this.project.options.outDir !== undefined && this.project.compiler instanceof ProjectCompiler) { - root = file.original.gulp.cwd + '/'; - } else { - root = ''; - } - - let base: string; - if (this.project.options.outDir !== undefined && this.project.compiler instanceof ProjectCompiler) { - base = path.resolve(file.original.gulp.cwd, this.project.options.outDir) + '/'; - } else if (this.project.singleOutput) { - if (this.project.options.out === undefined) { - base = this.project.projectDirectory; - } else { - base = this.project.input.commonBasePath; + for (let i = 0; i < inputMap.sources.length; i++) { + const absolute = path.resolve(sourceFile.gulp.base, inputMap.sources[i]); + const relative = path.relative(directory, absolute); + generator.setSourceContent(relative, inputMap.sourcesContent[i]); } - } else { - base = file.original.gulp.base; } + return generator.toString(); - const fileJs = new gutil.File({ - path: path.join(root, file.fileName + '.' + file.extension[OutputFileKind.JavaScript]), - contents: new Buffer(file.content[OutputFileKind.JavaScript]), - cwd: file.original.gulp.cwd, - base - }); - if (file.original.gulp.sourceMap) fileJs.sourceMap = JSON.parse(file.sourceMapString); - this.streamJs.push(fileJs); - - if (this.project.options.declaration) { - const fileDts = new gutil.File({ - path: path.join(root, file.fileName + '.' + file.extension[OutputFileKind.Definitions]), - contents: new Buffer(file.content[OutputFileKind.Definitions]), - cwd: file.original.gulp.cwd, - base - }); - this.streamDts.push(fileDts); + function relativeToOutput(fileName: string) { + const absolute = path.resolve(directory, fileName.replace(/\\/g, '/')); + return path.relative(output.base, absolute); } } - finish(results: reporter.CompilationResult) { - if (this.project.sortOutput) { - let sortedEmit = (fileName: string) => { - let file = this.files[utils.normalizePath(fileName)]; - if (!file || file.skipPush || file.pushed) return; - - if (file.original && file.original.ts) { - let references = file.original.ts.referencedFiles.map(file => tsApi.getFileName(file)); - - for (const reference of references) { - sortedEmit(utils.splitExtension(reference)[0]); - } - } - this.emit(file); - }; - - for (const fileName of Object.keys(this.files)) { - sortedEmit(fileName); - } - } - - this.results = results; - if (this.project.reporter.finish) this.project.reporter.finish(results); + finish(result: reporter.CompilationResult) { + this.result = result; + if (this.project.reporter.finish) this.project.reporter.finish(result); + this.streamFull.emit('finish'); this.streamJs.emit('finish'); this.streamDts.emit('finish'); + this.streamFull.push(null); this.streamJs.push(null); this.streamDts.push(null); - this.project.running = false; } private getError(info: ts.Diagnostic): reporter.TypeScriptError { - let fileName = info.file && tsApi.getFileName(info.file); + let fileName = info.file && info.file.fileName; const file = fileName && this.project.input.getFile(fileName); return utils.getError(info, this.project.typescript, file); @@ -264,11 +120,9 @@ export class Output { error(error: reporter.TypeScriptError) { if (!error) return; - // Save errors for lazy compilation (if the next input is the same as the current), - this.errors.push(error); // call reporter callback if (this.project.reporter.error) this.project.reporter.error( error, this.project.typescript); // & emit the error on the stream. - this.streamJs.emit('error', error); + this.streamFull.emit('error', error); } } diff --git a/lib/project.ts b/lib/project.ts index cede1a4f..c6be7832 100644 --- a/lib/project.ts +++ b/lib/project.ts @@ -4,204 +4,184 @@ import * as vfs from 'vinyl-fs'; import * as path from 'path'; import * as through2 from 'through2'; import * as gutil from 'gulp-util'; -import * as tsApi from './tsapi'; import * as utils from './utils'; -import { FilterSettings } from './main'; -import { Reporter } from './reporter'; +import { Reporter, defaultReporter } from './reporter'; import { FileCache } from './input'; import { Output } from './output'; -import { ICompiler } from './compiler'; -import { TsConfig } from './types'; +import { ICompiler, ProjectCompiler, FileCompiler } from './compiler'; +import { TsConfig, VinylFile } from './types'; -export class Project { +interface PartialProject { + (reporter?: Reporter): ICompileStream; + + src?(this: Project): NodeJS.ReadWriteStream; + + typescript?: typeof ts; + projectDirectory?: string; + config?: TsConfig; + options?: ts.CompilerOptions; +} +export interface Project { + (reporter?: Reporter): ICompileStream; + + src(this: Project): NodeJS.ReadWriteStream; + + readonly typescript?: typeof ts; + readonly projectDirectory: string; + readonly config: TsConfig; + readonly options: ts.CompilerOptions; +} + +export interface ProjectInfo { input: FileCache; output: Output; - previousOutput: Output; compiler: ICompiler; + singleOutput: boolean; + options: ts.CompilerOptions; + typescript: typeof ts; + reporter: Reporter; +} - configFileName: string; - projectDirectory: string; - config: TsConfig; +export function setupProject(projectDirectory: string, config: TsConfig, options: ts.CompilerOptions, typescript: typeof ts) { + const input = new FileCache(typescript, options); + const compiler: ICompiler = options.isolatedModules ? new FileCompiler() : new ProjectCompiler(); + let running = false; - running = false; + if (options.isolatedModules) { + options.newLine = typescript.NewLineKind.LineFeed; + options.sourceMap = false; + options.declaration = false; + options.inlineSourceMap = true; + } - // region settings + const project: PartialProject = (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; - /** - * The TypeScript library that is used for this project. - * Can also be jsx-typescript for example. - */ - typescript: typeof ts; + input.reset(); + compiler.prepare(projectInfo); - options: ts.CompilerOptions; + const stream = new CompileStream(projectInfo); + projectInfo.output = new Output(projectInfo, stream, stream.js, stream.dts); + projectInfo.reporter = reporter || defaultReporter; - /** - * Whether there should not be loaded external files to the project. - * Example: - * In the lib directory you have .ts files. - * In the definitions directory you have the .d.ts files. - * If you turn this option on, you should add in your gulp file the definitions directory as an input source. - * Advantage: - * - Faster builds - * Disadvantage: - * - If you forget some directory, your compile will fail. - */ - noExternalResolve: boolean; - - /** - * Sort output based on tags. - * tsc does this when you pass the --out parameter. - */ - sortOutput: boolean; - - filterSettings: FilterSettings; + stream.on('finish', () => { + running = false; + }); - singleOutput: boolean; + return stream; + }; + + const singleOutput = options.out !== undefined || options.outFile !== undefined; + + project.src = src; + project.typescript = typescript; + project.projectDirectory = projectDirectory; + project.config = config; + project.options = options; + + const projectInfo: ProjectInfo = { + input, + singleOutput, + compiler, + options, + typescript, + // Set when `project` is called + output: undefined, + reporter: undefined + }; + + return project as Project; +} - reporter: Reporter; +function src(this: Project) { + let base: string; + if (this.options["rootDir"]) { + base = path.resolve(this.projectDirectory, this.options["rootDir"]); + } - // endregion + const content: any = {}; + if (this.config.include) content.include = this.config.include; + if (this.config.exclude) content.exclude = this.config.exclude; + if (this.config.files) content.files = this.config.files; + if (this.options['allowJs']) content.compilerOptions = { allowJs: true }; + const { fileNames, errors } = this.typescript.parseJsonConfigFileContent( + content, + this.typescript.sys, + this.projectDirectory); + + for (const error of errors) { + console.log(error.messageText); + } - currentDirectory: string; + if (base === undefined) base = utils.getCommonBasePathOfArray( + fileNames.filter(file => file.substr(-5) !== ".d.ts") + .map(file => path.dirname(file))); - constructor(configFileName: string, projectDirectory: string, config: TsConfig, options: ts.CompilerOptions, noExternalResolve: boolean, sortOutput: boolean, typescript = ts) { - this.typescript = typescript; - this.configFileName = configFileName; - this.projectDirectory = projectDirectory; - this.config = config; - this.options = options; + const vinylOptions = { base, allowEmpty: true }; + return vfs.src(fileNames, vinylOptions); +} - this.noExternalResolve = noExternalResolve; - this.sortOutput = sortOutput; - this.singleOutput = options.out !== undefined || options['outFile'] !== undefined; +export interface ICompileStream extends NodeJS.ReadWriteStream { + js: stream.Readable; + dts: stream.Readable; +} +class CompileStream extends stream.Duplex implements ICompileStream { + constructor(project: ProjectInfo) { + super({objectMode: true}); - this.input = new FileCache(typescript, options); - } + this.project = project; - /** - * Resets the compiler. - * The compiler needs to be reset for incremental builds. - */ - reset(outputJs: stream.Readable, outputDts: stream.Readable) { - this.input.reset(); - this.previousOutput = this.output; - this.output = new Output(this, outputJs, outputDts); + // Prevent "Unhandled stream error in pipe" when a compilation error occurs. + this.on('error', () => {}); } - src() { - let configPath = path.dirname(this.configFileName); + private project: ProjectInfo; - let base: string; - if (this.options["rootDir"]) { - base = path.resolve(configPath, this.options["rootDir"]); - } + _write(file: any, encoding, cb: (err?) => void); + _write(file: VinylFile, encoding, cb = (err?) => {}) { + if (!file) return cb(); - if ((this.typescript as tsApi.TypeScript).parseJsonConfigFileContent && (this.typescript as tsApi.TypeScript).sys) { - const content: any = {}; - if (this.config.include) content.include = this.config.include; - if (this.config.exclude) content.exclude = this.config.exclude; - if (this.config.files) content.files = this.config.files; - if (this.options['allowJs']) content.compilerOptions = { allowJs: true }; - const { fileNames, errors } = (this.typescript as tsApi.TypeScript).parseJsonConfigFileContent( - content, - (this.typescript as tsApi.TypeScript).sys, - this.projectDirectory); - - for (const error of errors) { - console.log(error.messageText); - } - - if (base === undefined) 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); + if (file.isNull()) { + cb(); + return; + } + if (file.isStream()) { + return cb(new gutil.PluginError('gulp-typescript', 'Streaming not supported')); } - if (!this.config.files) { - let files: string[] = []; - - //If neither 'files' nor 'include' option is defined, - //take all .ts files (or .ts, .js, .jsx if required) by default. - if (!this.config.include) { - files.push(path.join(configPath, '**/*.ts')); - - if (tsApi.isTS16OrNewer(this.typescript)) { - files.push(path.join(configPath, '**/*.tsx')); - } - if (( this.options).allowJs) { - files.push(path.join(configPath, '**/*.js')); - files.push(path.join(configPath, '**/*.jsx')); - } - } - else if (this.config.include instanceof Array) { - files = files.concat( - // Include files - this.config.include.map(file => path.resolve(configPath, file)), - // Include directories - this.config.include.map(file => path.resolve(configPath, file) + '/**') - ); - } - - if (this.config.exclude instanceof Array) { - files = files.concat( - // Exclude files - this.config.exclude.map(file => '!' + path.resolve(configPath, file)), - // Exclude directories - this.config.exclude.map(file => '!' + path.resolve(configPath, file) + '/**') - ); - } - if (base !== undefined) { - return vfs.src(files, { base }); - } - const srcStream = vfs.src(files); - const sources = new stream.Readable({ objectMode: true }); - sources._read = () => {}; - const resolvedFiles: gutil.File[] = []; - srcStream.on('data', (file: gutil.File) => { - resolvedFiles.push(file); - }); - srcStream.on('finish', () => { - const sourceFiles = resolvedFiles - .filter(file => file.path.substr(-5) !== ".d.ts"); - const base = utils.getCommonBasePathOfArray( - sourceFiles.map(file => path.dirname(file.path)) - ); - for (const file of sourceFiles) { - file.base = base; - sources.push(file); - } - sources.emit('finish'); - }); - return srcStream; + const inputFile = this.project.input.addGulp(file); + + this.project.compiler.inputFile(inputFile); + + cb(); + } + _read() { + + } + + end(chunk?, encoding?, callback?) { + if (typeof chunk === 'function') { + this._write(null, null, chunk); + } else if (typeof encoding === 'function') { + this._write(chunk, null, encoding); + } else { + this._write(chunk, encoding, callback); } - const files = this.config.files.map(file => path.resolve(configPath, file)); - if (base === undefined) base = utils.getCommonBasePathOfArray(files.map(file => path.dirname(file))); - - const resolvedFiles: string[] = []; - const checkMissingFiles = through2.obj(function (file: gutil.File, enc, callback) { - this.push(file); - resolvedFiles.push(utils.normalizePath(file.path)); - callback(); - }); - checkMissingFiles.on('finish', () => { - for (const fileName of this.config.files) { - const fullPaths = [ - utils.normalizePath(path.join(configPath, fileName)), - utils.normalizePath(path.join(process.cwd(), configPath, fileName)) - ]; - - if (resolvedFiles.indexOf(fullPaths[0]) === -1 && resolvedFiles.indexOf(fullPaths[1]) === -1) { - const error = new Error(`error TS6053: File '${ fileName }' not found.`); - console.error(error.message); - checkMissingFiles.emit('error', error); - } - } - }); + this.project.compiler.inputDone(); + } + + js: stream.Readable = new CompileOutputStream(); + dts: stream.Readable = new CompileOutputStream(); +} +class CompileOutputStream extends stream.Readable { + constructor() { + super({objectMode: true}); + } + + _read() { - const vinylOptions = { base, allowEmpty: true }; - return vfs.src(this.config.files.map(file => path.resolve(configPath, file)), vinylOptions) - .pipe(checkMissingFiles); } } diff --git a/lib/reporter.ts b/lib/reporter.ts index 0d6568c3..bfd20832 100644 --- a/lib/reporter.ts +++ b/lib/reporter.ts @@ -1,5 +1,4 @@ import * as ts from 'typescript'; -import * as tsApi from './tsapi'; import * as gutil from 'gulp-util'; import { VinylFile } from './types'; @@ -27,9 +26,11 @@ export interface CompilationResult { * Only used when using isolatedModules. */ transpileErrors: number; + optionsErrors: number; syntaxErrors: number; globalErrors: number; semanticErrors: number; + declarationErrors: number; emitErrors: number; emitSkipped: boolean; @@ -37,9 +38,11 @@ export interface CompilationResult { export function emptyCompilationResult(): CompilationResult { return { transpileErrors: 0, + optionsErrors: 0, syntaxErrors: 0, globalErrors: 0, semanticErrors: 0, + declarationErrors: 0, emitErrors: 0, emitSkipped: false } @@ -60,9 +63,11 @@ function defaultFinishHandler(results: CompilationResult) { }; showErrorCount(results.transpileErrors, ''); + showErrorCount(results.optionsErrors, 'options'); showErrorCount(results.syntaxErrors, 'syntax'); showErrorCount(results.globalErrors, 'global'); showErrorCount(results.semanticErrors, 'semantic'); + showErrorCount(results.declarationErrors, 'declaration'); showErrorCount(results.emitErrors, 'emit'); if (results.emitSkipped) { @@ -84,27 +89,14 @@ export function defaultReporter(): Reporter { }; } -function flattenDiagnosticsVerbose(message: string | tsApi.DiagnosticMessageChain15, index = 0): string { - if (typeof message === 'undefined') { - return ''; - } else if (typeof message === 'string') { - return message; - } else { - let result: string; - if (index === 0) { - result = message.messageText; - } else { - result = '\n> TS' + message.code + ' ' + message.messageText; - } - return result + flattenDiagnosticsVerbose(message.next, index + 1); - } -} - export function longReporter(): Reporter { + const typescript: typeof ts = require('typescript'); return { error: (error: TypeScriptError) => { if (error.tsFile) { - console.error('[' + gutil.colors.gray('gulp-typescript') + '] ' + gutil.colors.red(error.fullFilename + '(' + error.startPosition.line + ',' + error.startPosition.character + '): ') + 'error TS' + error.diagnostic.code + ' ' + flattenDiagnosticsVerbose(error.diagnostic.messageText)); + console.error('[' + gutil.colors.gray('gulp-typescript') + '] ' + gutil.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); } @@ -113,11 +105,12 @@ export function longReporter(): Reporter { } } export function fullReporter(fullFilename: boolean = false): Reporter { + const typescript: typeof ts = require('typescript'); return { error: (error: TypeScriptError, typescript: typeof ts) => { console.error('[' + gutil.colors.gray('gulp-typescript') + '] ' + gutil.colors.bgRed(error.diagnostic.code + '') - + ' ' + gutil.colors.red(flattenDiagnosticsVerbose(error.diagnostic.messageText)) + + ' ' + gutil.colors.red(typescript.flattenDiagnosticMessageText(error.diagnostic.messageText, '\n')) ); if (error.tsFile) { diff --git a/lib/tsapi.ts b/lib/tsapi.ts deleted file mode 100644 index 9676483d..00000000 --- a/lib/tsapi.ts +++ /dev/null @@ -1,184 +0,0 @@ -import * as ts from 'typescript'; -import { CompilationResult, emptyCompilationResult } from './reporter'; -import { normalizePath } from './utils'; - -export interface TypeScript { - convertCompilerOptionsFromJson?: (jsonOptions: any, basePath: string, configFileName?: string) => { - options: ts.CompilerOptions; - errors: ts.Diagnostic[]; - } - parseJsonConfigFileContent?: (json: any, host: any, basePath: string) => { fileNames: string[], errors: ts.Diagnostic[] }; - sys?: any; -} - -export interface TypeScript14 { - createSourceFile(filename: string, content: string, target: ts.ScriptTarget, version: string); -} -export interface TypeScript15 { - createSourceFile(fileName: string, content: string, target: ts.ScriptTarget, isOpen: boolean); - findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string; - flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain15, newLine: string): string; - transpile(input: string, compilerOptions?: ts.CompilerOptions, fileName?: string, diagnostics?: ts.Diagnostic[]): string; -} -export interface TypeScript17 { - parseConfigFileTextToJson(fileName: string, jsonText: string): { - config?: any; - error?: ts.Diagnostic; - }; -} - -export function parseTsConfig(typescript: TypeScript14 | TypeScript15 | TypeScript17, fileName: string, content: string) { - if ('parseConfigFileTextToJson' in typescript) { - return ( typescript).parseConfigFileTextToJson(fileName, content); - } else { - return { - config: JSON.parse(content.replace(/^\uFEFF/, '')) - }; - } -} - - -/* - * In TS1.6+ ts.createProgram has an extra argument, `oldProgram`. - * TS will reuse the old program if possible, which speeds up incremental - * compilation - */ -export type CreateProgram = (rootNames: string[], options: ts.CompilerOptions, host?: ts.CompilerHost, oldProgram?: ts.Program) => ts.Program; - -/* - * TS1.4 had a simple getDiagnostics method, in 1.5 that method doens't exist, - * but instead there are now 4 methods which (combined) return all diagnostics. - */ -export interface Program14 { - getDiagnostics(): ts.Diagnostic[]; - getTypeChecker(fullTypeCheckMode: boolean): TypeChecker14; -} -export interface Program15 { - getSyntacticDiagnostics(): ts.Diagnostic[]; - getGlobalDiagnostics(): ts.Diagnostic[]; - getSemanticDiagnostics(): ts.Diagnostic[]; - getDeclarationDiagnostics(): ts.Diagnostic[]; - emit(): { diagnostics: ts.Diagnostic[]; emitSkipped: boolean; }; -} - -export interface TypeChecker14 { - getDiagnostics(sourceFile?: ts.SourceFile): ts.Diagnostic[]; - emitFiles(): { diagnostics: ts.Diagnostic[]; }; -} -export interface DiagnosticMessageChain15 { - messageText: string; - category: ts.DiagnosticCategory; - code: number; - next?: DiagnosticMessageChain15; -} - -/* - * In TS 14 the method getLineAndCharacterFromPosition has been renamed from ...From... to ...Of... - */ -export interface TSFile14 { - getLineAndCharacterFromPosition(pos: number): ts.LineAndCharacter; -} -export interface TSFile15 { - getLineAndCharacterOfPosition(pos: number): ts.LineAndCharacter; -} - -export interface TSOptions18 { - allowJs?: boolean; - suppressOutputPathCheck?: boolean; -} -export interface TSOptions20 extends TSOptions18 { - baseUrl?: string; - rootDirs?: string[]; -} - -export function isTS14(typescript: typeof ts) { - return !('findConfigFile' in typescript); -} -export function isTS16OrNewer(typescript: typeof ts) { - return ('ModuleResolutionKind' in typescript); -} - -export function getFileName(thing: { filename: string} | { fileName: string }): string { - if (( thing).filename) return ( thing).filename; // TS 1.4 - return ( thing).fileName; // TS 1.5 -} -export function getDiagnosticsAndEmit(program: Program14 | Program15): [ts.Diagnostic[], CompilationResult] { - let result = emptyCompilationResult(); - - if (( program).getDiagnostics) { // TS 1.4 - let errors = ( program).getDiagnostics(); - - result.syntaxErrors = errors.length; - - if (!errors.length) { - // If there are no syntax errors, check types - const checker = ( program).getTypeChecker(true); - - const semanticErrors = checker.getDiagnostics(); - - const emitErrors = checker.emitFiles().diagnostics; - - errors = semanticErrors.concat(emitErrors); - result.semanticErrors = errors.length; - } else { - result.emitSkipped = true; - } - - return [errors, result]; - } else { // TS 1.5 - let errors = ( program).getSyntacticDiagnostics(); - result.syntaxErrors = errors.length; - if (errors.length === 0) { - errors = ( program).getGlobalDiagnostics(); - - // Remove error: "File '...' is not under 'rootDir' '...'. 'rootDir' is expected to contain all source files." - // This is handled by ICompiler#correctSourceMap, so this error can be muted. - errors = errors.filter((item) => item.code !== 6059); - - result.globalErrors = errors.length; - } - - if (errors.length === 0) { - errors = ( program).getSemanticDiagnostics(); - result.semanticErrors = errors.length; - } - - const emitOutput = ( program).emit(); - result.emitErrors = emitOutput.diagnostics.length; - result.emitSkipped = emitOutput.emitSkipped; - return [errors.concat(emitOutput.diagnostics), result]; - } -} -export function getLineAndCharacterOfPosition(typescript: typeof ts, file: TSFile14 | TSFile15, position: number) { - if (( file).getLineAndCharacterOfPosition) { // TS 1.5 - const lineAndCharacter = ( file).getLineAndCharacterOfPosition(position); - return { - line: lineAndCharacter.line + 1, - character: lineAndCharacter.character + 1 - } - } else { // TS 1.4 - return ( file).getLineAndCharacterFromPosition(position); - } -} -export function createSourceFile(typescript: TypeScript14 | TypeScript15, fileName: string, content: string, target: ts.ScriptTarget, version = '0') { - if (( typescript).findConfigFile) { - return ( typescript).createSourceFile(fileName, content, target, true); - } else { - return ( typescript).createSourceFile(fileName, content, target, version); - } -} -export function flattenDiagnosticMessageText(typescript: TypeScript14 | TypeScript15, messageText: string | DiagnosticMessageChain15): string { - if (typeof messageText === 'string') { - return messageText; - } else { - return ( typescript).flattenDiagnosticMessageText(messageText, "\n"); - } -} - -export function transpile(typescript: TypeScript14 | TypeScript15, input: string, compilerOptions?: ts.CompilerOptions, fileName?: string, diagnostics?: ts.Diagnostic[]): string { - if (!( typescript).transpile) { - throw new Error('gulp-typescript: Single file compilation is not supported using TypeScript 1.4'); - } - - return ( typescript).transpile(input, compilerOptions, fileName.replace(/\\/g, '/'), diagnostics); -} diff --git a/lib/tsconfig.json b/lib/tsconfig.json new file mode 100644 index 00000000..22816170 --- /dev/null +++ b/lib/tsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "target": "ES5", + "module": "commonjs", + "noUnusedLocals": true, + "declaration": true + } +} diff --git a/lib/types.ts b/lib/types.ts index 7a53abb0..4ad68b3a 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -1,6 +1,3 @@ -import { Stats } from 'fs'; -import { Readable } from 'stream'; - export interface TsConfig { files?: string[]; include?: string[]; diff --git a/lib/utils.ts b/lib/utils.ts index 232cfa92..f7f44ae4 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -1,7 +1,6 @@ import * as path from 'path'; import * as ts from 'typescript'; import { File } from './input'; -import * as tsApi from './tsapi'; import * as reporter from './reporter'; import * as gutil from 'gulp-util'; @@ -60,18 +59,18 @@ export function getError(info: ts.Diagnostic, typescript: typeof ts, file?: File err.name = 'TypeScript error'; err.diagnostic = info; - const codeAndMessageText = ts.DiagnosticCategory[info.category].toLowerCase() + + const codeAndMessageText = typescript.DiagnosticCategory[info.category].toLowerCase() + ' TS' + info.code + ': ' + - tsApi.flattenDiagnosticMessageText(typescript, info.messageText) + typescript.flattenDiagnosticMessageText(info.messageText, '\n') if (!info.file) { err.message = codeAndMessageText; return err; } - let fileName = tsApi.getFileName(info.file); + let fileName = info.file.fileName; if (file) { err.tsFile = file.ts; @@ -84,12 +83,11 @@ export function getError(info: ts.Diagnostic, typescript: typeof ts, file?: File fileName = file.fileNameOriginal; } } else { - fileName = tsApi.getFileName(info.file); - err.fullFilename = fileName; + err.fullFilename = info.file.fileName; } - const startPos = tsApi.getLineAndCharacterOfPosition(typescript, info.file, info.start); - const endPos = tsApi.getLineAndCharacterOfPosition(typescript, 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, @@ -102,7 +100,7 @@ export function getError(info: ts.Diagnostic, typescript: typeof ts, file?: File character: endPos.character }; - err.message = gutil.colors.red(fileName + '(' + startPos.line + ',' + startPos.character + '): ').toString() + err.message = gutil.colors.red(fileName + '(' + (startPos.line + 1) + ',' + (startPos.character + 1) + '): ').toString() + codeAndMessageText; return err; diff --git a/package.json b/package.json index 66b50665..18e06f05 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-typescript", - "version": "2.14.1", + "version": "3.0.0", "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", @@ -59,7 +59,6 @@ "gulp-util": "~3.0.7", "source-map": "~0.5.3", "through2": "~2.0.1", - "typescript": "1.8.10", "vinyl-fs": "~2.4.3" }, "devDependencies": { @@ -70,7 +69,11 @@ "gulp-plumber": "~1.1.0", "gulp-sourcemaps": "~1.6.0", "merge-stream": "~1.0.0", - "rimraf": "~2.5.2" + "rimraf": "~2.5.2", + "typescript": "2.0.3" + }, + "peerDependencies": { + "typescript": "~2.0.3 || >=2.0.0-dev || >=2.1.0-dev" }, "scripts": { "test": "gulp" diff --git a/readme.md b/readme.md index c76aaa35..aafd1e1d 100644 --- a/readme.md +++ b/readme.md @@ -2,6 +2,8 @@ gulp-typescript =============== A gulp plugin for handling TypeScript compilation workflow. The plugin exposes TypeScript's compiler options to gulp using TypeScript API. +Updating from version 2? See the [breaking changes in version 3](http://dev.ivogabe.com/gulp-typescript-3/). + [![Build Status](https://travis-ci.org/ivogabe/gulp-typescript.svg?branch=master)](https://travis-ci.org/ivogabe/gulp-typescript) Features @@ -30,11 +32,12 @@ npm install gulp-typescript Options ------- Allmost all options from TypeScript are supported. -- `out` (TS1.5-), `outFile` (TS1.6+) (string) - Generate one javascript and one definition file. Only works when no module system is used. +- `outFile` (string) - Generate one javascript and one definition file. Only works when no module system is used. - `outDir` (string) - Move output to a different (virtual) directory. Note that you still need `gulp.dest` to write output to disk. - `noImplicitAny` (boolean) - Warn on expressions and declarations with an implied 'any' type. -- `suppressImplicitAnyIndexErrors` (boolean) - Suppress --noImplicitAny errors for indexing objects lacking index signatures. +- `suppressImplicitAnyIndexErrors` (boolean) - Suppress `--noImplicitAny` errors for indexing objects lacking index signatures. - `noLib` (boolean) - Don't include the default lib (with definitions for - Array, Date etc) +- `lib` (string[]) - List of library files to be included in the compilation. - `target` (string) - Specify ECMAScript target version: 'ES3' (default), 'ES5' or 'ES6'. - `module` (string) - Specify module code generation: 'commonjs', 'amd', 'umd' or 'system'. - `jsx` (string) - Specify jsx code generation: 'react' or 'preserve' (TS1.6+). @@ -51,19 +54,13 @@ Allmost all options from TypeScript are supported. - `allowJs` (boolean) - Allow JavaScript files to be compiled. - `rootDir` - Specifies the root directory of input files. Only use to control the output directory structure with `outDir`. -See the [TypeScript wiki](http://www.typescriptlang.org/docs/handbook/compiler-options.html) for a complete list. +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. - `watch` - Use `gulp.watch` instead. See the paragraph "Incremental compilation". - `project` - See "Using `tsconfig.json`". - Obvious: `help`, `version` -## Unofficial options -Besides the official options options, gulp-typescript supports the following options: -- ```noExternalResolve``` (boolean) - Do not resolve files that are not in the input. Explanation below. -- ```sortOutput``` (boolean) - Sort output files. Useful if you want to concatenate files (see below). -- ```typescript``` (object) - Use a different version / fork of TypeScript (see below). Use it like: `typescript: require('typescript')` or `typescript: require('my-fork-of-typescript')` - 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`. @@ -81,17 +78,16 @@ gulp.task('default', function () { .pipe(gulp.dest('built/local')); }); ``` -Another example of `gulpfile.js`. Instead of creating default task, the file specifies custom named task. To invoke, run `gulp scripts` instead of `gulp`. As a result, the task will generate both JavaScript files and TypeScript definition files (.d.ts). +Another example of `gulpfile.js`. Instead of creating the default task, the file specifies custom named task. To invoke, run `gulp scripts` instead of `gulp`. As a result, the task will generate both JavaScript files and TypeScript definition files (`.d.ts`). ```javascript var gulp = require('gulp'); var ts = require('gulp-typescript'); -var merge = require('merge2'); // Require separate installation +var merge = require('merge2'); // Requires separate installation gulp.task('scripts', function() { var tsResult = gulp.src('lib/**/*.ts') .pipe(ts({ - declaration: true, - noExternalResolve: true + declaration: true })); return merge([ @@ -100,28 +96,29 @@ gulp.task('scripts', function() { ]); }); ``` -`tsResult` is a object that has a JavaScript stream (`.js`) and a definition file stream (`.dts`). -You need to set the `declaration` option to get definition files in the `dts` stream. +`tsResult` is a stream containing the generated JavaScript and definition files. +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. Incremental compilation ----------------------- -Instead of calling ```ts(options)```, you can create a project first, and then call ```ts(project)```. An example: +Instead of calling `ts(options)`, you can create a project first, and then call `tsProject()`. An example: ```javascript var gulp = require('gulp'); var ts = require('gulp-typescript'); var merge = require('merge2'); var tsProject = ts.createProject({ - declaration: true, - noExternalResolve: true + declaration: true }); gulp.task('scripts', function() { var tsResult = gulp.src('lib/*.ts') - .pipe(ts(tsProject)); + .pipe(tsProject()); - return merge([ // Merge the two output streams, so this task is finished when the IO of both operations are done. + 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')) ]); @@ -131,7 +128,7 @@ gulp.task('watch', ['scripts'], function() { gulp.watch('lib/*.ts', ['scripts']); }); ``` -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. +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. @@ -144,13 +141,13 @@ var tsProject = ts.createProject('tsconfig.json'); ``` If you want to add or overwrite certain settings in the `tsconfig.json` file, you can use: ```javascript -var tsProject = ts.createProject('tsconfig.json', { sortOutput: true }); +var tsProject = ts.createProject('tsconfig.json', { noImplicitAny: true }); ``` The task will look like: ```javascript gulp.task('scripts', function() { var tsResult = tsProject.src() // instead of gulp.src(...) - .pipe(ts(tsProject)); + .pipe(tsProject()); return tsResult.js.pipe(gulp.dest('release')); }); @@ -158,79 +155,21 @@ gulp.task('scripts', function() { TypeScript version ------------------ -gulp-typescript uses TypeScript 1.8 by default. You can also use 1.4+ or a nighty version of TypeScript instead. -You should add the version you want (1.4+) to your package.json file as a devDependency. You can use the a nightly build to get the latest features: -``` -npm install typescript@next -``` -And add this to your gulpfile: -```javascript -[...].pipe(ts({ - typescript: require('typescript') -})); -``` -Or in combination with a `tsconfig` file: -```javascript -var tsProject = ts.createProject('tsconfig.json', { - typescript: require('typescript') -}); -``` +gulp-typescript isn't restricted to a single TypeScript version. +You can install the latest stable version using `npm install typescript --save-dev` or a nightly `npm install typescript@next --save-dev`. -It's also possible to use a fork of TypeScript. Add an extra option to the options object like this: +You can also use a fork of TypeScript, if it is based on TypeScript 2.x. You can configure this in your gulpfile: ```javascript [...].pipe(ts({ typescript: require('my-fork-of-typescript') })); ``` - -Filters -------- -There are two ways to filter files: -```javascript -gulp.task('scripts', function() { - var tsResult = gulp.src('lib/*.ts') - .pipe(ts(tsProject, filterSettings)); - - ... -}); -``` -And +Or in combination with a `tsconfig` file: ```javascript -gulp.task('scripts', function() { - var tsResult = gulp.src('lib/*.ts') - .pipe(ts(tsProject)); - - tsResult.pipe(ts.filter(tsProject, filterSettings)); +var tsProject = ts.createProject('tsconfig.json', { + typescript: require('my-form-of-typescript') }); ``` -The first example doesn't add files (that don't pass the filter) to the compiler, the second one does add them to the compiler, -but removes them later from the stream. -You can put as much pipes between compilation and filtering as you want, as long as the filename doesn't change. - -At the moment there is only one filter available: - -- ```referencedFrom``` (string[]) Only files that are referenced (using ```/// ```) by the files in this array pass this filter. - -Resolving files ---------------- -By default, gulp-typescript will try to resolve the files you require and reference. These files are parsed, but not emitted (so you will not see them in the output stream). - -If you set the option ```noExternalResolve``` to true, gulp-typescript will not resolve all the requires and references. It assumes that all the necessary files are in the input stream. For example, if you have your ```.ts``` files in the ```lib``` folder, and the ```.d.ts``` files in the ```definitions``` folder, you must use ```gulp.src(['lib/**.ts', 'definitions/**.ts'])``` instead of ```gulp.src(['lib/**.ts'])``` in your gulpfile if you use the option ```noExternalResolve```. - -Advantage of ```noExternalResolve```: faster compilation. -Disadvantage of ```noExternalResolve```: won't work when you forgot some input files. -Advice: turn it on, and make sure you list all the input files. - -Files that are resolved when ```noExternalResolve``` is off, won't be pushed to the output stream, unless you are using the `out` option. - -Concatenate files ------------- -The ```tsc``` command has the ability to concatenate using the ```--out``` parameter. There are two approaches to do that in ```gulp-typescript```. - -You can use the `out` option. This is fine for small projects, but for big projects it's not always sufficient. - -The other option is to use `gulp-concat`. The ```tsc``` command sorts the files using the `````` tags. ```gulp-typescript``` does this when you enable the ```sortOutput``` option. You can use the ```referencedFrom``` filter to only include files that are referenced from certain files. - Source maps ---------- @@ -240,19 +179,17 @@ associated sourcemap. ```javascript var gulp = require('gulp') var ts = require('gulp-typescript'); -var concat = require('gulp-concat'); var sourcemaps = require('gulp-sourcemaps'); gulp.task('scripts', function() { var tsResult = gulp.src('lib/*.ts') .pipe(sourcemaps.init()) // This means sourcemaps will be generated .pipe(ts({ - sortOutput: true, // ... })); return tsResult.js - .pipe(concat('output.js')) // You can use other plugins that also support gulp-sourcemaps + .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')); }); @@ -261,17 +198,18 @@ For more information, see [gulp-sourcemaps](https://github.com/floridoo/gulp-sou Reporters --------- -You can specify a custom reporter as the 3rd argument of the main function: +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(optionsOrProject, filters, reporter); +ts(options, reporter); +tsProject(reporter); ``` -You can set options, project or filter to `undefined` if you don't want to set them. Available reporters are: +Available reporters are: - nullReporter (`ts.reporter.nullReporter()`) - Don't report errors - defaultReporter (`ts.reporter.defaultReporter()`) - Report basic errors to the console - longReporter (`ts.reporter.longReporter()`) - Extended version of default reporter, intelliJ link functionality + file watcher error highlighting should work using this one - fullReporter (`ts.reporter.fullReporter(showFullFilename?: boolean)`) - Show full error messages, with source. -If you want to build a custom reporter, you take a look at `lib/reporter.ts`, in that file is an interface which a reporter should implement. +If you want to build a custom reporter, you take a look at `lib/reporter.ts`, that file declares an interface which a reporter should implement. Build gulp-typescript ------------ diff --git a/release/compiler.d.ts b/release/compiler.d.ts index 8fdd652e..2a9e67d0 100644 --- a/release/compiler.d.ts +++ b/release/compiler.d.ts @@ -1,47 +1,34 @@ import * as ts from 'typescript'; -import { RawSourceMap } from './types'; import { File } from './input'; import { Host } from './host'; -import { Project } from './project'; +import { ProjectInfo } from './project'; export interface ICompiler { - prepare(_project: Project): void; - inputFile(file: File): any; - inputDone(): any; - /** - * Corrects the paths in the sourcemap. - * Returns true when the file is located - * under the base path. - */ - correctSourceMap(map: RawSourceMap): boolean; + prepare(project: ProjectInfo): void; + inputFile(file: File): void; + inputDone(): void; } /** * Compiles a whole project, with full type checking */ export declare class ProjectCompiler implements ICompiler { host: Host; - project: Project; + project: ProjectInfo; program: ts.Program; - prepare(_project: Project): void; + prepare(project: ProjectInfo): void; inputFile(file: File): void; inputDone(): void; - private _commonBaseDiff; - /** - * Calculates the difference between the common base directory calculated based on the base paths of the input files - * and the common source directory calculated by TypeScript. - */ - private commonBaseDiff; - correctSourceMap(map: RawSourceMap): boolean; + private emitFile(result, currentDirectory, file?); + private reportDiagnostics(diagnostics); private removeSourceMapComment(content); } export declare class FileCompiler implements ICompiler { host: Host; - project: Project; - program: ts.Program; - private errorsPerFile; - private previousErrorsPerFile; + project: ProjectInfo; + private output; + private previousOutput; private compilationResult; - prepare(_project: Project): void; + prepare(project: ProjectInfo): void; + private write(file, fileName, diagnostics, content, sourceMap); inputFile(file: File): void; inputDone(): void; - correctSourceMap(map: RawSourceMap): boolean; } diff --git a/release/compiler.js b/release/compiler.js index 5e1043d9..636af486 100644 --- a/release/compiler.js +++ b/release/compiler.js @@ -1,11 +1,7 @@ "use strict"; -var ts = require('typescript'); var path = require('path'); -var tsApi = require('./tsapi'); var input_1 = require('./input'); -var output_1 = require('./output'); var host_1 = require('./host'); -var filter_1 = require('./filter'); var reporter_1 = require('./reporter'); var utils = require('./utils'); /** @@ -14,127 +10,111 @@ var utils = require('./utils'); var ProjectCompiler = (function () { function ProjectCompiler() { } - ProjectCompiler.prototype.prepare = function (_project) { - this.project = _project; + ProjectCompiler.prototype.prepare = function (project) { + this.project = project; }; ProjectCompiler.prototype.inputFile = function (file) { }; ProjectCompiler.prototype.inputDone = function () { + var _this = this; if (!this.project.input.firstSourceFile) { this.project.output.finish(reporter_1.emptyCompilationResult()); return; } - var root = this.project.input.commonBasePath; var rootFilenames = this.project.input.getFileNames(true); if (!this.project.singleOutput) { - // Add an empty file under the root. - // This will make sure the commonSourceDirectory, calculated by TypeScript, won't point to a subdirectory of the root. - // We cannot use the `rootDir` option here, since that gives errors if the commonSourceDirectory points to a - // directory containing the rootDir instead of the rootDir, which will break the build when using `noEmitOnError`. - // The empty file is filtered out later on. - var emptyFileName = path.join(this.project.options['rootDir'] ? path.resolve(this.project.projectDirectory, this.project.options['rootDir']) : root, '________________empty.ts'); - rootFilenames.push(emptyFileName); - this.project.input.addContent(emptyFileName, ''); - } - if (!this.project.input.isChanged(true)) { - // Re-use old output - var old = this.project.previousOutput; - for (var _i = 0, _a = old.errors; _i < _a.length; _i++) { - var error = _a[_i]; - this.project.output.error(error); - } - for (var _b = 0, _c = Object.keys(old.files); _b < _c.length; _b++) { - var fileName = _c[_b]; - var file = old.files[fileName]; - this.project.output.write(file.fileName + '.' + file.extension[output_1.OutputFileKind.JavaScript], file.content[output_1.OutputFileKind.JavaScript]); - this.project.output.write(file.fileName + '.' + file.extension[output_1.OutputFileKind.SourceMap], file.content[output_1.OutputFileKind.SourceMap]); - if (file.content[output_1.OutputFileKind.Definitions] !== undefined) { - this.project.output.write(file.fileName + '.' + file.extension[output_1.OutputFileKind.Definitions], file.content[output_1.OutputFileKind.Definitions]); - } + 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.output.finish(old.results); - return; - } - this.project.options.sourceRoot = root; - this.host = new host_1.Host(this.project.typescript, this.project.currentDirectory, this.project.input, !this.project.noExternalResolve, this.project.options.target >= ts.ScriptTarget.ES6 ? 'lib.es6.d.ts' : 'lib.d.ts'); - if (this.project.filterSettings !== undefined) { - var filter_2 = new filter_1.Filter(this.project, this.project.filterSettings); - rootFilenames = rootFilenames.filter(function (fileName) { return filter_2.match(fileName); }); } - // Creating a program to compile the sources - // We cast to `tsApi.CreateProgram` so we can pass the old program as an extra argument. - // TS 1.6+ will try to reuse program structure (if possible) + var currentDirectory = utils.getCommonBasePathOfArray(rootFilenames.map(function (fileName) { return _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 _d = tsApi.getDiagnosticsAndEmit(this.program), errors = _d[0], result = _d[1]; - for (var i = 0; i < errors.length; i++) { - this.project.output.diagnostic(errors[i]); + var preEmitDiagnostics = this.project.typescript.getPreEmitDiagnostics(this.program); + var result = reporter_1.emptyCompilationResult(); + result.optionsErrors = this.program.getOptionsDiagnostics().length; + result.syntaxErrors = this.program.getSyntacticDiagnostics().length; + result.globalErrors = this.program.getGlobalDiagnostics().length; + result.semanticErrors = this.program.getSemanticDiagnostics().length; + if (this.project.options.declaration) { + result.declarationErrors = this.program.getDeclarationDiagnostics().length; + } + this.reportDiagnostics(preEmitDiagnostics); + var emitOutput = this.program.emit(); + result.emitErrors = emitOutput.diagnostics.length; + result.emitSkipped = emitOutput.emitSkipped; + if (this.project.singleOutput) { + this.emitFile(result, currentDirectory); } - for (var fileName in this.host.output) { - if (!this.host.output.hasOwnProperty(fileName)) - continue; - var content = this.host.output[fileName]; - var _e = utils.splitExtension(fileName), extension = _e[1]; - if (extension === 'js' || extension === 'jsx') { - content = this.removeSourceMapComment(content); + else { + // Emit files one by one + for (var _i = 0, _a = this.host.input.getFileNames(true); _i < _a.length; _i++) { + var fileName = _a[_i]; + var file = this.project.input.getFile(fileName); + this.emitFile(result, currentDirectory, file); } - this.project.output.write(fileName, content); } this.project.output.finish(result); }; - Object.defineProperty(ProjectCompiler.prototype, "commonBaseDiff", { - /** - * Calculates the difference between the common base directory calculated based on the base paths of the input files - * and the common source directory calculated by TypeScript. - */ - get: function () { - if (this._commonBaseDiff) - return this._commonBaseDiff; - var expected = this.project.input.commonBasePath; - var real = this.project.input.commonSourceDirectory; - var length = real.length - expected.length; - this._commonBaseDiff = [length, real.substring(real.length - length)]; - if (length > 0) { - this._commonBaseDiff = [length, real.substring(real.length - length)]; + ProjectCompiler.prototype.emitFile = function (result, currentDirectory, file) { + var _this = this; + var jsFileName; + var dtsFileName; + var jsContent; + var dtsContent; + var jsMapContent; + var emitOutput = this.program.emit(file && file.ts, function (fileName, content) { + var _a = utils.splitExtension(fileName, ['d.ts']), extension = _a[1]; + switch (extension) { + case 'js': + case 'jsx': + jsFileName = fileName; + jsContent = _this.removeSourceMapComment(content); + break; + case 'd.ts': + dtsFileName = fileName; + dtsContent = content; + break; + case 'map': + jsMapContent = content; + break; } - else { - this._commonBaseDiff = [length, expected.substring(expected.length + length)]; + }); + result.emitErrors += emitOutput.diagnostics.length; + this.reportDiagnostics(emitOutput.diagnostics); + var base; + var baseDeclarations; + if (file) { + base = file.gulp.base; + if (this.project.options.outDir) { + var baseRelative = path.relative(this.project.options.rootDir, base); + base = path.join(this.project.options.outDir, baseRelative); } - if (this._commonBaseDiff[1] === '/' || this._commonBaseDiff[1] === '\\') { - this._commonBaseDiff = [0, '']; + baseDeclarations = base; + if (this.project.options.declarationDir) { + var baseRelative = path.relative(this.project.options.rootDir, file.gulp.base); + baseDeclarations = path.join(this.project.options.declarationDir, baseRelative); } - return this._commonBaseDiff; - }, - // 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 - }); - ProjectCompiler.prototype.correctSourceMap = function (map) { - var _this = this; - var _a = this.commonBaseDiff, diffLength = _a[0], diff = _a[1]; - if (this.project.singleOutput) - return true; - if (diffLength < 0) { - // There were files added outside of the common base. - var outsideRoot_1 = false; - map.sources = map.sources.map(function (fileName) { - var fullPath = path.join(_this.project.input.commonSourceDirectory, fileName); - var fullPathNormalized = utils.normalizePath(fullPath); - var relative = path.relative(utils.normalizePath(_this.project.input.commonBasePath), fullPathNormalized); - var first2 = relative.substring(0, 2); - var first3 = relative.substring(0, 3); - if (first3 === '../' || first3 === '..\\') { - outsideRoot_1 = true; - } - else if (first2 === './' || first2 === '.\\') { - relative = relative.substring(2); - } - return path.normalize(fullPath).substring(fullPathNormalized.length - relative.length); - }); - if (outsideRoot_1) - return false; } - return true; + else { + var outFile = this.project.options.outFile || this.project.options.out; + base = jsFileName.substring(0, jsFileName.length - outFile.length); + } + if (jsContent !== undefined) { + 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); + } + if (emitOutput.emitSkipped) { + result.emitSkipped = true; + } + }; + ProjectCompiler.prototype.reportDiagnostics = function (diagnostics) { + for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) { + var error = diagnostics_1[_i]; + this.project.output.diagnostic(error); + } }; ProjectCompiler.prototype.removeSourceMapComment = function (content) { // By default the TypeScript automaticly inserts a source map comment. @@ -149,46 +129,36 @@ var ProjectCompiler = (function () { exports.ProjectCompiler = ProjectCompiler; var FileCompiler = (function () { function FileCompiler() { - this.errorsPerFile = {}; - this.previousErrorsPerFile = {}; + this.output = {}; + this.previousOutput = {}; this.compilationResult = undefined; } - FileCompiler.prototype.prepare = function (_project) { - this.project = _project; + FileCompiler.prototype.prepare = function (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.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) { 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.project.previousOutput; - var diagnostics_1 = this.previousErrorsPerFile[file.fileNameNormalized]; - for (var _i = 0, diagnostics_2 = diagnostics_1; _i < diagnostics_2.length; _i++) { - var error = diagnostics_2[_i]; - this.project.output.diagnostic(error); - } - this.compilationResult.transpileErrors += diagnostics_1.length; - this.errorsPerFile[file.fileNameNormalized] = this.previousErrorsPerFile[file.fileNameNormalized]; - for (var _a = 0, _b = Object.keys(old.files); _a < _b.length; _a++) { - var fileName = _b[_a]; - var oldFile = old.files[fileName]; - if (oldFile.original.fileNameNormalized !== file.fileNameNormalized) - continue; - this.project.output.write(oldFile.fileName + '.' + oldFile.extension[output_1.OutputFileKind.JavaScript], oldFile.content[output_1.OutputFileKind.JavaScript]); - this.project.output.write(oldFile.fileName + '.' + oldFile.extension[output_1.OutputFileKind.SourceMap], oldFile.content[output_1.OutputFileKind.SourceMap]); - } + var old = this.previousOutput[file.fileNameNormalized]; + this.write(file, old.fileName, old.diagnostics, old.content, old.sourceMap); return; } var diagnostics = []; - var outputString = tsApi.transpile(this.project.typescript, file.content, this.project.options, file.fileNameOriginal, diagnostics); - for (var _c = 0, diagnostics_3 = diagnostics; _c < diagnostics_3.length; _c++) { - var diagnostic = diagnostics_3[_c]; - this.project.output.diagnostic(diagnostic); - } - this.compilationResult.transpileErrors += diagnostics.length; + 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); if (mapString.substring(0, 1) === '\r') @@ -200,21 +170,17 @@ var FileCompiler = (function () { } mapString = mapString.substring(start.length); var map = JSON.parse(new Buffer(mapString, 'base64').toString()); - map.sourceRoot = path.resolve(file.gulp.cwd, file.gulp.base); - map.sources[0] = path.relative(map.sourceRoot, file.gulp.path); + // 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 _d = utils.splitExtension(map.file), extension = _d[1]; // js or jsx - this.project.output.write(fileNameExtensionless + '.' + extension, outputString.substring(0, index)); - this.project.output.write(fileNameExtensionless + '.' + extension + '.map', JSON.stringify(map)); - this.errorsPerFile[file.fileNameNormalized] = diagnostics; + var _a = utils.splitExtension(map.file), extension = _a[1]; // js or jsx + this.write(file, fileNameExtensionless + '.' + extension, diagnostics, outputString.substring(0, index), JSON.stringify(map)); }; FileCompiler.prototype.inputDone = function () { this.project.output.finish(this.compilationResult); - this.previousErrorsPerFile = this.errorsPerFile; - this.errorsPerFile = {}; - }; - FileCompiler.prototype.correctSourceMap = function (map) { - return true; + this.previousOutput = this.output; + this.output = {}; }; return FileCompiler; }()); diff --git a/release/host.d.ts b/release/host.d.ts index 88490f41..ac3814ef 100644 --- a/release/host.d.ts +++ b/release/host.d.ts @@ -1,28 +1,21 @@ import * as ts from 'typescript'; import { FileCache } from './input'; -import * as utils from './utils'; export declare class Host implements ts.CompilerHost { - static libDefault: utils.Map; - static getLibDefault(typescript: typeof ts, libFileName: string, originalFileName: string): any; typescript: typeof ts; + fallback: ts.CompilerHost; currentDirectory: string; - private externalResolve; - private libFileName; input: FileCache; - output: utils.Map; - constructor(typescript: typeof ts, currentDirectory: string, input: FileCache, externalResolve: boolean, libFileName: string); - private reset(); + constructor(typescript: typeof ts, currentDirectory: string, input: FileCache, options: ts.CompilerOptions); getNewLine(): string; useCaseSensitiveFileNames(): boolean; getCurrentDirectory: () => string; getCanonicalFileName(filename: string): string; - getDefaultLibFilename(): string; - getDefaultLibFileName(): string; + getDefaultLibFileName(options: ts.CompilerOptions): string; getDefaultLibLocation(): string; writeFile: (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) => void; - fileExists(fileName: string): boolean; - readFile(fileName: string): string; + fileExists: (fileName: string) => boolean; + readFile: (fileName: string) => string; getSourceFile: (fileName: string, languageVersion: ts.ScriptTarget, onError?: (message: string) => void) => ts.SourceFile; - realpath: any; - getDirectories: any; + realpath: (path: string) => string; + getDirectories: (path: string) => string[]; } diff --git a/release/host.js b/release/host.js index 3d72cb2d..bbb7f0e2 100644 --- a/release/host.js +++ b/release/host.js @@ -1,82 +1,42 @@ "use strict"; -var tsApi = require('./tsapi'); var utils = require('./utils'); -var fs = require('fs'); -var path = require('path'); -var libDirectory = '__lib/'; var Host = (function () { - function Host(typescript, currentDirectory, input, externalResolve, libFileName) { + function Host(typescript, currentDirectory, input, options) { var _this = this; this.getCurrentDirectory = function () { return _this.currentDirectory; }; - this.writeFile = function (fileName, data, writeByteOrderMark, onError) { - _this.output[fileName] = data; + this.writeFile = function (fileName, data, writeByteOrderMark, onError) { }; + this.fileExists = function (fileName) { + var sourceFile = _this.input.getFile(fileName); + if (sourceFile) + return true; + return _this.fallback.fileExists(fileName); + }; + this.readFile = function (fileName) { + var sourceFile = _this.input.getFile(fileName); + if (sourceFile) + return sourceFile.content; + return _this.fallback.readFile(fileName); }; this.getSourceFile = function (fileName, languageVersion, onError) { - if (fileName === '__lib.d.ts') { - return Host.getLibDefault(_this.typescript, _this.libFileName, fileName); - } - if (fileName.substring(0, libDirectory.length) === libDirectory) { - try { - return Host.getLibDefault(_this.typescript, fileName.substring(libDirectory.length), fileName); - } - catch (e) { } - try { - return Host.getLibDefault(_this.typescript, 'lib.' + fileName.substring(libDirectory.length), fileName); - } - catch (e) { } - return undefined; - } + // TODO: Cache lib.d.ts files between compilations var sourceFile = _this.input.getFile(fileName); if (sourceFile) return sourceFile.ts; - if (_this.externalResolve) { - var text = void 0; - try { - text = fs.readFileSync(fileName).toString('utf8'); - } - catch (ex) { - return undefined; - } - _this.input.addContent(fileName, text); - var sourceFile_1 = _this.input.getFile(fileName); - if (sourceFile_1) - return sourceFile_1.ts; - } + 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.typescript = typescript; + this.fallback = typescript.createCompilerHost(options); this.currentDirectory = currentDirectory; this.input = input; - this.externalResolve = externalResolve; - this.libFileName = libFileName; - var fallback = typescript.createCompilerHost({}); - this.realpath = fallback['realpath']; - this.getDirectories = fallback['getDirectories']; - this.reset(); } - Host.getLibDefault = function (typescript, libFileName, originalFileName) { - var fileName; - for (var i in require.cache) { - if (!Object.prototype.hasOwnProperty.call(require.cache, i) || require.cache[i] === undefined) - continue; - if (require.cache[i].exports === typescript) { - fileName = i; - } - } - if (fileName === undefined) { - return undefined; // Not found - } - fileName = path.join(path.dirname(fileName), libFileName); - if (this.libDefault[fileName]) { - return this.libDefault[fileName]; // Already loaded - } - var content = fs.readFileSync(fileName).toString('utf8'); - return this.libDefault[fileName] = tsApi.createSourceFile(typescript, originalFileName, content, typescript.ScriptTarget.ES3); // Will also work for ES5 & 6 - }; - Host.prototype.reset = function () { - this.output = {}; - }; Host.prototype.getNewLine = function () { return '\n'; }; @@ -86,53 +46,12 @@ var Host = (function () { Host.prototype.getCanonicalFileName = function (filename) { return utils.normalizePath(filename); }; - Host.prototype.getDefaultLibFilename = function () { - return '__lib.d.ts'; - }; - Host.prototype.getDefaultLibFileName = function () { - return '__lib.d.ts'; + Host.prototype.getDefaultLibFileName = function (options) { + return this.fallback.getDefaultLibFileName(options); }; Host.prototype.getDefaultLibLocation = function () { - return libDirectory; - }; - Host.prototype.fileExists = function (fileName) { - if (fileName === '__lib.d.ts') { - return true; - } - var sourceFile = this.input.getFile(fileName); - if (sourceFile) - return true; - if (this.externalResolve) { - try { - var stat = fs.statSync(fileName); - if (!stat) - return false; - return stat.isFile(); - } - catch (ex) { - } - } - return false; - }; - Host.prototype.readFile = function (fileName) { - var normalizedFileName = utils.normalizePath(fileName); - var sourceFile = this.input.getFile(fileName); - if (sourceFile) - return sourceFile.content; - if (this.externalResolve) { - // Read the whole file (and cache contents) to prevent race conditions. - var text = void 0; - try { - text = fs.readFileSync(fileName).toString('utf8'); - } - catch (ex) { - return undefined; - } - return text; - } - return undefined; + return this.fallback.getDefaultLibLocation(); }; - Host.libDefault = {}; return Host; }()); exports.Host = Host; diff --git a/release/input.js b/release/input.js index 8586c4ef..15f0ece1 100644 --- a/release/input.js +++ b/release/input.js @@ -1,6 +1,5 @@ "use strict"; var path = require('path'); -var tsApi = require('./tsapi'); var utils = require('./utils'); (function (FileChangeState) { FileChangeState[FileChangeState["New"] = 0] = "New"; @@ -173,7 +172,7 @@ var FileCache = (function () { return; } } - file.ts = tsApi.createSourceFile(this.typescript, file.fileNameOriginal, file.content, this.options.target, this.version + ''); + file.ts = this.typescript.createSourceFile(file.fileNameOriginal, file.content, this.options.target); }; FileCache.prototype.getFile = function (name) { return this.current.getFile(name); diff --git a/release/main.d.ts b/release/main.d.ts index 3baac5fc..e67e54bb 100644 --- a/release/main.d.ts +++ b/release/main.d.ts @@ -1,15 +1,11 @@ +/// import * as ts from 'typescript'; -import * as stream from 'stream'; -import * as project from './project'; +import * as _project from './project'; import * as _reporter from './reporter'; declare function compile(): compile.CompileStream; -declare function compile(proj: project.Project, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter): compile.CompileStream; -declare function compile(settings: compile.Settings, filters?: compile.FilterSettings, theReporter?: _reporter.Reporter): compile.CompileStream; +declare function compile(proj: _project.Project, theReporter?: _reporter.Reporter): compile.CompileStream; +declare function compile(settings: compile.Settings, theReporter?: _reporter.Reporter): compile.CompileStream; declare module compile { - interface CompileStream extends stream.Readable { - js: stream.Readable; - dts: stream.Readable; - } interface Settings { out?: string; outFile?: string; @@ -40,13 +36,11 @@ declare module compile { rootDir?: string; sourceRoot?: string; } - interface FilterSettings { - referencedFrom: string[]; - } - export import Project = project.Project; + type Project = _project.Project; + type CompileStream = _project.ICompileStream; export import reporter = _reporter; function createProject(settings?: Settings): any; function createProject(tsConfigFileName: string, settings?: Settings): any; - function filter(project: Project, filters: FilterSettings): NodeJS.ReadWriteStream; + function filter(...args: any[]): void; } export = compile; diff --git a/release/main.js b/release/main.js index 54ac33b7..501efd5b 100644 --- a/release/main.js +++ b/release/main.js @@ -1,238 +1,80 @@ +/// "use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var ts = require('typescript'); var fs = require('fs'); -var gutil = require('gulp-util'); var path = require('path'); -var stream = require('stream'); -var project = require('./project'); +var gutil = require('gulp-util'); +var _project = require('./project'); var utils = require('./utils'); -var _filter = require('./filter'); var _reporter = require('./reporter'); -var compiler = require('./compiler'); -var tsApi = require('./tsapi'); -var through2 = require('through2'); -var PLUGIN_NAME = 'gulp-typescript'; -var CompileStream = (function (_super) { - __extends(CompileStream, _super); - function CompileStream(proj) { - _super.call(this, { objectMode: true }); - this.dts = new CompileOutputStream(); - this.project = proj; - // Backwards compatibility - this.js = this; - // Prevent "Unhandled stream error in pipe" when compilation error occurs. - this.on('error', function () { }); +function compile(param, theReporter) { + if (arguments.length >= 3) { + 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."); } - CompileStream.prototype._write = function (file, encoding, cb) { - if (cb === void 0) { cb = function (err) { }; } - if (!file) - return cb(); - if (file.isNull()) { - cb(); - return; - } - if (file.isStream()) { - return cb(new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported')); - } - var isFirstFile = this.project.input.firstSourceFile === undefined; - var inputFile = this.project.input.addGulp(file); - if (isFirstFile) { - this.project.currentDirectory = this.project.input.firstSourceFile.gulp.cwd; - } - this.project.compiler.inputFile(inputFile); - cb(); - }; - CompileStream.prototype._read = function () { - }; - CompileStream.prototype.end = function (chunk, encoding, callback) { - if (typeof chunk === 'function') { - this._write(null, null, chunk); - } - else if (typeof encoding === 'function') { - this._write(chunk, null, encoding); - } - else { - this._write(chunk, encoding, callback); - } - this.project.compiler.inputDone(); - }; - return CompileStream; -}(stream.Duplex)); -var CompileOutputStream = (function (_super) { - __extends(CompileOutputStream, _super); - function CompileOutputStream() { - _super.call(this, { objectMode: true }); - } - CompileOutputStream.prototype._read = function () { - }; - return CompileOutputStream; -}(stream.Readable)); -function compile(param, filters, theReporter) { var proj; - if (param instanceof project.Project) { + if (typeof param === "function") { proj = param; - if (proj.running) { - throw new Error('gulp-typescript: A project cannot be used in two compilations at the same time. Create multiple projects with createProject instead.'); + if (arguments.length >= 2) { + deprecate("ts(tsProject, ...) has been deprecated", "use .pipe(tsProject(reporter)) instead", "As of gulp-typescript 3.0, .pipe(ts(tsProject, ...)) should be written as .pipe(tsProject(reporter))."); + } + else { + deprecate("ts(tsProject) has been deprecated", "use .pipe(tsProject(reporter)) instead", "As of gulp-typescript 3.0, .pipe(ts(tsProject)) should be written as .pipe(tsProject())."); } - proj.running = true; } else { proj = compile.createProject(param || {}); } - var inputStream = new CompileStream(proj); - proj.reset(inputStream.js, inputStream.dts); - proj.filterSettings = filters; - proj.reporter = theReporter || _reporter.defaultReporter(); - proj.compiler.prepare(proj); - return inputStream; + return proj(theReporter); } -function createEnumMap(input) { - var map = {}; - var keys = Object.keys(input); - for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { - var key = keys_1[_i]; - var value = input[key]; - if (typeof value === 'number') { - map[key.toLowerCase()] = value; - } +function getTypeScript(typescript) { + if (typescript) + return typescript; + try { + return require('typescript'); } - return map; -} -function getScriptTarget(typescript, language) { - var map = createEnumMap(typescript.ScriptTarget); - return map[language.toLowerCase()]; -} -function getModuleKind(typescript, moduleName) { - var map = createEnumMap(typescript.ModuleKind); - return map[moduleName.toLowerCase()]; -} -function getModuleResolution(typescript, kind) { - if (typescript.ModuleResolutionKind === undefined) { - return undefined; // Not supported in TS1.4 & 1.5 + catch (e) { + deprecate("TypeScript not installed", "install with `npm install typescript --save-dev`", "As of gulp-typescript 3.0, TypeScript isn't bundled with gulp-typescript any more.\nInstall the latest stable version with `npm install typescript --save-dev`\nor a nightly with `npm install typescript@next --save-dev`"); + throw new Error("TypeScript not installed"); } - // Enum member name is NodeJs, while option name is `node` - if (kind === 'node') - kind = 'nodejs'; - var map = createEnumMap(typescript.ModuleResolutionKind); - return map[kind.toLowerCase()]; -} -function getJsxEmit(typescript, jsx) { - if (typescript.JsxEmit === undefined) { - return undefined; // Not supported in TS1.4 & 1.5 - } - var map = createEnumMap(typescript.JsxEmit); - return map[jsx.toLowerCase()]; } function getCompilerOptions(settings, projectPath, configFileName) { - var typescript = settings.typescript || ts; + var 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.'); } - // Try to use `convertCompilerOptionsFromJson` to convert options. - if (typescript.convertCompilerOptionsFromJson) { - // Copy settings and remove several options - var newSettings = {}; - for (var _i = 0, _a = Object.keys(settings); _i < _a.length; _i++) { - var option = _a[_i]; - if (option === 'declarationFiles') { - newSettings.declaration = settings.declarationFiles; - continue; - } - if (option === 'noExternalResolve' || - option === 'sortOutput' || - option === 'typescript' || - option === 'sourceMap' || - option === 'inlineSourceMap') - continue; - newSettings[option] = settings[option]; - } - var result = typescript.convertCompilerOptionsFromJson(newSettings, projectPath, configFileName); - var reporter = _reporter.defaultReporter(); - for (var _b = 0, _c = result.errors; _b < _c.length; _b++) { - var error = _c[_b]; - reporter.error(utils.getError(error, typescript), typescript); - } - result.options.sourceMap = true; - result.options.suppressOutputPathCheck = true; - return result.options; + if (settings.noExternalResolve !== undefined) { + deprecate("noExternalResolve is deprecated", "use noResolve instead", "The non-standard option noExternalResolve has been removed as of gulp-typescript 3.0.\nUse noResolve instead."); } - // Legacy conversion - var tsSettings = {}; - for (var key in settings) { - if (!Object.hasOwnProperty.call(settings, key)) - continue; - if (key === 'noExternalResolve' || - key === 'declarationFiles' || - key === 'sortOutput' || - key === 'typescript' || - key === 'target' || - key === 'module' || - key === 'moduleResolution' || - key === 'jsx' || - key === 'sourceRoot' || - key === 'sourceMap' || - key === 'inlineSourceMap') - continue; - tsSettings[key] = settings[key]; - } - if (typeof settings.target === 'string') { - tsSettings.target = getScriptTarget(typescript, settings.target); - } - else if (typeof settings.target === 'number') { - tsSettings.target = settings.target; - } - if (typeof settings.module === 'string') { - tsSettings.module = getModuleKind(typescript, settings.module); - } - else if (typeof settings.module === 'number') { - tsSettings.module = settings.module; - } - if (typeof settings.jsx === 'string') { - // jsx is not supported in TS1.4 & 1.5, so we cannot do `tsSettings.jsx = `, but we have to use brackets. - tsSettings['jsx'] = getJsxEmit(typescript, settings.jsx); + if (settings.sortOutput !== undefined) { + deprecate("sortOutput is deprecated", "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."); } - else if (typeof settings.jsx === 'number') { - tsSettings['jsx'] = settings.jsx; - } - if (typeof settings.moduleResolution === 'string') { - // moduleResolution is not supported in TS1.4 & 1.5, so we cannot do `tsSettings.moduleResolution = `, but we have to use brackets. - tsSettings['moduleResolution'] = getModuleResolution(typescript, settings.moduleResolution); - } - else if (typeof settings.moduleResolution === 'number') { - tsSettings['moduleResolution'] = settings.moduleResolution; - } - if (tsApi.isTS14(typescript)) { - if (tsSettings.target === undefined) { - // TS 1.4 has a bug that the target needs to be set. - tsSettings.target = ts.ScriptTarget.ES3; - } - if (tsSettings.module === undefined) { - // Same bug in TS 1.4 as previous comment. - tsSettings.module = ts.ModuleKind.None; + // Copy settings and remove several options + var newSettings = {}; + for (var _i = 0, _a = Object.keys(settings); _i < _a.length; _i++) { + var option = _a[_i]; + if (option === 'declarationFiles') { + newSettings.declaration = settings.declarationFiles; + continue; } + if (option === 'noExternalResolve' || + option === 'sortOutput' || + option === 'typescript' || + option === 'sourceMap' || + option === 'inlineSourceMap') + continue; + newSettings[option] = settings[option]; } - if (settings.declarationFiles !== undefined) { - tsSettings.declaration = settings.declarationFiles; - } - tsSettings.sourceMap = true; - // Suppress errors when providing `allowJs` without `outDir`. - tsSettings.suppressOutputPathCheck = true; - if (tsSettings.baseUrl) { - tsSettings.baseUrl = path.resolve(projectPath, tsSettings.baseUrl); - } - if (tsSettings.rootDirs) { - tsSettings.rootDirs = tsSettings.rootDirs.map(function (dir) { return path.resolve(projectPath, dir); }); + var result = typescript.convertCompilerOptionsFromJson(newSettings, projectPath, configFileName); + var reporter = _reporter.defaultReporter(); + for (var _b = 0, _c = result.errors; _b < _c.length; _b++) { + var error = _c[_b]; + reporter.error(utils.getError(error, typescript), typescript); } - return tsSettings; + result.options.sourceMap = true; + result.options.suppressOutputPathCheck = true; + return result.options; } var compile; (function (compile) { - compile.Project = project.Project; compile.reporter = _reporter; function createProject(fileNameOrSettings, settings) { var tsConfigFileName = undefined; @@ -240,12 +82,12 @@ var compile; var projectDirectory = process.cwd(); if (fileNameOrSettings !== undefined) { if (typeof fileNameOrSettings === 'string') { - tsConfigFileName = fileNameOrSettings; - projectDirectory = path.dirname(fileNameOrSettings); - // load file and strip BOM, since JSON.parse fails to parse if there's a BOM present - var tsConfigText = fs.readFileSync(fileNameOrSettings).toString(); - var typescript = (settings && settings.typescript) || ts; - var tsConfig = tsApi.parseTsConfig(typescript, tsConfigFileName, tsConfigText); + tsConfigFileName = path.resolve(process.cwd(), fileNameOrSettings); + projectDirectory = path.dirname(tsConfigFileName); + // Load file and strip BOM, since JSON.parse fails to parse if there's a BOM present + var tsConfigText = fs.readFileSync(tsConfigFileName).toString(); + var typescript = getTypeScript(settings && settings.typescript); + var tsConfig = typescript.parseConfigFileTextToJson(tsConfigFileName, tsConfigText); tsConfigContent = tsConfig.config || {}; if (tsConfig.error) { console.log(tsConfig.error.messageText); @@ -269,35 +111,27 @@ var compile; settings = fileNameOrSettings; } } - var project = new compile.Project(tsConfigFileName, projectDirectory, tsConfigContent, getCompilerOptions(settings, projectDirectory, tsConfigFileName), settings.noExternalResolve ? true : false, settings.sortOutput ? true : false, settings.typescript); - // Isolated modules are only supported when using TS1.5+ - if (project.options['isolatedModules'] && !tsApi.isTS14(project.typescript)) { - if (project.options.out !== undefined || project.options['outFile'] !== undefined || project.sortOutput) { - console.warn('You cannot combine option `isolatedModules` with `out`, `outFile` or `sortOutput`'); - } - project.options['newLine'] = ts.NewLineKind.LineFeed; //new line option/kind fails TS1.4 typecheck - project.options.sourceMap = false; - project.options.declaration = false; - project.options['inlineSourceMap'] = true; - project.compiler = new compiler.FileCompiler(); - } - else { - project.compiler = new compiler.ProjectCompiler(); - } + var project = _project.setupProject(projectDirectory, tsConfigContent, getCompilerOptions(settings, projectDirectory, tsConfigFileName), getTypeScript(settings.typescript)); return project; } compile.createProject = createProject; - function filter(project, filters) { - var filterObj = undefined; - return through2.obj(function (file, encoding, callback) { - if (!filterObj) { - filterObj = new _filter.Filter(project, filters); - } - if (filterObj.match(file.path)) - this.push(file); - callback(); - }); + function filter() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + 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; })(compile || (compile = {})); +function deprecate(title, alternative, description) { + console.log(gutil.colors.red('gulp-typescript').toString() + + gutil.colors.gray(': ') + + title + + gutil.colors.gray(' - ') + + alternative); + if (description) + console.log(' ' + gutil.colors.gray(description.replace(/\n/g, '\n '))); + console.log(' ' + gutil.colors.gray('More information: ' + gutil.colors.underline('http://dev.ivogabe.com/gulp-typescript-3/'))); +} module.exports = compile; diff --git a/release/output.d.ts b/release/output.d.ts index 717b3cca..7109b62f 100644 --- a/release/output.d.ts +++ b/release/output.d.ts @@ -1,51 +1,19 @@ import * as stream from 'stream'; import * as ts from 'typescript'; -import * as utils from './utils'; import * as input from './input'; import * as reporter from './reporter'; import * as project from './project'; -import { RawSourceMap } from './types'; -export interface OutputFile { - fileName: string; - original: input.File; - sourceMapOrigins: input.File[]; - extension: { - [kind: number]: string; - }; - content: { - [kind: number]: string; - }; - pushed: boolean; - skipPush: boolean; - sourceMapsApplied: boolean; - sourceMap: RawSourceMap; - sourceMapString: string; -} -export declare enum OutputFileKind { - JavaScript = 0, - SourceMap = 1, - Definitions = 2, -} export declare class Output { - static knownExtensions: string[]; - constructor(_project: project.Project, streamJs: stream.Readable, streamDts: stream.Readable); - project: project.Project; - files: utils.Map; - errors: reporter.TypeScriptError[]; - results: reporter.CompilationResult; + constructor(_project: project.ProjectInfo, streamFull: stream.Readable, streamJs: stream.Readable, streamDts: stream.Readable); + project: project.ProjectInfo; + result: reporter.CompilationResult; + streamFull: stream.Readable; streamJs: stream.Readable; streamDts: stream.Readable; - write(fileName: string, content: string): void; - /** - * Adds the file to the `this.files`. - * If there is already a file with the specified `fileName`, it will be merged. - * This method should be called 3 times, 1 time for each `OutputFileKind`. - * @param fileName The extensionless filename. - */ - private addOrMergeFile(fileName, extension, kind, content); - private applySourceMaps(file); - private emit(file); - finish(results: reporter.CompilationResult): void; + 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); + finish(result: reporter.CompilationResult): void; private getError(info); diagnostic(info: ts.Diagnostic): void; error(error: reporter.TypeScriptError): void; diff --git a/release/output.js b/release/output.js index e6d14813..39750244 100644 --- a/release/output.js +++ b/release/output.js @@ -3,225 +3,88 @@ var path = require('path'); var sourceMap = require('source-map'); var gutil = require('gulp-util'); var utils = require('./utils'); -var tsApi = require('./tsapi'); -var compiler_1 = require("./compiler"); -(function (OutputFileKind) { - OutputFileKind[OutputFileKind["JavaScript"] = 0] = "JavaScript"; - OutputFileKind[OutputFileKind["SourceMap"] = 1] = "SourceMap"; - OutputFileKind[OutputFileKind["Definitions"] = 2] = "Definitions"; -})(exports.OutputFileKind || (exports.OutputFileKind = {})); -var OutputFileKind = exports.OutputFileKind; var Output = (function () { - function Output(_project, streamJs, streamDts) { - this.files = {}; - this.errors = []; + function Output(_project, streamFull, streamJs, streamDts) { this.project = _project; + this.streamFull = streamFull; this.streamJs = streamJs; this.streamDts = streamDts; } - Output.prototype.write = function (fileName, content) { - var _a = utils.splitExtension(fileName, Output.knownExtensions), fileNameExtensionless = _a[0], extension = _a[1]; - var kind; - switch (extension) { - case 'js': - case 'jsx': - kind = OutputFileKind.JavaScript; - break; - case 'js.map': - case 'jsx.map': - kind = OutputFileKind.SourceMap; - break; - case 'd.ts': - kind = OutputFileKind.Definitions; - break; - } - this.addOrMergeFile(fileNameExtensionless, extension, kind, content); + 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 + }); + var appliedSourceMap = this.applySourceMap(sourceMapContent, original, file); + if (appliedSourceMap) + file.sourceMap = JSON.parse(appliedSourceMap); + this.streamFull.push(file); + this.streamJs.push(file); }; - /** - * Adds the file to the `this.files`. - * If there is already a file with the specified `fileName`, it will be merged. - * This method should be called 3 times, 1 time for each `OutputFileKind`. - * @param fileName The extensionless filename. - */ - Output.prototype.addOrMergeFile = function (fileName, extension, kind, content) { - var _this = this; - var file = this.files[utils.normalizePath(fileName)]; - if (file) { - file.extension[kind] = extension; - file.content[kind] = content; - if (file.content[OutputFileKind.JavaScript] !== undefined - && file.content[OutputFileKind.SourceMap] !== undefined - && (file.content[OutputFileKind.Definitions] !== undefined || !this.project.options.declaration)) { - file.sourceMap = JSON.parse(file.content[OutputFileKind.SourceMap]); - if (!this.project.compiler.correctSourceMap(file.sourceMap)) { - file.skipPush = true; - return; - } - if (this.project.singleOutput) { - file.original = this.project.input.firstSourceFile; - file.sourceMapOrigins = this.project.input.getFileNames(true).map(function (fName) { return _this.project.input.getFile(fName); }); - } - else { - var originalFileName = path.resolve(file.sourceMap.sourceRoot, file.sourceMap.sources[0]); - file.original = this.project.input.getFile(originalFileName); - if (!file.original) { - console.error(("Could not find input file " + originalFileName + ". This is probably an issue of gulp-typescript.") - + "\nPlease report it at https://github.com/ivogabe/gulp-typescript/issues" - + ("\nDebug information: \nsourceRoot = " + JSON.stringify(file.sourceMap.sourceRoot) + "\nsources = " + JSON.stringify(file.sourceMap.sources))); - file.skipPush = true; - file.sourceMapOrigins = []; - } - else { - file.skipPush = !file.original.gulp; - file.sourceMapOrigins = [file.original]; - } - var _a = utils.splitExtension(file.sourceMap.file), jsExtension = _a[1]; // js or jsx - var filePath = utils.splitExtension(originalFileName)[0]; - var outputFileName = filePath + "." + jsExtension; - // Fix the output filename in the source map, which must be relative - // to the source root or it won't work correctly in gulp-sourcemaps if - // there are more transformations down in the pipeline. - file.sourceMap.file = path.relative(file.sourceMap.sourceRoot, outputFileName); - } - this.applySourceMaps(file); - if (!this.project.sortOutput) { - this.emit(file); - } - } - return; - } - this.files[utils.normalizePath(fileName)] = { - fileName: fileName, - original: undefined, - sourceMapOrigins: undefined, - extension: (_b = {}, - _b[kind] = extension, - _b - ), - content: (_c = {}, - _c[kind] = content, - _c - ), - pushed: false, - skipPush: undefined, - sourceMapsApplied: false, - sourceMap: undefined, - sourceMapString: undefined - }; - var _b, _c; + Output.prototype.writeDts = function (base, fileName, content, cwd) { + var file = new gutil.File({ + path: fileName, + contents: new Buffer(content), + cwd: cwd, + base: base + }); + this.streamFull.push(file); + this.streamDts.push(file); }; - Output.prototype.applySourceMaps = function (file) { - if (file.sourceMapsApplied || file.skipPush || !file.original.gulp.sourceMap) - return; - file.sourceMapsApplied = true; - var map = file.sourceMap; - map.file = map.file.replace(/\\/g, '/'); + Output.prototype.applySourceMap = function (sourceMapContent, original, output) { + var _this = this; + 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 = output.relative; + map.sources = map.sources.map(relativeToOutput); delete map.sourceRoot; - map.sources = map.sources.map(function (path) { return path.replace(/\\/g, '/'); }); var generator = sourceMap.SourceMapGenerator.fromSourceMap(new sourceMap.SourceMapConsumer(map)); - for (var _i = 0, _a = file.sourceMapOrigins; _i < _a.length; _i++) { - var sourceFile = _a[_i]; + 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. - */ + // 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); + generator.applySourceMap(consumer, sourceFile.fileNameOriginal, sourceFile.gulp.base); } if (!inputMap.sources || !inputMap.sourcesContent) continue; - for (var i in inputMap.sources) { - generator.setSourceContent(inputMap.sources[i], inputMap.sourcesContent[i]); + for (var i = 0; i < inputMap.sources.length; i++) { + var absolute = path.resolve(sourceFile.gulp.base, inputMap.sources[i]); + var relative = path.relative(directory, absolute); + generator.setSourceContent(relative, inputMap.sourcesContent[i]); } } - file.sourceMapString = generator.toString(); - }; - Output.prototype.emit = function (file) { - if (file.skipPush) - return; - var root; - if (this.project.typescript.convertCompilerOptionsFromJson !== undefined && this.project.options.out === undefined) { - root = ''; - } - else if (this.project.singleOutput) { - root = this.project.input.commonBasePath; - } - else if (this.project.options.outDir !== undefined && this.project.compiler instanceof compiler_1.ProjectCompiler) { - root = file.original.gulp.cwd + '/'; - } - else { - root = ''; - } - var base; - if (this.project.options.outDir !== undefined && this.project.compiler instanceof compiler_1.ProjectCompiler) { - base = path.resolve(file.original.gulp.cwd, this.project.options.outDir) + '/'; - } - else if (this.project.singleOutput) { - if (this.project.options.out === undefined) { - base = this.project.projectDirectory; - } - else { - base = this.project.input.commonBasePath; - } - } - else { - base = file.original.gulp.base; - } - var fileJs = new gutil.File({ - path: path.join(root, file.fileName + '.' + file.extension[OutputFileKind.JavaScript]), - contents: new Buffer(file.content[OutputFileKind.JavaScript]), - cwd: file.original.gulp.cwd, - base: base - }); - if (file.original.gulp.sourceMap) - fileJs.sourceMap = JSON.parse(file.sourceMapString); - this.streamJs.push(fileJs); - if (this.project.options.declaration) { - var fileDts = new gutil.File({ - path: path.join(root, file.fileName + '.' + file.extension[OutputFileKind.Definitions]), - contents: new Buffer(file.content[OutputFileKind.Definitions]), - cwd: file.original.gulp.cwd, - base: base - }); - this.streamDts.push(fileDts); + return generator.toString(); + function relativeToOutput(fileName) { + var absolute = path.resolve(directory, fileName.replace(/\\/g, '/')); + return path.relative(output.base, absolute); } }; - Output.prototype.finish = function (results) { - var _this = this; - if (this.project.sortOutput) { - var sortedEmit_1 = function (fileName) { - var file = _this.files[utils.normalizePath(fileName)]; - if (!file || file.skipPush || file.pushed) - return; - if (file.original && file.original.ts) { - var references = file.original.ts.referencedFiles.map(function (file) { return tsApi.getFileName(file); }); - for (var _i = 0, references_1 = references; _i < references_1.length; _i++) { - var reference = references_1[_i]; - sortedEmit_1(utils.splitExtension(reference)[0]); - } - } - _this.emit(file); - }; - for (var _i = 0, _a = Object.keys(this.files); _i < _a.length; _i++) { - var fileName = _a[_i]; - sortedEmit_1(fileName); - } - } - this.results = results; + Output.prototype.finish = function (result) { + this.result = result; if (this.project.reporter.finish) - this.project.reporter.finish(results); + this.project.reporter.finish(result); + this.streamFull.emit('finish'); this.streamJs.emit('finish'); this.streamDts.emit('finish'); + this.streamFull.push(null); this.streamJs.push(null); this.streamDts.push(null); - this.project.running = false; }; Output.prototype.getError = function (info) { - var fileName = info.file && tsApi.getFileName(info.file); + var fileName = info.file && info.file.fileName; var file = fileName && this.project.input.getFile(fileName); return utils.getError(info, this.project.typescript, file); }; @@ -231,15 +94,12 @@ var Output = (function () { Output.prototype.error = function (error) { if (!error) return; - // Save errors for lazy compilation (if the next input is the same as the current), - this.errors.push(error); // call reporter callback if (this.project.reporter.error) this.project.reporter.error(error, this.project.typescript); // & emit the error on the stream. - this.streamJs.emit('error', error); + this.streamFull.emit('error', error); }; - Output.knownExtensions = ['js', 'jsx', 'js.map', 'jsx.map', 'd.ts']; return Output; }()); exports.Output = Output; diff --git a/release/project.d.ts b/release/project.d.ts index 2ae607c1..a6d331cd 100644 --- a/release/project.d.ts +++ b/release/project.d.ts @@ -1,52 +1,29 @@ import * as stream from 'stream'; import * as ts from 'typescript'; -import { FilterSettings } from './main'; import { Reporter } from './reporter'; import { FileCache } from './input'; import { Output } from './output'; import { ICompiler } from './compiler'; import { TsConfig } from './types'; -export declare class Project { +export interface Project { + (reporter?: Reporter): ICompileStream; + src(this: Project): NodeJS.ReadWriteStream; + readonly typescript?: typeof ts; + readonly projectDirectory: string; + readonly config: TsConfig; + readonly options: ts.CompilerOptions; +} +export interface ProjectInfo { input: FileCache; output: Output; - previousOutput: Output; compiler: ICompiler; - configFileName: string; - projectDirectory: string; - config: TsConfig; - running: boolean; - /** - * The TypeScript library that is used for this project. - * Can also be jsx-typescript for example. - */ - typescript: typeof ts; - options: ts.CompilerOptions; - /** - * Whether there should not be loaded external files to the project. - * Example: - * In the lib directory you have .ts files. - * In the definitions directory you have the .d.ts files. - * If you turn this option on, you should add in your gulp file the definitions directory as an input source. - * Advantage: - * - Faster builds - * Disadvantage: - * - If you forget some directory, your compile will fail. - */ - noExternalResolve: boolean; - /** - * Sort output based on tags. - * tsc does this when you pass the --out parameter. - */ - sortOutput: boolean; - filterSettings: FilterSettings; singleOutput: boolean; + options: ts.CompilerOptions; + typescript: typeof ts; reporter: Reporter; - currentDirectory: string; - constructor(configFileName: string, projectDirectory: string, config: TsConfig, options: ts.CompilerOptions, noExternalResolve: boolean, sortOutput: boolean, typescript?: typeof ts); - /** - * Resets the compiler. - * The compiler needs to be reset for incremental builds. - */ - reset(outputJs: stream.Readable, outputDts: stream.Readable): void; - src(): NodeJS.ReadWriteStream; +} +export declare function setupProject(projectDirectory: string, config: TsConfig, options: ts.CompilerOptions, typescript: typeof ts): Project; +export interface ICompileStream extends NodeJS.ReadWriteStream { + js: stream.Readable; + dts: stream.Readable; } diff --git a/release/project.js b/release/project.js index e2264846..16308855 100644 --- a/release/project.js +++ b/release/project.js @@ -1,142 +1,134 @@ "use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; var stream = require('stream'); -var ts = require('typescript'); var vfs = require('vinyl-fs'); var path = require('path'); -var through2 = require('through2'); -var tsApi = require('./tsapi'); +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 Project = (function () { - function Project(configFileName, projectDirectory, config, options, noExternalResolve, sortOutput, typescript) { - if (typescript === void 0) { typescript = ts; } - this.running = false; - this.typescript = typescript; - this.configFileName = configFileName; - this.projectDirectory = projectDirectory; - this.config = config; - this.options = options; - this.noExternalResolve = noExternalResolve; - this.sortOutput = sortOutput; - this.singleOutput = options.out !== undefined || options['outFile'] !== undefined; - this.input = new input_1.FileCache(typescript, options); +var compiler_1 = require('./compiler'); +function setupProject(projectDirectory, 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; + if (options.isolatedModules) { + options.newLine = typescript.NewLineKind.LineFeed; + options.sourceMap = false; + options.declaration = false; + options.inlineSourceMap = true; } - /** - * Resets the compiler. - * The compiler needs to be reset for incremental builds. - */ - Project.prototype.reset = function (outputJs, outputDts) { - this.input.reset(); - this.previousOutput = this.output; - this.output = new output_1.Output(this, outputJs, outputDts); + var project = function (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); + projectInfo.output = new output_1.Output(projectInfo, stream, stream.js, stream.dts); + projectInfo.reporter = reporter || reporter_1.defaultReporter; + stream.on('finish', function () { + running = false; + }); + return stream; + }; + var singleOutput = options.out !== undefined || options.outFile !== undefined; + project.src = src; + project.typescript = typescript; + project.projectDirectory = projectDirectory; + project.config = config; + project.options = options; + var projectInfo = { + input: input, + singleOutput: singleOutput, + compiler: compiler, + options: options, + typescript: typescript, + // Set when `project` is called + output: undefined, + reporter: undefined + }; + return project; +} +exports.setupProject = setupProject; +function src() { + var base; + if (this.options["rootDir"]) { + base = path.resolve(this.projectDirectory, this.options["rootDir"]); + } + var content = {}; + if (this.config.include) + content.include = this.config.include; + if (this.config.exclude) + content.exclude = this.config.exclude; + if (this.config.files) + content.files = this.config.files; + if (this.options['allowJs']) + content.compilerOptions = { allowJs: true }; + var _a = this.typescript.parseJsonConfigFileContent(content, this.typescript.sys, this.projectDirectory), fileNames = _a.fileNames, errors = _a.errors; + for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) { + var error = errors_1[_i]; + 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 }; + return vfs.src(fileNames, vinylOptions); +} +var CompileStream = (function (_super) { + __extends(CompileStream, _super); + function CompileStream(project) { + _super.call(this, { objectMode: true }); + 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 () { }); + } + CompileStream.prototype._write = function (file, encoding, cb) { + if (cb === void 0) { cb = function (err) { }; } + if (!file) + return cb(); + if (file.isNull()) { + cb(); + return; + } + if (file.isStream()) { + return cb(new gutil.PluginError('gulp-typescript', 'Streaming not supported')); + } + var inputFile = this.project.input.addGulp(file); + this.project.compiler.inputFile(inputFile); + cb(); }; - Project.prototype.src = function () { - var _this = this; - var configPath = path.dirname(this.configFileName); - var base; - if (this.options["rootDir"]) { - base = path.resolve(configPath, this.options["rootDir"]); + CompileStream.prototype._read = function () { + }; + CompileStream.prototype.end = function (chunk, encoding, callback) { + if (typeof chunk === 'function') { + this._write(null, null, chunk); } - if (this.typescript.parseJsonConfigFileContent && this.typescript.sys) { - var content = {}; - if (this.config.include) - content.include = this.config.include; - if (this.config.exclude) - content.exclude = this.config.exclude; - if (this.config.files) - content.files = this.config.files; - if (this.options['allowJs']) - content.compilerOptions = { allowJs: true }; - var _a = this.typescript.parseJsonConfigFileContent(content, this.typescript.sys, this.projectDirectory), fileNames = _a.fileNames, errors = _a.errors; - for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) { - var error = errors_1[_i]; - 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_1 = { base: base, allowEmpty: true }; - return vfs.src(fileNames, vinylOptions_1); + else if (typeof encoding === 'function') { + this._write(chunk, null, encoding); } - if (!this.config.files) { - var files_1 = []; - //If neither 'files' nor 'include' option is defined, - //take all .ts files (or .ts, .js, .jsx if required) by default. - if (!this.config.include) { - files_1.push(path.join(configPath, '**/*.ts')); - if (tsApi.isTS16OrNewer(this.typescript)) { - files_1.push(path.join(configPath, '**/*.tsx')); - } - if (this.options.allowJs) { - files_1.push(path.join(configPath, '**/*.js')); - files_1.push(path.join(configPath, '**/*.jsx')); - } - } - else if (this.config.include instanceof Array) { - files_1 = files_1.concat( - // Include files - this.config.include.map(function (file) { return path.resolve(configPath, file); }), - // Include directories - this.config.include.map(function (file) { return path.resolve(configPath, file) + '/**'; })); - } - if (this.config.exclude instanceof Array) { - files_1 = files_1.concat( - // Exclude files - this.config.exclude.map(function (file) { return '!' + path.resolve(configPath, file); }), - // Exclude directories - this.config.exclude.map(function (file) { return '!' + path.resolve(configPath, file) + '/**'; })); - } - if (base !== undefined) { - return vfs.src(files_1, { base: base }); - } - var srcStream = vfs.src(files_1); - var sources_1 = new stream.Readable({ objectMode: true }); - sources_1._read = function () { }; - var resolvedFiles_1 = []; - srcStream.on('data', function (file) { - resolvedFiles_1.push(file); - }); - srcStream.on('finish', function () { - var sourceFiles = resolvedFiles_1 - .filter(function (file) { return file.path.substr(-5) !== ".d.ts"; }); - var base = utils.getCommonBasePathOfArray(sourceFiles.map(function (file) { return path.dirname(file.path); })); - for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { - var file = sourceFiles_1[_i]; - file.base = base; - sources_1.push(file); - } - sources_1.emit('finish'); - }); - return srcStream; + else { + this._write(chunk, encoding, callback); } - var files = this.config.files.map(function (file) { return path.resolve(configPath, file); }); - if (base === undefined) - base = utils.getCommonBasePathOfArray(files.map(function (file) { return path.dirname(file); })); - var resolvedFiles = []; - var checkMissingFiles = through2.obj(function (file, enc, callback) { - this.push(file); - resolvedFiles.push(utils.normalizePath(file.path)); - callback(); - }); - checkMissingFiles.on('finish', function () { - for (var _i = 0, _a = _this.config.files; _i < _a.length; _i++) { - var fileName = _a[_i]; - var fullPaths = [ - utils.normalizePath(path.join(configPath, fileName)), - utils.normalizePath(path.join(process.cwd(), configPath, fileName)) - ]; - if (resolvedFiles.indexOf(fullPaths[0]) === -1 && resolvedFiles.indexOf(fullPaths[1]) === -1) { - var error = new Error("error TS6053: File '" + fileName + "' not found."); - console.error(error.message); - checkMissingFiles.emit('error', error); - } - } - }); - var vinylOptions = { base: base, allowEmpty: true }; - return vfs.src(this.config.files.map(function (file) { return path.resolve(configPath, file); }), vinylOptions) - .pipe(checkMissingFiles); + this.project.compiler.inputDone(); + }; + return CompileStream; +}(stream.Duplex)); +var CompileOutputStream = (function (_super) { + __extends(CompileOutputStream, _super); + function CompileOutputStream() { + _super.call(this, { objectMode: true }); + } + CompileOutputStream.prototype._read = function () { }; - return Project; -}()); -exports.Project = Project; + return CompileOutputStream; +}(stream.Readable)); diff --git a/release/reporter.d.ts b/release/reporter.d.ts index ed2b7097..3dba518e 100644 --- a/release/reporter.d.ts +++ b/release/reporter.d.ts @@ -22,9 +22,11 @@ export interface CompilationResult { * Only used when using isolatedModules. */ transpileErrors: number; + optionsErrors: number; syntaxErrors: number; globalErrors: number; semanticErrors: number; + declarationErrors: number; emitErrors: number; emitSkipped: boolean; } diff --git a/release/reporter.js b/release/reporter.js index 231f9ba8..157b7e70 100644 --- a/release/reporter.js +++ b/release/reporter.js @@ -3,9 +3,11 @@ var gutil = require('gulp-util'); function emptyCompilationResult() { return { transpileErrors: 0, + optionsErrors: 0, syntaxErrors: 0, globalErrors: 0, semanticErrors: 0, + declarationErrors: 0, emitErrors: 0, emitSkipped: false }; @@ -20,9 +22,11 @@ function defaultFinishHandler(results) { hasError = true; }; showErrorCount(results.transpileErrors, ''); + showErrorCount(results.optionsErrors, 'options'); showErrorCount(results.syntaxErrors, 'syntax'); showErrorCount(results.globalErrors, 'global'); showErrorCount(results.semanticErrors, 'semantic'); + showErrorCount(results.declarationErrors, 'declaration'); showErrorCount(results.emitErrors, 'emit'); if (results.emitSkipped) { gutil.log('TypeScript: emit', gutil.colors.red('failed')); @@ -44,30 +48,14 @@ function defaultReporter() { }; } exports.defaultReporter = defaultReporter; -function flattenDiagnosticsVerbose(message, index) { - if (index === void 0) { index = 0; } - if (typeof message === 'undefined') { - return ''; - } - else if (typeof message === 'string') { - return message; - } - else { - var result = void 0; - if (index === 0) { - result = message.messageText; - } - else { - result = '\n> TS' + message.code + ' ' + message.messageText; - } - return result + flattenDiagnosticsVerbose(message.next, index + 1); - } -} function longReporter() { + var typescript = require('typescript'); return { error: function (error) { if (error.tsFile) { - console.error('[' + gutil.colors.gray('gulp-typescript') + '] ' + gutil.colors.red(error.fullFilename + '(' + error.startPosition.line + ',' + error.startPosition.character + '): ') + 'error TS' + error.diagnostic.code + ' ' + flattenDiagnosticsVerbose(error.diagnostic.messageText)); + console.error('[' + gutil.colors.gray('gulp-typescript') + '] ' + gutil.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); @@ -79,11 +67,12 @@ function longReporter() { exports.longReporter = longReporter; function fullReporter(fullFilename) { if (fullFilename === void 0) { fullFilename = false; } + var typescript = require('typescript'); return { error: function (error, typescript) { console.error('[' + gutil.colors.gray('gulp-typescript') + '] ' + gutil.colors.bgRed(error.diagnostic.code + '') - + ' ' + gutil.colors.red(flattenDiagnosticsVerbose(error.diagnostic.messageText))); + + ' ' + 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)/); diff --git a/release/utils.js b/release/utils.js index cb4c4e98..fbd442b4 100644 --- a/release/utils.js +++ b/release/utils.js @@ -1,7 +1,5 @@ "use strict"; var path = require('path'); -var ts = require('typescript'); -var tsApi = require('./tsapi'); var gutil = require('gulp-util'); function normalizePath(pathString) { return path.normalize(pathString).toLowerCase(); @@ -53,16 +51,16 @@ function getError(info, typescript, file) { var err = new Error(); err.name = 'TypeScript error'; err.diagnostic = info; - var codeAndMessageText = ts.DiagnosticCategory[info.category].toLowerCase() + + var codeAndMessageText = typescript.DiagnosticCategory[info.category].toLowerCase() + ' TS' + info.code + ': ' + - tsApi.flattenDiagnosticMessageText(typescript, info.messageText); + typescript.flattenDiagnosticMessageText(info.messageText, '\n'); if (!info.file) { err.message = codeAndMessageText; return err; } - var fileName = tsApi.getFileName(info.file); + var fileName = info.file.fileName; if (file) { err.tsFile = file.ts; err.fullFilename = file.fileNameOriginal; @@ -76,11 +74,10 @@ function getError(info, typescript, file) { } } else { - fileName = tsApi.getFileName(info.file); - err.fullFilename = fileName; + err.fullFilename = info.file.fileName; } - var startPos = tsApi.getLineAndCharacterOfPosition(typescript, info.file, info.start); - var endPos = tsApi.getLineAndCharacterOfPosition(typescript, info.file, info.start + info.length); + var startPos = typescript.getLineAndCharacterOfPosition(info.file, info.start); + var endPos = typescript.getLineAndCharacterOfPosition(info.file, info.start + info.length); err.startPosition = { position: info.start, line: startPos.line, @@ -91,7 +88,7 @@ function getError(info, typescript, file) { line: endPos.line, character: endPos.character }; - err.message = gutil.colors.red(fileName + '(' + startPos.line + ',' + startPos.character + '): ').toString() + err.message = gutil.colors.red(fileName + '(' + (startPos.line + 1) + ',' + (startPos.character + 1) + '): ').toString() + codeAndMessageText; return err; } diff --git a/test/base/gulptask.js b/test/base/gulptask.js index 011b5d11..45d617ad 100644 --- a/test/base/gulptask.js +++ b/test/base/gulptask.js @@ -7,7 +7,7 @@ module.exports = function(newTS, lib, output, reporter) { }); var tsResult = tsProject.src() - .pipe(newTS(tsProject, undefined, reporter)); + .pipe(tsProject(reporter)); tsResult.dts.pipe(gulp.dest(output + '/dts')); return tsResult.js diff --git a/test/baselines/base/1.4/errors.txt b/test/baselines/base/1.4/errors.txt deleted file mode 100644 index f1952a5b..00000000 --- a/test/baselines/base/1.4/errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -TypeScript error: error TS2318: Cannot find global type 'Array'. -TypeScript error: error TS2318: Cannot find global type 'Boolean'. -TypeScript error: error TS2318: Cannot find global type 'Function'. -TypeScript error: error TS2318: Cannot find global type 'IArguments'. -TypeScript error: error TS2318: Cannot find global type 'Number'. -TypeScript error: error TS2318: Cannot find global type 'Object'. -TypeScript error: error TS2318: Cannot find global type 'RegExp'. -TypeScript error: error TS2318: Cannot find global type 'String'. -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 8, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/base/1.5/errors.txt b/test/baselines/base/1.5/errors.txt deleted file mode 100644 index 1c24ef97..00000000 --- a/test/baselines/base/1.5/errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -TypeScript error: error TS2318: Cannot find global type 'Array'. -TypeScript error: error TS2318: Cannot find global type 'Boolean'. -TypeScript error: error TS2318: Cannot find global type 'Function'. -TypeScript error: error TS2318: Cannot find global type 'IArguments'. -TypeScript error: error TS2318: Cannot find global type 'Number'. -TypeScript error: error TS2318: Cannot find global type 'Object'. -TypeScript error: error TS2318: Cannot find global type 'RegExp'. -TypeScript error: error TS2318: Cannot find global type 'String'. -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 8, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/base/1.5/js/a.js b/test/baselines/base/1.5/js/a.js deleted file mode 100644 index dc8896ed..00000000 --- a/test/baselines/base/1.5/js/a.js +++ /dev/null @@ -1 +0,0 @@ -var x = {}; diff --git a/test/baselines/base/1.6/js/a.js b/test/baselines/base/1.6/js/a.js deleted file mode 100644 index dc8896ed..00000000 --- a/test/baselines/base/1.6/js/a.js +++ /dev/null @@ -1 +0,0 @@ -var x = {}; diff --git a/test/baselines/base/1.7/errors.txt b/test/baselines/base/1.7/errors.txt deleted file mode 100644 index 1c24ef97..00000000 --- a/test/baselines/base/1.7/errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -TypeScript error: error TS2318: Cannot find global type 'Array'. -TypeScript error: error TS2318: Cannot find global type 'Boolean'. -TypeScript error: error TS2318: Cannot find global type 'Function'. -TypeScript error: error TS2318: Cannot find global type 'IArguments'. -TypeScript error: error TS2318: Cannot find global type 'Number'. -TypeScript error: error TS2318: Cannot find global type 'Object'. -TypeScript error: error TS2318: Cannot find global type 'RegExp'. -TypeScript error: error TS2318: Cannot find global type 'String'. -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 8, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/base/1.7/js/a.js b/test/baselines/base/1.7/js/a.js deleted file mode 100644 index dc8896ed..00000000 --- a/test/baselines/base/1.7/js/a.js +++ /dev/null @@ -1 +0,0 @@ -var x = {}; diff --git a/test/baselines/base/1.8/errors.txt b/test/baselines/base/1.8/errors.txt deleted file mode 100644 index 1c24ef97..00000000 --- a/test/baselines/base/1.8/errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -TypeScript error: error TS2318: Cannot find global type 'Array'. -TypeScript error: error TS2318: Cannot find global type 'Boolean'. -TypeScript error: error TS2318: Cannot find global type 'Function'. -TypeScript error: error TS2318: Cannot find global type 'IArguments'. -TypeScript error: error TS2318: Cannot find global type 'Number'. -TypeScript error: error TS2318: Cannot find global type 'Object'. -TypeScript error: error TS2318: Cannot find global type 'RegExp'. -TypeScript error: error TS2318: Cannot find global type 'String'. -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 8, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/base/1.8/js/a.js b/test/baselines/base/1.8/js/a.js deleted file mode 100644 index dc8896ed..00000000 --- a/test/baselines/base/1.8/js/a.js +++ /dev/null @@ -1 +0,0 @@ -var x = {}; diff --git a/test/baselines/base/1.6/errors.txt b/test/baselines/base/2.0/errors.txt similarity index 92% rename from test/baselines/base/1.6/errors.txt rename to test/baselines/base/2.0/errors.txt index 1c24ef97..4c350d69 100644 --- a/test/baselines/base/1.6/errors.txt +++ b/test/baselines/base/2.0/errors.txt @@ -8,9 +8,11 @@ TypeScript error: error TS2318: Cannot find global type 'RegExp'. TypeScript error: error TS2318: Cannot find global type 'String'. { "transpileErrors": 0, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 8, "semanticErrors": 0, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/base/1.4/js/a.js b/test/baselines/base/2.0/js/a.js similarity index 100% rename from test/baselines/base/1.4/js/a.js rename to test/baselines/base/2.0/js/a.js diff --git a/test/baselines/base/dev/errors.txt b/test/baselines/base/dev/errors.txt index 1c24ef97..4c350d69 100644 --- a/test/baselines/base/dev/errors.txt +++ b/test/baselines/base/dev/errors.txt @@ -8,9 +8,11 @@ TypeScript error: error TS2318: Cannot find global type 'RegExp'. TypeScript error: error TS2318: Cannot find global type 'String'. { "transpileErrors": 0, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 8, "semanticErrors": 0, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/basic/1.4/js/other-3.js b/test/baselines/basic/1.4/js/other-3.js deleted file mode 100644 index a485755d..00000000 --- a/test/baselines/basic/1.4/js/other-3.js +++ /dev/null @@ -1,10 +0,0 @@ -define(["require", "exports"], function (require, exports) { - var Hello = (function () { - function Hello() { - } - return Hello; - })(); - exports.Hello = Hello; -}); - -//# sourceMappingURL=other-3.js.map diff --git a/test/baselines/basic/1.4/js/other-3.js.map b/test/baselines/basic/1.4/js/other-3.js.map deleted file mode 100644 index c8b6350a..00000000 --- a/test/baselines/basic/1.4/js/other-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["other-3.ts"],"names":["Hello","Hello.constructor"],"mappings":";IAAA,IAAa,KAAK;QAAlBA,SAAaA,KAAKA;QAElBC,CAACA;QAADD,YAACA;IAADA,CAFA,AAECA,IAAA;IAFY,aAAK,GAAL,KAEZ,CAAA","file":"other-3.js","sourcesContent":["export class Hello {\n\tvalue: string;\n}"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/basic/1.4/js/test-3.js b/test/baselines/basic/1.4/js/test-3.js deleted file mode 100644 index 0d8d822b..00000000 --- a/test/baselines/basic/1.4/js/test-3.js +++ /dev/null @@ -1,6 +0,0 @@ -define(["require", "exports", './other-3'], function (require, exports, other) { - var a = new other.Hello(); - console.log(a.value); -}); - -//# sourceMappingURL=test-3.js.map diff --git a/test/baselines/basic/1.4/js/test-3.js.map b/test/baselines/basic/1.4/js/test-3.js.map deleted file mode 100644 index 55af2a46..00000000 --- a/test/baselines/basic/1.4/js/test-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-3.ts"],"names":[],"mappings":"wEAAO,KAAK;IAEZ,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC","file":"test-3.js","sourcesContent":["import other = require('./other-3');\n\nvar a = new other.Hello();\nconsole.log(a.value);"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/basic/1.5/dts/other-3.d.ts b/test/baselines/basic/1.5/dts/other-3.d.ts deleted file mode 100644 index b3a0b19d..00000000 --- a/test/baselines/basic/1.5/dts/other-3.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare class Hello { - value: string; -} diff --git a/test/baselines/basic/1.5/dts/test-3.d.ts b/test/baselines/basic/1.5/dts/test-3.d.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/test/baselines/basic/1.5/js/other-3.js b/test/baselines/basic/1.5/js/other-3.js deleted file mode 100644 index a485755d..00000000 --- a/test/baselines/basic/1.5/js/other-3.js +++ /dev/null @@ -1,10 +0,0 @@ -define(["require", "exports"], function (require, exports) { - var Hello = (function () { - function Hello() { - } - return Hello; - })(); - exports.Hello = Hello; -}); - -//# sourceMappingURL=other-3.js.map diff --git a/test/baselines/basic/1.5/js/other-3.js.map b/test/baselines/basic/1.5/js/other-3.js.map deleted file mode 100644 index 51bb6c6b..00000000 --- a/test/baselines/basic/1.5/js/other-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["other-3.ts"],"names":["Hello","Hello.constructor"],"mappings":";IAAA;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAFA,AAECA,IAAA;IAFY,aAAK,QAEjB,CAAA","file":"other-3.js","sourcesContent":["export class Hello {\n\tvalue: string;\n}"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/basic/1.5/js/test-3.js b/test/baselines/basic/1.5/js/test-3.js deleted file mode 100644 index 0d8d822b..00000000 --- a/test/baselines/basic/1.5/js/test-3.js +++ /dev/null @@ -1,6 +0,0 @@ -define(["require", "exports", './other-3'], function (require, exports, other) { - var a = new other.Hello(); - console.log(a.value); -}); - -//# sourceMappingURL=test-3.js.map diff --git a/test/baselines/basic/1.5/js/test-3.js.map b/test/baselines/basic/1.5/js/test-3.js.map deleted file mode 100644 index 690921f0..00000000 --- a/test/baselines/basic/1.5/js/test-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-3.ts"],"names":[],"mappings":";IAEA,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC","file":"test-3.js","sourcesContent":["import other = require('./other-3');\n\nvar a = new other.Hello();\nconsole.log(a.value);"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/basic/1.6/dts/other-3.d.ts b/test/baselines/basic/1.6/dts/other-3.d.ts deleted file mode 100644 index b3a0b19d..00000000 --- a/test/baselines/basic/1.6/dts/other-3.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare class Hello { - value: string; -} diff --git a/test/baselines/basic/1.6/dts/test-3.d.ts b/test/baselines/basic/1.6/dts/test-3.d.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/test/baselines/basic/1.6/js/other-3.js b/test/baselines/basic/1.6/js/other-3.js deleted file mode 100644 index a485755d..00000000 --- a/test/baselines/basic/1.6/js/other-3.js +++ /dev/null @@ -1,10 +0,0 @@ -define(["require", "exports"], function (require, exports) { - var Hello = (function () { - function Hello() { - } - return Hello; - })(); - exports.Hello = Hello; -}); - -//# sourceMappingURL=other-3.js.map diff --git a/test/baselines/basic/1.6/js/other-3.js.map b/test/baselines/basic/1.6/js/other-3.js.map deleted file mode 100644 index 51bb6c6b..00000000 --- a/test/baselines/basic/1.6/js/other-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["other-3.ts"],"names":["Hello","Hello.constructor"],"mappings":";IAAA;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAFA,AAECA,IAAA;IAFY,aAAK,QAEjB,CAAA","file":"other-3.js","sourcesContent":["export class Hello {\n\tvalue: string;\n}"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/basic/1.6/js/test-3.js b/test/baselines/basic/1.6/js/test-3.js deleted file mode 100644 index 0d8d822b..00000000 --- a/test/baselines/basic/1.6/js/test-3.js +++ /dev/null @@ -1,6 +0,0 @@ -define(["require", "exports", './other-3'], function (require, exports, other) { - var a = new other.Hello(); - console.log(a.value); -}); - -//# sourceMappingURL=test-3.js.map diff --git a/test/baselines/basic/1.6/js/test-3.js.map b/test/baselines/basic/1.6/js/test-3.js.map deleted file mode 100644 index 690921f0..00000000 --- a/test/baselines/basic/1.6/js/test-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-3.ts"],"names":[],"mappings":";IAEA,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC","file":"test-3.js","sourcesContent":["import other = require('./other-3');\n\nvar a = new other.Hello();\nconsole.log(a.value);"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/basic/1.7/dts/other-3.d.ts b/test/baselines/basic/1.7/dts/other-3.d.ts deleted file mode 100644 index b3a0b19d..00000000 --- a/test/baselines/basic/1.7/dts/other-3.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare class Hello { - value: string; -} diff --git a/test/baselines/basic/1.7/dts/test-3.d.ts b/test/baselines/basic/1.7/dts/test-3.d.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/test/baselines/basic/1.7/js/other-3.js b/test/baselines/basic/1.7/js/other-3.js deleted file mode 100644 index a485755d..00000000 --- a/test/baselines/basic/1.7/js/other-3.js +++ /dev/null @@ -1,10 +0,0 @@ -define(["require", "exports"], function (require, exports) { - var Hello = (function () { - function Hello() { - } - return Hello; - })(); - exports.Hello = Hello; -}); - -//# sourceMappingURL=other-3.js.map diff --git a/test/baselines/basic/1.7/js/other-3.js.map b/test/baselines/basic/1.7/js/other-3.js.map deleted file mode 100644 index 51bb6c6b..00000000 --- a/test/baselines/basic/1.7/js/other-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["other-3.ts"],"names":["Hello","Hello.constructor"],"mappings":";IAAA;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAFA,AAECA,IAAA;IAFY,aAAK,QAEjB,CAAA","file":"other-3.js","sourcesContent":["export class Hello {\n\tvalue: string;\n}"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/basic/1.7/js/test-3.js b/test/baselines/basic/1.7/js/test-3.js deleted file mode 100644 index 0d8d822b..00000000 --- a/test/baselines/basic/1.7/js/test-3.js +++ /dev/null @@ -1,6 +0,0 @@ -define(["require", "exports", './other-3'], function (require, exports, other) { - var a = new other.Hello(); - console.log(a.value); -}); - -//# sourceMappingURL=test-3.js.map diff --git a/test/baselines/basic/1.7/js/test-3.js.map b/test/baselines/basic/1.7/js/test-3.js.map deleted file mode 100644 index 690921f0..00000000 --- a/test/baselines/basic/1.7/js/test-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-3.ts"],"names":[],"mappings":";IAEA,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC","file":"test-3.js","sourcesContent":["import other = require('./other-3');\n\nvar a = new other.Hello();\nconsole.log(a.value);"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/basic/1.8/dts/other-3.d.ts b/test/baselines/basic/1.8/dts/other-3.d.ts deleted file mode 100644 index b3a0b19d..00000000 --- a/test/baselines/basic/1.8/dts/other-3.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare class Hello { - value: string; -} diff --git a/test/baselines/basic/1.8/dts/test-3.d.ts b/test/baselines/basic/1.8/dts/test-3.d.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/test/baselines/basic/1.8/errors.txt b/test/baselines/basic/1.8/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/basic/1.8/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/basic/1.8/js/other-3.js.map b/test/baselines/basic/1.8/js/other-3.js.map deleted file mode 100644 index c7288495..00000000 --- a/test/baselines/basic/1.8/js/other-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["other-3.ts"],"names":[],"mappings":";;IAAA;QAAA;QAEA,CAAC;QAAD,YAAC;IAAD,CAFA,AAEC,IAAA;IAFY,aAAK,QAEjB,CAAA","file":"other-3.js","sourcesContent":["export class Hello {\n\tvalue: string;\n}"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/basic/1.8/js/test-3.js.map b/test/baselines/basic/1.8/js/test-3.js.map deleted file mode 100644 index fd43fb58..00000000 --- a/test/baselines/basic/1.8/js/test-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-3.ts"],"names":[],"mappings":";;IAEA,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC","file":"test-3.js","sourcesContent":["import other = require('./other-3');\n\nvar a = new other.Hello();\nconsole.log(a.value);"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/basic/1.4/dts/other-3.d.ts b/test/baselines/basic/2.0/dts/other-3.d.ts similarity index 100% rename from test/baselines/basic/1.4/dts/other-3.d.ts rename to test/baselines/basic/2.0/dts/other-3.d.ts diff --git a/test/baselines/basic/1.4/dts/test-3.d.ts b/test/baselines/basic/2.0/dts/test-3.d.ts similarity index 100% rename from test/baselines/basic/1.4/dts/test-3.d.ts rename to test/baselines/basic/2.0/dts/test-3.d.ts diff --git a/test/baselines/basic/1.4/errors.txt b/test/baselines/basic/2.0/errors.txt similarity index 73% rename from test/baselines/basic/1.4/errors.txt rename to test/baselines/basic/2.0/errors.txt index 566ba53f..e51d1660 100644 --- a/test/baselines/basic/1.4/errors.txt +++ b/test/baselines/basic/2.0/errors.txt @@ -1,9 +1,11 @@ { "transpileErrors": 0, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 0, "semanticErrors": 0, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/basic/1.8/js/other-3.js b/test/baselines/basic/2.0/js/other-3.js similarity index 100% rename from test/baselines/basic/1.8/js/other-3.js rename to test/baselines/basic/2.0/js/other-3.js diff --git a/test/baselines/basic/2.0/js/other-3.js.map b/test/baselines/basic/2.0/js/other-3.js.map new file mode 100644 index 00000000..f5a1a299 --- /dev/null +++ b/test/baselines/basic/2.0/js/other-3.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../other-3.ts"],"names":[],"mappings":";;IAAA;QAAA;QAEA,CAAC;QAAD,YAAC;IAAD,CAFA,AAEC,IAAA;IAFY,aAAK,QAEjB,CAAA","file":"other-3.js","sourcesContent":["export class Hello {\n\tvalue: string;\n}"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/basic/1.8/js/test-3.js b/test/baselines/basic/2.0/js/test-3.js similarity index 100% rename from test/baselines/basic/1.8/js/test-3.js rename to test/baselines/basic/2.0/js/test-3.js diff --git a/test/baselines/basic/2.0/js/test-3.js.map b/test/baselines/basic/2.0/js/test-3.js.map new file mode 100644 index 00000000..0c660b19 --- /dev/null +++ b/test/baselines/basic/2.0/js/test-3.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../test-3.ts"],"names":[],"mappings":";;IAEA,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC","file":"test-3.js","sourcesContent":["import other = require('./other-3');\n\nvar a = new other.Hello();\nconsole.log(a.value);"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/basic/dev/errors.txt b/test/baselines/basic/dev/errors.txt index 566ba53f..e51d1660 100644 --- a/test/baselines/basic/dev/errors.txt +++ b/test/baselines/basic/dev/errors.txt @@ -1,9 +1,11 @@ { "transpileErrors": 0, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 0, "semanticErrors": 0, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/basic/dev/js/other-3.js.map b/test/baselines/basic/dev/js/other-3.js.map index c7288495..f5a1a299 100644 --- a/test/baselines/basic/dev/js/other-3.js.map +++ b/test/baselines/basic/dev/js/other-3.js.map @@ -1 +1 @@ -{"version":3,"sources":["other-3.ts"],"names":[],"mappings":";;IAAA;QAAA;QAEA,CAAC;QAAD,YAAC;IAAD,CAFA,AAEC,IAAA;IAFY,aAAK,QAEjB,CAAA","file":"other-3.js","sourcesContent":["export class Hello {\n\tvalue: string;\n}"],"sourceRoot":"../../../../basic/"} \ No newline at end of file +{"version":3,"sources":["../other-3.ts"],"names":[],"mappings":";;IAAA;QAAA;QAEA,CAAC;QAAD,YAAC;IAAD,CAFA,AAEC,IAAA;IAFY,aAAK,QAEjB,CAAA","file":"other-3.js","sourcesContent":["export class Hello {\n\tvalue: string;\n}"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/basic/dev/js/test-3.js.map b/test/baselines/basic/dev/js/test-3.js.map index fd43fb58..0c660b19 100644 --- a/test/baselines/basic/dev/js/test-3.js.map +++ b/test/baselines/basic/dev/js/test-3.js.map @@ -1 +1 @@ -{"version":3,"sources":["test-3.ts"],"names":[],"mappings":";;IAEA,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC","file":"test-3.js","sourcesContent":["import other = require('./other-3');\n\nvar a = new other.Hello();\nconsole.log(a.value);"],"sourceRoot":"../../../../basic/"} \ No newline at end of file +{"version":3,"sources":["../test-3.ts"],"names":[],"mappings":";;IAEA,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC","file":"test-3.js","sourcesContent":["import other = require('./other-3');\n\nvar a = new other.Hello();\nconsole.log(a.value);"],"sourceRoot":"../../../../basic/"} \ No newline at end of file diff --git a/test/baselines/bom/1.4/errors.txt b/test/baselines/bom/1.4/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/bom/1.4/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/bom/1.5/errors.txt b/test/baselines/bom/1.5/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/bom/1.5/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/bom/1.5/js/test-bom.js b/test/baselines/bom/1.5/js/test-bom.js deleted file mode 100644 index 526b86c7..00000000 --- a/test/baselines/bom/1.5/js/test-bom.js +++ /dev/null @@ -1 +0,0 @@ -console.log('hello world!'); diff --git a/test/baselines/bom/1.6/errors.txt b/test/baselines/bom/1.6/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/bom/1.6/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/bom/1.6/js/test-bom.js b/test/baselines/bom/1.6/js/test-bom.js deleted file mode 100644 index 526b86c7..00000000 --- a/test/baselines/bom/1.6/js/test-bom.js +++ /dev/null @@ -1 +0,0 @@ -console.log('hello world!'); diff --git a/test/baselines/bom/1.7/errors.txt b/test/baselines/bom/1.7/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/bom/1.7/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/bom/1.7/js/test-bom.js b/test/baselines/bom/1.7/js/test-bom.js deleted file mode 100644 index 526b86c7..00000000 --- a/test/baselines/bom/1.7/js/test-bom.js +++ /dev/null @@ -1 +0,0 @@ -console.log('hello world!'); diff --git a/test/baselines/bom/1.8/errors.txt b/test/baselines/bom/1.8/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/bom/1.8/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/bom/1.8/js/test-bom.js b/test/baselines/bom/1.8/js/test-bom.js deleted file mode 100644 index 526b86c7..00000000 --- a/test/baselines/bom/1.8/js/test-bom.js +++ /dev/null @@ -1 +0,0 @@ -console.log('hello world!'); diff --git a/test/baselines/basic/1.6/errors.txt b/test/baselines/bom/2.0/errors.txt similarity index 73% rename from test/baselines/basic/1.6/errors.txt rename to test/baselines/bom/2.0/errors.txt index 566ba53f..e51d1660 100644 --- a/test/baselines/basic/1.6/errors.txt +++ b/test/baselines/bom/2.0/errors.txt @@ -1,9 +1,11 @@ { "transpileErrors": 0, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 0, "semanticErrors": 0, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/bom/1.4/js/test-bom.js b/test/baselines/bom/2.0/js/test-bom.js similarity index 100% rename from test/baselines/bom/1.4/js/test-bom.js rename to test/baselines/bom/2.0/js/test-bom.js diff --git a/test/baselines/bom/dev/errors.txt b/test/baselines/bom/dev/errors.txt index 566ba53f..e51d1660 100644 --- a/test/baselines/bom/dev/errors.txt +++ b/test/baselines/bom/dev/errors.txt @@ -1,9 +1,11 @@ { "transpileErrors": 0, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 0, "semanticErrors": 0, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/errorReporting/1.4/js/test-4.js.map b/test/baselines/errorReporting/1.4/js/test-4.js.map deleted file mode 100644 index d6d51d93..00000000 --- a/test/baselines/errorReporting/1.4/js/test-4.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-4.ts"],"names":[],"mappings":"AAAA,AACA,eADe;AACf,IAAI,CAAC;AAEL,AACA,gBADgB;IACZ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACrB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACtB,CAAC,GAAG,CAAC,CAAC","file":"test-4.js","sourceRoot":"../../../../errorReporting/"} \ No newline at end of file diff --git a/test/baselines/errorReporting/1.5/errors.txt b/test/baselines/errorReporting/1.5/errors.txt deleted file mode 100644 index a7971620..00000000 --- a/test/baselines/errorReporting/1.5/errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -TypeScript error: test/errorReporting/test-4.ts(2,1): error TS2304: Cannot find name 'asdf'. -TypeScript error: test/errorReporting/test-4.ts(7,1): error TS2322: Type '{ y: string; }[][]' is not assignable to type '{ x: number; }[][]'. - Type '{ y: string; }[]' is not assignable to type '{ x: number; }[]'. - Type '{ y: string; }' is not assignable to type '{ x: number; }'. - Property 'x' is missing in type '{ y: string; }'. -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 2, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/errorReporting/1.5/js/test-4.js b/test/baselines/errorReporting/1.5/js/test-4.js deleted file mode 100644 index 9e317e1f..00000000 --- a/test/baselines/errorReporting/1.5/js/test-4.js +++ /dev/null @@ -1,8 +0,0 @@ -// Simple error -asdf; -// Nested errors -var x = [[{ x: 0 }]]; -var y = [[{ y: "" }]]; -x = y; - -//# sourceMappingURL=test-4.js.map diff --git a/test/baselines/errorReporting/1.5/js/test-4.js.map b/test/baselines/errorReporting/1.5/js/test-4.js.map deleted file mode 100644 index d6d51d93..00000000 --- a/test/baselines/errorReporting/1.5/js/test-4.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-4.ts"],"names":[],"mappings":"AAAA,AACA,eADe;AACf,IAAI,CAAC;AAEL,AACA,gBADgB;IACZ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACrB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACtB,CAAC,GAAG,CAAC,CAAC","file":"test-4.js","sourceRoot":"../../../../errorReporting/"} \ No newline at end of file diff --git a/test/baselines/errorReporting/1.6/errors.txt b/test/baselines/errorReporting/1.6/errors.txt deleted file mode 100644 index a7971620..00000000 --- a/test/baselines/errorReporting/1.6/errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -TypeScript error: test/errorReporting/test-4.ts(2,1): error TS2304: Cannot find name 'asdf'. -TypeScript error: test/errorReporting/test-4.ts(7,1): error TS2322: Type '{ y: string; }[][]' is not assignable to type '{ x: number; }[][]'. - Type '{ y: string; }[]' is not assignable to type '{ x: number; }[]'. - Type '{ y: string; }' is not assignable to type '{ x: number; }'. - Property 'x' is missing in type '{ y: string; }'. -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 2, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/errorReporting/1.6/js/test-4.js b/test/baselines/errorReporting/1.6/js/test-4.js deleted file mode 100644 index 9e317e1f..00000000 --- a/test/baselines/errorReporting/1.6/js/test-4.js +++ /dev/null @@ -1,8 +0,0 @@ -// Simple error -asdf; -// Nested errors -var x = [[{ x: 0 }]]; -var y = [[{ y: "" }]]; -x = y; - -//# sourceMappingURL=test-4.js.map diff --git a/test/baselines/errorReporting/1.7/errors.txt b/test/baselines/errorReporting/1.7/errors.txt deleted file mode 100644 index a7971620..00000000 --- a/test/baselines/errorReporting/1.7/errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -TypeScript error: test/errorReporting/test-4.ts(2,1): error TS2304: Cannot find name 'asdf'. -TypeScript error: test/errorReporting/test-4.ts(7,1): error TS2322: Type '{ y: string; }[][]' is not assignable to type '{ x: number; }[][]'. - Type '{ y: string; }[]' is not assignable to type '{ x: number; }[]'. - Type '{ y: string; }' is not assignable to type '{ x: number; }'. - Property 'x' is missing in type '{ y: string; }'. -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 2, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/errorReporting/1.7/js/test-4.js b/test/baselines/errorReporting/1.7/js/test-4.js deleted file mode 100644 index 9e317e1f..00000000 --- a/test/baselines/errorReporting/1.7/js/test-4.js +++ /dev/null @@ -1,8 +0,0 @@ -// Simple error -asdf; -// Nested errors -var x = [[{ x: 0 }]]; -var y = [[{ y: "" }]]; -x = y; - -//# sourceMappingURL=test-4.js.map diff --git a/test/baselines/errorReporting/1.7/js/test-4.js.map b/test/baselines/errorReporting/1.7/js/test-4.js.map deleted file mode 100644 index 133c7b23..00000000 --- a/test/baselines/errorReporting/1.7/js/test-4.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-4.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,IAAI,CAAC;AAEL,gBAAgB;AAChB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACrB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACtB,CAAC,GAAG,CAAC,CAAC","file":"test-4.js","sourceRoot":"../../../../errorReporting/"} \ No newline at end of file diff --git a/test/baselines/errorReporting/1.8/errors.txt b/test/baselines/errorReporting/1.8/errors.txt deleted file mode 100644 index a7971620..00000000 --- a/test/baselines/errorReporting/1.8/errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -TypeScript error: test/errorReporting/test-4.ts(2,1): error TS2304: Cannot find name 'asdf'. -TypeScript error: test/errorReporting/test-4.ts(7,1): error TS2322: Type '{ y: string; }[][]' is not assignable to type '{ x: number; }[][]'. - Type '{ y: string; }[]' is not assignable to type '{ x: number; }[]'. - Type '{ y: string; }' is not assignable to type '{ x: number; }'. - Property 'x' is missing in type '{ y: string; }'. -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 2, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/errorReporting/1.8/js/test-4.js b/test/baselines/errorReporting/1.8/js/test-4.js deleted file mode 100644 index 9e317e1f..00000000 --- a/test/baselines/errorReporting/1.8/js/test-4.js +++ /dev/null @@ -1,8 +0,0 @@ -// Simple error -asdf; -// Nested errors -var x = [[{ x: 0 }]]; -var y = [[{ y: "" }]]; -x = y; - -//# sourceMappingURL=test-4.js.map diff --git a/test/baselines/errorReporting/1.8/js/test-4.js.map b/test/baselines/errorReporting/1.8/js/test-4.js.map deleted file mode 100644 index 133c7b23..00000000 --- a/test/baselines/errorReporting/1.8/js/test-4.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-4.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,IAAI,CAAC;AAEL,gBAAgB;AAChB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACrB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACtB,CAAC,GAAG,CAAC,CAAC","file":"test-4.js","sourceRoot":"../../../../errorReporting/"} \ No newline at end of file diff --git a/test/baselines/errorReporting/1.4/errors.txt b/test/baselines/errorReporting/2.0/errors.txt similarity index 92% rename from test/baselines/errorReporting/1.4/errors.txt rename to test/baselines/errorReporting/2.0/errors.txt index a7971620..2c9b6a68 100644 --- a/test/baselines/errorReporting/1.4/errors.txt +++ b/test/baselines/errorReporting/2.0/errors.txt @@ -5,9 +5,11 @@ TypeScript error: test/errorReporting/test-4.ts(7,1): error TS2322: Ty Property 'x' is missing in type '{ y: string; }'. { "transpileErrors": 0, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 0, "semanticErrors": 2, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/errorReporting/1.4/js/test-4.js b/test/baselines/errorReporting/2.0/js/test-4.js similarity index 100% rename from test/baselines/errorReporting/1.4/js/test-4.js rename to test/baselines/errorReporting/2.0/js/test-4.js diff --git a/test/baselines/errorReporting/1.6/js/test-4.js.map b/test/baselines/errorReporting/2.0/js/test-4.js.map similarity index 100% rename from test/baselines/errorReporting/1.6/js/test-4.js.map rename to test/baselines/errorReporting/2.0/js/test-4.js.map diff --git a/test/baselines/errorReporting/dev/errors.txt b/test/baselines/errorReporting/dev/errors.txt index a7971620..2c9b6a68 100644 --- a/test/baselines/errorReporting/dev/errors.txt +++ b/test/baselines/errorReporting/dev/errors.txt @@ -5,9 +5,11 @@ TypeScript error: test/errorReporting/test-4.ts(7,1): error TS2322: Ty Property 'x' is missing in type '{ y: string; }'. { "transpileErrors": 0, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 0, "semanticErrors": 2, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/externalResolve/1.4/errors.txt b/test/baselines/externalResolve/1.4/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/externalResolve/1.4/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/externalResolve/1.4/js/test-2.js b/test/baselines/externalResolve/1.4/js/test-2.js deleted file mode 100644 index 7c1f8250..00000000 --- a/test/baselines/externalResolve/1.4/js/test-2.js +++ /dev/null @@ -1,8 +0,0 @@ -/// -var other = require('./other-2'); -var someModule = require('someModule'); -var a = new other.Hello(); -console.log(a.value); -console.log(someModule); - -//# sourceMappingURL=test-2.js.map diff --git a/test/baselines/externalResolve/1.4/js/test-2.js.map b/test/baselines/externalResolve/1.4/js/test-2.js.map deleted file mode 100644 index 918b6d3f..00000000 --- a/test/baselines/externalResolve/1.4/js/test-2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-2.ts"],"names":[],"mappings":"AAAA,AACA,uCADuC;AACvC,IAAO,KAAK,WAAW,WAAW,CAAC,CAAC;AACpC,IAAO,UAAU,WAAW,YAAY,CAAC,CAAC;AAE1C,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;AAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAErB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC","file":"test-2.js","sourcesContent":["/// \nimport other = require('./other-2');\nimport someModule = require('someModule');\n\nvar a = new other.Hello();\nconsole.log(a.value);\n\nconsole.log(someModule);\n"],"sourceRoot":"../../../../externalResolve/"} \ No newline at end of file diff --git a/test/baselines/externalResolve/1.5/dts/test-2.d.ts b/test/baselines/externalResolve/1.5/dts/test-2.d.ts deleted file mode 100644 index d3fe4c35..00000000 --- a/test/baselines/externalResolve/1.5/dts/test-2.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/test/baselines/externalResolve/1.5/errors.txt b/test/baselines/externalResolve/1.5/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/externalResolve/1.5/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/externalResolve/1.5/js/test-2.js b/test/baselines/externalResolve/1.5/js/test-2.js deleted file mode 100644 index 7c1f8250..00000000 --- a/test/baselines/externalResolve/1.5/js/test-2.js +++ /dev/null @@ -1,8 +0,0 @@ -/// -var other = require('./other-2'); -var someModule = require('someModule'); -var a = new other.Hello(); -console.log(a.value); -console.log(someModule); - -//# sourceMappingURL=test-2.js.map diff --git a/test/baselines/externalResolve/1.5/js/test-2.js.map b/test/baselines/externalResolve/1.5/js/test-2.js.map deleted file mode 100644 index 918b6d3f..00000000 --- a/test/baselines/externalResolve/1.5/js/test-2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-2.ts"],"names":[],"mappings":"AAAA,AACA,uCADuC;AACvC,IAAO,KAAK,WAAW,WAAW,CAAC,CAAC;AACpC,IAAO,UAAU,WAAW,YAAY,CAAC,CAAC;AAE1C,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;AAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAErB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC","file":"test-2.js","sourcesContent":["/// \nimport other = require('./other-2');\nimport someModule = require('someModule');\n\nvar a = new other.Hello();\nconsole.log(a.value);\n\nconsole.log(someModule);\n"],"sourceRoot":"../../../../externalResolve/"} \ No newline at end of file diff --git a/test/baselines/externalResolve/1.6/dts/test-2.d.ts b/test/baselines/externalResolve/1.6/dts/test-2.d.ts deleted file mode 100644 index d3fe4c35..00000000 --- a/test/baselines/externalResolve/1.6/dts/test-2.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/test/baselines/externalResolve/1.6/errors.txt b/test/baselines/externalResolve/1.6/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/externalResolve/1.6/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/externalResolve/1.6/js/test-2.js b/test/baselines/externalResolve/1.6/js/test-2.js deleted file mode 100644 index 7c1f8250..00000000 --- a/test/baselines/externalResolve/1.6/js/test-2.js +++ /dev/null @@ -1,8 +0,0 @@ -/// -var other = require('./other-2'); -var someModule = require('someModule'); -var a = new other.Hello(); -console.log(a.value); -console.log(someModule); - -//# sourceMappingURL=test-2.js.map diff --git a/test/baselines/externalResolve/1.6/js/test-2.js.map b/test/baselines/externalResolve/1.6/js/test-2.js.map deleted file mode 100644 index cd13fb16..00000000 --- a/test/baselines/externalResolve/1.6/js/test-2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-2.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,IAAO,KAAK,WAAW,WAAW,CAAC,CAAC;AACpC,IAAO,UAAU,WAAW,YAAY,CAAC,CAAC;AAE1C,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;AAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAErB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC","file":"test-2.js","sourcesContent":["/// \nimport other = require('./other-2');\nimport someModule = require('someModule');\n\nvar a = new other.Hello();\nconsole.log(a.value);\n\nconsole.log(someModule);\n"],"sourceRoot":"../../../../externalResolve/"} \ No newline at end of file diff --git a/test/baselines/externalResolve/1.7/dts/test-2.d.ts b/test/baselines/externalResolve/1.7/dts/test-2.d.ts deleted file mode 100644 index d3fe4c35..00000000 --- a/test/baselines/externalResolve/1.7/dts/test-2.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/test/baselines/externalResolve/1.7/errors.txt b/test/baselines/externalResolve/1.7/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/externalResolve/1.7/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/externalResolve/1.7/js/test-2.js b/test/baselines/externalResolve/1.7/js/test-2.js deleted file mode 100644 index 7c1f8250..00000000 --- a/test/baselines/externalResolve/1.7/js/test-2.js +++ /dev/null @@ -1,8 +0,0 @@ -/// -var other = require('./other-2'); -var someModule = require('someModule'); -var a = new other.Hello(); -console.log(a.value); -console.log(someModule); - -//# sourceMappingURL=test-2.js.map diff --git a/test/baselines/externalResolve/1.7/js/test-2.js.map b/test/baselines/externalResolve/1.7/js/test-2.js.map deleted file mode 100644 index cd13fb16..00000000 --- a/test/baselines/externalResolve/1.7/js/test-2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-2.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,IAAO,KAAK,WAAW,WAAW,CAAC,CAAC;AACpC,IAAO,UAAU,WAAW,YAAY,CAAC,CAAC;AAE1C,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;AAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAErB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC","file":"test-2.js","sourcesContent":["/// \nimport other = require('./other-2');\nimport someModule = require('someModule');\n\nvar a = new other.Hello();\nconsole.log(a.value);\n\nconsole.log(someModule);\n"],"sourceRoot":"../../../../externalResolve/"} \ No newline at end of file diff --git a/test/baselines/externalResolve/1.8/dts/test-2.d.ts b/test/baselines/externalResolve/1.8/dts/test-2.d.ts deleted file mode 100644 index d3fe4c35..00000000 --- a/test/baselines/externalResolve/1.8/dts/test-2.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/test/baselines/externalResolve/1.8/errors.txt b/test/baselines/externalResolve/1.8/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/externalResolve/1.8/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/externalResolve/1.4/dts/test-2.d.ts b/test/baselines/externalResolve/2.0/dts/test-2.d.ts similarity index 100% rename from test/baselines/externalResolve/1.4/dts/test-2.d.ts rename to test/baselines/externalResolve/2.0/dts/test-2.d.ts diff --git a/test/baselines/basic/1.7/errors.txt b/test/baselines/externalResolve/2.0/errors.txt similarity index 73% rename from test/baselines/basic/1.7/errors.txt rename to test/baselines/externalResolve/2.0/errors.txt index 566ba53f..e51d1660 100644 --- a/test/baselines/basic/1.7/errors.txt +++ b/test/baselines/externalResolve/2.0/errors.txt @@ -1,9 +1,11 @@ { "transpileErrors": 0, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 0, "semanticErrors": 0, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/externalResolve/1.8/js/test-2.js b/test/baselines/externalResolve/2.0/js/test-2.js similarity index 100% rename from test/baselines/externalResolve/1.8/js/test-2.js rename to test/baselines/externalResolve/2.0/js/test-2.js diff --git a/test/baselines/externalResolve/1.8/js/test-2.js.map b/test/baselines/externalResolve/2.0/js/test-2.js.map similarity index 100% rename from test/baselines/externalResolve/1.8/js/test-2.js.map rename to test/baselines/externalResolve/2.0/js/test-2.js.map diff --git a/test/baselines/externalResolve/dev/errors.txt b/test/baselines/externalResolve/dev/errors.txt index 566ba53f..e51d1660 100644 --- a/test/baselines/externalResolve/dev/errors.txt +++ b/test/baselines/externalResolve/dev/errors.txt @@ -1,9 +1,11 @@ { "transpileErrors": 0, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 0, "semanticErrors": 0, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/filter-referencedFrom/1.4/errors.txt b/test/baselines/filter-referencedFrom/1.4/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/filter-referencedFrom/1.4/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/filter-referencedFrom/1.4/js/concat.js b/test/baselines/filter-referencedFrom/1.4/js/concat.js deleted file mode 100644 index 90e722f1..00000000 --- a/test/baselines/filter-referencedFrom/1.4/js/concat.js +++ /dev/null @@ -1,57 +0,0 @@ -var ClassA = (function () { - function ClassA() { - } - ClassA.prototype.foo = function () { - }; - return ClassA; -})(); -var Mod; -(function (Mod) { - function foo() { - } - Mod.foo = foo; -})(Mod || (Mod = {})); - -var implicitReferenced = "Implicit Referenced"; - -var __extends = this.__extends || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - __.prototype = b.prototype; - d.prototype = new __(); -}; -/// -/// -var ClassZ = (function (_super) { - __extends(ClassZ, _super); - function ClassZ() { - _super.apply(this, arguments); - } - ClassZ.prototype.bar = function () { - }; - return ClassZ; -})(ClassA); -var Mod; -(function (Mod) { - function lorem() { - } - Mod.lorem = lorem; -})(Mod || (Mod = {})); - -/// -/// -var TestClass = (function () { - function TestClass() { - } - return TestClass; -})(); -var a = new TestClass(); -console.log(a, new ClassA(), new ClassZ()); -var Mod; -(function (Mod) { - function bar() { - } - Mod.bar = bar; -})(Mod || (Mod = {})); - -//# sourceMappingURL=concat.js.map diff --git a/test/baselines/filter-referencedFrom/1.4/js/concat.js.map b/test/baselines/filter-referencedFrom/1.4/js/concat.js.map deleted file mode 100644 index 372acc64..00000000 --- a/test/baselines/filter-referencedFrom/1.4/js/concat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["a.ts","implicitReferenced.ts","z.ts","test-1.ts"],"names":["ClassA","ClassA.constructor","ClassA.foo","Mod","Mod.foo","ClassZ","ClassZ.constructor","ClassZ.bar","Mod.lorem","TestClass","TestClass.constructor","Mod.bar"],"mappings":"AAAA,IAAM,MAAM;IAAZA,SAAMA,MAAMA;IAIZC,CAACA;IAHAD,oBAAGA,GAAHA;IAEAE,CAACA;IACFF,aAACA;AAADA,CAJA,AAICA,IAAA;AAED,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACXG,SAAgBA,GAAGA;IAAIC,CAACA;IAARD,OAAGA,GAAHA,GAAQA,CAAAA;AACzBA,CAACA,EAFM,GAAG,KAAH,GAAG,QAET;;ACRD,IAAI,kBAAkB,GAAG,qBAAqB,CAAC;;;;;;;;ACA/C,AAEA,6BAF6B;AAC7B,8CAA8C;IACxC,MAAM;IAASE,UAAfA,MAAMA,UAAeA;IAA3BA,SAAMA,MAAMA;QAASC,8BAAMA;IAI3BA,CAACA;IAHAD,oBAAGA,GAAHA;IAEAE,CAACA;IACFF,aAACA;AAADA,CAJA,AAICA,EAJoB,MAAM,EAI1B;AAED,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACXF,SAAgBA,KAAKA;IAAIK,CAACA;IAAVL,SAAKA,GAALA,KAAUA,CAAAA;AAC3BA,CAACA,EAFM,GAAG,KAAH,GAAG,QAET;;ACVD,6BAA6B;AAC7B,6BAA6B;AAE7B,IAAM,SAAS;IAAfM,SAAMA,SAASA;IAEfC,CAACA;IAADD,gBAACA;AAADA,CAFA,AAECA,IAAA;AAED,IAAI,CAAC,GAAG,IAAI,SAAS,EAAE,CAAC;AAExB,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,MAAM,EAAE,EAAE,IAAI,MAAM,EAAE,CAAC,CAAC;AAE3C,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACXN,SAAgBA,GAAGA;IAAIQ,CAACA;IAARR,OAAGA,GAAHA,GAAQA,CAAAA;AACzBA,CAACA,EAFM,GAAG,KAAH,GAAG,QAET","file":"concat.js","sourcesContent":["class ClassA {\n\tfoo() {\n\n\t}\n}\n\nmodule Mod {\n\texport function foo() {}\n}\n","var implicitReferenced = \"Implicit Referenced\";","/// \n/// \nclass ClassZ extends ClassA {\n\tbar() {\n\n\t}\n}\n\nmodule Mod {\n\texport function lorem() {}\n}\n","/// \n/// \n\nclass TestClass {\n\t\n}\n\nvar a = new TestClass();\n\nconsole.log(a, new ClassA(), new ClassZ());\n\nmodule Mod {\n\texport function bar() {}\n}\n"],"sourceRoot":"../../../../filter-referencedFrom/"} \ No newline at end of file diff --git a/test/baselines/filter-referencedFrom/1.5/errors.txt b/test/baselines/filter-referencedFrom/1.5/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/filter-referencedFrom/1.5/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/filter-referencedFrom/1.5/js/concat.js b/test/baselines/filter-referencedFrom/1.5/js/concat.js deleted file mode 100644 index 52f7e589..00000000 --- a/test/baselines/filter-referencedFrom/1.5/js/concat.js +++ /dev/null @@ -1,54 +0,0 @@ -var ClassA = (function () { - function ClassA() { - } - ClassA.prototype.foo = function () { - }; - return ClassA; -})(); -var Mod; -(function (Mod) { - function foo() { } - Mod.foo = foo; -})(Mod || (Mod = {})); - -var implicitReferenced = "Implicit Referenced"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - __.prototype = b.prototype; - d.prototype = new __(); -}; -/// -/// -var ClassZ = (function (_super) { - __extends(ClassZ, _super); - function ClassZ() { - _super.apply(this, arguments); - } - ClassZ.prototype.bar = function () { - }; - return ClassZ; -})(ClassA); -var Mod; -(function (Mod) { - function lorem() { } - Mod.lorem = lorem; -})(Mod || (Mod = {})); - -/// -/// -var TestClass = (function () { - function TestClass() { - } - return TestClass; -})(); -var a = new TestClass(); -console.log(a, new ClassA(), new ClassZ()); -var Mod; -(function (Mod) { - function bar() { } - Mod.bar = bar; -})(Mod || (Mod = {})); - -//# sourceMappingURL=concat.js.map diff --git a/test/baselines/filter-referencedFrom/1.5/js/concat.js.map b/test/baselines/filter-referencedFrom/1.5/js/concat.js.map deleted file mode 100644 index 1d8c6920..00000000 --- a/test/baselines/filter-referencedFrom/1.5/js/concat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["a.ts","implicitReferenced.ts","z.ts","test-1.ts"],"names":["ClassA","ClassA.constructor","ClassA.foo","Mod","Mod.foo","ClassZ","ClassZ.constructor","ClassZ.bar","Mod.lorem","TestClass","TestClass.constructor","Mod.bar"],"mappings":"AAAA;IAAAA;IAIAC,CAACA;IAHAD,oBAAGA,GAAHA;IAEAE,CAACA;IACFF,aAACA;AAADA,CAJA,AAICA,IAAA;AAED,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACXG,iBAAuBC,CAACA;IAARD,OAAGA,MAAKA,CAAAA;AACzBA,CAACA,EAFM,GAAG,KAAH,GAAG,QAET;;ACRD,IAAI,kBAAkB,GAAG,qBAAqB,CAAC;;;;;;;;ACA/C,AAEA,6BAF6B;AAC7B,8CAA8C;;IACzBE,0BAAMA;IAA3BA;QAAqBC,8BAAMA;IAI3BA,CAACA;IAHAD,oBAAGA,GAAHA;IAEAE,CAACA;IACFF,aAACA;AAADA,CAJA,AAICA,EAJoB,MAAM,EAI1B;AAED,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACXF,mBAAyBK,CAACA;IAAVL,SAAKA,QAAKA,CAAAA;AAC3BA,CAACA,EAFM,GAAG,KAAH,GAAG,QAET;;ACVD,6BAA6B;AAC7B,6BAA6B;AAE7B;IAAAM;IAEAC,CAACA;IAADD,gBAACA;AAADA,CAFA,AAECA,IAAA;AAED,IAAI,CAAC,GAAG,IAAI,SAAS,EAAE,CAAC;AAExB,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,MAAM,EAAE,EAAE,IAAI,MAAM,EAAE,CAAC,CAAC;AAE3C,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACXN,iBAAuBQ,CAACA;IAARR,OAAGA,MAAKA,CAAAA;AACzBA,CAACA,EAFM,GAAG,KAAH,GAAG,QAET","file":"concat.js","sourcesContent":["class ClassA {\n\tfoo() {\n\n\t}\n}\n\nmodule Mod {\n\texport function foo() {}\n}\n","var implicitReferenced = \"Implicit Referenced\";","/// \n/// \nclass ClassZ extends ClassA {\n\tbar() {\n\n\t}\n}\n\nmodule Mod {\n\texport function lorem() {}\n}\n","/// \n/// \n\nclass TestClass {\n\t\n}\n\nvar a = new TestClass();\n\nconsole.log(a, new ClassA(), new ClassZ());\n\nmodule Mod {\n\texport function bar() {}\n}\n"],"sourceRoot":"../../../../filter-referencedFrom/"} \ No newline at end of file diff --git a/test/baselines/filter-referencedFrom/1.6/errors.txt b/test/baselines/filter-referencedFrom/1.6/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/filter-referencedFrom/1.6/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/filter-referencedFrom/1.6/js/concat.js b/test/baselines/filter-referencedFrom/1.6/js/concat.js deleted file mode 100644 index dbd30004..00000000 --- a/test/baselines/filter-referencedFrom/1.6/js/concat.js +++ /dev/null @@ -1,53 +0,0 @@ -var ClassA = (function () { - function ClassA() { - } - ClassA.prototype.foo = function () { - }; - return ClassA; -})(); -var Mod; -(function (Mod) { - function foo() { } - Mod.foo = foo; -})(Mod || (Mod = {})); - -var implicitReferenced = "Implicit Referenced"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -/// -/// -var ClassZ = (function (_super) { - __extends(ClassZ, _super); - function ClassZ() { - _super.apply(this, arguments); - } - ClassZ.prototype.bar = function () { - }; - return ClassZ; -})(ClassA); -var Mod; -(function (Mod) { - function lorem() { } - Mod.lorem = lorem; -})(Mod || (Mod = {})); - -/// -/// -var TestClass = (function () { - function TestClass() { - } - return TestClass; -})(); -var a = new TestClass(); -console.log(a, new ClassA(), new ClassZ()); -var Mod; -(function (Mod) { - function bar() { } - Mod.bar = bar; -})(Mod || (Mod = {})); - -//# sourceMappingURL=concat.js.map diff --git a/test/baselines/filter-referencedFrom/1.6/js/concat.js.map b/test/baselines/filter-referencedFrom/1.6/js/concat.js.map deleted file mode 100644 index d5f5578c..00000000 --- a/test/baselines/filter-referencedFrom/1.6/js/concat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["a.ts","implicitReferenced.ts","z.ts","test-1.ts"],"names":["ClassA","ClassA.constructor","ClassA.foo","Mod","Mod.foo","ClassZ","ClassZ.constructor","ClassZ.bar","Mod.lorem","TestClass","TestClass.constructor","Mod.bar"],"mappings":"AAAA;IAAAA;IAIAC,CAACA;IAHAD,oBAAGA,GAAHA;IAEAE,CAACA;IACFF,aAACA;AAADA,CAJA,AAICA,IAAA;AAED,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACXG,iBAAuBC,CAACA;IAARD,OAAGA,MAAKA,CAAAA;AACzBA,CAACA,EAFM,GAAG,KAAH,GAAG,QAET;;ACRD,IAAI,kBAAkB,GAAG,qBAAqB,CAAC;;;;;;;ACA/C,6BAA6B;AAC7B,8CAA8C;AAC9C;IAAqBE,0BAAMA;IAA3BA;QAAqBC,8BAAMA;IAI3BA,CAACA;IAHAD,oBAAGA,GAAHA;IAEAE,CAACA;IACFF,aAACA;AAADA,CAJA,AAICA,EAJoB,MAAM,EAI1B;AAED,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACXF,mBAAyBK,CAACA;IAAVL,SAAKA,QAAKA,CAAAA;AAC3BA,CAACA,EAFM,GAAG,KAAH,GAAG,QAET;;ACVD,6BAA6B;AAC7B,6BAA6B;AAE7B;IAAAM;IAEAC,CAACA;IAADD,gBAACA;AAADA,CAFA,AAECA,IAAA;AAED,IAAI,CAAC,GAAG,IAAI,SAAS,EAAE,CAAC;AAExB,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,MAAM,EAAE,EAAE,IAAI,MAAM,EAAE,CAAC,CAAC;AAE3C,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACXN,iBAAuBQ,CAACA;IAARR,OAAGA,MAAKA,CAAAA;AACzBA,CAACA,EAFM,GAAG,KAAH,GAAG,QAET","file":"concat.js","sourcesContent":["class ClassA {\n\tfoo() {\n\n\t}\n}\n\nmodule Mod {\n\texport function foo() {}\n}\n","var implicitReferenced = \"Implicit Referenced\";","/// \n/// \nclass ClassZ extends ClassA {\n\tbar() {\n\n\t}\n}\n\nmodule Mod {\n\texport function lorem() {}\n}\n","/// \n/// \n\nclass TestClass {\n\t\n}\n\nvar a = new TestClass();\n\nconsole.log(a, new ClassA(), new ClassZ());\n\nmodule Mod {\n\texport function bar() {}\n}\n"],"sourceRoot":"../../../../filter-referencedFrom/"} \ No newline at end of file diff --git a/test/baselines/filter-referencedFrom/1.7/errors.txt b/test/baselines/filter-referencedFrom/1.7/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/filter-referencedFrom/1.7/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/filter-referencedFrom/1.7/js/concat.js b/test/baselines/filter-referencedFrom/1.7/js/concat.js deleted file mode 100644 index dbd30004..00000000 --- a/test/baselines/filter-referencedFrom/1.7/js/concat.js +++ /dev/null @@ -1,53 +0,0 @@ -var ClassA = (function () { - function ClassA() { - } - ClassA.prototype.foo = function () { - }; - return ClassA; -})(); -var Mod; -(function (Mod) { - function foo() { } - Mod.foo = foo; -})(Mod || (Mod = {})); - -var implicitReferenced = "Implicit Referenced"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -/// -/// -var ClassZ = (function (_super) { - __extends(ClassZ, _super); - function ClassZ() { - _super.apply(this, arguments); - } - ClassZ.prototype.bar = function () { - }; - return ClassZ; -})(ClassA); -var Mod; -(function (Mod) { - function lorem() { } - Mod.lorem = lorem; -})(Mod || (Mod = {})); - -/// -/// -var TestClass = (function () { - function TestClass() { - } - return TestClass; -})(); -var a = new TestClass(); -console.log(a, new ClassA(), new ClassZ()); -var Mod; -(function (Mod) { - function bar() { } - Mod.bar = bar; -})(Mod || (Mod = {})); - -//# sourceMappingURL=concat.js.map diff --git a/test/baselines/filter-referencedFrom/1.7/js/concat.js.map b/test/baselines/filter-referencedFrom/1.7/js/concat.js.map deleted file mode 100644 index d5f5578c..00000000 --- a/test/baselines/filter-referencedFrom/1.7/js/concat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["a.ts","implicitReferenced.ts","z.ts","test-1.ts"],"names":["ClassA","ClassA.constructor","ClassA.foo","Mod","Mod.foo","ClassZ","ClassZ.constructor","ClassZ.bar","Mod.lorem","TestClass","TestClass.constructor","Mod.bar"],"mappings":"AAAA;IAAAA;IAIAC,CAACA;IAHAD,oBAAGA,GAAHA;IAEAE,CAACA;IACFF,aAACA;AAADA,CAJA,AAICA,IAAA;AAED,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACXG,iBAAuBC,CAACA;IAARD,OAAGA,MAAKA,CAAAA;AACzBA,CAACA,EAFM,GAAG,KAAH,GAAG,QAET;;ACRD,IAAI,kBAAkB,GAAG,qBAAqB,CAAC;;;;;;;ACA/C,6BAA6B;AAC7B,8CAA8C;AAC9C;IAAqBE,0BAAMA;IAA3BA;QAAqBC,8BAAMA;IAI3BA,CAACA;IAHAD,oBAAGA,GAAHA;IAEAE,CAACA;IACFF,aAACA;AAADA,CAJA,AAICA,EAJoB,MAAM,EAI1B;AAED,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACXF,mBAAyBK,CAACA;IAAVL,SAAKA,QAAKA,CAAAA;AAC3BA,CAACA,EAFM,GAAG,KAAH,GAAG,QAET;;ACVD,6BAA6B;AAC7B,6BAA6B;AAE7B;IAAAM;IAEAC,CAACA;IAADD,gBAACA;AAADA,CAFA,AAECA,IAAA;AAED,IAAI,CAAC,GAAG,IAAI,SAAS,EAAE,CAAC;AAExB,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,MAAM,EAAE,EAAE,IAAI,MAAM,EAAE,CAAC,CAAC;AAE3C,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACXN,iBAAuBQ,CAACA;IAARR,OAAGA,MAAKA,CAAAA;AACzBA,CAACA,EAFM,GAAG,KAAH,GAAG,QAET","file":"concat.js","sourcesContent":["class ClassA {\n\tfoo() {\n\n\t}\n}\n\nmodule Mod {\n\texport function foo() {}\n}\n","var implicitReferenced = \"Implicit Referenced\";","/// \n/// \nclass ClassZ extends ClassA {\n\tbar() {\n\n\t}\n}\n\nmodule Mod {\n\texport function lorem() {}\n}\n","/// \n/// \n\nclass TestClass {\n\t\n}\n\nvar a = new TestClass();\n\nconsole.log(a, new ClassA(), new ClassZ());\n\nmodule Mod {\n\texport function bar() {}\n}\n"],"sourceRoot":"../../../../filter-referencedFrom/"} \ No newline at end of file diff --git a/test/baselines/filter-referencedFrom/1.8/errors.txt b/test/baselines/filter-referencedFrom/1.8/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/filter-referencedFrom/1.8/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/filter-referencedFrom/1.8/js/concat.js b/test/baselines/filter-referencedFrom/1.8/js/concat.js deleted file mode 100644 index 05f26571..00000000 --- a/test/baselines/filter-referencedFrom/1.8/js/concat.js +++ /dev/null @@ -1,53 +0,0 @@ -var ClassA = (function () { - function ClassA() { - } - ClassA.prototype.foo = function () { - }; - return ClassA; -}()); -var Mod; -(function (Mod) { - function foo() { } - Mod.foo = foo; -})(Mod || (Mod = {})); - -var implicitReferenced = "Implicit Referenced"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -/// -/// -var ClassZ = (function (_super) { - __extends(ClassZ, _super); - function ClassZ() { - _super.apply(this, arguments); - } - ClassZ.prototype.bar = function () { - }; - return ClassZ; -}(ClassA)); -var Mod; -(function (Mod) { - function lorem() { } - Mod.lorem = lorem; -})(Mod || (Mod = {})); - -/// -/// -var TestClass = (function () { - function TestClass() { - } - return TestClass; -}()); -var a = new TestClass(); -console.log(a, new ClassA(), new ClassZ()); -var Mod; -(function (Mod) { - function bar() { } - Mod.bar = bar; -})(Mod || (Mod = {})); - -//# sourceMappingURL=concat.js.map diff --git a/test/baselines/filter-referencedFrom/1.8/js/concat.js.map b/test/baselines/filter-referencedFrom/1.8/js/concat.js.map deleted file mode 100644 index 4ed12a74..00000000 --- a/test/baselines/filter-referencedFrom/1.8/js/concat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["a.ts","implicitReferenced.ts","z.ts","test-1.ts"],"names":[],"mappings":"AAAA;IAAA;IAIA,CAAC;IAHA,oBAAG,GAAH;IAEA,CAAC;IACF,aAAC;AAAD,CAJA,AAIC,IAAA;AAED,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACX,iBAAuB,CAAC;IAAR,OAAG,MAAK,CAAA;AACzB,CAAC,EAFM,GAAG,KAAH,GAAG,QAET;;ACRD,IAAI,kBAAkB,GAAG,qBAAqB,CAAC;;;;;;;ACA/C,6BAA6B;AAC7B,8CAA8C;AAC9C;IAAqB,0BAAM;IAA3B;QAAqB,8BAAM;IAI3B,CAAC;IAHA,oBAAG,GAAH;IAEA,CAAC;IACF,aAAC;AAAD,CAJA,AAIC,CAJoB,MAAM,GAI1B;AAED,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACX,mBAAyB,CAAC;IAAV,SAAK,QAAK,CAAA;AAC3B,CAAC,EAFM,GAAG,KAAH,GAAG,QAET;;ACVD,6BAA6B;AAC7B,6BAA6B;AAE7B;IAAA;IAEA,CAAC;IAAD,gBAAC;AAAD,CAFA,AAEC,IAAA;AAED,IAAI,CAAC,GAAG,IAAI,SAAS,EAAE,CAAC;AAExB,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,MAAM,EAAE,EAAE,IAAI,MAAM,EAAE,CAAC,CAAC;AAE3C,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACX,iBAAuB,CAAC;IAAR,OAAG,MAAK,CAAA;AACzB,CAAC,EAFM,GAAG,KAAH,GAAG,QAET","file":"concat.js","sourcesContent":["class ClassA {\n\tfoo() {\n\n\t}\n}\n\nmodule Mod {\n\texport function foo() {}\n}\n","var implicitReferenced = \"Implicit Referenced\";","/// \n/// \nclass ClassZ extends ClassA {\n\tbar() {\n\n\t}\n}\n\nmodule Mod {\n\texport function lorem() {}\n}\n","/// \n/// \n\nclass TestClass {\n\t\n}\n\nvar a = new TestClass();\n\nconsole.log(a, new ClassA(), new ClassZ());\n\nmodule Mod {\n\texport function bar() {}\n}\n"],"sourceRoot":"../../../../filter-referencedFrom/"} \ No newline at end of file diff --git a/test/baselines/filter-referencedFrom/dev/errors.txt b/test/baselines/filter-referencedFrom/dev/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/filter-referencedFrom/dev/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/filter-referencedFrom/dev/js/concat.js b/test/baselines/filter-referencedFrom/dev/js/concat.js deleted file mode 100644 index 05f26571..00000000 --- a/test/baselines/filter-referencedFrom/dev/js/concat.js +++ /dev/null @@ -1,53 +0,0 @@ -var ClassA = (function () { - function ClassA() { - } - ClassA.prototype.foo = function () { - }; - return ClassA; -}()); -var Mod; -(function (Mod) { - function foo() { } - Mod.foo = foo; -})(Mod || (Mod = {})); - -var implicitReferenced = "Implicit Referenced"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -/// -/// -var ClassZ = (function (_super) { - __extends(ClassZ, _super); - function ClassZ() { - _super.apply(this, arguments); - } - ClassZ.prototype.bar = function () { - }; - return ClassZ; -}(ClassA)); -var Mod; -(function (Mod) { - function lorem() { } - Mod.lorem = lorem; -})(Mod || (Mod = {})); - -/// -/// -var TestClass = (function () { - function TestClass() { - } - return TestClass; -}()); -var a = new TestClass(); -console.log(a, new ClassA(), new ClassZ()); -var Mod; -(function (Mod) { - function bar() { } - Mod.bar = bar; -})(Mod || (Mod = {})); - -//# sourceMappingURL=concat.js.map diff --git a/test/baselines/filter-referencedFrom/dev/js/concat.js.map b/test/baselines/filter-referencedFrom/dev/js/concat.js.map deleted file mode 100644 index 4ed12a74..00000000 --- a/test/baselines/filter-referencedFrom/dev/js/concat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["a.ts","implicitReferenced.ts","z.ts","test-1.ts"],"names":[],"mappings":"AAAA;IAAA;IAIA,CAAC;IAHA,oBAAG,GAAH;IAEA,CAAC;IACF,aAAC;AAAD,CAJA,AAIC,IAAA;AAED,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACX,iBAAuB,CAAC;IAAR,OAAG,MAAK,CAAA;AACzB,CAAC,EAFM,GAAG,KAAH,GAAG,QAET;;ACRD,IAAI,kBAAkB,GAAG,qBAAqB,CAAC;;;;;;;ACA/C,6BAA6B;AAC7B,8CAA8C;AAC9C;IAAqB,0BAAM;IAA3B;QAAqB,8BAAM;IAI3B,CAAC;IAHA,oBAAG,GAAH;IAEA,CAAC;IACF,aAAC;AAAD,CAJA,AAIC,CAJoB,MAAM,GAI1B;AAED,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACX,mBAAyB,CAAC;IAAV,SAAK,QAAK,CAAA;AAC3B,CAAC,EAFM,GAAG,KAAH,GAAG,QAET;;ACVD,6BAA6B;AAC7B,6BAA6B;AAE7B;IAAA;IAEA,CAAC;IAAD,gBAAC;AAAD,CAFA,AAEC,IAAA;AAED,IAAI,CAAC,GAAG,IAAI,SAAS,EAAE,CAAC;AAExB,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,MAAM,EAAE,EAAE,IAAI,MAAM,EAAE,CAAC,CAAC;AAE3C,IAAO,GAAG,CAET;AAFD,WAAO,GAAG,EAAC,CAAC;IACX,iBAAuB,CAAC;IAAR,OAAG,MAAK,CAAA;AACzB,CAAC,EAFM,GAAG,KAAH,GAAG,QAET","file":"concat.js","sourcesContent":["class ClassA {\n\tfoo() {\n\n\t}\n}\n\nmodule Mod {\n\texport function foo() {}\n}\n","var implicitReferenced = \"Implicit Referenced\";","/// \n/// \nclass ClassZ extends ClassA {\n\tbar() {\n\n\t}\n}\n\nmodule Mod {\n\texport function lorem() {}\n}\n","/// \n/// \n\nclass TestClass {\n\t\n}\n\nvar a = new TestClass();\n\nconsole.log(a, new ClassA(), new ClassZ());\n\nmodule Mod {\n\texport function bar() {}\n}\n"],"sourceRoot":"../../../../filter-referencedFrom/"} \ No newline at end of file diff --git a/test/baselines/isolatedModules/1.4/errors.txt b/test/baselines/isolatedModules/1.4/errors.txt deleted file mode 100644 index 2047e515..00000000 --- a/test/baselines/isolatedModules/1.4/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -TypeScript error: test/isolatedModules/test-3.ts(2,1): error TS1128: Declaration or statement expected. -{ - "transpileErrors": 0, - "syntaxErrors": 1, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": true -} \ No newline at end of file diff --git a/test/baselines/isolatedModules/1.5/errors.txt b/test/baselines/isolatedModules/1.5/errors.txt deleted file mode 100644 index eb4e56a0..00000000 --- a/test/baselines/isolatedModules/1.5/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -TypeScript error: test/isolatedModules/test-3.ts(2,1): error TS1128: Declaration or statement expected. -{ - "transpileErrors": 1, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/isolatedModules/1.5/js/other-3.js b/test/baselines/isolatedModules/1.5/js/other-3.js deleted file mode 100644 index a3026c7b..00000000 --- a/test/baselines/isolatedModules/1.5/js/other-3.js +++ /dev/null @@ -1,9 +0,0 @@ -define(["require", "exports"], function (require, exports) { - var Hello = (function () { - function Hello() { - } - return Hello; - })(); - exports.Hello = Hello; -}); -//# sourceMappingURL=other-3.js.map diff --git a/test/baselines/isolatedModules/1.5/js/other-3.js.map b/test/baselines/isolatedModules/1.5/js/other-3.js.map deleted file mode 100644 index a865fac9..00000000 --- a/test/baselines/isolatedModules/1.5/js/other-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["other-3.ts"],"names":["Hello","Hello.constructor"],"mappings":";IAAA;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAFA,AAECA,IAAA;IAFY,aAAK,QAEjB,CAAA","file":"other-3.js","sourcesContent":["export class Hello {\n\tvalue: string;\n}"],"sourceRoot":"../../../../isolatedModules/"} \ No newline at end of file diff --git a/test/baselines/isolatedModules/1.5/js/test-3.js b/test/baselines/isolatedModules/1.5/js/test-3.js deleted file mode 100644 index c2a68080..00000000 --- a/test/baselines/isolatedModules/1.5/js/test-3.js +++ /dev/null @@ -1,5 +0,0 @@ -define(["require", "exports", './other-3'], function (require, exports, other) { - var a = new other.Hello(); - console.log(a.value); -}); -//# sourceMappingURL=test-3.js.map diff --git a/test/baselines/isolatedModules/1.5/js/test-3.js.map b/test/baselines/isolatedModules/1.5/js/test-3.js.map deleted file mode 100644 index e03f294d..00000000 --- a/test/baselines/isolatedModules/1.5/js/test-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-3.ts"],"names":[],"mappings":";IAEA,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC","file":"test-3.js","sourcesContent":["import other = require('./other-3');\n. // Syntax error\nvar a = new other.Hello();\nconsole.log(a.value);"],"sourceRoot":"../../../../isolatedModules/"} \ No newline at end of file diff --git a/test/baselines/isolatedModules/1.6/errors.txt b/test/baselines/isolatedModules/1.6/errors.txt deleted file mode 100644 index eb4e56a0..00000000 --- a/test/baselines/isolatedModules/1.6/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -TypeScript error: test/isolatedModules/test-3.ts(2,1): error TS1128: Declaration or statement expected. -{ - "transpileErrors": 1, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/isolatedModules/1.6/js/other-3.js b/test/baselines/isolatedModules/1.6/js/other-3.js deleted file mode 100644 index a3026c7b..00000000 --- a/test/baselines/isolatedModules/1.6/js/other-3.js +++ /dev/null @@ -1,9 +0,0 @@ -define(["require", "exports"], function (require, exports) { - var Hello = (function () { - function Hello() { - } - return Hello; - })(); - exports.Hello = Hello; -}); -//# sourceMappingURL=other-3.js.map diff --git a/test/baselines/isolatedModules/1.6/js/other-3.js.map b/test/baselines/isolatedModules/1.6/js/other-3.js.map deleted file mode 100644 index a865fac9..00000000 --- a/test/baselines/isolatedModules/1.6/js/other-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["other-3.ts"],"names":["Hello","Hello.constructor"],"mappings":";IAAA;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAFA,AAECA,IAAA;IAFY,aAAK,QAEjB,CAAA","file":"other-3.js","sourcesContent":["export class Hello {\n\tvalue: string;\n}"],"sourceRoot":"../../../../isolatedModules/"} \ No newline at end of file diff --git a/test/baselines/isolatedModules/1.6/js/test-3.js b/test/baselines/isolatedModules/1.6/js/test-3.js deleted file mode 100644 index c2a68080..00000000 --- a/test/baselines/isolatedModules/1.6/js/test-3.js +++ /dev/null @@ -1,5 +0,0 @@ -define(["require", "exports", './other-3'], function (require, exports, other) { - var a = new other.Hello(); - console.log(a.value); -}); -//# sourceMappingURL=test-3.js.map diff --git a/test/baselines/isolatedModules/1.6/js/test-3.js.map b/test/baselines/isolatedModules/1.6/js/test-3.js.map deleted file mode 100644 index e03f294d..00000000 --- a/test/baselines/isolatedModules/1.6/js/test-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-3.ts"],"names":[],"mappings":";IAEA,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC","file":"test-3.js","sourcesContent":["import other = require('./other-3');\n. // Syntax error\nvar a = new other.Hello();\nconsole.log(a.value);"],"sourceRoot":"../../../../isolatedModules/"} \ No newline at end of file diff --git a/test/baselines/isolatedModules/1.7/errors.txt b/test/baselines/isolatedModules/1.7/errors.txt deleted file mode 100644 index eb4e56a0..00000000 --- a/test/baselines/isolatedModules/1.7/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -TypeScript error: test/isolatedModules/test-3.ts(2,1): error TS1128: Declaration or statement expected. -{ - "transpileErrors": 1, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/isolatedModules/1.7/js/other-3.js b/test/baselines/isolatedModules/1.7/js/other-3.js deleted file mode 100644 index a3026c7b..00000000 --- a/test/baselines/isolatedModules/1.7/js/other-3.js +++ /dev/null @@ -1,9 +0,0 @@ -define(["require", "exports"], function (require, exports) { - var Hello = (function () { - function Hello() { - } - return Hello; - })(); - exports.Hello = Hello; -}); -//# sourceMappingURL=other-3.js.map diff --git a/test/baselines/isolatedModules/1.7/js/other-3.js.map b/test/baselines/isolatedModules/1.7/js/other-3.js.map deleted file mode 100644 index a865fac9..00000000 --- a/test/baselines/isolatedModules/1.7/js/other-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["other-3.ts"],"names":["Hello","Hello.constructor"],"mappings":";IAAA;QAAAA;QAEAC,CAACA;QAADD,YAACA;IAADA,CAFA,AAECA,IAAA;IAFY,aAAK,QAEjB,CAAA","file":"other-3.js","sourcesContent":["export class Hello {\n\tvalue: string;\n}"],"sourceRoot":"../../../../isolatedModules/"} \ No newline at end of file diff --git a/test/baselines/isolatedModules/1.7/js/test-3.js b/test/baselines/isolatedModules/1.7/js/test-3.js deleted file mode 100644 index c2a68080..00000000 --- a/test/baselines/isolatedModules/1.7/js/test-3.js +++ /dev/null @@ -1,5 +0,0 @@ -define(["require", "exports", './other-3'], function (require, exports, other) { - var a = new other.Hello(); - console.log(a.value); -}); -//# sourceMappingURL=test-3.js.map diff --git a/test/baselines/isolatedModules/1.7/js/test-3.js.map b/test/baselines/isolatedModules/1.7/js/test-3.js.map deleted file mode 100644 index e03f294d..00000000 --- a/test/baselines/isolatedModules/1.7/js/test-3.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["test-3.ts"],"names":[],"mappings":";IAEA,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC","file":"test-3.js","sourcesContent":["import other = require('./other-3');\n. // Syntax error\nvar a = new other.Hello();\nconsole.log(a.value);"],"sourceRoot":"../../../../isolatedModules/"} \ No newline at end of file diff --git a/test/baselines/isolatedModules/1.8/errors.txt b/test/baselines/isolatedModules/2.0/errors.txt similarity index 83% rename from test/baselines/isolatedModules/1.8/errors.txt rename to test/baselines/isolatedModules/2.0/errors.txt index eb4e56a0..3d6e1f78 100644 --- a/test/baselines/isolatedModules/1.8/errors.txt +++ b/test/baselines/isolatedModules/2.0/errors.txt @@ -1,9 +1,11 @@ TypeScript error: test/isolatedModules/test-3.ts(2,1): error TS1128: Declaration or statement expected. { "transpileErrors": 1, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 0, "semanticErrors": 0, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/isolatedModules/1.8/js/other-3.js b/test/baselines/isolatedModules/2.0/js/other-3.js similarity index 100% rename from test/baselines/isolatedModules/1.8/js/other-3.js rename to test/baselines/isolatedModules/2.0/js/other-3.js diff --git a/test/baselines/isolatedModules/1.8/js/other-3.js.map b/test/baselines/isolatedModules/2.0/js/other-3.js.map similarity index 100% rename from test/baselines/isolatedModules/1.8/js/other-3.js.map rename to test/baselines/isolatedModules/2.0/js/other-3.js.map diff --git a/test/baselines/isolatedModules/1.8/js/test-3.js b/test/baselines/isolatedModules/2.0/js/test-3.js similarity index 100% rename from test/baselines/isolatedModules/1.8/js/test-3.js rename to test/baselines/isolatedModules/2.0/js/test-3.js diff --git a/test/baselines/isolatedModules/1.8/js/test-3.js.map b/test/baselines/isolatedModules/2.0/js/test-3.js.map similarity index 100% rename from test/baselines/isolatedModules/1.8/js/test-3.js.map rename to test/baselines/isolatedModules/2.0/js/test-3.js.map diff --git a/test/baselines/isolatedModules/dev/errors.txt b/test/baselines/isolatedModules/dev/errors.txt index eb4e56a0..3d6e1f78 100644 --- a/test/baselines/isolatedModules/dev/errors.txt +++ b/test/baselines/isolatedModules/dev/errors.txt @@ -1,9 +1,11 @@ TypeScript error: test/isolatedModules/test-3.ts(2,1): error TS1128: Declaration or statement expected. { "transpileErrors": 1, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 0, "semanticErrors": 0, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/out/1.4/errors.txt b/test/baselines/out/1.4/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/out/1.4/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/out/1.4/js/concat.js b/test/baselines/out/1.4/js/concat.js deleted file mode 100644 index a1d5e711..00000000 --- a/test/baselines/out/1.4/js/concat.js +++ /dev/null @@ -1,10 +0,0 @@ -var Hello = (function () { - function Hello() { - } - return Hello; -})(); -var a = new Hello(); -console.log(a.value); -var b; // Target = ES6, so lib.es6.d.ts should be included. - -//# sourceMappingURL=concat.js.map diff --git a/test/baselines/out/1.4/js/concat.js.map b/test/baselines/out/1.4/js/concat.js.map deleted file mode 100644 index c87934d1..00000000 --- a/test/baselines/out/1.4/js/concat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["bar.ts","foo.ts"],"names":["Hello","Hello.constructor"],"mappings":"AAAA,IAAM,KAAK;IAAXA,SAAMA,KAAKA;IAEXC,CAACA;IAADD,YAACA;AAADA,CAFA,AAECA,IAAA;ACFD,IAAI,CAAC,GAAG,IAAI,KAAK,EAAE,CAAC;AACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAErB,IAAI,CAAS,EAAE,oDAAD,AAAqD","file":"concat.js","sourcesContent":["class Hello {\n\tvalue: string;\n}","var a = new Hello();\nconsole.log(a.value);\n\nvar b: Symbol; // Target = ES6, so lib.es6.d.ts should be included."],"sourceRoot":"../../../../out/"} \ No newline at end of file diff --git a/test/baselines/out/1.5/dts/concat.d.ts b/test/baselines/out/1.5/dts/concat.d.ts deleted file mode 100644 index e978dc48..00000000 --- a/test/baselines/out/1.5/dts/concat.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare class Hello { - value: string; -} -declare var a: Hello; -declare var b: Symbol; diff --git a/test/baselines/out/1.5/errors.txt b/test/baselines/out/1.5/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/out/1.5/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/out/1.5/js/concat.js.map b/test/baselines/out/1.5/js/concat.js.map deleted file mode 100644 index 364f8eec..00000000 --- a/test/baselines/out/1.5/js/concat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["bar.ts","foo.ts"],"names":["Hello"],"mappings":"AAAA;AAEAA,CAACA;ACFD,IAAI,CAAC,GAAG,IAAI,KAAK,EAAE,CAAC;AACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAErB,IAAI,CAAS,EAAE,oDAAD,AAAqD","file":"concat.js","sourcesContent":["class Hello {\n\tvalue: string;\n}","var a = new Hello();\nconsole.log(a.value);\n\nvar b: Symbol; // Target = ES6, so lib.es6.d.ts should be included."],"sourceRoot":"../../../../out/"} \ No newline at end of file diff --git a/test/baselines/out/1.6/dts/concat.d.ts b/test/baselines/out/1.6/dts/concat.d.ts deleted file mode 100644 index e978dc48..00000000 --- a/test/baselines/out/1.6/dts/concat.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare class Hello { - value: string; -} -declare var a: Hello; -declare var b: Symbol; diff --git a/test/baselines/out/1.6/errors.txt b/test/baselines/out/1.6/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/out/1.6/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/out/1.6/js/concat.js b/test/baselines/out/1.6/js/concat.js deleted file mode 100644 index 2ac2ca92..00000000 --- a/test/baselines/out/1.6/js/concat.js +++ /dev/null @@ -1,7 +0,0 @@ -class Hello { -} -var a = new Hello(); -console.log(a.value); -var b; // Target = ES6, so lib.es6.d.ts should be included. - -//# sourceMappingURL=concat.js.map diff --git a/test/baselines/out/1.6/js/concat.js.map b/test/baselines/out/1.6/js/concat.js.map deleted file mode 100644 index 5ab591df..00000000 --- a/test/baselines/out/1.6/js/concat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["bar.ts","foo.ts"],"names":["Hello"],"mappings":"AAAA;AAEAA,CAACA;ACFD,IAAI,CAAC,GAAG,IAAI,KAAK,EAAE,CAAC;AACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAErB,IAAI,CAAS,CAAC,CAAC,oDAAoD","file":"concat.js","sourcesContent":["class Hello {\n\tvalue: string;\n}","var a = new Hello();\nconsole.log(a.value);\n\nvar b: Symbol; // Target = ES6, so lib.es6.d.ts should be included."],"sourceRoot":"../../../../out/"} \ No newline at end of file diff --git a/test/baselines/out/1.7/dts/concat.d.ts b/test/baselines/out/1.7/dts/concat.d.ts deleted file mode 100644 index e978dc48..00000000 --- a/test/baselines/out/1.7/dts/concat.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare class Hello { - value: string; -} -declare var a: Hello; -declare var b: Symbol; diff --git a/test/baselines/out/1.7/errors.txt b/test/baselines/out/1.7/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/out/1.7/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/out/1.7/js/concat.js b/test/baselines/out/1.7/js/concat.js deleted file mode 100644 index 2ac2ca92..00000000 --- a/test/baselines/out/1.7/js/concat.js +++ /dev/null @@ -1,7 +0,0 @@ -class Hello { -} -var a = new Hello(); -console.log(a.value); -var b; // Target = ES6, so lib.es6.d.ts should be included. - -//# sourceMappingURL=concat.js.map diff --git a/test/baselines/out/1.7/js/concat.js.map b/test/baselines/out/1.7/js/concat.js.map deleted file mode 100644 index 5ab591df..00000000 --- a/test/baselines/out/1.7/js/concat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["bar.ts","foo.ts"],"names":["Hello"],"mappings":"AAAA;AAEAA,CAACA;ACFD,IAAI,CAAC,GAAG,IAAI,KAAK,EAAE,CAAC;AACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAErB,IAAI,CAAS,CAAC,CAAC,oDAAoD","file":"concat.js","sourcesContent":["class Hello {\n\tvalue: string;\n}","var a = new Hello();\nconsole.log(a.value);\n\nvar b: Symbol; // Target = ES6, so lib.es6.d.ts should be included."],"sourceRoot":"../../../../out/"} \ No newline at end of file diff --git a/test/baselines/out/1.8/dts/concat.d.ts b/test/baselines/out/1.8/dts/concat.d.ts deleted file mode 100644 index e978dc48..00000000 --- a/test/baselines/out/1.8/dts/concat.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare class Hello { - value: string; -} -declare var a: Hello; -declare var b: Symbol; diff --git a/test/baselines/out/1.8/errors.txt b/test/baselines/out/1.8/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/out/1.8/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/out/1.8/js/concat.js b/test/baselines/out/1.8/js/concat.js deleted file mode 100644 index 2ac2ca92..00000000 --- a/test/baselines/out/1.8/js/concat.js +++ /dev/null @@ -1,7 +0,0 @@ -class Hello { -} -var a = new Hello(); -console.log(a.value); -var b; // Target = ES6, so lib.es6.d.ts should be included. - -//# sourceMappingURL=concat.js.map diff --git a/test/baselines/out/1.8/js/concat.js.map b/test/baselines/out/1.8/js/concat.js.map deleted file mode 100644 index 9ec46ef0..00000000 --- a/test/baselines/out/1.8/js/concat.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["bar.ts","foo.ts"],"names":[],"mappings":"AAAA;AAEA,CAAC;ACFD,IAAI,CAAC,GAAG,IAAI,KAAK,EAAE,CAAC;AACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAErB,IAAI,CAAS,CAAC,CAAC,oDAAoD","file":"concat.js","sourcesContent":["class Hello {\n\tvalue: string;\n}","var a = new Hello();\nconsole.log(a.value);\n\nvar b: Symbol; // Target = ES6, so lib.es6.d.ts should be included."],"sourceRoot":"../../../../out/"} \ No newline at end of file diff --git a/test/baselines/out/1.4/dts/concat.d.ts b/test/baselines/out/2.0/dts/concat.d.ts similarity index 100% rename from test/baselines/out/1.4/dts/concat.d.ts rename to test/baselines/out/2.0/dts/concat.d.ts diff --git a/test/baselines/basic/1.5/errors.txt b/test/baselines/out/2.0/errors.txt similarity index 73% rename from test/baselines/basic/1.5/errors.txt rename to test/baselines/out/2.0/errors.txt index 566ba53f..e51d1660 100644 --- a/test/baselines/basic/1.5/errors.txt +++ b/test/baselines/out/2.0/errors.txt @@ -1,9 +1,11 @@ { "transpileErrors": 0, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 0, "semanticErrors": 0, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/out/1.5/js/concat.js b/test/baselines/out/2.0/js/concat.js similarity index 100% rename from test/baselines/out/1.5/js/concat.js rename to test/baselines/out/2.0/js/concat.js diff --git a/test/baselines/out/2.0/js/concat.js.map b/test/baselines/out/2.0/js/concat.js.map new file mode 100644 index 00000000..26f94053 --- /dev/null +++ b/test/baselines/out/2.0/js/concat.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["test/out/bar.ts","test/out/foo.ts"],"names":[],"mappings":"AAAA;AAEA,CAAC;ACFD,IAAI,CAAC,GAAG,IAAI,KAAK,EAAE,CAAC;AACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAErB,IAAI,CAAS,CAAC,CAAC,oDAAoD","file":"concat.js","sourcesContent":["class Hello {\n\tvalue: string;\n}","var a = new Hello();\nconsole.log(a.value);\n\nvar b: Symbol; // Target = ES6, so lib.es6.d.ts should be included."],"sourceRoot":"../../../../out/"} \ No newline at end of file diff --git a/test/baselines/out/dev/errors.txt b/test/baselines/out/dev/errors.txt index 566ba53f..e51d1660 100644 --- a/test/baselines/out/dev/errors.txt +++ b/test/baselines/out/dev/errors.txt @@ -1,9 +1,11 @@ { "transpileErrors": 0, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 0, "semanticErrors": 0, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/baselines/out/dev/js/concat.js.map b/test/baselines/out/dev/js/concat.js.map index 9ec46ef0..26f94053 100644 --- a/test/baselines/out/dev/js/concat.js.map +++ b/test/baselines/out/dev/js/concat.js.map @@ -1 +1 @@ -{"version":3,"sources":["bar.ts","foo.ts"],"names":[],"mappings":"AAAA;AAEA,CAAC;ACFD,IAAI,CAAC,GAAG,IAAI,KAAK,EAAE,CAAC;AACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAErB,IAAI,CAAS,CAAC,CAAC,oDAAoD","file":"concat.js","sourcesContent":["class Hello {\n\tvalue: string;\n}","var a = new Hello();\nconsole.log(a.value);\n\nvar b: Symbol; // Target = ES6, so lib.es6.d.ts should be included."],"sourceRoot":"../../../../out/"} \ No newline at end of file +{"version":3,"sources":["test/out/bar.ts","test/out/foo.ts"],"names":[],"mappings":"AAAA;AAEA,CAAC;ACFD,IAAI,CAAC,GAAG,IAAI,KAAK,EAAE,CAAC;AACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAErB,IAAI,CAAS,CAAC,CAAC,oDAAoD","file":"concat.js","sourcesContent":["class Hello {\n\tvalue: string;\n}","var a = new Hello();\nconsole.log(a.value);\n\nvar b: Symbol; // Target = ES6, so lib.es6.d.ts should be included."],"sourceRoot":"../../../../out/"} \ No newline at end of file diff --git a/test/baselines/sourceMaps/1.4/errors.txt b/test/baselines/sourceMaps/1.4/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/sourceMaps/1.4/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/sourceMaps/1.4/js/Main/MainFile.js b/test/baselines/sourceMaps/1.4/js/Main/MainFile.js deleted file mode 100644 index 1097fc5a..00000000 --- a/test/baselines/sourceMaps/1.4/js/Main/MainFile.js +++ /dev/null @@ -1,6 +0,0 @@ -var foo = { - bar: 42 -}; -console.log(foo.bar); - -//# sourceMappingURL=MainFile.js.map diff --git a/test/baselines/sourceMaps/1.4/js/Main/MainFile.js.map b/test/baselines/sourceMaps/1.4/js/Main/MainFile.js.map deleted file mode 100644 index 479f710d..00000000 --- a/test/baselines/sourceMaps/1.4/js/Main/MainFile.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["MainFile.ts"],"names":[],"mappings":"AAEA,IAAI,GAAG,GAAS;IACZ,GAAG,EAAE,EAAE;CACV,CAAC;AAEF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"MainFile.js","sourcesContent":["import IFoo = require(\"../Outer/Foo\");\n\nvar foo: IFoo = {\n bar: 42\n};\n\nconsole.log(foo.bar);"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/test/baselines/sourceMaps/1.5/errors.txt b/test/baselines/sourceMaps/1.5/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/sourceMaps/1.5/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/sourceMaps/1.5/js/Main/MainFile.js b/test/baselines/sourceMaps/1.5/js/Main/MainFile.js deleted file mode 100644 index 1097fc5a..00000000 --- a/test/baselines/sourceMaps/1.5/js/Main/MainFile.js +++ /dev/null @@ -1,6 +0,0 @@ -var foo = { - bar: 42 -}; -console.log(foo.bar); - -//# sourceMappingURL=MainFile.js.map diff --git a/test/baselines/sourceMaps/1.5/js/Main/MainFile.js.map b/test/baselines/sourceMaps/1.5/js/Main/MainFile.js.map deleted file mode 100644 index 479f710d..00000000 --- a/test/baselines/sourceMaps/1.5/js/Main/MainFile.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["MainFile.ts"],"names":[],"mappings":"AAEA,IAAI,GAAG,GAAS;IACZ,GAAG,EAAE,EAAE;CACV,CAAC;AAEF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"MainFile.js","sourcesContent":["import IFoo = require(\"../Outer/Foo\");\n\nvar foo: IFoo = {\n bar: 42\n};\n\nconsole.log(foo.bar);"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/test/baselines/sourceMaps/1.6/errors.txt b/test/baselines/sourceMaps/1.6/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/sourceMaps/1.6/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/sourceMaps/1.6/js/Main/MainFile.js b/test/baselines/sourceMaps/1.6/js/Main/MainFile.js deleted file mode 100644 index 1097fc5a..00000000 --- a/test/baselines/sourceMaps/1.6/js/Main/MainFile.js +++ /dev/null @@ -1,6 +0,0 @@ -var foo = { - bar: 42 -}; -console.log(foo.bar); - -//# sourceMappingURL=MainFile.js.map diff --git a/test/baselines/sourceMaps/1.6/js/Main/MainFile.js.map b/test/baselines/sourceMaps/1.6/js/Main/MainFile.js.map deleted file mode 100644 index 479f710d..00000000 --- a/test/baselines/sourceMaps/1.6/js/Main/MainFile.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["MainFile.ts"],"names":[],"mappings":"AAEA,IAAI,GAAG,GAAS;IACZ,GAAG,EAAE,EAAE;CACV,CAAC;AAEF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"MainFile.js","sourcesContent":["import IFoo = require(\"../Outer/Foo\");\n\nvar foo: IFoo = {\n bar: 42\n};\n\nconsole.log(foo.bar);"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/test/baselines/sourceMaps/1.6/js/Main/MainFileTsx.js b/test/baselines/sourceMaps/1.6/js/Main/MainFileTsx.js deleted file mode 100644 index f2b8ce87..00000000 --- a/test/baselines/sourceMaps/1.6/js/Main/MainFileTsx.js +++ /dev/null @@ -1,6 +0,0 @@ -var foo = { - bar: 42 -}; -console.log(foo.bar); - -//# sourceMappingURL=MainFileTsx.js.map diff --git a/test/baselines/sourceMaps/1.6/js/Main/MainFileTsx.js.map b/test/baselines/sourceMaps/1.6/js/Main/MainFileTsx.js.map deleted file mode 100644 index 3659c38d..00000000 --- a/test/baselines/sourceMaps/1.6/js/Main/MainFileTsx.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["MainFileTsx.tsx"],"names":[],"mappings":"AAEA,IAAI,GAAG,GAAS;IACZ,GAAG,EAAE,EAAE;CACV,CAAC;AAEF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"MainFileTsx.js","sourcesContent":["import IFoo = require(\"../Outer/Foo\");\n\nvar foo: IFoo = {\n bar: 42\n};\n\nconsole.log(foo.bar);\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/test/baselines/sourceMaps/1.7/errors.txt b/test/baselines/sourceMaps/1.7/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/sourceMaps/1.7/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/sourceMaps/1.7/js/Main/MainFile.js b/test/baselines/sourceMaps/1.7/js/Main/MainFile.js deleted file mode 100644 index 1097fc5a..00000000 --- a/test/baselines/sourceMaps/1.7/js/Main/MainFile.js +++ /dev/null @@ -1,6 +0,0 @@ -var foo = { - bar: 42 -}; -console.log(foo.bar); - -//# sourceMappingURL=MainFile.js.map diff --git a/test/baselines/sourceMaps/1.7/js/Main/MainFile.js.map b/test/baselines/sourceMaps/1.7/js/Main/MainFile.js.map deleted file mode 100644 index 479f710d..00000000 --- a/test/baselines/sourceMaps/1.7/js/Main/MainFile.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["MainFile.ts"],"names":[],"mappings":"AAEA,IAAI,GAAG,GAAS;IACZ,GAAG,EAAE,EAAE;CACV,CAAC;AAEF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"MainFile.js","sourcesContent":["import IFoo = require(\"../Outer/Foo\");\n\nvar foo: IFoo = {\n bar: 42\n};\n\nconsole.log(foo.bar);"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/test/baselines/sourceMaps/1.7/js/Main/MainFileTsx.js b/test/baselines/sourceMaps/1.7/js/Main/MainFileTsx.js deleted file mode 100644 index f2b8ce87..00000000 --- a/test/baselines/sourceMaps/1.7/js/Main/MainFileTsx.js +++ /dev/null @@ -1,6 +0,0 @@ -var foo = { - bar: 42 -}; -console.log(foo.bar); - -//# sourceMappingURL=MainFileTsx.js.map diff --git a/test/baselines/sourceMaps/1.7/js/Main/MainFileTsx.js.map b/test/baselines/sourceMaps/1.7/js/Main/MainFileTsx.js.map deleted file mode 100644 index 3659c38d..00000000 --- a/test/baselines/sourceMaps/1.7/js/Main/MainFileTsx.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["MainFileTsx.tsx"],"names":[],"mappings":"AAEA,IAAI,GAAG,GAAS;IACZ,GAAG,EAAE,EAAE;CACV,CAAC;AAEF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"MainFileTsx.js","sourcesContent":["import IFoo = require(\"../Outer/Foo\");\n\nvar foo: IFoo = {\n bar: 42\n};\n\nconsole.log(foo.bar);\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/test/baselines/sourceMaps/1.8/errors.txt b/test/baselines/sourceMaps/1.8/errors.txt deleted file mode 100644 index 566ba53f..00000000 --- a/test/baselines/sourceMaps/1.8/errors.txt +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "transpileErrors": 0, - "syntaxErrors": 0, - "globalErrors": 0, - "semanticErrors": 0, - "emitErrors": 0, - "emitSkipped": false -} \ No newline at end of file diff --git a/test/baselines/sourceMaps/2.0/errors.txt b/test/baselines/sourceMaps/2.0/errors.txt new file mode 100644 index 00000000..e51d1660 --- /dev/null +++ b/test/baselines/sourceMaps/2.0/errors.txt @@ -0,0 +1,11 @@ + +{ + "transpileErrors": 0, + "optionsErrors": 0, + "syntaxErrors": 0, + "globalErrors": 0, + "semanticErrors": 0, + "declarationErrors": 0, + "emitErrors": 0, + "emitSkipped": false +} \ No newline at end of file diff --git a/test/baselines/sourceMaps/1.8/js/Main/MainFile.js b/test/baselines/sourceMaps/2.0/js/Main/MainFile.js similarity index 100% rename from test/baselines/sourceMaps/1.8/js/Main/MainFile.js rename to test/baselines/sourceMaps/2.0/js/Main/MainFile.js diff --git a/test/baselines/sourceMaps/1.8/js/Main/MainFile.js.map b/test/baselines/sourceMaps/2.0/js/Main/MainFile.js.map similarity index 100% rename from test/baselines/sourceMaps/1.8/js/Main/MainFile.js.map rename to test/baselines/sourceMaps/2.0/js/Main/MainFile.js.map diff --git a/test/baselines/sourceMaps/1.8/js/Main/MainFileTsx.js b/test/baselines/sourceMaps/2.0/js/Main/MainFileTsx.js similarity index 100% rename from test/baselines/sourceMaps/1.8/js/Main/MainFileTsx.js rename to test/baselines/sourceMaps/2.0/js/Main/MainFileTsx.js diff --git a/test/baselines/sourceMaps/1.8/js/Main/MainFileTsx.js.map b/test/baselines/sourceMaps/2.0/js/Main/MainFileTsx.js.map similarity index 100% rename from test/baselines/sourceMaps/1.8/js/Main/MainFileTsx.js.map rename to test/baselines/sourceMaps/2.0/js/Main/MainFileTsx.js.map diff --git a/test/baselines/sourceMaps/dev/errors.txt b/test/baselines/sourceMaps/dev/errors.txt index 566ba53f..e51d1660 100644 --- a/test/baselines/sourceMaps/dev/errors.txt +++ b/test/baselines/sourceMaps/dev/errors.txt @@ -1,9 +1,11 @@ { "transpileErrors": 0, + "optionsErrors": 0, "syntaxErrors": 0, "globalErrors": 0, "semanticErrors": 0, + "declarationErrors": 0, "emitErrors": 0, "emitSkipped": false } \ No newline at end of file diff --git a/test/basic/gulptask.js b/test/basic/gulptask.js index a26a2a1b..355d82fc 100644 --- a/test/basic/gulptask.js +++ b/test/basic/gulptask.js @@ -3,14 +3,12 @@ var sourcemaps = require('gulp-sourcemaps'); module.exports = function(newTS, lib, output, reporter) { var tsProject = newTS.createProject('test/basic/tsconfig.json', { - noExternalResolve: true, typescript: lib, - outDir: output + 'js' }); var tsResult = tsProject.src() .pipe(sourcemaps.init()) - .pipe(newTS(tsProject, undefined, reporter)); + .pipe(tsProject(reporter)); tsResult.dts.pipe(gulp.dest(output + '/dts')); return tsResult.js diff --git a/test/basic/tsconfig.json b/test/basic/tsconfig.json index 99c344db..9ed99ee8 100644 --- a/test/basic/tsconfig.json +++ b/test/basic/tsconfig.json @@ -1,7 +1,9 @@ { "compilerOptions": { "declaration": true, - "module": "amd" + "module": "amd", + "outDir": "js", + "declarationDir": "dts" }, "files": [ "test-3.ts", diff --git a/test/bom/gulptask.js b/test/bom/gulptask.js index d0655243..2c3d393e 100644 --- a/test/bom/gulptask.js +++ b/test/bom/gulptask.js @@ -2,10 +2,10 @@ var gulp = require('gulp'); var sourcemaps = require('gulp-sourcemaps'); module.exports = function(newTS, lib, output, reporter) { - var tsProject = newTS.createProject('test/bom/tsconfig.json'); + var tsProject = newTS.createProject('test/bom/tsconfig.json', { typescript: lib }); var tsResult = tsProject.src() - .pipe(newTS(tsProject, undefined, reporter)); + .pipe(tsProject(reporter)); tsResult.dts.pipe(gulp.dest(output + '/dts')); return tsResult.js diff --git a/test/errorReporting/gulptask.js b/test/errorReporting/gulptask.js index 4f3a8a48..d560e285 100644 --- a/test/errorReporting/gulptask.js +++ b/test/errorReporting/gulptask.js @@ -5,7 +5,7 @@ module.exports = function(newTS, lib, output, reporter) { var errors = 0; var tsResult = gulp.src('test/errorReporting/*.ts') .pipe(sourcemaps.init()) - .pipe(newTS({ typescript: lib }, undefined, reporter)); + .pipe(newTS({ typescript: lib }, reporter)); tsResult.dts.pipe(gulp.dest(output + 'dts')); return tsResult.js diff --git a/test/externalResolve/gulptask.js b/test/externalResolve/gulptask.js index 022b5248..82e42b77 100644 --- a/test/externalResolve/gulptask.js +++ b/test/externalResolve/gulptask.js @@ -8,7 +8,7 @@ module.exports = function(newTS, lib, output, reporter) { declarationFiles: true, module: 'commonjs', typescript: lib - }, undefined, reporter)); + }, reporter)); tsResult.dts.pipe(gulp.dest(output + 'dts')); return tsResult.js diff --git a/test/filter-referencedFrom/a.ts b/test/filter-referencedFrom/a.ts deleted file mode 100644 index 540cd768..00000000 --- a/test/filter-referencedFrom/a.ts +++ /dev/null @@ -1,9 +0,0 @@ -class ClassA { - foo() { - - } -} - -module Mod { - export function foo() {} -} diff --git a/test/filter-referencedFrom/gulptask.js b/test/filter-referencedFrom/gulptask.js deleted file mode 100644 index 19f10ba5..00000000 --- a/test/filter-referencedFrom/gulptask.js +++ /dev/null @@ -1,20 +0,0 @@ -var gulp = require('gulp'); -var sourcemaps = require('gulp-sourcemaps'); -var concat = require('gulp-concat'); - -module.exports = function(newTS, lib, output, reporter) { - var project = newTS.createProject({ - declarationFiles: true, - noExternalResolve: true, - sortOutput: true, - typescript: lib - }); - - return gulp.src('test/filter-referencedFrom/**.ts') - .pipe(sourcemaps.init()) - .pipe(newTS(project, undefined, reporter)) - .pipe(newTS.filter(project, { referencedFrom: ['test-1.ts'] })) - .pipe(concat('concat.js')) - .pipe(sourcemaps.write('.', { sourceRoot: '../../../../filter-referencedFrom/' })) - .pipe(gulp.dest(output + 'js')); -} diff --git a/test/filter-referencedFrom/implicitReferenced.ts b/test/filter-referencedFrom/implicitReferenced.ts deleted file mode 100644 index 2bb39d5b..00000000 --- a/test/filter-referencedFrom/implicitReferenced.ts +++ /dev/null @@ -1 +0,0 @@ -var implicitReferenced = "Implicit Referenced"; \ No newline at end of file diff --git a/test/filter-referencedFrom/notReferenced.ts b/test/filter-referencedFrom/notReferenced.ts deleted file mode 100644 index 46fb1d62..00000000 --- a/test/filter-referencedFrom/notReferenced.ts +++ /dev/null @@ -1 +0,0 @@ -var notReferenced = "Not Referenced"; \ No newline at end of file diff --git a/test/filter-referencedFrom/test-1.ts b/test/filter-referencedFrom/test-1.ts deleted file mode 100644 index 602d49cd..00000000 --- a/test/filter-referencedFrom/test-1.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// -/// - -class TestClass { - -} - -var a = new TestClass(); - -console.log(a, new ClassA(), new ClassZ()); - -module Mod { - export function bar() {} -} diff --git a/test/filter-referencedFrom/z.ts b/test/filter-referencedFrom/z.ts deleted file mode 100644 index 29ddad80..00000000 --- a/test/filter-referencedFrom/z.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// -/// -class ClassZ extends ClassA { - bar() { - - } -} - -module Mod { - export function lorem() {} -} diff --git a/test/isolatedModules/gulptask.js b/test/isolatedModules/gulptask.js index feec2fbd..4572cdda 100644 --- a/test/isolatedModules/gulptask.js +++ b/test/isolatedModules/gulptask.js @@ -10,7 +10,7 @@ module.exports = function(newTS, lib, output, reporter) { var tsResult = tsProject.src() .pipe(plumber()) .pipe(sourcemaps.init()) - .pipe(newTS(tsProject, undefined, reporter)); + .pipe(tsProject(reporter)); tsResult.dts.pipe(gulp.dest(output + '/dts')); return tsResult.js diff --git a/test/out/gulptask.js b/test/out/gulptask.js index 51f9aa30..6557de0d 100644 --- a/test/out/gulptask.js +++ b/test/out/gulptask.js @@ -9,7 +9,7 @@ module.exports = function(newTS, lib, output, reporter) { out: 'concat.js', typescript: lib, target: 'es6' - }, undefined, reporter)); + }, reporter)); tsResult.dts.pipe(gulp.dest(output + '/dts')); return tsResult.js .pipe(sourcemaps.write('.', { sourceRoot: '../../../../out/' })) diff --git a/test/sourceMaps/gulptask.js b/test/sourceMaps/gulptask.js index 313ceaac..a1559a0e 100644 --- a/test/sourceMaps/gulptask.js +++ b/test/sourceMaps/gulptask.js @@ -8,7 +8,7 @@ module.exports = function(newTS, lib, output, reporter) { return project.src() .pipe(sourcemaps.init()) - .pipe(newTS(project, undefined, reporter)).js + .pipe(project(reporter)).js .pipe(sourcemaps.write(".")) .pipe(gulp.dest(output + "js/Main")); } diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 120934fa..00000000 --- a/tsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "files": [ - "lib/main.ts", - "typings/tsd.d.ts" - ], - "compilerOptions": { - "target": "ES5", - "moduleResolution": "node", - "module": "commonjs" - } -} diff --git a/typescript/dev b/typescript/dev index 19aac12b..95c3eccb 160000 --- a/typescript/dev +++ b/typescript/dev @@ -1 +1 @@ -Subproject commit 19aac12be9e73851dee3db4263105beaec20c14a +Subproject commit 95c3eccbe9f3f7e1857ce157d437e6b80b3c9c6f