mirror of
https://github.com/apple/pkl.git
synced 2026-03-22 17:19:13 +01:00
Un-deprecate Resource.base64, compute bytes/base64 in terms of each other (#1138)
This makes changes to avoid a needless breaking change.
It preserves code like `new Resource { base64 = someValue }.sha256`,
and also code that renders `Resource` into static formats.
Co-authored-by: Islon Scherer <islonscherer@gmail.com>
This commit is contained in:
@@ -513,6 +513,9 @@ class PropertiesRenderer extends ValueRenderer {
|
||||
/// An external (file, HTTP, etc.) resource.
|
||||
///
|
||||
/// Usually, a [Resource] is obtained via a `read()` expression, such as `read("some/file")`.
|
||||
///
|
||||
/// When created directly, either of [bytes] or [base64] can be set, and the other will be
|
||||
/// computed in terms of the set value.
|
||||
class Resource {
|
||||
/// The URI of this resource.
|
||||
uri: Uri
|
||||
@@ -520,13 +523,12 @@ class Resource {
|
||||
/// The text content of this resource.
|
||||
text: String
|
||||
|
||||
/// The content of this resource in Base64 encoding.
|
||||
base64: String = bytes.base64
|
||||
|
||||
/// The bytes of this resource.
|
||||
@Since { version = "0.29.0" }
|
||||
bytes: Bytes
|
||||
|
||||
/// The content of this resource in Base64.
|
||||
@Deprecated { since = "0.29.0"; message = "Use bytes.base64 instead" }
|
||||
hidden base64: String = bytes.base64
|
||||
hidden bytes: Bytes = base64.base64DecodedBytes
|
||||
|
||||
/// The [MD5](https://en.wikipedia.org/wiki/MD5)
|
||||
/// hash of this resource as hexadecimal string.
|
||||
|
||||
Reference in New Issue
Block a user