msw 2.4.1 → 2.4.2

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.
@@ -8,7 +8,7 @@
8
8
  * - Please do NOT serve this file on production.
9
9
  */
10
10
 
11
- const PACKAGE_VERSION = '2.4.1'
11
+ const PACKAGE_VERSION = '2.4.2'
12
12
  const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
13
13
  const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
14
14
  const activeClientIds = new Set()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "msw",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "Seamless REST/GraphQL API mocking library for browser and Node.js.",
5
5
  "main": "./lib/core/index.js",
6
6
  "module": "./lib/core/index.mjs",
@@ -181,7 +181,7 @@
181
181
  },
182
182
  "peerDependencies": {
183
183
  "graphql": ">= 16.8.x",
184
- "typescript": ">= 4.7.x"
184
+ "typescript": ">= 4.8.x"
185
185
  },
186
186
  "peerDependenciesMeta": {
187
187
  "graphql": {
@@ -40,12 +40,14 @@ export function parseDocumentNode(node: DocumentNode): ParsedGraphQLQuery {
40
40
  }
41
41
 
42
42
  async function parseQuery(query: string): Promise<ParsedGraphQLQuery | Error> {
43
- const { parse } = await import('graphql').catch((error) => {
44
- devUtils.error(
45
- 'Failed to parse a GraphQL query: cannot import the "graphql" module. Please make sure you install it if you wish to intercept GraphQL requests. See the original import error below.',
46
- )
47
- throw error
48
- })
43
+ /**
44
+ * @note Use `require` to get the "graphql" module here.
45
+ * It has to be scoped to this function because this module leaks to the
46
+ * root export. It has to be `require` because tools like Jest have trouble
47
+ * handling dynamic imports. It gets replaced with a dynamic import on build time.
48
+ */
49
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
50
+ const { parse } = require('graphql')
49
51
 
50
52
  try {
51
53
  const ast = parse(query)