Move everything into crates/ directory

This commit is contained in:
Laurenz 2023-07-02 19:59:52 +02:00
parent 3ab1918509
commit ebfdb1dafa
215 changed files with 97 additions and 108 deletions

1
.gitignore vendored
View File

@ -13,7 +13,6 @@ tarpaulin-report.html
# Rust # Rust
/target /target
bench/target
**/*.rs.bk **/*.rs.bk
# Node # Node

View File

@ -13,7 +13,7 @@ land your contribution below.
2. Fork the Typst repository and start with your contribution. If you, at any 2. Fork the Typst repository and start with your contribution. If you, at any
point in this process, are unsure about how to do something in the Typst point in this process, are unsure about how to do something in the Typst
codebase, reach out to a maintainer or a more experienced contributor. Also codebase, reach out to a maintainer or a more experienced contributor. Also
have a look at the [`ARCHITECTURE.md`][architecture] file. It explains how have a look at the [`architecture.md`][architecture] file. It explains how
the compiler works. the compiler works.
3. Create a pull request (PR) in the Typst repository, outlining your 3. Create a pull request (PR) in the Typst repository, outlining your
contribution, the technical rationale behind it, and, if it includes a new contribution, the technical rationale behind it, and, if it includes a new
@ -69,5 +69,5 @@ Typst!
[issue]: https://github.com/typst/typst/issues [issue]: https://github.com/typst/typst/issues
[testing]: https://github.com/typst/typst/blob/main/tests/README.md [testing]: https://github.com/typst/typst/blob/main/tests/README.md
[#contributors]: https://discord.com/channels/1054443721975922748/1088371867913572452 [#contributors]: https://discord.com/channels/1054443721975922748/1088371867913572452
[architecture]: https://github.com/typst/typst/blob/main/ARCHITECTURE.md [architecture]: https://github.com/typst/typst/blob/main/docs/dev/architecture.md
[changelog]: https://typst.app/docs/changelog/ [changelog]: https://typst.app/docs/changelog/

32
Cargo.lock generated
View File

@ -425,9 +425,9 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-epoch" name = "crossbeam-epoch"
version = "0.9.14" version = "0.9.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cfg-if", "cfg-if",
@ -751,15 +751,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "hermit-abi"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.3.1" version = "0.3.1"
@ -1245,9 +1236,9 @@ dependencies = [
[[package]] [[package]]
name = "memoffset" name = "memoffset"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
dependencies = [ dependencies = [
"autocfg", "autocfg",
] ]
@ -1356,11 +1347,11 @@ dependencies = [
[[package]] [[package]]
name = "num_cpus" name = "num_cpus"
version = "1.15.0" version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [ dependencies = [
"hermit-abi 0.2.6", "hermit-abi 0.3.1",
"libc", "libc",
] ]
@ -1394,9 +1385,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]] [[package]]
name = "os_str_bytes" name = "os_str_bytes"
version = "6.5.0" version = "6.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac"
[[package]] [[package]]
name = "overload" name = "overload"
@ -3218,11 +3209,10 @@ dependencies = [
[[package]] [[package]]
name = "zopfli" name = "zopfli"
version = "0.7.2" version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5b2bed49d3f0af28729a2338ee8c3a48eba2133a78ebc560779be161ebaaad8" checksum = "4e0650ae6a051326d798eb099b632f1afb0d323d25ee4ec82ffb0779512084d5"
dependencies = [ dependencies = [
"byteorder",
"crc32fast", "crc32fast",
"log", "log",
"simd-adler32", "simd-adler32",

View File

@ -1,6 +1,6 @@
[workspace] [workspace]
members = ["cli", "docs", "library", "macros", "tests"] members = ["crates/*", "tests"]
default-members = ["cli"] default-members = ["crates/typst-cli"]
[workspace.package] [workspace.package]
version = "0.6.0" version = "0.6.0"
@ -12,63 +12,6 @@ repository = "https://github.com/typst/typst"
readme = "README.md" readme = "README.md"
license = "Apache-2.0" license = "Apache-2.0"
[package]
name = "typst"
description = "A new markup-based typesetting system that is powerful and easy to learn."
categories = ["compilers", "science"]
keywords = ["markup", "typesetting"]
version.workspace = true
rust-version.workspace = true
authors.workspace = true
edition.workspace = true
homepage.workspace = true
repository.workspace = true
license.workspace = true
[lib]
doctest = false
bench = false
[dependencies]
typst-macros = { path = "macros" }
bitflags = { version = "2", features = ["serde"] }
bytemuck = "1"
comemo = "0.3"
ecow = { version = "0.1.1", features = ["serde"] }
flate2 = "1"
fontdb = "0.13"
if_chain = "1"
image = { version = "0.24", default-features = false, features = ["png", "jpeg", "gif"] }
indexmap = "1.9.3"
log = "0.4"
miniz_oxide = "0.7"
once_cell = "1"
pdf-writer = "0.7.1"
pixglyph = "0.1"
regex = "1"
resvg = { version = "0.32", default-features = false }
roxmltree = "0.18"
rustybuzz = "0.7"
serde = { version = "1", features = ["derive"] }
siphasher = "0.3"
subsetter = "0.1.1"
svg2pdf = { git = "https://github.com/typst/svg2pdf" }
tiny-skia = "0.9.0"
toml = { version = "0.7.3", default-features = false, features = ["parse"] }
tracing = "0.1.37"
ttf-parser = "0.18.1"
unicode-general-category = "0.6"
unicode-ident = "1.0"
unicode-math-class = "0.1"
unicode-segmentation = "1"
unscanny = "0.1"
usvg = { version = "0.32", default-features = false, features = ["text"] }
xmp-writer = "0.1"
time = { version = "0.3.20", features = ["std", "formatting"] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
stacker = "0.1.15"
[profile.dev.package."*"] [profile.dev.package."*"]
opt-level = 2 opt-level = 2

13
NOTICE
View File

@ -3,8 +3,8 @@ Licenses for third party components used by this project can be found below.
================================================================================ ================================================================================
The MIT License applies to: The MIT License applies to:
* The default color set defined in `src/geom/color.rs` which is adapted from * The default color set defined in `crates/typst/src/geom/color.rs` which is
the colors.css project adapted from the colors.css project
(https://clrs.cc/) (https://clrs.cc/)
The MIT License (MIT) The MIT License (MIT)
@ -29,8 +29,9 @@ THE SOFTWARE.
================================================================================ ================================================================================
================================================================================ ================================================================================
Alpha multiplication and source-over blending in `src/export/render.rs` are Alpha multiplication and source-over blending in
ported from Skia code which can be found here: `crates/typst/src/export/render.rs` are ported from Skia code which can be found
here:
https://skia.googlesource.com/skia/+/refs/heads/main/include/core/SkColorPriv.h https://skia.googlesource.com/skia/+/refs/heads/main/include/core/SkColorPriv.h
Copyright (c) 2011 Google Inc. All rights reserved. Copyright (c) 2011 Google Inc. All rights reserved.
@ -63,8 +64,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================================================ ================================================================================
================================================================================ ================================================================================
Syntaxes in `library/assets/syntect.bin` are generated from syntax definitions Syntaxes in `crates/typst-library/assets/syntect.bin` are generated from syntax
which can be found here: definitions which can be found here:
https://github.com/sharkdp/bat/tree/master/assets/syntaxes https://github.com/sharkdp/bat/tree/master/assets/syntaxes
The syntax definitions are used under their respective licenses. The syntax definitions are used under their respective licenses.

View File

@ -220,7 +220,7 @@ instant preview. To achieve these goals, we follow three core design principles:
[scripting]: https://typst.app/docs/reference/scripting/ [scripting]: https://typst.app/docs/reference/scripting/
[rust]: https://rustup.rs/ [rust]: https://rustup.rs/
[releases]: https://github.com/typst/typst/releases/ [releases]: https://github.com/typst/typst/releases/
[architecture]: https://github.com/typst/typst/blob/main/ARCHITECTURE.md [architecture]: https://github.com/typst/typst/blob/main/docs/dev/architecture.md
[contributing]: https://github.com/typst/typst/blob/main/CONTRIBUTING.md [contributing]: https://github.com/typst/typst/blob/main/CONTRIBUTING.md
[packages]: https://github.com/typst/packages/ [packages]: https://github.com/typst/packages/
[`comemo`]: https://github.com/typst/comemo/ [`comemo`]: https://github.com/typst/comemo/

View File

@ -20,8 +20,8 @@ bench = false
doc = false doc = false
[dependencies] [dependencies]
typst = { path = ".." } typst = { path = "../typst" }
typst-library = { path = "../library" } typst-library = { path = "../typst-library" }
chrono = { version = "0.4.24", default-features = false, features = ["clock", "std"] } chrono = { version = "0.4.24", default-features = false, features = ["clock", "std"] }
clap = { version = "4.2.4", features = ["derive", "env"] } clap = { version = "4.2.4", features = ["derive", "env"] }
codespan-reporting = "0.11" codespan-reporting = "0.11"

View File

@ -95,7 +95,7 @@ impl FontSearcher {
macro_rules! add { macro_rules! add {
($filename:literal) => { ($filename:literal) => {
process(include_bytes!(concat!("../../assets/fonts/", $filename,))); process(include_bytes!(concat!("../../../assets/fonts/", $filename)));
}; };
} }

View File

@ -11,8 +11,8 @@ doctest = false
bench = false bench = false
[dependencies] [dependencies]
typst = { path = ".." } typst = { path = "../typst" }
typst-library = { path = "../library" } typst-library = { path = "../typst-library" }
comemo = "0.3" comemo = "0.3"
heck = "0.4" heck = "0.4"
include_dir = "0.7" include_dir = "0.7"

View File

@ -23,13 +23,13 @@ use typst::geom::{Abs, Smart};
use typst_library::layout::{Margin, PageElem}; use typst_library::layout::{Margin, PageElem};
use unscanny::Scanner; use unscanny::Scanner;
static SRC: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/src"); static DOCS: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/../../docs");
static FILES: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/../assets/files"); static FILES: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/../../assets/files");
static DETAILS: Lazy<yaml::Mapping> = Lazy::new(|| yaml("reference/details.yml")); static DETAILS: Lazy<yaml::Mapping> = Lazy::new(|| yaml("reference/details.yml"));
static GROUPS: Lazy<Vec<GroupData>> = Lazy::new(|| yaml("reference/groups.yml")); static GROUPS: Lazy<Vec<GroupData>> = Lazy::new(|| yaml("reference/groups.yml"));
static FONTS: Lazy<(Prehashed<FontBook>, Vec<Font>)> = Lazy::new(|| { static FONTS: Lazy<(Prehashed<FontBook>, Vec<Font>)> = Lazy::new(|| {
static DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/../assets/fonts"); static DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/../../assets/fonts");
let fonts: Vec<_> = DIR let fonts: Vec<_> = DIR
.files() .files()
.flat_map(|file| Font::iter(file.contents().into())) .flat_map(|file| Font::iter(file.contents().into()))
@ -53,13 +53,13 @@ static LIBRARY: Lazy<Prehashed<Library>> = Lazy::new(|| {
/// Build documentation pages. /// Build documentation pages.
pub fn provide(resolver: &dyn Resolver) -> Vec<PageModel> { pub fn provide(resolver: &dyn Resolver) -> Vec<PageModel> {
vec![ vec![
markdown_page(resolver, "/docs/", "general/overview.md").with_route("/docs/"), markdown_page(resolver, "/docs/", "overview.md").with_route("/docs/"),
tutorial_pages(resolver), tutorial_pages(resolver),
reference_pages(resolver), reference_pages(resolver),
guides_pages(resolver), guides_pages(resolver),
packages_page(resolver), packages_page(resolver),
markdown_page(resolver, "/docs/", "general/changelog.md"), markdown_page(resolver, "/docs/", "changelog.md"),
markdown_page(resolver, "/docs/", "general/community.md"), markdown_page(resolver, "/docs/", "community.md"),
] ]
} }
@ -125,7 +125,7 @@ pub enum BodyModel {
/// Build the tutorial. /// Build the tutorial.
fn tutorial_pages(resolver: &dyn Resolver) -> PageModel { fn tutorial_pages(resolver: &dyn Resolver) -> PageModel {
let mut page = markdown_page(resolver, "/docs/", "tutorial/welcome.md"); let mut page = markdown_page(resolver, "/docs/", "tutorial/welcome.md");
page.children = SRC page.children = DOCS
.get_dir("tutorial") .get_dir("tutorial")
.unwrap() .unwrap()
.files() .files()
@ -187,7 +187,7 @@ fn markdown_page(
path: impl AsRef<Path>, path: impl AsRef<Path>,
) -> PageModel { ) -> PageModel {
assert!(parent.starts_with('/') && parent.ends_with('/')); assert!(parent.starts_with('/') && parent.ends_with('/'));
let md = SRC.get_file(path).unwrap().contents_utf8().unwrap(); let md = DOCS.get_file(path).unwrap().contents_utf8().unwrap();
let html = Html::markdown(resolver, md); let html = Html::markdown(resolver, md);
let title = html.title().expect("chapter lacks a title").to_string(); let title = html.title().expect("chapter lacks a title").to_string();
PageModel { PageModel {
@ -652,7 +652,7 @@ fn types_page(resolver: &dyn Resolver, parent: &str) -> PageModel {
/// Produce the types' models. /// Produce the types' models.
fn type_models(resolver: &dyn Resolver) -> Vec<TypeModel> { fn type_models(resolver: &dyn Resolver) -> Vec<TypeModel> {
let file = SRC.get_file("reference/types.md").unwrap(); let file = DOCS.get_file("reference/types.md").unwrap();
let text = file.contents_utf8().unwrap(); let text = file.contents_utf8().unwrap();
let mut s = unscanny::Scanner::new(text); let mut s = unscanny::Scanner::new(text);
@ -906,7 +906,7 @@ fn module<'a>(parent: &'a Module, name: &str) -> Result<&'a Module, String> {
/// Load YAML from a path. /// Load YAML from a path.
#[track_caller] #[track_caller]
fn yaml<T: DeserializeOwned>(path: &str) -> T { fn yaml<T: DeserializeOwned>(path: &str) -> T {
let file = SRC.get_file(path).unwrap(); let file = DOCS.get_file(path).unwrap();
yaml::from_slice(file.contents()).unwrap() yaml::from_slice(file.contents()).unwrap()
} }

View File

@ -17,7 +17,7 @@ doctest = false
bench = false bench = false
[dependencies] [dependencies]
typst = { path = ".." } typst = { path = "../typst" }
az = "1.2" az = "1.2"
chinese-number = { version = "0.7.2", default-features = false, features = ["number-to-chinese"] } chinese-number = { version = "0.7.2", default-features = false, features = ["number-to-chinese"] }
comemo = "0.3" comemo = "0.3"

Some files were not shown because too many files have changed in this diff Show More