@adhese/sdk-devtools 0.9.1 → 0.10.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/CHANGELOG.md +11 -0
- package/README.md +3 -3
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @adhese/sdk-devtools
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0f1b268: Rename createDevtools to devtoolsPlugin
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 1819375: Fix Adhese not being properly disposed in React instances
|
|
12
|
+
- 0f1b268: Use watcher to listen to changes of the debug property instead of an event
|
|
13
|
+
|
|
3
14
|
## 0.9.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -21,15 +21,15 @@ bun add @adhese/sdk-devtools
|
|
|
21
21
|
```
|
|
22
22
|
:::
|
|
23
23
|
|
|
24
|
-
Add the `
|
|
24
|
+
Add the `devtoolsPlugin` function to your Adhese config plugins field:
|
|
25
25
|
|
|
26
26
|
```js
|
|
27
|
-
import {
|
|
27
|
+
import { devtoolsPlugin } from '@adhese/sdk-devtools';
|
|
28
28
|
import { createAdhese } from '@adhese/sdk';
|
|
29
29
|
|
|
30
30
|
const adhese = createAdhese({
|
|
31
31
|
account: 'your-account-id',
|
|
32
|
-
plugins: [
|
|
32
|
+
plugins: [devtoolsPlugin],
|
|
33
33
|
});
|
|
34
34
|
```
|
|
35
35
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const sdkShared = require("@adhese/sdk-shared");
|
|
3
4
|
const react = require("react");
|
|
4
|
-
const
|
|
5
|
+
const devtoolsPlugin = (context, {
|
|
5
6
|
onInit,
|
|
6
7
|
onDispose
|
|
7
8
|
}) => {
|
|
@@ -14,18 +15,17 @@ const createDevtools = (context, {
|
|
|
14
15
|
unmount = main.createAdheseDevtools(wrapperElement, context);
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
|
-
onInit(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
await initDevtools();
|
|
21
|
-
if (context.isDisposed)
|
|
22
|
-
dispose();
|
|
23
|
-
}
|
|
24
|
-
(_a = context.events) == null ? void 0 : _a.debugChange.addListener(async (debug) => {
|
|
25
|
-
if (debug)
|
|
18
|
+
onInit(() => {
|
|
19
|
+
sdkShared.watch(() => [context.debug, context.isDisposed], async ([debug, isDisposed]) => {
|
|
20
|
+
if (debug && !isDisposed) {
|
|
26
21
|
await initDevtools();
|
|
27
|
-
|
|
22
|
+
if (context.isDisposed)
|
|
23
|
+
dispose();
|
|
24
|
+
} else {
|
|
28
25
|
dispose();
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
immediate: true
|
|
29
29
|
});
|
|
30
30
|
});
|
|
31
31
|
function dispose() {
|
|
@@ -38,5 +38,5 @@ const createDevtools = (context, {
|
|
|
38
38
|
};
|
|
39
39
|
const Devtools = react.lazy(() => Promise.resolve().then(() => require("./devtools-gR8ZWEgG.cjs")).then((n) => n.Devtools).then((module2) => ({ default: module2.Devtools })));
|
|
40
40
|
exports.Devtools = Devtools;
|
|
41
|
-
exports.
|
|
41
|
+
exports.devtoolsPlugin = devtoolsPlugin;
|
|
42
42
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import type { AdheseContext, AdhesePlugin } from '@adhese/sdk';\nimport { lazy } from 'react';\n\nexport const
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import type { AdheseContext, AdhesePlugin } from '@adhese/sdk';\nimport { watch } from '@adhese/sdk-shared';\nimport { lazy } from 'react';\n\nexport const devtoolsPlugin: AdhesePlugin = (context: AdheseContext, {\n onInit,\n onDispose,\n}) => {\n const wrapperElement = document.createElement('div');\n let unmount: (() => void) | undefined;\n\n async function initDevtools(): Promise<void> {\n const main = await import('./main');\n\n if (!unmount) {\n document.body.appendChild(wrapperElement);\n\n unmount = main.createAdheseDevtools(wrapperElement, context);\n }\n }\n\n onInit(() => {\n watch(() => [context.debug, context.isDisposed], async ([debug, isDisposed]) => {\n if (debug && !isDisposed) {\n await initDevtools();\n\n if (context.isDisposed)\n dispose();\n }\n else {\n dispose();\n }\n }, {\n immediate: true,\n });\n });\n\n function dispose(): void {\n unmount?.();\n unmount = undefined;\n if (wrapperElement.parentElement)\n wrapperElement.outerHTML = '';\n }\n\n onDispose(dispose);\n};\n\n// eslint-disable-next-line ts/naming-convention\nexport const Devtools = lazy(() => import('./Devtools').then(module => ({ default: module.Devtools })));\n"],"names":["watch","lazy","module"],"mappings":";;;;AAIa,MAAA,iBAA+B,CAAC,SAAwB;AAAA,EACnE;AAAA,EACA;AACF,MAAM;AACE,QAAA,iBAAiB,SAAS,cAAc,KAAK;AAC/C,MAAA;AAEJ,iBAAe,eAA8B;AACrC,UAAA,OAAO,MAAM,QAAO,QAAA,EAAA,KAAA,MAAA,QAAA,yBAAQ;AAElC,QAAI,CAAC,SAAS;AACH,eAAA,KAAK,YAAY,cAAc;AAE9B,gBAAA,KAAK,qBAAqB,gBAAgB,OAAO;AAAA,IAC7D;AAAA,EACF;AAEA,SAAO,MAAM;AACLA,oBAAA,MAAM,CAAC,QAAQ,OAAO,QAAQ,UAAU,GAAG,OAAO,CAAC,OAAO,UAAU,MAAM;AAC1E,UAAA,SAAS,CAAC,YAAY;AACxB,cAAM,aAAa;AAEnB,YAAI,QAAQ;AACF;MAAA,OAEP;AACK;MACV;AAAA,IAAA,GACC;AAAA,MACD,WAAW;AAAA,IAAA,CACZ;AAAA,EAAA,CACF;AAED,WAAS,UAAgB;AACb;AACA,cAAA;AACV,QAAI,eAAe;AACjB,qBAAe,YAAY;AAAA,EAC/B;AAEA,YAAU,OAAO;AACnB;AAGO,MAAM,WAAWC,MAAA,KAAK,MAAM,QAAO,QAAA,EAAA,KAAA,MAAA,QAAA,yBAAY,CAAA,EAAA,KAAA,OAAA,EAAA,QAAA,EAAE,KAAK,CAAAC,aAAW,EAAE,SAASA,QAAO,WAAW,CAAC;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare function Devtools$1({ adheseContext }: {
|
|
|
6
6
|
adheseContext: AdheseContext;
|
|
7
7
|
}): ReactElement;
|
|
8
8
|
|
|
9
|
-
declare const
|
|
9
|
+
declare const devtoolsPlugin: AdhesePlugin;
|
|
10
10
|
declare const Devtools: react.LazyExoticComponent<typeof Devtools$1>;
|
|
11
11
|
|
|
12
|
-
export { Devtools,
|
|
12
|
+
export { Devtools, devtoolsPlugin };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { watch } from "@adhese/sdk-shared";
|
|
1
2
|
import { lazy } from "react";
|
|
2
|
-
const
|
|
3
|
+
const devtoolsPlugin = (context, {
|
|
3
4
|
onInit,
|
|
4
5
|
onDispose
|
|
5
6
|
}) => {
|
|
@@ -12,18 +13,17 @@ const createDevtools = (context, {
|
|
|
12
13
|
unmount = main.createAdheseDevtools(wrapperElement, context);
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
|
-
onInit(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
await initDevtools();
|
|
19
|
-
if (context.isDisposed)
|
|
20
|
-
dispose();
|
|
21
|
-
}
|
|
22
|
-
(_a = context.events) == null ? void 0 : _a.debugChange.addListener(async (debug) => {
|
|
23
|
-
if (debug)
|
|
16
|
+
onInit(() => {
|
|
17
|
+
watch(() => [context.debug, context.isDisposed], async ([debug, isDisposed]) => {
|
|
18
|
+
if (debug && !isDisposed) {
|
|
24
19
|
await initDevtools();
|
|
25
|
-
|
|
20
|
+
if (context.isDisposed)
|
|
21
|
+
dispose();
|
|
22
|
+
} else {
|
|
26
23
|
dispose();
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
immediate: true
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
function dispose() {
|
|
@@ -37,6 +37,6 @@ const createDevtools = (context, {
|
|
|
37
37
|
const Devtools = lazy(() => import("./devtools-DbsxZEDX.js").then((n) => n.D).then((module) => ({ default: module.Devtools })));
|
|
38
38
|
export {
|
|
39
39
|
Devtools,
|
|
40
|
-
|
|
40
|
+
devtoolsPlugin
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import type { AdheseContext, AdhesePlugin } from '@adhese/sdk';\nimport { lazy } from 'react';\n\nexport const
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import type { AdheseContext, AdhesePlugin } from '@adhese/sdk';\nimport { watch } from '@adhese/sdk-shared';\nimport { lazy } from 'react';\n\nexport const devtoolsPlugin: AdhesePlugin = (context: AdheseContext, {\n onInit,\n onDispose,\n}) => {\n const wrapperElement = document.createElement('div');\n let unmount: (() => void) | undefined;\n\n async function initDevtools(): Promise<void> {\n const main = await import('./main');\n\n if (!unmount) {\n document.body.appendChild(wrapperElement);\n\n unmount = main.createAdheseDevtools(wrapperElement, context);\n }\n }\n\n onInit(() => {\n watch(() => [context.debug, context.isDisposed], async ([debug, isDisposed]) => {\n if (debug && !isDisposed) {\n await initDevtools();\n\n if (context.isDisposed)\n dispose();\n }\n else {\n dispose();\n }\n }, {\n immediate: true,\n });\n });\n\n function dispose(): void {\n unmount?.();\n unmount = undefined;\n if (wrapperElement.parentElement)\n wrapperElement.outerHTML = '';\n }\n\n onDispose(dispose);\n};\n\n// eslint-disable-next-line ts/naming-convention\nexport const Devtools = lazy(() => import('./Devtools').then(module => ({ default: module.Devtools })));\n"],"names":[],"mappings":";;AAIa,MAAA,iBAA+B,CAAC,SAAwB;AAAA,EACnE;AAAA,EACA;AACF,MAAM;AACE,QAAA,iBAAiB,SAAS,cAAc,KAAK;AAC/C,MAAA;AAEJ,iBAAe,eAA8B;AACrC,UAAA,OAAO,MAAM,OAAO,wBAAQ;AAElC,QAAI,CAAC,SAAS;AACH,eAAA,KAAK,YAAY,cAAc;AAE9B,gBAAA,KAAK,qBAAqB,gBAAgB,OAAO;AAAA,IAC7D;AAAA,EACF;AAEA,SAAO,MAAM;AACL,UAAA,MAAM,CAAC,QAAQ,OAAO,QAAQ,UAAU,GAAG,OAAO,CAAC,OAAO,UAAU,MAAM;AAC1E,UAAA,SAAS,CAAC,YAAY;AACxB,cAAM,aAAa;AAEnB,YAAI,QAAQ;AACF;MAAA,OAEP;AACK;MACV;AAAA,IAAA,GACC;AAAA,MACD,WAAW;AAAA,IAAA,CACZ;AAAA,EAAA,CACF;AAED,WAAS,UAAgB;AACb;AACA,cAAA;AACV,QAAI,eAAe;AACjB,qBAAe,YAAY;AAAA,EAC/B;AAEA,YAAU,OAAO;AACnB;AAGO,MAAM,WAAW,KAAK,MAAM,OAAO,wBAAY,EAAA,KAAA,OAAA,EAAA,CAAA,EAAE,KAAK,CAAA,YAAW,EAAE,SAAS,OAAO,WAAW,CAAC;"}
|