@quilted/create 0.2.32 → 0.2.33

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 (28) hide show
  1. package/CHANGELOG.md +6 -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 +1 -1
  19. package/templates/app-basic/browser.tsx +4 -1
  20. package/templates/app-basic/server.tsx +4 -1
  21. package/templates/app-basic/shared/context.ts +7 -1
  22. package/templates/app-graphql/App.tsx +1 -1
  23. package/templates/app-graphql/browser.tsx +2 -0
  24. package/templates/app-graphql/server.tsx +2 -0
  25. package/templates/app-graphql/shared/context.ts +7 -1
  26. package/templates/app-trpc/browser.tsx +2 -0
  27. package/templates/app-trpc/server.tsx +20 -18
  28. package/templates/app-trpc/shared/context.ts +7 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @quilted/create
2
2
 
3
+ ## 0.2.33
4
+
5
+ ### Patch Changes
6
+
7
+ - [#760](https://github.com/lemonmade/quilt/pull/760) [`8cea8b6`](https://github.com/lemonmade/quilt/commit/8cea8b67158b4aab6b7fc30f1dc8efbddd00e143) Thanks [@lemonmade](https://github.com/lemonmade)! - Explicitly pass router in templates via app context
8
+
3
9
  ## 0.2.32
4
10
 
5
11
  ### Patch Changes
@@ -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 };
@@ -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 };
@@ -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/index5.esnext';
7
+ import { __exports as out } from '../../../../../../../../_virtual/index3.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/index5.esnext';
6
+ import { __exports as out } from '../../../../../../../../_virtual/index3.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/index5.esnext';
5
+ import { __exports as out } from '../../../../../../../_virtual/index3.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/index5.esnext';
1
+ import { __exports as out } from '../../../../../../../_virtual/index3.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/index4.esnext';
1
+ import { __exports as out } from '../../../../../../../_virtual/index2.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/index2.esnext';
2
+ import { __module as dirGlob$1 } from '../../../../../_virtual/index4.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/index3.esnext';
5
+ import { __exports as pathType$1 } from '../../../../../_virtual/index5.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/index4.esnext';
5
+ import { __exports as out } from '../../../../../../../_virtual/index2.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/index5.esnext';
5
+ import { __exports as out } from '../../../../../../../_virtual/index3.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/index5.esnext';
7
- import { __exports as out$1 } from '../../../../../../../_virtual/index4.esnext';
6
+ import { __exports as out } from '../../../../../../../_virtual/index3.esnext';
7
+ import { __exports as out$1 } from '../../../../../../../_virtual/index2.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/index5.esnext';
6
- import { __exports as out$1 } from '../../../../../../../_virtual/index4.esnext';
5
+ import { __exports as out } from '../../../../../../../_virtual/index3.esnext';
6
+ import { __exports as out$1 } from '../../../../../../../_virtual/index2.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/index3.esnext';
1
+ import { __exports as pathType } from '../../../../../_virtual/index5.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.32",
4
+ "version": "0.2.33",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -41,7 +41,7 @@ export function App({context}: AppProps) {
41
41
  return (
42
42
  <AppContext context={context}>
43
43
  <HTML>
44
- <Navigation routes={routes} context={context} />
44
+ <Navigation router={context.router} routes={routes} context={context} />
45
45
  </HTML>
46
46
  </AppContext>
47
47
  );
@@ -1,6 +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
5
 
5
6
  import type {AppContext} from '~/shared/context.ts';
6
7
  import {App} from './App.tsx';
@@ -8,7 +9,9 @@ import {App} from './App.tsx';
8
9
  const element = document.querySelector('#app')!;
9
10
  const browser = new Browser();
10
11
 
11
- const context = {} satisfies AppContext;
12
+ const context = {
13
+ router: new Router(browser.request.url),
14
+ } satisfies AppContext;
12
15
 
13
16
  // Makes key parts of the app available in the browser console
14
17
  Object.assign(globalThis, {app: context});
@@ -1,6 +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
5
  import {BrowserAssets} from 'quilt:module/assets';
5
6
 
6
7
  import type {AppContext} from '~/shared/context.ts';
@@ -12,7 +13,9 @@ const assets = new BrowserAssets();
12
13
 
13
14
  // For all GET requests, render our React application.
14
15
  router.get(async (request) => {
15
- const context = {} satisfies AppContext;
16
+ const context = {
17
+ router: new Router(request.url),
18
+ } satisfies AppContext;
16
19
 
17
20
  const response = await renderToResponse(<App context={context} />, {
18
21
  request,
@@ -1,6 +1,12 @@
1
1
  import {createOptionalContext} from '@quilted/quilt/context';
2
+ import type {Router} from '@quilted/quilt/navigate';
2
3
 
3
- export interface AppContext {}
4
+ export interface AppContext {
5
+ /**
6
+ * The router used to control navigation throughout the application.
7
+ */
8
+ readonly router: Router;
9
+ }
4
10
 
5
11
  export const AppContextReact = createOptionalContext<AppContext>();
6
12
  export const useAppContext = AppContextReact.use;
@@ -42,7 +42,7 @@ export function App({context}: AppProps) {
42
42
  return (
43
43
  <AppContext context={context}>
44
44
  <HTML>
45
- <Navigation routes={routes} context={context} />
45
+ <Navigation router={context.router} routes={routes} context={context} />
46
46
  </HTML>
47
47
  </AppContext>
48
48
  );
@@ -3,6 +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
7
 
7
8
  import type {AppContext} from '~/shared/context.ts';
8
9
 
@@ -15,6 +16,7 @@ const graphQLFetch = createGraphQLFetch({url: '/api/graphql'});
15
16
  const graphQLCache = new GraphQLCache({fetch: graphQLFetch});
16
17
 
17
18
  const context = {
19
+ router: new Router(browser.request.url),
18
20
  graphql: {
19
21
  fetch: graphQLFetch,
20
22
  cache: graphQLCache,
@@ -1,6 +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
5
  import {BrowserAssets} from 'quilt:module/assets';
5
6
 
6
7
  import type {AppContext} from '~/shared/context.ts';
@@ -32,6 +33,7 @@ router.get(async (request) => {
32
33
  ]);
33
34
 
34
35
  const context = {
36
+ router: new Router(request.url),
35
37
  graphql: {
36
38
  fetch: performGraphQLOperation,
37
39
  cache: new GraphQLCache(),
@@ -1,6 +1,12 @@
1
1
  import {createOptionalContext} from '@quilted/quilt/context';
2
+ import type {Router} from '@quilted/quilt/navigate';
2
3
 
3
- export interface AppContext {}
4
+ export interface AppContext {
5
+ /**
6
+ * The router used to control navigation throughout the application.
7
+ */
8
+ readonly router: Router;
9
+ }
4
10
 
5
11
  export const AppContextReact = createOptionalContext<AppContext>();
6
12
  export const useAppContext = AppContextReact.use;
@@ -4,6 +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
8
 
8
9
  import type {AppContext} from '~/shared/context.ts';
9
10
  import {trpc} from '~/shared/trpc.ts';
@@ -19,6 +20,7 @@ const trpcClient = trpc.createClient({
19
20
  });
20
21
 
21
22
  const context = {
23
+ router: new Router(browser.request.url),
22
24
  trpc: trpcClient,
23
25
  queryClient,
24
26
  } satisfies AppContext;
@@ -5,6 +5,8 @@ import {BrowserAssets} from 'quilt:module/assets';
5
5
  import {createDirectClient} from '@quilted/trpc/server';
6
6
  import {fetchRequestHandler} from '@trpc/server/adapters/fetch';
7
7
 
8
+ import type {AppContext} from '~/shared/context.ts';
9
+
8
10
  import {appRouter} from './trpc.ts';
9
11
 
10
12
  const router = new RequestRouter();
@@ -25,24 +27,24 @@ router.any(
25
27
 
26
28
  // For all GET requests, render our React application.
27
29
  router.get(async (request) => {
28
- const [{App}, {renderToResponse}, {QueryClient}] = await Promise.all([
29
- import('./App.tsx'),
30
- import('@quilted/quilt/server'),
31
- import('@tanstack/react-query'),
32
- ]);
33
-
34
- const response = await renderToResponse(
35
- <App
36
- context={{
37
- trpc: createDirectClient(appRouter),
38
- queryClient: new QueryClient(),
39
- }}
40
- />,
41
- {
42
- request,
43
- assets,
44
- },
45
- );
30
+ const [{App}, {renderToResponse}, {Router}, {QueryClient}] =
31
+ await Promise.all([
32
+ import('./App.tsx'),
33
+ import('@quilted/quilt/server'),
34
+ import('@quilted/quilt/navigate'),
35
+ import('@tanstack/react-query'),
36
+ ]);
37
+
38
+ const context = {
39
+ router: new Router(request.url),
40
+ trpc: createDirectClient(appRouter),
41
+ queryClient: new QueryClient(),
42
+ } satisfies AppContext;
43
+
44
+ const response = await renderToResponse(<App context={context} />, {
45
+ request,
46
+ assets,
47
+ });
46
48
 
47
49
  return response;
48
50
  });
@@ -1,6 +1,12 @@
1
1
  import {createOptionalContext} from '@quilted/quilt/context';
2
+ import type {Router} from '@quilted/quilt/navigate';
2
3
 
3
- export interface AppContext {}
4
+ export interface AppContext {
5
+ /**
6
+ * The router used to control navigation throughout the application.
7
+ */
8
+ readonly router: Router;
9
+ }
4
10
 
5
11
  export const AppContextReact = createOptionalContext<AppContext>();
6
12
  export const useAppContext = AppContextReact.use;