@quilted/quilt 0.5.158 → 0.6.1

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 (180) hide show
  1. package/CHANGELOG.md +40 -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/assets/files.d.ts +97 -0
  20. package/build/typescript/assets/files.d.ts.map +1 -0
  21. package/build/typescript/assets/styles.d.ts +11 -0
  22. package/build/typescript/assets/styles.d.ts.map +1 -0
  23. package/build/typescript/assets.d.ts +2 -0
  24. package/build/typescript/assets.d.ts.map +1 -1
  25. package/build/typescript/globals.d.ts +3 -0
  26. package/build/typescript/globals.d.ts.map +1 -1
  27. package/build/typescript/graphql/testing/matchers/utilities.d.ts +1 -1
  28. package/build/typescript/graphql/testing/matchers/utilities.d.ts.map +1 -1
  29. package/build/typescript/graphql/testing/matchers.d.ts +10 -8
  30. package/build/typescript/graphql/testing/matchers.d.ts.map +1 -1
  31. package/build/typescript/graphql/testing.d.ts +7 -1
  32. package/build/typescript/graphql/testing.d.ts.map +1 -1
  33. package/build/typescript/modules.d.ts +23 -0
  34. package/build/typescript/modules.d.ts.map +1 -0
  35. package/build/typescript/react/testing.d.ts +7 -2
  36. package/build/typescript/react/testing.d.ts.map +1 -1
  37. package/configuration/rollup.config.js +3 -0
  38. package/package.json +66 -197
  39. package/source/assets/files.ts +129 -0
  40. package/source/assets/styles.ts +9 -0
  41. package/source/assets.ts +3 -0
  42. package/source/globals.ts +4 -0
  43. package/source/graphql/testing/matchers/operations.ts +1 -1
  44. package/source/graphql/testing/matchers/utilities.ts +1 -1
  45. package/source/graphql/testing/matchers.ts +15 -22
  46. package/source/graphql/testing.ts +11 -1
  47. package/source/modules.ts +31 -0
  48. package/source/react/testing.ts +10 -3
  49. package/tsconfig.json +2 -4
  50. package/build/cjs/assets.cjs +0 -39
  51. package/build/cjs/async.cjs +0 -32
  52. package/build/cjs/env.cjs +0 -7
  53. package/build/cjs/events.cjs +0 -46
  54. package/build/cjs/globals.cjs +0 -21
  55. package/build/cjs/graphql/server.cjs +0 -14
  56. package/build/cjs/graphql/testing/matchers/operations.cjs +0 -42
  57. package/build/cjs/graphql/testing/matchers/utilities.cjs +0 -43
  58. package/build/cjs/graphql/testing/matchers.cjs +0 -10
  59. package/build/cjs/graphql/testing.cjs +0 -18
  60. package/build/cjs/graphql.cjs +0 -21
  61. package/build/cjs/html/HTML.cjs +0 -21
  62. package/build/cjs/html.cjs +0 -133
  63. package/build/cjs/http.cjs +0 -146
  64. package/build/cjs/index.cjs +0 -2
  65. package/build/cjs/localize.cjs +0 -46
  66. package/build/cjs/magic/app.cjs +0 -2
  67. package/build/cjs/magic/assets.cjs +0 -2
  68. package/build/cjs/magic/request-router.cjs +0 -2
  69. package/build/cjs/navigate/testing.cjs +0 -12
  70. package/build/cjs/navigate.cjs +0 -70
  71. package/build/cjs/performance.cjs +0 -26
  72. package/build/cjs/polyfills/abort-controller.cjs +0 -4
  73. package/build/cjs/polyfills/base.cjs +0 -4
  74. package/build/cjs/polyfills/crypto.cjs +0 -4
  75. package/build/cjs/polyfills/fetch-get-set-cookie.cjs +0 -4
  76. package/build/cjs/polyfills/fetch.cjs +0 -4
  77. package/build/cjs/polyfills/noop.cjs +0 -4
  78. package/build/cjs/react/testing.cjs +0 -30
  79. package/build/cjs/react/tools.cjs +0 -19
  80. package/build/cjs/react.cjs +0 -15
  81. package/build/cjs/request-router/index.cjs +0 -12
  82. package/build/cjs/request-router/node.cjs +0 -12
  83. package/build/cjs/server/ServerContext.cjs +0 -20
  84. package/build/cjs/server/preload.cjs +0 -37
  85. package/build/cjs/server/request-router.cjs +0 -266
  86. package/build/cjs/server.cjs +0 -114
  87. package/build/cjs/signals.cjs +0 -51
  88. package/build/cjs/static/StaticContext.cjs +0 -20
  89. package/build/cjs/static/index.cjs +0 -261
  90. package/build/cjs/static/render.cjs +0 -44
  91. package/build/cjs/testing.cjs +0 -12
  92. package/build/cjs/threads.cjs +0 -117
  93. package/build/cjs/utilities/react.cjs +0 -12
  94. package/build/esm/magic/request-router.mjs +0 -1
  95. package/build/esm/polyfills/abort-controller.mjs +0 -1
  96. package/build/esm/polyfills/base.mjs +0 -1
  97. package/build/esm/polyfills/crypto.mjs +0 -1
  98. package/build/esm/polyfills/fetch-get-set-cookie.mjs +0 -1
  99. package/build/esm/polyfills/fetch.mjs +0 -1
  100. package/build/esm/polyfills/noop.mjs +0 -1
  101. package/build/esm/static/StaticContext.mjs +0 -18
  102. package/build/esm/static/index.mjs +0 -259
  103. package/build/esm/static/render.mjs +0 -42
  104. package/build/esm/testing.mjs +0 -1
  105. package/build/esnext/magic/app.esnext +0 -1
  106. package/build/esnext/magic/assets.esnext +0 -1
  107. package/build/esnext/magic/request-router.esnext +0 -1
  108. package/build/esnext/polyfills/abort-controller.esnext +0 -1
  109. package/build/esnext/polyfills/base.esnext +0 -1
  110. package/build/esnext/polyfills/crypto.esnext +0 -1
  111. package/build/esnext/polyfills/fetch-get-set-cookie.esnext +0 -1
  112. package/build/esnext/polyfills/fetch.esnext +0 -1
  113. package/build/esnext/polyfills/noop.esnext +0 -1
  114. package/build/esnext/static/StaticContext.esnext +0 -18
  115. package/build/esnext/static/index.esnext +0 -259
  116. package/build/esnext/static/render.esnext +0 -42
  117. package/build/esnext/testing.esnext +0 -1
  118. package/build/typescript/App.d.ts +0 -48
  119. package/build/typescript/App.d.ts.map +0 -1
  120. package/build/typescript/TestApp.d.ts +0 -17
  121. package/build/typescript/TestApp.d.ts.map +0 -1
  122. package/build/typescript/global.d.ts +0 -8
  123. package/build/typescript/global.d.ts.map +0 -1
  124. package/build/typescript/magic/app.d.ts +0 -4
  125. package/build/typescript/magic/app.d.ts.map +0 -1
  126. package/build/typescript/magic/assets.d.ts +0 -5
  127. package/build/typescript/magic/assets.d.ts.map +0 -1
  128. package/build/typescript/magic/request-router.d.ts +0 -4
  129. package/build/typescript/magic/request-router.d.ts.map +0 -1
  130. package/build/typescript/matchers/graphql/operations.d.ts +0 -7
  131. package/build/typescript/matchers/graphql/operations.d.ts.map +0 -1
  132. package/build/typescript/matchers/graphql/utilities.d.ts +0 -8
  133. package/build/typescript/matchers/graphql/utilities.d.ts.map +0 -1
  134. package/build/typescript/matchers/graphql.d.ts +0 -9
  135. package/build/typescript/matchers/graphql.d.ts.map +0 -1
  136. package/build/typescript/matchers.d.ts +0 -3
  137. package/build/typescript/matchers.d.ts.map +0 -1
  138. package/build/typescript/polyfills/abort-controller.d.ts +0 -2
  139. package/build/typescript/polyfills/abort-controller.d.ts.map +0 -1
  140. package/build/typescript/polyfills/base.d.ts +0 -2
  141. package/build/typescript/polyfills/base.d.ts.map +0 -1
  142. package/build/typescript/polyfills/crypto.d.ts +0 -2
  143. package/build/typescript/polyfills/crypto.d.ts.map +0 -1
  144. package/build/typescript/polyfills/fetch-get-set-cookie.d.ts +0 -2
  145. package/build/typescript/polyfills/fetch-get-set-cookie.d.ts.map +0 -1
  146. package/build/typescript/polyfills/fetch.d.ts +0 -2
  147. package/build/typescript/polyfills/fetch.d.ts.map +0 -1
  148. package/build/typescript/polyfills/noop.d.ts +0 -2
  149. package/build/typescript/polyfills/noop.d.ts.map +0 -1
  150. package/build/typescript/react/index.d.ts +0 -3
  151. package/build/typescript/react/index.d.ts.map +0 -1
  152. package/build/typescript/react-dom/index.d.ts +0 -3
  153. package/build/typescript/react-dom/index.d.ts.map +0 -1
  154. package/build/typescript/server/index.d.ts +0 -16
  155. package/build/typescript/server/index.d.ts.map +0 -1
  156. package/build/typescript/static/StaticContext.d.ts +0 -13
  157. package/build/typescript/static/StaticContext.d.ts.map +0 -1
  158. package/build/typescript/static/index.d.ts +0 -20
  159. package/build/typescript/static/index.d.ts.map +0 -1
  160. package/build/typescript/static/render.d.ts +0 -19
  161. package/build/typescript/static/render.d.ts.map +0 -1
  162. package/build/typescript/testing.d.ts +0 -2
  163. package/build/typescript/testing.d.ts.map +0 -1
  164. package/quilt.project.ts +0 -5
  165. package/source/magic/app.ts +0 -5
  166. package/source/magic/assets.ts +0 -8
  167. package/source/magic/request-router.ts +0 -5
  168. package/source/polyfills/README.md +0 -3
  169. package/source/polyfills/abort-controller.ts +0 -1
  170. package/source/polyfills/base.ts +0 -1
  171. package/source/polyfills/crypto.ts +0 -1
  172. package/source/polyfills/fetch-get-set-cookie.ts +0 -1
  173. package/source/polyfills/fetch.ts +0 -1
  174. package/source/polyfills/noop.ts +0 -1
  175. package/source/static/StaticContext.tsx +0 -39
  176. package/source/static/index.tsx +0 -315
  177. package/source/static/render.tsx +0 -40
  178. package/source/testing.ts +0 -1
  179. /package/build/esm/{magic/app.mjs → modules.mjs} +0 -0
  180. /package/build/{esm/magic/assets.mjs → esnext/modules.esnext} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # @quilted/quilt
2
2
 
3
+ ## 0.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e407aec5`](https://github.com/lemonmade/quilt/commit/e407aec56e697eadfc7b1e62168ad40a49738d96) Thanks [@lemonmade](https://github.com/lemonmade)! - Dissolve TypeScript package between craft and quilt
8
+
9
+ ## 0.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#645](https://github.com/lemonmade/quilt/pull/645) [`302ed847`](https://github.com/lemonmade/quilt/commit/302ed8479f9c035ef39d48137de958dba50690ca) Thanks [@lemonmade](https://github.com/lemonmade)! - Removed CommonJS support
14
+
15
+ The `require` export condition is no longer provided by any package. Quilt only supports ESModules, so if you need to use the CommonJS version, you will need to pre-process Quilt’s output code on your own.
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [[`302ed847`](https://github.com/lemonmade/quilt/commit/302ed8479f9c035ef39d48137de958dba50690ca), [`302ed847`](https://github.com/lemonmade/quilt/commit/302ed8479f9c035ef39d48137de958dba50690ca), [`5d346a24`](https://github.com/lemonmade/quilt/commit/5d346a240ca95592c8623560ab1721935d6df1fa)]:
20
+ - @quilted/async@0.4.0
21
+ - @quilted/events@2.0.0
22
+ - @quilted/graphql@3.0.0
23
+ - @quilted/threads@2.0.0
24
+ - @quilted/useful-react-types@2.0.0
25
+ - @quilted/assets@0.1.0
26
+ - @quilted/react-assets@0.1.0
27
+ - @quilted/react-async@0.4.0
28
+ - @quilted/react-graphql@0.5.0
29
+ - @quilted/react-html@0.4.0
30
+ - @quilted/react-http@0.4.0
31
+ - @quilted/react-idle@0.4.0
32
+ - @quilted/react-localize@1.0.0
33
+ - @quilted/react-performance@0.2.0
34
+ - @quilted/react-router@0.4.0
35
+ - @quilted/react-server-render@0.4.0
36
+ - @quilted/react-signals@0.2.0
37
+ - @quilted/react-testing@0.6.0
38
+ - @quilted/react-utilities@0.2.0
39
+ - @quilted/react-workers@0.3.0
40
+ - @quilted/request-router@0.2.0
41
+ - @quilted/signals@0.2.0
42
+
3
43
  ## 0.5.158
4
44
 
5
45
  ### Patch Changes
@@ -10,7 +10,7 @@ function toHavePerformedGraphQLOperation(graphql, operation, variables) {
10
10
  const foundByOperation = graphql.completed.all({
11
11
  operation
12
12
  });
13
- const foundByVariables = variables == null ? foundByOperation : foundByOperation.filter(operation => Object.keys(variables).every(key => this.equals(variables[key], (operation.variables ?? {})[key])));
13
+ const foundByVariables = variables == null ? foundByOperation : foundByOperation.filter(operation => Object.keys(variables).every(key => Object.is(variables[key], (operation.variables ?? {})[key])));
14
14
  const pass = foundByVariables.length > 0;
15
15
  const {
16
16
  name
@@ -3,7 +3,7 @@ import { GraphQLController } from '@quilted/graphql/testing';
3
3
 
4
4
  function assertIsGraphQLController(graphql, {
5
5
  expectation,
6
- isNot
6
+ isNot = false
7
7
  }) {
8
8
  if (!(graphql instanceof GraphQLController)) {
9
9
  throw new Error(matcherErrorMessage(matcherHint(`.${expectation}`, undefined, undefined, {
@@ -1,8 +1,9 @@
1
- import { expect } from '@quilted/testing';
2
1
  import { toHavePerformedGraphQLOperation } from './matchers/operations.mjs';
3
2
 
4
- expect.extend({
3
+ const matchers = {
5
4
  toHavePerformedGraphQLOperation,
6
5
  toHavePerformedGraphQLQuery: toHavePerformedGraphQLOperation,
7
6
  toHavePerformedGraphQLMutation: toHavePerformedGraphQLOperation
8
- });
7
+ };
8
+
9
+ export { matchers };
@@ -1,3 +1,7 @@
1
- import './testing/matchers.mjs';
1
+ import { expect } from 'vitest';
2
+ import { matchers } from './testing/matchers.mjs';
2
3
  export * from '@quilted/graphql/testing';
3
4
  export { GraphQLTesting } from '@quilted/react-graphql/testing';
5
+
6
+ // @ts-expect-error Incompatibilities between `expect()` and vitest
7
+ expect.extend(matchers);
@@ -1,3 +1,6 @@
1
- import '@quilted/react-testing/matchers';
2
- export * from '@quilted/testing';
1
+ import { expect } from 'vitest';
2
+ import { matchers } from '@quilted/react-testing/matchers';
3
3
  export { createRender, destroyAll, render, rendered } from '@quilted/react-testing';
4
+
5
+ // @ts-expect-error Incompatibilities between `expect()` and vitest
6
+ expect.extend(matchers);
@@ -1,6 +1,6 @@
1
1
  import { createAsyncModulesGlobal } from '@quilted/async';
2
2
 
3
- const property = Symbol.for('quilt');
3
+ const property = Symbol.for("quilt");
4
4
  const quilt = globalThis[property] ?? {};
5
5
  quilt.AsyncModules = createAsyncModulesGlobal({
6
6
  cache: quilt.AsyncModules
@@ -4,37 +4,67 @@ import { assertIsGraphQLController, diffVariables } from './utilities.esnext';
4
4
 
5
5
  function toHavePerformedGraphQLOperation(graphql, operation, variables) {
6
6
  assertIsGraphQLController(graphql, {
7
- expectation: 'toHavePerformedGraphQLOperation',
7
+ expectation: "toHavePerformedGraphQLOperation",
8
8
  isNot: this.isNot
9
9
  });
10
10
  const foundByOperation = graphql.completed.all({
11
11
  operation
12
12
  });
13
- const foundByVariables = variables == null ? foundByOperation : foundByOperation.filter(operation => Object.keys(variables).every(key => this.equals(variables[key], (operation.variables ?? {})[key])));
13
+ const foundByVariables = variables == null ? foundByOperation : foundByOperation.filter(
14
+ (operation2) => Object.keys(variables).every(
15
+ (key) => Object.is(
16
+ variables[key],
17
+ (operation2.variables ?? {})[key]
18
+ )
19
+ )
20
+ );
14
21
  const pass = foundByVariables.length > 0;
15
- const {
22
+ const { name } = normalizeOperation(operation);
23
+ const message = pass ? () => `${matcherHint(".not.toHavePerformedGraphQLOperation")}
24
+
25
+ Expected not to have performed GraphQL operation:
26
+ ${EXPECTED_COLOR(
27
+ name
28
+ )}
29
+ ${variables ? `With variables matching:
30
+ ${printExpected(variables)}
31
+ ` : ""}But ${foundByVariables.length} matching ${foundByVariables.length === 1 ? "operation was" : "operations were"} found.
32
+ ` : () => `${`${matcherHint(".toHavePerformedGraphQLOperation")}
33
+
34
+ Expected to have performed GraphQL operation:
35
+ ${EXPECTED_COLOR(
16
36
  name
17
- } = normalizeOperation(operation);
18
- const message = pass ? () => `${matcherHint('.not.toHavePerformedGraphQLOperation')}\n\n` + `Expected not to have performed GraphQL operation:\n ${EXPECTED_COLOR(name)}\n${variables ? `With variables matching:\n ${printExpected(variables)}\n` : ''}` + `But ${foundByVariables.length} matching ${foundByVariables.length === 1 ? 'operation was' : 'operations were'} found.\n` : () => `${`${matcherHint('.toHavePerformedGraphQLOperation')}\n\n` + `Expected to have performed GraphQL operation:\n ${EXPECTED_COLOR(name)}\n${variables ? `With variables matching:\n ${printExpected(variables)}\n` : ''}`}${foundByOperation.length === 0 ? `But no matching operations were found.\n` : `But the ${foundByVariables.length === 1 ? 'found operation has' : 'found operations have'} the following variable differences:\n\n${diffs(foundByVariables, variables, this.expand)}`}`;
19
- return {
20
- pass,
21
- message
22
- };
37
+ )}
38
+ ${variables ? `With variables matching:
39
+ ${printExpected(variables)}
40
+ ` : ""}`}${foundByOperation.length === 0 ? `But no matching operations were found.
41
+ ` : `But the ${foundByVariables.length === 1 ? "found operation has" : "found operations have"} the following variable differences:
42
+
43
+ ${diffs(
44
+ foundByVariables,
45
+ variables,
46
+ this.expand
47
+ )}`}`;
48
+ return { pass, message };
23
49
  }
24
50
  function diffs(requests, variables, expand) {
25
- return requests.reduce((diffs, request, index) => `${diffs}${index === 0 ? '' : '\n\n'}${normalizedDiff(request, variables, {
26
- expand,
27
- showLegend: index === 0
28
- })}`, '');
51
+ return requests.reduce(
52
+ (diffs2, request, index) => `${diffs2}${index === 0 ? "" : "\n\n"}${normalizedDiff(
53
+ request,
54
+ variables,
55
+ {
56
+ expand,
57
+ showLegend: index === 0
58
+ }
59
+ )}`,
60
+ ""
61
+ );
29
62
  }
30
- function normalizedDiff(request, variables, {
31
- expand = false,
32
- showLegend = false
33
- }) {
63
+ function normalizedDiff(request, variables, { expand = false, showLegend = false }) {
34
64
  const result = diffVariables(request.variables ?? {}, variables, {
35
65
  expand
36
- }) || '';
37
- return showLegend ? result : result.split('\n\n')[1];
66
+ }) || "";
67
+ return showLegend ? result : result.split("\n\n")[1];
38
68
  }
39
69
 
40
70
  export { toHavePerformedGraphQLOperation };
@@ -1,35 +1,38 @@
1
1
  import { matcherErrorMessage, matcherHint, RECEIVED_COLOR, printWithType, printReceived, diff } from 'jest-matcher-utils';
2
2
  import { GraphQLController } from '@quilted/graphql/testing';
3
3
 
4
- function assertIsGraphQLController(graphql, {
5
- expectation,
6
- isNot
7
- }) {
4
+ function assertIsGraphQLController(graphql, { expectation, isNot = false }) {
8
5
  if (!(graphql instanceof GraphQLController)) {
9
- throw new Error(matcherErrorMessage(matcherHint(`.${expectation}`, undefined, undefined, {
10
- isNot
11
- }), `${RECEIVED_COLOR('received')} value must be a @quilted/graphql/fixtures GraphQLController object`, printWithType('Received', graphql, printReceived)));
6
+ throw new Error(
7
+ matcherErrorMessage(
8
+ matcherHint(`.${expectation}`, void 0, void 0, { isNot }),
9
+ `${RECEIVED_COLOR(
10
+ "received"
11
+ )} value must be a @quilted/graphql/fixtures GraphQLController object`,
12
+ printWithType("Received", graphql, printReceived)
13
+ )
14
+ );
12
15
  }
13
16
  }
14
- function diffVariables(actual, expected, {
15
- expand = false
16
- }) {
17
+ function diffVariables(actual, expected, { expand = false }) {
17
18
  return diff(expected, getObjectSubset(actual, expected), {
18
19
  expand
19
20
  });
20
21
  }
21
-
22
- // Original from https://github.com/facebook/jest/blob/master/packages/expect/source/utils.ts#L107
23
22
  function getObjectSubset(object, subset) {
24
23
  if (Array.isArray(object)) {
25
24
  if (Array.isArray(subset) && subset.length === object.length) {
26
- return subset.map((sub, i) => getObjectSubset(object[i], sub));
25
+ return subset.map(
26
+ (sub, i) => getObjectSubset(object[i], sub)
27
+ );
27
28
  }
28
29
  } else if (object instanceof Date) {
29
30
  return object;
30
- } else if (typeof object === 'object' && object !== null && typeof subset === 'object' && subset !== null) {
31
+ } else if (typeof object === "object" && object !== null && typeof subset === "object" && subset !== null) {
31
32
  const trimmed = {};
32
- Object.keys(subset).filter(key => Reflect.has(object, key)).forEach(key => trimmed[key] = getObjectSubset(object[key], subset[key]));
33
+ Object.keys(subset).filter((key) => Reflect.has(object, key)).forEach(
34
+ (key) => trimmed[key] = getObjectSubset(object[key], subset[key])
35
+ );
33
36
  if (Object.keys(trimmed).length > 0) {
34
37
  return trimmed;
35
38
  }
@@ -1,8 +1,9 @@
1
- import { expect } from '@quilted/testing';
2
1
  import { toHavePerformedGraphQLOperation } from './matchers/operations.esnext';
3
2
 
4
- expect.extend({
3
+ const matchers = {
5
4
  toHavePerformedGraphQLOperation,
6
5
  toHavePerformedGraphQLQuery: toHavePerformedGraphQLOperation,
7
6
  toHavePerformedGraphQLMutation: toHavePerformedGraphQLOperation
8
- });
7
+ };
8
+
9
+ export { matchers };
@@ -1,3 +1,6 @@
1
- import './testing/matchers.esnext';
1
+ import { expect } from 'vitest';
2
+ import { matchers } from './testing/matchers.esnext';
2
3
  export * from '@quilted/graphql/testing';
3
4
  export { GraphQLTesting } from '@quilted/react-graphql/testing';
5
+
6
+ expect.extend(matchers);
@@ -1,15 +1,12 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
1
2
  import { HttpContext, CookieContext } from '@quilted/react-http';
2
3
  import { useHTMLUpdater } from '@quilted/react-html';
3
- import { jsx, jsxs } from 'react/jsx-runtime';
4
4
 
5
- function HTML({
6
- children
7
- }) {
8
- return /*#__PURE__*/jsx(HttpContext, {
9
- children: /*#__PURE__*/jsxs(CookieContext, {
10
- children: [/*#__PURE__*/jsx(HTMLUpdater, {}), children]
11
- })
12
- });
5
+ function HTML({ children }) {
6
+ return /* @__PURE__ */ jsx(HttpContext, { children: /* @__PURE__ */ jsxs(CookieContext, { children: [
7
+ /* @__PURE__ */ jsx(HTMLUpdater, {}),
8
+ children
9
+ ] }) });
13
10
  }
14
11
  function HTMLUpdater() {
15
12
  useHTMLUpdater();
@@ -1,3 +1,5 @@
1
- import '@quilted/react-testing/matchers';
2
- export * from '@quilted/testing';
1
+ import { expect } from 'vitest';
2
+ import { matchers } from '@quilted/react-testing/matchers';
3
3
  export { createRender, destroyAll, render, rendered } from '@quilted/react-testing';
4
+
5
+ expect.extend(matchers);
@@ -11,8 +11,20 @@ function ServerContext({
11
11
  assets,
12
12
  children
13
13
  }) {
14
- const normalizedUrl = typeof url === 'string' ? new URL(url) : url;
15
- return maybeWrapContext(AssetsContext, assets, maybeWrapContext(HttpServerContext, http, maybeWrapContext(HTMLContext, html, maybeWrapContext(InitialUrlContext, normalizedUrl, children))));
14
+ const normalizedUrl = typeof url === "string" ? new URL(url) : url;
15
+ return maybeWrapContext(
16
+ AssetsContext,
17
+ assets,
18
+ maybeWrapContext(
19
+ HttpServerContext,
20
+ http,
21
+ maybeWrapContext(
22
+ HTMLContext,
23
+ html,
24
+ maybeWrapContext(InitialUrlContext, normalizedUrl, children)
25
+ )
26
+ )
27
+ );
16
28
  }
17
29
 
18
30
  export { ServerContext };
@@ -15,20 +15,19 @@ async function assetsForRequest(request, {
15
15
  cacheKey: getCacheKey
16
16
  }) {
17
17
  const url = new URL(request.url);
18
- const modules = url.searchParams.get('modules')?.split(',') ?? [];
19
- const includeStyles = url.searchParams.get('styles') !== 'false';
20
- const includeScripts = url.searchParams.get('scripts') !== 'false';
21
- const cacheKey = (await getCacheKey?.(request, context)) ?? (await assets.cacheKey?.(request));
22
- const {
23
- styles,
24
- scripts
25
- } = await assets.entry({
18
+ const modules = url.searchParams.get("modules")?.split(",") ?? [];
19
+ const includeStyles = url.searchParams.get("styles") !== "false";
20
+ const includeScripts = url.searchParams.get("scripts") !== "false";
21
+ const cacheKey = await getCacheKey?.(request, context) ?? await assets.cacheKey?.(request);
22
+ const { styles, scripts } = await assets.entry({
26
23
  modules,
27
24
  cacheKey
28
25
  });
29
26
  const result = {};
30
- if (includeStyles) result.styles = styles;
31
- if (includeScripts) result.scripts = scripts;
27
+ if (includeStyles)
28
+ result.styles = styles;
29
+ if (includeScripts)
30
+ result.scripts = scripts;
32
31
  return result;
33
32
  }
34
33