Closed DartBot closed 9 years ago
Comment by nex3
Unfortunately, this restriction is pretty important. Pub makes a lot of assumptions that the publicly-accessible files in your package are exactly those in lib/. These assumptions are necessary for performance, since listing and loading the contents of every file in every dependency can be extremely painful, and for correctness, since users may not want or expect their transformers to run on files outside lib (or web/ or bin/, if they're using serve, build, and/or run).
Added NotPlanned label.
Comment by seaneagan
I see there is a $include configuration that can be passed to a transformer in the pubspec. Why not let $include refer to files at the top-level:
transformers: copy_to_lib: $include: pubspec.yaml
Comment by nex3
Although semantically that may work, there are a lot of technological issues. Pub has a lot of logic that assumes a certain set of directories to be relevant, and that filters down to stuff like directory watching and publishing in complex ways.
We do want to find a way to provide packages' versions to the program, but I don't think this is how we'll do it.
Issue by seaneagan Originally opened as dart-lang/sdk#19434
I'd like to write a transformer to copy a package's "pubspec.yaml" to a sub-directory (e.g. "lib") that's available when running pub serve/build/run/issue dart-lang/pub#970, but from:
https://www.dartlang.org/tools/pub/assets-and-transformers.html
"An asset can be in any root level directory of your package"
So I assume that means source assets cannot be at the top-level as "pubspec.yaml" is.
Can that restriction be relaxed?