remove treehouse-format crate and collapse everything into src
This commit is contained in:
parent
ca127a9411
commit
b792688776
66 changed files with 145 additions and 112 deletions
37
Cargo.lock
generated
37
Cargo.lock
generated
|
@ -724,7 +724,7 @@ dependencies = [
|
|||
"pest_derive",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1409,7 +1409,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
"ucd-trie",
|
||||
]
|
||||
|
||||
|
@ -1599,7 +1599,7 @@ dependencies = [
|
|||
"rand_chacha",
|
||||
"simd_helpers",
|
||||
"system-deps",
|
||||
"thiserror",
|
||||
"thiserror 1.0.69",
|
||||
"v_frame",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
@ -1931,7 +1931,16 @@ version = "1.0.69"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
"thiserror-impl 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "2.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
|
||||
dependencies = [
|
||||
"thiserror-impl 2.0.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1945,6 +1954,17 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "2.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.8"
|
||||
|
@ -2176,24 +2196,17 @@ dependencies = [
|
|||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 2.0.12",
|
||||
"tokio",
|
||||
"toml_edit 0.19.15",
|
||||
"tracing",
|
||||
"tracing-chrome",
|
||||
"tracing-subscriber",
|
||||
"treehouse-format",
|
||||
"ulid",
|
||||
"webp",
|
||||
"xmlparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "treehouse-format"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.17.0"
|
||||
|
|
38
Cargo.toml
38
Cargo.toml
|
@ -1,11 +1,37 @@
|
|||
[workspace]
|
||||
members = ["crates/*"]
|
||||
resolver = "2"
|
||||
[package]
|
||||
name = "treehouse"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[workspace.dependencies]
|
||||
[dependencies]
|
||||
anyhow = "1.0.75"
|
||||
axum = { version = "0.7.9", features = ["macros"] }
|
||||
axum-macros = "0.4.2"
|
||||
base64 = "0.21.7"
|
||||
blake3 = "1.5.3"
|
||||
chrono = { version = "0.4.35", features = ["serde"] }
|
||||
clap = { version = "4.3.22", features = ["derive"] }
|
||||
codespan-reporting = "0.11.1"
|
||||
dashmap = "6.1.0"
|
||||
git2 = { version = "0.19.0", default-features = false, features = ["vendored-libgit2"] }
|
||||
handlebars = "4.3.7"
|
||||
image = "0.25.5"
|
||||
indexmap = { version = "2.2.6", features = ["serde"] }
|
||||
jotdown = { version = "0.4.1", default-features = false }
|
||||
rand = "0.8.5"
|
||||
rayon = "1.10.0"
|
||||
regex = "1.10.3"
|
||||
serde = { version = "1.0.183", features = ["derive"] }
|
||||
serde_json = "1.0.105"
|
||||
thiserror = "2.0.12"
|
||||
tokio = { version = "1.32.0", features = ["full"] }
|
||||
toml_edit = { version = "0.19.14", features = ["serde"] }
|
||||
tracing = "0.1.40"
|
||||
|
||||
treehouse-format = { path = "crates/treehouse-format" }
|
||||
tracing-chrome = "0.7.2"
|
||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
|
||||
ulid = "1.0.0"
|
||||
webp = "0.3.0"
|
||||
xmlparser = "0.13.6"
|
||||
|
||||
[profile.dev]
|
||||
package.webp.opt-level = 3
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
[package]
|
||||
name = "treehouse-format"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
thiserror = "1.0.47"
|
|
@ -1,32 +0,0 @@
|
|||
use std::ops::Range;
|
||||
|
||||
pub mod ast;
|
||||
pub mod pull;
|
||||
|
||||
#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq)]
|
||||
pub enum ParseErrorKind {
|
||||
#[error("branch kind (`+` or `-`) expected")]
|
||||
BranchKindExpected,
|
||||
|
||||
#[error("root branches must not be indented")]
|
||||
RootIndentLevel,
|
||||
|
||||
#[error("at least {expected} spaces of indentation were expected, but got {got}")]
|
||||
InconsistentIndentation { got: usize, expected: usize },
|
||||
|
||||
#[error("unterminated code block")]
|
||||
UnterminatedCodeBlock,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
|
||||
#[error("{range:?}: {kind}")]
|
||||
pub struct ParseError {
|
||||
pub kind: ParseErrorKind,
|
||||
pub range: Range<usize>,
|
||||
}
|
||||
|
||||
impl ParseErrorKind {
|
||||
pub fn at(self, range: Range<usize>) -> ParseError {
|
||||
ParseError { kind: self, range }
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
[package]
|
||||
name = "treehouse"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
treehouse-format = { workspace = true }
|
||||
|
||||
anyhow = "1.0.75"
|
||||
axum = { version = "0.7.9", features = ["macros"] }
|
||||
axum-macros = "0.4.2"
|
||||
base64 = "0.21.7"
|
||||
blake3 = "1.5.3"
|
||||
chrono = { version = "0.4.35", features = ["serde"] }
|
||||
clap = { version = "4.3.22", features = ["derive"] }
|
||||
codespan-reporting = "0.11.1"
|
||||
dashmap = "6.1.0"
|
||||
git2 = { version = "0.19.0", default-features = false, features = ["vendored-libgit2"] }
|
||||
handlebars = "4.3.7"
|
||||
image = "0.25.5"
|
||||
indexmap = { version = "2.2.6", features = ["serde"] }
|
||||
jotdown = { version = "0.4.1", default-features = false }
|
||||
rand = "0.8.5"
|
||||
rayon = "1.10.0"
|
||||
regex = "1.10.3"
|
||||
serde = { version = "1.0.183", features = ["derive"] }
|
||||
serde_json = "1.0.105"
|
||||
tokio = { version = "1.32.0", features = ["full"] }
|
||||
toml_edit = { version = "0.19.14", features = ["serde"] }
|
||||
tracing.workspace = true
|
||||
tracing-chrome = "0.7.2"
|
||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
|
||||
ulid = "1.0.0"
|
||||
webp = "0.3.0"
|
||||
xmlparser = "0.13.6"
|
|
@ -3,11 +3,11 @@ use std::ops::{ControlFlow, Range};
|
|||
use anyhow::{anyhow, Context};
|
||||
use codespan_reporting::diagnostic::Diagnostic;
|
||||
use tracing::{error, info};
|
||||
use treehouse_format::ast::Branch;
|
||||
|
||||
use crate::{
|
||||
parse::{self, parse_toml_with_diagnostics, parse_tree_with_diagnostics},
|
||||
state::{report_diagnostics, FileId, Source, Treehouse},
|
||||
tree::ast::Branch,
|
||||
vfs::{self, Content, Dir, Edit, EditPath, VPath},
|
||||
};
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
use std::ops::ControlFlow;
|
||||
|
||||
use treehouse_format::ast::{Branch, Roots};
|
||||
|
||||
use crate::{
|
||||
parse::parse_tree_with_diagnostics,
|
||||
state::{report_diagnostics, Source, Treehouse},
|
||||
tree::ast::{Branch, Roots},
|
||||
vfs::{self, Content, Dir, VPath},
|
||||
};
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
use std::fmt::Write;
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use treehouse_format::pull::BranchKind;
|
||||
|
||||
use crate::{
|
||||
config::Config,
|
||||
|
@ -11,7 +10,9 @@ use crate::{
|
|||
state::{FileId, Treehouse},
|
||||
tree::{
|
||||
attributes::{Content, Stage, Visibility},
|
||||
mini_template, SemaBranchId,
|
||||
mini_template,
|
||||
pull::BranchKind,
|
||||
SemaBranchId,
|
||||
},
|
||||
vfs::{self, VPath, VPathBuf},
|
||||
};
|
|
@ -2,9 +2,11 @@ use std::{ops::Range, str::FromStr};
|
|||
|
||||
use codespan_reporting::diagnostic::{Diagnostic, Label, LabelStyle, Severity};
|
||||
use tracing::instrument;
|
||||
use treehouse_format::ast::Roots;
|
||||
|
||||
use crate::state::{toml_error_to_diagnostic, FileId, TomlError, Treehouse};
|
||||
use crate::{
|
||||
state::{toml_error_to_diagnostic, FileId, TomlError, Treehouse},
|
||||
tree::{self, ast::Roots},
|
||||
};
|
||||
|
||||
pub struct ErrorsEmitted;
|
||||
|
||||
|
@ -13,7 +15,7 @@ pub fn parse_tree_with_diagnostics(
|
|||
file_id: FileId,
|
||||
input: &str,
|
||||
) -> Result<Roots, Vec<Diagnostic<FileId>>> {
|
||||
Roots::parse(&mut treehouse_format::pull::Parser { input, position: 0 }).map_err(|error| {
|
||||
Roots::parse(&mut tree::pull::Parser { input, position: 0 }).map_err(|error| {
|
||||
vec![Diagnostic {
|
||||
severity: Severity::Error,
|
||||
code: Some("tree".into()),
|
|
@ -1,20 +1,22 @@
|
|||
pub mod ast;
|
||||
pub mod attributes;
|
||||
pub mod mini_template;
|
||||
pub mod pull;
|
||||
|
||||
use std::ops::Range;
|
||||
|
||||
use attributes::Timestamps;
|
||||
use codespan_reporting::diagnostic::{Diagnostic, Label, LabelStyle, Severity};
|
||||
use tracing::instrument;
|
||||
use treehouse_format::{
|
||||
ast::{Branch, Roots},
|
||||
pull::BranchKind,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
config::Config,
|
||||
state::{toml_error_to_diagnostic, FileId, Source, TomlError, Treehouse},
|
||||
tree::attributes::{Attributes, Content},
|
||||
tree::{
|
||||
ast::{Branch, Roots},
|
||||
attributes::{Attributes, Content},
|
||||
pull::BranchKind,
|
||||
},
|
||||
};
|
||||
|
||||
use self::attributes::RootAttributes;
|
||||
|
@ -409,3 +411,31 @@ impl SemaBranch {
|
|||
attributes
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq)]
|
||||
pub enum ParseErrorKind {
|
||||
#[error("branch kind (`+` or `-`) expected")]
|
||||
BranchKindExpected,
|
||||
|
||||
#[error("root branches must not be indented")]
|
||||
RootIndentLevel,
|
||||
|
||||
#[error("at least {expected} spaces of indentation were expected, but got {got}")]
|
||||
InconsistentIndentation { got: usize, expected: usize },
|
||||
|
||||
#[error("unterminated code block")]
|
||||
UnterminatedCodeBlock,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
|
||||
#[error("{range:?}: {kind}")]
|
||||
pub struct ParseError {
|
||||
pub kind: ParseErrorKind,
|
||||
pub range: Range<usize>,
|
||||
}
|
||||
|
||||
impl ParseErrorKind {
|
||||
pub fn at(self, range: Range<usize>) -> ParseError {
|
||||
ParseError { kind: self, range }
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
use std::ops::Range;
|
||||
|
||||
use crate::{
|
||||
use super::{
|
||||
pull::{Attributes, BranchEvent, BranchKind, Parser},
|
||||
ParseError, ParseErrorKind,
|
||||
};
|
1
src/tree/lib.rs
Normal file
1
src/tree/lib.rs
Normal file
|
@ -0,0 +1 @@
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::{convert::identity, ops::Range};
|
||||
|
||||
use crate::{ParseError, ParseErrorKind};
|
||||
use super::{ParseError, ParseErrorKind};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum BranchKind {
|
|
@ -147,7 +147,7 @@ html {
|
|||
}
|
||||
|
||||
body {
|
||||
font-size: 1.4rem;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
pre,
|
||||
|
@ -183,9 +183,10 @@ input {
|
|||
"slnt" var(--recursive-slnt),
|
||||
"CRSV" var(--recursive-crsv);
|
||||
|
||||
font-feature-settings: var(--recursive-simplified-f),
|
||||
var(--recursive-simplified-g), var(--recursive-simplified-l),
|
||||
var(--recursive-simplified-r), var(--recursive-no-serif-L-Z);
|
||||
font-feature-settings:
|
||||
var(--recursive-simplified-f), var(--recursive-simplified-g),
|
||||
var(--recursive-simplified-l), var(--recursive-simplified-r),
|
||||
var(--recursive-no-serif-L-Z);
|
||||
}
|
||||
|
||||
h1 {
|
||||
|
|
35
template/_doc.hbs
Normal file
35
template/_doc.hbs
Normal file
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en-US" prefix="og: https://ogp.me/ns#">
|
||||
|
||||
<head>
|
||||
{{> components/_head.hbs }}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Empty span to push noscript over to the next grid cell.
|
||||
Browsers turn <noscript> tags into <span style="display: inline !important;"> with no
|
||||
additional classes, and we can't easily select that in CSS. -->
|
||||
<span></span>
|
||||
{{> components/_noscript.hbs }}
|
||||
|
||||
{{> components/_nav.hbs }}
|
||||
{{> components/_header.hbs }}
|
||||
|
||||
{{!--
|
||||
NOTE: ~ because components/_tree.hbs must not include any extra indentation, because it may
|
||||
contain pre elements which shouldn't be indented.
|
||||
--}}
|
||||
{{~> components/_tree.hbs }}
|
||||
|
||||
{{!-- For all pages except the one linked from the footer, include the footer icon. --}}
|
||||
{{#if (ne page.tree_path "treehouse")}}
|
||||
{{> components/_footer.hbs }}
|
||||
{{/if}}
|
||||
|
||||
<th-overlays></th-overlays>
|
||||
<th-command-line></th-command-line>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue