chayns-api 1.1.0-4 → 1.1.0-6
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/cjs/components/withHydrationBoundary.js +2 -1
- package/dist/cjs/host/ChaynsHost.js +19 -0
- package/dist/esm/components/withHydrationBoundary.js +2 -1
- package/dist/esm/host/ChaynsHost.js +19 -0
- package/dist/types/components/withHydrationBoundary.d.ts +2 -1
- package/dist/types/constants/hydrationContext.d.ts +1 -0
- package/package.json +1 -1
|
@@ -5,9 +5,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
9
|
+
var _runtime = require("@module-federation/runtime");
|
|
8
10
|
var _HostIframe = _interopRequireDefault(require("./iframe/HostIframe"));
|
|
9
11
|
var _ModuleHost = _interopRequireDefault(require("./module/ModuleHost"));
|
|
10
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
(0, _runtime.init)({
|
|
14
|
+
// @ts-expect-error will be set by chayns-toolkit via DefinePlugin
|
|
15
|
+
name: __PACKAGE_NAME__,
|
|
16
|
+
remotes: [],
|
|
17
|
+
shared: {
|
|
18
|
+
react: {
|
|
19
|
+
version: _react.default.version,
|
|
20
|
+
scope: 'default',
|
|
21
|
+
lib: () => _react.default
|
|
22
|
+
},
|
|
23
|
+
'react-dom': {
|
|
24
|
+
version: _reactDom.default.version,
|
|
25
|
+
scope: 'default',
|
|
26
|
+
lib: () => _reactDom.default
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
11
30
|
const ChaynsHost = ({
|
|
12
31
|
type,
|
|
13
32
|
iFrameProps,
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import { init } from '@module-federation/runtime';
|
|
2
4
|
import HostIframe from './iframe/HostIframe';
|
|
3
5
|
import ModuleHost from './module/ModuleHost';
|
|
6
|
+
init({
|
|
7
|
+
// @ts-expect-error will be set by chayns-toolkit via DefinePlugin
|
|
8
|
+
name: __PACKAGE_NAME__,
|
|
9
|
+
remotes: [],
|
|
10
|
+
shared: {
|
|
11
|
+
react: {
|
|
12
|
+
version: React.version,
|
|
13
|
+
scope: 'default',
|
|
14
|
+
lib: () => React
|
|
15
|
+
},
|
|
16
|
+
'react-dom': {
|
|
17
|
+
version: ReactDOM.version,
|
|
18
|
+
scope: 'default',
|
|
19
|
+
lib: () => ReactDOM
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
4
23
|
const ChaynsHost = _ref => {
|
|
5
24
|
let {
|
|
6
25
|
type,
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
type StoreLikeValue = object & {
|
|
3
3
|
getState: () => object;
|
|
4
4
|
abort?: () => Promise<void>;
|
|
5
|
+
type?: 'raw' | 'json';
|
|
5
6
|
};
|
|
6
7
|
type HydrationComponent = React.FC<{
|
|
7
8
|
value: StoreLikeValue;
|
|
@@ -9,7 +10,7 @@ type HydrationComponent = React.FC<{
|
|
|
9
10
|
}>;
|
|
10
11
|
type Initializer = (initialValue: object | undefined) => StoreLikeValue;
|
|
11
12
|
type HydrationBoundary = React.FC<{
|
|
12
|
-
id
|
|
13
|
+
id?: string;
|
|
13
14
|
children?: React.ReactNode;
|
|
14
15
|
}>;
|
|
15
16
|
declare const withHydrationBoundary: (Component: HydrationComponent, initializer: Initializer, useHydrationId: undefined | (() => string)) => HydrationBoundary;
|