-
Notifications
You must be signed in to change notification settings - Fork 50
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
[native_assets_cli] Reduce number of visible libraries in package #1805
Comments
There should be no library that's "public" and at the same time "internal". It doesn't make any sense. What used to be The split of the old library structure into The separation between The The reason for re-exports is that we should make things as easy for hook writer as we can, we should not force them to import So in short: This library structure is showing the layering of the system: a base layer, code & data assets layered on top and cross-cutting concerns (bundling tool functionality, test functionality). (We can probably get rid of the Regarding the API doc generator: There's many improvements that could be made to it (e.g. for every class's api docs shows all inherited members e.g. |
Given the size of this package the large number of public libraries is a little confusing. I'd suggest either:
|
Also hook helper packages such as We have three sets of users of this package.
And then the first two sets of users are split again in:
That already creates 7 libraries. And then we also split the I'd really like to bring this number down.
Yes, let's remove it. I wonder if we can do anything to bring the 7 down further. Or if we can do anything to clarify for users what they should be importing. Maybe it should be spelled out in the library doc comments: /// xxx
///
/// If you are a xxx, you should be importing xxx instead
library; I'd still leaning towards hiding the APIs for the very rare use case of writing an embedder. I don't like regressing the experience for ~1000 users to cater for <10.
I agree that the concepts are decoupled. I don't agree it's good for users to have them as separate imports. Theoretically speaking package test could ship without support for common matchers, it's up to the users to decide what matchers to import. Different types of matchers are different concepts. But in practice users are happy to have all the matchers imported. Batteries included. |
Having them as separate packages will also serve another use: If we use the package's SDK constraint as a way to version the protocol extensions. So by having |
Can you elaborate on this idea? We explored using SDK constraints before and ran into issues due to the SDK constraint of helper packages being able to be lower than the root package (#93). Doing it per asset type (per protocol extension) will not change that? Maybe just reopen that issue for elaborating on the idea. (Or are you talking about doing breaking changes to the Dart API of protocol extensions?) |
https://pub.dev/documentation/native_assets_cli/latest/ has many libraries, which is quite confusing for users, especially because they re-export the same things over and over again.
All libraries that are internal should not generate docs. @mkustermann Any reason why the
pkgs/native_assets_cli/lib/native_assets_cli_internal.dart
ones show up in the docs again? The oneinternal
was hidden before your refactoring with/// @nodoc
. See https://pub.dev/documentation/native_assets_cli/0.8.0/. (Also, why did the rest of the doc comment disappear?)Conceivably we need these to be public:
pkgs/native_assets_cli/lib/native_assets_cli.dart
(or maybe not, maybe these types should all be only re-exported in the individual asset exports?)pkgs/native_assets_cli/lib/code_assets.dart
pkgs/native_assets_cli/lib/code_assets_testing.dart
pkgs/native_assets_cli/lib/data_assets.dart
@mkustermann would like to really separate all the asset types and have separate imports for the separate asset types. However the downside is that now all classes show up in multiple libraries. We should consider:
pkgs/native_assets_cli/lib/code_assets.dart
andpkgs/native_assets_cli/lib/native_assets_cli.dart
to write a hook.pkgs/native_assets_cli/lib/native_assets_cli.dart
, a single library for users. (And maybe a second one for testing.)Maybe @devoncarew and @mosuem Can give some guidance on best practises when trying to expose parts of packages via multiple libraries.
Another thing that is annoying with having separate imports and having extension types is that the IDE doesn't autocomplete the methods added in extension types in other imports, which hurts discoverability. This pushes towards option 2. (But doesn't fix discoverability issues with discoverability for extensions added in other packages. So it makes
DataAsset
s andCodeAsset
s more privileged than other asset types.The text was updated successfully, but these errors were encountered: