@quilted/quilt 0.5.63 → 0.5.66

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.
@@ -0,0 +1,5 @@
1
+ export interface EnvironmentVariables {
2
+ }
3
+ declare const Env: EnvironmentVariables;
4
+ export default Env;
5
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;CAAG;AAExC,OAAO,CAAC,MAAM,GAAG,EAAE,oBAAoB,CAAC;AAExC,eAAe,GAAG,CAAC"}
@@ -1,2 +1,3 @@
1
- export { Alternate, BodyAttributes, HtmlAttributes, Hydrator, Link, Meta, SearchRobots, ThemeColor, Title, Viewport, Favicon, useAlternateUrl, useSerialized, useBodyAttributes, useHtmlAttributes, useFavicon, useLink, useLocale, useMeta, useSearchRobots, useThemeColor, useTitle, useViewport, useHtmlUpdater, getSerialized, } from '@quilted/react-html';
1
+ export { Alternate, BodyAttributes, HtmlAttributes, Hydrator, Link, Meta, SearchRobots, Serialize, ThemeColor, Title, Viewport, Favicon, useAlternateUrl, useSerialized, useBodyAttributes, useHtmlAttributes, useFavicon, useLink, useLocale, useMeta, useSearchRobots, useThemeColor, useTitle, useViewport, useHtmlUpdater, getSerialized, } from '@quilted/react-html';
2
+ export type { Serializable } from '@quilted/react-html';
2
3
  //# sourceMappingURL=html.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/html.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,cAAc,EACd,cAAc,EACd,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,KAAK,EACL,QAAQ,EACR,OAAO,EACP,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,OAAO,EACP,SAAS,EACT,OAAO,EACP,eAAe,EACf,aAAa,EACb,QAAQ,EACR,WAAW,EACX,cAAc,EACd,aAAa,GACd,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/html.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,cAAc,EACd,cAAc,EACd,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,UAAU,EACV,KAAK,EACL,QAAQ,EACR,OAAO,EACP,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,OAAO,EACP,SAAS,EACT,OAAO,EACP,eAAe,EACf,aAAa,EACb,QAAQ,EACR,WAAW,EACX,cAAc,EACd,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import '@quilted/polyfills/crypto';
2
+ //# sourceMappingURL=crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/polyfills/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
@@ -1,10 +1,13 @@
1
1
  import type { ComponentType } from 'react';
2
2
  import type { AssetLoader } from '@quilted/async/server';
3
- import type { HttpHandler, RequestHandler, HttpHandlerOptions } from '@quilted/http-handlers';
4
- export interface Options extends Pick<HttpHandlerOptions, 'before'> {
3
+ import type { Request, HttpHandler, RequestHandler } from '@quilted/http-handlers';
4
+ export interface Options<Props = Record<string, never>> {
5
5
  assets: AssetLoader<unknown>;
6
6
  handler?: HttpHandler;
7
+ renderProps?(options: {
8
+ request: Request;
9
+ }): Props;
7
10
  }
8
- export declare function createServerRenderingRequestHandler(App: ComponentType<any>, { assets }: Pick<Options, 'assets'>): RequestHandler;
9
- export declare function createServerRenderingHttpHandler(App: ComponentType<any>, { assets, before, handler }: Options): HttpHandler;
11
+ export declare function createServerRenderingRequestHandler<Props>(App: ComponentType<Props>, { assets, renderProps, }: Pick<Options<Props>, 'assets' | 'renderProps'>): RequestHandler;
12
+ export declare function createServerRenderingHttpHandler<Props>(App: ComponentType<Props>, { assets, renderProps, handler }: Options<Props>): HttpHandler;
10
13
  //# sourceMappingURL=http-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-handler.d.ts","sourceRoot":"","sources":["../../../src/server/http-handler.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAIvD,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAIhC,MAAM,WAAW,OAAQ,SAAQ,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IACjE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED,wBAAgB,mCAAmC,CACjD,GAAG,EAAE,aAAa,CAAC,GAAG,CAAC,EACvB,EAAC,MAAM,EAAC,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,GAChC,cAAc,CAqDhB;AAED,wBAAgB,gCAAgC,CAC9C,GAAG,EAAE,aAAa,CAAC,GAAG,CAAC,EACvB,EAAC,MAAM,EAAE,MAAM,EAAE,OAAqC,EAAC,EAAE,OAAO,eAIjE"}
1
+ {"version":3,"file":"http-handler.d.ts","sourceRoot":"","sources":["../../../src/server/http-handler.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAIvD,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,cAAc,EACf,MAAM,wBAAwB,CAAC;AAIhC,MAAM,WAAW,OAAO,C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AAID,wBAAsB,YAAY,CAChC,GAAG,EAAE,aAAa,CAAC,GAAG,CAAC,EACvB,EACE,MAAM,EACN,MAAM,EAAE,cAAc,EACtB,QAAQ,EACR,KAAY,EACZ,OAAkB,EAClB,QAAe,GAChB,EAAE,OAAO,iBAsOX"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@quilted/quilt",
3
3
  "type": "module",
4
- "version": "0.5.63",
4
+ "version": "0.5.66",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/lemonmade/quilt.git",
@@ -103,6 +103,12 @@
103
103
  "import": "./build/esm/polyfills/base.mjs",
104
104
  "require": "./build/cjs/polyfills/base.cjs"
105
105
  },
106
+ "./polyfills/crypto": {
107
+ "quilt:from-source": "./src/polyfills/crypto.ts",
108
+ "quilt:esnext": "./build/esnext/polyfills/crypto.esnext",
109
+ "import": "./build/esm/polyfills/crypto.mjs",
110
+ "require": "./build/cjs/polyfills/crypto.cjs"
111
+ },
106
112
  "./polyfills/fetch": {
107
113
  "quilt:from-source": "./src/polyfills/fetch.ts",
108
114
  "quilt:esnext": "./build/esnext/polyfills/fetch.esnext",
@@ -134,6 +140,9 @@
134
140
  "global": [
135
141
  "./build/typescript/global.d.ts"
136
142
  ],
143
+ "env": [
144
+ "./build/typescript/env.d.ts"
145
+ ],
137
146
  "http": [
138
147
  "./build/typescript/http.d.ts"
139
148
  ],
@@ -164,6 +173,9 @@
164
173
  "polyfills/fetch": [
165
174
  "./build/typescript/polyfills/fetch.d.ts"
166
175
  ],
176
+ "polyfills/crypto": [
177
+ "./build/typescript/polyfills/crypto.d.ts"
178
+ ],
167
179
  "polyfills/noop": [
168
180
  "./build/typescript/polyfills/noop.d.ts"
169
181
  ],
@@ -6,6 +6,7 @@ export default createPackage((pkg) => {
6
6
  pkg.entry({source: './src/html', name: 'html'});
7
7
  pkg.entry({source: './src/email', name: 'email'});
8
8
  pkg.entry({source: './src/global', name: 'global'});
9
+ pkg.entry({source: './src/env', name: 'env'});
9
10
  pkg.entry({source: './src/react', name: 'react'});
10
11
  pkg.entry({
11
12
  source: './src/react/server',
package/src/env.ts ADDED
@@ -0,0 +1,5 @@
1
+ export interface EnvironmentVariables {}
2
+
3
+ declare const Env: EnvironmentVariables;
4
+
5
+ export default Env;
package/src/html.ts CHANGED
@@ -6,6 +6,7 @@ export {
6
6
  Link,
7
7
  Meta,
8
8
  SearchRobots,
9
+ Serialize,
9
10
  ThemeColor,
10
11
  Title,
11
12
  Viewport,
@@ -25,3 +26,4 @@ export {
25
26
  useHtmlUpdater,
26
27
  getSerialized,
27
28
  } from '@quilted/react-html';
29
+ export type {Serializable} from '@quilted/react-html';
@@ -0,0 +1 @@
1
+ import '@quilted/polyfills/crypto';
@@ -1,25 +1,29 @@
1
1
  import type {ComponentType} from 'react';
2
2
 
3
3
  import type {AssetLoader} from '@quilted/async/server';
4
- import {render, Html} from '@quilted/react-html/server';
4
+ import {render as renderToString, Html} from '@quilted/react-html/server';
5
5
 
6
6
  import {createHttpHandler, html, redirect} from '@quilted/http-handlers';
7
7
  import type {
8
+ Request,
8
9
  HttpHandler,
9
10
  RequestHandler,
10
- HttpHandlerOptions,
11
11
  } from '@quilted/http-handlers';
12
12
 
13
13
  import {renderApp} from './render';
14
14
 
15
- export interface Options extends Pick<HttpHandlerOptions, 'before'> {
15
+ export interface Options<Props = Record<string, never>> {
16
16
  assets: AssetLoader<unknown>;
17
17
  handler?: HttpHandler;
18
+ renderProps?(options: {request: Request}): Props;
18
19
  }
19
20
 
20
- export function createServerRenderingRequestHandler(
21
- App: ComponentType<any>,
22
- {assets}: Pick<Options, 'assets'>,
21
+ export function createServerRenderingRequestHandler<Props>(
22
+ App: ComponentType<Props>,
23
+ {
24
+ assets,
25
+ renderProps = () => ({} as any),
26
+ }: Pick<Options<Props>, 'assets' | 'renderProps'>,
23
27
  ): RequestHandler {
24
28
  return async (request) => {
25
29
  const accepts = request.headers.get('Accept');
@@ -31,7 +35,7 @@ export function createServerRenderingRequestHandler(
31
35
  http,
32
36
  markup,
33
37
  asyncAssets,
34
- } = await renderApp(<App />, {
38
+ } = await renderApp(<App {...renderProps?.({request})} />, {
35
39
  url: request.url,
36
40
  headers: request.headers,
37
41
  });
@@ -57,7 +61,7 @@ export function createServerRenderingRequestHandler(
57
61
  ]);
58
62
 
59
63
  return html(
60
- render(
64
+ renderToString(
61
65
  <Html
62
66
  manager={htmlManager}
63
67
  styles={styles}
@@ -75,10 +79,10 @@ export function createServerRenderingRequestHandler(
75
79
  };
76
80
  }
77
81
 
78
- export function createServerRenderingHttpHandler(
79
- App: ComponentType<any>,
80
- {assets, before, handler = createHttpHandler({before})}: Options,
82
+ export function createServerRenderingHttpHandler<Props>(
83
+ App: ComponentType<Props>,
84
+ {assets, renderProps, handler = createHttpHandler()}: Options<Props>,
81
85
  ) {
82
- handler.get(createServerRenderingRequestHandler(App, {assets}));
86
+ handler.get(createServerRenderingRequestHandler(App, {assets, renderProps}));
83
87
  return handler;
84
88
  }
@@ -169,8 +169,6 @@ export async function renderStatic(
169
169
  }
170
170
  }
171
171
 
172
- // console.log({routeId, match, addFallbacks, children, routes, ownRoute});
173
-
174
172
  if (hasChildren) {
175
173
  for (const {id, route} of matchedRoutes) {
176
174
  for (const child of children!) {