@quilted/create 0.2.33 → 0.2.35

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 (42) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/build/esnext/_virtual/index2.esnext +2 -2
  3. package/build/esnext/_virtual/index3.esnext +2 -2
  4. package/build/esnext/_virtual/index4.esnext +2 -2
  5. package/build/esnext/_virtual/index5.esnext +2 -2
  6. package/build/esnext/node_modules/.pnpm/@nodelib_fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/async.esnext +1 -1
  7. package/build/esnext/node_modules/.pnpm/@nodelib_fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/sync.esnext +1 -1
  8. package/build/esnext/node_modules/.pnpm/@nodelib_fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.esnext +1 -1
  9. package/build/esnext/node_modules/.pnpm/@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.esnext +1 -1
  10. package/build/esnext/node_modules/.pnpm/@nodelib_fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.esnext +1 -1
  11. package/build/esnext/node_modules/.pnpm/dir-glob@3.0.1/node_modules/dir-glob/index.esnext +2 -2
  12. package/build/esnext/node_modules/.pnpm/fast-glob@3.2.12/node_modules/fast-glob/out/readers/async.esnext +1 -1
  13. package/build/esnext/node_modules/.pnpm/fast-glob@3.2.12/node_modules/fast-glob/out/readers/reader.esnext +1 -1
  14. package/build/esnext/node_modules/.pnpm/fast-glob@3.2.12/node_modules/fast-glob/out/readers/stream.esnext +2 -2
  15. package/build/esnext/node_modules/.pnpm/fast-glob@3.2.12/node_modules/fast-glob/out/readers/sync.esnext +2 -2
  16. package/build/esnext/node_modules/.pnpm/path-type@4.0.0/node_modules/path-type/index.esnext +1 -1
  17. package/package.json +1 -1
  18. package/templates/app-basic/App.tsx +5 -4
  19. package/templates/app-basic/browser.tsx +1 -1
  20. package/templates/app-basic/server.tsx +1 -1
  21. package/templates/app-basic/shared/context.ts +1 -7
  22. package/templates/app-basic/shared/navigation.ts +15 -0
  23. package/templates/app-basic/tests/render/render.tsx +1 -1
  24. package/templates/app-basic/tests/render/types.ts +1 -1
  25. package/templates/app-basic/tests/render.ts +1 -1
  26. package/templates/app-graphql/App.tsx +6 -5
  27. package/templates/app-graphql/browser.tsx +1 -1
  28. package/templates/app-graphql/server.tsx +2 -2
  29. package/templates/app-graphql/shared/context.ts +1 -7
  30. package/templates/app-graphql/shared/navigation.ts +15 -0
  31. package/templates/app-graphql/tests/render/render.tsx +11 -9
  32. package/templates/app-graphql/tests/render/types.ts +2 -7
  33. package/templates/app-graphql/tests/render.ts +1 -1
  34. package/templates/app-trpc/App.tsx +6 -5
  35. package/templates/app-trpc/browser.tsx +1 -1
  36. package/templates/app-trpc/server.tsx +1 -1
  37. package/templates/app-trpc/shared/context.ts +1 -7
  38. package/templates/app-trpc/shared/navigation.ts +15 -0
  39. package/templates/app-trpc/tests/render/render.tsx +3 -3
  40. package/templates/app-trpc/tests/render/types.ts +1 -1
  41. package/templates/app-trpc/tests/render.ts +1 -1
  42. package/templates/workspace/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @quilted/create
2
2
 
3
+ ## 0.2.35
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5c418c3`](https://github.com/lemonmade/quilt/commit/5c418c3a9a7de7c5ee4337cbd02b68e4bcd2d581) Thanks [@lemonmade](https://github.com/lemonmade)! - Add `createContextRouteFunction()` helper for creating routes with a known context, and use it for app context
8
+
9
+ - [`7dae2be`](https://github.com/lemonmade/quilt/commit/7dae2bebab01a4a4e2baf6c1799ce0adb59a5bb7) Thanks [@lemonmade](https://github.com/lemonmade)! - Rename `@quilted/quilt/navigate` to `@quilted/quilt/navigation`
10
+
11
+ ## 0.2.34
12
+
13
+ ### Patch Changes
14
+
15
+ - [`759b46c`](https://github.com/lemonmade/quilt/commit/759b46c6b47efb14889b9ac80c416893bf90e83e) Thanks [@lemonmade](https://github.com/lemonmade)! - Upgrade Vite and Vitest dependencies
16
+
17
+ - [`df319bd`](https://github.com/lemonmade/quilt/commit/df319bd30acf226005fcb7f9e7bf55d289004cbf) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix server GraphQL execution in GraphQL template
18
+
3
19
  ## 0.2.33
4
20
 
5
21
  ### Patch Changes
@@ -1,3 +1,3 @@
1
- var out = {};
1
+ var dirGlob = {exports: {}};
2
2
 
3
- export { out as __exports };
3
+ export { dirGlob as __module };
@@ -1,3 +1,3 @@
1
- var out = {};
1
+ var pathType = {};
2
2
 
3
- export { out as __exports };
3
+ export { pathType as __exports };
@@ -1,3 +1,3 @@
1
- var dirGlob = {exports: {}};
1
+ var out = {};
2
2
 
3
- export { dirGlob as __module };
3
+ export { out as __exports };
@@ -1,3 +1,3 @@
1
- var pathType = {};
1
+ var out = {};
2
2
 
3
- export { pathType as __exports };
3
+ export { out as __exports };
@@ -4,7 +4,7 @@ import { r as runParallel_1 } from '../../../../../../run-parallel@1.2.0/node_mo
4
4
  import '../constants.esnext';
5
5
  import '../utils/index.esnext';
6
6
  import './common.esnext';
7
- import { __exports as out } from '../../../../../../../../_virtual/index3.esnext';
7
+ import { __exports as out } from '../../../../../../../../_virtual/index5.esnext';
8
8
  import { __exports as constants } from '../../../../../../../../_virtual/constants.esnext';
9
9
  import { __exports as utils$1 } from '../../../../../../../../_virtual/index7.esnext';
10
10
  import { __exports as common$1 } from '../../../../../../../../_virtual/common2.esnext';
@@ -3,7 +3,7 @@ import '../../../../../../@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/o
3
3
  import '../constants.esnext';
4
4
  import '../utils/index.esnext';
5
5
  import './common.esnext';
6
- import { __exports as out } from '../../../../../../../../_virtual/index3.esnext';
6
+ import { __exports as out } from '../../../../../../../../_virtual/index5.esnext';
7
7
  import { __exports as constants } from '../../../../../../../../_virtual/constants.esnext';
8
8
  import { __exports as utils$1 } from '../../../../../../../../_virtual/index7.esnext';
9
9
  import { __exports as common$1 } from '../../../../../../../../_virtual/common2.esnext';
@@ -2,7 +2,7 @@ import { __exports as settings } from '../../../../../../../_virtual/settings4.e
2
2
  import path__default from 'node:path';
3
3
  import '../../../../../@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.esnext';
4
4
  import './adapters/fs.esnext';
5
- import { __exports as out } from '../../../../../../../_virtual/index3.esnext';
5
+ import { __exports as out } from '../../../../../../../_virtual/index5.esnext';
6
6
  import { __exports as fs$1 } from '../../../../../../../_virtual/fs3.esnext';
7
7
 
8
8
  Object.defineProperty(settings, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- import { __exports as out } from '../../../../../../../_virtual/index3.esnext';
1
+ import { __exports as out } from '../../../../../../../_virtual/index5.esnext';
2
2
  import './providers/async.esnext';
3
3
  import './providers/sync.esnext';
4
4
  import './settings.esnext';
@@ -1,4 +1,4 @@
1
- import { __exports as out } from '../../../../../../../_virtual/index2.esnext';
1
+ import { __exports as out } from '../../../../../../../_virtual/index4.esnext';
2
2
  import './providers/async.esnext';
3
3
  import './providers/stream.esnext';
4
4
  import './providers/sync.esnext';
@@ -1,8 +1,8 @@
1
1
  import { getDefaultExportFromCjs } from '../../../../../_virtual/_commonjsHelpers.esnext';
2
- import { __module as dirGlob$1 } from '../../../../../_virtual/index4.esnext';
2
+ import { __module as dirGlob$1 } from '../../../../../_virtual/index2.esnext';
3
3
  import path__default from 'node:path';
4
4
  import '../../../path-type@4.0.0/node_modules/path-type/index.esnext';
5
- import { __exports as pathType$1 } from '../../../../../_virtual/index5.esnext';
5
+ import { __exports as pathType$1 } from '../../../../../_virtual/index3.esnext';
6
6
 
7
7
  const path = path__default;
8
8
  const pathType = pathType$1;
@@ -2,7 +2,7 @@ import { __exports as async } from '../../../../../../../_virtual/async2.esnext'
2
2
  import '../../../../../@nodelib_fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.esnext';
3
3
  import './reader.esnext';
4
4
  import './stream.esnext';
5
- import { __exports as out } from '../../../../../../../_virtual/index2.esnext';
5
+ import { __exports as out } from '../../../../../../../_virtual/index4.esnext';
6
6
  import { __exports as reader } from '../../../../../../../_virtual/reader.esnext';
7
7
  import { __exports as stream } from '../../../../../../../_virtual/stream2.esnext';
8
8
 
@@ -2,7 +2,7 @@ import { __exports as reader } from '../../../../../../../_virtual/reader.esnext
2
2
  import path__default from 'node:path';
3
3
  import '../../../../../@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.esnext';
4
4
  import '../utils/index.esnext';
5
- import { __exports as out } from '../../../../../../../_virtual/index3.esnext';
5
+ import { __exports as out } from '../../../../../../../_virtual/index5.esnext';
6
6
  import { __exports as utils$1 } from '../../../../../../../_virtual/index.esnext';
7
7
 
8
8
  Object.defineProperty(reader, "__esModule", { value: true });
@@ -3,8 +3,8 @@ import require$$0 from 'node:stream';
3
3
  import '../../../../../@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.esnext';
4
4
  import '../../../../../@nodelib_fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.esnext';
5
5
  import './reader.esnext';
6
- import { __exports as out } from '../../../../../../../_virtual/index3.esnext';
7
- import { __exports as out$1 } from '../../../../../../../_virtual/index2.esnext';
6
+ import { __exports as out } from '../../../../../../../_virtual/index5.esnext';
7
+ import { __exports as out$1 } from '../../../../../../../_virtual/index4.esnext';
8
8
  import { __exports as reader } from '../../../../../../../_virtual/reader.esnext';
9
9
 
10
10
  Object.defineProperty(stream, "__esModule", { value: true });
@@ -2,8 +2,8 @@ import { __exports as sync } from '../../../../../../../_virtual/sync2.esnext';
2
2
  import '../../../../../@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.esnext';
3
3
  import '../../../../../@nodelib_fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.esnext';
4
4
  import './reader.esnext';
5
- import { __exports as out } from '../../../../../../../_virtual/index3.esnext';
6
- import { __exports as out$1 } from '../../../../../../../_virtual/index2.esnext';
5
+ import { __exports as out } from '../../../../../../../_virtual/index5.esnext';
6
+ import { __exports as out$1 } from '../../../../../../../_virtual/index4.esnext';
7
7
  import { __exports as reader } from '../../../../../../../_virtual/reader.esnext';
8
8
 
9
9
  Object.defineProperty(sync, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- import { __exports as pathType } from '../../../../../_virtual/index5.esnext';
1
+ import { __exports as pathType } from '../../../../../_virtual/index3.esnext';
2
2
  import require$$0 from 'node:util';
3
3
  import fs__default from 'node:fs';
4
4
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@quilted/create",
3
3
  "type": "module",
4
- "version": "0.2.33",
4
+ "version": "0.2.35",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,7 +1,7 @@
1
1
  import type {RenderableProps} from 'preact';
2
2
 
3
3
  import {NotFound} from '@quilted/quilt/server';
4
- import {Navigation, route} from '@quilted/quilt/navigate';
4
+ import {Navigation} from '@quilted/quilt/navigation';
5
5
  import {Localization, useLocaleFromEnvironment} from '@quilted/quilt/localize';
6
6
 
7
7
  import {HTML} from './foundation/html.ts';
@@ -13,6 +13,7 @@ import {
13
13
  AppContextReact,
14
14
  type AppContext as AppContextType,
15
15
  } from './shared/context.ts';
16
+ import {routeWithAppContext} from './shared/navigation.ts';
16
17
 
17
18
  export interface AppProps {
18
19
  context: AppContextType;
@@ -21,16 +22,16 @@ export interface AppProps {
21
22
  // Define the routes for your application. If you have a lot of routes, you
22
23
  // might want to split this into a separate file.
23
24
  const routes = [
24
- route('*', {
25
+ routeWithAppContext('*', {
25
26
  render: (children) => <Frame>{children}</Frame>,
26
27
  children: [
27
- route('/', {
28
+ routeWithAppContext('/', {
28
29
  async load() {
29
30
  await Promise.all([Home.load()]);
30
31
  },
31
32
  render: <Home />,
32
33
  }),
33
- route('*', {render: <NotFound />}),
34
+ routeWithAppContext('*', {render: <NotFound />}),
34
35
  ],
35
36
  }),
36
37
  ];
@@ -1,7 +1,7 @@
1
1
  import '@quilted/quilt/globals';
2
2
  import {hydrate} from 'preact';
3
3
  import {Browser, BrowserContext} from '@quilted/quilt/browser';
4
- import {Router} from '@quilted/quilt/navigate';
4
+ import {Router} from '@quilted/quilt/navigation';
5
5
 
6
6
  import type {AppContext} from '~/shared/context.ts';
7
7
  import {App} from './App.tsx';
@@ -1,7 +1,7 @@
1
1
  import '@quilted/quilt/globals';
2
2
  import {RequestRouter} from '@quilted/quilt/request-router';
3
3
  import {renderToResponse} from '@quilted/quilt/server';
4
- import {Router} from '@quilted/quilt/navigate';
4
+ import {Router} from '@quilted/quilt/navigation';
5
5
  import {BrowserAssets} from 'quilt:module/assets';
6
6
 
7
7
  import type {AppContext} from '~/shared/context.ts';
@@ -1,12 +1,6 @@
1
1
  import {createOptionalContext} from '@quilted/quilt/context';
2
- import type {Router} from '@quilted/quilt/navigate';
3
2
 
4
- export interface AppContext {
5
- /**
6
- * The router used to control navigation throughout the application.
7
- */
8
- readonly router: Router;
9
- }
3
+ export interface AppContext {}
10
4
 
11
5
  export const AppContextReact = createOptionalContext<AppContext>();
12
6
  export const useAppContext = AppContextReact.use;
@@ -0,0 +1,15 @@
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,6 +1,6 @@
1
1
  import {createRender} from '@quilted/quilt/testing';
2
2
  import {BrowserContext, BrowserTestMock} from '@quilted/quilt/browser/testing';
3
- import {TestRouting, TestRouter} from '@quilted/quilt/navigate/testing';
3
+ import {TestRouting, TestRouter} from '@quilted/quilt/navigation/testing';
4
4
  import {Localization} from '@quilted/quilt/localize';
5
5
 
6
6
  import {AppContextReact} from '~/shared/context.ts';
@@ -1,4 +1,4 @@
1
- import type {TestRouter} from '@quilted/quilt/navigate/testing';
1
+ import type {TestRouter} from '@quilted/quilt/navigation/testing';
2
2
  import type {BrowserTestMock} from '@quilted/quilt/browser/testing';
3
3
 
4
4
  import type {AppContext} from '~/shared/context.ts';
@@ -1,6 +1,6 @@
1
1
  import '@quilted/quilt/testing';
2
2
 
3
- export {TestRouter} from '@quilted/quilt/navigate/testing';
3
+ export {TestRouter} from '@quilted/quilt/navigation/testing';
4
4
 
5
5
  export * from './render/types.ts';
6
6
  export {renderApp} from './render/render.tsx';
@@ -2,7 +2,7 @@ import type {RenderableProps} from 'preact';
2
2
 
3
3
  import {NotFound} from '@quilted/quilt/server';
4
4
  import {GraphQLContext} from '@quilted/quilt/graphql';
5
- import {Navigation, route} from '@quilted/quilt/navigate';
5
+ import {Navigation} from '@quilted/quilt/navigation';
6
6
  import {Localization, useLocaleFromEnvironment} from '@quilted/quilt/localize';
7
7
 
8
8
  import {HTML} from './foundation/html.ts';
@@ -14,6 +14,7 @@ import {
14
14
  AppContextReact,
15
15
  type AppContext as AppContextType,
16
16
  } from './shared/context.ts';
17
+ import {routeWithAppContext} from './shared/navigation.ts';
17
18
 
18
19
  export interface AppProps {
19
20
  context: AppContextType;
@@ -22,16 +23,16 @@ export interface AppProps {
22
23
  // Define the routes for your application. If you have a lot of routes, you
23
24
  // might want to split this into a separate file.
24
25
  const routes = [
25
- route('*', {
26
+ routeWithAppContext('*', {
26
27
  render: (children) => <Frame>{children}</Frame>,
27
28
  children: [
28
- route('/', {
29
- async load(_navigation, {graphql}: AppContextType) {
29
+ routeWithAppContext('/', {
30
+ async load({context: {graphql}}) {
30
31
  await Promise.all([Home.load(), graphql.cache.query(homeQuery)]);
31
32
  },
32
33
  render: <Home />,
33
34
  }),
34
- route('*', {render: <NotFound />}),
35
+ routeWithAppContext('*', {render: <NotFound />}),
35
36
  ],
36
37
  }),
37
38
  ];
@@ -3,7 +3,7 @@ import '@quilted/quilt/globals';
3
3
  import {hydrate} from 'preact';
4
4
  import {createGraphQLFetch, GraphQLCache} from '@quilted/quilt/graphql';
5
5
  import {Browser, BrowserContext} from '@quilted/quilt/browser';
6
- import {Router} from '@quilted/quilt/navigate';
6
+ import {Router} from '@quilted/quilt/navigation';
7
7
 
8
8
  import type {AppContext} from '~/shared/context.ts';
9
9
 
@@ -1,7 +1,7 @@
1
1
  import '@quilted/quilt/globals';
2
2
 
3
3
  import {RequestRouter, JSONResponse} from '@quilted/quilt/request-router';
4
- import {Router} from '@quilted/quilt/navigate';
4
+ import {Router} from '@quilted/quilt/navigation';
5
5
  import {BrowserAssets} from 'quilt:module/assets';
6
6
 
7
7
  import type {AppContext} from '~/shared/context.ts';
@@ -36,7 +36,7 @@ router.get(async (request) => {
36
36
  router: new Router(request.url),
37
37
  graphql: {
38
38
  fetch: performGraphQLOperation,
39
- cache: new GraphQLCache(),
39
+ cache: new GraphQLCache({fetch: performGraphQLOperation}),
40
40
  },
41
41
  } satisfies AppContext;
42
42
 
@@ -1,12 +1,6 @@
1
1
  import {createOptionalContext} from '@quilted/quilt/context';
2
- import type {Router} from '@quilted/quilt/navigate';
3
2
 
4
- export interface AppContext {
5
- /**
6
- * The router used to control navigation throughout the application.
7
- */
8
- readonly router: Router;
9
- }
3
+ export interface AppContext {}
10
4
 
11
5
  export const AppContextReact = createOptionalContext<AppContext>();
12
6
  export const useAppContext = AppContextReact.use;
@@ -0,0 +1,15 @@
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>();
@@ -2,7 +2,7 @@ import {Suspense} from 'preact/compat';
2
2
 
3
3
  import {createRender} from '@quilted/quilt/testing';
4
4
  import {BrowserContext, BrowserTestMock} from '@quilted/quilt/browser/testing';
5
- import {TestRouting, TestRouter} from '@quilted/quilt/navigate/testing';
5
+ import {Navigation, TestRouter} from '@quilted/quilt/navigation/testing';
6
6
  import {Localization} from '@quilted/quilt/localize';
7
7
  import {GraphQLCache} from '@quilted/quilt/graphql';
8
8
 
@@ -34,24 +34,26 @@ export const renderApp = createRender<
34
34
  return {
35
35
  router,
36
36
  browser,
37
- graphql,
38
- fetchGraphQL: graphql.fetch,
39
- graphQLCache,
37
+ graphql: {fetch: graphql.fetch, cache: graphQLCache},
38
+ graphQLController: graphql,
40
39
  };
41
40
  },
42
41
  // Render all of our app-wide context providers around each component under test.
43
42
  render(element, context, {locale = 'en'}) {
44
- const {router, browser, graphql, graphQLCache} = context;
43
+ const {router, browser, graphql, graphQLController} = context;
45
44
 
46
45
  return (
47
46
  <AppContextReact.Provider value={context}>
48
47
  <BrowserContext browser={browser}>
49
48
  <Localization locale={locale}>
50
- <TestRouting router={router}>
51
- <GraphQLTesting controller={graphql} cache={graphQLCache}>
49
+ <Navigation router={router}>
50
+ <GraphQLTesting
51
+ controller={graphQLController}
52
+ cache={graphql.cache}
53
+ >
52
54
  <Suspense fallback={null}>{element}</Suspense>
53
55
  </GraphQLTesting>
54
- </TestRouting>
56
+ </Navigation>
55
57
  </Localization>
56
58
  </BrowserContext>
57
59
  </AppContextReact.Provider>
@@ -64,7 +66,7 @@ export const renderApp = createRender<
64
66
  // once the data is ready.
65
67
 
66
68
  await wrapper.act(async () => {
67
- await wrapper.context.graphql.resolveAll();
69
+ await wrapper.context.graphQLController.resolveAll();
68
70
  });
69
71
  },
70
72
  });
@@ -1,4 +1,4 @@
1
- import type {TestRouter} from '@quilted/quilt/navigate/testing';
1
+ 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
 
@@ -68,12 +68,7 @@ export interface RenderContext extends AppContext {
68
68
  /**
69
69
  * The GraphQL controller used for this component test.
70
70
  */
71
- readonly graphql: GraphQLController;
72
-
73
- /**
74
- * The cache of GraphQL query results.
75
- */
76
- readonly graphQLCache: GraphQLCache;
71
+ readonly graphQLController: GraphQLController;
77
72
  }
78
73
 
79
74
  export interface RenderActions extends Record<string, never> {}
@@ -1,6 +1,6 @@
1
1
  import '@quilted/quilt/testing';
2
2
 
3
- export {TestRouter} from '@quilted/quilt/navigate/testing';
3
+ export {TestRouter} from '@quilted/quilt/navigation/testing';
4
4
 
5
5
  export * from './render/types.ts';
6
6
  export {renderApp} from './render/render.tsx';
@@ -1,7 +1,7 @@
1
1
  import type {RenderableProps} from 'preact';
2
2
 
3
3
  import {NotFound} from '@quilted/quilt/server';
4
- import {Navigation, route} from '@quilted/quilt/navigate';
4
+ import {Navigation, route} from '@quilted/quilt/navigation';
5
5
  import {Localization, useLocaleFromEnvironment} from '@quilted/quilt/localize';
6
6
 
7
7
  import {ReactQueryContext} from '@quilted/react-query';
@@ -16,6 +16,7 @@ import {
16
16
  AppContextReact,
17
17
  type AppContext as AppContextType,
18
18
  } from './shared/context.ts';
19
+ import {routeWithAppContext} from './shared/navigation.ts';
19
20
 
20
21
  export interface AppProps {
21
22
  context: AppContextType;
@@ -24,16 +25,16 @@ export interface AppProps {
24
25
  // Define the routes for your application. If you have a lot of routes, you
25
26
  // might want to split this into a separate file.
26
27
  const routes = [
27
- route('*', {
28
+ routeWithAppContext('*', {
28
29
  render: (children) => <Frame>{children}</Frame>,
29
30
  children: [
30
- route('/', {
31
+ routeWithAppContext('/', {
31
32
  async load() {
32
33
  await Promise.all([Home.load()]);
33
34
  },
34
35
  render: <Home />,
35
36
  }),
36
- route('*', {render: <NotFound />}),
37
+ routeWithAppContext('*', {render: <NotFound />}),
37
38
  ],
38
39
  }),
39
40
  ];
@@ -44,7 +45,7 @@ export function App({context}: AppProps) {
44
45
  return (
45
46
  <AppContext context={context}>
46
47
  <HTML>
47
- <Navigation routes={routes} context={context} />
48
+ <Navigation router={context.router} routes={routes} context={context} />
48
49
  </HTML>
49
50
  </AppContext>
50
51
  );
@@ -4,7 +4,7 @@ import {hydrate} from 'preact';
4
4
  import {httpBatchLink} from '@trpc/client';
5
5
  import {QueryClient} from '@tanstack/react-query';
6
6
  import {Browser, BrowserContext} from '@quilted/quilt/browser';
7
- import {Router} from '@quilted/quilt/navigate';
7
+ import {Router} from '@quilted/quilt/navigation';
8
8
 
9
9
  import type {AppContext} from '~/shared/context.ts';
10
10
  import {trpc} from '~/shared/trpc.ts';
@@ -31,7 +31,7 @@ router.get(async (request) => {
31
31
  await Promise.all([
32
32
  import('./App.tsx'),
33
33
  import('@quilted/quilt/server'),
34
- import('@quilted/quilt/navigate'),
34
+ import('@quilted/quilt/navigation'),
35
35
  import('@tanstack/react-query'),
36
36
  ]);
37
37
 
@@ -1,12 +1,6 @@
1
1
  import {createOptionalContext} from '@quilted/quilt/context';
2
- import type {Router} from '@quilted/quilt/navigate';
3
2
 
4
- export interface AppContext {
5
- /**
6
- * The router used to control navigation throughout the application.
7
- */
8
- readonly router: Router;
9
- }
3
+ export interface AppContext {}
10
4
 
11
5
  export const AppContextReact = createOptionalContext<AppContext>();
12
6
  export const useAppContext = AppContextReact.use;
@@ -0,0 +1,15 @@
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,6 +1,6 @@
1
1
  import {createRender} from '@quilted/quilt/testing';
2
2
  import {BrowserContext, BrowserTestMock} from '@quilted/quilt/browser/testing';
3
- import {TestRouting, TestRouter} from '@quilted/quilt/navigate/testing';
3
+ import {Navigation, TestRouter} from '@quilted/quilt/navigation/testing';
4
4
  import {Localization} from '@quilted/quilt/localize';
5
5
 
6
6
  import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
@@ -39,13 +39,13 @@ export const renderApp = createRender<
39
39
  <AppContextReact.Provider value={context}>
40
40
  <BrowserContext browser={browser}>
41
41
  <Localization locale={locale}>
42
- <TestRouting router={router}>
42
+ <Navigation router={router}>
43
43
  <trpc.Provider client={trpcClient} queryClient={queryClient}>
44
44
  <QueryClientProvider client={queryClient}>
45
45
  {element}
46
46
  </QueryClientProvider>
47
47
  </trpc.Provider>
48
- </TestRouting>
48
+ </Navigation>
49
49
  </Localization>
50
50
  </BrowserContext>
51
51
  </AppContextReact.Provider>
@@ -1,4 +1,4 @@
1
- import type {TestRouter} from '@quilted/quilt/navigate/testing';
1
+ 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
 
@@ -1,6 +1,6 @@
1
1
  import '@quilted/quilt/testing';
2
2
 
3
- export {TestRouter} from '@quilted/quilt/navigate/testing';
3
+ export {TestRouter} from '@quilted/quilt/navigation/testing';
4
4
 
5
5
  export * from './render/types.ts';
6
6
  export {renderApp} from './render/render.tsx';
@@ -20,8 +20,8 @@
20
20
  "prettier": "^3.0.0",
21
21
  "tsx": "^4.9.0",
22
22
  "typescript": "^5.5.0",
23
- "vite": "^5.2.0",
24
- "vitest": "^1.6.0"
23
+ "vite": "^5.3.0",
24
+ "vitest": "^2.0.0"
25
25
  },
26
26
  "prettier": {
27
27
  "arrowParens": "always",