@quilted/create 0.3.0 → 0.3.2

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/build/esm/_virtual/index7.mjs +2 -2
  3. package/build/esm/_virtual/index8.mjs +2 -2
  4. package/build/esm/node_modules/.pnpm/@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.mjs +1 -1
  5. package/build/esm/node_modules/.pnpm/@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/async.mjs +1 -1
  6. package/build/esm/node_modules/.pnpm/@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/sync.mjs +1 -1
  7. package/build/esm/node_modules/.pnpm/@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.mjs +1 -1
  8. package/build/esm/node_modules/.pnpm/@nodelib_fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.mjs +1 -1
  9. package/build/esm/node_modules/.pnpm/@nodelib_fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/async.mjs +1 -1
  10. package/build/esm/node_modules/.pnpm/@nodelib_fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/sync.mjs +1 -1
  11. package/build/esm/node_modules/.pnpm/@nodelib_fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.mjs +1 -1
  12. package/build/esm/node_modules/.pnpm/dir-glob@3.0.1/node_modules/dir-glob/index.mjs +1 -1
  13. package/build/esm/node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/index.mjs +1 -1
  14. package/build/esm/node_modules/.pnpm/prettier@3.5.1/node_modules/prettier/plugins/typescript.mjs +1 -1
  15. package/build/esnext/_virtual/index7.esnext +2 -2
  16. package/build/esnext/_virtual/index8.esnext +2 -2
  17. package/build/esnext/node_modules/.pnpm/@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.esnext +1 -1
  18. package/build/esnext/node_modules/.pnpm/@nodelib_fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.esnext +1 -1
  19. package/build/esnext/node_modules/.pnpm/dir-glob@3.0.1/node_modules/dir-glob/index.esnext +1 -1
  20. package/build/esnext/node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/stream.esnext +1 -1
  21. package/build/esnext/node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/index.esnext +1 -1
  22. package/build/esnext/node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/stream.esnext +1 -1
  23. package/build/esnext/node_modules/.pnpm/prettier@3.5.1/node_modules/prettier/plugins/typescript.esnext +2 -2
  24. package/package.json +1 -1
  25. package/templates/app-basic/App.tsx +8 -3
  26. package/templates/app-basic/browser.css +10 -0
  27. package/templates/app-basic/browser.tsx +8 -12
  28. package/templates/app-basic/context/browser.ts +10 -0
  29. package/templates/app-basic/context/navigation.ts +17 -0
  30. package/templates/app-basic/{shared/context.ts → context/preact.ts} +1 -1
  31. package/templates/app-basic/context/server.ts +10 -0
  32. package/templates/app-basic/context/types.ts +5 -0
  33. package/templates/app-basic/foundation/frame/Frame.module.css +0 -11
  34. package/templates/app-basic/server.tsx +5 -14
  35. package/templates/app-basic/tests/render/render.tsx +8 -5
  36. package/templates/app-basic/tests/render/types.ts +2 -2
  37. package/templates/app-basic/tsconfig.json +2 -4
  38. package/templates/app-graphql/App.tsx +4 -3
  39. package/templates/app-graphql/browser.css +10 -0
  40. package/templates/app-graphql/browser.tsx +9 -23
  41. package/templates/app-graphql/context/browser.ts +21 -0
  42. package/templates/app-graphql/context/navigation.ts +17 -0
  43. package/templates/{app-trpc/shared/context.ts → app-graphql/context/preact.ts} +1 -1
  44. package/templates/app-graphql/context/server.ts +23 -0
  45. package/templates/app-graphql/context/types.ts +10 -0
  46. package/templates/app-graphql/server.tsx +4 -24
  47. package/templates/app-graphql/tests/render/render.tsx +13 -10
  48. package/templates/app-graphql/tests/render/types.ts +9 -4
  49. package/templates/app-graphql/tsconfig.json +1 -1
  50. package/templates/app-trpc/App.tsx +5 -7
  51. package/templates/app-trpc/browser.css +10 -0
  52. package/templates/app-trpc/browser.tsx +9 -23
  53. package/templates/app-trpc/context/browser.ts +20 -0
  54. package/templates/app-trpc/context/navigation.ts +17 -0
  55. package/templates/{app-graphql/shared/context.ts → app-trpc/context/preact.ts} +1 -1
  56. package/templates/app-trpc/context/server.ts +18 -0
  57. package/templates/app-trpc/context/trpc.ts +6 -0
  58. package/templates/app-trpc/context/types.ts +11 -0
  59. package/templates/app-trpc/features/home/Home.tsx +1 -1
  60. package/templates/app-trpc/server.tsx +4 -19
  61. package/templates/app-trpc/tests/render/render.tsx +11 -6
  62. package/templates/app-trpc/tests/render/types.ts +2 -2
  63. package/templates/app-trpc/tsconfig.json +1 -1
  64. package/templates/github/_github/workflows/actions/prepare/action.yml +6 -3
  65. package/templates/github/_github/workflows/ci.yml +7 -4
  66. package/templates/workspace/package.json +5 -5
  67. package/templates/app-basic/shared/navigation.ts +0 -15
  68. package/templates/app-graphql/shared/graphql.ts +0 -22
  69. package/templates/app-graphql/shared/navigation.ts +0 -15
  70. package/templates/app-trpc/shared/navigation.ts +0 -15
  71. package/templates/app-trpc/shared/trpc.ts +0 -18
@@ -2,7 +2,7 @@ import type {TestRouter} from '@quilted/quilt/navigation/testing';
2
2
  import type {BrowserTestMock} from '@quilted/quilt/browser/testing';
3
3
  import type {GraphQLCache} from '@quilted/quilt/graphql';
4
4
 
5
- import type {AppContext} from '~/shared/context.ts';
5
+ import type {AppContext} from '~/context/types.ts';
6
6
 
7
7
  import type {GraphQLController} from '../graphql.ts';
8
8
 
@@ -58,7 +58,7 @@ export interface RenderContext extends AppContext {
58
58
  /**
59
59
  * The router used for this component test.
60
60
  */
61
- readonly router: TestRouter;
61
+ readonly navigation: {router: TestRouter};
62
62
 
63
63
  /**
64
64
  * The browser environment for this component test.
@@ -66,9 +66,14 @@ export interface RenderContext extends AppContext {
66
66
  readonly browser: BrowserTestMock;
67
67
 
68
68
  /**
69
- * The GraphQL controller used for this component test.
69
+ * The GraphQL context used for this component test.
70
70
  */
71
- readonly graphQLController: GraphQLController;
71
+ readonly graphql: AppContext['graphql'] & {
72
+ /**
73
+ * The GraphQL controller used for this component test.
74
+ */
75
+ readonly controller: GraphQLController;
76
+ };
72
77
  }
73
78
 
74
79
  export interface RenderActions extends Record<string, never> {}
@@ -3,7 +3,7 @@
3
3
  "compilerOptions": {
4
4
  "jsxImportSource": "preact",
5
5
  "paths": {
6
- "~/shared/*": ["./shared/*"],
6
+ "~/context/*": ["./context/*"],
7
7
  "~/tests/*": ["./tests/*"],
8
8
  "react": ["./node_modules/preact/compat"],
9
9
  "react-dom": ["./node_modules/preact/compat"]
@@ -9,12 +9,10 @@ import {Frame} from './foundation/frame.ts';
9
9
 
10
10
  import {Home} from './features/home.ts';
11
11
 
12
- import {trpc} from './shared/trpc.ts';
13
- import {
14
- AppContextPreact,
15
- type AppContext as AppContextType,
16
- } from './shared/context.ts';
17
- import {routeWithAppContext} from './shared/navigation.ts';
12
+ import {trpc} from './context/trpc.ts';
13
+ import type {AppContext as AppContextType} from './context/types.ts';
14
+ import {AppContextPreact} from './context/preact.ts';
15
+ import {routeWithAppContext} from './context/navigation.ts';
18
16
 
19
17
  export interface AppProps {
20
18
  context: AppContextType;
@@ -47,7 +45,7 @@ export function App({context}: AppProps) {
47
45
  <Localization>
48
46
  <Head />
49
47
  <Navigation
50
- router={context.router}
48
+ router={context.navigation.router}
51
49
  routes={routes}
52
50
  context={context}
53
51
  />
@@ -0,0 +1,10 @@
1
+ *,
2
+ *::before,
3
+ *::after {
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ html,
8
+ body {
9
+ margin: 0;
10
+ }
@@ -1,29 +1,12 @@
1
+ import './browser.css';
2
+
1
3
  import type {ComponentChild} from 'preact';
2
4
  import {hydrate} from '@quilted/quilt/browser';
3
- import {Router} from '@quilted/quilt/navigation';
4
-
5
- import {httpBatchLink} from '@trpc/client';
6
- import {QueryClient} from '@tanstack/react-query';
7
5
 
8
- import type {AppContext} from '~/shared/context.ts';
9
- import {trpc} from '~/shared/trpc.ts';
6
+ import {BrowserAppContext} from '~/context/browser.ts';
10
7
 
11
8
  import {App} from './App.tsx';
12
9
 
13
- class BrowserAppContext implements AppContext {
14
- readonly router: Router;
15
- readonly trpc: AppContext['trpc'];
16
- readonly queryClient: QueryClient;
17
-
18
- constructor() {
19
- this.router = new Router();
20
- this.queryClient = new QueryClient();
21
- this.trpc = trpc.createClient({
22
- links: [httpBatchLink({url: new URL('/api', window.location.href).href})],
23
- });
24
- }
25
- }
26
-
27
10
  class BrowserApp {
28
11
  /**
29
12
  * The app's globally-available context.
@@ -44,7 +27,7 @@ class BrowserApp {
44
27
  // @example
45
28
  // ```js
46
29
  // // Log the current URL
47
- // console.log(globalThis.app.context.router.currentRequest.url);
30
+ // console.log(globalThis.app.context.navigation.router.currentRequest.url);
48
31
  // ```
49
32
  Object.defineProperty(globalThis, 'app', {
50
33
  value: this,
@@ -53,8 +36,11 @@ class BrowserApp {
53
36
  writable: true,
54
37
  });
55
38
  }
39
+
40
+ hydrate() {
41
+ hydrate(this.rendered);
42
+ }
56
43
  }
57
44
 
58
45
  const app = new BrowserApp();
59
-
60
- hydrate(app.rendered);
46
+ app.hydrate();
@@ -0,0 +1,20 @@
1
+ import {httpBatchLink} from '@trpc/client';
2
+ import {QueryClient} from '@tanstack/react-query';
3
+
4
+ import type {AppContext} from './types.ts';
5
+ import {NavigationForApp} from './navigation.ts';
6
+ import {trpc} from './trpc.ts';
7
+
8
+ export class BrowserAppContext implements AppContext {
9
+ readonly navigation: NavigationForApp;
10
+ readonly trpc: AppContext['trpc'];
11
+ readonly queryClient: QueryClient;
12
+
13
+ constructor() {
14
+ this.navigation = new NavigationForApp();
15
+ this.queryClient = new QueryClient();
16
+ this.trpc = trpc.createClient({
17
+ links: [httpBatchLink({url: new URL('/api', window.location.href).href})],
18
+ });
19
+ }
20
+ }
@@ -0,0 +1,17 @@
1
+ import {createContextRouteFunction, Router} from '@quilted/quilt/navigation';
2
+
3
+ import type {AppContext} from './types.ts';
4
+
5
+ export interface Navigation {
6
+ readonly router: Router;
7
+ }
8
+
9
+ export class NavigationForApp implements Navigation {
10
+ readonly router: Router;
11
+
12
+ constructor(url?: string | URL) {
13
+ this.router = new Router(url);
14
+ }
15
+ }
16
+
17
+ export const routeWithAppContext = createContextRouteFunction<AppContext>();
@@ -1,6 +1,6 @@
1
1
  import {createOptionalContext} from '@quilted/quilt/context';
2
2
 
3
- export interface AppContext {}
3
+ import type {AppContext} from './types.ts';
4
4
 
5
5
  export const AppContextPreact = createOptionalContext<AppContext>();
6
6
  export const useAppContext = AppContextPreact.use;
@@ -0,0 +1,18 @@
1
+ import {createDirectClient} from '@quilted/trpc/server';
2
+ import {QueryClient} from '@tanstack/react-query';
3
+
4
+ import type {AppContext} from './types.ts';
5
+ import {NavigationForApp} from './navigation.ts';
6
+ import {appRouter} from '../trpc.ts';
7
+
8
+ export class ServerAppContext implements AppContext {
9
+ readonly navigation: NavigationForApp;
10
+ readonly trpc: AppContext['trpc'];
11
+ readonly queryClient: QueryClient;
12
+
13
+ constructor(request: Request) {
14
+ this.navigation = new NavigationForApp(request.url);
15
+ this.trpc = createDirectClient(appRouter);
16
+ this.queryClient = new QueryClient();
17
+ }
18
+ }
@@ -0,0 +1,6 @@
1
+ import {createTRPCReact, type CreateTRPCReact} from '@trpc/react-query';
2
+
3
+ import type {AppRouter} from '../trpc.ts';
4
+
5
+ export const trpc: CreateTRPCReact<AppRouter, {}> =
6
+ createTRPCReact<AppRouter>();
@@ -0,0 +1,11 @@
1
+ import type {Navigation} from './navigation.ts';
2
+ import type {TRPCUntypedClient} from '@trpc/client';
3
+ import type {QueryClient} from '@tanstack/react-query';
4
+
5
+ import type {AppRouter} from '../trpc.ts';
6
+
7
+ export interface AppContext {
8
+ readonly navigation: Navigation;
9
+ readonly trpc: TRPCUntypedClient<AppRouter>;
10
+ readonly queryClient: QueryClient;
11
+ }
@@ -1,4 +1,4 @@
1
- import {trpc} from '~/shared/trpc.ts';
1
+ import {trpc} from '~/context/trpc.ts';
2
2
 
3
3
  import styles from './Home.module.css';
4
4
 
@@ -6,34 +6,16 @@ import {
6
6
  PermissionsPolicyHeader,
7
7
  StrictTransportSecurityHeader,
8
8
  } from '@quilted/quilt/server';
9
- import {Router} from '@quilted/quilt/navigation';
10
-
11
9
  import Env from 'quilt:module/env';
12
10
  import {BrowserAssets} from 'quilt:module/assets';
13
11
 
14
- import {createDirectClient} from '@quilted/trpc/server';
15
12
  import {fetchRequestHandler} from '@trpc/server/adapters/fetch';
16
- import {QueryClient} from '@tanstack/react-query';
17
-
18
- import type {AppContext} from '~/shared/context.ts';
19
13
 
20
14
  import {appRouter} from './trpc.ts';
21
15
 
22
16
  const app = new Hono();
23
17
  const assets = new BrowserAssets();
24
18
 
25
- class ServerAppContext implements AppContext {
26
- readonly router: Router;
27
- readonly trpc: AppContext['trpc'];
28
- readonly queryClient: QueryClient;
29
-
30
- constructor(request: Request) {
31
- this.router = new Router(request.url);
32
- this.trpc = createDirectClient(appRouter);
33
- this.queryClient = new QueryClient();
34
- }
35
- }
36
-
37
19
  // TRPC API
38
20
  app.all('/api/*', async (c) => {
39
21
  const request = c.req.raw;
@@ -49,7 +31,10 @@ app.all('/api/*', async (c) => {
49
31
  app.get('*', async (c) => {
50
32
  const request = c.req.raw;
51
33
 
52
- const [{App}] = await Promise.all([import('./App.tsx')]);
34
+ const [{App}, {ServerAppContext}] = await Promise.all([
35
+ import('./App.tsx'),
36
+ import('./context/server.ts'),
37
+ ]);
53
38
 
54
39
  const context = new ServerAppContext(request);
55
40
 
@@ -8,8 +8,8 @@ import {Localization} from '@quilted/quilt/localize';
8
8
 
9
9
  import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
10
10
 
11
- import {trpc} from '~/shared/trpc.ts';
12
- import {AppContextReact} from '~/shared/context.ts';
11
+ import {trpc} from '~/context/trpc.ts';
12
+ import {AppContextPreact} from '~/context/preact.ts';
13
13
 
14
14
  import {RenderOptions, RenderContext, RenderActions} from './types.ts';
15
15
 
@@ -28,7 +28,7 @@ export const renderApp = createRender<
28
28
  // React tree and your test code, and is ideal for mocking out global context providers.
29
29
  context({router = new TestRouter(), browser = new BrowserTestMock()}) {
30
30
  return {
31
- router,
31
+ navigation: {router},
32
32
  browser,
33
33
  trpc: trpc.createClient(),
34
34
  queryClient: new QueryClient(),
@@ -36,10 +36,15 @@ export const renderApp = createRender<
36
36
  },
37
37
  // Render all of our app-wide context providers around each component under test.
38
38
  render(element, context, {locale = 'en'}) {
39
- const {router, browser, trpc: trpcClient, queryClient} = context;
39
+ const {
40
+ navigation: {router},
41
+ browser,
42
+ trpc: trpcClient,
43
+ queryClient,
44
+ } = context;
40
45
 
41
46
  return (
42
- <AppContextReact.Provider value={context}>
47
+ <AppContextPreact.Provider value={context}>
43
48
  <BrowserDetailsContext.Provider value={browser}>
44
49
  <Localization locale={locale}>
45
50
  <Navigation router={router}>
@@ -51,7 +56,7 @@ export const renderApp = createRender<
51
56
  </Navigation>
52
57
  </Localization>
53
58
  </BrowserDetailsContext.Provider>
54
- </AppContextReact.Provider>
59
+ </AppContextPreact.Provider>
55
60
  );
56
61
  },
57
62
  async afterRender() {
@@ -2,7 +2,7 @@ import type {TestRouter} from '@quilted/quilt/navigation/testing';
2
2
  import type {BrowserTestMock} from '@quilted/quilt/browser/testing';
3
3
  import type {QueryClient} from '@tanstack/react-query';
4
4
 
5
- import type {AppContext} from '~/shared/context.ts';
5
+ import type {AppContext} from '~/context/types.ts';
6
6
 
7
7
  export interface RenderOptions {
8
8
  /**
@@ -28,7 +28,7 @@ export interface RenderContext extends AppContext {
28
28
  /**
29
29
  * The router used for this component test.
30
30
  */
31
- readonly router: TestRouter;
31
+ readonly navigation: {router: TestRouter};
32
32
 
33
33
  /**
34
34
  * The browser environment for this component test.
@@ -3,7 +3,7 @@
3
3
  "compilerOptions": {
4
4
  "jsxImportSource": "preact",
5
5
  "paths": {
6
- "~/shared/*": ["./shared/*"],
6
+ "~/context/*": ["./context/*"],
7
7
  "~/tests/*": ["./tests/*"],
8
8
  "react": ["./node_modules/preact/compat"],
9
9
  "react-dom": ["./node_modules/preact/compat"]
@@ -2,12 +2,15 @@ name: Prepare repo
2
2
  runs:
3
3
  using: 'composite'
4
4
  steps:
5
- - uses: pnpm/action-setup@v2.2.1
6
- - uses: actions/setup-node@v2
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
@@ -1,10 +1,9 @@
1
1
  name: CI
2
2
 
3
3
  on:
4
- push:
4
+ pull_request:
5
5
  branches:
6
- - '**'
7
- - '!main'
6
+ - main
8
7
  workflow_call:
9
8
  inputs:
10
9
  build:
@@ -16,6 +15,7 @@ jobs:
16
15
  lint:
17
16
  name: Lint 💅
18
17
  runs-on: ubuntu-latest
18
+ timeout-minutes: 5
19
19
  steps:
20
20
  - uses: actions/checkout@v4
21
21
  - uses: ./.github/workflows/actions/prepare
@@ -24,6 +24,7 @@ jobs:
24
24
  type-check:
25
25
  name: Type check 🧮
26
26
  runs-on: ubuntu-latest
27
+ timeout-minutes: 5
27
28
  steps:
28
29
  - uses: actions/checkout@v4
29
30
  - uses: ./.github/workflows/actions/prepare
@@ -32,6 +33,7 @@ jobs:
32
33
  unit-tests:
33
34
  name: Unit tests 🧪
34
35
  runs-on: ubuntu-latest
36
+ timeout-minutes: 5
35
37
  steps:
36
38
  - uses: actions/checkout@v4
37
39
  - uses: ./.github/workflows/actions/prepare
@@ -39,8 +41,9 @@ jobs:
39
41
 
40
42
  build:
41
43
  name: Build 🏗
42
- if: ${{ inputs.build || github.event_name == 'push' }}
44
+ if: ${{ inputs.build || github.event_name == 'pull_request' }}
43
45
  runs-on: ubuntu-latest
46
+ timeout-minutes: 5
44
47
  steps:
45
48
  - uses: actions/checkout@v4
46
49
  - uses: ./.github/workflows/actions/prepare
@@ -13,15 +13,15 @@
13
13
  "typescript:watch": "tsx watch --conditions quilt:source"
14
14
  },
15
15
  "devDependencies": {
16
- "@quilted/rollup": "^0.3.0",
17
- "@quilted/vite": "^0.2.0",
16
+ "@quilted/rollup": "^0.4.0",
17
+ "@quilted/vite": "^0.3.0",
18
18
  "@quilted/typescript": "^0.4.0",
19
- "rollup": "^4.34.0",
19
+ "rollup": "^4.46.0",
20
20
  "prettier": "^3.3.0",
21
21
  "tsx": "^4.19.0",
22
22
  "typescript": "^5.7.0",
23
- "vite": "^6.1.0",
24
- "vitest": "^3.0.0"
23
+ "vite": "^7.1.0",
24
+ "vitest": "^3.2.0"
25
25
  },
26
26
  "prettier": {
27
27
  "arrowParens": "always",
@@ -1,15 +0,0 @@
1
- import type {Router} from '@quilted/quilt/navigation';
2
- import {createContextRouteFunction} from '@quilted/quilt/navigation';
3
-
4
- import type {AppContext} from '~/shared/context.ts';
5
-
6
- declare module '~/shared/context.ts' {
7
- interface AppContext {
8
- /**
9
- * The router used to control navigation throughout the application.
10
- */
11
- readonly router: Router;
12
- }
13
- }
14
-
15
- export const routeWithAppContext = createContextRouteFunction<AppContext>();
@@ -1,22 +0,0 @@
1
- import type {GraphQLFetch, GraphQLCache} from '@quilted/quilt/graphql';
2
-
3
- declare module '~/shared/context.ts' {
4
- interface AppContext {
5
- /**
6
- * The app’s GraphQL client.
7
- */
8
- readonly graphql: {
9
- /**
10
- * A function to perform GraphQL operations.
11
- */
12
- readonly fetch: GraphQLFetch;
13
-
14
- /**
15
- * The app’s GraphQL cache.
16
- */
17
- readonly cache: GraphQLCache;
18
- };
19
- }
20
- }
21
-
22
- export {};
@@ -1,15 +0,0 @@
1
- import type {Router} from '@quilted/quilt/navigation';
2
- import {createContextRouteFunction} from '@quilted/quilt/navigation';
3
-
4
- import type {AppContext} from '~/shared/context.ts';
5
-
6
- declare module '~/shared/context.ts' {
7
- interface AppContext {
8
- /**
9
- * The router used to control navigation throughout the application.
10
- */
11
- readonly router: Router;
12
- }
13
- }
14
-
15
- export const routeWithAppContext = createContextRouteFunction<AppContext>();
@@ -1,15 +0,0 @@
1
- import type {Router} from '@quilted/quilt/navigation';
2
- import {createContextRouteFunction} from '@quilted/quilt/navigation';
3
-
4
- import type {AppContext} from '~/shared/context.ts';
5
-
6
- declare module '~/shared/context.ts' {
7
- interface AppContext {
8
- /**
9
- * The router used to control navigation throughout the application.
10
- */
11
- readonly router: Router;
12
- }
13
- }
14
-
15
- export const routeWithAppContext = createContextRouteFunction<AppContext>();
@@ -1,18 +0,0 @@
1
- import type {TRPCUntypedClient} from '@trpc/client';
2
- import {createTRPCReact, type CreateTRPCReact} from '@trpc/react-query';
3
- import type {QueryClient} from '@tanstack/react-query';
4
-
5
- // Get access to our app’s router type signature, which will
6
- // provide strong typing on the queries and mutations we can
7
- // perform.
8
- import type {AppRouter} from '../trpc.ts';
9
-
10
- export const trpc: CreateTRPCReact<AppRouter, {}> =
11
- createTRPCReact<AppRouter>();
12
-
13
- declare module '~/shared/context.ts' {
14
- interface AppContext {
15
- trpc: TRPCUntypedClient<AppRouter>;
16
- queryClient: QueryClient;
17
- }
18
- }