build(broccoli): make node_trees produce strict-mode scripts

Closes #2575
Closes #2648
This commit is contained in:
Caitlin Potter 2015-06-19 18:02:35 -04:00
parent 2d2ae9b8d8
commit ed9d9d5096
3 changed files with 38 additions and 32 deletions

View File

@ -127,6 +127,10 @@ export function makeParamDecorator(annotationCls): any {
if (this instanceof annotationCls) {
return annotationInstance;
} else {
(<any>ParamDecorator).annotation = annotationInstance;
return ParamDecorator;
}
function ParamDecorator(cls, unusedKey, index) {
var parameters: Array<Array<any>> = Reflect.getMetadata('parameters', cls);
parameters = parameters || [];
@ -144,10 +148,6 @@ export function makeParamDecorator(annotationCls): any {
Reflect.defineMetadata('parameters', parameters, cls);
return cls;
}
(<any>ParamDecorator).annotation = annotationInstance;
return ParamDecorator;
}
}
ParamDecoratorFactory.prototype = Object.create(annotationCls.prototype);
return ParamDecoratorFactory;

View File

@ -1209,8 +1209,6 @@ export function main() {
// - https://github.com/angular/angular/issues/776
// - https://github.com/angular/angular/commit/81f3f32
xdescribe('Missing directive checks', () => {
if (assertionsEnabled()) {
function expectCompileError(tb, inlineTpl, errMessage, done) {
tb.overrideView(MyComp, new viewAnn.View({template: inlineTpl}));
PromiseWrapper.then(
@ -1225,6 +1223,7 @@ export function main() {
});
}
if (assertionsEnabled()) {
it('should raise an error if no directive is registered for a template with template bindings',
inject([TestBed, AsyncTestCompleter], (tb: TestBed, async) => {
expectCompileError(tb, '<div><div template="if: foo"></div></div>',

View File

@ -127,5 +127,12 @@ module.exports = function makeNodeTree(destinationPath) {
]
});
// Prepend 'use strict' directive to all JS files.
// See https://github.com/Microsoft/TypeScript/issues/3576
nodeTree = replace(nodeTree, {
files: ['**/*.js'],
patterns: [{match: /^/, replacement: function() { return `'use strict';` }}]
});
return destCopy(nodeTree, destinationPath);
};