dart-archive / barback

An asset build system for Dart.
https://pub.dartlang.org/packages/barback
BSD 3-Clause "New" or "Revised" License
10 stars 9 forks source link

Provide abstract parent class to Transform #66

Open srawlins opened 9 years ago

srawlins commented 9 years ago

It would be great if Barback provided its own general interface that Transform follows. This could be exactly Angular 2's AssetReader.

I have two reasons that this would be a great asset (hehe):

  1. The very reason Angular wrote it: you could also include a faking implementation, like Angular's TestAssetReader, which also implements AssetReader, and works great for tests where you want to read fake assets, or read data directly off the filesystem.
  2. For writing generalized tools that can take Transform assets as inputs, or files from the filesystem (they would thus take an "AssetReader" or "AssetProvider" or some such thing). Such a tool could be used in transformery implementations, or other code gen implementations, where it can read straight off the disk.

Currently and unfortunately, I am importing Angular 2's AssetReader in a project, only to use AssetReader. AssetReader is a class that is really so general that I think it could go into Barback, and wouldn't require much maintenance, as it is abstract.