@quilted/quilt 0.5.157 → 0.6.0

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 (171) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/build/esm/graphql/testing/matchers/operations.mjs +1 -1
  3. package/build/esm/graphql/testing/matchers/utilities.mjs +1 -1
  4. package/build/esm/graphql/testing/matchers.mjs +4 -3
  5. package/build/esm/graphql/testing.mjs +5 -1
  6. package/build/esm/react/testing.mjs +5 -2
  7. package/build/esnext/globals.esnext +1 -1
  8. package/build/esnext/graphql/testing/matchers/operations.esnext +49 -19
  9. package/build/esnext/graphql/testing/matchers/utilities.esnext +18 -15
  10. package/build/esnext/graphql/testing/matchers.esnext +4 -3
  11. package/build/esnext/graphql/testing.esnext +4 -1
  12. package/build/esnext/html/HTML.esnext +6 -9
  13. package/build/esnext/react/testing.esnext +4 -2
  14. package/build/esnext/server/ServerContext.esnext +14 -2
  15. package/build/esnext/server/preload.esnext +9 -10
  16. package/build/esnext/server/request-router.esnext +138 -141
  17. package/build/esnext/utilities/react.esnext +1 -4
  18. package/build/tsconfig.tsbuildinfo +1 -1
  19. package/build/typescript/globals.d.ts +1 -0
  20. package/build/typescript/globals.d.ts.map +1 -1
  21. package/build/typescript/graphql/testing/matchers/utilities.d.ts +1 -1
  22. package/build/typescript/graphql/testing/matchers/utilities.d.ts.map +1 -1
  23. package/build/typescript/graphql/testing/matchers.d.ts +10 -8
  24. package/build/typescript/graphql/testing/matchers.d.ts.map +1 -1
  25. package/build/typescript/graphql/testing.d.ts +7 -1
  26. package/build/typescript/graphql/testing.d.ts.map +1 -1
  27. package/build/typescript/modules.d.ts +23 -0
  28. package/build/typescript/modules.d.ts.map +1 -0
  29. package/build/typescript/react/testing.d.ts +7 -2
  30. package/build/typescript/react/testing.d.ts.map +1 -1
  31. package/configuration/rollup.config.js +3 -0
  32. package/package.json +66 -197
  33. package/source/globals.ts +2 -0
  34. package/source/graphql/testing/matchers/operations.ts +1 -1
  35. package/source/graphql/testing/matchers/utilities.ts +1 -1
  36. package/source/graphql/testing/matchers.ts +15 -22
  37. package/source/graphql/testing.ts +11 -1
  38. package/source/modules.ts +31 -0
  39. package/source/react/testing.ts +10 -3
  40. package/tsconfig.json +1 -3
  41. package/build/cjs/assets.cjs +0 -39
  42. package/build/cjs/async.cjs +0 -32
  43. package/build/cjs/env.cjs +0 -7
  44. package/build/cjs/events.cjs +0 -46
  45. package/build/cjs/globals.cjs +0 -21
  46. package/build/cjs/graphql/server.cjs +0 -14
  47. package/build/cjs/graphql/testing/matchers/operations.cjs +0 -42
  48. package/build/cjs/graphql/testing/matchers/utilities.cjs +0 -43
  49. package/build/cjs/graphql/testing/matchers.cjs +0 -10
  50. package/build/cjs/graphql/testing.cjs +0 -18
  51. package/build/cjs/graphql.cjs +0 -21
  52. package/build/cjs/html/HTML.cjs +0 -21
  53. package/build/cjs/html.cjs +0 -133
  54. package/build/cjs/http.cjs +0 -146
  55. package/build/cjs/index.cjs +0 -2
  56. package/build/cjs/localize.cjs +0 -46
  57. package/build/cjs/magic/app.cjs +0 -2
  58. package/build/cjs/magic/assets.cjs +0 -2
  59. package/build/cjs/magic/request-router.cjs +0 -2
  60. package/build/cjs/navigate/testing.cjs +0 -12
  61. package/build/cjs/navigate.cjs +0 -70
  62. package/build/cjs/performance.cjs +0 -26
  63. package/build/cjs/polyfills/abort-controller.cjs +0 -4
  64. package/build/cjs/polyfills/base.cjs +0 -4
  65. package/build/cjs/polyfills/crypto.cjs +0 -4
  66. package/build/cjs/polyfills/fetch-get-set-cookie.cjs +0 -4
  67. package/build/cjs/polyfills/fetch.cjs +0 -4
  68. package/build/cjs/polyfills/noop.cjs +0 -4
  69. package/build/cjs/react/testing.cjs +0 -30
  70. package/build/cjs/react/tools.cjs +0 -19
  71. package/build/cjs/react.cjs +0 -15
  72. package/build/cjs/request-router/index.cjs +0 -12
  73. package/build/cjs/request-router/node.cjs +0 -12
  74. package/build/cjs/server/ServerContext.cjs +0 -20
  75. package/build/cjs/server/preload.cjs +0 -37
  76. package/build/cjs/server/request-router.cjs +0 -266
  77. package/build/cjs/server.cjs +0 -114
  78. package/build/cjs/signals.cjs +0 -51
  79. package/build/cjs/static/StaticContext.cjs +0 -20
  80. package/build/cjs/static/index.cjs +0 -261
  81. package/build/cjs/static/render.cjs +0 -44
  82. package/build/cjs/testing.cjs +0 -12
  83. package/build/cjs/threads.cjs +0 -117
  84. package/build/cjs/utilities/react.cjs +0 -12
  85. package/build/esm/magic/request-router.mjs +0 -1
  86. package/build/esm/polyfills/abort-controller.mjs +0 -1
  87. package/build/esm/polyfills/base.mjs +0 -1
  88. package/build/esm/polyfills/crypto.mjs +0 -1
  89. package/build/esm/polyfills/fetch-get-set-cookie.mjs +0 -1
  90. package/build/esm/polyfills/fetch.mjs +0 -1
  91. package/build/esm/polyfills/noop.mjs +0 -1
  92. package/build/esm/static/StaticContext.mjs +0 -18
  93. package/build/esm/static/index.mjs +0 -259
  94. package/build/esm/static/render.mjs +0 -42
  95. package/build/esm/testing.mjs +0 -1
  96. package/build/esnext/magic/app.esnext +0 -1
  97. package/build/esnext/magic/assets.esnext +0 -1
  98. package/build/esnext/magic/request-router.esnext +0 -1
  99. package/build/esnext/polyfills/abort-controller.esnext +0 -1
  100. package/build/esnext/polyfills/base.esnext +0 -1
  101. package/build/esnext/polyfills/crypto.esnext +0 -1
  102. package/build/esnext/polyfills/fetch-get-set-cookie.esnext +0 -1
  103. package/build/esnext/polyfills/fetch.esnext +0 -1
  104. package/build/esnext/polyfills/noop.esnext +0 -1
  105. package/build/esnext/static/StaticContext.esnext +0 -18
  106. package/build/esnext/static/index.esnext +0 -259
  107. package/build/esnext/static/render.esnext +0 -42
  108. package/build/esnext/testing.esnext +0 -1
  109. package/build/typescript/App.d.ts +0 -48
  110. package/build/typescript/App.d.ts.map +0 -1
  111. package/build/typescript/TestApp.d.ts +0 -17
  112. package/build/typescript/TestApp.d.ts.map +0 -1
  113. package/build/typescript/global.d.ts +0 -8
  114. package/build/typescript/global.d.ts.map +0 -1
  115. package/build/typescript/magic/app.d.ts +0 -4
  116. package/build/typescript/magic/app.d.ts.map +0 -1
  117. package/build/typescript/magic/assets.d.ts +0 -5
  118. package/build/typescript/magic/assets.d.ts.map +0 -1
  119. package/build/typescript/magic/request-router.d.ts +0 -4
  120. package/build/typescript/magic/request-router.d.ts.map +0 -1
  121. package/build/typescript/matchers/graphql/operations.d.ts +0 -7
  122. package/build/typescript/matchers/graphql/operations.d.ts.map +0 -1
  123. package/build/typescript/matchers/graphql/utilities.d.ts +0 -8
  124. package/build/typescript/matchers/graphql/utilities.d.ts.map +0 -1
  125. package/build/typescript/matchers/graphql.d.ts +0 -9
  126. package/build/typescript/matchers/graphql.d.ts.map +0 -1
  127. package/build/typescript/matchers.d.ts +0 -3
  128. package/build/typescript/matchers.d.ts.map +0 -1
  129. package/build/typescript/polyfills/abort-controller.d.ts +0 -2
  130. package/build/typescript/polyfills/abort-controller.d.ts.map +0 -1
  131. package/build/typescript/polyfills/base.d.ts +0 -2
  132. package/build/typescript/polyfills/base.d.ts.map +0 -1
  133. package/build/typescript/polyfills/crypto.d.ts +0 -2
  134. package/build/typescript/polyfills/crypto.d.ts.map +0 -1
  135. package/build/typescript/polyfills/fetch-get-set-cookie.d.ts +0 -2
  136. package/build/typescript/polyfills/fetch-get-set-cookie.d.ts.map +0 -1
  137. package/build/typescript/polyfills/fetch.d.ts +0 -2
  138. package/build/typescript/polyfills/fetch.d.ts.map +0 -1
  139. package/build/typescript/polyfills/noop.d.ts +0 -2
  140. package/build/typescript/polyfills/noop.d.ts.map +0 -1
  141. package/build/typescript/react/index.d.ts +0 -3
  142. package/build/typescript/react/index.d.ts.map +0 -1
  143. package/build/typescript/react-dom/index.d.ts +0 -3
  144. package/build/typescript/react-dom/index.d.ts.map +0 -1
  145. package/build/typescript/server/index.d.ts +0 -16
  146. package/build/typescript/server/index.d.ts.map +0 -1
  147. package/build/typescript/static/StaticContext.d.ts +0 -13
  148. package/build/typescript/static/StaticContext.d.ts.map +0 -1
  149. package/build/typescript/static/index.d.ts +0 -20
  150. package/build/typescript/static/index.d.ts.map +0 -1
  151. package/build/typescript/static/render.d.ts +0 -19
  152. package/build/typescript/static/render.d.ts.map +0 -1
  153. package/build/typescript/testing.d.ts +0 -2
  154. package/build/typescript/testing.d.ts.map +0 -1
  155. package/quilt.project.ts +0 -5
  156. package/source/magic/app.ts +0 -5
  157. package/source/magic/assets.ts +0 -8
  158. package/source/magic/request-router.ts +0 -5
  159. package/source/polyfills/README.md +0 -3
  160. package/source/polyfills/abort-controller.ts +0 -1
  161. package/source/polyfills/base.ts +0 -1
  162. package/source/polyfills/crypto.ts +0 -1
  163. package/source/polyfills/fetch-get-set-cookie.ts +0 -1
  164. package/source/polyfills/fetch.ts +0 -1
  165. package/source/polyfills/noop.ts +0 -1
  166. package/source/static/StaticContext.tsx +0 -39
  167. package/source/static/index.tsx +0 -315
  168. package/source/static/render.tsx +0 -40
  169. package/source/testing.ts +0 -1
  170. /package/build/esm/{magic/app.mjs → modules.mjs} +0 -0
  171. /package/build/{esm/magic/assets.mjs → esnext/modules.esnext} +0 -0
@@ -1,3 +1,4 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
1
2
  import { isValidElement } from 'react';
2
3
  import { renderToStaticMarkup } from 'react-dom/server';
3
4
  import { styleAssetPreloadAttributes, scriptAssetPreloadAttributes } from '@quilted/assets';
@@ -7,12 +8,11 @@ import { HTMLManager, Head, Script, Style, StylePreload, ScriptPreload } from '@
7
8
  import { extract } from '@quilted/react-server-render/server';
8
9
  import { RedirectResponse, HTMLResponse } from '@quilted/request-router';
9
10
  import { ServerContext } from './ServerContext.esnext';
10
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
11
 
12
12
  async function renderToResponse(optionsOrElement, definitelyOptions) {
13
13
  let element;
14
14
  let options;
15
- if ( /*#__PURE__*/isValidElement(optionsOrElement)) {
15
+ if (isValidElement(optionsOrElement)) {
16
16
  element = optionsOrElement;
17
17
  options = definitelyOptions;
18
18
  } else {
@@ -27,42 +27,37 @@ async function renderToResponse(optionsOrElement, definitelyOptions) {
27
27
  renderHTML
28
28
  } = options;
29
29
  const baseUrl = request.URL ?? new URL(request.url);
30
- const cacheKey = explicitCacheKey ?? (await assets?.cacheKey?.(request)) ?? {};
30
+ const cacheKey = explicitCacheKey ?? (await assets?.cacheKey?.(request) ?? {});
31
31
  const html = new HTMLManager();
32
- const http = new HttpManager({
33
- headers: request.headers
34
- });
35
- const assetsManager = new AssetsManager({
36
- cacheKey
37
- });
32
+ const http = new HttpManager({ headers: request.headers });
33
+ const assetsManager = new AssetsManager({ cacheKey });
38
34
  let responseStatus = 200;
39
35
  let appHeaders;
40
36
  let appStream;
41
37
  if (shouldStream === false && element != null) {
42
38
  const rendered = await extract(element, {
43
- decorate(element) {
44
- return /*#__PURE__*/jsx(ServerContext, {
45
- http: http,
46
- html: html,
47
- url: baseUrl,
48
- assets: assetsManager,
49
- children: element
50
- });
39
+ decorate(element2) {
40
+ return /* @__PURE__ */ jsx(
41
+ ServerContext,
42
+ {
43
+ http,
44
+ html,
45
+ url: baseUrl,
46
+ assets: assetsManager,
47
+ children: element2
48
+ }
49
+ );
51
50
  }
52
51
  });
53
- const {
54
- headers,
55
- statusCode = 200,
56
- redirectUrl
57
- } = http.state;
52
+ const { headers: headers2, statusCode = 200, redirectUrl } = http.state;
58
53
  if (redirectUrl) {
59
54
  return new RedirectResponse(redirectUrl, {
60
55
  status: statusCode,
61
- headers,
56
+ headers: headers2,
62
57
  request
63
58
  });
64
59
  }
65
- appHeaders = headers;
60
+ appHeaders = headers2;
66
61
  responseStatus = statusCode;
67
62
  const appTransformStream = new TransformStream();
68
63
  const appWriter = appTransformStream.writable.getWriter();
@@ -73,18 +68,21 @@ async function renderToResponse(optionsOrElement, definitelyOptions) {
73
68
  if (appStream == null) {
74
69
  const appTransformStream = new TransformStream();
75
70
  appStream = appTransformStream.readable;
76
- const renderAppStream = async function renderAppStream() {
71
+ const renderAppStream = async function renderAppStream2() {
77
72
  const appWriter = appTransformStream.writable.getWriter();
78
73
  if (element != null) {
79
74
  const rendered = await extract(element, {
80
- decorate(element) {
81
- return /*#__PURE__*/jsx(ServerContext, {
82
- http: http,
83
- html: html,
84
- url: baseUrl,
85
- assets: assetsManager,
86
- children: element
87
- });
75
+ decorate(element2) {
76
+ return /* @__PURE__ */ jsx(
77
+ ServerContext,
78
+ {
79
+ http,
80
+ html,
81
+ url: baseUrl,
82
+ assets: assetsManager,
83
+ children: element2
84
+ }
85
+ );
88
86
  }
89
87
  });
90
88
  appWriter.write(rendered);
@@ -93,172 +91,171 @@ async function renderToResponse(optionsOrElement, definitelyOptions) {
93
91
  };
94
92
  waitUntil(renderAppStream());
95
93
  }
96
- const {
97
- headers,
98
- body
99
- } = await renderToHTMLStream(appStream);
94
+ const { headers, body } = await renderToHTMLStream(appStream);
100
95
  return new HTMLResponse(body, {
101
96
  status: responseStatus,
102
97
  headers
103
98
  });
104
99
  async function renderToHTMLStream(content) {
105
- const headers = new Headers(appHeaders);
106
- const [synchronousAssets, preloadAssets] = await Promise.all([assets?.entry({
107
- cacheKey,
108
- modules: assetsManager.usedModules({
109
- timing: 'load'
100
+ const headers2 = new Headers(appHeaders);
101
+ const [synchronousAssets, preloadAssets] = await Promise.all([
102
+ assets?.entry({
103
+ cacheKey,
104
+ modules: assetsManager.usedModules({ timing: "load" })
105
+ }),
106
+ assets?.modules(assetsManager.usedModules({ timing: "preload" }), {
107
+ cacheKey
110
108
  })
111
- }), assets?.modules(assetsManager.usedModules({
112
- timing: 'preload'
113
- }), {
114
- cacheKey
115
- })]);
109
+ ]);
116
110
  if (synchronousAssets) {
117
111
  for (const style of synchronousAssets.styles) {
118
- headers.append('Link', preloadHeader(styleAssetPreloadAttributes(style)));
112
+ headers2.append(
113
+ "Link",
114
+ preloadHeader(styleAssetPreloadAttributes(style))
115
+ );
119
116
  }
120
117
  for (const script of synchronousAssets.scripts) {
121
- headers.append('Link', preloadHeader(scriptAssetPreloadAttributes(script)));
118
+ headers2.append(
119
+ "Link",
120
+ preloadHeader(scriptAssetPreloadAttributes(script))
121
+ );
122
122
  }
123
123
  }
124
124
  if (renderHTML) {
125
- const body = await renderHTML(content, {
125
+ const body3 = await renderHTML(content, {
126
126
  manager: html,
127
127
  assets: synchronousAssets,
128
128
  preloadAssets
129
129
  });
130
- return {
131
- headers,
132
- body
133
- };
130
+ return { headers: headers2, body: body3 };
134
131
  }
135
132
  const responseStream = new TextEncoderStream();
136
- const body = responseStream.readable;
137
- const renderFullHTML = async function renderFullHTML() {
133
+ const body2 = responseStream.readable;
134
+ const renderFullHTML = async function renderFullHTML2() {
138
135
  const writer = responseStream.writable.getWriter();
139
136
  writer.write(`<!DOCTYPE html>`);
140
-
141
- /* eslint-disable jsx-a11y/html-has-lang */
142
-
143
- const {
144
- htmlAttributes,
145
- bodyAttributes,
146
- ...headProps
147
- } = html.state;
148
- const htmlContent = renderToStaticMarkup( /*#__PURE__*/jsxs("html", {
149
- ...htmlAttributes,
150
- children: [/*#__PURE__*/jsxs("head", {
151
- children: [/*#__PURE__*/jsx(Head, {
152
- ...headProps
153
- }), synchronousAssets?.scripts.map(script => /*#__PURE__*/jsx(Script, {
154
- asset: script,
155
- baseUrl: baseUrl
156
- }, script.source)), synchronousAssets?.styles.map(style => /*#__PURE__*/jsx(Style, {
157
- asset: style,
158
- baseUrl: baseUrl
159
- }, style.source)), preloadAssets?.styles.map(style => /*#__PURE__*/jsx(StylePreload, {
160
- asset: style,
161
- baseUrl: baseUrl
162
- }, style.source)), preloadAssets?.scripts.map(script => /*#__PURE__*/jsx(ScriptPreload, {
163
- asset: script,
164
- baseUrl: baseUrl
165
- }, script.source))]
166
- }), /*#__PURE__*/jsx("body", {
167
- ...bodyAttributes,
168
- dangerouslySetInnerHTML: {
169
- __html: '%%CONTENT%%'
170
- }
171
- })]
172
- }));
173
-
174
- /* eslint-enable jsx-a11y/html-has-lang */
175
-
176
- const [firstChunk, secondChunk] = htmlContent.split('%%CONTENT%%');
137
+ const { htmlAttributes, bodyAttributes, ...headProps } = html.state;
138
+ const htmlContent = renderToStaticMarkup(
139
+ /* @__PURE__ */ jsxs("html", { ...htmlAttributes, children: [
140
+ /* @__PURE__ */ jsxs("head", { children: [
141
+ /* @__PURE__ */ jsx(Head, { ...headProps }),
142
+ synchronousAssets?.scripts.map((script) => /* @__PURE__ */ jsx(Script, { asset: script, baseUrl }, script.source)),
143
+ synchronousAssets?.styles.map((style) => /* @__PURE__ */ jsx(Style, { asset: style, baseUrl }, style.source)),
144
+ preloadAssets?.styles.map((style) => /* @__PURE__ */ jsx(
145
+ StylePreload,
146
+ {
147
+ asset: style,
148
+ baseUrl
149
+ },
150
+ style.source
151
+ )),
152
+ preloadAssets?.scripts.map((script) => /* @__PURE__ */ jsx(
153
+ ScriptPreload,
154
+ {
155
+ asset: script,
156
+ baseUrl
157
+ },
158
+ script.source
159
+ ))
160
+ ] }),
161
+ /* @__PURE__ */ jsx(
162
+ "body",
163
+ {
164
+ ...bodyAttributes,
165
+ dangerouslySetInnerHTML: { __html: "%%CONTENT%%" }
166
+ }
167
+ )
168
+ ] })
169
+ );
170
+ const [firstChunk, secondChunk] = htmlContent.split("%%CONTENT%%");
177
171
  writer.write(firstChunk);
178
- if (element != null) writer.write(`<div id="app">`);
172
+ if (element != null)
173
+ writer.write(`<div id="app">`);
179
174
  const reader = content.getReader();
180
-
181
- // eslint-disable-next-line no-constant-condition
182
175
  while (true) {
183
- const {
184
- done,
185
- value
186
- } = await reader.read();
176
+ const { done, value } = await reader.read();
187
177
  if (done) {
188
178
  break;
189
179
  }
190
180
  writer.write(value);
191
181
  }
192
- if (element != null) writer.write(`</div>`);
193
- const [newSynchronousAssets, newPreloadAssets] = await Promise.all([assets?.entry({
194
- cacheKey,
195
- modules: assetsManager.usedModules({
196
- timing: 'load'
182
+ if (element != null)
183
+ writer.write(`</div>`);
184
+ const [newSynchronousAssets, newPreloadAssets] = await Promise.all([
185
+ assets?.entry({
186
+ cacheKey,
187
+ modules: assetsManager.usedModules({ timing: "load" })
188
+ }),
189
+ assets?.modules(assetsManager.usedModules({ timing: "preload" }), {
190
+ cacheKey
197
191
  })
198
- }), assets?.modules(assetsManager.usedModules({
199
- timing: 'preload'
200
- }), {
201
- cacheKey
202
- })]);
192
+ ]);
203
193
  if (newSynchronousAssets) {
204
- const diffedSynchronousAssets = diffBrowserAssetsEntries(newSynchronousAssets, synchronousAssets);
205
- const diffedPreloadAssets = diffBrowserAssetsEntries(newPreloadAssets, preloadAssets);
206
- const additionalAssetsContent = renderToStaticMarkup( /*#__PURE__*/jsxs(Fragment, {
207
- children: [diffedSynchronousAssets.scripts.map(script => /*#__PURE__*/jsx(Script, {
208
- asset: script,
209
- baseUrl: baseUrl
210
- }, script.source)), diffedSynchronousAssets.styles.map(style => /*#__PURE__*/jsx(Style, {
211
- asset: style,
212
- baseUrl: baseUrl
213
- }, style.source)), diffedPreloadAssets.styles.map(style => /*#__PURE__*/jsx(StylePreload, {
214
- asset: style,
215
- baseUrl: baseUrl
216
- }, style.source)), diffedPreloadAssets.scripts.map(script => /*#__PURE__*/jsx(ScriptPreload, {
217
- asset: script,
218
- baseUrl: baseUrl
219
- }, script.source))]
220
- }));
194
+ const diffedSynchronousAssets = diffBrowserAssetsEntries(
195
+ newSynchronousAssets,
196
+ synchronousAssets
197
+ );
198
+ const diffedPreloadAssets = diffBrowserAssetsEntries(
199
+ newPreloadAssets,
200
+ preloadAssets
201
+ );
202
+ const additionalAssetsContent = renderToStaticMarkup(
203
+ /* @__PURE__ */ jsxs(Fragment, { children: [
204
+ diffedSynchronousAssets.scripts.map((script) => /* @__PURE__ */ jsx(Script, { asset: script, baseUrl }, script.source)),
205
+ diffedSynchronousAssets.styles.map((style) => /* @__PURE__ */ jsx(Style, { asset: style, baseUrl }, style.source)),
206
+ diffedPreloadAssets.styles.map((style) => /* @__PURE__ */ jsx(
207
+ StylePreload,
208
+ {
209
+ asset: style,
210
+ baseUrl
211
+ },
212
+ style.source
213
+ )),
214
+ diffedPreloadAssets.scripts.map((script) => /* @__PURE__ */ jsx(
215
+ ScriptPreload,
216
+ {
217
+ asset: script,
218
+ baseUrl
219
+ },
220
+ script.source
221
+ ))
222
+ ] })
223
+ );
221
224
  writer.write(additionalAssetsContent);
222
225
  }
223
226
  writer.write(secondChunk);
224
227
  writer.close();
225
228
  };
226
229
  waitUntil(renderFullHTML());
227
- return {
228
- headers,
229
- body
230
- };
230
+ return { headers: headers2, body: body2 };
231
231
  }
232
232
  }
233
233
  function preloadHeader(attributes) {
234
234
  const {
235
235
  as,
236
- rel = 'preload',
236
+ rel = "preload",
237
237
  href,
238
238
  crossOrigin,
239
239
  crossorigin
240
240
  } = attributes;
241
-
242
- // Support both property and attribute versions of the casing
243
241
  const finalCrossOrigin = crossOrigin ?? crossorigin;
244
242
  let header = `<${href}>; rel="${rel}"; as="${as}"`;
245
- if (finalCrossOrigin === '' || finalCrossOrigin === true) {
243
+ if (finalCrossOrigin === "" || finalCrossOrigin === true) {
246
244
  header += `; crossorigin`;
247
- } else if (typeof finalCrossOrigin === 'string') {
245
+ } else if (typeof finalCrossOrigin === "string") {
248
246
  header += `; crossorigin="${finalCrossOrigin}"`;
249
247
  }
250
248
  return header;
251
249
  }
252
250
  function diffBrowserAssetsEntries(newList, oldList) {
253
- const oldStyles = new Set(oldList.styles.map(style => style.source));
254
- const oldScripts = new Set(oldList.scripts.map(script => script.source));
251
+ const oldStyles = new Set(oldList.styles.map((style) => style.source));
252
+ const oldScripts = new Set(oldList.scripts.map((script) => script.source));
255
253
  return {
256
- styles: newList.styles.filter(style => !oldStyles.has(style.source)),
257
- scripts: newList.scripts.filter(script => !oldScripts.has(script.source))
254
+ styles: newList.styles.filter((style) => !oldStyles.has(style.source)),
255
+ scripts: newList.scripts.filter((script) => !oldScripts.has(script.source))
258
256
  };
259
257
  }
260
258
  function noop(..._args) {
261
- // noop
262
259
  }
263
260
 
264
261
  export { renderToResponse };
@@ -1,10 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
 
3
3
  function maybeWrapContext(Context, value, children) {
4
- return value ? /*#__PURE__*/jsx(Context.Provider, {
5
- value: value,
6
- children: children
7
- }) : children;
4
+ return value ? /* @__PURE__ */ jsx(Context.Provider, { value, children }) : children;
8
5
  }
9
6
 
10
7
  export { maybeWrapContext };