Files
kotlin-fork/compiler/testData/cli/js/jsExtraHelp.out
T
Alexander Korepanov 79d378f2bd [JS IR] Perform optimizations on the generated JS code
The patch adopts and reuses the optimizations from the legacy backend.

The optimizations remove useless temporary variables,
statements and simplify generated JS code.

The optimizations can be disabled by `-Xoptimize-generated-js=false`.

Related to KT-51139
2023-04-18 12:49:33 +00:00

139 lines
11 KiB
Plaintext
Vendored

Usage: kotlinc-js <options> <source files>
where advanced options include:
-Xcache-directory=<path> A path to cache directory
-Xenable-js-scripting Enable experimental support of .kts files using K/JS (with -Xir only)
-Xerror-tolerance-policy Set up error tolerance policy (NONE, SEMANTIC, SYNTAX, ALL)
-Xenable-extension-functions-in-externals
Enable extensions functions members in external interfaces
-Xfake-override-validator Enable IR fake override validator
-Xforce-deprecated-legacy-compiler-usage
The flag is used only for our inner infrastructure. It will be removed soon, so it's unsafe to use it nowadays.
-Xfriend-modules=<path> Paths to friend modules
-Xfriend-modules-disabled Disable internal declaration export
-Xgenerate-dts Generate TypeScript declarations .d.ts file alongside JS file. Available in IR backend only.
-Xgenerate-polyfills Generate polyfills for features from the ES6+ standards.
-Xinclude=<path> A path to an intermediate library that should be processed in the same manner as source files.
-Xir-base-class-in-metadata Write base class into metadata
-Xir-build-cache Use compiler to build cache
-Xir-dce Perform experimental dead code elimination
-Xir-dce-print-reachability-info
Print declarations' reachability info to stdout during performing DCE
-Xir-dce-runtime-diagnostic={log|exception}
Enable runtime diagnostics when performing DCE instead of removing declarations
-Xir-generate-inline-anonymous-functions
Lambda expressions that capture values are translated into in-line anonymous JavaScript functions
-Xir-keep Comma-separated list of fully-qualified names to not be eliminated by DCE (if it can be reached), and for which to keep non-minified names.
-Xir-minimized-member-names Perform minimization for names of members
-Xir-module-name=<name> Specify a compilation module name for IR backend
-Xir-new-ir2js New fragment-based ir2js
-Xir-only Disables pre-IR backend
-Xir-per-file Splits generated .js per-file
-Xir-per-module Splits generated .js per-module
-Xir-per-module-output-name Adds a custom output name to the splitted js files
-Xir-produce-js Generates JS file using IR backend. Also disables pre-IR backend
-Xir-produce-klib-dir Generate unpacked KLIB into parent directory of output JS file.
In combination with -meta-info generates both IR and pre-IR versions of library.
-Xir-produce-klib-file Generate packed klib into file specified by -output. Disables pre-IR backend
-Xir-property-lazy-initialization
Perform lazy initialization for properties
-Xir-safe-external-boolean Safe access via Boolean() to Boolean properties in externals to safely cast falsy values.
-Xir-safe-external-boolean-diagnostic={log|exception}
Enable runtime diagnostics when access safely to boolean in external declarations
-Xmetadata-only Generate *.meta.js and *.kjsm files only
-Xoptimize-generated-js Perform additional optimizations on the generated JS code
-Xpartial-linkage-loglevel={info|warning|error}
Partial linkage compile-time log level
-Xpartial-linkage={enable|disable}
Use partial linkage mode
-Xstrict-implicit-export-types Generate strict types for implicitly exported entities inside d.ts files. Available in IR backend only.
-Xtyped-arrays Translate primitive arrays to JS typed arrays
-Xes-classes Generated JavaScript will use ES2015 classes.
-Xwasm Use experimental WebAssembly compiler backend
-Xwasm-debug-info Add debug info to WebAssembly compiled module
-Xwasm-enable-array-range-checks
Turn on range checks for the array access functions
-Xwasm-enable-asserts Turn on asserts
-Xwasm-generate-wat Generate wat file
-Xwasm-kclass-fqn Enable support for FQ names in KClass
-Xallow-any-scripts-in-source-roots
Allow to compile any scripts along with regular Kotlin sources
-Xallow-kotlin-package Allow compiling code in package 'kotlin' and allow not requiring kotlin.stdlib in module-info
-Xallow-result-return-type Allow compiling code when `kotlin.Result` is used as a return type
-Xbuiltins-from-sources Compile builtIns from sources
-Xcheck-phase-conditions Check pre- and postconditions on phases
-Xcheck-sticky-phase-conditions
Run sticky condition checks on subsequent phases as well. Implies -Xcheck-phase-conditions
-Xcommon-sources=<path> Sources of the common module that need to be compiled together with this module in the multi-platform mode.
Should be a subset of sources passed as free arguments
-Xcontext-receivers Enable experimental context receivers
-Xdisable-default-scripting-plugin
Do not enable scripting plugin by default
-Xdisable-phases Disable backend phases
-Xdisable-ultra-light-classes Do not use the ultra light classes implementation
-Xdump-directory Dump backend state into directory
-Xdump-fqname FqName of declaration that should be dumped
-Xdump-perf=<path> Dump detailed performance statistics to the specified file
-Xeffect-system Enable experimental language feature: effect system
-Xenable-builder-inference Use the builder inference by default, for all calls with lambdas which can't be resolved without it.
The corresponding calls' declarations may not be marked with @BuilderInference.
-Xklib-enable-signature-clash-checks
Enable the checks on uniqueness of signatures
-Xexpect-actual-linker Enable experimental expect/actual linker
-Xexplicit-api={strict|warning|disable}
Force compiler to report errors on all public API declarations without explicit visibility or return type.
Use 'warning' level to issue warnings instead of errors.
-Xextended-compiler-checks Enable additional compiler checks that might provide verbose diagnostic information for certain errors.
Warning: this mode is not backward-compatible and might cause compilation errors in previously compiled code.
-Xfragment-refines=<fromModuleName>:<onModuleName>
Declares that <fromModuleName> refines <onModuleName> with dependsOn/refines relation
-Xfragment-sources=<fragment name>:<path>
Adds sources to a specific fragment of a multiplatform compilation
-Xfragments=<fragment name> Declares all known fragments of a multiplatform compilation
-Xignore-const-optimization-errors
Ignore all compilation exceptions while optimizing some constant expressions.
-Xenable-incremental-compilation
Enable incremental compilation
-Xinference-compatibility Enable compatibility changes for generic type inference algorithm
-Xinline-classes Enable experimental inline classes
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
-Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block
-Xlist-phases List backend phases
-Xmetadata-version Change metadata version of the generated binary files
-Xmulti-platform Enable experimental language support for multi-platform projects
-Xnew-inference Enable new experimental generic type inference algorithm
-Xno-check-actual Do not check presence of 'actual' modifier in multi-platform projects
-Xno-inline Disable method inlining
-Xklib-normalize-absolute-path Normalize absolute paths in klibs
-Xphases-to-dump Dump backend state both before and after these phases
-Xphases-to-dump-after Dump backend state after these phases
-Xphases-to-dump-before Dump backend state before these phases
-Xphases-to-validate Validate backend state both before and after these phases
-Xphases-to-validate-after Validate backend state after these phases
-Xphases-to-validate-before Validate backend state before these phases
-Xplugin=<path> Load plugins from the given classpath
-Xcompiler-plugin=<path1>,<path2>:<optionName>=<value>,<optionName>=<value>
Register compiler plugin
-Xprofile-phases Profile backend phases
-Xproper-ieee754-comparisons Generate proper IEEE 754 comparisons in all cases if values are statically known to be of primitive numeric types
-Xread-deserialized-contracts Enable reading of contracts from metadata
-Xklib-relative-path-base Provide a base paths to compute source's relative paths in klib (default is empty)
-Xrender-internal-diagnostic-names
Render internal names of warnings and errors
-Xreport-output-files Report source to output files mapping
-Xreport-perf Report detailed performance statistics
-Xself-upper-bound-inference Support inferring type arguments based on only self upper bounds of the corresponding type parameters
-Xskip-metadata-version-check Allow to load classes with bad metadata version and pre-release classes
-Xskip-prerelease-check Allow to load pre-release classes
-Xsuppress-version-warnings Suppress warnings about outdated, inconsistent or experimental language or API versions
-Xunrestricted-builder-inference
Eliminate builder inference restrictions like allowance of returning type variables of a builder inference call
-Xuse-fir-extended-checkers Use extended analysis mode based on Front-end IR. Warning: this feature is far from being production-ready
-Xuse-fir-ic Compile using Front-end IR internal incremental compilation cycle. Warning: this feature is far from being production-ready
-Xuse-fir-lt Compile using LightTree parser with Front-end IR. Warning: this feature is far from being production-ready
-Xuse-k2 Compile using experimental K2. K2 is a new compiler pipeline, no compatibility guarantees are yet provided
-Xuse-mixed-named-arguments Enable Support named arguments in their own position even if the result appears as mixed
-Xverbose-phases Be verbose while performing these backend phases
Advanced options are non-standard and may be changed or removed without any notice.
OK