build(broccoli): make node_trees produce strict-mode scripts
Closes #2575 Closes #2648
This commit is contained in:
parent
2d2ae9b8d8
commit
ed9d9d5096
|
@ -127,6 +127,10 @@ export function makeParamDecorator(annotationCls): any {
|
||||||
if (this instanceof annotationCls) {
|
if (this instanceof annotationCls) {
|
||||||
return annotationInstance;
|
return annotationInstance;
|
||||||
} else {
|
} else {
|
||||||
|
(<any>ParamDecorator).annotation = annotationInstance;
|
||||||
|
return ParamDecorator;
|
||||||
|
}
|
||||||
|
|
||||||
function ParamDecorator(cls, unusedKey, index) {
|
function ParamDecorator(cls, unusedKey, index) {
|
||||||
var parameters: Array<Array<any>> = Reflect.getMetadata('parameters', cls);
|
var parameters: Array<Array<any>> = Reflect.getMetadata('parameters', cls);
|
||||||
parameters = parameters || [];
|
parameters = parameters || [];
|
||||||
|
@ -144,10 +148,6 @@ export function makeParamDecorator(annotationCls): any {
|
||||||
Reflect.defineMetadata('parameters', parameters, cls);
|
Reflect.defineMetadata('parameters', parameters, cls);
|
||||||
return cls;
|
return cls;
|
||||||
}
|
}
|
||||||
|
|
||||||
(<any>ParamDecorator).annotation = annotationInstance;
|
|
||||||
return ParamDecorator;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ParamDecoratorFactory.prototype = Object.create(annotationCls.prototype);
|
ParamDecoratorFactory.prototype = Object.create(annotationCls.prototype);
|
||||||
return ParamDecoratorFactory;
|
return ParamDecoratorFactory;
|
||||||
|
|
|
@ -1209,8 +1209,6 @@ export function main() {
|
||||||
// - https://github.com/angular/angular/issues/776
|
// - https://github.com/angular/angular/issues/776
|
||||||
// - https://github.com/angular/angular/commit/81f3f32
|
// - https://github.com/angular/angular/commit/81f3f32
|
||||||
xdescribe('Missing directive checks', () => {
|
xdescribe('Missing directive checks', () => {
|
||||||
|
|
||||||
if (assertionsEnabled()) {
|
|
||||||
function expectCompileError(tb, inlineTpl, errMessage, done) {
|
function expectCompileError(tb, inlineTpl, errMessage, done) {
|
||||||
tb.overrideView(MyComp, new viewAnn.View({template: inlineTpl}));
|
tb.overrideView(MyComp, new viewAnn.View({template: inlineTpl}));
|
||||||
PromiseWrapper.then(
|
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',
|
it('should raise an error if no directive is registered for a template with template bindings',
|
||||||
inject([TestBed, AsyncTestCompleter], (tb: TestBed, async) => {
|
inject([TestBed, AsyncTestCompleter], (tb: TestBed, async) => {
|
||||||
expectCompileError(tb, '<div><div template="if: foo"></div></div>',
|
expectCompileError(tb, '<div><div template="if: foo"></div></div>',
|
||||||
|
|
|
@ -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);
|
return destCopy(nodeTree, destinationPath);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue