@yaasl/devtools 0.11.0-alpha.2 → 0.11.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.
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-parameters */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,6 +5,9 @@ const utils_1 = require("@yaasl/utils");
5
5
  let didWarn = false;
6
6
  /** Returns the global redux extension object if available */
7
7
  const getReduxExtension = () => {
8
+ const window = (0, utils_1.getWindow)();
9
+ if (!window)
10
+ return null;
8
11
  const reduxExtension = window.__REDUX_DEVTOOLS_EXTENSION__;
9
12
  if (!reduxExtension) {
10
13
  if (!didWarn) {
@@ -30,10 +30,10 @@ const subscribeStore = (atom, connection) => {
30
30
  return;
31
31
  didInit = true;
32
32
  connection.subscribe(action => {
33
- const { payload } = action;
34
- const nextState = !action.state
33
+ const { payload, state } = action;
34
+ const nextState = !state
35
35
  ? null
36
- : JSON.parse(action.state);
36
+ : JSON.parse(state);
37
37
  switch (payload === null || payload === void 0 ? void 0 : payload.type) {
38
38
  case "COMMIT":
39
39
  connection.init(cache_1.cache.getStore());
@@ -1 +1,2 @@
1
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-parameters */
1
2
  export {};
@@ -1,7 +1,10 @@
1
- import { log } from "@yaasl/utils";
1
+ import { getWindow, log } from "@yaasl/utils";
2
2
  let didWarn = false;
3
3
  /** Returns the global redux extension object if available */
4
4
  export const getReduxExtension = () => {
5
+ const window = getWindow();
6
+ if (!window)
7
+ return null;
5
8
  const reduxExtension = window.__REDUX_DEVTOOLS_EXTENSION__;
6
9
  if (!reduxExtension) {
7
10
  if (!didWarn) {
@@ -27,10 +27,10 @@ export const subscribeStore = (atom, connection) => {
27
27
  return;
28
28
  didInit = true;
29
29
  connection.subscribe(action => {
30
- const { payload } = action;
31
- const nextState = !action.state
30
+ const { payload, state } = action;
31
+ const nextState = !state
32
32
  ? null
33
- : JSON.parse(action.state);
33
+ : JSON.parse(state);
34
34
  switch (payload?.type) {
35
35
  case "COMMIT":
36
36
  connection.init(cache.getStore());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaasl/devtools",
3
- "version": "0.11.0-alpha.2",
3
+ "version": "0.11.0",
4
4
  "description": "yaasl debugging tools (e.g. redux-devtools-extension middleware)",
5
5
  "author": "PrettyCoffee",
6
6
  "license": "MIT",
@@ -38,13 +38,8 @@
38
38
  "validate": "run-s lint test build"
39
39
  },
40
40
  "dependencies": {
41
- "@yaasl/core": "0.11.0-alpha.2",
42
- "@yaasl/utils": "0.11.0-alpha.2"
43
- },
44
- "eslintConfig": {
45
- "extends": [
46
- "../../.eslintrc"
47
- ]
41
+ "@yaasl/core": "0.11.0",
42
+ "@yaasl/utils": "0.11.0"
48
43
  },
49
44
  "lint-staged": {
50
45
  "*.{ts,tsx}": [
package/tsconfig.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": ["./src"],
4
- "exclude": ["./**/*.test.ts"],
5
- "compilerOptions": {
6
- "declaration": false,
7
- "noEmit": false,
8
- }
9
- }