1
1
import { unstable_defineEntries as defineEntries } from 'waku/minimal/server' ;
2
2
import { Slot } from 'waku/minimal/client' ;
3
+ import { unstable_createAsyncIterable as createAsyncIterable } from 'waku/server' ;
3
4
4
5
import App from './components2/App' ;
5
6
import { runWithRerender } from './als' ;
@@ -25,5 +26,42 @@ export default defineEntries({
25
26
} ) ;
26
27
}
27
28
} ,
28
- getBuildConfig : async ( ) => [ { pathSpec : [ ] , entries : [ { rscPath : '' } ] } ] ,
29
+ handleBuild : ( {
30
+ // renderRsc,
31
+ // renderHtml,
32
+ // rscPath2pathname,
33
+ unstable_generatePrefetchCode,
34
+ } ) =>
35
+ createAsyncIterable ( async ( ) => {
36
+ const moduleIds = new Set < string > ( ) ;
37
+ const generateHtmlHead = ( ) =>
38
+ `<script type="module" async>${ unstable_generatePrefetchCode (
39
+ [ '' ] ,
40
+ moduleIds ,
41
+ ) } </script>`;
42
+ const tasks = [
43
+ async ( ) => ( {
44
+ type : 'htmlHead' as const ,
45
+ pathSpec : [ ] ,
46
+ head : generateHtmlHead ( ) ,
47
+ } ) ,
48
+ // async () => ({
49
+ // type: 'file' as const,
50
+ // pathname: rscPath2pathname(''),
51
+ // body: await renderRsc(
52
+ // { App: <App name="Waku" /> },
53
+ // { moduleIdCallback: (id) => moduleIds.add(id) },
54
+ // ),
55
+ // }),
56
+ // async () => ({
57
+ // type: 'file' as const,
58
+ // pathname: '/',
59
+ // body: renderHtml({ App: <App name="Waku" /> }, <Slot id="App" />, {
60
+ // rscPath: '',
61
+ // htmlHead: generateHtmlHead(),
62
+ // }).then(({ body }) => body),
63
+ // }),
64
+ ] ;
65
+ return tasks ;
66
+ } ) ,
29
67
} ) ;
0 commit comments