DDC interop: allow me to control which APIs are exported from a module #27692
Labels
area-web-js
Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.
customer-dart-sass
type-enhancement
A request for a change that isn't a bug
web-js-interop
Issues that impact all js interop
When I'm using DDC to compile a module for use as a JavaScript module, I want to be able to control exactly what API is exposed, just as I would be able to if I were writing JavaScript natively. I don't want to expose all Dart types and fields that are transitively used by my module.
I propose that a flag,
--entrypoint-only
be added to DDC. This flag causes the generated module to export only those names that are exported by the Dart library(s) passed directly to the dev compiler, without any extra prefixes. It could also cause the compiler not to emit a summary file, since this JS module won't be able to be imported by other DDC-generated modules.For example, consider the following two files:
Currently,
dartdevc --modules es6 -o test1.dart.js test1.dart
emitsI'd like
dartdevc --modules es6 -o test1.dart.js --entrypoint-only test1.dart
to emit something like:The text was updated successfully, but these errors were encountered: