@schmock/vue 2.4.1 → 2.6.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @schmock/vue
2
2
 
3
- Vue 3 adapter for Schmock — a plugin and a composable that intercept `fetch`.
3
+ Vue 3.5+ adapter for Schmock — a plugin and a composable that intercept `fetch`. It needs `app.onUnmount`, which Vue added in 3.5.
4
4
 
5
5
  Part of [Schmock](https://github.com/khalic-lab/schmock) — mock APIs from OpenAPI specs or hand-crafted routes.
6
6
 
package/dist/index.d.ts CHANGED
@@ -3,6 +3,11 @@ import { type App, type Plugin } from "vue";
3
3
  export interface SchmockPluginOptions {
4
4
  mock: Schmock.CallableMockInstance;
5
5
  interceptOptions?: Schmock.InterceptOptions;
6
+ /**
7
+ * Alias of `interceptOptions`, under the name React's `SchmockProvider`
8
+ * takes them. When both are given, `interceptOptions` is used.
9
+ */
10
+ options?: Schmock.InterceptOptions;
6
11
  }
7
12
  /**
8
13
  * Release the interception lease an app acquired when `schmockPlugin` was
@@ -12,4 +17,3 @@ export interface SchmockPluginOptions {
12
17
  export declare function restoreSchmockInterception(app: App): void;
13
18
  export declare const schmockPlugin: Plugin<SchmockPluginOptions>;
14
19
  export declare function useSchmock(): Schmock.CallableMockInstance;
15
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{inject as Q}from"vue";var D=Symbol("schmock"),y=new WeakMap;function B(q){let x=y.get(q);if(!x)return;y.delete(q),x.restore()}var T={install(q,x){let{mock:z,interceptOptions:F}=x;if(q.provide(D,z),typeof document>"u")return;let G=z.intercept(F);y.set(q,G);let J=q.mount.bind(q);q.mount=(...N)=>{try{return J(...N)}catch(P){throw B(q),P}},q.onUnmount(()=>{B(q)})}};function V(){let q=Q(D);if(!q)throw Error("useSchmock must be used in a component with schmockPlugin installed");return q}export{V as useSchmock,T as schmockPlugin,B as restoreSchmockInterception};
1
+ import{inject as Q}from"vue";var D=Symbol("schmock"),y=new WeakMap;function B(q){let x=y.get(q);if(!x)return;y.delete(q),x.restore()}var T={install(q,x){let{mock:z,interceptOptions:F=x.options}=x;if(q.provide(D,z),typeof document>"u")return;let G=z.intercept(F);y.set(q,G);let J=q.mount.bind(q);q.mount=(...N)=>{try{return J(...N)}catch(P){throw B(q),P}},q.onUnmount(()=>{B(q)})}};function V(){let q=Q(D);if(!q)throw Error("useSchmock must be used in a component with schmockPlugin installed");return q}export{V as useSchmock,T as schmockPlugin,B as restoreSchmockInterception};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schmock/vue",
3
- "version": "2.4.1",
3
+ "version": "2.6.0",
4
4
  "description": "Vue adapter for Schmock — Plugin and composables",
5
5
  "type": "module",
6
6
  "repository": {
@@ -17,7 +17,8 @@
17
17
  "exports": {
18
18
  ".": {
19
19
  "types": "./dist/index.d.ts",
20
- "import": "./dist/index.js"
20
+ "import": "./dist/index.js",
21
+ "default": "./dist/index.js"
21
22
  },
22
23
  "./package.json": "./package.json"
23
24
  },
@@ -43,7 +44,7 @@
43
44
  "license": "MIT",
44
45
  "dependencies": {},
45
46
  "peerDependencies": {
46
- "@schmock/core": "^2.4.1",
47
+ "@schmock/core": "^2.6.0",
47
48
  "vue": "^3.5.0"
48
49
  },
49
50
  "devDependencies": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,KAAK,GAAG,EAA6B,KAAK,MAAM,EAAE,MAAM,KAAK,CAAC;AASvE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,OAAO,CAAC,oBAAoB,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC;CAC7C;AAOD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAMzD;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,oBAAoB,CA6BtD,CAAC;AAIF,wBAAgB,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAQzD"}