dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.2k stars 1.57k forks source link

dart compile should have an option to use ddc (Dart Development Compiler) #56877

Open a-siva opened 1 week ago

a-siva commented 1 week ago

The 'compile' command in dart cli uses the production compiler dart2js to compile Dart files to JS when the 'js' option is used. TO be consistent we need another option to allow users to specify that ddc the dart Development Compiler should be used to generate the JS file.

// cc @bkonyi

a-siva commented 1 week ago

Adding comment from @nshahan here

we don't really expect end users to run DDC outside of a build system, but it would be nice to shield ourselves from extra work when we make changes like this. Depending on how the flag piping is implemented in the cli we could add a hidden flag like dart compile js --js-dev-unsupported-compilerand parse it in the cli but pass the rest of the flags through to the compilers.

natebosch commented 1 week ago

The main reason we needed DDC out of the public API for the SDK was to allow changes to it's arguments and requirements without a breaking SDK change. Things might be more stable now, but we also don't plan to document it's behavior in a way that would make it useful to typical customers of the SDK. I think hiding it behind a flag that we don't advertise and includes "unsupported" or similar wording is a good idea and mitigates the concerns I have exposing it.