Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: angular/angular-cli
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v9.1.4
Choose a base ref
...
head repository: angular/angular-cli
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v9.1.5
Choose a head ref
  • 10 commits
  • 11 files changed
  • 4 contributors

Commits on May 4, 2020

  1. fix(@angular-devkit/build-angular): update worker-plugin

    This update contains the following fix GoogleChromeLabs/worker-plugin#65
    
    Closes: #17373
    alan-agius4 authored and dgp1130 committed May 4, 2020
    Copy the full SHA
    257e493 View commit details
  2. build: update angular packages

    alan-agius4 authored and dgp1130 committed May 4, 2020
    Copy the full SHA
    059397a View commit details
  3. fix(@angular/cli): allow configuration option in ng deploy

    Fixes #17613
    
    (cherry picked from commit 57bc38e)
    alan-agius4 authored and dgp1130 committed May 4, 2020
    Copy the full SHA
    49a462f View commit details

Commits on May 5, 2020

  1. fix(@schematics/angular): don't add @angular/language-service in ne…

    …w Angular projects
    
    This package is no longer required since the VS code extension is already shipped with it.
    alan-agius4 authored and dgp1130 committed May 5, 2020
    Copy the full SHA
    2571115 View commit details
  2. fix(@ngtools/webpack): only emit import default helper when needed

    Previously, the import default TypeScript helper was emitted for every file when in JIT mode.  This was unused code in the majority of cases.  The helper is now emitted only when needed.  For this package that would be when an Angular component decorator's resource URL properties are adjusted to support JIT execution with Webpack.
    
    (cherry picked from commit 013d424)
    clydin authored and dgp1130 committed May 5, 2020
    Copy the full SHA
    e2a25c1 View commit details

Commits on May 6, 2020

  1. ci: exclude private packages from consideration for license checking

    (cherry picked from commit 13b0763)
    josephperrott authored and dgp1130 committed May 6, 2020
    Copy the full SHA
    6931135 View commit details

Commits on May 7, 2020

  1. ci: add 0BSD as a valid license

    This is required for tslib versions >= 1.11.2. Tslib changes it's license to 0BSD which should allow projects that embed or bundle tslib to omit its license header.
    
    See: https://opensource.google/docs/thirdparty/licenses/#unencumbered
    (cherry picked from commit fb4eaf1)
    alan-agius4 authored and dgp1130 committed May 7, 2020
    Copy the full SHA
    ef4235b View commit details
  2. release: v9.1.5

    dgp1130 committed May 7, 2020
    Copy the full SHA
    5db7e16 View commit details

Commits on May 8, 2020

  1. Revert "release: v9.1.5"

    This reverts commit 5db7e16.
    
    Need to use FW `9.1.6` to incorporate a case-sensitivity fix for Windows so CI will pass.
    dgp1130 committed May 8, 2020
    Copy the full SHA
    5ef4987 View commit details
  2. release: v9.1.5

    dgp1130 committed May 8, 2020
    Copy the full SHA
    901fdc5 View commit details
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -66,8 +66,8 @@
]
},
"devDependencies": {
"@angular/compiler": "9.1.0-rc.2",
"@angular/compiler-cli": "9.1.0-rc.2",
"@angular/compiler": "9.1.4",
"@angular/compiler-cli": "9.1.4",
"@bazel/bazel": "2.1.0",
"@bazel/buildifier": "0.29.0",
"@bazel/jasmine": "1.3.0",
17 changes: 8 additions & 9 deletions packages/angular/cli/commands/deploy.json
Original file line number Diff line number Diff line change
@@ -18,17 +18,16 @@
"$source": "argv",
"index": 0
}
},
"configuration": {
"description": "A named build target, as specified in the \"configurations\" section of angular.json.\nEach named target is accompanied by a configuration of option defaults for that target.",
"type": "string",
"aliases": [
"c"
]
}
},
"configuration": {
"description": "A named build target, as specified in the \"configurations\" section of angular.json.\nEach named target is accompanied by a configuration of option defaults for that target.",
"type": "string",
"aliases": [
"c"
]
},
"required": [
]
"required": []
},
{
"$ref": "./definitions.json#/definitions/base"
26 changes: 13 additions & 13 deletions packages/angular_devkit/build_angular/package.json
Original file line number Diff line number Diff line change
@@ -67,23 +67,23 @@
"webpack-merge": "4.2.2",
"webpack-sources": "1.4.3",
"webpack-subresource-integrity": "1.4.0",
"worker-plugin": "4.0.2"
"worker-plugin": "4.0.3"
},
"devDependencies": {
"@angular/animations": "9.1.0-rc.2",
"@angular/animations": "9.1.4",
"@angular/cdk": "9.1.3",
"@angular/common": "9.1.0-rc.2",
"@angular/compiler": "9.1.0-rc.2",
"@angular/compiler-cli": "9.1.0-rc.2",
"@angular/core": "9.1.0-rc.2",
"@angular/forms": "9.1.0-rc.2",
"@angular/localize": "9.1.0-rc.2",
"@angular/common": "9.1.4",
"@angular/compiler": "9.1.4",
"@angular/compiler-cli": "9.1.4",
"@angular/core": "9.1.4",
"@angular/forms": "9.1.4",
"@angular/localize": "9.1.4",
"@angular/material": "9.1.3",
"@angular/platform-browser": "9.1.0-rc.2",
"@angular/platform-browser-dynamic": "9.1.0-rc.2",
"@angular/platform-server": "9.1.0-rc.2",
"@angular/router": "9.1.0-rc.2",
"@angular/service-worker": "9.1.0-rc.2",
"@angular/platform-browser": "9.1.4",
"@angular/platform-browser-dynamic": "9.1.4",
"@angular/platform-server": "9.1.4",
"@angular/router": "9.1.4",
"@angular/service-worker": "9.1.4",
"codelyzer": "^5.0.0",
"bootstrap": "^4.0.0",
"font-awesome": "^4.7.0",
4 changes: 2 additions & 2 deletions packages/angular_devkit/build_ng_packagr/package.json
Original file line number Diff line number Diff line change
@@ -15,8 +15,8 @@
"tsickle": "~0.37.1 || ~0.38.0"
},
"devDependencies": {
"@angular/compiler": "9.1.0-rc.2",
"@angular/compiler-cli": "9.1.0-rc.2",
"@angular/compiler": "9.1.4",
"@angular/compiler-cli": "9.1.4",
"@angular-devkit/core": "0.0.0",
"ng-packagr": "~9.0.0",
"tslib": "^1.10.0"
4 changes: 2 additions & 2 deletions packages/ngtools/webpack/package.json
Original file line number Diff line number Diff line change
@@ -32,8 +32,8 @@
"webpack": "^4.0.0"
},
"devDependencies": {
"@angular/compiler": "9.1.0-rc.2",
"@angular/compiler-cli": "9.1.0-rc.2",
"@angular/compiler": "9.1.4",
"@angular/compiler-cli": "9.1.4",
"typescript": "3.8.3",
"webpack": "4.42.0"
}
95 changes: 47 additions & 48 deletions packages/ngtools/webpack/src/transformers/replace_resources.ts
Original file line number Diff line number Diff line change
@@ -5,23 +5,32 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { tags } from '@angular-devkit/core';
import * as ts from 'typescript';

// emit helper for `import Name from "foo"`
// importName is marked as an internal property but is needed for the tslib import.
const importDefaultHelper: ts.UnscopedEmitHelper & { importName?: string } = {
name: 'typescript:commonjsimportdefault',
importName: '__importDefault',
scoped: false,
text: `
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};`,
};

export function replaceResources(
shouldTransform: (fileName: string) => boolean,
getTypeChecker: () => ts.TypeChecker,
directTemplateLoading = false,
): ts.TransformerFactory<ts.SourceFile> {

return (context: ts.TransformationContext) => {
const typeChecker = getTypeChecker();

const visitNode: ts.Visitor = (node: ts.Node) => {
if (ts.isClassDeclaration(node)) {
const decorators = ts.visitNodes(
node.decorators,
(node: ts.Decorator) => visitDecorator(node, typeChecker, directTemplateLoading),
const decorators = ts.visitNodes(node.decorators, (node: ts.Decorator) =>
visitDecorator(context, node, typeChecker, directTemplateLoading),
);

return ts.updateClassDeclaration(
@@ -38,22 +47,8 @@ export function replaceResources(
return ts.visitEachChild(node, visitNode, context);
};

// emit helper for `import Name from "foo"`
// importName is marked as an internal property but is needed for the tslib import.
const importDefaultHelper: ts.UnscopedEmitHelper & { importName?: string; } = {
name: 'typescript:commonjsimportdefault',
importName: '__importDefault',
scoped: false,
text: tags.stripIndent`
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};`,
};

return (sourceFile: ts.SourceFile) => {
if (shouldTransform(sourceFile.fileName)) {
context.requestEmitHelper(importDefaultHelper);

return ts.visitNode(sourceFile, visitNode);
}

@@ -63,9 +58,11 @@ export function replaceResources(
}

function visitDecorator(
context: ts.TransformationContext,
node: ts.Decorator,
typeChecker: ts.TypeChecker,
directTemplateLoading: boolean): ts.Decorator {
directTemplateLoading: boolean,
): ts.Decorator {
if (!isComponentDecorator(node, typeChecker)) {
return node;
}
@@ -85,10 +82,8 @@ function visitDecorator(
const styleReplacements: ts.Expression[] = [];

// visit all properties
let properties = ts.visitNodes(
objectExpression.properties,
(node: ts.ObjectLiteralElementLike) =>
visitComponentMetadata(node, styleReplacements, directTemplateLoading),
let properties = ts.visitNodes(objectExpression.properties, (node: ts.ObjectLiteralElementLike) =>
visitComponentMetadata(context, node, styleReplacements, directTemplateLoading),
);

// replace properties with updated properties
@@ -103,16 +98,14 @@ function visitDecorator(

return ts.updateDecorator(
node,
ts.updateCall(
decoratorFactory,
decoratorFactory.expression,
decoratorFactory.typeArguments,
[ts.updateObjectLiteral(objectExpression, properties)],
),
ts.updateCall(decoratorFactory, decoratorFactory.expression, decoratorFactory.typeArguments, [
ts.updateObjectLiteral(objectExpression, properties),
]),
);
}

function visitComponentMetadata(
context: ts.TransformationContext,
node: ts.ObjectLiteralElementLike,
styleReplacements: ts.Expression[],
directTemplateLoading: boolean,
@@ -124,14 +117,17 @@ function visitComponentMetadata(
const name = node.name.text;
switch (name) {
case 'moduleId':

return undefined;

case 'templateUrl':
return ts.updatePropertyAssignment(
node,
ts.createIdentifier('template'),
createRequireExpression(node.initializer, directTemplateLoading ? '!raw-loader!' : ''),
createRequireExpression(
context,
node.initializer,
directTemplateLoading ? '!raw-loader!' : '',
),
);

case 'styles':
@@ -141,16 +137,15 @@ function visitComponentMetadata(
}

const isInlineStyles = name === 'styles';
const styles = ts.visitNodes(
node.initializer.elements,
(node: ts.Expression) => {
if (!ts.isStringLiteral(node) && !ts.isNoSubstitutionTemplateLiteral(node)) {
return node;
}

return isInlineStyles ? ts.createLiteral(node.text) : createRequireExpression(node);
},
);
const styles = ts.visitNodes(node.initializer.elements, (node: ts.Expression) => {
if (!ts.isStringLiteral(node) && !ts.isNoSubstitutionTemplateLiteral(node)) {
return node;
}

return isInlineStyles
? ts.createLiteral(node.text)
: createRequireExpression(context, node);
});

// Styles should be placed first
if (isInlineStyles) {
@@ -188,17 +183,21 @@ function isComponentDecorator(node: ts.Node, typeChecker: ts.TypeChecker): node
return false;
}

function createRequireExpression(node: ts.Expression, loader?: string): ts.Expression {
function createRequireExpression(
context: ts.TransformationContext,
node: ts.Expression,
loader?: string,
): ts.Expression {
const url = getResourceUrl(node, loader);
if (!url) {
return node;
}

const callExpression = ts.createCall(
ts.createIdentifier('require'),
undefined,
[ts.createLiteral(url)],
);
context.requestEmitHelper(importDefaultHelper);

const callExpression = ts.createCall(ts.createIdentifier('require'), undefined, [
ts.createLiteral(url),
]);

return ts.createPropertyAccess(
ts.createCall(
Original file line number Diff line number Diff line change
@@ -391,7 +391,7 @@ describe('@ngtools/webpack transformers', () => {
`;

const output = tags.stripIndent`
import { __decorate, __importDefault } from "tslib";
import { __decorate } from "tslib";
import { Component } from 'foo';
let AppComponent = class AppComponent {
@@ -453,5 +453,36 @@ describe('@ngtools/webpack transformers', () => {
const result = transform(input, false);
expect(tags.oneLine`${result}`).toEqual(tags.oneLine`${output}`);
});

it('should not emit import default helper if no changes are made', () => {
const input = tags.stripIndent`
import { Component } from '@angular/core';
@Component({
selector: 'app-root'
})
export class AppComponent {
title = 'app';
}
`;
const output = tags.stripIndent`
import { __decorate } from "tslib";
import { Component } from '@angular/core';
let AppComponent = class AppComponent {
constructor() {
this.title = 'app';
}
};
AppComponent = __decorate([
Component({
selector: 'app-root'
})
], AppComponent);
export { AppComponent };
`;

const result = transform(input);
expect(tags.oneLine`${result}`).toEqual(tags.oneLine`${output}`);
});
});
});
8 changes: 4 additions & 4 deletions packages/schematics/angular/utility/latest-versions.ts
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@

export const latestVersions = {
// These versions should be kept up to date with latest Angular peer dependencies.
Angular: '~9.1.4',
Angular: '~9.1.6',
RxJs: '~6.5.4',
ZoneJs: '~0.10.2',
TypeScript: '~3.8.3',
@@ -18,9 +18,9 @@ export const latestVersions = {
// For our e2e tests, these versions must match the latest tag present on the branch.
// During RC periods they will not match the latest RC until there's a new git tag, and
// should not be updated.
DevkitBuildAngular: '~0.901.4',
DevkitBuildNgPackagr: '~0.901.4',
DevkitBuildWebpack: '~0.901.4',
DevkitBuildAngular: '~0.901.5',
DevkitBuildNgPackagr: '~0.901.5',
DevkitBuildWebpack: '~0.901.5',

ngPackagr: '^9.0.0',
};
Original file line number Diff line number Diff line change
@@ -26,7 +26,6 @@
"devDependencies": {
"@angular/cli": "<%= '~' + version %>",
"@angular/compiler-cli": "<%= latestVersions.Angular %>",
"@angular/language-service": "<%= latestVersions.Angular %>",
"@types/node": "^12.11.1",<% if (!minimal) { %>
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
3 changes: 2 additions & 1 deletion scripts/validate-licenses.ts
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@ const licensesWhitelist = [
// Have a full copyright grant. Validated by opensource team.
'Unlicense',
'CC0-1.0',
'0BSD',

// Combinations.
'(AFL-2.1 OR BSD-2-Clause)',
@@ -96,7 +97,7 @@ function _passesSpdx(licenses: string[], accepted: string[]) {

export default function (_options: {}, logger: logging.Logger): Promise<number> {
return new Promise(resolve => {
checker.init({ start: path.join(__dirname, '..') }, (err: Error, json: JsonObject) => {
checker.init({ start: path.join(__dirname, '..'), excludePrivatePackages: true }, (err: Error, json: JsonObject) => {
if (err) {
logger.fatal(`Something happened:\n${err.message}`);
resolve(1);
Loading