@modern-js/plugin-garfish 1.6.2-beta.1 → 1.8.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 CHANGED
@@ -1,5 +1,65 @@
1
1
  # @modern-js/plugin-garfish
2
2
 
3
+ ## 1.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 59c941a: chore(runtime): merge `@modern-js/runtime-core` to `@modern-js/runtime`
8
+
9
+ chore(runtime): 合并 `@modern-js/runtime-core` 到 `@modern-js/runtime`
10
+
11
+ ### Patch Changes
12
+
13
+ - e686059: chore: adjust `@modern-js/plugin-garfish` runtime export path
14
+
15
+ chore: 调整 `@modern-js/plugin-garfish` runtime 导出路径
16
+
17
+ - 246ac0d: feat: support runtime masterApp type
18
+
19
+ feat: 支持在 `modern.config.ts` 中提示 `runtime.masterApp` 类型
20
+
21
+ - Updated dependencies [79e83ef]
22
+ - Updated dependencies [e0cd14a]
23
+ - Updated dependencies [287ac8b]
24
+ - Updated dependencies [22f4dca]
25
+ - Updated dependencies [59c941a]
26
+ - Updated dependencies [7b9067f]
27
+ - @modern-js/utils@1.9.0
28
+ - @modern-js/runtime@1.5.0
29
+
30
+ ## 1.7.0
31
+
32
+ ### Minor Changes
33
+
34
+ - 4fc801f: chore(runtime): merge `@modern-js/plugin-router` to `@modern-js/runtime`
35
+
36
+ chore(runtime): 合并 `@modern-js/plugin-router` 到 `@modern-js/runtime`
37
+
38
+ ### Patch Changes
39
+
40
+ - Updated dependencies [1421965]
41
+ - Updated dependencies [4fc801f]
42
+ - Updated dependencies [b8ea9cd]
43
+ - Updated dependencies [4fc801f]
44
+ - Updated dependencies [4fc801f]
45
+ - Updated dependencies [4fc801f]
46
+ - Updated dependencies [4fc801f]
47
+ - Updated dependencies [16eaebd]
48
+ - Updated dependencies [8f046e8]
49
+ - Updated dependencies [c8614b8]
50
+ - @modern-js/runtime@1.4.0
51
+ - @modern-js/utils@1.8.0
52
+
53
+ ## 1.6.2
54
+
55
+ ### Patch Changes
56
+
57
+ - 7b9e302: fix: incorrect @babel/runtime version
58
+ - Updated dependencies [dc37349]
59
+ - Updated dependencies [a90bc96]
60
+ - @modern-js/plugin-router@1.2.16
61
+ - @modern-js/utils@1.7.9
62
+
3
63
  ## 1.6.0
4
64
 
5
65
  ### Minor Changes
@@ -173,7 +173,7 @@ export default (({
173
173
  },
174
174
 
175
175
  addRuntimeExports() {
176
- const addExportStatement = `export { default as garfish, default as masterApp, hoistNonReactStatics } from '${_mfPackagePath}'`;
176
+ const addExportStatement = `export { default as garfish, default as masterApp, hoistNonReactStatics } from '@modern-js/plugin-garfish'`;
177
177
  logger('exportStatement', addExportStatement);
178
178
  pluginsExportsUtils.addExport(addExportStatement);
179
179
  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";
@@ -190,7 +190,7 @@ var _default = ({
190
190
  },
191
191
 
192
192
  addRuntimeExports() {
193
- const addExportStatement = `export { default as garfish, default as masterApp, hoistNonReactStatics } from '${_mfPackagePath}'`;
193
+ const addExportStatement = `export { default as garfish, default as masterApp, hoistNonReactStatics } from '@modern-js/plugin-garfish'`;
194
194
  (0, _util.logger)('exportStatement', addExportStatement);
195
195
  pluginsExportsUtils.addExport(addExportStatement);
196
196
  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) {
@@ -184,7 +184,7 @@ export default (function () {
184
184
  };
185
185
  },
186
186
  addRuntimeExports: function addRuntimeExports() {
187
- var addExportStatement = "export { default as garfish, default as masterApp, hoistNonReactStatics } from '".concat(mfPackagePath, "'");
187
+ var addExportStatement = "export { default as garfish, default as masterApp, hoistNonReactStatics } from '@modern-js/plugin-garfish'";
188
188
  logger('exportStatement', addExportStatement);
189
189
  pluginsExportsUtils.addExport(addExportStatement);
190
190
  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";
@@ -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-beta.1",
14
+ "version": "1.8.0",
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
+ }