Skip to content

Commit cc1e8f3

Browse files
authored
Merge pull request #230 from noahbald/feat/227-web-sys-dom-parser
feat: #227 web sys dom parser
2 parents d6d6711 + 49ed97a commit cc1e8f3

File tree

19 files changed

+694
-113
lines changed

19 files changed

+694
-113
lines changed

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
if: $${{ always() }} # run even if clippy failed
3737
run: cargo doc --workspace --no-deps --locked
3838
- name: Run tests
39-
run: cargo test --workspace --verbose --locked --exclude oxvg_napi
39+
run: cargo test --workspace --verbose --locked --exclude oxvg_napi --exclude oxvg_wasm
4040

4141
toml:
4242
name: Toml formatting

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
target/
4949
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
5050
- name: Run tests
51-
run: cargo test --verbose --workspace --profile release --target=${{ matrix.settings.target }} --exclude oxvg_napi
51+
run: cargo test --verbose --workspace --profile release --target=${{ matrix.settings.target }} --exclude oxvg_napi --exclude oxvg_wasm
5252
- name: Build
5353
run: cargo build --verbose --bins --profile release --target=${{ matrix.settings.target }}
5454
- name: List

Cargo.lock

Lines changed: 34 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,15 @@ cfg-if = { version = "1.0" }
4343
clap = { version = "4.5", features = ["derive"] }
4444
# NOTE: Out of date version used for compatibility with selectors
4545
# https://github.com/servo/stylo/blob/main/Cargo.toml#L35
46-
cssparser = "0.34.0"
46+
cssparser = "0.36"
4747
cssparser_lightningcss = { package = "cssparser", version = "0.33" }
4848
dashmap = "6.1"
4949
derive_more = "2.0"
5050
derive-where = "1.2"
5151
getrandom = { version = "0.3" }
5252
itertools = "0.14"
53-
lightningcss = { version = "1.0.0-alpha.70", default-features = false, features = [
53+
js-sys = { version = "0.3" }
54+
lightningcss = { version = "1.0.0-alpha.71", default-features = false, features = [
5455
"visitor",
5556
] }
5657
log = { version = "0.4" }
@@ -66,7 +67,7 @@ rcdom = { package = "markup5ever_rcdom", version = "0.36.0" }
6667
regex = "1.11"
6768
roxmltree = "0.20"
6869
schemars = { version = "1.2.1" }
69-
selectors = "0.26"
70+
selectors = "0.36"
7071
serde = "1.0"
7172
serde_json = "1.0"
7273
serde-wasm-bindgen = "0.6"
@@ -79,6 +80,7 @@ tower-lsp-server = "0.22"
7980
tsify = { version = "0.5", default-features = false, features = ["js"] }
8081
typed-arena = "2.0"
8182
wasm-bindgen = "=0.2.104"
83+
web-sys = { version = "0.3" }
8284
xml5ever = "0.38"
8385

8486
# Developer dependencies

crates/oxvg_ast/Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ selectors = [
3838
]
3939
# Include source-spans for nodes and attributes
4040
range = ["dep:bytecount"]
41+
# Includes a parser that uses web_sys
42+
web_sys = ["parse", "dep:web-sys"]
4143
# Includes a visitor trait for building visitors
4244
visitor = ["dep:bitflags"]
4345

@@ -68,4 +70,18 @@ smallvec = { workspace = true }
6870
string_cache = { workspace = true, optional = true }
6971
tendril = { workspace = true, optional = true }
7072
typed-arena = { workspace = true }
73+
web-sys = { workspace = true, features = [
74+
"Document",
75+
"DomParser",
76+
"SupportedType",
77+
"Node",
78+
"NodeList",
79+
"Element",
80+
"NamedNodeMap",
81+
"Attr",
82+
"ProcessingInstruction",
83+
"StyleSheet",
84+
"CharacterData",
85+
"Comment",
86+
], optional = true }
7187
xml5ever = { workspace = true, optional = true }

crates/oxvg_ast/src/parse.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ pub mod markup5ever;
1010

1111
#[cfg(feature = "roxmltree")]
1212
pub mod roxmltree;
13+
14+
#[cfg(feature = "web_sys")]
15+
pub mod web_sys;

0 commit comments

Comments
 (0)