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.
@@ -37,7 +37,8 @@ const withHydrationBoundary = (Component, initializer, useHydrationId) => {
37
37
  }
38
38
  value[id] = {
39
39
  getState: s.getState,
40
- abort: s.abort
40
+ abort: s.abort,
41
+ type: s.type
41
42
  };
42
43
  }
43
44
  return s;
@@ -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,
@@ -30,7 +30,8 @@ const withHydrationBoundary = (Component, initializer, useHydrationId) => {
30
30
  }
31
31
  value[id] = {
32
32
  getState: s.getState,
33
- abort: s.abort
33
+ abort: s.abort,
34
+ type: s.type
34
35
  };
35
36
  }
36
37
  return s;
@@ -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: string;
13
+ id?: string;
13
14
  children?: React.ReactNode;
14
15
  }>;
15
16
  declare const withHydrationBoundary: (Component: HydrationComponent, initializer: Initializer, useHydrationId: undefined | (() => string)) => HydrationBoundary;
@@ -3,6 +3,7 @@ export type HydrationContextValueType = {
3
3
  [key: string]: {
4
4
  getState: () => object;
5
5
  abort?: () => Promise<void>;
6
+ type?: 'raw' | 'json';
6
7
  };
7
8
  };
8
9
  export declare let HydrationContext: React.Context<HydrationContextValueType>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "1.1.0-4",
3
+ "version": "1.1.0-6",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",