Created
October 20, 2023 09:28
-
-
Save v6ak/c00dc292ae4faf93c8013ceb3fb8c5da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# safety settings | |
set -u | |
set -e | |
set -o pipefail | |
function run { | |
version="$1" | |
if [ "$version" == "" ]; then | |
version_spec="" | |
version_human="the newest version" | |
else | |
version_spec="@$version" | |
version_human="$version" | |
fi | |
echo "Running for $version_human" | |
npx google-closure-compiler$version_spec \ | |
-O ADVANCED \ | |
--language_in=ES_NEXT \ | |
--module_resolution=NODE \ | |
--dependency_mode=PRUNE \ | |
main.js some-module.js \ | |
--entry_point main.js \ | |
> opt$version_spec.js | |
echo "DONE: opt$version_spec.js ($version_human)" | |
} | |
if [ $# == 0 ]; then | |
# Run in the newest version + version currently used in Scala.js | |
for version_spec in "" v20220202; do | |
run "$version_spec" | |
done | |
else | |
# Run in the specified versions | |
for version_spec in "$@"; do | |
run "$version_spec" | |
done | |
fi | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as foo from "./some-module.js"; | |
foo["bar"](); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 | |
~/cloco-imports (1 bg job)% ./compile.sh "" | |
Running for the newest version | |
java.lang.NullPointerException: NAME foo 3:0 [length: 3] [source_file: main.js] : Color{id=0, prototypes=[], instanceColors=[], invalidating=true, propertiesKeepOriginalName=false, constructor=false, ownProperties=[], boxId=null, closureAssert=false, unionElements=[]} | |
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:907) | |
at com.google.javascript.jscomp.RemoveUnusedCode.getVarForNameNode(RemoveUnusedCode.java:858) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNameNode(RemoveUnusedCode.java:711) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNode(RemoveUnusedCode.java:535) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren(RemoveUnusedCode.java:1262) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNode(RemoveUnusedCode.java:547) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren(RemoveUnusedCode.java:1262) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseCall(RemoveUnusedCode.java:769) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNode(RemoveUnusedCode.java:463) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren(RemoveUnusedCode.java:1262) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNode(RemoveUnusedCode.java:547) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren(RemoveUnusedCode.java:1262) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNode(RemoveUnusedCode.java:547) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren(RemoveUnusedCode.java:1262) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNode(RemoveUnusedCode.java:547) | |
at com.google.javascript.jscomp.RemoveUnusedCode$Continuation.apply(RemoveUnusedCode.java:1776) | |
at com.google.javascript.jscomp.RemoveUnusedCode.traverseAndRemoveUnusedReferences(RemoveUnusedCode.java:378) | |
at com.google.javascript.jscomp.RemoveUnusedCode.process(RemoveUnusedCode.java:352) | |
at com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process(PhaseOptimizer.java:240) | |
at com.google.javascript.jscomp.PhaseOptimizer.process(PhaseOptimizer.java:179) | |
at com.google.javascript.jscomp.Compiler.performTranspilationAndOptimizations(Compiler.java:2969) | |
at com.google.javascript.jscomp.Compiler.lambda$stage2Passes$7(Compiler.java:1031) | |
at com.google.javascript.jscomp.CompilerExecutor.lambda$runInCompilerThread$0(CompilerExecutor.java:100) | |
at [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:264) | |
at [email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) | |
at [email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) | |
at [email protected]/java.lang.Thread.run(Thread.java:833) | |
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775) | |
at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @nocompile */ | |
function xxx(){} | |
/** @type {Object} */ | |
var x; | |
//export { xxx as bar }; | |
export default x; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment