@squide/msw 2.0.4 → 2.0.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @squide/msw
2
2
 
3
+ ## 2.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#115](https://github.com/gsoft-inc/wl-squide/pull/115) [`568255a`](https://github.com/gsoft-inc/wl-squide/commit/568255a50a519e7d19c8c2b03909559686cd24c4) Thanks [@patricklafrance](https://github.com/patricklafrance)! - - Request handlers registeration are now printed to the debug logs.
8
+
9
+ - Updated dependencies [[`568255a`](https://github.com/gsoft-inc/wl-squide/commit/568255a50a519e7d19c8c2b03909559686cd24c4)]:
10
+ - @squide/core@3.1.0
11
+
3
12
  ## 2.0.4
4
13
 
5
14
  ### Patch Changes
@@ -1,20 +1,29 @@
1
1
  import { RequestHandlerRegistry } from './chunk-2J7GQPWR.js';
2
- import { Plugin } from '@squide/core';
2
+ import { Plugin, isNil } from '@squide/core';
3
3
 
4
4
  var MswPlugin = class _MswPlugin extends Plugin {
5
+ #runtime;
5
6
  #requestHandlerRegistry = new RequestHandlerRegistry();
6
7
  constructor() {
7
8
  super(_MswPlugin.name);
8
9
  }
10
+ _setRuntime(runtime) {
11
+ this.#runtime = runtime;
12
+ }
9
13
  registerRequestHandlers(handlers) {
10
14
  this.#requestHandlerRegistry.add(handlers);
15
+ this.#runtime?.logger.debug("[squide] The following MSW request handlers has been registered: ", handlers);
11
16
  }
12
17
  get requestHandlers() {
13
18
  return this.#requestHandlerRegistry.handlers;
14
19
  }
15
20
  };
16
21
  function getMswPlugin(runtime) {
17
- return runtime.getPlugin(MswPlugin.name);
22
+ const plugin = runtime.getPlugin(MswPlugin.name);
23
+ if (isNil(plugin)) {
24
+ throw new Error("[squide] The getMswPlugin function is called but no MswPlugin instance has been registered with the runtime.");
25
+ }
26
+ return plugin;
18
27
  }
19
28
 
20
29
  export { MswPlugin, getMswPlugin };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { MswPlugin, getMswPlugin } from './chunk-D2TOUDBN.js';
1
+ export { MswPlugin, getMswPlugin } from './chunk-OKIK46QG.js';
2
2
  export { RequestHandlerRegistry } from './chunk-2J7GQPWR.js';
3
3
  export { useIsMswStarted } from './chunk-P5ONHQEP.js';
4
4
  export { __resetMswStatus, isMswStarted, setMswAsStarted } from './chunk-JLS7DBDX.js';
@@ -4,6 +4,7 @@ import { RequestHandler } from 'msw';
4
4
  declare class MswPlugin extends Plugin {
5
5
  #private;
6
6
  constructor();
7
+ _setRuntime(runtime: Runtime): void;
7
8
  registerRequestHandlers(handlers: RequestHandler[]): void;
8
9
  get requestHandlers(): RequestHandler[];
9
10
  }
package/dist/mswPlugin.js CHANGED
@@ -1,3 +1,3 @@
1
- export { MswPlugin, getMswPlugin } from './chunk-D2TOUDBN.js';
1
+ export { MswPlugin, getMswPlugin } from './chunk-OKIK46QG.js';
2
2
  import './chunk-2J7GQPWR.js';
3
3
  import './chunk-JLS7DBDX.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@squide/msw",
3
3
  "author": "Workleap",
4
- "version": "2.0.4",
4
+ "version": "2.0.5",
5
5
  "description": "Add support for MSW to @squide federated application shell.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -37,13 +37,11 @@
37
37
  }
38
38
  },
39
39
  "devDependencies": {
40
- "@types/jest": "29.5.7",
41
40
  "@types/react": "18.2.36",
42
41
  "@types/react-dom": "18.2.14",
43
42
  "@workleap/eslint-plugin": "3.0.0",
44
43
  "@workleap/tsup-configs": "3.0.1",
45
44
  "@workleap/typescript-configs": "3.0.2",
46
- "jest": "29.7.0",
47
45
  "msw": "2.0.3",
48
46
  "react": "18.2.0",
49
47
  "react-dom": "18.2.0",
@@ -51,7 +49,7 @@
51
49
  "typescript": "5.2.2"
52
50
  },
53
51
  "dependencies": {
54
- "@squide/core": "3.0.0"
52
+ "@squide/core": "3.1.0"
55
53
  },
56
54
  "sideEffects": false,
57
55
  "engines": {