@quilted/create 0.1.78 → 0.1.80

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 (103) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/build/cjs/app.cjs +8 -10
  3. package/build/esm/app.mjs +8 -10
  4. package/build/esnext/app.esnext +8 -10
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/build/typescript/app.d.ts.map +1 -1
  7. package/build/typescript/shared.d.ts +1 -1
  8. package/build/typescript/shared.d.ts.map +1 -1
  9. package/package.json +1 -1
  10. package/source/app.ts +16 -18
  11. package/source/shared.ts +0 -2
  12. package/templates/app-basic/App.tsx +37 -13
  13. package/templates/app-basic/browser.tsx +2 -2
  14. package/templates/app-basic/features/start/Start/Start.tsx +5 -0
  15. package/templates/app-basic/features/start.ts +5 -0
  16. package/templates/app-basic/foundation/frame/Frame.module.css +14 -0
  17. package/templates/app-basic/foundation/frame/Frame.tsx +7 -0
  18. package/templates/app-basic/foundation/frame.ts +1 -0
  19. package/templates/app-basic/foundation/{Head → html}/Head.test.tsx +4 -4
  20. package/templates/app-basic/foundation/html.ts +1 -0
  21. package/templates/{app-trpc/foundation/Http/Http.test.tsx → app-basic/foundation/http/Headers.test.tsx} +8 -8
  22. package/templates/app-basic/foundation/{Http/Http.tsx → http/Headers.tsx} +3 -3
  23. package/templates/app-basic/foundation/http.ts +1 -0
  24. package/templates/app-basic/server.tsx +18 -15
  25. package/templates/app-basic/shared/context.ts +1 -6
  26. package/templates/app-basic/tests/render/render.tsx +12 -12
  27. package/templates/app-basic/tests/render/types.ts +3 -5
  28. package/templates/app-basic/tests/render.ts +2 -2
  29. package/templates/app-basic/tsconfig.json +1 -1
  30. package/templates/app-empty/App.tsx +1 -1
  31. package/templates/app-empty/browser.tsx +1 -1
  32. package/templates/app-empty/server.tsx +18 -14
  33. package/templates/app-empty/tsconfig.json +1 -1
  34. package/templates/app-graphql/App.tsx +36 -26
  35. package/templates/app-graphql/browser.tsx +2 -2
  36. package/templates/app-graphql/features/{Start → start/Start}/Start.test.tsx +3 -7
  37. package/templates/app-graphql/features/start/Start/Start.tsx +14 -0
  38. package/templates/app-graphql/features/start.ts +5 -0
  39. package/templates/app-graphql/foundation/frame/Frame.module.css +14 -0
  40. package/templates/app-graphql/foundation/frame/Frame.tsx +7 -0
  41. package/templates/app-graphql/foundation/frame.ts +1 -0
  42. package/templates/{app-trpc/foundation/Head → app-graphql/foundation/html}/Head.test.tsx +4 -4
  43. package/templates/app-graphql/foundation/html.ts +1 -0
  44. package/templates/{app-basic/foundation/Http/Http.test.tsx → app-graphql/foundation/http/Headers.test.tsx} +8 -8
  45. package/templates/app-graphql/foundation/{Http/Http.tsx → http/Headers.tsx} +3 -3
  46. package/templates/app-graphql/foundation/http.ts +1 -0
  47. package/templates/app-graphql/graphql/schema.graphql +4 -2
  48. package/templates/app-graphql/server/graphql.ts +9 -4
  49. package/templates/app-graphql/server.tsx +36 -33
  50. package/templates/app-graphql/shared/context.ts +1 -6
  51. package/templates/app-graphql/tests/graphql.ts +3 -4
  52. package/templates/app-graphql/tests/render/render.tsx +16 -15
  53. package/templates/app-graphql/tests/render/types.ts +9 -10
  54. package/templates/app-graphql/tests/render.ts +2 -3
  55. package/templates/app-graphql/tsconfig.json +1 -1
  56. package/templates/app-trpc/App.tsx +39 -33
  57. package/templates/app-trpc/browser.tsx +2 -2
  58. package/templates/app-trpc/features/{Start → start/Start}/Start.test.tsx +2 -2
  59. package/templates/app-trpc/features/start/Start/Start.tsx +9 -0
  60. package/templates/app-trpc/features/start.ts +5 -0
  61. package/templates/app-trpc/foundation/frame/Frame.module.css +14 -0
  62. package/templates/app-trpc/foundation/frame/Frame.tsx +7 -0
  63. package/templates/app-trpc/foundation/frame.ts +1 -0
  64. package/templates/{app-graphql/foundation/Head → app-trpc/foundation/html}/Head.test.tsx +4 -4
  65. package/templates/app-trpc/foundation/html.ts +1 -0
  66. package/templates/{app-graphql/foundation/Http/Http.test.tsx → app-trpc/foundation/http/Headers.test.tsx} +8 -8
  67. package/templates/app-trpc/foundation/{Http/Http.tsx → http/Headers.tsx} +3 -3
  68. package/templates/app-trpc/foundation/http.ts +1 -0
  69. package/templates/app-trpc/server.tsx +20 -13
  70. package/templates/app-trpc/shared/context.ts +1 -6
  71. package/templates/app-trpc/tests/render/render.tsx +17 -16
  72. package/templates/app-trpc/tsconfig.json +1 -1
  73. package/templates/service-basic/service.ts +2 -2
  74. package/templates/app-basic/features/Start/Start.tsx +0 -12
  75. package/templates/app-basic/features/Start.tsx +0 -3
  76. package/templates/app-basic/foundation/Head.tsx +0 -1
  77. package/templates/app-basic/foundation/Http.tsx +0 -1
  78. package/templates/app-basic/foundation/Metrics/Metrics.tsx +0 -23
  79. package/templates/app-basic/foundation/Metrics.tsx +0 -1
  80. package/templates/app-graphql/features/Start/Start.tsx +0 -20
  81. package/templates/app-graphql/features/Start.tsx +0 -3
  82. package/templates/app-graphql/foundation/Head.tsx +0 -1
  83. package/templates/app-graphql/foundation/Http.tsx +0 -1
  84. package/templates/app-graphql/foundation/Metrics/Metrics.tsx +0 -23
  85. package/templates/app-graphql/foundation/Metrics.tsx +0 -1
  86. package/templates/app-single-file/App.tsx +0 -199
  87. package/templates/app-single-file/package.json +0 -35
  88. package/templates/app-single-file/quilt.project.ts +0 -5
  89. package/templates/app-single-file/tsconfig.json +0 -9
  90. package/templates/app-trpc/features/Start/Start.tsx +0 -16
  91. package/templates/app-trpc/features/Start.tsx +0 -3
  92. package/templates/app-trpc/foundation/Head.tsx +0 -1
  93. package/templates/app-trpc/foundation/Http.tsx +0 -1
  94. package/templates/app-trpc/foundation/Metrics/Metrics.tsx +0 -23
  95. package/templates/app-trpc/foundation/Metrics.tsx +0 -1
  96. /package/templates/app-basic/features/{Start → start/Start}/Start.module.css +0 -0
  97. /package/templates/app-basic/features/{Start → start/Start}/Start.test.tsx +0 -0
  98. /package/templates/app-basic/foundation/{Head → html}/Head.tsx +0 -0
  99. /package/templates/app-graphql/features/{Start → start/Start}/Start.module.css +0 -0
  100. /package/templates/app-graphql/features/{Start → start/Start}/StartQuery.graphql +0 -0
  101. /package/templates/app-graphql/foundation/{Head → html}/Head.tsx +0 -0
  102. /package/templates/app-trpc/features/{Start → start/Start}/Start.module.css +0 -0
  103. /package/templates/app-trpc/foundation/{Head → html}/Head.tsx +0 -0
@@ -1,12 +0,0 @@
1
- import {usePerformanceNavigation} from '@quilted/quilt';
2
-
3
- import styles from './Start.module.css';
4
-
5
- export default function Start() {
6
- // This hook indicates that the page has loaded. It is used as part of Quilt’s
7
- // navigation performance tracking feature. If you have disabled this feature,
8
- // you can remove this hook.
9
- usePerformanceNavigation();
10
-
11
- return <div className={styles.Start}>Hello world!</div>;
12
- }
@@ -1,3 +0,0 @@
1
- import {createAsyncComponent} from '@quilted/quilt';
2
-
3
- export const Start = createAsyncComponent(() => import('./Start/Start.tsx'));
@@ -1 +0,0 @@
1
- export {Head} from './Head/Head.tsx';
@@ -1 +0,0 @@
1
- export {Http} from './Http/Http.tsx';
@@ -1,23 +0,0 @@
1
- import {
2
- usePerformanceNavigationEvent,
3
- type PropsWithChildren,
4
- } from '@quilted/quilt';
5
- import Env from '@quilted/quilt/env';
6
-
7
- // This component records metrics about your application.
8
- export function Metrics({children}: PropsWithChildren) {
9
- usePerformanceNavigationEvent(async (navigation) => {
10
- if (Env.MODE === 'development') {
11
- // eslint-disable-next-line no-console
12
- console.log('Navigation:');
13
- // eslint-disable-next-line no-console
14
- console.log(navigation);
15
- return;
16
- }
17
-
18
- // If you have a service that collects metrics, you can send navigation
19
- // data to them here.
20
- });
21
-
22
- return <>{children}</>;
23
- }
@@ -1 +0,0 @@
1
- export {Metrics} from './Metrics/Metrics.tsx';
@@ -1,20 +0,0 @@
1
- import {usePerformanceNavigation} from '@quilted/quilt';
2
- import {useGraphQLQuery} from '@quilted/react-query';
3
-
4
- import styles from './Start.module.css';
5
- import startQuery from './StartQuery.graphql';
6
-
7
- export default function Start() {
8
- const {data, isLoading} = useGraphQLQuery(startQuery);
9
-
10
- // This hook indicates that the page has loaded. It is used as part of Quilt’s
11
- // navigation performance tracking feature. If you have disabled this feature,
12
- // you can remove this hook.
13
- usePerformanceNavigation({state: isLoading ? 'loading' : 'complete'});
14
-
15
- return (
16
- <div className={styles.Start}>
17
- {data ? `Hello ${data.name}!` : 'Hello!'}
18
- </div>
19
- );
20
- }
@@ -1,3 +0,0 @@
1
- import {createAsyncComponent} from '@quilted/quilt';
2
-
3
- export const Start = createAsyncComponent(() => import('./Start/Start.tsx'));
@@ -1 +0,0 @@
1
- export {Head} from './Head/Head.tsx';
@@ -1 +0,0 @@
1
- export {Http} from './Http/Http.tsx';
@@ -1,23 +0,0 @@
1
- import {
2
- usePerformanceNavigationEvent,
3
- type PropsWithChildren,
4
- } from '@quilted/quilt';
5
- import Env from '@quilted/quilt/env';
6
-
7
- // This component records metrics about your application.
8
- export function Metrics({children}: PropsWithChildren) {
9
- usePerformanceNavigationEvent(async (navigation) => {
10
- if (Env.MODE === 'development') {
11
- // eslint-disable-next-line no-console
12
- console.log('Navigation:');
13
- // eslint-disable-next-line no-console
14
- console.log(navigation);
15
- return;
16
- }
17
-
18
- // If you have a service that collects metrics, you can send navigation
19
- // data to them here.
20
- });
21
-
22
- return <>{children}</>;
23
- }
@@ -1 +0,0 @@
1
- export {Metrics} from './Metrics/Metrics.tsx';
@@ -1,199 +0,0 @@
1
- import {
2
- QuiltApp,
3
- useCurrentUrl,
4
- usePerformanceNavigation,
5
- usePerformanceNavigationEvent,
6
- type Routes,
7
- } from '@quilted/quilt';
8
- import {Title, Viewport, Favicon, SearchRobots} from '@quilted/quilt/html';
9
- import {
10
- CacheControl,
11
- ResponseHeader,
12
- ContentSecurityPolicy,
13
- PermissionsPolicy,
14
- StrictTransportSecurity,
15
- } from '@quilted/quilt/http';
16
- import Env from '@quilted/quilt/env';
17
-
18
- // This component renders the routes for your application. If you have a lot
19
- // of routes, or you need to customize the routes based on React context,
20
- // you can declare dynamic routes in component with Quilt’s `useRoutes()`
21
- // hook.
22
- const routes: Routes = [{match: '/', render: <Start />}];
23
-
24
- // The root component for your application. You will typically render any
25
- // app-wide context in this component.
26
- export default function App() {
27
- return (
28
- <QuiltApp http={<Http />} html={<Head />} routes={routes}>
29
- <Metrics />
30
- </QuiltApp>
31
- );
32
- }
33
-
34
- // This component will be rendered for the root URL of your application. Feel
35
- // free to edit it, rename it, remove it entirely, or move it to a dedicated file.
36
- function Start() {
37
- // This hook indicates that the page has loaded. It is used as part of Quilt’s
38
- // navigation performance tracking feature. If you have disabled this feature,
39
- // you can remove this hook.
40
- usePerformanceNavigation();
41
-
42
- return <div>Hello world!</div>;
43
- }
44
-
45
- // This component sets details of the HTML page. If you need to customize
46
- // any of these details based on conditions like the active route, or some
47
- // state about the user, you can move these components to wherever in your
48
- // application you can read that state.
49
- function Head() {
50
- return (
51
- <>
52
- {/* Sets the default `<title>` for this application. */}
53
- <Title>App</Title>
54
-
55
- {/*
56
- * Sets the default favicon used by the application. You can
57
- * change this to a different emoji, make it `blank`, or pass
58
- * a URL with the `source` prop.
59
- */}
60
- <Favicon emoji="🧶" />
61
-
62
- {/* Adds a responsive-friendly `viewport` `<meta>` tag. */}
63
- <Viewport cover />
64
-
65
- {/*
66
- * Disables all search indexing for this application. If you are
67
- * building an unauthenticated app, you probably want to remove
68
- * this component, or update it to control how your site is indexed
69
- * by search engines.
70
- */}
71
- <SearchRobots index={false} follow={false} />
72
- </>
73
- );
74
- }
75
-
76
- // This component sets details on the HTTP response for all HTML server-rendering
77
- // requests. If you need to customize any of these details based on conditions like
78
- // the active route, or some state about the user, you can move these components to
79
- // wherever in your application you can read that state.
80
- export function Http() {
81
- const isHttps = useCurrentUrl().protocol === 'https:';
82
-
83
- return (
84
- <>
85
- {/*
86
- * Disables the cache for this page, which is generally the best option
87
- * when dealing with authenticated content. If your site doesn’t have
88
- * authentication, or you have a better cache policy that works for your
89
- * app or deployment, make sure to update this component accordingly!
90
- *
91
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
92
- */}
93
- <CacheControl cache={false} />
94
-
95
- {/*
96
- * Sets a strict content security policy for this page. If you load
97
- * assets from other origins, or want to allow some more dangerous
98
- * resource loading techniques like `eval`, you can change the
99
- * `defaultSources` to be less restrictive, or add additional items
100
- * to the allowlist for more specific directives.
101
- *
102
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
103
- */}
104
- <ContentSecurityPolicy
105
- reportOnly={Env.MODE === 'development'}
106
- // By default, only allow sources from the page’s origin.
107
- defaultSources={["'self'"]}
108
- // In development, allow connections to local websockets for hot reloading.
109
- connectSources={
110
- Env.MODE === 'development'
111
- ? ["'self'", `${isHttps ? 'ws' : 'wss'}://localhost:*`]
112
- : undefined
113
- }
114
- // Includes `'unsafe-inline'` because CSS is often necessary in development,
115
- // and can be difficult to avoid in production.
116
- styleSources={["'self'", "'unsafe-inline'"]}
117
- // Includes `data:` so that an inline image can be used for the favicon.
118
- // If you do not use the `emoji` or `blank` favicons in your app, and you
119
- // do not load any other images as data URIs, you can remove this directive.
120
- imageSources={["'self'", 'data:']}
121
- // Don’t allow this page to be rendered as a frame from a different origin.
122
- frameAncestors={false}
123
- // Ensure that all requests made by this page are made over https, unless
124
- // it is being served over http (typically, during local development)
125
- upgradeInsecureRequests={isHttps}
126
- />
127
-
128
- {/*
129
- * Sets a strict permissions policy for this page, which limits access
130
- * to some native browser features.
131
- *
132
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
133
- */}
134
- <PermissionsPolicy
135
- // Disables Google’s Federated Learning of Cohorts (“FLoC”) tracking initiative.
136
- // @see https://www.eff.org/deeplinks/2021/03/googles-floc-terrible-idea
137
- interestCohort={false}
138
- // Don’t use synchronous XHRs!
139
- // @see https://featurepolicy.info/policies/sync-xhr
140
- syncXhr={false}
141
- // Disables access to a few device APIs that are infrequently used
142
- // and prone to abuse. If your application uses these APIs intentionally,
143
- // feel free to remove the prop, or pass an array containing the origins
144
- // that should be allowed to use this feature (e.g., `['self']` to allow
145
- // only the main page’s origin).
146
- camera={false}
147
- microphone={false}
148
- geolocation={false}
149
- />
150
-
151
- {/*
152
- * Instructs browsers to only load this page over HTTPS using the
153
- * `Strict-Transport-Security` header.
154
- *
155
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
156
- */}
157
- {isHttps && <StrictTransportSecurity />}
158
-
159
- {/*
160
- * Controls how much information about the current page is included in
161
- * requests (through the `Referer` header). The default value
162
- * (strict-origin-when-cross-origin) means that only the origin is included
163
- * for cross-origin requests, while the origin, path, and querystring
164
- * are included for same-origin requests.
165
- *
166
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
167
- */}
168
- <ResponseHeader
169
- name="Referrer-Policy"
170
- value="strict-origin-when-cross-origin"
171
- />
172
-
173
- {/*
174
- * Instructs browsers to respect the MIME type in the `Content-Type` header.
175
- *
176
- * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
177
- */}
178
- <ResponseHeader name="X-Content-Type-Options" value="nosniff" />
179
- </>
180
- );
181
- }
182
-
183
- // This component records metrics about your application.
184
- export function Metrics() {
185
- usePerformanceNavigationEvent(async (navigation) => {
186
- if (Env.MODE === 'development') {
187
- // eslint-disable-next-line no-console
188
- console.log('Navigation:');
189
- // eslint-disable-next-line no-console
190
- console.log(navigation);
191
- return;
192
- }
193
-
194
- // If you have a service that collects metrics, you can send navigation
195
- // data to them here.
196
- });
197
-
198
- return null;
199
- }
@@ -1,35 +0,0 @@
1
- {
2
- "name": "template-app-single-file",
3
- "type": "module",
4
- "version": "0.0.0",
5
- "private": true,
6
- "scripts": {
7
- "start": "node ./build/server/server.js"
8
- },
9
- "dependencies": {},
10
- "devDependencies": {
11
- "@quilted/quilt": "^0.5.0",
12
- "@types/react": "^18.0.0",
13
- "@types/react-dom": "^18.0.0",
14
- "preact": "^10.17.0",
15
- "react": "npm:@quilted/react@^18.2.0",
16
- "react-dom": "npm:@quilted/react-dom@^18.2.0"
17
- },
18
- "sideEffects": [
19
- "*.css"
20
- ],
21
- "browserslist": {
22
- "defaults": [
23
- "extends @quilted/browserslist-config/defaults"
24
- ],
25
- "modules": [
26
- "extends @quilted/browserslist-config/modules"
27
- ],
28
- "evergreen": [
29
- "extends @quilted/browserslist-config/evergreen"
30
- ]
31
- },
32
- "eslintConfig": {
33
- "extends": "@quilted/eslint-config/app"
34
- }
35
- }
@@ -1,5 +0,0 @@
1
- import {createProject, quiltApp} from '@quilted/craft';
2
-
3
- export default createProject((project) => {
4
- project.use(quiltApp());
5
- });
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "@quilted/typescript/project.json",
3
- "compilerOptions": {
4
- "outDir": "build/typescript"
5
- },
6
- "include": ["**/*"],
7
- "exclude": ["build", "quilt.project.ts", "**/*.test.ts", "**/*.test.tsx"],
8
- "references": []
9
- }
@@ -1,16 +0,0 @@
1
- import {usePerformanceNavigation} from '@quilted/quilt';
2
-
3
- import {trpc} from '~/shared/trpc.ts';
4
-
5
- import styles from './Start.module.css';
6
-
7
- export default function Start() {
8
- const [data] = trpc.message.useSuspenseQuery('world');
9
-
10
- // This hook indicates that the page has loaded. It is used as part of Quilt’s
11
- // navigation performance tracking feature. If you have disabled this feature,
12
- // you can remove this hook.
13
- usePerformanceNavigation();
14
-
15
- return <div className={styles.Start}>{data}</div>;
16
- }
@@ -1,3 +0,0 @@
1
- import {createAsyncComponent} from '@quilted/quilt';
2
-
3
- export const Start = createAsyncComponent(() => import('./Start/Start.tsx'));
@@ -1 +0,0 @@
1
- export {Head} from './Head/Head.tsx';
@@ -1 +0,0 @@
1
- export {Http} from './Http/Http.tsx';
@@ -1,23 +0,0 @@
1
- import {
2
- usePerformanceNavigationEvent,
3
- type PropsWithChildren,
4
- } from '@quilted/quilt';
5
- import Env from '@quilted/quilt/env';
6
-
7
- // This component records metrics about your application.
8
- export function Metrics({children}: PropsWithChildren) {
9
- usePerformanceNavigationEvent(async (navigation) => {
10
- if (Env.MODE === 'development') {
11
- // eslint-disable-next-line no-console
12
- console.log('Navigation:');
13
- // eslint-disable-next-line no-console
14
- console.log(navigation);
15
- return;
16
- }
17
-
18
- // If you have a service that collects metrics, you can send navigation
19
- // data to them here.
20
- });
21
-
22
- return <>{children}</>;
23
- }
@@ -1 +0,0 @@
1
- export {Metrics} from './Metrics/Metrics.tsx';