Open srawlins opened 4 years ago
We do not plan to make any new APIs available for parsing .packages
files. That is not a goal for this package. The support we do have for reading .packages
files is temporary.
We will stop supporting .packages
files as soon as possible since they cannot support language versioning and therefore not support null safety.
We could potentially expose the "parse-any" function, and not promise to keep supporting .packages
, but since that's what you are going to use it for exclusively, it doesn't seem to be what you need.
If you need to support parsing .packages
files, I recommend copying the code instead.
I think that @srawlins was looking for a synchronous way of parsing the new package config format?
The code that was changed was only reading the old .packages
format, so providing a synchronous way to read the new format will not help here. Providing API to just read the old format is a non-goal.
We also decided early on to not have synchronous APIs for I/O.
A general synchronous parseConfigurationFile
function might make sense.
It'll be taking a Uint8List
in UTF-8 format as input (because that's what we have).
It can perhaps be available as a static PackageConfig.parseFile()
.
It's not intended as a long-term support for .packages
, but then, the analyzer shouldn't need it forever either.
Migrating from all of the deprecated APIs/libraries (like
packages_file.parse
) to supported ones (likepackage_config_discovery.loadPackageConfigUri
) currently requires a change to asynchronous code.I'd like to use the internal synchronous functions, like
lib/src/package_config_io.dart
'sparseAnyConfigFile
, as it is synchronous, and the publicloadPackageConfigUri
is more-or-less an asynchronous wrapper around it.