closure-compiler
closure-compiler copied to clipboard
A JavaScript checker and optimizer.
The following code, [when compiled with `CHECK_REQUIRES`, produces a `JSC_MISSING_REQUIRE_IN_PROVIDES_FILE` warning](https://closure-compiler-debugger.appspot.com/#input0%3Dgoog.provide('Interface')%253B%250A%250A%252F**%2520%2540interface%2520*%252F%250AInterface%2520%253D%2520function()%2520%257B%257D%253B%250A%26input1%3Dgoog.requireType('Interface')%253B%250A%250A%252F**%2520%2540constructor%2520%2540implements%2520%257BInterface%257D%2520*%252F%250Afunction%2520Implementation()%2520%257B%257D%250A%26conformanceConfig%26externs%26refasterjs-template%26CHECK_TYPES%3Dtrue%26REWRITE_MODULES_BEFORE_TYPECHECKING%3Dtrue%26CHECK_REQUIRES%3Dtrue%26CLOSURE_PASS%3Dtrue%26PRESERVE_TYPE_ANNOTATIONS%3Dtrue%26PRETTY_PRINT%3Dtrue): Parent: ```JS goog.provide('Interface'); /** @interface */ Interface = function() {}; ``` Child: ``` goog.requireType('Interface'); /** @constructor @implements {Interface} */...
``` // a.js import * as b from './b.js'; console.log(b.x); ``` ``` // b.js const x = /\/*/; export { x }; ``` ``` java -jar compiler.jar \ --compilation_level=ADVANCED \...
Sample input code: ```js (async function(){})() ``` Expected output: it compiles Actual output: ``` liam$ java -jar /usr/lib/node_modules/google-closure-compiler/compiler.jar --inject_libraries=false
Currently, [eval](https://github.com/google/closure-compiler/blob/3aaf3475128e8f7e398a42b3400256aee4870bbe/externs/es3.js#L383) only support string type as an argument. However, Chrome added support for [Trusted Types](https://web.dev/trusted-types/) in Chrome 83, which makes TrustedScript type as a valid argument to eval.
Currently there is no simple way to annotate destructured array parameters. I propose a syntax similar to the current destructured objects syntax: ``` javascript /** * @param {[x: number, y:...
a.js ```js goog.module('a'); import('./b.js').then(out => { console.log(out.b); }); ``` b.js ```js goog.module('b'); /** @type {number} */ exports.b = 1; ``` compiler flags ``` --language_in=ECMASCRIPT_2020 --language_out=ECMASCRIPT_2020 --chunk_output_type=ES_MODULES --emit_use_strict=false --js=b.js --chunk=b_out:1 --js=a.js...
I'm getting the following error when trying to use the MediaQueryListEvent type: **WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type MediaQueryListEvent** Code: ``` /** * Handle MediaQueryList change event *...
I am trying to build the latest code from github on Ubuntu 20.04, and get the following error. ``` $ bazelisk build :all .... INFO: Analyzed 424 targets (0 packages...
Hello, as `Array.prototype.push()` has the option to push more than one element at a time, I think it would be a good option to let closure compiler know this, to...
Hello, as closure compiler optimizes for a good gzip compression ratio and a trivial benchmark revealed a 28x performance increase on v8 and couple percent on Firefox by replacing ```...