chore: clang-format master
This commit is contained in:
parent
9485f5a813
commit
0297398f5e
@ -55,8 +55,7 @@ export class AttrAst implements TemplateAst {
|
|||||||
* A binding for an element property (e.g. `[property]="expression"`).
|
* A binding for an element property (e.g. `[property]="expression"`).
|
||||||
*/
|
*/
|
||||||
export class BoundElementPropertyAst implements TemplateAst {
|
export class BoundElementPropertyAst implements TemplateAst {
|
||||||
constructor(
|
constructor(public name: string, public type: PropertyBindingType,
|
||||||
public name: string, public type: PropertyBindingType,
|
|
||||||
public securityContext: SecurityContext, public value: AST, public unit: string,
|
public securityContext: SecurityContext, public value: AST, public unit: string,
|
||||||
public sourceSpan: ParseSourceSpan) {}
|
public sourceSpan: ParseSourceSpan) {}
|
||||||
visit(visitor: TemplateAstVisitor, context: any): any {
|
visit(visitor: TemplateAstVisitor, context: any): any {
|
||||||
|
@ -131,7 +131,8 @@ function bindAndWriteToRenderer(boundProps: BoundElementPropertyAst[], context:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function sanitizedValue(boundProp: BoundElementPropertyAst, renderValue: o.Expression): o.Expression {
|
function sanitizedValue(boundProp: BoundElementPropertyAst,
|
||||||
|
renderValue: o.Expression): o.Expression {
|
||||||
let enumValue: string;
|
let enumValue: string;
|
||||||
switch (boundProp.securityContext) {
|
switch (boundProp.securityContext) {
|
||||||
case SecurityContext.NONE:
|
case SecurityContext.NONE:
|
||||||
|
@ -57,9 +57,8 @@ export function main() {
|
|||||||
expect(registry.getMappedPropName('exotic-unknown')).toEqual('exotic-unknown');
|
expect(registry.getMappedPropName('exotic-unknown')).toEqual('exotic-unknown');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return security contexts for elements', () => {
|
it('should return security contexts for elements',
|
||||||
expect(registry.securityContext('a', 'href')).toBe(SecurityContext.URL);
|
() => { expect(registry.securityContext('a', 'href')).toBe(SecurityContext.URL); });
|
||||||
});
|
|
||||||
|
|
||||||
it('should detect properties on namespaced elements',
|
it('should detect properties on namespaced elements',
|
||||||
() => { expect(registry.hasProperty('@svg:g', 'id')).toBeTruthy(); });
|
() => { expect(registry.hasProperty('@svg:g', 'id')).toBeTruthy(); });
|
||||||
|
@ -8,9 +8,17 @@ import * as path from 'path';
|
|||||||
import * as compiler from '@angular/compiler';
|
import * as compiler from '@angular/compiler';
|
||||||
import {ViewEncapsulation} from '@angular/core';
|
import {ViewEncapsulation} from '@angular/core';
|
||||||
import {StaticReflector} from './static_reflector';
|
import {StaticReflector} from './static_reflector';
|
||||||
import {CompileMetadataResolver, HtmlParser, DirectiveNormalizer, Lexer, Parser,
|
import {
|
||||||
TemplateParser, DomElementSchemaRegistry, StyleCompiler,
|
CompileMetadataResolver,
|
||||||
ViewCompiler, TypeScriptEmitter
|
HtmlParser,
|
||||||
|
DirectiveNormalizer,
|
||||||
|
Lexer,
|
||||||
|
Parser,
|
||||||
|
TemplateParser,
|
||||||
|
DomElementSchemaRegistry,
|
||||||
|
StyleCompiler,
|
||||||
|
ViewCompiler,
|
||||||
|
TypeScriptEmitter
|
||||||
} from './compiler_private';
|
} from './compiler_private';
|
||||||
|
|
||||||
import {Parse5DomAdapter} from '@angular/platform-server';
|
import {Parse5DomAdapter} from '@angular/platform-server';
|
||||||
@ -96,8 +104,7 @@ export class CodeGenerator {
|
|||||||
let root = this.ngOptions.basePath;
|
let root = this.ngOptions.basePath;
|
||||||
for (let eachRootDir of this.options.rootDirs || []) {
|
for (let eachRootDir of this.options.rootDirs || []) {
|
||||||
if (this.ngOptions.trace) {
|
if (this.ngOptions.trace) {
|
||||||
console.log(
|
console.log(`Check if ${filePath} is under rootDirs element ${eachRootDir}`);
|
||||||
`Check if ${filePath} is under rootDirs element ${eachRootDir}`);
|
|
||||||
}
|
}
|
||||||
if (path.relative(eachRootDir, filePath).indexOf('.') !== 0) {
|
if (path.relative(eachRootDir, filePath).indexOf('.') !== 0) {
|
||||||
root = eachRootDir;
|
root = eachRootDir;
|
||||||
@ -170,7 +177,7 @@ export class CodeGenerator {
|
|||||||
new compiler.DirectiveResolver(staticReflector), new compiler.PipeResolver(staticReflector),
|
new compiler.DirectiveResolver(staticReflector), new compiler.PipeResolver(staticReflector),
|
||||||
new compiler.ViewResolver(staticReflector), null, null, staticReflector);
|
new compiler.ViewResolver(staticReflector), null, null, staticReflector);
|
||||||
|
|
||||||
return new CodeGenerator(options, ngOptions, program, compilerHost,
|
return new CodeGenerator(options, ngOptions, program, compilerHost, staticReflector, resolver,
|
||||||
staticReflector, resolver, offlineCompiler, reflectorHost);
|
offlineCompiler, reflectorHost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@ export type TemplateParser = _c.TemplateParser;
|
|||||||
export var TemplateParser: typeof _c.TemplateParser = _c.TemplateParser;
|
export var TemplateParser: typeof _c.TemplateParser = _c.TemplateParser;
|
||||||
|
|
||||||
export type DomElementSchemaRegistry = _c.DomElementSchemaRegistry;
|
export type DomElementSchemaRegistry = _c.DomElementSchemaRegistry;
|
||||||
export var DomElementSchemaRegistry: typeof _c.DomElementSchemaRegistry = _c.DomElementSchemaRegistry;
|
export var DomElementSchemaRegistry: typeof _c.DomElementSchemaRegistry =
|
||||||
|
_c.DomElementSchemaRegistry;
|
||||||
|
|
||||||
export type StyleCompiler = _c.StyleCompiler;
|
export type StyleCompiler = _c.StyleCompiler;
|
||||||
export var StyleCompiler: typeof _c.StyleCompiler = _c.StyleCompiler;
|
export var StyleCompiler: typeof _c.StyleCompiler = _c.StyleCompiler;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin / env node
|
||||||
|
|
||||||
// Must be imported first, because angular2 decorators throws on load.
|
// Must be imported first, because angular2 decorators throws on load.
|
||||||
import 'reflect-metadata';
|
import 'reflect-metadata';
|
||||||
|
@ -125,7 +125,7 @@ export class StaticReflector implements ReflectorReader {
|
|||||||
let parameterDecorators = <any[]>this.simplify(type, ctor['parameterDecorators']);
|
let parameterDecorators = <any[]>this.simplify(type, ctor['parameterDecorators']);
|
||||||
|
|
||||||
parameters = [];
|
parameters = [];
|
||||||
parameterTypes.forEach( (paramType, index) => {
|
parameterTypes.forEach((paramType, index) => {
|
||||||
let nestedResult: any[] = [];
|
let nestedResult: any[] = [];
|
||||||
if (paramType) {
|
if (paramType) {
|
||||||
nestedResult.push(paramType);
|
nestedResult.push(paramType);
|
||||||
@ -152,7 +152,7 @@ export class StaticReflector implements ReflectorReader {
|
|||||||
private registerDecoratorOrConstructor(type: StaticSymbol, ctor: any): void {
|
private registerDecoratorOrConstructor(type: StaticSymbol, ctor: any): void {
|
||||||
this.conversionMap.set(type, (context: StaticSymbol, args: any[]) => {
|
this.conversionMap.set(type, (context: StaticSymbol, args: any[]) => {
|
||||||
let argValues: any[] = [];
|
let argValues: any[] = [];
|
||||||
args.forEach( (arg, index) => {
|
args.forEach((arg, index) => {
|
||||||
let argValue: any;
|
let argValue: any;
|
||||||
if (typeof arg === 'object' && !arg['__symbolic']) {
|
if (typeof arg === 'object' && !arg['__symbolic']) {
|
||||||
argValue = mapStringMap(arg, (value, key) => this.simplify(context, value));
|
argValue = mapStringMap(arg, (value, key) => this.simplify(context, value));
|
||||||
@ -387,6 +387,6 @@ function mapStringMap(input: {[key: string]: any},
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPrimitive(o: any):boolean {
|
function isPrimitive(o: any): boolean {
|
||||||
return o === null || (typeof o !== "function" && typeof o !== "object");
|
return o === null || (typeof o !== "function" && typeof o !== "object");
|
||||||
}
|
}
|
@ -9,7 +9,11 @@ import {
|
|||||||
import {isBlank} from '@angular/facade/src/lang';
|
import {isBlank} from '@angular/facade/src/lang';
|
||||||
import {ListWrapper} from '@angular/facade/src/collection';
|
import {ListWrapper} from '@angular/facade/src/collection';
|
||||||
|
|
||||||
import {StaticReflector, StaticReflectorHost, StaticSymbol} from '@angular/compiler_cli/src/static_reflector';
|
import {
|
||||||
|
StaticReflector,
|
||||||
|
StaticReflectorHost,
|
||||||
|
StaticSymbol
|
||||||
|
} from '@angular/compiler_cli/src/static_reflector';
|
||||||
|
|
||||||
describe('StaticReflector', () => {
|
describe('StaticReflector', () => {
|
||||||
let noContext = new StaticSymbol('', '');
|
let noContext = new StaticSymbol('', '');
|
||||||
|
@ -16,8 +16,7 @@ export class ViewUtils {
|
|||||||
sanitizer: SanitizationService;
|
sanitizer: SanitizationService;
|
||||||
private _nextCompTypeId: number = 0;
|
private _nextCompTypeId: number = 0;
|
||||||
|
|
||||||
constructor(
|
constructor(private _renderer: RootRenderer, @Inject(APP_ID) private _appId: string,
|
||||||
private _renderer: RootRenderer, @Inject(APP_ID) private _appId: string,
|
|
||||||
sanitizer: SanitizationService) {
|
sanitizer: SanitizationService) {
|
||||||
this.sanitizer = sanitizer;
|
this.sanitizer = sanitizer;
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,8 @@ function declareTests(isJit: boolean) {
|
|||||||
let tpl = `<div [attr.onclick]="ctxProp"></div>`;
|
let tpl = `<div [attr.onclick]="ctxProp"></div>`;
|
||||||
tcb = tcb.overrideView(SecuredComponent, new ViewMetadata({template: tpl}));
|
tcb = tcb.overrideView(SecuredComponent, new ViewMetadata({template: tpl}));
|
||||||
PromiseWrapper.catchError(tcb.createAsync(SecuredComponent), (e) => {
|
PromiseWrapper.catchError(tcb.createAsync(SecuredComponent), (e) => {
|
||||||
expect(e.message).toContain(
|
expect(e.message).toContain(`Template parse errors:\n` +
|
||||||
`Template parse errors:\n` + `Binding to event attribute 'onclick' is disallowed ` +
|
`Binding to event attribute 'onclick' is disallowed ` +
|
||||||
`for security reasons, please use (click)=... `);
|
`for security reasons, please use (click)=... `);
|
||||||
async.done();
|
async.done();
|
||||||
return null;
|
return null;
|
||||||
|
@ -69,7 +69,7 @@ export class RouterLink implements OnDestroy {
|
|||||||
ngOnDestroy() { ObservableWrapper.dispose(this._subscription); }
|
ngOnDestroy() { ObservableWrapper.dispose(this._subscription); }
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
set routerLink(data: any[]|any) {
|
set routerLink(data: any[] | any) {
|
||||||
if (isArray(data)) {
|
if (isArray(data)) {
|
||||||
this._commands = <any[]>data;
|
this._commands = <any[]>data;
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,7 +4,8 @@ import {BaseException} from './facade/exceptions';
|
|||||||
import {ListWrapper} from './facade/collection';
|
import {ListWrapper} from './facade/collection';
|
||||||
|
|
||||||
// TODO: vsavkin: should reuse segments
|
// TODO: vsavkin: should reuse segments
|
||||||
export function link(segment: RouteSegment, routeTree: RouteTree, urlTree: UrlTree, commands: any[]): UrlTree {
|
export function link(segment: RouteSegment, routeTree: RouteTree, urlTree: UrlTree,
|
||||||
|
commands: any[]): UrlTree {
|
||||||
if (commands.length === 0) return urlTree;
|
if (commands.length === 0) return urlTree;
|
||||||
|
|
||||||
let normalizedCommands = _normalizeCommands(commands);
|
let normalizedCommands = _normalizeCommands(commands);
|
||||||
@ -13,24 +14,26 @@ export function link(segment: RouteSegment, routeTree: RouteTree, urlTree: UrlTr
|
|||||||
}
|
}
|
||||||
|
|
||||||
let startingNode = _findStartingNode(normalizedCommands, urlTree, segment, routeTree);
|
let startingNode = _findStartingNode(normalizedCommands, urlTree, segment, routeTree);
|
||||||
let updated = normalizedCommands.commands.length > 0 ?
|
let updated =
|
||||||
_updateMany(ListWrapper.clone(startingNode.children), normalizedCommands.commands) : [];
|
normalizedCommands.commands.length > 0 ?
|
||||||
|
_updateMany(ListWrapper.clone(startingNode.children), normalizedCommands.commands) :
|
||||||
|
[];
|
||||||
let newRoot = _constructNewTree(rootNode(urlTree), startingNode, updated);
|
let newRoot = _constructNewTree(rootNode(urlTree), startingNode, updated);
|
||||||
|
|
||||||
return new UrlTree(newRoot);
|
return new UrlTree(newRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _navigateToRoot(normalizedChange:_NormalizedNavigationCommands):boolean {
|
function _navigateToRoot(normalizedChange: _NormalizedNavigationCommands): boolean {
|
||||||
return normalizedChange.isAbsolute && normalizedChange.commands.length === 1 && normalizedChange.commands[0] == "/";
|
return normalizedChange.isAbsolute && normalizedChange.commands.length === 1 &&
|
||||||
|
normalizedChange.commands[0] == "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
class _NormalizedNavigationCommands {
|
class _NormalizedNavigationCommands {
|
||||||
constructor(public isAbsolute: boolean,
|
constructor(public isAbsolute: boolean, public numberOfDoubleDots: number,
|
||||||
public numberOfDoubleDots: number,
|
|
||||||
public commands: any[]) {}
|
public commands: any[]) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _normalizeCommands(commands: any[]): _NormalizedNavigationCommands {;''
|
function _normalizeCommands(commands: any[]): _NormalizedNavigationCommands {
|
||||||
if (isString(commands[0]) && commands.length === 1 && commands[0] == "/") {
|
if (isString(commands[0]) && commands.length === 1 && commands[0] == "/") {
|
||||||
return new _NormalizedNavigationCommands(true, 0, commands);
|
return new _NormalizedNavigationCommands(true, 0, commands);
|
||||||
}
|
}
|
||||||
@ -64,7 +67,7 @@ function _normalizeCommands(commands: any[]): _NormalizedNavigationCommands {;''
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (cc != ''){
|
if (cc != '') {
|
||||||
res.push(cc);
|
res.push(cc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,7 +77,8 @@ function _normalizeCommands(commands: any[]): _NormalizedNavigationCommands {;''
|
|||||||
return new _NormalizedNavigationCommands(isAbsolute, numberOfDoubleDots, res);
|
return new _NormalizedNavigationCommands(isAbsolute, numberOfDoubleDots, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _findUrlSegment(segment: RouteSegment, routeTree: RouteTree, urlTree: UrlTree, numberOfDoubleDots: number): UrlSegment {
|
function _findUrlSegment(segment: RouteSegment, routeTree: RouteTree, urlTree: UrlTree,
|
||||||
|
numberOfDoubleDots: number): UrlSegment {
|
||||||
let s = segment;
|
let s = segment;
|
||||||
while (s.urlSegments.length === 0) {
|
while (s.urlSegments.length === 0) {
|
||||||
s = routeTree.parent(s);
|
s = routeTree.parent(s);
|
||||||
@ -87,11 +91,13 @@ function _findUrlSegment(segment: RouteSegment, routeTree: RouteTree, urlTree: U
|
|||||||
return path[path.length - 1 - numberOfDoubleDots];
|
return path[path.length - 1 - numberOfDoubleDots];
|
||||||
}
|
}
|
||||||
|
|
||||||
function _findStartingNode(normalizedChange:_NormalizedNavigationCommands, urlTree:UrlTree, segment:RouteSegment, routeTree:RouteTree):TreeNode<UrlSegment> {
|
function _findStartingNode(normalizedChange: _NormalizedNavigationCommands, urlTree: UrlTree,
|
||||||
|
segment: RouteSegment, routeTree: RouteTree): TreeNode<UrlSegment> {
|
||||||
if (normalizedChange.isAbsolute) {
|
if (normalizedChange.isAbsolute) {
|
||||||
return rootNode(urlTree);
|
return rootNode(urlTree);
|
||||||
} else {
|
} else {
|
||||||
let urlSegment = _findUrlSegment(segment, routeTree, urlTree, normalizedChange.numberOfDoubleDots);
|
let urlSegment =
|
||||||
|
_findUrlSegment(segment, routeTree, urlTree, normalizedChange.numberOfDoubleDots);
|
||||||
return _findMatchingNode(urlSegment, rootNode(urlTree));
|
return _findMatchingNode(urlSegment, rootNode(urlTree));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,7 +158,8 @@ function _update(node: TreeNode<UrlSegment>, commands: any[]): TreeNode<UrlSegme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _recurse(urlSegment: UrlSegment, node: TreeNode<UrlSegment>, rest: any[]): TreeNode<UrlSegment> {
|
function _recurse(urlSegment: UrlSegment, node: TreeNode<UrlSegment>,
|
||||||
|
rest: any[]): TreeNode<UrlSegment> {
|
||||||
if (rest.length === 0) {
|
if (rest.length === 0) {
|
||||||
return new TreeNode<UrlSegment>(urlSegment, []);
|
return new TreeNode<UrlSegment>(urlSegment, []);
|
||||||
}
|
}
|
||||||
|
@ -143,8 +143,7 @@ function _matchWithParts(route: RouteMetadata, url: TreeNode<UrlSegment>): _Matc
|
|||||||
}
|
}
|
||||||
|
|
||||||
let p = lastSegment.value.parameters;
|
let p = lastSegment.value.parameters;
|
||||||
let parameters =
|
let parameters = <{[key: string]: string}>StringMapWrapper.merge(p, positionalParams);
|
||||||
<{[key: string]: string}>StringMapWrapper.merge(p, positionalParams);
|
|
||||||
let axuUrlSubtrees = isPresent(lastParent) ? lastParent.children.slice(1) : [];
|
let axuUrlSubtrees = isPresent(lastParent) ? lastParent.children.slice(1) : [];
|
||||||
|
|
||||||
return new _MatchResult(route.component, consumedUrlSegments, parameters, lastSegment.children,
|
return new _MatchResult(route.component, consumedUrlSegments, parameters, lastSegment.children,
|
||||||
|
@ -90,8 +90,8 @@ export class TreeNode<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class UrlSegment {
|
export class UrlSegment {
|
||||||
constructor(public segment: any, public parameters: {[key: string]: any},
|
constructor(public segment: any, public parameters: {[key: string]: any}, public outlet: string) {
|
||||||
public outlet: string) {}
|
}
|
||||||
|
|
||||||
toString(): string {
|
toString(): string {
|
||||||
let outletPrefix = isBlank(this.outlet) ? "" : `${this.outlet}:`;
|
let outletPrefix = isBlank(this.outlet) ? "" : `${this.outlet}:`;
|
||||||
|
@ -155,7 +155,7 @@ export function main() {
|
|||||||
let p = parser.parse("/a(ap)/c(cp)");
|
let p = parser.parse("/a(ap)/c(cp)");
|
||||||
let c = p.firstChild(p.root);
|
let c = p.firstChild(p.root);
|
||||||
|
|
||||||
let child = new RouteSegment([], {'one':1}, null, null, null);
|
let child = new RouteSegment([], {'one': 1}, null, null, null);
|
||||||
let root = new TreeNode<RouteSegment>(new RouteSegment([c], {}, null, null, null),
|
let root = new TreeNode<RouteSegment>(new RouteSegment([c], {}, null, null, null),
|
||||||
[new TreeNode<RouteSegment>(child, [])]);
|
[new TreeNode<RouteSegment>(child, [])]);
|
||||||
let tree = new RouteTree(root);
|
let tree = new RouteTree(root);
|
||||||
|
@ -29,12 +29,7 @@ if (globsIndex < 0) {
|
|||||||
args = process.argv.slice(globsIndex + 1);
|
args = process.argv.slice(globsIndex + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var specFiles =
|
var specFiles = args.map(function(globstr) { return glob.sync(globstr, {cwd: toolsDir}); })
|
||||||
args.map(function(globstr) {
|
|
||||||
return glob.sync(globstr, {
|
|
||||||
cwd: toolsDir
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.reduce(function(specFiles, paths) { return specFiles.concat(paths); }, []);
|
.reduce(function(specFiles, paths) { return specFiles.concat(paths); }, []);
|
||||||
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100;
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100;
|
||||||
@ -45,7 +40,5 @@ jrunner.onComplete(function(passed) { process.exit(passed ? 0 : 1); });
|
|||||||
jrunner.projectBaseDir = path.resolve(__dirname, '../../');
|
jrunner.projectBaseDir = path.resolve(__dirname, '../../');
|
||||||
jrunner.specDir = '';
|
jrunner.specDir = '';
|
||||||
require('zone.js/dist/jasmine-patch.js');
|
require('zone.js/dist/jasmine-patch.js');
|
||||||
specFiles.forEach((file) => {
|
specFiles.forEach((file) => { toolsDirRequire(file); });
|
||||||
toolsDirRequire(file);
|
|
||||||
});
|
|
||||||
jrunner.execute();
|
jrunner.execute();
|
||||||
|
@ -11,8 +11,7 @@ const OFFLINE_COMPILE = [
|
|||||||
'offline_compiler_codegen_typed'
|
'offline_compiler_codegen_typed'
|
||||||
];
|
];
|
||||||
|
|
||||||
function processOutputEmitterCodeGen():
|
function processOutputEmitterCodeGen(): Promise<number> {
|
||||||
Promise<number> {
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
var outDir = 'dist/all/@angular/compiler/test/';
|
var outDir = 'dist/all/@angular/compiler/test/';
|
||||||
var promises = [];
|
var promises = [];
|
||||||
@ -21,24 +20,21 @@ function processOutputEmitterCodeGen():
|
|||||||
var codegen = require('../../all/@angular/compiler/test/' + file + '.js');
|
var codegen = require('../../all/@angular/compiler/test/' + file + '.js');
|
||||||
if (codegen.emit) {
|
if (codegen.emit) {
|
||||||
console.log(` ${file} has changed, regenerating...`);
|
console.log(` ${file} has changed, regenerating...`);
|
||||||
promises.push(
|
promises.push(Promise.resolve(codegen.emit())
|
||||||
Promise.resolve(codegen.emit())
|
|
||||||
.then((code) => { writeFileSync(outDir + file + '.ts', code); }));
|
.then((code) => { writeFileSync(outDir + file + '.ts', code); }));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (promises.length) {
|
if (promises.length) {
|
||||||
Promise.all(promises)
|
Promise.all(promises)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
var args = [
|
var args =
|
||||||
'--project',
|
['--project', 'tools/cjs-jasmine/tsconfig-output_emitter_codegen.json'];
|
||||||
'tools/cjs-jasmine/tsconfig-output_emitter_codegen.json'
|
|
||||||
];
|
|
||||||
console.log(' compiling changes: tsc ' + args.join(' '));
|
console.log(' compiling changes: tsc ' + args.join(' '));
|
||||||
var tsc = spawn(TSC, args, {stdio: 'pipe'});
|
var tsc = spawn(TSC, args, {stdio: 'pipe'});
|
||||||
tsc.stdout.on('data', (data) => process.stdout.write(data));
|
tsc.stdout.on('data', (data) => process.stdout.write(data));
|
||||||
tsc.stderr.on('data', (data) => process.stderr.write(data));
|
tsc.stderr.on('data', (data) => process.stderr.write(data));
|
||||||
tsc.on('close', (code) => code ? reject('Tsc exited with: ' + code) :
|
tsc.on('close',
|
||||||
resolve(code));
|
(code) => code ? reject('Tsc exited with: ' + code) : resolve(code));
|
||||||
})
|
})
|
||||||
.catch(reportError);
|
.catch(reportError);
|
||||||
} else {
|
} else {
|
||||||
@ -46,7 +42,7 @@ function processOutputEmitterCodeGen():
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(reportError);
|
.catch(reportError);
|
||||||
}
|
}
|
||||||
|
|
||||||
function md(dir: string, folders: string[]) {
|
function md(dir: string, folders: string[]) {
|
||||||
if (folders.length) {
|
if (folders.length) {
|
||||||
@ -71,7 +67,13 @@ if (platform == 'node') {
|
|||||||
complete: 'Compilation complete. Watching for file changes.',
|
complete: 'Compilation complete. Watching for file changes.',
|
||||||
onChangeCmds: [
|
onChangeCmds: [
|
||||||
processOutputEmitterCodeGen,
|
processOutputEmitterCodeGen,
|
||||||
['node', 'dist/tools/cjs-jasmine', '--', '{@angular,benchpress}/**/*_spec.js', '@angular/compiler_cli/test/**/*_spec.js']
|
[
|
||||||
|
'node',
|
||||||
|
'dist/tools/cjs-jasmine',
|
||||||
|
'--',
|
||||||
|
'{@angular,benchpress}/**/*_spec.js',
|
||||||
|
'@angular/compiler_cli/test/**/*_spec.js'
|
||||||
|
]
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
} else if (platform == 'browser') {
|
} else if (platform == 'browser') {
|
||||||
@ -92,7 +94,8 @@ if (platform == 'node') {
|
|||||||
complete: 'Compilation complete. Watching for file changes.',
|
complete: 'Compilation complete. Watching for file changes.',
|
||||||
onChangeCmds: [
|
onChangeCmds: [
|
||||||
// TODO: fix and enable tests for public_api_spec again!
|
// TODO: fix and enable tests for public_api_spec again!
|
||||||
// ['node', 'dist/tools/cjs-jasmine/index-tools', '--', '{metadata,public_api_guard}/**/*{_,.}spec.js']
|
// ['node', 'dist/tools/cjs-jasmine/index-tools', '--',
|
||||||
|
// '{metadata,public_api_guard}/**/*{_,.}spec.js']
|
||||||
['node', 'dist/tools/cjs-jasmine/index-tools', '--', 'metadata/**/*{_,.}spec.js']
|
['node', 'dist/tools/cjs-jasmine/index-tools', '--', 'metadata/**/*{_,.}spec.js']
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user