msw-storybook-addon
Advanced tools
Comparing version 1.10.1--canary.134.6ef71b8.0 to 1.10.1--canary.134.9892d86.0
@@ -20,5 +20,5 @@ "use strict"; | ||
// src/index.new.ts | ||
var index_new_exports = {}; | ||
__export(index_new_exports, { | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
initialize: () => initialize, | ||
@@ -28,3 +28,3 @@ mswDecorator: () => mswDecorator, | ||
}); | ||
module.exports = __toCommonJS(index_new_exports); | ||
module.exports = __toCommonJS(src_exports); | ||
@@ -41,23 +41,26 @@ // src/initialize.browser.ts | ||
// src/applyRequestHandlers.ts | ||
function applyRequestHandlers(handlersListOrObject) { | ||
if (handlersListOrObject == null) { | ||
return; | ||
} | ||
if (Array.isArray(handlersListOrObject) && handlersListOrObject.length > 0) { | ||
api.use(...handlersListOrObject); | ||
return; | ||
} | ||
if ("handlers" in handlersListOrObject && handlersListOrObject.handlers) { | ||
const handlers = Object.values(handlersListOrObject.handlers).filter(Boolean).reduce( | ||
(handlers2, handlersList) => handlers2.concat(handlersList), | ||
[] | ||
); | ||
if (handlers.length > 0) { | ||
api.use(...handlers); | ||
} | ||
return; | ||
} | ||
} | ||
// src/decorator.ts | ||
var mswDecorator = (storyFn, context) => { | ||
const { | ||
parameters: { msw } | ||
} = context; | ||
if (api) { | ||
api.resetHandlers(); | ||
if (msw) { | ||
if (Array.isArray(msw) && msw.length > 0) { | ||
api.use(...msw); | ||
} else if ("handlers" in msw && msw.handlers) { | ||
const handlers = Object.values(msw.handlers).filter(Boolean).reduce( | ||
(handlers2, handlersList) => handlers2.concat(handlersList), | ||
[] | ||
); | ||
if (handlers.length > 0) { | ||
api.use(...handlers); | ||
} | ||
} | ||
} | ||
} | ||
applyRequestHandlers(context.parameters.msw); | ||
return storyFn(); | ||
@@ -68,21 +71,3 @@ }; | ||
var mswLoader = async (context) => { | ||
const { | ||
parameters: { msw } | ||
} = context; | ||
if (api) { | ||
api.resetHandlers(); | ||
if (msw) { | ||
if (Array.isArray(msw) && msw.length > 0) { | ||
api.use(...msw); | ||
} else if ("handlers" in msw && msw.handlers) { | ||
const handlers = Object.values(msw.handlers).filter(Boolean).reduce( | ||
(handlers2, handlersList) => handlers2.concat(handlersList), | ||
[] | ||
); | ||
if (handlers.length > 0) { | ||
api.use(...handlers); | ||
} | ||
} | ||
} | ||
} | ||
applyRequestHandlers(context.parameters.msw); | ||
if (typeof window !== "undefined" && "navigator" in window && navigator.serviceWorker.controller) { | ||
@@ -89,0 +74,0 @@ await navigator.serviceWorker.ready; |
@@ -20,5 +20,5 @@ "use strict"; | ||
// src/index.new.ts | ||
var index_new_exports = {}; | ||
__export(index_new_exports, { | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
initialize: () => initialize, | ||
@@ -28,3 +28,3 @@ mswDecorator: () => mswDecorator, | ||
}); | ||
module.exports = __toCommonJS(index_new_exports); | ||
module.exports = __toCommonJS(src_exports); | ||
@@ -41,23 +41,26 @@ // src/initialize.node.ts | ||
// src/applyRequestHandlers.ts | ||
function applyRequestHandlers(handlersListOrObject) { | ||
if (handlersListOrObject == null) { | ||
return; | ||
} | ||
if (Array.isArray(handlersListOrObject) && handlersListOrObject.length > 0) { | ||
api.use(...handlersListOrObject); | ||
return; | ||
} | ||
if ("handlers" in handlersListOrObject && handlersListOrObject.handlers) { | ||
const handlers = Object.values(handlersListOrObject.handlers).filter(Boolean).reduce( | ||
(handlers2, handlersList) => handlers2.concat(handlersList), | ||
[] | ||
); | ||
if (handlers.length > 0) { | ||
api.use(...handlers); | ||
} | ||
return; | ||
} | ||
} | ||
// src/decorator.ts | ||
var mswDecorator = (storyFn, context) => { | ||
const { | ||
parameters: { msw } | ||
} = context; | ||
if (api) { | ||
api.resetHandlers(); | ||
if (msw) { | ||
if (Array.isArray(msw) && msw.length > 0) { | ||
api.use(...msw); | ||
} else if ("handlers" in msw && msw.handlers) { | ||
const handlers = Object.values(msw.handlers).filter(Boolean).reduce( | ||
(handlers2, handlersList) => handlers2.concat(handlersList), | ||
[] | ||
); | ||
if (handlers.length > 0) { | ||
api.use(...handlers); | ||
} | ||
} | ||
} | ||
} | ||
applyRequestHandlers(context.parameters.msw); | ||
return storyFn(); | ||
@@ -68,21 +71,3 @@ }; | ||
var mswLoader = async (context) => { | ||
const { | ||
parameters: { msw } | ||
} = context; | ||
if (api) { | ||
api.resetHandlers(); | ||
if (msw) { | ||
if (Array.isArray(msw) && msw.length > 0) { | ||
api.use(...msw); | ||
} else if ("handlers" in msw && msw.handlers) { | ||
const handlers = Object.values(msw.handlers).filter(Boolean).reduce( | ||
(handlers2, handlersList) => handlers2.concat(handlersList), | ||
[] | ||
); | ||
if (handlers.length > 0) { | ||
api.use(...handlers); | ||
} | ||
} | ||
} | ||
} | ||
applyRequestHandlers(context.parameters.msw); | ||
if (typeof window !== "undefined" && "navigator" in window && navigator.serviceWorker.controller) { | ||
@@ -89,0 +74,0 @@ await navigator.serviceWorker.ready; |
@@ -20,5 +20,5 @@ "use strict"; | ||
// src/index.new.ts | ||
var index_new_exports = {}; | ||
__export(index_new_exports, { | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
initialize: () => initialize, | ||
@@ -28,3 +28,3 @@ mswDecorator: () => mswDecorator, | ||
}); | ||
module.exports = __toCommonJS(index_new_exports); | ||
module.exports = __toCommonJS(src_exports); | ||
@@ -41,23 +41,26 @@ // src/initialize.react-native.ts | ||
// src/applyRequestHandlers.ts | ||
function applyRequestHandlers(handlersListOrObject) { | ||
if (handlersListOrObject == null) { | ||
return; | ||
} | ||
if (Array.isArray(handlersListOrObject) && handlersListOrObject.length > 0) { | ||
api.use(...handlersListOrObject); | ||
return; | ||
} | ||
if ("handlers" in handlersListOrObject && handlersListOrObject.handlers) { | ||
const handlers = Object.values(handlersListOrObject.handlers).filter(Boolean).reduce( | ||
(handlers2, handlersList) => handlers2.concat(handlersList), | ||
[] | ||
); | ||
if (handlers.length > 0) { | ||
api.use(...handlers); | ||
} | ||
return; | ||
} | ||
} | ||
// src/decorator.ts | ||
var mswDecorator = (storyFn, context) => { | ||
const { | ||
parameters: { msw } | ||
} = context; | ||
if (api) { | ||
api.resetHandlers(); | ||
if (msw) { | ||
if (Array.isArray(msw) && msw.length > 0) { | ||
api.use(...msw); | ||
} else if ("handlers" in msw && msw.handlers) { | ||
const handlers = Object.values(msw.handlers).filter(Boolean).reduce( | ||
(handlers2, handlersList) => handlers2.concat(handlersList), | ||
[] | ||
); | ||
if (handlers.length > 0) { | ||
api.use(...handlers); | ||
} | ||
} | ||
} | ||
} | ||
applyRequestHandlers(context.parameters.msw); | ||
return storyFn(); | ||
@@ -68,21 +71,3 @@ }; | ||
var mswLoader = async (context) => { | ||
const { | ||
parameters: { msw } | ||
} = context; | ||
if (api) { | ||
api.resetHandlers(); | ||
if (msw) { | ||
if (Array.isArray(msw) && msw.length > 0) { | ||
api.use(...msw); | ||
} else if ("handlers" in msw && msw.handlers) { | ||
const handlers = Object.values(msw.handlers).filter(Boolean).reduce( | ||
(handlers2, handlersList) => handlers2.concat(handlersList), | ||
[] | ||
); | ||
if (handlers.length > 0) { | ||
api.use(...handlers); | ||
} | ||
} | ||
} | ||
} | ||
applyRequestHandlers(context.parameters.msw); | ||
if (typeof window !== "undefined" && "navigator" in window && navigator.serviceWorker.controller) { | ||
@@ -89,0 +74,0 @@ await navigator.serviceWorker.ready; |
{ | ||
"name": "msw-storybook-addon", | ||
"description": "Mock API requests in Storybook with Mock Service Worker.", | ||
"version": "1.10.1--canary.134.6ef71b8.0", | ||
"version": "1.10.1--canary.134.9892d86.0", | ||
"main": "./dist/index.browser.js", | ||
"types": "./dist/index.browser.d.ts", | ||
"exports": { | ||
"browser": "./dist/index.browser.js", | ||
"react-native": "./dist/index.react-native.js", | ||
"node": "./dist/index.node.js" | ||
"browser": { | ||
"types": "./dist/index.browser.d.ts", | ||
"default": "./dist/index.browser.js" | ||
}, | ||
"react-native": { | ||
"types": "./dist/index.react-native.d.ts", | ||
"default": "./dist/index.react-native.js" | ||
}, | ||
"node": { | ||
"types": "./dist/index.node.d.ts", | ||
"default": "./dist/index.node.js" | ||
} | ||
}, | ||
@@ -11,0 +21,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
11250
7
0
267