mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-16 23:50:02 -04:00
rewrite the rewriter
This commit is contained in:
parent
73c1c8a5c8
commit
6a5ecc4efc
6 changed files with 62 additions and 128 deletions
|
@ -1,6 +1,9 @@
|
|||
pub mod rewrite;
|
||||
|
||||
use std::str::{from_utf8, FromStr};
|
||||
use std::{
|
||||
panic,
|
||||
str::{from_utf8, FromStr},
|
||||
};
|
||||
|
||||
use js_sys::Uint8Array;
|
||||
use rewrite::rewrite;
|
||||
|
@ -13,6 +16,11 @@ extern "C" {
|
|||
fn log(s: &str);
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn init() {
|
||||
panic::set_hook(Box::new(console_error_panic_hook::hook));
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn rewrite_js(js: &str, url: &str) -> Vec<u8> {
|
||||
rewrite(js, Url::from_str(url).unwrap())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue