Skip to content

Commit

Permalink
chore(innate): add workspace crates
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Oct 6, 2023
1 parent f4103f5 commit 2368ff1
Show file tree
Hide file tree
Showing 139 changed files with 15,408 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: corepack enable && corepack prepare yarn@stable --activate

- name: Wasm pack build modules
run: cd kayle_innate && wasm-pack build --target nodejs && cd ../
run: cd kayle_innate && wasm-pack build --release --target nodejs kayle_innate && cd ../

- name: Install and build locales
run: yarn --no-immutable && yarn build && npx playwright install --with-deps chromium
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: corepack enable && corepack prepare yarn@stable --activate

- name: Wasm pack build modules
run: cd kayle_innate && wasm-pack build --target nodejs && cd ../
run: cd kayle_innate && wasm-pack build --release --target nodejs kayle_innate && cd ../

- name: Install and build locales
run: yarn --no-immutable && yarn build && npx playwright install --with-deps chromium
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: corepack enable && corepack prepare yarn@stable --activate

- name: Wasm pack build modules
run: cd kayle_innate && wasm-pack build --target nodejs && cd ../
run: cd kayle_innate && wasm-pack build --release --target nodejs kayle_innate && cd ../

- name: Install and build locales
run: yarn --no-immutable && yarn build && npx playwright install --with-deps chromium
Expand Down
29 changes: 23 additions & 6 deletions kayle_innate/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion kayle_innate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[workspace]
resolver = "2"
members = [
"kayle_innate"
"kayle_innate",
"kayle_victor/victor",
"kayle_scraper"
]
10 changes: 5 additions & 5 deletions kayle_innate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ The rust lib for accessibility things.

Target the platform that you need like nodejs or browsers etc.

`wasm-pack build --target nodejs`
` wasm-pack build --target nodejs --release kayle_innate`

## Testing

1. `wasm-pack test --node --firefox --chrome --headless`
1. `wasm-pack test --node --firefox --chrome --headless kayle_innate`

In order to test the accessibility parser in Rust run.

`RUST_LOG=info wasm-pack test --firefox --headless --features accessibility --release`.
`RUST_LOG=info wasm-pack test --firefox --headless --features accessibility --release kayle_innate`.

## Debugging

Expand All @@ -30,5 +30,5 @@ In order to make a better accessibility runner from the ground up we are adding

## Publishing

1. `wasm-pack build`
1. `wasm-pack publish`
1. `wasm-pack build kayle_innate`
1. `wasm-pack publish kayle_innate`
7 changes: 5 additions & 2 deletions kayle_innate/kayle_innate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ wee_alloc = { version = "0.4.5", optional = true }
url = "2.4.0"
lazy_static = "1.4.0"
case_insensitive_string = "0.1.0"
scraper_forky = { version = "0.17.1", features = ["main"], default-features = false }
scraper_forky = { version = "0.17.1", features = ["main"], default-features = false, path = "../kayle_scraper" }
getrandom = { version = "0.2", features = ["js"] }
taffy = { version = "0.3.13", optional = true }
serde = { version = "1.0", features = ["derive"] }
Expand All @@ -30,7 +30,7 @@ js-sys = "0.3.64"
selectors = "=0.21.0"
smallvec = "0.6"
ego-tree = "0.6.2"
victor_tree = { version = "0.0.7" }
victor_tree = { version = "0.0.7", path = "../kayle_victor/victor" }
markup5ever = "0.11.0"

[dependencies.cssparser]
Expand All @@ -39,6 +39,9 @@ version = "^0.25.0"
[dev-dependencies]
wasm-bindgen-test = "0.3.37"

[profile.dev]
opt-level = 3

[profile.release]
opt-level = "s"
lto = true
32 changes: 16 additions & 16 deletions kayle_innate/kayle_innate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ pub use wasm_bindgen::prelude::*;
#[macro_use]
extern crate lazy_static;

/// the main engine for audits
/// the main engine for audits.
mod engine;
/// locales
/// locales for translations.
mod i18n;
/// used for auto-kayle to gather all links in a page.
/// auto-kayle helpers to gather all links in a page.
mod links;
/// helpers
/// app utilities.
mod utils;

#[cfg(feature = "accessibility")]
Expand Down Expand Up @@ -56,19 +56,19 @@ pub fn _audit_not_ready(html: &str, css_rules: &str) -> Result<JsValue, JsValue>
let _audit = engine::audit::wcag::WCAG3AA::audit(&auditor);
console_log!("Audit Time {:?}", now() - ttt);

let mut _match_context = auditor.match_context;
// let mut _match_context = auditor.match_context;

for item in auditor.tree {
for node in item.1 {
let _style = victor_tree::style::cascade::style_for_element_ref(
&node,
&auditor.author,
&document,
&mut _match_context,
);
console_log!("{:?}", _style.as_ref().box_size())
}
}
// for item in auditor.tree {
// for node in item.1 {
// let _style = victor_tree::style::cascade::style_for_element_ref(
// &node,
// &auditor.author,
// &document,
// &mut _match_context,
// );
// console_log!("{:?}", _style.as_ref().box_size())
// }
// }

// todo: map to JsValues instead of serde
Ok(serde_wasm_bindgen::to_value(&_audit)?)
Expand Down
2 changes: 1 addition & 1 deletion kayle_innate/kayle_innate/tests/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ fn _get_document_links() {

#[wasm_bindgen_test]
#[cfg(feature = "accessibility")]
fn _parse_accessibility_tree() {
fn _audit() {
let _ = kayle_innate::_audit_not_ready(mock::MOCK_WEBSITE_HTML, &mock::MOCK_CSS_RULES);
}
13 changes: 13 additions & 0 deletions kayle_innate/kayle_scraper/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# EditorConfig
root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

[*.md]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions kayle_innate/kayle_scraper/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target
*.bk
.idea
Loading

0 comments on commit 2368ff1

Please sign in to comment.