Upgrade Closure Compiler (#19041)

The Symbol bug has now been fixed so we can remove the hack that renames
the global variable.
This commit is contained in:
Sebastian Markbåge
2020-05-29 09:17:14 -07:00
committed by GitHub
parent 6d375f3078
commit c03b8661a9
3 changed files with 32 additions and 44 deletions

View File

@@ -61,7 +61,7 @@
"flow-bin": "0.97",
"glob": "^7.1.6",
"glob-stream": "^6.1.0",
"google-closure-compiler": "^20200224.0.0",
"google-closure-compiler": "^20200517.0.0",
"gzip-size": "^5.1.1",
"jasmine-check": "^1.0.0-rc.0",
"jest": "^25.2.7",

View File

@@ -19,16 +19,6 @@ function compile(flags) {
});
}
function encodeNativeCalls(code) {
// Closure Compiler tries to install a polyfill if we reference the Symbol global.
// We need to temporarily trick Closure that it's not the built-in it's looking for.
return code.replace(/Symbol/g, 'SymbolTmp');
}
function decodeNativeCalls(code) {
return code.replace(/SymbolTmp/g, 'Symbol');
}
module.exports = function closure(flags = {}) {
return {
name: 'scripts/rollup/plugins/closure-plugin',
@@ -36,12 +26,10 @@ module.exports = function closure(flags = {}) {
const inputFile = tmp.fileSync();
const tempPath = inputFile.name;
flags = Object.assign({}, flags, {js: tempPath});
const filteredCode = encodeNativeCalls(code);
await writeFileAsync(tempPath, filteredCode, 'utf8');
await writeFileAsync(tempPath, code, 'utf8');
const compiledCode = await compile(flags);
inputFile.removeCallback();
const decodedCode = decodeNativeCalls(compiledCode);
return {code: decodedCode};
return {code: compiledCode};
},
};
};

View File

@@ -6382,46 +6382,46 @@ globby@^6.1.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"
google-closure-compiler-java@^20200224.0.0:
version "20200224.0.0"
resolved "https://registry.yarnpkg.com/google-closure-compiler-java/-/google-closure-compiler-java-20200224.0.0.tgz#03d71aefd0a07010fd8a7057d09c76f6729767bc"
integrity sha512-palFcDoScauZjWIsGDzMK6h+IctcRb55I3wJX8Ko/DTSz72xwadRdKm0lGt8OoYL7SKEO+IjgD7s8XrAGpLnlQ==
google-closure-compiler-java@^20200517.0.0:
version "20200517.0.0"
resolved "https://registry.yarnpkg.com/google-closure-compiler-java/-/google-closure-compiler-java-20200517.0.0.tgz#778370c22273c9085f4cf959ce063f8f112c02ac"
integrity sha512-JVZBiyyXwcYi6Yc3lO6dF2hMLJA4OzPm4/mgsem/tF1vk2HsWTnL3GTaBsPB2ENVZp0hoqsd4KgpPiG9ssNWxw==
google-closure-compiler-js@^20200224.0.0:
version "20200224.0.0"
resolved "https://registry.yarnpkg.com/google-closure-compiler-js/-/google-closure-compiler-js-20200224.0.0.tgz#cf4b598abf7be686c683e530529756805b8af500"
integrity sha512-70VKN0kbnTRtu2dqxDjWZQGfEQIHj7b7oUUCsYPO5oEXCDfgxNc13oYUJXvrTONLRWlHCNl/I8FNrVOwZ3gY/g==
google-closure-compiler-js@^20200517.0.0:
version "20200517.0.0"
resolved "https://registry.yarnpkg.com/google-closure-compiler-js/-/google-closure-compiler-js-20200517.0.0.tgz#9cb0861f764073d1c4d3b7453b74073ccb1ecfb1"
integrity sha512-dz6dOUHx5nhdIqMRXacAYS8aJfLvw4IKxGg28Hq/zeeDPHlX3P3iBK20NgFDfT8zdushThymtMqChSy7C5eyfA==
google-closure-compiler-linux@^20200224.0.0:
version "20200224.0.0"
resolved "https://registry.yarnpkg.com/google-closure-compiler-linux/-/google-closure-compiler-linux-20200224.0.0.tgz#d9608b224b4d8f38d4d34e99a24da54bca6b1902"
integrity sha512-/BaE889EPrXWOKJVolA9++e99xBDMzeFBf7zF7nBB8PUmU5DlvtsoLL82xnT6nbZC1ktHaETlVx+vYGju8zKBQ==
google-closure-compiler-linux@^20200517.0.0:
version "20200517.0.0"
resolved "https://registry.yarnpkg.com/google-closure-compiler-linux/-/google-closure-compiler-linux-20200517.0.0.tgz#2b9ecb634130060174aff5c52329a694ea4be68b"
integrity sha512-S5xPh6TtP+ESzZrmQLcDDqtZAsCVTbdI4VS98wQlN6IMZTd94nAnOCg9mrxQNAgop2t4sdsv/KuH0BGPUWEZ+w==
google-closure-compiler-osx@^20200224.0.0:
version "20200224.0.0"
resolved "https://registry.yarnpkg.com/google-closure-compiler-osx/-/google-closure-compiler-osx-20200224.0.0.tgz#aee62d8b878a662fc73b92419603168c0c3a35ed"
integrity sha512-WXVNW9nPUqjvCe38mUIlBGEPVPCTKLtdaXC+q+kQdonkJFHNrpdyYWa746Y8cNP/byQyDNpPsqcKseZTLh17sQ==
google-closure-compiler-osx@^20200517.0.0:
version "20200517.0.0"
resolved "https://registry.yarnpkg.com/google-closure-compiler-osx/-/google-closure-compiler-osx-20200517.0.0.tgz#9394e9a2fd97e3729fc3bd2abcffff6aab2cfcaa"
integrity sha512-FWIcsKqLllLjdOBZd7azijVaObydgRd0obVNi63eUfC5MX6T4qxKumGCyor2UCNY6by2ESz+PlGqCFzFhZ6b2g==
google-closure-compiler-windows@^20200224.0.0:
version "20200224.0.0"
resolved "https://registry.yarnpkg.com/google-closure-compiler-windows/-/google-closure-compiler-windows-20200224.0.0.tgz#cae323b898625ca57b0e87aaddde021a414dda58"
integrity sha512-l6w2D8r9+GC9CQTAYEMAuNI996Zb6YV5qG7+FR0gCoL6h6S3Mc7mi87bafgwaicsVcmmHE/9kCBuW4ZyTMs5Fg==
google-closure-compiler-windows@^20200517.0.0:
version "20200517.0.0"
resolved "https://registry.yarnpkg.com/google-closure-compiler-windows/-/google-closure-compiler-windows-20200517.0.0.tgz#c5cdde438c29458666a83358567b12072924ed6c"
integrity sha512-UXhjRGwS8deTkRla/riyVq3psscgMuw78lepEPtq5NgbumgJzY2+IQP9q+4MVOfJW58Rv0JUWKAFOnBBSZWcAQ==
google-closure-compiler@^20200224.0.0:
version "20200224.0.0"
resolved "https://registry.yarnpkg.com/google-closure-compiler/-/google-closure-compiler-20200224.0.0.tgz#ec0e708d9716a48e12fff43fe37fa5cec732a283"
integrity sha512-V81dRYygdHbZtOtU16VX26xAdJBB1UZyfSg3OTzdNl3l/xEIx1D/L7TYUqjeTXsxcy+JruJ/UfUlIJAOaMRTog==
google-closure-compiler@^20200517.0.0:
version "20200517.0.0"
resolved "https://registry.yarnpkg.com/google-closure-compiler/-/google-closure-compiler-20200517.0.0.tgz#6c47f99fc1be59bd4f9e23c5a8f2e66d64b54143"
integrity sha512-80W9zBS9Ajk1T5InWCfsoPohDmo5T1AAyw1rHh5+dgb/jPgwC65KhY+oJozTncf+/7tyQHJXozTARwhSlBUcMg==
dependencies:
chalk "2.x"
google-closure-compiler-java "^20200224.0.0"
google-closure-compiler-js "^20200224.0.0"
google-closure-compiler-java "^20200517.0.0"
google-closure-compiler-js "^20200517.0.0"
minimist "1.x"
vinyl "2.x"
vinyl-sourcemaps-apply "^0.2.0"
optionalDependencies:
google-closure-compiler-linux "^20200224.0.0"
google-closure-compiler-osx "^20200224.0.0"
google-closure-compiler-windows "^20200224.0.0"
google-closure-compiler-linux "^20200517.0.0"
google-closure-compiler-osx "^20200517.0.0"
google-closure-compiler-windows "^20200517.0.0"
got@^6.7.1:
version "6.7.1"