@canonical/storybook-addon-msw 0.40.0 → 0.43.0
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.
- package/dist/esm/lib/Panel.js +1 -1
- package/dist/esm/lib/Panel.js.map +1 -1
- package/dist/esm/lib/Tool.js +1 -1
- package/dist/esm/lib/Tool.js.map +1 -1
- package/dist/esm/preset.js.map +1 -1
- package/dist/esm/preview.js +2 -1
- package/dist/esm/preview.js.map +1 -1
- package/dist/esm/withMSW.js +51 -45
- package/dist/esm/withMSW.js.map +1 -1
- package/dist/types/lib/Panel.d.ts +2 -1
- package/dist/types/lib/Panel.d.ts.map +1 -1
- package/dist/types/lib/Tool.d.ts +2 -1
- package/dist/types/lib/Tool.d.ts.map +1 -1
- package/dist/types/preview.d.ts.map +1 -1
- package/dist/types/withMSW.d.ts +14 -1
- package/dist/types/withMSW.d.ts.map +1 -1
- package/package.json +15 -15
package/dist/esm/lib/Panel.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createElement, memo } from "react";
|
|
|
2
2
|
import { AddonPanel, SyntaxHighlighter } from "storybook/internal/components";
|
|
3
3
|
import { useParameter } from "storybook/manager-api";
|
|
4
4
|
import { PARAM_KEY } from "../constants.js";
|
|
5
|
-
export const Panel = memo(function MswPanel({ active }) {
|
|
5
|
+
export const Panel = memo(function MswPanel({ active, }) {
|
|
6
6
|
const parameter = useParameter(PARAM_KEY);
|
|
7
7
|
if (!active || !parameter?.handlers) {
|
|
8
8
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.js","sourceRoot":"","sources":["../../../src/lib/Panel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"Panel.js","sourceRoot":"","sources":["../../../src/lib/Panel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAA6B,MAAM,OAAO,CAAC;AACvE,OAAO,EA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AC,GAAG,CAAC,CAAC,CAAC,EAAE,aAAa,CAC/F,EACD,aAAa,CACX,iBAAiB,EACjB,EAAE,QAAQ,EAAE,MAAM,EAAE,EACpB,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CACrC,CACF,CAAC;IAEF,OAAO,aAAa,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;AACzD,CAAC,CAAC,CAAC"}
|
package/dist/esm/lib/Tool.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LightningIcon } from "@storybook/icons";
|
|
2
|
-
import { createElement, memo, useCallback } from "react";
|
|
2
|
+
import { createElement, memo, useCallback, } from "react";
|
|
3
3
|
import { ToggleButton } from "storybook/internal/components";
|
|
4
4
|
import { useGlobals } from "storybook/manager-api";
|
|
5
5
|
import { KEY, TOOL_ID } from "../constants.js";
|
package/dist/esm/lib/Tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.js","sourceRoot":"","sources":["../../../src/lib/Tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"Tool.js","sourceRoot":"","sources":["../../../src/lib/Tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,aAAa,EACb,IAAI,EAEJ,WAAW,GACZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAY,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,CAAC,MAAM,IAAI,GAAuC,IAAI,CAC1D,SAAS,eAAe,CAAC,MAAoB;IAC3C,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,YAAY,CAAC,GAAG,UAAU,EAAE,CAAC;IAE5D,MAAM,QAAQ,GAAG,GAAG,IAAI,YAAY,CAAC;IACrC,MAAM,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEhC,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,aAAa,CAAC;YACZ,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ;SACjB,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;IAE9B,6CAA6C;IAC7C,oBAAoB;IACpB,qCAAqC;IACrC,qCAAqC;IACrC,8BAA8B;IAC9B,8BAA8B;IAC9B,yBAAyB;IACzB,sBAAsB;IACtB,QAAQ;IACR,qBAAqB;IAErB,OAAO,aAAa,CAClB,YAAY,EACZ;QACE,GAAG,EAAE,OAAO;QACZ,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,QAAQ;QACjB,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc;QAC/C,OAAO,EAAE,MAAM;QACf,IAAI,EAAE,OAAO;KACd,EACD,aAAa,CAAC,aAAa,CAAC,CAC7B,CAAC;AACJ,CAAC,CACF,CAAC"}
|
package/dist/esm/preset.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset.js","sourceRoot":"","sources":["../../src/preset.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,qFAAqF;AAErF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"preset.js","sourceRoot":"","sources":["../../src/preset.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,qFAAqF;AAErF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,iFAAiF;AACjF,2FAA2F;AAC3F,4EAA4E;AAC5E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC"}
|
package/dist/esm/preview.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { KEY } from "./constants.js";
|
|
2
|
-
import { withMSW } from "./withMSW.js";
|
|
2
|
+
import { mswLoader, withMSW } from "./withMSW.js";
|
|
3
3
|
/**
|
|
4
4
|
* Note: if you want to use JSX in this file, rename it to `preview.tsx`
|
|
5
5
|
* and update the entry prop in tsup.config.ts to use "src/preview.tsx",
|
|
6
6
|
*/
|
|
7
7
|
const preview = {
|
|
8
|
+
loaders: [mswLoader],
|
|
8
9
|
decorators: [withMSW],
|
|
9
10
|
initialGlobals: {
|
|
10
11
|
[KEY]: true,
|
package/dist/esm/preview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/preview.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/preview.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAElD;;;GAGG;AAEH,MAAM,OAAO,GAAiC;IAC5C,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,UAAU,EAAE,CAAC,OAAO,CAAC;IACrB,cAAc,EAAE;QACd,CAAC,GAAG,CAAC,EAAE,IAAI;KACZ;CACF,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/dist/esm/withMSW.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { setupWorker } from "msw/browser";
|
|
2
|
-
import
|
|
3
|
-
import { useEffect, useGlobals, useParameter, useRef, useState, } from "storybook/internal/preview-api";
|
|
2
|
+
import { useEffect, useGlobals, useParameter, useRef, } from "storybook/internal/preview-api";
|
|
4
3
|
import { KEY, PARAM_KEY } from "./constants.js";
|
|
5
4
|
// Singleton worker instance
|
|
6
5
|
let worker = null;
|
|
@@ -27,54 +26,61 @@ const initializeWorker = async () => {
|
|
|
27
26
|
})();
|
|
28
27
|
return workerPromise;
|
|
29
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Whether MSW should serve this story. The toolbar stores the global as a
|
|
31
|
+
* boolean, and only an explicit `false` turns it off; a story opts out with
|
|
32
|
+
* `parameters.msw.disable`.
|
|
33
|
+
*/
|
|
34
|
+
const isActive = (globalValue, parameter) => globalValue !== false && !(parameter?.disable ?? false);
|
|
35
|
+
/**
|
|
36
|
+
* Install the story's handlers on a started worker, or clear them when MSW is
|
|
37
|
+
* off for the story. A worker that failed to start leaves the story to run
|
|
38
|
+
* against the network.
|
|
39
|
+
*/
|
|
40
|
+
const applyHandlers = async (active, handlers) => {
|
|
41
|
+
if (!active) {
|
|
42
|
+
worker?.resetHandlers();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const activeWorker = await initializeWorker();
|
|
46
|
+
if (!activeWorker)
|
|
47
|
+
return;
|
|
48
|
+
activeWorker.resetHandlers();
|
|
49
|
+
if (handlers && handlers.length > 0) {
|
|
50
|
+
activeWorker.use(...handlers);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Starts the worker and installs the story's handlers before the story
|
|
55
|
+
* renders. Storybook awaits loaders before it renders a story and before its
|
|
56
|
+
* play function runs, so the story's first render already has its mocks and a
|
|
57
|
+
* play function never waits on MSW.
|
|
58
|
+
*/
|
|
59
|
+
export const mswLoader = async ({ globals, parameters, }) => {
|
|
60
|
+
const parameter = parameters[PARAM_KEY];
|
|
61
|
+
await applyHandlers(isActive(globals[KEY], parameter), parameter?.handlers);
|
|
62
|
+
return {};
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Keeps the handlers in step with the toolbar toggle while a story is shown.
|
|
66
|
+
* It never holds the story back: the loader has already started the worker,
|
|
67
|
+
* and preview-hook effects only run once the story and its play function have
|
|
68
|
+
* finished, so gating the render here would deadlock a play function.
|
|
69
|
+
*/
|
|
30
70
|
export const withMSW = (StoryFn) => {
|
|
31
|
-
const [isWorkerReady, setIsWorkerReady] = useState(false);
|
|
32
71
|
const [globals] = useGlobals();
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
// The handlers array reference changes on each render even if contents are same
|
|
40
|
-
const handlersRef = useRef(handlers);
|
|
41
|
-
handlersRef.current = handlers;
|
|
72
|
+
const parameter = useParameter(PARAM_KEY);
|
|
73
|
+
const active = isActive(globals[KEY], parameter);
|
|
74
|
+
// The handlers array is a new reference on every render even when its
|
|
75
|
+
// contents are the same; read it through a ref so the effect does not re-run.
|
|
76
|
+
const handlersRef = useRef(parameter?.handlers);
|
|
77
|
+
handlersRef.current = parameter?.handlers;
|
|
42
78
|
useEffect(() => {
|
|
43
|
-
|
|
44
|
-
setIsWorkerReady(true);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
let cancelled = false;
|
|
48
|
-
const setupHandlers = async () => {
|
|
49
|
-
const activeWorker = await initializeWorker();
|
|
50
|
-
if (cancelled)
|
|
51
|
-
return;
|
|
52
|
-
// If worker failed to initialize, just mark as ready and continue without MSW
|
|
53
|
-
if (!activeWorker) {
|
|
54
|
-
setIsWorkerReady(true);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const currentHandlers = handlersRef.current;
|
|
58
|
-
if (currentHandlers && currentHandlers.length > 0) {
|
|
59
|
-
activeWorker.resetHandlers();
|
|
60
|
-
activeWorker.use(...currentHandlers);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
activeWorker.resetHandlers();
|
|
64
|
-
}
|
|
65
|
-
setIsWorkerReady(true);
|
|
66
|
-
};
|
|
67
|
-
setupHandlers();
|
|
79
|
+
void applyHandlers(active, handlersRef.current);
|
|
68
80
|
return () => {
|
|
69
|
-
|
|
70
|
-
if (worker) {
|
|
71
|
-
worker.resetHandlers();
|
|
72
|
-
}
|
|
81
|
+
worker?.resetHandlers();
|
|
73
82
|
};
|
|
74
|
-
}, [
|
|
75
|
-
if (!isWorkerReady) {
|
|
76
|
-
return React.createElement("div", {}, "Loading MSW...");
|
|
77
|
-
}
|
|
83
|
+
}, [active]);
|
|
78
84
|
return StoryFn();
|
|
79
85
|
};
|
|
80
86
|
//# sourceMappingURL=withMSW.js.map
|
package/dist/esm/withMSW.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withMSW.js","sourceRoot":"","sources":["../../src/withMSW.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,
|
|
1
|
+
{"version":3,"file":"withMSW.js","sourceRoot":"","sources":["../../src/withMSW.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,MAAM,GACP,MAAM,gCAAgC,CAAC;AAMxC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,4BAA4B;AAC5B,IAAI,MAAM,GAAuB,IAAI,CAAC;AACtC,IAAI,aAAa,GAAuC,IAAI,C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AChC,CAAC;AACH,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAA6B,KAAK,EAAE,EACxD,OAAO,EACP,UAAU,GACX,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAA6B,CAAC;IACpE,MAAM,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC5E,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAgC,EAAE,EAAE;IAC1D,MAAM,CAAC,OAAO,CAAC,GAAG,UAAU,EAAE,CAAC;IAC/B,MAAM,SAAS,GAAG,YAAY,CAAe,SAAS,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC;IAEjD,sEAAsE;IACtE,8EAA8E;IAC9E,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAChD,WAAW,CAAC,OAAO,GAAG,SAAS,EAAE,QAAQ,CAAC;IAE1C,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;QAChD,OAAO,GAAG,EAAE;YACV,MAAM,EAAE,aAAa,EAAE,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,OAAO,EAAE,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { type NamedExoticComponent } from "react";
|
|
1
2
|
import { type API } from "storybook/manager-api";
|
|
2
3
|
interface PanelProps {
|
|
3
4
|
api: API;
|
|
4
5
|
active?: boolean;
|
|
5
6
|
}
|
|
6
|
-
export declare const Panel:
|
|
7
|
+
export declare const Panel: NamedExoticComponent<PanelProps>;
|
|
7
8
|
export {};
|
|
8
9
|
//# sourceMappingURL=Panel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../../../src/lib/Panel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../../../src/lib/Panel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,KAAK,GAAG,EAAgB,MAAM,uBAAuB,CAAC;AAI/D,UAAU,UAAU;IAClB,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,KAAK,EAAE,oBAAoB,CAAC,UAAU,CA8CjD,CAAC"}
|
package/dist/types/lib/Tool.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type NamedExoticComponent } from "react";
|
|
1
2
|
import { type API } from "storybook/manager-api";
|
|
2
|
-
export declare const Tool:
|
|
3
|
+
export declare const Tool: NamedExoticComponent<{
|
|
3
4
|
api: API;
|
|
4
5
|
}>;
|
|
5
6
|
//# sourceMappingURL=Tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.d.ts","sourceRoot":"","sources":["../../../src/lib/Tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tool.d.ts","sourceRoot":"","sources":["../../../src/lib/Tool.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,oBAAoB,EAE1B,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,KAAK,GAAG,EAAc,MAAM,uBAAuB,CAAC;AAG7D,eAAO,MAAM,IAAI,EAAE,oBAAoB,CAAC;IAAE,GAAG,EAAE,GAAG,CAAA;CAAE,CAsCnD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/preview.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK7E;;;GAGG;AAEH,QAAA,MAAM,OAAO,EAAE,kBAAkB,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/preview.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK7E;;;GAGG;AAEH,QAAA,MAAM,OAAO,EAAE,kBAAkB,CAAC,QAAQ,CAMzC,CAAC;eAEa,OAAO"}
|
package/dist/types/withMSW.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
import type { Renderer, PartialStoryFn as StoryFunction } from "storybook/internal/types";
|
|
1
|
+
import type { LoaderFunction, Renderer, PartialStoryFn as StoryFunction } from "storybook/internal/types";
|
|
2
|
+
/**
|
|
3
|
+
* Starts the worker and installs the story's handlers before the story
|
|
4
|
+
* renders. Storybook awaits loaders before it renders a story and before its
|
|
5
|
+
* play function runs, so the story's first render already has its mocks and a
|
|
6
|
+
* play function never waits on MSW.
|
|
7
|
+
*/
|
|
8
|
+
export declare const mswLoader: LoaderFunction<Renderer>;
|
|
9
|
+
/**
|
|
10
|
+
* Keeps the handlers in step with the toolbar toggle while a story is shown.
|
|
11
|
+
* It never holds the story back: the loader has already started the worker,
|
|
12
|
+
* and preview-hook effects only run once the story and its play function have
|
|
13
|
+
* finished, so gating the render here would deadlock a play function.
|
|
14
|
+
*/
|
|
2
15
|
export declare const withMSW: (StoryFn: StoryFunction<Renderer>) => any;
|
|
3
16
|
//# sourceMappingURL=withMSW.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withMSW.d.ts","sourceRoot":"","sources":["../../src/withMSW.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withMSW.d.ts","sourceRoot":"","sources":["../../src/withMSW.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,cAAc,EACd,QAAQ,EACR,cAAc,IAAI,aAAa,EAChC,MAAM,0BAA0B,CAAC;AA+DlC;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAO9C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,OAAO,YAAa,aAAa,CAAC,QAAQ,CAAC,QAkBvD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/storybook-addon-msw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
],
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "https://github.com/canonical/pragma"
|
|
22
|
+
"url": "https://github.com/canonical/pragma-web"
|
|
23
23
|
},
|
|
24
24
|
"bugs": {
|
|
25
|
-
"url": "https://github.com/canonical/pragma/issues"
|
|
25
|
+
"url": "https://github.com/canonical/pragma-web/issues"
|
|
26
26
|
},
|
|
27
27
|
"license": "LGPL-3.0",
|
|
28
28
|
"exports": {
|
|
@@ -50,17 +50,17 @@
|
|
|
50
50
|
"test": "echo 'No unit tests yet'"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@canonical/styles-debug": "^0.
|
|
53
|
+
"@canonical/styles-debug": "^0.43.0",
|
|
54
54
|
"@storybook/icons": "^2.0.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@biomejs/biome": "2.5.
|
|
58
|
-
"@canonical/biome-config": "
|
|
59
|
-
"@canonical/storybook-config": "^0.
|
|
60
|
-
"@canonical/typescript-config-react": "^0.
|
|
61
|
-
"@canonical/webarchitect": "
|
|
62
|
-
"@storybook/addon-docs": "^10.
|
|
63
|
-
"@storybook/react-vite": "^10.
|
|
57
|
+
"@biomejs/biome": "2.5.14",
|
|
58
|
+
"@canonical/biome-config": "0.43.0",
|
|
59
|
+
"@canonical/storybook-config": "^0.43.0",
|
|
60
|
+
"@canonical/typescript-config-react": "^0.43.0",
|
|
61
|
+
"@canonical/webarchitect": "0.43.0",
|
|
62
|
+
"@storybook/addon-docs": "^10.6.0",
|
|
63
|
+
"@storybook/react-vite": "^10.6.0",
|
|
64
64
|
"@types/node": "^26.0.0",
|
|
65
65
|
"@types/react": "^19.2.14",
|
|
66
66
|
"@types/react-dom": "^19.2.3",
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
"msw": "^2.12.10",
|
|
69
69
|
"react": "^19.2.4",
|
|
70
70
|
"react-dom": "^19.2.4",
|
|
71
|
-
"storybook": "^10.
|
|
72
|
-
"typescript": "^
|
|
71
|
+
"storybook": "^10.6.0",
|
|
72
|
+
"typescript": "^7.0.2",
|
|
73
73
|
"vite": "^8.0.1"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"react": "^18.0.0 || ^19.0.0",
|
|
77
77
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
78
|
-
"storybook": "^10.
|
|
78
|
+
"storybook": "^10.6.0"
|
|
79
79
|
},
|
|
80
80
|
"storybook": {
|
|
81
81
|
"displayName": "DS Baseline Grid",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"public"
|
|
98
98
|
]
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "581682464ef71de3f77dc2dc8bbe2b7e493bb05e"
|
|
101
101
|
}
|