typescript.api
Advanced tools
Comparing version 0.2.1 to 0.2.2
{ | ||
"name": "typescript.api", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "A compiler as a service api enabling nodejs developers to resolve, compile, reflect and run typescript 0.9 source files.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -137,3 +137,4 @@ declare module TypeScript.Api.Units { | ||
public ast: AST; | ||
constructor(path: string, content: string, diagnostics: Diagnostic[], ast: AST); | ||
public declaration: string; | ||
constructor(path: string, content: string, diagnostics: Diagnostic[], ast: AST, declaration: string); | ||
} | ||
@@ -140,0 +141,0 @@ } |
@@ -539,5 +539,6 @@ var TypeScript; | ||
__extends(CompiledUnit, _super); | ||
function CompiledUnit(path, content, diagnostics, ast) { | ||
function CompiledUnit(path, content, diagnostics, ast, declaration) { | ||
_super.call(this, path, content, diagnostics); | ||
this.ast = ast; | ||
this.declaration = declaration; | ||
} | ||
@@ -593,2 +594,3 @@ return CompiledUnit; | ||
settings.disallowBool = true; | ||
settings.generateDeclarationFiles = true; | ||
this.compiler = new TypeScript.TypeScriptCompiler(new TypeScript.Api.Loggers.NullLogger(), settings, TypeScript.diagnosticMessages); | ||
@@ -674,2 +676,3 @@ this.compiler.logger = new TypeScript.Api.Loggers.NullLogger(); | ||
}); | ||
this.compiler.emitAllDeclarations(); | ||
var result = []; | ||
@@ -686,7 +689,17 @@ for(var file in emitter.files) { | ||
if (sourceUnit) { | ||
var path = sourceUnit.path; | ||
var path = sourceUnit.path.replace(/\\/g, '/'); | ||
var content = emitter.files[file].toString(); | ||
var diagnostics = sourceUnit.diagnostics; | ||
var ast = document.script; | ||
result.push(new TypeScript.Api.Units.CompiledUnit(path, content, diagnostics, ast)); | ||
var declaration = ''; | ||
for(var decl in emitter.files) { | ||
if (decl.indexOf('.d.ts') != -1) { | ||
var comparer = decl.replace(/\\/g, '/').replace('.d.ts', '.ts'); | ||
if (path == comparer) { | ||
declaration = emitter.files[decl].toString(); | ||
break; | ||
} | ||
} | ||
} | ||
result.push(new TypeScript.Api.Units.CompiledUnit(path, content, diagnostics, ast, declaration)); | ||
} | ||
@@ -693,0 +706,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
2848671
55596