@modern-js/plugin-garfish 1.6.2 → 1.8.1

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,73 @@
1
1
  # @modern-js/plugin-garfish
2
2
 
3
+ ## 1.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: `@modern-js/plugin-garfish` support `pluginName` params
8
+
9
+ fix: `@modern-js/plugin-garfish` 支持 `pluginName` 参数
10
+
11
+ ## 1.8.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 59c941a: chore(runtime): merge `@modern-js/runtime-core` to `@modern-js/runtime`
16
+
17
+ chore(runtime): 合并 `@modern-js/runtime-core` 到 `@modern-js/runtime`
18
+
19
+ ### Patch Changes
20
+
21
+ - e686059: chore: adjust `@modern-js/plugin-garfish` runtime export path
22
+
23
+ chore: 调整 `@modern-js/plugin-garfish` runtime 导出路径
24
+
25
+ - 246ac0d: feat: support runtime masterApp type
26
+
27
+ feat: 支持在 `modern.config.ts` 中提示 `runtime.masterApp` 类型
28
+
29
+ - Updated dependencies [79e83ef]
30
+ - Updated dependencies [e0cd14a]
31
+ - Updated dependencies [287ac8b]
32
+ - Updated dependencies [22f4dca]
33
+ - Updated dependencies [59c941a]
34
+ - Updated dependencies [7b9067f]
35
+ - @modern-js/utils@1.9.0
36
+ - @modern-js/runtime@1.5.0
37
+
38
+ ## 1.7.0
39
+
40
+ ### Minor Changes
41
+
42
+ - 4fc801f: chore(runtime): merge `@modern-js/plugin-router` to `@modern-js/runtime`
43
+
44
+ chore(runtime): 合并 `@modern-js/plugin-router` 到 `@modern-js/runtime`
45
+
46
+ ### Patch Changes
47
+
48
+ - Updated dependencies [1421965]
49
+ - Updated dependencies [4fc801f]
50
+ - Updated dependencies [b8ea9cd]
51
+ - Updated dependencies [4fc801f]
52
+ - Updated dependencies [4fc801f]
53
+ - Updated dependencies [4fc801f]
54
+ - Updated dependencies [4fc801f]
55
+ - Updated dependencies [16eaebd]
56
+ - Updated dependencies [8f046e8]
57
+ - Updated dependencies [c8614b8]
58
+ - @modern-js/runtime@1.4.0
59
+ - @modern-js/utils@1.8.0
60
+
61
+ ## 1.6.2
62
+
63
+ ### Patch Changes
64
+
65
+ - 7b9e302: fix: incorrect @babel/runtime version
66
+ - Updated dependencies [dc37349]
67
+ - Updated dependencies [a90bc96]
68
+ - @modern-js/plugin-router@1.2.16
69
+ - @modern-js/utils@1.7.9
70
+
3
71
  ## 1.6.0
4
72
 
5
73
  ### Minor Changes
@@ -27,6 +27,7 @@ export function getDefaultMicroFrontedConfig(microFrontend) {
27
27
  }, microFrontend);
28
28
  }
29
29
  export default (({
30
+ pluginName: _pluginName = '@modern-js/plugin-garfish',
30
31
  runtimePluginName: _runtimePluginName = '@modern-js/runtime/plugins',
31
32
  mfPackagePath: _mfPackagePath = path.resolve(__dirname, '../../../../')
32
33
  } = {}) => ({
@@ -173,7 +174,7 @@ export default (({
173
174
  },
174
175
 
175
176
  addRuntimeExports() {
176
- const addExportStatement = `export { default as garfish, default as masterApp, hoistNonReactStatics } from '${_mfPackagePath}'`;
177
+ const addExportStatement = `export { default as garfish, default as masterApp, hoistNonReactStatics } from '${_pluginName}'`;
177
178
  logger('exportStatement', addExportStatement);
178
179
  pluginsExportsUtils.addExport(addExportStatement);
179
180
  runtimeExportsUtils.addExport(`export * from '${_mfPackagePath}'`);
@@ -1,5 +1,4 @@
1
- const _excluded = ["setLoadingState", "style"],
2
- _excluded2 = ["beforeLoad", "beforeMount", "errorLoadApp", "errorMountApp", "errorUnmountApp"];
1
+ const _excluded = ["beforeLoad", "beforeMount", "errorLoadApp", "errorMountApp", "errorUnmountApp"];
3
2
 
4
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
4
 
@@ -31,13 +30,9 @@ export function generateMApp(options, manifest) {
31
30
  const {
32
31
  domId
33
32
  } = this.state;
34
-
35
- const _this$props = this.props,
36
- {
37
- setLoadingState,
38
- style
39
- } = _this$props,
40
- userProps = _objectWithoutProperties(_this$props, _excluded);
33
+ const {
34
+ setLoadingState
35
+ } = this.props;
41
36
 
42
37
  const {
43
38
  beforeLoad,
@@ -46,7 +41,7 @@ export function generateMApp(options, manifest) {
46
41
  errorMountApp,
47
42
  errorUnmountApp
48
43
  } = options,
49
- otherOptions = _objectWithoutProperties(options, _excluded2); // start auto render able
44
+ otherOptions = _objectWithoutProperties(options, _excluded); // start auto render able
50
45
 
51
46
 
52
47
  Garfish.router.setRouterConfig({
@@ -118,7 +113,6 @@ export function generateMApp(options, manifest) {
118
113
  }
119
114
 
120
115
  }, otherOptions), {}, {
121
- props: _objectSpread(_objectSpread({}, otherOptions.props || {}), userProps),
122
116
  insulationVariable: [...(otherOptions.insulationVariable || []), '_SERVER_DATA'],
123
117
  customLoader: provider => {
124
118
  const {
@@ -15,7 +15,7 @@ import path from 'path';
15
15
  import React from 'react'; // eslint-disable-next-line import/no-named-as-default
16
16
 
17
17
  import Garfish from 'garfish';
18
- import { withRouter } from '@modern-js/plugin-router'; // import Loadable from 'react-loadable';
18
+ import { withRouter } from '@modern-js/runtime/router'; // import Loadable from 'react-loadable';
19
19
 
20
20
  import { logger, generateSubAppContainerKey } from "../../util";
21
21
  import { Loadable } from "../loadable";
@@ -44,6 +44,7 @@ function getDefaultMicroFrontedConfig(microFrontend) {
44
44
  }
45
45
 
46
46
  var _default = ({
47
+ pluginName: _pluginName = '@modern-js/plugin-garfish',
47
48
  runtimePluginName: _runtimePluginName = '@modern-js/runtime/plugins',
48
49
  mfPackagePath: _mfPackagePath = _path.default.resolve(__dirname, '../../../../')
49
50
  } = {}) => ({
@@ -190,7 +191,7 @@ var _default = ({
190
191
  },
191
192
 
192
193
  addRuntimeExports() {
193
- const addExportStatement = `export { default as garfish, default as masterApp, hoistNonReactStatics } from '${_mfPackagePath}'`;
194
+ const addExportStatement = `export { default as garfish, default as masterApp, hoistNonReactStatics } from '${_pluginName}'`;
194
195
  (0, _util.logger)('exportStatement', addExportStatement);
195
196
  pluginsExportsUtils.addExport(addExportStatement);
196
197
  runtimeExportsUtils.addExport(`export * from '${_mfPackagePath}'`);
@@ -15,8 +15,7 @@ var _loadable = require("../loadable");
15
15
 
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
17
 
18
- const _excluded = ["setLoadingState", "style"],
19
- _excluded2 = ["beforeLoad", "beforeMount", "errorLoadApp", "errorMountApp", "errorUnmountApp"];
18
+ const _excluded = ["beforeLoad", "beforeMount", "errorLoadApp", "errorMountApp", "errorUnmountApp"];
20
19
 
21
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
21
 
@@ -44,13 +43,9 @@ function generateMApp(options, manifest) {
44
43
  const {
45
44
  domId
46
45
  } = this.state;
47
-
48
- const _this$props = this.props,
49
- {
50
- setLoadingState,
51
- style
52
- } = _this$props,
53
- userProps = _objectWithoutProperties(_this$props, _excluded);
46
+ const {
47
+ setLoadingState
48
+ } = this.props;
54
49
 
55
50
  const {
56
51
  beforeLoad,
@@ -59,7 +54,7 @@ function generateMApp(options, manifest) {
59
54
  errorMountApp,
60
55
  errorUnmountApp
61
56
  } = options,
62
- otherOptions = _objectWithoutProperties(options, _excluded2); // start auto render able
57
+ otherOptions = _objectWithoutProperties(options, _excluded); // start auto render able
63
58
 
64
59
 
65
60
  _garfish.default.router.setRouterConfig({
@@ -131,7 +126,6 @@ function generateMApp(options, manifest) {
131
126
  }
132
127
 
133
128
  }, otherOptions), {}, {
134
- props: _objectSpread(_objectSpread({}, otherOptions.props || {}), userProps),
135
129
  insulationVariable: [...(otherOptions.insulationVariable || []), '_SERVER_DATA'],
136
130
  customLoader: provider => {
137
131
  const {
@@ -11,7 +11,7 @@ var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _garfish = _interopRequireDefault(require("garfish"));
13
13
 
14
- var _pluginRouter = require("@modern-js/plugin-router");
14
+ var _router = require("@modern-js/runtime/router");
15
15
 
16
16
  var _util = require("../../util");
17
17
 
@@ -193,7 +193,7 @@ function getAppInstance(options, appInfo, manifest) {
193
193
 
194
194
  }
195
195
 
196
- return (0, _loadable.Loadable)((0, _pluginRouter.withRouter)(MicroApp))(manifest === null || manifest === void 0 ? void 0 : manifest.loadable);
196
+ return (0, _loadable.Loadable)((0, _router.withRouter)(MicroApp))(manifest === null || manifest === void 0 ? void 0 : manifest.loadable);
197
197
  }
198
198
 
199
199
  function generateApps(options, manifest) {
@@ -26,6 +26,8 @@ export function getDefaultMicroFrontedConfig(microFrontend) {
26
26
  }
27
27
  export default (function () {
28
28
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
29
+ _ref$pluginName = _ref.pluginName,
30
+ pluginName = _ref$pluginName === void 0 ? '@modern-js/plugin-garfish' : _ref$pluginName,
29
31
  _ref$runtimePluginNam = _ref.runtimePluginName,
30
32
  runtimePluginName = _ref$runtimePluginNam === void 0 ? '@modern-js/runtime/plugins' : _ref$runtimePluginNam,
31
33
  _ref$mfPackagePath = _ref.mfPackagePath,
@@ -184,7 +186,7 @@ export default (function () {
184
186
  };
185
187
  },
186
188
  addRuntimeExports: function addRuntimeExports() {
187
- var addExportStatement = "export { default as garfish, default as masterApp, hoistNonReactStatics } from '".concat(mfPackagePath, "'");
189
+ var addExportStatement = "export { default as garfish, default as masterApp, hoistNonReactStatics } from '".concat(pluginName, "'");
188
190
  logger('exportStatement', addExportStatement);
189
191
  pluginsExportsUtils.addExport(addExportStatement);
190
192
  runtimeExportsUtils.addExport("export * from '".concat(mfPackagePath, "'"));
@@ -7,8 +7,7 @@ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitial
7
7
  import _inherits from "@babel/runtime/helpers/esm/inherits";
8
8
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
9
9
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
10
- var _excluded = ["setLoadingState", "style"],
11
- _excluded2 = ["beforeLoad", "beforeMount", "errorLoadApp", "errorMountApp", "errorUnmountApp"];
10
+ var _excluded = ["beforeLoad", "beforeMount", "errorLoadApp", "errorMountApp", "errorUnmountApp"];
12
11
  import React from 'react'; // eslint-disable-next-line import/no-named-as-default
13
12
 
14
13
  import Garfish from 'garfish';
@@ -45,18 +44,14 @@ export function generateMApp(options, manifest) {
45
44
  var _this2 = this;
46
45
 
47
46
  var domId = this.state.domId;
48
-
49
- var _this$props = this.props,
50
- setLoadingState = _this$props.setLoadingState,
51
- style = _this$props.style,
52
- userProps = _objectWithoutProperties(_this$props, _excluded);
47
+ var setLoadingState = this.props.setLoadingState;
53
48
 
54
49
  var _beforeLoad = options.beforeLoad,
55
50
  _beforeMount = options.beforeMount,
56
51
  _errorLoadApp = options.errorLoadApp,
57
52
  _errorMountApp = options.errorMountApp,
58
53
  _errorUnmountApp = options.errorUnmountApp,
59
- otherOptions = _objectWithoutProperties(options, _excluded2); // start auto render able
54
+ otherOptions = _objectWithoutProperties(options, _excluded); // start auto render able
60
55
 
61
56
 
62
57
  Garfish.router.setRouterConfig({
@@ -142,7 +137,6 @@ export function generateMApp(options, manifest) {
142
137
  return _errorUnmountApp === null || _errorUnmountApp === void 0 ? void 0 : _errorUnmountApp.apply(void 0, [error, appInfo].concat(args));
143
138
  }
144
139
  }, otherOptions), {}, {
145
- props: _objectSpread(_objectSpread({}, otherOptions.props || {}), userProps),
146
140
  insulationVariable: [].concat(_toConsumableArray(otherOptions.insulationVariable || []), ['_SERVER_DATA']),
147
141
  customLoader: function customLoader(provider) {
148
142
  var render = provider.render,
@@ -15,7 +15,7 @@ import path from 'path';
15
15
  import React from 'react'; // eslint-disable-next-line import/no-named-as-default
16
16
 
17
17
  import Garfish from 'garfish';
18
- import { withRouter } from '@modern-js/plugin-router'; // import Loadable from 'react-loadable';
18
+ import { withRouter } from '@modern-js/runtime/router'; // import Loadable from 'react-loadable';
19
19
 
20
20
  import { logger, generateSubAppContainerKey } from "../../util";
21
21
  import { Loadable } from "../loadable";
@@ -13,9 +13,11 @@ export declare function getDefaultMicroFrontedConfig(microFrontend: NonInValidAb
13
13
  };
14
14
 
15
15
  declare const _default: ({
16
+ pluginName,
16
17
  runtimePluginName,
17
18
  mfPackagePath
18
19
  }?: {
20
+ pluginName?: string | undefined;
19
21
  runtimePluginName?: string | undefined;
20
22
  mfPackagePath?: string | undefined;
21
23
  }) => CliPlugin;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { RouteComponentProps } from '@modern-js/plugin-router';
2
+ import { RouteComponentProps } from '@modern-js/runtime/router';
3
3
  import { LoadableConfig, MicroComponentProps } from './useModuleApps';
4
4
  export interface MicroProps extends RouteComponentProps {
5
5
  setLoadingState: (state: {
@@ -1,4 +1,4 @@
1
- import type { Plugin } from '@modern-js/runtime-core';
1
+ import type { Plugin } from '@modern-js/runtime';
2
2
  import { Config } from './useModuleApps';
3
3
 
4
4
  declare const _default: (config: Config) => Plugin;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.6.2",
14
+ "version": "1.8.1",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/runtime/index.d.ts",
17
17
  "typesVersions": {
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@babel/runtime": "^7.18.0",
53
- "@modern-js/utils": "^1.7.8",
53
+ "@modern-js/utils": "^1.9.0",
54
54
  "@types/debug": "^4.1.7",
55
55
  "@types/react-loadable": "^5.5.6",
56
56
  "debug": "^4.3.2",
@@ -59,18 +59,17 @@
59
59
  "react-loadable": "^5.5.0"
60
60
  },
61
61
  "peerDependencies": {
62
- "@modern-js/plugin-router": "^1.2.15"
62
+ "@modern-js/runtime": "^1.5.0"
63
63
  },
64
64
  "peerDependenciesMeta": {
65
- "@modern-js/plugin-router": {
65
+ "@modern-js/runtime": {
66
66
  "optional": true
67
67
  }
68
68
  },
69
69
  "devDependencies": {
70
- "@modern-js/core": "1.12.1",
71
- "@modern-js/plugin-router": "1.2.15",
72
- "@modern-js/runtime-core": "1.5.1",
73
- "@modern-js/types": "1.5.4",
70
+ "@modern-js/core": "1.14.0",
71
+ "@modern-js/runtime": "1.5.0",
72
+ "@modern-js/types": "1.6.2",
74
73
  "@scripts/build": "0.0.0",
75
74
  "@scripts/jest-config": "0.0.0",
76
75
  "@testing-library/jest-dom": "^5.16.1",
@@ -78,6 +77,7 @@
78
77
  "@testing-library/react-hooks": "^7.0.1",
79
78
  "@testing-library/user-event": "^13.5.0",
80
79
  "@types/hoist-non-react-statics": "^3.3.1",
80
+ "@types/testing-library__jest-dom": "^5.14.3",
81
81
  "@types/jest": "^27",
82
82
  "@types/node": "^14",
83
83
  "@types/react": "^17",
package/type.d.ts CHANGED
@@ -1,4 +1,12 @@
1
+ import { Config } from './dist/types/runtime/useModuleApps';
2
+
1
3
  declare module '@modern-js/runtime' {
2
4
  export const useModuleApp: typeof import('./dist/types/runtime').useModuleApp;
3
5
  export const useModuleApps: typeof import('./dist/types/runtime').useModuleApps;
4
6
  }
7
+
8
+ declare module '@modern-js/core' {
9
+ interface RuntimeConfig {
10
+ masterApp?: Config
11
+ }
12
+ }