-
-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: adopt the global Fetch API #1436
Merged
+8,971
−7,709
Merged
Changes from 1 commit
Commits
Show all changes
211 commits
Select commit
Hold shift + click to select a range
ded1309
feat: wip new api
kettanaito 6a21d47
feat: add "HttpResponse"
kettanaito 90dd65e
feat: support "HttpResponse.arrayBuffer()"
kettanaito 49369e6
fix(HttpResponse): forward cookies in the browser only
kettanaito 3b947c7
docs: update readme
kettanaito b909e48
fix(pruneGetRequestBody): support HEAD requests
kettanaito f9840b7
chore: polyfill Request in jest tests
kettanaito b87724d
feat: support "bypass" utility
kettanaito 3315cd4
chore: update "headers-polyfill" to 3.1.2
kettanaito aef1db1
test(headers-multiple): separate headers by comma
kettanaito b44a993
feat: support new api for graphql
kettanaito 71753c3
chore: migrate "msw-api" tests
kettanaito a5a91dc
feat: add "delay()"
kettanaito 0ee92d8
feat: migrate to new interceptors
kettanaito 7fcadf2
fix(RequestHandler): clone response in generator
kettanaito d64713a
chore: migrate to fetch api in node
kettanaito fd89534
feat: export universal fetch classes
kettanaito 5166b5e
fix(bypass): use compatible Request type
kettanaito 11fa7c6
feat: support one-time request handlers
kettanaito adab915
feat: add "passthrough", fix tests
kettanaito dde933b
feat: support multi-value response cookies
kettanaito 13bb61f
chore: add "File" polyfill for node
kettanaito ca158f3
feat: add "HttpResponse.formData()"
kettanaito e494683
test: fix request FormData body test
kettanaito 41ffaa0
chore: remove unused code
kettanaito 547eecb
docs: add the migration guide
kettanaito e8fca8b
feat: support response body type generic
kettanaito 6771bb3
fix(HttpResponse): accept "string" as input to ".json()"
kettanaito a4adce0
feat: support strict request body type
kettanaito 490d2b8
test: add path params types tests
kettanaito 62a7289
feat(graphql): support strict response body type
kettanaito 7a56a7d
feat: support mock ReadableStream responses
kettanaito f3ee2f4
feat: handle request body as ArrayBuffer
kettanaito 896ae0e
test: fix graphql typings tests
kettanaito f78175f
test: remove "set" typings tests
kettanaito b84fd6b
chore: remove unused "compose"
kettanaito 533f44c
chore(NetworkError): add jsdoc
kettanaito b562f1f
fix(GraphQLHandler): annotate "errors" as partial
kettanaito 6fd2eb8
chore(HttpResponse): remove unnecessary "defineReadOnly"
kettanaito 6f07723
chore: move "HttpResponse" to the root
kettanaito d61a5db
test: add unit tests for HttpResponse
kettanaito 801b5ae
chore: move fetch polyfills to root
kettanaito 24a59e5
fix: correct types
kettanaito de0bd2f
fix(RequestHandler): set ResponseBodyType as undefined by default
kettanaito a27f6b7
test(cookies-inheritance): use a response body union type
kettanaito e005153
fix(bypass): support request generic to satisfy various polyfills
kettanaito 03e6658
Merge branch 'main' into feat/standard-api
kettanaito f3894cf
chore: update to @mswjs/[email protected]
kettanaito 0157d82
chore: use @swc/jest vs ts-jest
kettanaito 9b50319
fix(bypass): return [url, init] tuple for polyfill compatibility
kettanaito 895e8e6
Merge branch 'main' into feat/standard-api
kettanaito 10e3691
chore: fix failing bypass test
kettanaito 8874812
chore: fix worker context event listener compatibility
kettanaito 6861097
fix: typescript <= 4.4 compatibility
kettanaito b14380b
docs: improve migration guide
kettanaito b320fe5
test: fix response-patching test
kettanaito 2684382
fix(bypass): forward request body
kettanaito 085d52b
test: fix failing tests
kettanaito 4edf17f
Merge branch 'main' into feat/standard-api
kettanaito 77ca45a
Merge branch 'main' into feat/standard-api
kettanaito d84b2d0
chore: v0.0.0-fetch.rc-1
kettanaito b48b42e
Merge branch 'main' into feat/standard-api
kettanaito 09218f3
docs(migrating): remove duplicate handler in set-cookies
kettanaito 84978a0
docs: use HeadersInit for multi-value cookies
kettanaito 3875d9b
chore(HttpResponse): remove commented code
kettanaito 80ed635
docs: fix typo in migration guide (#1469)
Xayer cb2766d
Merge branch 'main' into feat/standard-api
kettanaito 041ff3e
chore: v0.0.0-fetch.rc-2
kettanaito 2f8bf27
fix(HttpResponse): accept interfaces as json response-data type (#1481)
christoph-fricke 4bea835
docs(migrating): fix example for response composition (#1483)
christoph-fricke 3a001af
docs(migrating): fix description for "ctx.errors" migration (#1487)
christoph-fricke 7788593
Merge branch 'main' into feat/standard-api
kettanaito ffc51db
Merge branch 'main' into feat/standard-api
kettanaito 9ba34e1
chore(release): v0.0.0-fetch.rc-3
kettanaito 9607880
Merge branch 'main' into feat/standard-api
kettanaito 6b87f2b
fix(decorateResponseInit): use global "Headers" if available
kettanaito d1e82e7
Merge branch 'main' into feat/standard-api
kettanaito cff6452
fix: update to @mswjs/[email protected]
kettanaito 021a080
Merge branch 'main' into feat/standard-api
kettanaito 1bfd751
fix(worker): remove bypassing of server-sent events (#1551)
piotr-cz 9a2446b
feat: drop support for node < 18
kettanaito b614531
Merge branch 'main' into feat/standard-api
kettanaito 0fd5019
chore: fix unit tests
kettanaito d0a27ef
test(xhr): rewrite to fetch api
kettanaito 7062869
chore: fix node tests
kettanaito 603b24a
chore: use node 18 on ci
kettanaito e39b8fe
chore: move interceptors back to regular dependencies
kettanaito 7acbf21
test: fix rest-api body mocks test
kettanaito fc38370
chore: fix browser tests
kettanaito 69d2c65
chore(xhr): fix onload being called twice in tests
kettanaito 5e92590
chore(release): v0.0.0-fetch.rc-4
kettanaito 2273782
chore(release): v0.0.0-fetch.rc-5
kettanaito 22cb9a1
feat: distribute library as cjs and esm
kettanaito c0c7f2a
fix: set "main" to node, use explicit "browser" field
kettanaito e4dce71
chore(release): 0.0.0-fetch.rc-6
kettanaito 694bec9
test(on): clone response before reading it
kettanaito 0f08330
chore: use node v18.14.2 internally
kettanaito a9cd280
test: unskip form-data node test
kettanaito e2c6d5a
Merge branch 'main' into feat/standard-api
kettanaito a369914
fix: update "strict-event-emitter" to 0.5.0
kettanaito 37617c8
chore(release): v0.0.0-fetch.rc-7
kettanaito c347a9e
Merge branch 'main' into feat/standard-api
kettanaito 2d57879
Merge branch 'main' into feat/standard-api
kettanaito bedcb2c
chore(release): v0.0.0-fetch.rc-8
kettanaito c4367a5
fix: migrate to "@open-draft/until@2"
kettanaito c5d6600
chore: update to "@mswjs/[email protected]"
kettanaito 472a358
chore: update to "[email protected]"
kettanaito 14cf7d7
Merge branch 'main' into feat/standard-api
kettanaito 7c6c9d9
feat: split the library into "core", "browser" and "node" (#1584)
kettanaito 651e1a8
feat: export browser integration from "msw/browser" (#1591)
kettanaito 206682f
docs: mention "msw/browser" change in migration guidelines
kettanaito f5637d1
chore(release): v0.0.0-fetch.rc-9
kettanaito 34ae9da
fix: include "browser" in "files"
kettanaito e7153d9
chore(release): 0.0.0-fetch.rc-10
kettanaito 76bac29
docs: add missing quote to migration guidelines (#1592)
6af4b3c
fix: ditch "debug" in favor of "@open-draft/logger"
kettanaito f4b4b4f
fix: use "statuses" plain object, list as dependency
kettanaito f656f0c
fix: bump to interceptors 0.22.12
kettanaito b8376e4
chore: explain "customConditions" in jest (jsdom)
kettanaito a4dadc9
chore: force exit node tests
kettanaito b816698
chore(release): v0.0.0-fetch.rc-11
kettanaito 2331179
chore: add automated modules tests
kettanaito e48f435
chore: add runtime esm node test
kettanaito 99402f6
fix: drop "chalk"
kettanaito 1f81582
fix: use default import for cjs "statuses"
kettanaito 0074b52
test: add runtime esm node.js tests
kettanaito a3b5c09
test: fix printHandlers location tests
kettanaito 4c21110
chore: add browser module tests
kettanaito 0fd26dc
chore: use "@web/dev-server" for browser esm tests
kettanaito 4f3e05b
chore: update in-house dependencies for esm compat
kettanaito 8ae5a4f
chore: use correct cjs deps imports
kettanaito f1749a6
chore: fix typescript package import in ts tests
kettanaito c7139df
fix(cookie): use manually bundled esm version
kettanaito 9b27a12
chore: temporarily fix "process.env" for "graphql"
kettanaito 7ff17ae
feat(HttpResponse): make initializable class
kettanaito 0f35fd2
fix: esm fixes
thepassle 100a43f
fix: annotate "@bundled-es-modules/statuses"
kettanaito 94ec2ca
Merge branch 'main' into feat/standard-api
kettanaito 36a0dcc
fix: cjs build of js-levenshtein
kettanaito 229c967
chore(release): v0.0.0-fetch.rc-12
kettanaito cb565c9
fix: add "chalk@4" back to dependencies
kettanaito e20814e
chore(release): v0.0.0-fetch.rc-13
kettanaito b631430
Merge branch 'main' into feat/standard-api
kettanaito 50c4c9c
fix: stream response chunks as they come in Node.js (#1606)
kettanaito 8a527e9
fix: prevent "abort" listener memory leak in RequestHandler (#1608)
kettanaito b159c28
chore(release): v0.0.0-fetch.rc-14
kettanaito ed9275a
test: add response FormData browser test
kettanaito f663eeb
test: add Blob response browser test
kettanaito 9c73b7d
test: add Blob json to request browser tests
kettanaito ccc576d
Merge branch 'main' into feat/standard-api
kettanaito 589eac6
Merge branch 'main' into feat/standard-api
kettanaito b25655c
fix: normalize response status and status text when logging
kettanaito 17f72e8
Merge branch 'main' into feat/standard-api
kettanaito a7caf12
test: add "Response.error" integration test
kettanaito 82e3812
feat: do not set "x-powered-by" mocked response header
kettanaito 8ca0287
chore: upgrade to @mswjs/[email protected]
kettanaito 1f06019
fix: rely on "isMockedResponse" to emit response events in node
kettanaito 90f3989
feat: handle Response.error special use-case
kettanaito cff199d
test(response-patching): rely on custom "x-source" response header
kettanaito 510f8b8
fix: upgrade to [email protected], remove "process" workaround
kettanaito 59c3e52
chore(release): v0.0.0-fetch.rc-15
kettanaito 789327a
Merge branch 'main' into feat/standard-api
kettanaito 47fd803
feat: make life-cycle event listeners have object argument
kettanaito 61f6f3b
feat: remove the ".printHandlers()" method
kettanaito c371f03
feat: deprecate "rest" in favor of "http" (#1673)
kettanaito 8943e1d
docs(passthrough): improve jsdoc description
kettanaito 15db686
fix: remove unused utils modules
kettanaito 90b854a
chore(release): v0.0.0-fetch.rc-16
kettanaito 6adc652
Merge branch 'main' into feat/standard-api
kettanaito 6239a0f
Merge branch 'main' into feat/standard-api
kettanaito bb02e57
test(graphql): add test on anonymous operation warning (#1693)
kettanaito 5f3dd2a
Merge branch 'main' into feat/standard-api
kettanaito 3b8f57e
fix(graphql): clone request before parsing (#1714)
kettanaito 3fb29e5
chore(release): v0.0.0-fetch.rc-17
kettanaito 223c17a
Merge branch 'main' into feat/standard-api
kettanaito a2b61ba
docs: add multipart-data common issue to migrating
kettanaito 5034e48
Merge branch 'main' into feat/standard-api
kettanaito 4ba43a5
chore: upgrade "headers-polyfill" to 3.2.3
kettanaito 0898517
chore(release): v0.0.0-fetch.rc-18
kettanaito b2b634c
fix: remove "NetworkError" in favor of "HttpResponse.error" (#1730)
kettanaito faa71c4
chore(release): v0.0.0-fetch.rc-19
kettanaito 3eca8c7
fix(graphql): support request handler options (#1739)
kettanaito 91989df
feat(worker): move exception handling from the worker (#1734)
kettanaito 84c7354
Merge branch 'main' into feat/standard-api
kettanaito 0763557
chore: upgrade to "headers-polyfill" v4 (#1741)
kettanaito 8f2b94d
feat: set minimal supported typescript version to 4.7 (#1742)
kettanaito cbb25fb
fix(bypass): make bypass synchronous (#1745)
kettanaito 581450f
chore(release): v0.0.0-fetch.rc-20
kettanaito 2405bbc
chore: update MIGRATING.md (#1737)
Kosai106 8855956
Merge branch 'main' into feat/standard-api
kettanaito 0a8100c
Merge branch 'main' into feat/standard-api
kettanaito 96caf8a
docs: update jsdoc links
kettanaito 2bcc39c
docs: use "intercept" instead of "capture"
kettanaito e1e4bb3
docs: add v2 announcement to readme (#1759)
kettanaito eca6a9e
feat(RequestHandler): make class method arguments an object (#1761)
kettanaito 078e541
fix(worker): replace `Math.random()` with `crypto.randomUUID()` (#1762)
laryro 17d5f3a
fix(setupServer): set max listeners on the "request.signal" (#1765)
kettanaito 89be69f
chore(release): v0.0.0-fetch.rc-21
kettanaito b04c168
chore: re-add inquirer (#1766)
mattcosta7 595d6f3
chore(release): v0.0.0-fetch.rc-22
kettanaito b028c66
test(browser): add ReadableStream response body test (#1770)
kettanaito 6405bea
fix: transfer response buffer on safari (#1771)
kettanaito f207368
chore(release): v0.0.0-fetch.rc-23
kettanaito f5f31fa
fix: check "setMaxListeners" in react native (#1773)
kettanaito cb0a5cd
fix(setupServer): suppress "ERR_INVALID_ARG_TYPE" (AbortSignal) error…
christoph-fricke 1f55572
chore(release): v0.0.0-fetch.rc-24
kettanaito 7d6d82d
fix(core): export the "RequestHandlerOptions" type (#1774)
christoph-fricke 22666b9
chore: revert rc version
kettanaito 5c49daf
Merge branch 'main' into feat/standard-api
kettanaito 144b548
docs: update discord link
kettanaito cbba4b5
docs: update docs links
kettanaito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: esm fixes
commit 0f35fd253c52c92b842e80325eaa0541cf2d7c18
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
declare const SERVICE_WORKER_CHECKSUM: string | ||
|
||
declare module '@bundled-es-modules/cookie' { | ||
export * from 'cookie' | ||
export * as default from 'cookie' | ||
} | ||
|
||
declare module '@bundled-es-modules/statuses' { | ||
const source_default: any | ||
export { source_default as default } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we move
js-levenshtein
into `devDependencies - it should get bundled into the output of msw via tsup, and avoid the need to use an esm dependency for that I believe.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dislike a bit that we lose the semantics of what dev/regular dependencies in package.json actually mean. Can't we achieve the same via the esbuild config? I know there's a way to force-bundle any dependencies with webpack, I can imagine there being an alternative for esbuild as well.
My suggestion here is instead of handling this by moving regular dependencies to dev, we may consider specifying what to bundle and what not on the bundler level? What do you think about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely agree there, I don't recall any options to force that last time I looked at tsup, but definitely worth taking another look!