@schmock/vue 2.1.3 → 2.1.4
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/index.js +1 -22
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { inject } from "vue";
|
|
3
|
-
// ===== Injection Key =====
|
|
4
|
-
const SCHMOCK_KEY = Symbol("schmock");
|
|
5
|
-
export const schmockPlugin = {
|
|
6
|
-
install(app, options) {
|
|
7
|
-
const { mock, interceptOptions } = options;
|
|
8
|
-
const handle = mock.intercept(interceptOptions);
|
|
9
|
-
app.provide(SCHMOCK_KEY, mock);
|
|
10
|
-
app.onUnmount(() => {
|
|
11
|
-
handle.restore();
|
|
12
|
-
});
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
// ===== Composable =====
|
|
16
|
-
export function useSchmock() {
|
|
17
|
-
const mock = inject(SCHMOCK_KEY);
|
|
18
|
-
if (!mock) {
|
|
19
|
-
throw new Error("useSchmock must be used in a component with schmockPlugin installed");
|
|
20
|
-
}
|
|
21
|
-
return mock;
|
|
22
|
-
}
|
|
1
|
+
import{inject as s}from"vue";var o=Symbol("schmock"),m={install(c,t){let{mock:n,interceptOptions:e}=t,i=n.intercept(e);c.provide(o,n),c.onUnmount(()=>{i.restore()})}};function p(){let c=s(o);if(!c)throw Error("useSchmock must be used in a component with schmockPlugin installed");return c}export{p as useSchmock,m as schmockPlugin};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schmock/vue",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "Vue adapter for Schmock — Plugin and composables",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@schmock/core": "^2.1.
|
|
32
|
+
"@schmock/core": "^2.1.4",
|
|
33
33
|
"vue": "^3.5.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|