@@ -10,19 +10,19 @@ use crate::{
10
10
stores:: MutableStore ,
11
11
template:: { Entity , Forever , Template } ,
12
12
} ;
13
- #[ cfg( client) ]
13
+ #[ cfg( any ( client, doc ) ) ]
14
14
use crate :: {
15
15
error_views:: { ErrorContext , ErrorPosition } ,
16
16
errors:: ClientError ,
17
17
} ;
18
18
use crate :: { errors:: PluginError , template:: Capsule } ;
19
19
use crate :: { stores:: ImmutableStore , template:: EntityMap } ;
20
20
use futures:: Future ;
21
- #[ cfg( client) ]
21
+ #[ cfg( any ( client, doc ) ) ]
22
22
use std:: marker:: PhantomData ;
23
23
#[ cfg( engine) ]
24
24
use std:: pin:: Pin ;
25
- #[ cfg( client) ]
25
+ #[ cfg( any ( client, doc ) ) ]
26
26
use std:: rc:: Rc ;
27
27
use std:: { any:: TypeId , sync:: Arc } ;
28
28
use std:: { collections:: HashMap , panic:: PanicInfo } ;
@@ -160,21 +160,21 @@ pub struct PerseusAppBase<G: Html, M: MutableStore, T: TranslationsManager> {
160
160
#[ cfg( engine) ]
161
161
pub ( crate ) static_dir : String ,
162
162
/// A handler for panics on the browser-side.
163
- #[ cfg( client) ]
163
+ #[ cfg( any ( client, doc ) ) ]
164
164
pub ( crate ) panic_handler : Option < Box < dyn Fn ( & PanicInfo ) + Send + Sync + ' static > > ,
165
165
/// A duplicate of the app's error handling function intended for panic
166
166
/// handling. This must be extracted as an owned value and provided in a
167
167
/// thread-safe manner to the panic hook system.
168
168
///
169
169
/// This is in an `Arc` because panic hooks are `Fn`s, not `FnOnce`s.
170
- #[ cfg( client) ]
170
+ #[ cfg( any ( client, doc ) ) ]
171
171
pub ( crate ) panic_handler_view : Arc <
172
172
dyn Fn ( Scope , ClientError , ErrorContext , ErrorPosition ) -> ( View < SsrNode > , View < G > )
173
173
+ Send
174
174
+ Sync ,
175
175
> ,
176
176
// We need this on the client-side to account for the unused type parameters
177
- #[ cfg( client) ]
177
+ #[ cfg( any ( client, doc ) ) ]
178
178
_marker : PhantomData < ( M , T ) > ,
179
179
}
180
180
impl < G : Html , M : MutableStore , T : TranslationsManager > std:: fmt:: Debug for PerseusAppBase < G , M , T > {
@@ -190,7 +190,7 @@ impl<G: Html, M: MutableStore, T: TranslationsManager> std::fmt::Debug for Perse
190
190
. field ( "locale" , & self . locales )
191
191
. field ( "plugins" , & self . plugins )
192
192
. field ( "index_view" , & self . index_view ) ;
193
- #[ cfg( client) ]
193
+ #[ cfg( any ( client, doc ) ) ]
194
194
{
195
195
return debug
196
196
. field (
@@ -251,7 +251,7 @@ impl<G: Html, T: TranslationsManager> PerseusAppBase<G, FsMutableStore, T> {
251
251
/// This is asynchronous because it creates a translations manager in the
252
252
/// background.
253
253
// It makes no sense to implement `Default` on this, so we silence Clippy deliberately
254
- #[ cfg( client) ]
254
+ #[ cfg( any ( client, doc ) ) ]
255
255
#[ allow( clippy:: new_without_default) ]
256
256
pub fn new ( ) -> Self {
257
257
Self :: new_wasm ( )
@@ -354,7 +354,7 @@ impl<G: Html, M: MutableStore, T: TranslationsManager> PerseusAppBase<G, M, T> {
354
354
// By default, we won't use any plugins
355
355
#[ cfg( engine) ]
356
356
plugins : Arc :: new ( Plugins :: new ( ) ) ,
357
- #[ cfg( client) ]
357
+ #[ cfg( any ( client, doc ) ) ]
358
358
plugins : Rc :: new ( Plugins :: new ( ) ) ,
359
359
#[ cfg( engine) ]
360
360
immutable_store : ImmutableStore :: new ( "./dist" . to_string ( ) ) ,
@@ -366,17 +366,17 @@ impl<G: Html, M: MutableStore, T: TranslationsManager> PerseusAppBase<G, M, T> {
366
366
index_view : DFLT_INDEX_VIEW . to_string ( ) ,
367
367
#[ cfg( engine) ]
368
368
static_dir : "./static" . to_string ( ) ,
369
- #[ cfg( client) ]
369
+ #[ cfg( any ( client, doc ) ) ]
370
370
panic_handler : None ,
371
- #[ cfg( client) ]
371
+ #[ cfg( any ( client, doc ) ) ]
372
372
panic_handler_view : ErrorViews :: unlocalized_development_default ( ) . take_panic_handler ( ) ,
373
- #[ cfg( client) ]
373
+ #[ cfg( any ( client, doc ) ) ]
374
374
_marker : PhantomData ,
375
375
}
376
376
}
377
377
/// Internal function for Wasm initialization. This should never be called
378
378
/// by the user!
379
- #[ cfg( client) ]
379
+ #[ cfg( any ( client, doc ) ) ]
380
380
#[ doc( hidden) ]
381
381
fn new_wasm ( ) -> Self {
382
382
Self {
@@ -543,7 +543,7 @@ impl<G: Html, M: MutableStore, T: TranslationsManager> PerseusAppBase<G, M, T> {
543
543
// error views.
544
544
#[ allow( unused_mut) ]
545
545
pub fn error_views ( mut self , mut val : ErrorViews < G > ) -> Self {
546
- #[ cfg( client) ]
546
+ #[ cfg( any ( client, doc ) ) ]
547
547
{
548
548
let panic_handler = val. take_panic_handler ( ) ;
549
549
self . error_views = Some ( Rc :: new ( val) ) ;
@@ -666,7 +666,7 @@ impl<G: Html, M: MutableStore, T: TranslationsManager> PerseusAppBase<G, M, T> {
666
666
/// Sets the plugins that the app will use. See [`Plugins`] for
667
667
/// further details.
668
668
pub fn plugins ( mut self , val : Plugins ) -> Self {
669
- #[ cfg( client) ]
669
+ #[ cfg( any ( client, doc ) ) ]
670
670
{
671
671
self . plugins = Rc :: new ( val) ;
672
672
}
@@ -771,7 +771,7 @@ impl<G: Html, M: MutableStore, T: TranslationsManager> PerseusAppBase<G, M, T> {
771
771
#[ allow( unused_variables) ]
772
772
#[ allow( unused_mut) ]
773
773
pub fn panic_handler ( mut self , val : impl Fn ( & PanicInfo ) + Send + Sync + ' static ) -> Self {
774
- #[ cfg( client) ]
774
+ #[ cfg( any ( client, doc ) ) ]
775
775
{
776
776
self . panic_handler = Some ( Box :: new ( val) ) ;
777
777
}
@@ -908,7 +908,7 @@ impl<G: Html, M: MutableStore, T: TranslationsManager> PerseusAppBase<G, M, T> {
908
908
// self.entities.clone()
909
909
// }
910
910
// /// Gets the [`ErrorViews`] used in the app. This returns an `Rc`.
911
- // #[cfg(client)]
911
+ // #[cfg(any( client, doc) )]
912
912
// pub fn get_error_views(&self) -> Rc<ErrorViews<G>> {
913
913
// self.error_views.clone()
914
914
// }
@@ -978,7 +978,7 @@ impl<G: Html, M: MutableStore, T: TranslationsManager> PerseusAppBase<G, M, T> {
978
978
// self.plugins.clone()
979
979
// }
980
980
// /// Gets the plugins registered for the app.
981
- // #[cfg(client)]
981
+ // #[cfg(any( client, doc) )]
982
982
// pub fn get_plugins(&self) -> Rc<Plugins> {
983
983
// self.plugins.clone()
984
984
// }
@@ -1039,7 +1039,7 @@ impl<G: Html, M: MutableStore, T: TranslationsManager> PerseusAppBase<G, M, T> {
1039
1039
/// # Future panics
1040
1040
/// If this is called more than once, the view panic handler will panic when
1041
1041
/// called.
1042
- #[ cfg( client) ]
1042
+ #[ cfg( any ( client, doc ) ) ]
1043
1043
pub fn take_panic_handlers (
1044
1044
& mut self ,
1045
1045
) -> (
0 commit comments