@angular/tsc-wrapped
Advanced tools
Comparing version 5.0.0-beta.4 to 5.0.0-beta.5
{ | ||
"name": "@angular/tsc-wrapped", | ||
"version": "5.0.0-beta.4", | ||
"version": "5.0.0-beta.5", | ||
"description": "Wraps the tsc CLI, allowing extensions.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/angular/angular/blob/master/packages/tsc-wrapped", |
@@ -254,3 +254,5 @@ "use strict"; | ||
}; | ||
var isExported = function (node) { return isExport(node) || isExportedIdentifier(node.name); }; | ||
var isExported = function (node) { | ||
return isExport(node) || isExportedIdentifier(node.name); | ||
}; | ||
var exportedIdentifierName = function (identifier) { | ||
@@ -346,10 +348,21 @@ return identifier && (exportMap.get(identifier.text) || identifier.text); | ||
break; | ||
case ts.SyntaxKind.TypeAliasDeclaration: | ||
var typeDeclaration = node; | ||
if (typeDeclaration.name && isExported(typeDeclaration)) { | ||
var name_5 = exportedName(typeDeclaration); | ||
if (name_5) { | ||
if (!metadata) | ||
metadata = {}; | ||
metadata[name_5] = { __symbolic: 'interface' }; | ||
} | ||
} | ||
break; | ||
case ts.SyntaxKind.InterfaceDeclaration: | ||
var interfaceDeclaration = node; | ||
if (interfaceDeclaration.name && isExported(interfaceDeclaration)) { | ||
var name_5 = exportedName(interfaceDeclaration); | ||
if (name_5) { | ||
var name_6 = exportedName(interfaceDeclaration); | ||
if (name_6) { | ||
if (!metadata) | ||
metadata = {}; | ||
metadata[name_5] = { __symbolic: 'interface' }; | ||
metadata[name_6] = { __symbolic: 'interface' }; | ||
} | ||
@@ -363,8 +376,8 @@ } | ||
if (isExported(functionDeclaration) && functionDeclaration.name) { | ||
var name_6 = exportedName(functionDeclaration); | ||
var name_7 = exportedName(functionDeclaration); | ||
var maybeFunc = maybeGetSimpleFunction(functionDeclaration); | ||
if (name_6) { | ||
if (name_7) { | ||
if (!metadata) | ||
metadata = {}; | ||
metadata[name_6] = | ||
metadata[name_7] = | ||
maybeFunc ? recordEntry(maybeFunc.func, node) : { __symbolic: 'function' }; | ||
@@ -390,7 +403,7 @@ } | ||
} | ||
var name_7 = undefined; | ||
var name_8 = undefined; | ||
if (member.name.kind == ts.SyntaxKind.Identifier) { | ||
var identifier = member.name; | ||
name_7 = identifier.text; | ||
enumValueHolder[name_7] = enumValue; | ||
name_8 = identifier.text; | ||
enumValueHolder[name_8] = enumValue; | ||
writtenMembers++; | ||
@@ -401,3 +414,3 @@ } | ||
} | ||
else if (name_7) { | ||
else if (name_8) { | ||
nextDefaultValue = { | ||
@@ -408,3 +421,3 @@ __symbolic: 'binary', | ||
__symbolic: 'select', | ||
expression: recordEntry({ __symbolic: 'reference', name: enumName }, node), name: name_7 | ||
expression: recordEntry({ __symbolic: 'reference', name: enumName }, node), name: name_8 | ||
} | ||
@@ -442,7 +455,7 @@ }; | ||
isExportedIdentifier(nameNode)) { | ||
var name_8 = exportedIdentifierName(nameNode); | ||
if (name_8) { | ||
var name_9 = exportedIdentifierName(nameNode); | ||
if (name_9) { | ||
if (!metadata) | ||
metadata = {}; | ||
metadata[name_8] = recordEntry(varValue, node); | ||
metadata[name_9] = recordEntry(varValue, node); | ||
} | ||
@@ -476,9 +489,9 @@ exported = true; | ||
case ts.SyntaxKind.Identifier: | ||
var name_9 = nameNode; | ||
var varValue = errorSym('Destructuring not supported', name_9); | ||
locals.define(name_9.text, varValue); | ||
var name_10 = nameNode; | ||
var varValue = errorSym('Destructuring not supported', name_10); | ||
locals.define(name_10.text, varValue); | ||
if (isExport(node)) { | ||
if (!metadata) | ||
metadata = {}; | ||
metadata[name_9.text] = varValue; | ||
metadata[name_10.text] = varValue; | ||
} | ||
@@ -685,5 +698,5 @@ break; | ||
var element = _a[_i]; | ||
var name_10 = element.name; | ||
if (name_10) { | ||
addNamesOf(name_10); | ||
var name_11 = element.name; | ||
if (name_11) { | ||
addNamesOf(name_11); | ||
} | ||
@@ -690,0 +703,0 @@ } |
@@ -21,8 +21,7 @@ /** | ||
trace?: boolean; | ||
/** @deprecated since v4 this option has no effect anymore. */ | ||
debug?: boolean; | ||
enableLegacyTemplate?: boolean; | ||
enableSummariesForJit?: boolean; | ||
alwaysCompileGeneratedCode?: boolean; | ||
preserveWhitespaces?: boolean; | ||
} | ||
export default Options; |
@@ -35,2 +35,3 @@ "use strict"; | ||
'exported-enum.ts', | ||
'exported-type.ts', | ||
'exported-consts.ts', | ||
@@ -65,2 +66,7 @@ 'local-symbol-ref.ts', | ||
}); | ||
it('should return an interface reference for types', function () { | ||
var sourceFile = program.getSourceFile('/exported-type.ts'); | ||
var metadata = collector.getMetadata(sourceFile); | ||
expect(metadata).toEqual({ __symbolic: 'module', version: 3, metadata: { SomeType: { __symbolic: 'interface' } } }); | ||
}); | ||
it('should return an interface reference for interfaces', function () { | ||
@@ -793,3 +799,3 @@ var sourceFile = program.getSourceFile('app/hero.ts'); | ||
it('should be able to substitute a lambda', function () { | ||
var source = createSource("\n const b = 1;\n export const a = () => b; \n "); | ||
var source = createSource("\n const b = 1;\n export const a = () => b;\n "); | ||
var metadata = collector.getMetadata(source, /* strict */ false, function (value, node) { | ||
@@ -810,3 +816,3 @@ if (node.kind === ts.SyntaxKind.ArrowFunction) { | ||
}); | ||
var source = createSource("\n const b = 1;\n export const a = () => b; \n "); | ||
var source = createSource("\n const b = 1;\n export const a = () => b;\n "); | ||
var metadata = collector.getMetadata(source, /* strict */ false, function (value, node) { | ||
@@ -863,2 +869,3 @@ if (node.kind === ts.SyntaxKind.ArrowFunction) { | ||
'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-type.ts': "\n export type SomeType = 'a' | 'b';\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 ", | ||
@@ -865,0 +872,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
687156
5390