Releases: axodotdev/axoasset
v0.4.0 - 2023-07-04
v0.3.0 - 2023-05-23
🎁 Features
-
SourceFile::deserialize_toml_edit (behind new toml-edit feature) - Gankra, pr52
Just a convenience to read a SourceFile as toml-edit and map the error spans to the right format.
🛠️ Fixes
-
Separate compression into cargo features - shadows-withal, pr47
The APIs for processing tarballs/zips are now behind "compression-tar" and "compression-zip",
with a convenience "compression" feature that covers both. -
LocalAsset API cleanup - shadows-withal, pr48
Some breaking cleanups to APIs to make them more ergonomic longterm
- Many APIs that previously took Strings now take
AsRef<Utf8Path>
- write_new_{all} now just takes a path to the file, instead of folder_path + name
- Many APIs that previously took Strings now take
-
update github CI - striezel, pr50
Updating several old Github CI actions to more modern/maintained versions, thanks a ton!
v0.2.0 - 2023-04-27
🎁 Features
-
✨ New
LocalAsset
functionality! - shadows-withal, pr38, pr46We've added a lot more functions to
LocalAsset
:write_new_all
, to write a file and its parent directoriescreate_dir
, which creates, well, a new directorycreate_dir_all
, which creates a directory and its parent directoriesremove_file
, which deletes a fileremove_dir
, which deletes an empty directoryremove_dir_all
, which deletes a directory and its contentstar_{gz,xz,zstd}_dir
, which are three separate functions that create a tar archive with the
specified compression algorithm, either Gzip, Xzip, or Zstdzip_dir
, which creates a zip archive
-
✨ New feature:
SourceFile::span_for_substr
- Gankra, pr35This function enables the ability to get spans even when using a tool that
doesn't support them as long as it returns actual substrings pointing into
the original SourceFile's inner String.
🛠️ Fixes
v0.1.1 - 2023-04-06
🛠️ Fixes
- Fix compilation errors for features and add tests - Gankra/ashleygwilliams, pr33
v0.1.0 - 2023-04-06
🎁 Features
-
✨ New type:
SourceFile
- Gankra, pr25SourceFile
is a new asset type which is a readonly String version of
Asset
wrapped in anArc
. The purpose of this type is to be cheap to
clone and pass around everywhere so that errors can refer to it (using the
miette#[source_code]
and#[label]
attributes). TheArc
ensures this
is cheap at minimal overhead. The String ensures the contents make sense to
display. -
✨ New type:
Spanned
- Gankra, pr25Spanned<T>
is a new type which tries to behave likeBox<T>
in the sense
that it's "as if" it's aT
but with source span info embedded. If you want
to remember that a value was decoded from an asset at bytes 100 to 200, you
can wrap it in aSpanned
without disrupting any of the code that uses it.
Then if you determine that value caused a problem, you can call
Spanned::span(&value)
to extract the span and have miette include the
asset context in the error message. -
✨ New features:
serde_json
andtoml-rs
- Gankra, pr25json-serde
andtoml-serde
are new features which pull in dedicated
support forserde_json
andtoml-rs
. These features adddeserialize_json
anddeserialize_toml
methods toSourceFile
which understand those crates'
native error types and produce full pretty miette-y errors when deserializing,
like this:× failed to read JSON ╰─▶ trailing comma at line 3 column 1 ╭─[src/tests/res/bad-package.json:2:1] 2 │ "name": null, 3 │ } · ─ ╰────
(In this case serde_json itself points at the close brace and not the actual comma, we're just faithfully forwarding that.)
Spanned
has special integration withtoml-rs
, because it's actually a
fork of that crate's own magicSpanned
type. If you deserialize a struct
that contains aSpanned<T>
it will automagically fill in the span info
for you. Ours further improves on this by putting in more effort to be totally
transparent likeBox
. -
✨ New function:
write_new
forLocalAsset
- ashleygwilliams, pr28axoasset was first conceived to handle assets declared by end users for use
inoranda
, but quickly grew to encompass all fs/network calls. one of the
things we often need to do is create a new file. This is only available on
LocalAsset
as, at least for the moment, that is the only place axoasset
has permissions to create new assets. -
make
RemoteAsset
an optional feature - Gankra, pr26A feature of
axoasset
is that it is agnostic to the origin of the asset:
it can be local or remote. However, often, authors can be certain that they
will only be using local assets. In this case, it reduces dependencies to
not include the remote functionality. Previously this wasn't possible! -
miette-ify
errors - Gankra, pr24Previously we were using
thiserror
for error handling, but to be consistent
across our toolchain, we've updated our errors to usemiette
. This has the
added benefit of formalizing structures we were informally building into our
error types (help/diagnostic text, forwarding the bare error as details, etc). -
consistent
Asset
interface - ashleygwilliams, pr30With 3 asset types,
LocalAsset
,RemoteAsset
, andSourceFile
, it felt
important to align their structures so they could be used nearly identically.
Every type now has a:origin_path
: the original source of the filefilename
: derived from theorigin_path
and, in the case ofRemoteAsset
s
also the headers from the network response.contents
: the contents of the asset as bytes or a String depending on
asset type
0.0.1
Initial release.