Update to typst v0.8.0

This commit is contained in:
Jack
2023-09-15 23:10:44 +01:00
parent 5349746971
commit d820ec132d
6 changed files with 362 additions and 429 deletions

View File

@ -1,3 +1,6 @@
# 0.7.0
- Update to Typst v0.8.0
# 0.6.0
- Improve error reporting
- Upgrade to Typst 0.7.0

572
compiler/Cargo.lock generated
View File

@ -23,6 +23,15 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
[[package]]
name = "android_system_properties"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
dependencies = [
"libc",
]
[[package]]
name = "ariadne"
version = "0.3.0"
@ -101,12 +110,6 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
[[package]]
name = "bit_field"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61"
[[package]]
name = "bitflags"
version = "1.3.2"
@ -175,12 +178,43 @@ checksum = "aeea139b89efab957972956e5d3e4efb66a6c261f726abf6911040cc8ef700f7"
[[package]]
name = "chrono"
version = "0.4.26"
version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5"
checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877"
dependencies = [
"android-tzdata",
"iana-time-zone",
"js-sys",
"num-traits",
"wasm-bindgen",
"windows-targets",
]
[[package]]
name = "ciborium"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926"
dependencies = [
"ciborium-io",
"ciborium-ll",
"serde",
]
[[package]]
name = "ciborium-io"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656"
[[package]]
name = "ciborium-ll"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b"
dependencies = [
"ciborium-io",
"half",
]
[[package]]
@ -226,6 +260,12 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
[[package]]
name = "crc32fast"
version = "1.3.2"
@ -235,55 +275,6 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
dependencies = [
"cfg-if",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
dependencies = [
"cfg-if",
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
dependencies = [
"autocfg",
"cfg-if",
"crossbeam-utils",
"memoffset",
"scopeguard",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
dependencies = [
"cfg-if",
]
[[package]]
name = "crunchy"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
name = "csv"
version = "1.2.2"
@ -343,12 +334,6 @@ dependencies = [
"serde",
]
[[package]]
name = "either"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "enum-ordinalize"
version = "3.1.13"
@ -368,22 +353,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "exr"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1e481eb11a482815d3e9d618db8c42a93207134662873809335a92327440c18"
dependencies = [
"bit_field",
"flume",
"half",
"lebe",
"miniz_oxide",
"rayon-core",
"smallvec",
"zune-inflate",
]
[[package]]
name = "fancy-regex"
version = "0.11.0"
@ -429,19 +398,6 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
[[package]]
name = "flume"
version = "0.10.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577"
dependencies = [
"futures-core",
"futures-sink",
"nanorand",
"pin-project",
"spin",
]
[[package]]
name = "fnv"
version = "1.0.7"
@ -450,14 +406,14 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "fontdb"
version = "0.13.1"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "237ff9f0813bbfc9de836016472e0c9ae7802f174a51594607e5f4ff334cb2f5"
checksum = "af8d8cbea8f21307d7e84bca254772981296f058a1d36b461bf4d83a7499fc9e"
dependencies = [
"log",
"memmap2",
"slotmap",
"ttf-parser",
"tinyvec",
"ttf-parser 0.19.2",
]
[[package]]
@ -469,31 +425,6 @@ dependencies = [
"percent-encoding",
]
[[package]]
name = "futures-core"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
[[package]]
name = "futures-sink"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e"
[[package]]
name = "getrandom"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi",
"wasm-bindgen",
]
[[package]]
name = "gif"
version = "0.12.0"
@ -506,12 +437,9 @@ dependencies = [
[[package]]
name = "half"
version = "2.2.1"
version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02b4af3693f1b705df946e9fe5631932443781d0aabb423b62fcd4d73f6d2fd0"
dependencies = [
"crunchy",
]
checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
[[package]]
name = "hashbrown"
@ -527,9 +455,9 @@ checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
[[package]]
name = "hayagriva"
version = "0.3.0"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8a21ff266f0b113789bbf4a27da16330315eebbd7df8e844f95d29f92ad556d"
checksum = "065e90e53aa502be868a307f58ca6b46e31143641e809047c689de75619d8cea"
dependencies = [
"biblatex",
"chrono",
@ -553,16 +481,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
version = "0.3.2"
name = "hypher"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
checksum = "723e315d77ea8aa1aedf53ad979ff0e763cfa2a1b3403248e427ae052f403cad"
[[package]]
name = "hypher"
name = "iana-time-zone"
version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"windows",
]
[[package]]
name = "iana-time-zone-haiku"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "927f74d31cdbfd8de201340c0bc474c52c9145193ccd8885fcede14005591aad"
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
dependencies = [
"cc",
]
[[package]]
name = "icu_collections"
@ -701,21 +646,18 @@ dependencies = [
"bytemuck",
"byteorder",
"color_quant",
"exr",
"gif",
"jpeg-decoder",
"num-rational",
"num-traits",
"png",
"qoi",
"tiff",
]
[[package]]
name = "imagesize"
version = "0.11.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b72ad49b554c1728b1e83254a1b1565aea4161e28dabbfa171fc15fe62299caf"
checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284"
[[package]]
name = "indexmap"
@ -725,7 +667,6 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
"autocfg",
"hashbrown 0.12.3",
"serde",
]
[[package]]
@ -736,6 +677,7 @@ checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
dependencies = [
"equivalent",
"hashbrown 0.14.0",
"serde",
]
[[package]]
@ -744,12 +686,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590"
[[package]]
name = "intx"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6f38a50a899dc47a6d0ed5508e7f601a2e34c3a85303514b5d137f3c10a0c75"
[[package]]
name = "isolang"
version = "2.3.0"
@ -770,9 +706,6 @@ name = "jpeg-decoder"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e"
dependencies = [
"rayon",
]
[[package]]
name = "js-sys"
@ -798,12 +731,6 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "lebe"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
[[package]]
name = "libc"
version = "0.2.147"
@ -847,16 +774,6 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a04a5b2b6f54acba899926491d0a6c59d98012938ca2ab5befb281c034e8f94"
[[package]]
name = "lock_api"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.20"
@ -869,24 +786,6 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memmap2"
version = "0.5.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327"
dependencies = [
"libc",
]
[[package]]
name = "memoffset"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
dependencies = [
"autocfg",
]
[[package]]
name = "miniz_oxide"
version = "0.7.1"
@ -897,15 +796,6 @@ dependencies = [
"simd-adler32",
]
[[package]]
name = "nanorand"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3"
dependencies = [
"getrandom",
]
[[package]]
name = "num-bigint"
version = "0.4.4"
@ -948,16 +838,6 @@ dependencies = [
"libm",
]
[[package]]
name = "num_cpus"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
"hermit-abi",
"libc",
]
[[package]]
name = "numerals"
version = "0.1.4"
@ -969,6 +849,7 @@ name = "obsidian-typst"
version = "0.6.0"
dependencies = [
"ariadne",
"chrono",
"comemo",
"console_error_panic_hook",
"fast_image_resize",
@ -1005,9 +886,9 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
[[package]]
name = "pdf-writer"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86af2eb3faa4614bc7fda8bd578c25e76a17ff3b1577be034b81e0c20527e204"
checksum = "9d77bc47c8968aa63f86a7e6693e270a6cbd1e3b784c364f1711a0ddecc71447"
dependencies = [
"bitflags 1.3.2",
"itoa",
@ -1044,26 +925,6 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
[[package]]
name = "pin-project"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.29",
]
[[package]]
name = "pin-project-lite"
version = "0.2.12"
@ -1072,11 +933,11 @@ checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05"
[[package]]
name = "pixglyph"
version = "0.1.0"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9eefadd393715fe315c8cdcd587f893b818a6dfe4f6f9faeb44b764c7c38fd8b"
checksum = "f67591f21f6668e63c1cd85adab066ac8a92bc7b962668dd8042197a6e4b8f8f"
dependencies = [
"ttf-parser",
"ttf-parser 0.19.2",
]
[[package]]
@ -1140,15 +1001,6 @@ dependencies = [
"cc",
]
[[package]]
name = "qoi"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001"
dependencies = [
"bytemuck",
]
[[package]]
name = "quick-xml"
version = "0.29.0"
@ -1192,28 +1044,6 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
[[package]]
name = "rayon"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
dependencies = [
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
"num_cpus",
]
[[package]]
name = "rctree"
version = "0.5.0"
@ -1251,9 +1081,9 @@ checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
[[package]]
name = "resvg"
version = "0.32.0"
version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "142e83d8ae8c8c639f304698a5567b229ba65caba867bf4387bbc0ae158827cf"
checksum = "b6554f47c38eca56827eea7f285c2a3018b4e12e0e195cc105833c008be338f1"
dependencies = [
"gif",
"jpeg-decoder",
@ -1275,19 +1105,6 @@ dependencies = [
"bytemuck",
]
[[package]]
name = "rosvgtree"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad747e7384940e7bf33b15ba433b7bad9f44c0c6d5287a67c2cb22cd1743d497"
dependencies = [
"log",
"roxmltree",
"simplecss",
"siphasher",
"svgtypes",
]
[[package]]
name = "roxmltree"
version = "0.18.0"
@ -1312,7 +1129,7 @@ dependencies = [
"bitflags 1.3.2",
"bytemuck",
"smallvec",
"ttf-parser",
"ttf-parser 0.18.1",
"unicode-bidi-mirroring",
"unicode-ccc",
"unicode-general-category",
@ -1340,12 +1157,6 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "serde"
version = "1.0.186"
@ -1357,9 +1168,9 @@ dependencies = [
[[package]]
name = "serde-wasm-bindgen"
version = "0.5.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e"
checksum = "30c9933e5689bd420dc6c87b7a1835701810cbc10cd86a26e4da45b73e6b1d78"
dependencies = [
"js-sys",
"serde",
@ -1399,14 +1210,15 @@ dependencies = [
[[package]]
name = "serde_yaml"
version = "0.8.26"
version = "0.9.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b"
checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574"
dependencies = [
"indexmap 1.9.3",
"indexmap 2.0.0",
"itoa",
"ryu",
"serde",
"yaml-rust",
"unsafe-libyaml",
]
[[package]]
@ -1450,9 +1262,6 @@ name = "spin"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
dependencies = [
"lock_api",
]
[[package]]
name = "stable_deref_trait"
@ -1512,9 +1321,9 @@ checksum = "09eab8a83bff89ba2200bd4c59be45c7c787f988431b936099a5a266c957f2f9"
[[package]]
name = "svg2pdf"
version = "0.6.0"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c966e59fd4afd959edcc226687f751a7d05c94d0477cca1a4c2b15a7220f2b24"
checksum = "f2adc7de163bd53f323850e65269280b2a66ffceee291cb8eca34f2eabc3acad"
dependencies = [
"image",
"miniz_oxide",
@ -1607,17 +1416,6 @@ dependencies = [
"syn 2.0.29",
]
[[package]]
name = "tiff"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d172b0f4d3fba17ba89811858b9d3d97f928aece846475bbda076ca46736211"
dependencies = [
"flate2",
"jpeg-decoder",
"weezl",
]
[[package]]
name = "time"
version = "0.3.27"
@ -1648,9 +1446,9 @@ dependencies = [
[[package]]
name = "tiny-skia"
version = "0.9.1"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce2986c82f77818c7b9144c70818fdde98db15308e329ae2f7204d767808fd3c"
checksum = "7db11798945fa5c3e5490c794ccca7c6de86d3afdd54b4eb324109939c6f37bc"
dependencies = [
"arrayref",
"arrayvec",
@ -1663,9 +1461,9 @@ dependencies = [
[[package]]
name = "tiny-skia-path"
version = "0.9.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7acb0ccda1ac91084353a56d0b69b0e29c311fd809d2088b1ed2f9ae1841c47"
checksum = "2f60aa35c89ac2687ace1a2556eaaea68e8c0d47408a2e3e7f5c98a489e7281c"
dependencies = [
"arrayref",
"bytemuck",
@ -1700,9 +1498,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "toml"
version = "0.7.6"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542"
checksum = "c226a7bba6d859b63c92c4b4fe69c5b6b72d0cb897dbc8e6012298e6154cb56e"
dependencies = [
"serde",
"serde_spanned",
@ -1721,9 +1519,9 @@ dependencies = [
[[package]]
name = "toml_edit"
version = "0.19.14"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a"
checksum = "8ff63e60a958cefbb518ae1fd6566af80d9d4be430a33f3723dfc47d1d411d95"
dependencies = [
"indexmap 2.0.0",
"serde",
@ -1770,6 +1568,12 @@ version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0609f771ad9c6155384897e1df4d948e692667cc0588548b68eb44d052b27633"
[[package]]
name = "ttf-parser"
version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1"
[[package]]
name = "typed-arena"
version = "2.0.2"
@ -1778,8 +1582,8 @@ checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
[[package]]
name = "typst"
version = "0.7.0"
source = "git+https://github.com/typst/typst.git?rev=522708b#522708b9df0b9b2f8265938aa1f0aeda8e6e6c1f"
version = "0.8.0"
source = "git+https://github.com/typst/typst.git?tag=v0.8.0#360cc9b9570f263d52530b98d0c93523e7bdb100"
dependencies = [
"base64",
"bitflags 2.4.0",
@ -1790,7 +1594,7 @@ dependencies = [
"fontdb",
"if_chain",
"image",
"indexmap 1.9.3",
"indexmap 2.0.0",
"log",
"miniz_oxide",
"oklab",
@ -1810,12 +1614,12 @@ dependencies = [
"tiny-skia",
"toml",
"tracing",
"ttf-parser",
"ttf-parser 0.19.2",
"typst-macros",
"typst-syntax",
"unicode-general-category",
"unicode-ident",
"unicode-math-class",
"unicode-properties",
"unicode-segmentation",
"unscanny",
"usvg",
@ -1827,11 +1631,12 @@ dependencies = [
[[package]]
name = "typst-library"
version = "0.7.0"
source = "git+https://github.com/typst/typst.git?rev=522708b#522708b9df0b9b2f8265938aa1f0aeda8e6e6c1f"
version = "0.8.0"
source = "git+https://github.com/typst/typst.git?tag=v0.8.0#360cc9b9570f263d52530b98d0c93523e7bdb100"
dependencies = [
"az",
"chinese-number",
"ciborium",
"comemo",
"csv",
"ecow",
@ -1855,7 +1660,7 @@ dependencies = [
"time",
"toml",
"tracing",
"ttf-parser",
"ttf-parser 0.19.2",
"typed-arena",
"typst",
"unicode-bidi",
@ -1866,8 +1671,8 @@ dependencies = [
[[package]]
name = "typst-macros"
version = "0.7.0"
source = "git+https://github.com/typst/typst.git?rev=522708b#522708b9df0b9b2f8265938aa1f0aeda8e6e6c1f"
version = "0.8.0"
source = "git+https://github.com/typst/typst.git?tag=v0.8.0#360cc9b9570f263d52530b98d0c93523e7bdb100"
dependencies = [
"heck",
"proc-macro2",
@ -1877,8 +1682,8 @@ dependencies = [
[[package]]
name = "typst-syntax"
version = "0.7.0"
source = "git+https://github.com/typst/typst.git?rev=522708b#522708b9df0b9b2f8265938aa1f0aeda8e6e6c1f"
version = "0.8.0"
source = "git+https://github.com/typst/typst.git?tag=v0.8.0#360cc9b9570f263d52530b98d0c93523e7bdb100"
dependencies = [
"comemo",
"ecow",
@ -1954,6 +1759,12 @@ dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-properties"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7f91c8b21fbbaa18853c3d0801c78f4fc94cdb976699bb03e832e75f7fd22f0"
[[package]]
name = "unicode-script"
version = "0.5.5"
@ -1984,6 +1795,12 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "unsafe-libyaml"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa"
[[package]]
name = "unscanny"
version = "0.1.0"
@ -2003,9 +1820,9 @@ dependencies = [
[[package]]
name = "usvg"
version = "0.32.0"
version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b44e14b7678bcc5947b397991432d0c4e02a103958a0ed5e1b9b961ddd08b21"
checksum = "14d09ddfb0d93bf84824c09336d32e42f80961a9d1680832eb24fdf249ce11e6"
dependencies = [
"base64",
"log",
@ -2018,26 +1835,27 @@ dependencies = [
[[package]]
name = "usvg-parser"
version = "0.32.0"
version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90c8251d965c2882a636ffcc054340b1f13a6bce68779cb5b2084d8ffc2535be"
checksum = "d19bf93d230813599927d88557014e0908ecc3531666d47c634c6838bc8db408"
dependencies = [
"data-url",
"flate2",
"imagesize",
"kurbo",
"log",
"rosvgtree",
"strict-num",
"roxmltree",
"simplecss",
"siphasher",
"svgtypes",
"usvg-tree",
]
[[package]]
name = "usvg-text-layout"
version = "0.32.0"
version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c4fed019d1af07bfe0f3bac13d120d7b51bc65b38cb24809cf4ed0b8b631138"
checksum = "035044604e89652c0a2959b8b356946997a52649ba6cade45928c2842376feb4"
dependencies = [
"fontdb",
"kurbo",
@ -2051,14 +1869,14 @@ dependencies = [
[[package]]
name = "usvg-tree"
version = "0.32.0"
version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7371265c467cdae0ccc3655e2e3f310c695fb9f717c0d25187bf3b333f7b5159"
checksum = "7939a7e4ed21cadb5d311d6339730681c3e24c3e81d60065be80e485d3fc8b92"
dependencies = [
"kurbo",
"rctree",
"strict-num",
"svgtypes",
"tiny-skia-path",
]
[[package]]
@ -2083,12 +1901,6 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.87"
@ -2157,11 +1969,10 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
[[package]]
name = "wasmi"
version = "0.30.0"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51fb5c61993e71158abf5bb863df2674ca3ec39ed6471c64f07aeaf751d67b4"
checksum = "1f341edb80021141d4ae6468cbeefc50798716a347d4085c3811900049ea8945"
dependencies = [
"intx",
"smallvec",
"spin",
"wasmi_arena",
@ -2177,9 +1988,9 @@ checksum = "401c1f35e413fac1846d4843745589d9ec678977ab35a384db8ae7830525d468"
[[package]]
name = "wasmi_core"
version = "0.12.0"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624e6333e861ef49095d2d678b76ebf30b06bf37effca845be7e5b87c90071b7"
checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a"
dependencies = [
"downcast-rs",
"libm",
@ -2243,6 +2054,72 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "winnow"
version = "0.5.15"
@ -2359,12 +2236,3 @@ dependencies = [
"syn 1.0.109",
"synstructure",
]
[[package]]
name = "zune-inflate"
version = "0.2.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02"
dependencies = [
"simd-adler32",
]

View File

@ -12,8 +12,8 @@ crate-type = ["cdylib"]
[dependencies]
# Everything to do with Typst
typst = { git = "https://github.com/typst/typst.git", rev = "522708b" }
typst-library = { git = "https://github.com/typst/typst.git", rev = "522708b" }
typst = { git = "https://github.com/typst/typst.git", tag = "v0.8.0" }
typst-library = { git = "https://github.com/typst/typst.git", tag = "v0.8.0" }
comemo = "0.3"
@ -22,7 +22,7 @@ wasm-bindgen = "^0.2"
js-sys = "^0.3"
wasm-bindgen-futures = "^0.4"
serde = { version = "1", features = ["derive"] }
serde-wasm-bindgen = "^0.5"
serde-wasm-bindgen = "^0.6"
web-sys = { version = "^0.3", features = [
"console",
"Window",
@ -36,3 +36,4 @@ console_error_panic_hook = "0.1.7"
fast_image_resize = "2.7.3"
ariadne = "0.3.0"
chrono = "0.4.30"

101
compiler/src/diagnostic.rs Normal file
View File

@ -0,0 +1,101 @@
use std::{cell::Ref, collections::HashMap, ops::Range};
use ariadne::{Config, FnCache, Label, Report, ReportKind};
use typst::{
diag::{Severity, SourceDiagnostic},
syntax::{FileId, Span},
};
use crate::file_entry::FileEntry;
#[derive(Hash, PartialEq, Eq, Clone, Copy)]
struct Id(Option<FileId>);
impl std::fmt::Debug for Id {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if self.0.is_some() {
write!(f, "{:?}", self.0.unwrap())
} else {
write!(f, "")
}
}
}
impl std::fmt::Display for Id {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if self.0.is_some() {
write!(f, "{:?}", self.0.unwrap())
} else {
write!(f, "")
}
}
}
pub fn format_diagnostic(
sources: Ref<HashMap<FileId, FileEntry>>,
diagnostics: &[SourceDiagnostic],
) -> String {
let mut bytes = Vec::new();
let mut cache = FnCache::new(|id: &Id| {
Ok(if let Some(id) = id.0 {
sources.get(&id).unwrap().source().text().to_string()
} else {
String::new()
})
});
for diagnostic in diagnostics {
let mut report = build_report(
diagnostic.span,
match diagnostic.severity {
Severity::Error => ReportKind::Error,
Severity::Warning => ReportKind::Warning,
},
diagnostic.message.to_string(),
&sources,
);
if !diagnostic.hints.is_empty() {
report.set_help(diagnostic.hints.join("\n"))
}
report.finish().write(&mut cache, &mut bytes).unwrap();
bytes.push(b'\n');
for point in &diagnostic.trace {
build_report(
point.span,
ReportKind::Advice,
point.v.to_string(),
&sources,
)
.finish()
.write(&mut cache, &mut bytes)
.unwrap();
bytes.push(b'\n');
}
}
return String::from_utf8(bytes).unwrap().trim().to_string();
}
fn build_report<'a>(
span: Span,
report_kind: ReportKind<'a>,
message: String,
sources: &Ref<HashMap<FileId, FileEntry>>,
) -> ariadne::ReportBuilder<'a, (Id, Range<usize>)> {
let config = Config::default().with_color(false).with_tab_width(2);
let id = Id(span.id());
let range = if let Some(id) = id.0 {
sources.get(&id).unwrap().source().range(span).unwrap()
} else {
0..0
};
Report::build(report_kind, id, range.start)
.with_config(config)
.with_message(message)
.with_label(Label::new((id, range)))
}

View File

@ -1,6 +1,6 @@
use chrono::{DateTime, Datelike, Local};
use comemo::Prehashed;
use fast_image_resize as fr;
use render::format_diagnostic;
use std::{
cell::{OnceCell, RefCell, RefMut},
collections::HashMap,
@ -12,17 +12,19 @@ use typst::{
eval::{Bytes, Datetime, Library, Tracer},
font::{Font, FontBook},
syntax::Source,
syntax::{FileId, PackageSpec},
util::PathExt,
syntax::{FileId, PackageSpec, VirtualPath},
// util::PathExt,
World,
};
use typst_library::prelude::EcoString;
use wasm_bindgen::prelude::*;
use web_sys::ImageData;
mod diagnostic;
mod file_entry;
mod render;
use crate::file_entry::FileEntry;
use crate::{diagnostic::format_diagnostic, file_entry::FileEntry};
/// A world that provides access to the operating system.
#[wasm_bindgen]
@ -39,9 +41,8 @@ pub struct SystemWorld {
fonts: Vec<Font>,
files: RefCell<HashMap<FileId, FileEntry>>,
/// The current date if requested. This is stored here to ensure it is
/// always the same within one compilation. Reset between compilations.
today: OnceCell<Option<Datetime>>,
now: OnceCell<DateTime<Local>>,
packages: RefCell<HashMap<PackageSpec, PackageResult<PathBuf>>>,
@ -60,12 +61,12 @@ impl SystemWorld {
Self {
root: PathBuf::from(root),
main: FileId::detached(),
main: FileId::new(None, VirtualPath::new("")),
library: Prehashed::new(typst_library::build()),
book: Prehashed::new(book),
fonts,
files: RefCell::default(),
today: OnceCell::new(),
now: OnceCell::new(),
packages: RefCell::default(),
resizer: fr::Resizer::default(),
js_request_data: js_read_file.clone(),
@ -100,7 +101,7 @@ impl SystemWorld {
fn compile(&mut self, text: String, path: String) -> Result<Document, JsValue> {
self.reset();
self.main = FileId::new(None, &PathBuf::from(&path));
self.main = FileId::new(None, VirtualPath::new(path));
self.files
.borrow_mut()
.insert(self.main, FileEntry::new(self.main, text));
@ -151,19 +152,30 @@ impl World for SystemWorld {
Some(self.fonts[index].clone())
}
fn today(&self, _: Option<i64>) -> Option<Datetime> {
None
fn today(&self, offset: Option<i64>) -> Option<Datetime> {
let now = self.now.get_or_init(chrono::Local::now);
let naive = match offset {
None => now.naive_local(),
Some(o) => now.naive_utc() + chrono::Duration::hours(o),
};
Datetime::from_ymd(
naive.year(),
naive.month().try_into().ok()?,
naive.day().try_into().ok()?,
)
}
}
impl SystemWorld {
fn reset(&mut self) {
self.files.borrow_mut().clear();
self.today.take();
self.now.take();
}
fn read_file(&self, path: &Path) -> FileResult<String> {
let f = |_e: JsValue| FileError::Other;
let f = |e: JsValue| FileError::Other(e.as_string().map(EcoString::from));
Ok(self
.js_request_data
.call1(&JsValue::NULL, &path.to_str().unwrap().into())
@ -179,7 +191,7 @@ impl SystemWorld {
return PackageError::NotFound(spec.clone());
}
}
PackageError::Other
PackageError::Other(e.as_string().map(EcoString::from))
};
self.packages
.borrow_mut()
@ -207,10 +219,12 @@ impl SystemWorld {
let path = match id.package() {
Some(spec) => self.prepare_package(spec)?,
None => self.root.clone(),
}
.join_rooted(id.path())
.ok_or(FileError::AccessDenied)?;
let text = self.read_file(&path)?;
};
// .
// .ok_or(FileError::AccessDenied)?;
let text = self.read_file(&id.vpath().resolve(&path).ok_or(FileError::AccessDenied)?)?;
Ok(RefMut::map(self.files.borrow_mut(), |files| {
return files.entry(id).or_insert(FileEntry::new(id, text));
}))

View File

@ -1,19 +1,14 @@
use std::{cell::Ref, collections::HashMap, num::NonZeroU32, str::FromStr};
use std::{num::NonZeroU32, str::FromStr};
use ariadne::{Config, FnCache, Label, Report, ReportKind};
use fast_image_resize as fr;
use fr::Resizer;
use typst::{
diag::{Severity, SourceDiagnostic},
doc::Document,
geom::{Color, RgbaColor},
syntax::FileId,
};
use wasm_bindgen::Clamped;
use web_sys::ImageData;
use crate::file_entry::FileEntry;
pub fn to_image(
resizer: &mut Resizer,
document: Document,
@ -78,52 +73,3 @@ pub fn to_image(
pub fn to_svg(document: Document) -> String {
typst::export::svg(&document.pages[0])
}
pub fn format_diagnostic(
sources: Ref<HashMap<FileId, FileEntry>>,
diagnostics: &[SourceDiagnostic],
) -> String {
let config = Config::default().with_color(false).with_tab_width(2);
let mut bytes = Vec::new();
let mut cache = FnCache::new(|id: &_| Ok(sources.get(id).unwrap().source().text().to_string()));
for diagnostic in diagnostics {
let id = diagnostic.span.id();
let source = sources.get(&id).unwrap().source();
let range = source.range(diagnostic.span);
let mut report = Report::build(
match diagnostic.severity {
Severity::Error => ReportKind::Error,
Severity::Warning => ReportKind::Warning,
},
id,
range.start,
)
.with_config(config)
.with_message(&diagnostic.message)
.with_label(Label::new((id, range)));
if !diagnostic.hints.is_empty() {
report.set_help(diagnostic.hints.join("\n"))
}
report.finish().write(&mut cache, &mut bytes).unwrap();
bytes.push(b'\n');
for point in &diagnostic.trace {
let id = point.span.id();
let source = sources.get(&id).unwrap().source();
let range = source.range(point.span);
Report::build(ReportKind::Advice, id, range.start)
.with_config(config)
.with_message(point.v.to_string())
.with_label(Label::new((id, range)))
.finish()
.write(&mut cache, &mut bytes)
.unwrap();
bytes.push(b'\n');
}
}
return String::from_utf8(bytes).unwrap().trim().to_string();
}