@@ -2,16 +2,17 @@ use std::cell::RefCell;
2
2
use std:: rc:: { Rc , Weak } ;
3
3
use std:: sync:: atomic:: { AtomicU32 , Ordering } ;
4
4
5
+ #[ cfg( not( target_os = "wasi" ) ) ]
5
6
use wasm_bindgen:: throw_str;
6
7
7
- #[ cfg( not( target_arch = "wasm32" ) ) ]
8
+ #[ cfg( any ( not( target_arch = "wasm32" ) , target_os = "wasi ") ) ]
8
9
pub ( crate ) fn get_id ( ) -> u32 {
9
10
static ID_CTR : AtomicU32 = AtomicU32 :: new ( 0 ) ;
10
11
11
12
ID_CTR . fetch_add ( 1 , Ordering :: SeqCst )
12
13
}
13
14
14
- #[ cfg( target_arch = "wasm32" ) ]
15
+ #[ cfg( all ( target_arch = "wasm32" , not ( target_os = "wasi" ) ) ) ]
15
16
pub ( crate ) fn get_id ( ) -> u32 {
16
17
static ID_CTR : AtomicU32 = AtomicU32 :: new ( 0 ) ;
17
18
static INIT : std:: sync:: Once = std:: sync:: Once :: new ( ) ;
@@ -30,19 +31,28 @@ pub(crate) fn get_id() -> u32 {
30
31
31
32
pub ( crate ) fn assert_absolute_path ( path : & str ) {
32
33
if !path. starts_with ( '/' ) {
34
+ #[ cfg( not( target_os = "wasi" ) ) ]
33
35
throw_str ( "You cannot use relative path with this history type." ) ;
36
+ #[ cfg( target_os = "wasi" ) ]
37
+ panic ! ( "You cannot use relative path with this history type." ) ;
34
38
}
35
39
}
36
40
37
41
pub ( crate ) fn assert_no_query ( path : & str ) {
38
42
if path. contains ( '?' ) {
43
+ #[ cfg( not( target_os = "wasi" ) ) ]
39
44
throw_str ( "You cannot have query in path, try use a variant of this method with `_query`." ) ;
45
+ #[ cfg( target_os = "wasi" ) ]
46
+ panic ! ( "You cannot have query in path, try use a variant of this method with `_query`." ) ;
40
47
}
41
48
}
42
49
43
50
pub ( crate ) fn assert_no_fragment ( path : & str ) {
44
51
if path. contains ( '#' ) {
52
+ #[ cfg( not( target_os = "wasi" ) ) ]
45
53
throw_str ( "You cannot use fragments (hash) in memory history." ) ;
54
+ #[ cfg( target_os = "wasi" ) ]
55
+ panic ! ( "You cannot use fragments (hash) in memory history." ) ;
46
56
}
47
57
}
48
58
0 commit comments