@angular/tsc-wrapped
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
export { MetadataWriterHost, TsickleHost } from './src/compiler_host'; | ||
@@ -2,0 +9,0 @@ export { CodegenExtension, main } from './src/main'; |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
"use strict"; | ||
@@ -2,0 +9,0 @@ function __export(m) { |
{ | ||
"name": "@angular/tsc-wrapped", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Wraps the tsc CLI, allowing extensions.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/angular/angular/tree/master/tools/tsc-wrapped", |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
import * as ts from 'typescript'; | ||
@@ -2,0 +9,0 @@ import { ModuleMetadata } from './schema'; |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
"use strict"; | ||
@@ -186,9 +193,11 @@ var ts = require('typescript'); | ||
var classDeclaration = node; | ||
var className = classDeclaration.name.text; | ||
if (node.flags & ts.NodeFlags.Export) { | ||
locals.define(className, { __symbolic: 'reference', name: className }); | ||
if (classDeclaration.name) { | ||
var className = classDeclaration.name.text; | ||
if (node.flags & ts.NodeFlags.Export) { | ||
locals.define(className, { __symbolic: 'reference', name: className }); | ||
} | ||
else { | ||
locals.define(className, errorSym('Reference to non-exported class', node, { className: className })); | ||
} | ||
} | ||
else { | ||
locals.define(className, errorSym('Reference to non-exported class', node, { className: className })); | ||
} | ||
break; | ||
@@ -200,3 +209,5 @@ case ts.SyntaxKind.FunctionDeclaration: | ||
var nameNode = functionDeclaration.name; | ||
locals.define(nameNode.text, errorSym('Reference to a non-exported function', nameNode, { name: nameNode.text })); | ||
if (nameNode && nameNode.text) { | ||
locals.define(nameNode.text, errorSym('Reference to a non-exported function', nameNode, { name: nameNode.text })); | ||
} | ||
} | ||
@@ -229,8 +240,10 @@ break; | ||
var classDeclaration = node; | ||
var className = classDeclaration.name.text; | ||
if (node.flags & ts.NodeFlags.Export) { | ||
if (classDeclaration.decorators) { | ||
if (!metadata) | ||
metadata = {}; | ||
metadata[className] = classMetadataOf(classDeclaration); | ||
if (classDeclaration.name) { | ||
var className = classDeclaration.name.text; | ||
if (node.flags & ts.NodeFlags.Export) { | ||
if (classDeclaration.decorators) { | ||
if (!metadata) | ||
metadata = {}; | ||
metadata[className] = classMetadataOf(classDeclaration); | ||
} | ||
} | ||
@@ -237,0 +250,0 @@ } |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
"use strict"; | ||
@@ -2,0 +9,0 @@ var __extends = (this && this.__extends) || function (d, b) { |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
import * as ts from 'typescript'; | ||
@@ -2,0 +9,0 @@ import { MetadataEntry, MetadataError, MetadataValue } from './schema'; |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
"use strict"; | ||
@@ -2,0 +9,0 @@ var ts = require('typescript'); |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
"use strict"; | ||
@@ -2,0 +9,0 @@ var fs = require('fs'); |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
import * as ts from 'typescript'; | ||
@@ -2,0 +9,0 @@ interface Options extends ts.CompilerOptions { |
@@ -0,2 +1,9 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
"use strict"; | ||
//# sourceMappingURL=options.js.map |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
export declare const VERSION: number; | ||
@@ -2,0 +9,0 @@ export declare type MetadataEntry = ClassMetadata | FunctionMetadata | MetadataValue; |
@@ -0,3 +1,10 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
"use strict"; | ||
// Metadata Schema | ||
"use strict"; | ||
// If you make a backwards incompatible change to the schema, increment the VERSION number. | ||
@@ -4,0 +11,0 @@ // If you make a backwards compatible change to the metadata (such as adding an option field) then |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
import * as ts from 'typescript'; | ||
@@ -2,0 +9,0 @@ import { MetadataValue } from './schema'; |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
"use strict"; | ||
@@ -2,0 +9,0 @@ var ts = require('typescript'); |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
"use strict"; | ||
@@ -2,0 +9,0 @@ var fs_1 = require('fs'); |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
"use strict"; | ||
@@ -527,2 +534,21 @@ var ts = require('typescript'); | ||
}); | ||
describe('with invalid input', function () { | ||
it('should not throw with a class with no name', function () { | ||
var fileName = '/invalid-class.ts'; | ||
override(fileName, 'export class'); | ||
var invalidClass = program.getSourceFile(fileName); | ||
expect(function () { return collector.getMetadata(invalidClass); }).not.toThrow(); | ||
}); | ||
it('should not throw with a function with no name', function () { | ||
var fileName = '/invalid-function.ts'; | ||
override(fileName, 'export function'); | ||
var invalidFunction = program.getSourceFile(fileName); | ||
expect(function () { return collector.getMetadata(invalidFunction); }).not.toThrow(); | ||
}); | ||
}); | ||
function override(fileName, content) { | ||
host.overrideFile(fileName, content); | ||
host.addFile(fileName); | ||
program = service.getProgram(); | ||
} | ||
}); | ||
@@ -529,0 +555,0 @@ // TODO: Do not use \` in a template literal as it confuses clang-format |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
"use strict"; | ||
@@ -2,0 +9,0 @@ var ts = require('typescript'); |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
"use strict"; | ||
@@ -2,0 +9,0 @@ var ts = require('typescript'); |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
"use strict"; | ||
@@ -2,0 +9,0 @@ var ts = require('typescript'); |
@@ -8,2 +8,4 @@ import * as ts from 'typescript'; | ||
private scripts; | ||
private overrides; | ||
private version; | ||
constructor(directory: Directory, scripts: string[]); | ||
@@ -16,2 +18,4 @@ getCompilationSettings(): ts.CompilerOptions; | ||
getDefaultLibFileName(options: ts.CompilerOptions): string; | ||
overrideFile(fileName: string, content: string): void; | ||
addFile(fileName: string): void; | ||
private getFileContent(fileName); | ||
@@ -18,0 +22,0 @@ } |
@@ -13,2 +13,4 @@ "use strict"; | ||
this.scripts = scripts; | ||
this.overrides = new Map(); | ||
this.version = 1; | ||
} | ||
@@ -23,3 +25,3 @@ Host.prototype.getCompilationSettings = function () { | ||
Host.prototype.getScriptFileNames = function () { return this.scripts; }; | ||
Host.prototype.getScriptVersion = function (fileName) { return '1'; }; | ||
Host.prototype.getScriptVersion = function (fileName) { return this.version.toString(); }; | ||
Host.prototype.getScriptSnapshot = function (fileName) { | ||
@@ -32,3 +34,14 @@ var content = this.getFileContent(fileName); | ||
Host.prototype.getDefaultLibFileName = function (options) { return 'lib.d.ts'; }; | ||
Host.prototype.overrideFile = function (fileName, content) { | ||
this.overrides.set(fileName, content); | ||
this.version++; | ||
}; | ||
Host.prototype.addFile = function (fileName) { | ||
this.scripts.push(fileName); | ||
this.version++; | ||
}; | ||
Host.prototype.getFileContent = function (fileName) { | ||
if (this.overrides.has(fileName)) { | ||
return this.overrides.get(fileName); | ||
} | ||
var names = fileName.split('/'); | ||
@@ -35,0 +48,0 @@ if (names[names.length - 1] === 'lib.d.ts') { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
419527
3335