@quilted/create 0.2.49 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/build/esm/node_modules/.pnpm/prettier@3.5.1/node_modules/prettier/plugins/typescript.mjs +1 -1
- package/build/esm/node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/prompts.mjs +1 -1
- package/build/esm/node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/prompts.mjs +1 -1
- package/build/esnext/_virtual/index7.esnext +2 -2
- package/build/esnext/_virtual/index8.esnext +2 -2
- package/build/esnext/node_modules/.pnpm/dir-glob@3.0.1/node_modules/dir-glob/index.esnext +1 -1
- package/build/esnext/node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/index.esnext +1 -1
- package/build/esnext/node_modules/.pnpm/prettier@3.5.1/node_modules/prettier/plugins/typescript.esnext +2 -2
- package/build/esnext/node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/dist/prompts.esnext +1 -1
- package/build/esnext/node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/prompts.esnext +1 -1
- package/package.json +1 -1
- package/templates/app-basic/App.tsx +8 -20
- package/templates/app-basic/package.json +2 -1
- package/templates/app-basic/server.tsx +7 -5
- package/templates/app-basic/shared/context.ts +2 -2
- package/templates/app-basic/tests/render/render.tsx +3 -3
- package/templates/app-empty/package.json +2 -1
- package/templates/app-empty/server.tsx +6 -5
- package/templates/app-graphql/App.tsx +14 -22
- package/templates/app-graphql/package.json +2 -1
- package/templates/app-graphql/server.tsx +11 -7
- package/templates/app-graphql/shared/context.ts +3 -11
- package/templates/app-graphql/shared/graphql.ts +10 -0
- package/templates/app-graphql/tests/render/render.tsx +3 -3
- package/templates/app-trpc/App.tsx +15 -22
- package/templates/app-trpc/package.json +2 -1
- package/templates/app-trpc/server.tsx +18 -18
- package/templates/app-trpc/shared/context.ts +2 -2
- package/templates/app-trpc/tests/render/render.tsx +3 -3
- package/templates/github/_github/workflows/actions/prepare/action.yml +6 -3
- package/templates/github/_github/workflows/ci.yml +7 -4
- package/templates/server-basic/package.json +1 -1
- package/templates/server-basic/server.ts +2 -2
- package/templates/workspace/package.json +5 -5
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var utils = {};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { utils as __exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var dirGlob = {exports: {}};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { dirGlob as __module };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as dirGlob } from '../../../../../_virtual/
|
|
1
|
+
import { __module as dirGlob } from '../../../../../_virtual/index8.esnext';
|
|
2
2
|
import path__default from 'node:path';
|
|
3
3
|
import { __require as requirePathType } from '../../../path-type@4.0.0/node_modules/path-type/index.esnext';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as utils } from '../../../../../../../_virtual/
|
|
1
|
+
import { __exports as utils } from '../../../../../../../_virtual/index7.esnext';
|
|
2
2
|
import { __require as requireArray } from './array.esnext';
|
|
3
3
|
import { __require as requireErrno } from './errno.esnext';
|
|
4
4
|
import { __require as requireFs } from './fs.esnext';
|
|
@@ -3516,10 +3516,10 @@ function z2(e, t) {
|
|
|
3516
3516
|
return V2(e) & t;
|
|
3517
3517
|
}
|
|
3518
3518
|
function F2(e, t, a) {
|
|
3519
|
-
return e.kind >= 0 && e.kind <= 165 ? 0 : (e.modifierFlagsCache & 536870912 || (e.modifierFlagsCache = T1(e) | 536870912), W2(e.modifierFlagsCache));
|
|
3519
|
+
return e.kind >= 0 && e.kind <= 165 ? 0 : (e.modifierFlagsCache & 536870912 || (e.modifierFlagsCache = T1(e) | 536870912), a || t && ea(e) ? (!(e.modifierFlagsCache & 268435456) && e.parent && (e.modifierFlagsCache |= b1(e) | 268435456), v1(e.modifierFlagsCache)) : W2(e.modifierFlagsCache));
|
|
3520
3520
|
}
|
|
3521
3521
|
function V2(e) {
|
|
3522
|
-
return F2(e);
|
|
3522
|
+
return F2(e, false);
|
|
3523
3523
|
}
|
|
3524
3524
|
function b1(e) {
|
|
3525
3525
|
let t = 0;
|
package/package.json
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type {RenderableProps} from 'preact';
|
|
2
|
-
|
|
3
1
|
import {NotFound} from '@quilted/quilt/server';
|
|
4
2
|
import {Navigation} from '@quilted/quilt/navigation';
|
|
5
3
|
import {Localization} from '@quilted/quilt/localize';
|
|
@@ -9,14 +7,11 @@ import {Frame} from './foundation/frame.ts';
|
|
|
9
7
|
|
|
10
8
|
import {Home} from './features/home.ts';
|
|
11
9
|
|
|
12
|
-
import {
|
|
13
|
-
AppContextReact,
|
|
14
|
-
type AppContext as AppContextType,
|
|
15
|
-
} from './shared/context.ts';
|
|
10
|
+
import {AppContextPreact, type AppContext} from './shared/context.ts';
|
|
16
11
|
import {routeWithAppContext} from './shared/navigation.ts';
|
|
17
12
|
|
|
18
13
|
export interface AppProps {
|
|
19
|
-
context:
|
|
14
|
+
context: AppContext;
|
|
20
15
|
}
|
|
21
16
|
|
|
22
17
|
// Define the routes for your application. If you have a lot of routes, you
|
|
@@ -40,20 +35,13 @@ const routes = [
|
|
|
40
35
|
// app-wide context in this component.
|
|
41
36
|
export function App({context}: AppProps) {
|
|
42
37
|
return (
|
|
43
|
-
<
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
<AppContextPreact.Provider value={context}>
|
|
39
|
+
<Localization>
|
|
40
|
+
<Head />
|
|
41
|
+
<Navigation router={context.router} routes={routes} context={context} />
|
|
42
|
+
</Localization>
|
|
43
|
+
</AppContextPreact.Provider>
|
|
47
44
|
);
|
|
48
45
|
}
|
|
49
46
|
|
|
50
47
|
export default App;
|
|
51
|
-
|
|
52
|
-
// This component renders any app-wide context.
|
|
53
|
-
function AppContext({children, context}: RenderableProps<AppProps>) {
|
|
54
|
-
return (
|
|
55
|
-
<AppContextReact.Provider value={context}>
|
|
56
|
-
<Localization>{children}</Localization>
|
|
57
|
-
</AppContextReact.Provider>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {Router} from '@quilted/quilt/navigation';
|
|
1
|
+
import {Hono} from 'hono';
|
|
3
2
|
import {
|
|
4
3
|
renderAppToHTMLResponse,
|
|
5
4
|
CacheControlHeader,
|
|
@@ -7,6 +6,7 @@ import {
|
|
|
7
6
|
PermissionsPolicyHeader,
|
|
8
7
|
StrictTransportSecurityHeader,
|
|
9
8
|
} from '@quilted/quilt/server';
|
|
9
|
+
import {Router} from '@quilted/quilt/navigation';
|
|
10
10
|
|
|
11
11
|
import Env from 'quilt:module/env';
|
|
12
12
|
import {BrowserAssets} from 'quilt:module/assets';
|
|
@@ -15,7 +15,7 @@ import type {AppContext} from '~/shared/context.ts';
|
|
|
15
15
|
|
|
16
16
|
import {App} from './App.tsx';
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const app = new Hono();
|
|
19
19
|
const assets = new BrowserAssets();
|
|
20
20
|
|
|
21
21
|
class ServerAppContext implements AppContext {
|
|
@@ -27,7 +27,9 @@ class ServerAppContext implements AppContext {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// For all GET requests, render our Preact application.
|
|
30
|
-
|
|
30
|
+
app.get('*', async (c) => {
|
|
31
|
+
const request = c.req.raw;
|
|
32
|
+
|
|
31
33
|
const context = new ServerAppContext(request);
|
|
32
34
|
|
|
33
35
|
const isHttps = request.url.startsWith('https://');
|
|
@@ -115,4 +117,4 @@ router.get(async (request) => {
|
|
|
115
117
|
return response;
|
|
116
118
|
});
|
|
117
119
|
|
|
118
|
-
export default
|
|
120
|
+
export default app;
|
|
@@ -2,5 +2,5 @@ import {createOptionalContext} from '@quilted/quilt/context';
|
|
|
2
2
|
|
|
3
3
|
export interface AppContext {}
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
export const useAppContext =
|
|
5
|
+
export const AppContextPreact = createOptionalContext<AppContext>();
|
|
6
|
+
export const useAppContext = AppContextPreact.use;
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {Navigation, TestRouter} from '@quilted/quilt/navigation/testing';
|
|
7
7
|
import {Localization} from '@quilted/quilt/localize';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import {AppContextPreact} from '~/shared/context.ts';
|
|
10
10
|
|
|
11
11
|
import {RenderOptions, RenderContext, RenderActions} from './types.ts';
|
|
12
12
|
|
|
@@ -31,13 +31,13 @@ export const renderApp = createRender<
|
|
|
31
31
|
const {router, browser} = context;
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
|
-
<
|
|
34
|
+
<AppContextPreact.Provider value={context}>
|
|
35
35
|
<BrowserDetailsContext.Provider value={browser}>
|
|
36
36
|
<Localization locale={locale}>
|
|
37
37
|
<Navigation router={router}>{element}</Navigation>
|
|
38
38
|
</Localization>
|
|
39
39
|
</BrowserDetailsContext.Provider>
|
|
40
|
-
</
|
|
40
|
+
</AppContextPreact.Provider>
|
|
41
41
|
);
|
|
42
42
|
},
|
|
43
43
|
async afterRender() {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import {Hono} from 'hono';
|
|
1
2
|
import {renderAppToHTMLResponse} from '@quilted/quilt/server';
|
|
2
|
-
import {RequestRouter} from '@quilted/quilt/request-router';
|
|
3
3
|
import {BrowserAssets} from 'quilt:module/assets';
|
|
4
4
|
|
|
5
5
|
import {App} from './App.tsx';
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const app = new Hono();
|
|
8
8
|
const assets = new BrowserAssets();
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
app.get('*', async (c) => {
|
|
11
|
+
const request = c.req.raw;
|
|
12
|
+
|
|
12
13
|
const response = await renderAppToHTMLResponse(<App />, {
|
|
13
14
|
request,
|
|
14
15
|
assets,
|
|
@@ -17,4 +18,4 @@ router.get(async (request) => {
|
|
|
17
18
|
return response;
|
|
18
19
|
});
|
|
19
20
|
|
|
20
|
-
export default
|
|
21
|
+
export default app;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type {RenderableProps} from 'preact';
|
|
2
|
-
|
|
3
1
|
import {NotFound} from '@quilted/quilt/server';
|
|
4
2
|
import {GraphQLContext} from '@quilted/quilt/graphql';
|
|
5
3
|
import {Navigation} from '@quilted/quilt/navigation';
|
|
@@ -10,14 +8,11 @@ import {Frame} from './foundation/frame.ts';
|
|
|
10
8
|
|
|
11
9
|
import {Home, homeQuery} from './features/home.ts';
|
|
12
10
|
|
|
13
|
-
import {
|
|
14
|
-
AppContextReact,
|
|
15
|
-
type AppContext as AppContextType,
|
|
16
|
-
} from './shared/context.ts';
|
|
11
|
+
import {AppContextPreact, type AppContext} from './shared/context.ts';
|
|
17
12
|
import {routeWithAppContext} from './shared/navigation.ts';
|
|
18
13
|
|
|
19
14
|
export interface AppProps {
|
|
20
|
-
context:
|
|
15
|
+
context: AppContext;
|
|
21
16
|
}
|
|
22
17
|
|
|
23
18
|
// Define the routes for your application. If you have a lot of routes, you
|
|
@@ -41,25 +36,22 @@ const routes = [
|
|
|
41
36
|
// app-wide context in this component.
|
|
42
37
|
export function App({context}: AppProps) {
|
|
43
38
|
return (
|
|
44
|
-
<
|
|
45
|
-
<Head />
|
|
46
|
-
<Navigation router={context.router} routes={routes} context={context} />
|
|
47
|
-
</AppContext>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default App;
|
|
52
|
-
|
|
53
|
-
// This component renders any app-wide context.
|
|
54
|
-
function AppContext({children, context}: RenderableProps<AppProps>) {
|
|
55
|
-
return (
|
|
56
|
-
<AppContextReact.Provider value={context}>
|
|
39
|
+
<AppContextPreact.Provider value={context}>
|
|
57
40
|
<GraphQLContext
|
|
58
41
|
fetch={context.graphql.fetch}
|
|
59
42
|
cache={context.graphql.cache}
|
|
60
43
|
>
|
|
61
|
-
<Localization>
|
|
44
|
+
<Localization>
|
|
45
|
+
<Head />
|
|
46
|
+
<Navigation
|
|
47
|
+
router={context.router}
|
|
48
|
+
routes={routes}
|
|
49
|
+
context={context}
|
|
50
|
+
/>
|
|
51
|
+
</Localization>
|
|
62
52
|
</GraphQLContext>
|
|
63
|
-
</
|
|
53
|
+
</AppContextPreact.Provider>
|
|
64
54
|
);
|
|
65
55
|
}
|
|
56
|
+
|
|
57
|
+
export default App;
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
"dependencies": {},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@quilted/graphql-tools": "^0.2.0",
|
|
19
|
-
"@quilted/quilt": "^0.
|
|
19
|
+
"@quilted/quilt": "^0.9.0",
|
|
20
20
|
"graphql": "^16.8.0",
|
|
21
|
+
"hono": "^4.8.0",
|
|
21
22
|
"jsdom": "^26.0.0",
|
|
22
23
|
"preact": "^10.26.0",
|
|
23
24
|
"react": "npm:@quilted/react@^19.0.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Hono} from 'hono';
|
|
2
2
|
import {Router} from '@quilted/quilt/navigation';
|
|
3
3
|
import {
|
|
4
4
|
renderAppToHTMLResponse,
|
|
@@ -14,7 +14,7 @@ import {BrowserAssets} from 'quilt:module/assets';
|
|
|
14
14
|
|
|
15
15
|
import type {AppContext} from '~/shared/context.ts';
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const app = new Hono();
|
|
18
18
|
const assets = new BrowserAssets();
|
|
19
19
|
|
|
20
20
|
class ServerAppContext implements AppContext {
|
|
@@ -37,7 +37,9 @@ class ServerAppContext implements AppContext {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// GraphQL API, called from the client
|
|
40
|
-
|
|
40
|
+
app.post('/api/graphql', async (c) => {
|
|
41
|
+
const request = c.req.raw;
|
|
42
|
+
|
|
41
43
|
const [{query, operationName, variables}, {performGraphQLOperation}] =
|
|
42
44
|
await Promise.all([request.json(), import('./server/graphql.ts')]);
|
|
43
45
|
|
|
@@ -46,11 +48,13 @@ router.post('/api/graphql', async (request) => {
|
|
|
46
48
|
operationName,
|
|
47
49
|
});
|
|
48
50
|
|
|
49
|
-
return
|
|
51
|
+
return Response.json(result);
|
|
50
52
|
});
|
|
51
53
|
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
+
// Preact app
|
|
55
|
+
app.get('*', async (c) => {
|
|
56
|
+
const request = c.req.raw;
|
|
57
|
+
|
|
54
58
|
const [{App}] = await Promise.all([import('./App.tsx')]);
|
|
55
59
|
|
|
56
60
|
const context = new ServerAppContext(request);
|
|
@@ -140,4 +144,4 @@ router.get(async (request) => {
|
|
|
140
144
|
return response;
|
|
141
145
|
});
|
|
142
146
|
|
|
143
|
-
export default
|
|
147
|
+
export default app;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import {createOptionalContext} from '@quilted/quilt/context';
|
|
2
|
-
import type {Router} from '@quilted/quilt/navigation';
|
|
3
|
-
import type {GraphQLFetch, GraphQLCache} from '@quilted/quilt/graphql';
|
|
4
2
|
|
|
5
|
-
export interface AppContext {
|
|
6
|
-
readonly router: Router;
|
|
7
|
-
readonly graphql: {
|
|
8
|
-
readonly fetch: GraphQLFetch<any>;
|
|
9
|
-
readonly cache: GraphQLCache;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
3
|
+
export interface AppContext {}
|
|
12
4
|
|
|
13
|
-
export const
|
|
14
|
-
export const useAppContext =
|
|
5
|
+
export const AppContextPreact = createOptionalContext<AppContext>();
|
|
6
|
+
export const useAppContext = AppContextPreact.use;
|
|
@@ -2,8 +2,18 @@ import type {GraphQLFetch, GraphQLCache} from '@quilted/quilt/graphql';
|
|
|
2
2
|
|
|
3
3
|
declare module '~/shared/context.ts' {
|
|
4
4
|
interface AppContext {
|
|
5
|
+
/**
|
|
6
|
+
* The app’s GraphQL client.
|
|
7
|
+
*/
|
|
5
8
|
readonly graphql: {
|
|
9
|
+
/**
|
|
10
|
+
* A function to perform GraphQL operations.
|
|
11
|
+
*/
|
|
6
12
|
readonly fetch: GraphQLFetch;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The app’s GraphQL cache.
|
|
16
|
+
*/
|
|
7
17
|
readonly cache: GraphQLCache;
|
|
8
18
|
};
|
|
9
19
|
}
|
|
@@ -9,7 +9,7 @@ import {Navigation, TestRouter} from '@quilted/quilt/navigation/testing';
|
|
|
9
9
|
import {Localization} from '@quilted/quilt/localize';
|
|
10
10
|
import {GraphQLCache} from '@quilted/quilt/graphql';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import {AppContextPreact} from '~/shared/context.ts';
|
|
13
13
|
|
|
14
14
|
import {GraphQLTesting, GraphQLController} from '../graphql.ts';
|
|
15
15
|
|
|
@@ -46,7 +46,7 @@ export const renderApp = createRender<
|
|
|
46
46
|
const {router, browser, graphql, graphQLController} = context;
|
|
47
47
|
|
|
48
48
|
return (
|
|
49
|
-
<
|
|
49
|
+
<AppContextPreact.Provider value={context}>
|
|
50
50
|
<BrowserDetailsContext.Provider value={browser}>
|
|
51
51
|
<Localization locale={locale}>
|
|
52
52
|
<Navigation router={router}>
|
|
@@ -59,7 +59,7 @@ export const renderApp = createRender<
|
|
|
59
59
|
</Navigation>
|
|
60
60
|
</Localization>
|
|
61
61
|
</BrowserDetailsContext.Provider>
|
|
62
|
-
</
|
|
62
|
+
</AppContextPreact.Provider>
|
|
63
63
|
);
|
|
64
64
|
},
|
|
65
65
|
async afterRender(wrapper) {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type {RenderableProps} from 'preact';
|
|
2
|
-
|
|
3
1
|
import {NotFound} from '@quilted/quilt/server';
|
|
4
2
|
import {Navigation} from '@quilted/quilt/navigation';
|
|
5
3
|
import {Localization} from '@quilted/quilt/localize';
|
|
@@ -13,7 +11,7 @@ import {Home} from './features/home.ts';
|
|
|
13
11
|
|
|
14
12
|
import {trpc} from './shared/trpc.ts';
|
|
15
13
|
import {
|
|
16
|
-
|
|
14
|
+
AppContextPreact,
|
|
17
15
|
type AppContext as AppContextType,
|
|
18
16
|
} from './shared/context.ts';
|
|
19
17
|
import {routeWithAppContext} from './shared/navigation.ts';
|
|
@@ -43,26 +41,21 @@ const routes = [
|
|
|
43
41
|
// app-wide context in this component.
|
|
44
42
|
export function App({context}: AppProps) {
|
|
45
43
|
return (
|
|
46
|
-
<
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
<AppContextPreact.Provider value={context}>
|
|
45
|
+
<trpc.Provider client={context.trpc} queryClient={context.queryClient}>
|
|
46
|
+
<ReactQueryContext client={context.queryClient}>
|
|
47
|
+
<Localization>
|
|
48
|
+
<Head />
|
|
49
|
+
<Navigation
|
|
50
|
+
router={context.router}
|
|
51
|
+
routes={routes}
|
|
52
|
+
context={context}
|
|
53
|
+
/>
|
|
54
|
+
</Localization>
|
|
55
|
+
</ReactQueryContext>
|
|
56
|
+
</trpc.Provider>
|
|
57
|
+
</AppContextPreact.Provider>
|
|
50
58
|
);
|
|
51
59
|
}
|
|
52
60
|
|
|
53
61
|
export default App;
|
|
54
|
-
|
|
55
|
-
// This component renders any app-wide context.
|
|
56
|
-
function AppContext({children, context}: RenderableProps<AppProps>) {
|
|
57
|
-
return (
|
|
58
|
-
<AppContextReact.Provider value={context}>
|
|
59
|
-
<Localization>
|
|
60
|
-
<trpc.Provider client={context.trpc} queryClient={context.queryClient}>
|
|
61
|
-
<ReactQueryContext client={context.queryClient}>
|
|
62
|
-
{children}
|
|
63
|
-
</ReactQueryContext>
|
|
64
|
-
</trpc.Provider>
|
|
65
|
-
</Localization>
|
|
66
|
-
</AppContextReact.Provider>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@quilted/quilt": "^0.
|
|
18
|
+
"@quilted/quilt": "^0.9.0",
|
|
19
19
|
"@quilted/react-query": "^0.4.0",
|
|
20
20
|
"@quilted/trpc": "^0.2.0",
|
|
21
21
|
"@tanstack/react-query": "^5.0.0",
|
|
22
22
|
"@trpc/client": "next",
|
|
23
23
|
"@trpc/react-query": "next",
|
|
24
24
|
"@trpc/server": "next",
|
|
25
|
+
"hono": "^4.8.0",
|
|
25
26
|
"jsdom": "^26.0.0",
|
|
26
27
|
"preact": "^10.26.0",
|
|
27
28
|
"react": "npm:@quilted/react@^19.0.0",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {Hono} from 'hono';
|
|
1
2
|
import {
|
|
2
3
|
renderAppToHTMLResponse,
|
|
3
4
|
CacheControlHeader,
|
|
@@ -5,7 +6,6 @@ import {
|
|
|
5
6
|
PermissionsPolicyHeader,
|
|
6
7
|
StrictTransportSecurityHeader,
|
|
7
8
|
} from '@quilted/quilt/server';
|
|
8
|
-
import {RequestRouter} from '@quilted/quilt/request-router';
|
|
9
9
|
import {Router} from '@quilted/quilt/navigation';
|
|
10
10
|
|
|
11
11
|
import Env from 'quilt:module/env';
|
|
@@ -19,7 +19,7 @@ import type {AppContext} from '~/shared/context.ts';
|
|
|
19
19
|
|
|
20
20
|
import {appRouter} from './trpc.ts';
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const app = new Hono();
|
|
23
23
|
const assets = new BrowserAssets();
|
|
24
24
|
|
|
25
25
|
class ServerAppContext implements AppContext {
|
|
@@ -34,21 +34,21 @@ class ServerAppContext implements AppContext {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
// TRPC API
|
|
38
|
+
app.all('/api/*', async (c) => {
|
|
39
|
+
const request = c.req.raw;
|
|
40
|
+
return fetchRequestHandler({
|
|
41
|
+
endpoint: '/api',
|
|
42
|
+
req: request,
|
|
43
|
+
router: appRouter,
|
|
44
|
+
createContext: () => ({}),
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Preact app
|
|
49
|
+
app.get('*', async (c) => {
|
|
50
|
+
const request = c.req.raw;
|
|
51
|
+
|
|
52
52
|
const [{App}] = await Promise.all([import('./App.tsx')]);
|
|
53
53
|
|
|
54
54
|
const context = new ServerAppContext(request);
|
|
@@ -138,4 +138,4 @@ router.get(async (request) => {
|
|
|
138
138
|
return response;
|
|
139
139
|
});
|
|
140
140
|
|
|
141
|
-
export default
|
|
141
|
+
export default app;
|
|
@@ -2,5 +2,5 @@ import {createOptionalContext} from '@quilted/quilt/context';
|
|
|
2
2
|
|
|
3
3
|
export interface AppContext {}
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
export const useAppContext =
|
|
5
|
+
export const AppContextPreact = createOptionalContext<AppContext>();
|
|
6
|
+
export const useAppContext = AppContextPreact.use;
|
|
@@ -9,7 +9,7 @@ import {Localization} from '@quilted/quilt/localize';
|
|
|
9
9
|
import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
|
|
10
10
|
|
|
11
11
|
import {trpc} from '~/shared/trpc.ts';
|
|
12
|
-
import {
|
|
12
|
+
import {AppContextPreact} from '~/shared/context.ts';
|
|
13
13
|
|
|
14
14
|
import {RenderOptions, RenderContext, RenderActions} from './types.ts';
|
|
15
15
|
|
|
@@ -39,7 +39,7 @@ export const renderApp = createRender<
|
|
|
39
39
|
const {router, browser, trpc: trpcClient, queryClient} = context;
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
|
-
<
|
|
42
|
+
<AppContextPreact.Provider value={context}>
|
|
43
43
|
<BrowserDetailsContext.Provider value={browser}>
|
|
44
44
|
<Localization locale={locale}>
|
|
45
45
|
<Navigation router={router}>
|
|
@@ -51,7 +51,7 @@ export const renderApp = createRender<
|
|
|
51
51
|
</Navigation>
|
|
52
52
|
</Localization>
|
|
53
53
|
</BrowserDetailsContext.Provider>
|
|
54
|
-
</
|
|
54
|
+
</AppContextPreact.Provider>
|
|
55
55
|
);
|
|
56
56
|
},
|
|
57
57
|
async afterRender() {
|
|
@@ -2,12 +2,15 @@ name: Prepare repo
|
|
|
2
2
|
runs:
|
|
3
3
|
using: 'composite'
|
|
4
4
|
steps:
|
|
5
|
-
- uses: pnpm/action-setup@
|
|
6
|
-
- uses: actions/setup-node@
|
|
5
|
+
- uses: pnpm/action-setup@v4.0.0
|
|
6
|
+
- uses: actions/setup-node@v4
|
|
7
7
|
with:
|
|
8
8
|
cache: pnpm
|
|
9
9
|
registry-url: 'https://registry.npmjs.org'
|
|
10
10
|
node-version-file: '.nvmrc'
|
|
11
|
+
- name: Enable Corepack
|
|
12
|
+
run: corepack enable && pnpm -v
|
|
13
|
+
shell: bash
|
|
11
14
|
- name: Install dependencies
|
|
12
|
-
run: pnpm install
|
|
15
|
+
run: pnpm install --frozen-lockfile
|
|
13
16
|
shell: bash
|