@angular/tsc-wrapped
Advanced tools
Comparing version 0.4.0 to 0.4.1
{ | ||
"name": "@angular/tsc-wrapped", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Wraps the tsc CLI, allowing extensions.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/angular/angular/tree/master/tools/tsc-wrapped", |
@@ -241,7 +241,10 @@ /** | ||
if (node.flags & ts.NodeFlags.Export) { | ||
if (!metadata) | ||
metadata = {}; | ||
if (classDeclaration.decorators) { | ||
if (!metadata) | ||
metadata = {}; | ||
metadata[className] = classMetadataOf(classDeclaration); | ||
} | ||
else { | ||
metadata[className] = { __symbolic: 'class' }; | ||
} | ||
} | ||
@@ -256,8 +259,13 @@ } | ||
if (node.flags & ts.NodeFlags.Export) { | ||
if (!metadata) | ||
metadata = {}; | ||
var maybeFunc = maybeGetSimpleFunction(functionDeclaration); | ||
if (maybeFunc) { | ||
if (!metadata) | ||
metadata = {}; | ||
metadata[maybeFunc.name] = recordEntry(maybeFunc.func, node); | ||
} | ||
else if (functionDeclaration.name.kind == ts.SyntaxKind.Identifier) { | ||
var nameNode = functionDeclaration.name; | ||
var functionName = nameNode.text; | ||
metadata[functionName] = { __symbolic: 'function' }; | ||
} | ||
} | ||
@@ -264,0 +272,0 @@ break; |
@@ -15,3 +15,3 @@ /** | ||
// can accurately represent the metadata, generate both version 1 and version 2 in an array. | ||
exports.VERSION = 1; | ||
exports.VERSION = 2; | ||
function isModuleMetadata(value) { | ||
@@ -18,0 +18,0 @@ return value && value.__symbolic === 'module'; |
@@ -27,2 +27,3 @@ /** | ||
'import-star.ts', | ||
'exported-classes.ts', | ||
'exported-functions.ts', | ||
@@ -58,3 +59,3 @@ 'exported-enum.ts', | ||
__symbolic: 'module', | ||
version: 1, | ||
version: 2, | ||
metadata: { | ||
@@ -89,3 +90,3 @@ HeroDetailComponent: { | ||
__symbolic: 'module', | ||
version: 1, | ||
version: 2, | ||
metadata: { | ||
@@ -133,3 +134,3 @@ AppComponent: { | ||
__symbolic: 'module', | ||
version: 1, | ||
version: 2, | ||
metadata: { | ||
@@ -146,8 +147,2 @@ HEROES: [ | ||
}); | ||
it('should return undefined for modules that have no metadata', function () { | ||
var sourceFile = program.getSourceFile('/app/error-cases.ts'); | ||
expect(sourceFile).toBeTruthy(sourceFile); | ||
var metadata = collector.getMetadata(sourceFile); | ||
expect(metadata).toBeUndefined(); | ||
}); | ||
var casesFile; | ||
@@ -208,3 +203,3 @@ var casesMetadata; | ||
__symbolic: 'module', | ||
version: 1, | ||
version: 2, | ||
metadata: { | ||
@@ -243,2 +238,15 @@ a: { __symbolic: 'error', message: 'Destructuring not supported', line: 1, character: 16 }, | ||
}); | ||
it('should record all exported classes', function () { | ||
var sourceFile = program.getSourceFile('/exported-classes.ts'); | ||
var metadata = collector.getMetadata(sourceFile); | ||
expect(metadata).toEqual({ | ||
__symbolic: 'module', | ||
version: 2, | ||
metadata: { | ||
SimpleClass: { __symbolic: 'class' }, | ||
AbstractClass: { __symbolic: 'class' }, | ||
DeclaredClass: { __symbolic: 'class' } | ||
} | ||
}); | ||
}); | ||
it('should be able to record functions', function () { | ||
@@ -249,3 +257,3 @@ var exportedFunctions = program.getSourceFile('/exported-functions.ts'); | ||
__symbolic: 'module', | ||
version: 1, | ||
version: 2, | ||
metadata: { | ||
@@ -298,3 +306,5 @@ one: { | ||
} | ||
} | ||
}, | ||
complexFn: { __symbolic: 'function' }, | ||
declaredFn: { __symbolic: 'function' } | ||
} | ||
@@ -587,3 +597,4 @@ }); | ||
'import-star.ts': "\n import {Injectable} from 'angular2/core';\n import * as common from 'angular2/common';\n\n @Injectable()\n export class SomeClass {\n constructor(private f: common.NgFor) {}\n }\n ", | ||
'exported-functions.ts': "\n export function one(a: string, b: string, c: string) {\n return {a: a, b: b, c: c};\n }\n export function two(a: string, b: string, c: string) {\n return {a, b, c};\n }\n export function three({a, b, c}: {a: string, b: string, c: string}) {\n return [a, b, c];\n }\n export function supportsState(): boolean {\n return !!window.history.pushState;\n }\n ", | ||
'exported-classes.ts': "\n export class SimpleClass {}\n export abstract class AbstractClass {}\n export declare class DeclaredClass {}\n ", | ||
'exported-functions.ts': "\n export function one(a: string, b: string, c: string) {\n return {a: a, b: b, c: c};\n }\n export function two(a: string, b: string, c: string) {\n return {a, b, c};\n }\n export function three({a, b, c}: {a: string, b: string, c: string}) {\n return [a, b, c];\n }\n export function supportsState(): boolean {\n return !!window.history.pushState;\n }\n export function complexFn(x: any): boolean {\n if (x) {\n return true;\n } else {\n return false;\n }\n }\n export declare function declaredFn();\n ", | ||
'exported-enum.ts': "\n import {constValue} from './exported-consts';\n\n export const someValue = 30;\n export enum SomeEnum { A, B, C = 100, D };\n export enum ComplexEnum { A, B, C = someValue, D = someValue + 10, E = constValue };\n ", | ||
@@ -590,0 +601,0 @@ 'exported-consts.ts': "\n export const constValue = 100;\n ", |
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
422255
3354