Skip to content

Update ivy set calls #16228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
"typescript": "3.6.4"
},
"devDependencies": {
"@angular/compiler": "9.0.0-rc.2",
"@angular/compiler-cli": "9.0.0-rc.2",
"@angular/compiler": "9.0.0-rc.3",
"@angular/compiler-cli": "9.0.0-rc.3",
"@bazel/bazel": "1.1.0",
"@bazel/buildifier": "0.29.0",
"@bazel/jasmine": "0.40.0",
Expand Down
24 changes: 12 additions & 12 deletions packages/angular_devkit/build_angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,20 @@
"worker-plugin": "3.2.0"
},
"devDependencies": {
"@angular/animations": "9.0.0-rc.2",
"@angular/animations": "9.0.0-rc.3",
"@angular/cdk": "8.2.3",
"@angular/common": "9.0.0-rc.2",
"@angular/compiler": "9.0.0-rc.2",
"@angular/compiler-cli": "9.0.0-rc.2",
"@angular/core": "9.0.0-rc.2",
"@angular/forms": "9.0.0-rc.2",
"@angular/localize": "9.0.0-rc.2",
"@angular/common": "9.0.0-rc.3",
"@angular/compiler": "9.0.0-rc.3",
"@angular/compiler-cli": "9.0.0-rc.3",
"@angular/core": "9.0.0-rc.3",
"@angular/forms": "9.0.0-rc.3",
"@angular/localize": "9.0.0-rc.3",
"@angular/material": "8.2.3",
"@angular/platform-browser": "9.0.0-rc.2",
"@angular/platform-browser-dynamic": "9.0.0-rc.2",
"@angular/platform-server": "9.0.0-rc.2",
"@angular/router": "9.0.0-rc.2",
"@angular/service-worker": "9.0.0-rc.2",
"@angular/platform-browser": "9.0.0-rc.3",
"@angular/platform-browser-dynamic": "9.0.0-rc.3",
"@angular/platform-server": "9.0.0-rc.3",
"@angular/router": "9.0.0-rc.3",
"@angular/service-worker": "9.0.0-rc.3",
"codelyzer": "^5.0.0",
"bootstrap": "^4.0.0",
"font-awesome": "^4.7.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/angular_devkit/build_ng_packagr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"tsickle": "~0.37.1"
},
"devDependencies": {
"@angular/compiler": "9.0.0-rc.2",
"@angular/compiler-cli": "9.0.0-rc.2",
"@angular/compiler": "9.0.0-rc.3",
"@angular/compiler-cli": "9.0.0-rc.3",
"@angular-devkit/core": "0.0.0",
"ng-packagr": "~9.0.0-rc.0",
"tslib": "^1.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export function testScrubFile(content: string) {
'propDecorators',
'ctorParameters',
'ɵsetClassMetadata',
'ɵɵsetNgModuleScope',
];

return markers.some((marker) => content.indexOf(marker) !== -1);
Expand Down Expand Up @@ -304,7 +303,35 @@ function isAssignmentExpressionTo(exprStmt: ts.ExpressionStatement, name: string
}

function isIvyPrivateCallExpression(exprStmt: ts.ExpressionStatement) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The IIFE structure could technically be different depending on any intermediate processing steps. The CLI's fixed configuration will prevent this but other usage may cause changes. An unbounded number of parenthesized expressions are also technically possible.

Examples: !function(){}() or (function(){}()) or ((function(){})())

const callExpr = exprStmt.expression;
// Each Ivy private call expression is inside an IIFE as single statements, so we must go down it.
const expression = exprStmt.expression;
if (!expression || !ts.isCallExpression(expression) || expression.arguments.length !== 0) {
return null;
}

const parenExpr = expression;
if (!ts.isParenthesizedExpression(parenExpr.expression)) {
return null;
}

const funExpr = parenExpr.expression.expression;
if (!ts.isFunctionExpression(funExpr)) {
return null;
}

const innerStmts = funExpr.body.statements;
if (innerStmts.length !== 1) {
return null;
}

const innerExprStmt = innerStmts[0];
if (!ts.isExpressionStatement(innerExprStmt)) {
return null;
}

// Now we're in the IIFE and have the inner expression statement. We can check if it matches
// a private Ivy call.
const callExpr = innerExprStmt.expression;
if (!ts.isCallExpression(callExpr)) {
return false;
}
Expand All @@ -313,8 +340,7 @@ function isIvyPrivateCallExpression(exprStmt: ts.ExpressionStatement) {
return false;
}

if (propAccExpr.name.text != 'ɵsetClassMetadata'
&& propAccExpr.name.text != 'ɵɵsetNgModuleScope') {
if (propAccExpr.name.text != 'ɵsetClassMetadata') {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,29 +722,14 @@ describe('scrub-file', () => {
`;
const input = tags.stripIndent`
${output}
/*@__PURE__*/ i0.ɵsetClassMetadata(Clazz, [{
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(Clazz, [{
type: Component,
args: [{
selector: 'app-lazy',
template: 'very lazy',
styles: []
}]
}], null, null);
`;

expect(testScrubFile(input)).toBeTruthy();
expect(tags.oneLine`${transform(input)}`).toEqual(tags.oneLine`${output}`);
});

it('removes ɵɵsetNgModuleScope call', () => {
const output = tags.stripIndent`
import { CommonModule } from '@angular/common';
import * as i0 from "@angular/core";
${clazz}
`;
const input = tags.stripIndent`
${output}
/*@__PURE__*/ i0.ɵɵsetNgModuleScope(Clazz, { declarations: [], imports: [CommonModule] });
}], null, null); })();
`;

expect(testScrubFile(input)).toBeTruthy();
Expand Down
4 changes: 2 additions & 2 deletions packages/ngtools/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"webpack": "^4.0.0"
},
"devDependencies": {
"@angular/compiler": "9.0.0-rc.2",
"@angular/compiler-cli": "9.0.0-rc.2",
"@angular/compiler": "9.0.0-rc.3",
"@angular/compiler-cli": "9.0.0-rc.3",
"typescript": "3.6.4",
"webpack": "4.41.2"
}
Expand Down
24 changes: 12 additions & 12 deletions tests/legacy-cli/e2e/ng-snapshot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"description": "snapshot versions of Angular for e2e testing",
"private": true,
"dependencies": {
"@angular/animations": "github:angular/animations-builds#e1bc552221367dcb8dd2a02f2e7bf67b33266784",
"@angular/common": "github:angular/common-builds#0de294808227b6936ce128acba8f5b831dca5313",
"@angular/compiler": "github:angular/compiler-builds#fc6c89aa2fd86742066606db67310eb37ada755a",
"@angular/compiler-cli": "github:angular/compiler-cli-builds#6344c50d86c9fc53dfed34621dca6c49f1aa54f0",
"@angular/core": "github:angular/core-builds#6dab5da62cd89d3082cd72c0e4cb3189f99994d4",
"@angular/forms": "github:angular/forms-builds#7487b47bdbc9c5c975f3fb26c9a38c6b8b61e4c3",
"@angular/language-service": "github:angular/language-service-builds#f47b1148343811d4f04c9b103e90e349513a8d8c",
"@angular/localize": "github:angular/localize-builds#7c5087a4e6b521e1d3e93716e6c31aeceaa18d3f",
"@angular/platform-browser": "github:angular/platform-browser-builds#6de9f7ec237e43023cf36bfaad35366a2ac4615c",
"@angular/platform-browser-dynamic": "github:angular/platform-browser-dynamic-builds#2d2a401069cea6c61d55ac4c61e0534c5628883e",
"@angular/platform-server": "github:angular/platform-server-builds#c55cfe4a37ee33fe1cdf028f9bf4b66cfcae8b74",
"@angular/router": "github:angular/router-builds#c8d14d65bec91b873dd4c22a96cb1bccf167c068"
"@angular/animations": "github:angular/animations-builds#17e2261564c9dfda010e53e5370edc4a221e0b24",
"@angular/common": "github:angular/common-builds#1231f1e27d608cc469810396013b44107f827f23",
"@angular/compiler": "github:angular/compiler-builds#125c38a042e9adba4693acaedf5e1c67850adca8",
"@angular/compiler-cli": "github:angular/compiler-cli-builds#6a5dcb38ed2aee4d29ffa07c900eff7ffb97332e",
"@angular/core": "github:angular/core-builds#3264d717f0a85d0563d6a204ba87d0a16e59900c",
"@angular/forms": "github:angular/forms-builds#8c2d00c042f38cd116ed75cda6856e11bd5d0dce",
"@angular/language-service": "github:angular/language-service-builds#2b667b13f57747647a6696d871ef932fcc244aee",
"@angular/localize": "github:angular/localize-builds#d67e30fe38a0867e82c99ee606941d30a400c1e4",
"@angular/platform-browser": "github:angular/platform-browser-builds#8d8cc91e69d6e446ea228bc6a0a794fc029c4421",
"@angular/platform-browser-dynamic": "github:angular/platform-browser-dynamic-builds#272adcc89cf2ca877e5f1c20e4de28c5ceb5c6b2",
"@angular/platform-server": "github:angular/platform-server-builds#272adcc89cf2ca877e5f1c20e4de28c5ceb5c6b2",
"@angular/router": "github:angular/router-builds#96c1644607177f8e325e6a8a5d84152dba90b5c5"
}
}
96 changes: 48 additions & 48 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# yarn lockfile v1


"@angular/animations@9.0.0-rc.2":
version "9.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-9.0.0-rc.2.tgz#14c2e5e69e56dc831ab09f0d1efe54617fd601d8"
integrity sha512-KeqKjO7KKZ0g7rGVT2SLJK0jfbx9Z35SpzOKjtQj87C9BUyjL4sDHKGMoPv9pTjjKNmw3czMMuU8hIWVWNebsg==
"@angular/animations@9.0.0-rc.3":
version "9.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-9.0.0-rc.3.tgz#3a76175ffe78496c67ce5a8ab47f20d5d8b8d98c"
integrity sha512-uTSTQzFfpHQ4JSNV0XQOJu+YWXoYvgQfA/+50/TJhLlpQcSDqEHNw3FdxAOtDha90uZEo0GmOSsUDOUbcF5lzw==

"@angular/cdk@8.2.3":
version "8.2.3"
Expand All @@ -16,15 +16,15 @@
optionalDependencies:
parse5 "^5.0.0"

"@angular/common@9.0.0-rc.2":
version "9.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/common/-/common-9.0.0-rc.2.tgz#9fc66113c2787f34c0be4203e20b9199f672654b"
integrity sha512-6eMQVY8J7aPmACe4knacYZ9Qd+R15M8mgn2WubRQ9yZSOMTo3sIZz8YGATrNcRv8uwvfYpZH77s8Sgj6Hv/qLw==
"@angular/common@9.0.0-rc.3":
version "9.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/common/-/common-9.0.0-rc.3.tgz#06325ec0266f3ddb3c1af20344d03f37520dd54a"
integrity sha512-8X4Lwdg9yZQcZ7y3yZfNuGBILEnTEshYT482v76MLGtqrlUVTt56KJfMa8gM8/ZzUdNgI+5+gfYlvxOT35hqUg==

"@angular/compiler-cli@9.0.0-rc.2":
version "9.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-9.0.0-rc.2.tgz#c8b4821e821c72fcbe8a94a24d23cd8ea2667738"
integrity sha512-zYwoUhm9J1xjnRafn7zXsEV1G4v6nkEtQJY9bZF1ZkLQdDZdWViBcluvlORkmPtoiqhcidrmLdY72ZE6m+AqSw==
"@angular/compiler-cli@9.0.0-rc.3":
version "9.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-9.0.0-rc.3.tgz#b9feb95935327d1a525a56b781246ebf03e95f74"
integrity sha512-G8lzGESy8u18+hh2upR0kpKwDoHEw5DoKp9p2UxrX5HHIOf9TlgPl7xcMSpWji122YYLReT5KRZn1hruTiiUeQ==
dependencies:
canonical-path "1.0.0"
chokidar "^2.1.1"
Expand All @@ -37,25 +37,25 @@
source-map "^0.6.1"
yargs "13.1.0"

"@angular/compiler@9.0.0-rc.2":
version "9.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-9.0.0-rc.2.tgz#7eb594e16a2e0fd007989276c3d2eeb34ea73d92"
integrity sha512-tHIEzOZu1P4JaoWvwQTVvuPnwrXpkC566ZXroqQCNRkGE6r+hrb5cYOvE9T6gcdLmLBekM68xZT69GSKa+yBDQ==
"@angular/compiler@9.0.0-rc.3":
version "9.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-9.0.0-rc.3.tgz#9572c842528b2bd1eb02752e29c4fbca7a9b8183"
integrity sha512-Dpb0onaKyOdOTqS6m5eEUru63SQTgNuWN8PkFf0o2EpEY521uuZFGGckoW0aJbLCNBh/u+XP5MmMWjRTmRbjbw==

"@angular/core@9.0.0-rc.2":
version "9.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-9.0.0-rc.2.tgz#496bb6f4090bc69dd6445469fcd3b898485b83fc"
integrity sha512-6dXu6RB+vozXIuGSf3DYLdq99leUM34nqozxiaeHQFtZbkGQ6AfUnZFMVfLrpoZNSt5TIuEWi/kUNeZ6mkdelg==
"@angular/core@9.0.0-rc.3":
version "9.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-9.0.0-rc.3.tgz#e0fbbacb0624327c78f45e5da5c4c9fb075a18af"
integrity sha512-Yc89CrOGFlBww0PDA5QEQulVyXRd67JVveTWozvIWnk5jZN3YDyNoqU+Fk3ub5rJKcIFhidfR6vly2o+l4OEAg==

"@angular/forms@9.0.0-rc.2":
version "9.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-9.0.0-rc.2.tgz#4df30eb9481990362bd7603a4d52b2cf21dc68e0"
integrity sha512-zNXxmpLxyokteTqVIdHJw4ZB96k6K1NhEXIlhhVlEvdEkaXseJFkGBkbdm3/hNlxgMdXLnHYe7X16Bv2uWvOlA==
"@angular/forms@9.0.0-rc.3":
version "9.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-9.0.0-rc.3.tgz#1aee57e6778eb6ce0f3d2cdc1dad987f0e01e274"
integrity sha512-ZO5l7kyhBLdfECCVNL5pePzPQ10Y79ocMu7QI+SJ93n0bGKhWZIzrrL8+UhhGHeRVXBWvkiwxSuHj9AEZiov8w==

"@angular/localize@9.0.0-rc.2":
version "9.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/localize/-/localize-9.0.0-rc.2.tgz#05ca407e630c2c62b65b6705a68183f67b14655f"
integrity sha512-5onjKG+V3hMyDAIYxsRJSQPhBuI/VJhj1SkloGjXZIsZx6+ySkvTed+JPWRbtNm5k3lTNLKYqQIdb9Dlwpaq2Q==
"@angular/localize@9.0.0-rc.3":
version "9.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/localize/-/localize-9.0.0-rc.3.tgz#763b4ed249d3cbcaf192610c9dd09173e49aaa8d"
integrity sha512-8dr2c4WzxVqZ8jIcQlXm6LfOPqxoRY9+IL2AVxf+4ifmaFrYeQPn9L2/WSN4DjJHA8NhJ8uddR/jAtJgifScXQ==
dependencies:
"@babel/core" "^7.5.5"
glob "7.1.2"
Expand All @@ -68,33 +68,33 @@
dependencies:
tslib "^1.7.1"

"@angular/platform-browser-dynamic@9.0.0-rc.2":
version "9.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-9.0.0-rc.2.tgz#169342adc31d605353b7a6990a55f88a09e22695"
integrity sha512-ornI75qbL8REWuEjwM7i7S56rP8DauWu0/mFYC2VWLv8j+fsw83nF4X1WRsdDQ6UWlscfEOyo550RkKg5LuW2Q==
"@angular/platform-browser-dynamic@9.0.0-rc.3":
version "9.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-9.0.0-rc.3.tgz#d808e716cbb68860bf59d9287e30c68a90f31e23"
integrity sha512-vIAtLqhu1baM9SQBBfkQhECSuEfjc/gpuj7FDtZX/a0dh7Mwa1D1NAyPGK6gPAPbVBSaFD0zGa1zJxpBORRcag==

"@angular/platform-browser@9.0.0-rc.2":
version "9.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-9.0.0-rc.2.tgz#4a2ee8c255d5ba0189c228bfb511c2aa05acf8fa"
integrity sha512-4k0nimptXz2n1ZfhyRndGKpvxDqvEaSwU6vCuOIM2msCd4R9B6oa+Q761jAIj6sSQ8NImEQ/YjNnDAr7GJTCNA==
"@angular/platform-browser@9.0.0-rc.3":
version "9.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-9.0.0-rc.3.tgz#1213c1e1cf50694d66fbfa5cf77c5ac8579b5438"
integrity sha512-RXDmOYUhI2CQtWWhDgKSMHHfBSD3t5RpJe+lAQOtzEMG05jDoaM3NJVhI5ccTVDyP2H/g6mOMHYDXmOk1idT7g==

"@angular/platform-server@9.0.0-rc.2":
version "9.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/platform-server/-/platform-server-9.0.0-rc.2.tgz#654139ad829f37c899f8ef911c000720d0cb5421"
integrity sha512-hLedw548a+xcwudBBmsWxMF/4M2ZVk7wHVj+kfr7vk+H1/lUe5404tEOlmsU5Gm1vS6xjtecjbbi8snOIE+cWA==
"@angular/platform-server@9.0.0-rc.3":
version "9.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/platform-server/-/platform-server-9.0.0-rc.3.tgz#c30223bc3ad0bdc273eaf7e25a7ad5992886ba14"
integrity sha512-VZtJZI5l13K6r7CUSE4npkcgNLJJvms2O2upXOheF+GMY/6mk+7+ID05TTbEy0EcohtAbsVD3OZqTM3wzlV8Cg==
dependencies:
domino "^2.1.2"
xhr2 "^0.1.4"

"@angular/router@9.0.0-rc.2":
version "9.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/router/-/router-9.0.0-rc.2.tgz#2c9bc6f6d9648959a051c0a3ba8d07ffbb6dfff9"
integrity sha512-cusnwp2+o0bZz1XyzmtQCfS2pJEughZUwpUuTyuoMzqNcyM4ACFDgXSeOtp3VtoPvgB6p2hu8B/KeU7Bkz9/OQ==
"@angular/router@9.0.0-rc.3":
version "9.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/router/-/router-9.0.0-rc.3.tgz#caad9579aa3699f3b9da9ba6477be05379b66ddb"
integrity sha512-CigHxXbsY5LG/K8wBn37qR9mTyB2cNnO6T5Yez1ZzRc+L4ZesryEsj3rfUIR4sZJUeoGPBcPP48qL2t1YBcJvw==

"@angular/service-worker@9.0.0-rc.2":
version "9.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-9.0.0-rc.2.tgz#a561c28b1da64041571e8d0417845a0661794a34"
integrity sha512-cg3W3+HMmtZgOgWG6cjJosdDCF4YFZeyhFRcrMxDsHnLjK4UGH7/CSvwg/KOFACm9DdpnZVP0S1QbGRAQGDISw==
"@angular/service-worker@9.0.0-rc.3":
version "9.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-9.0.0-rc.3.tgz#3a3d01b280ec71b6e22ee35d541567d8aca18102"
integrity sha512-6qOZCV0CY6lFvq09HrODHxnbeUN8JeolcpWwDL2RwDZDpwZF2mHlDFZqCZ8zsUrC32dHtofUAVIEjWaht0WnWg==

"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5":
version "7.5.5"
Expand Down