Use case
Framework
Owner
- Msw/2/Upgrade Recipe- NOTE: This codemod is deprecated. Use the new MSW codemod instead: https://go.codemod.com/msw-2-recipe- Codemod verified- Regularly tested and maintained by our engineers and codemod expert community by@alexbit-codemod
- Msw/2/Type Args- There is a change to generic type interface of - rest.method()calls. This codemod puts the generic arguments in the correct order to keep type safety.- Codemod verified- Regularly tested and maintained by our engineers and codemod expert community by- @codemod 
- Msw/2/Response Usages- To send a response from MSW handler, one would previously use something like - res(ctx.text("Hello world")). In msw v2, this is achieved by returning a native WebAPI Response object. msw v2 conveniently exposes a- HttpResponsefunction that has useful methods for creating just that object with a desired body. This codemod replaces the old- rescalls with the new- HttpResponsefunction calls and a bunch of ctx utilities that usually go with it. See examples below.- Codemod verified- Regularly tested and maintained by our engineers and codemod expert community by- @codemod 
- Msw/2/Request Changes- Following the original msw upgrade guide, the signature of the request handler have changed. Some of the parameters have changed their type, some widely used objects are available directly on the callback argument object for convenience. Following changes are applied by this codemod: - Codemod verified- Regularly tested and maintained by our engineers and codemod expert community by- @codemod 
- Msw/2/Req Passthrough- A new way of calling a passthrough is available in msw v2. This codemod replaces - req.passthrough()calls with the new way of doing that using exported function.- Codemod verified- Regularly tested and maintained by our engineers and codemod expert community by- @codemod 
- Msw/2/Print Handler- A new way of listing all handlers is preferred in msw v2. This codemod replaces - printHandlers()calls with the new way of doing that.- Codemod verified- Regularly tested and maintained by our engineers and codemod expert community by- @codemod 
- Msw/2/Lifecycle Events Signature- In msw v2, lifecycle events callback methods have changed their signature. This codemod replaces usages if its arguments with the new ones. - Codemod verified- Regularly tested and maintained by our engineers and codemod expert community by- @codemod 
- Msw/2/Imports- Following the original msw upgrade guide, there are certain imports that changed their location and/or naming. This codemod will adjust your imports to the new location and naming. - Codemod verified- Regularly tested and maintained by our engineers and codemod expert community by- @codemod 
- Msw/2/Ctx Fetch- ctx.fetch(req)is now meant to be called as- fetch(bypass(req))where- bypassis a new function available in the- mswlibrary. Changes applied by this codemod:- Codemod verified- Regularly tested and maintained by our engineers and codemod expert community by- @codemod 
- Msw/2/Callback Signature- Following the original msw upgrade guide, the signature of the request handler have changed. This codemod hard replaces the callback signature to the new one and cleans up unused variables. - Codemod verified- Regularly tested and maintained by our engineers and codemod expert community by- @codemod