-
Notifications
You must be signed in to change notification settings - Fork 34
[interop] Add support for importing and exporting declarations, as well as multi-file output #418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nikeokoronkwo
wants to merge
14
commits into
dart-lang:main
Choose a base branch
from
nikeokoronkwo:interop/import-export
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[interop] Add support for importing and exporting declarations, as well as multi-file output #418
nikeokoronkwo
wants to merge
14
commits into
dart-lang:main
from
nikeokoronkwo:interop/import-export
Conversation
This file contains hidden or 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
# Conflicts: # web_generator/lib/src/interop_gen/transform/transformer.dart # web_generator/lib/src/js/typescript.types.dart
- added import support - added gen of code inside file in the case of non multi-import - added support for multiple file generation - using `TransformManager` for managing transformation of code
# Conflicts: # web_generator/lib/src/ast/declarations.dart # web_generator/lib/src/interop_gen/transform.dart # web_generator/lib/src/interop_gen/transform/transformer.dart # web_generator/lib/src/js/typescript.types.dart
srujzs
reviewed
Jul 22, 2025
web_generator/test/integration/interop_gen/project/input/a.d.ts
Outdated
Show resolved
Hide resolved
web_generator/test/integration/interop_gen/import_export_input.d.ts
Outdated
Show resolved
Hide resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #378
Fixes #387
This PR is for adding support for multiple file processing, with support for exporting and importing declarations even between files.
It makes use of a
TransformManager
which transforms various files and uses aProgramMap
to memoize and keep track of dependencies across files, which helps in reducing expensive transform calls to declarations already referenced from other files.The type checker helps to resolve types and imports, as well as resolve import declarations. Import declarations are not parsed by default so that we know we are only making use of imports actually referenced in code (which is helpful in single outputs for instance).
(The program map makes use of
package:path
sPathMap
to easily work with paths for files and declarations, as the TS output may resolve either to a relative import in the file, or may reference the declaration externally as an absolute path).Imported declarations are declared as
ReferredType
s with aurl
property, which allows for referencing the normalExports are rewritten based on how they are specified, and are processed after transformation (since they are separate declarations and may be referenced as they are.
Imports are processed depending on the presence of the file:
TODOs