1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
use elem;
use cratebail;
use crate;
use crateLocatable;
/// Adds a custom file to a bundle.
///
/// This function creates a single file in a @reference:bundle[bundle], from
/// @bytes[raw byte data]. Unlike @document[documents], assets will be emitted
/// as-is without undergoing compilation.
///
/// The `asset` function can be combined with @read to copy a file from the
/// project into the output bundle. The first argument to `asset` defines the
/// output path for the asset in the bundle, while the path passed to `read`
/// defines where in the project to read the data from.
///
/// ```typ
/// // Copy the file `styles.css` into the bundle.
/// #asset("styles.css", read("styles.css"))
/// ```
///
/// That said, `asset` is not tied to `read`. You can also generate bytes
/// directly or use a function like @json.encode to emit serialized data.
///
/// ```typ
/// // Emits a JSON file with the number
/// // of headings in the document.
/// #context {
/// let headings = query(heading)
/// let meta = (
/// count: headings.len(),
/// )
/// asset("meta.json", json.encode(meta))
/// }
///
/// #document("doc.pdf")[
/// = Introduction
/// = Conclusion
/// ]
/// ```
///
/// This would emit a `meta.json` file with the following contents into the
/// resulting bundle:
///
/// ```json
/// {
/// "count": 2
/// }
/// ```
///
/// This function may only be used in the @reference:bundle[bundle] target.
pub const ASSET_UNSUPPORTED_RULE: = ;
/// The raw data for an asset.
;
cast!