Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

msw-storybook-addon

Package Overview
Dependencies
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msw-storybook-addon - npm Package Compare versions

Comparing version 1.10.1--canary.134.6ef71b8.0 to 1.10.1--canary.134.9892d86.0

dist/index.browser.d.ts

69

dist/index.browser.js

@@ -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": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc