@modern-js/plugin-garfish 1.4.13 → 1.5.2
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 +36 -0
- package/dist/js/modern/cli/index.js +14 -8
- package/dist/js/modern/cli/utils.js +1 -1
- package/dist/js/modern/runtime/index.js +2 -1
- package/dist/js/node/cli/index.js +14 -8
- package/dist/js/node/cli/utils.js +1 -1
- package/dist/js/node/runtime/index.js +8 -0
- package/dist/js/treeshaking/cli/index.js +19 -13
- package/dist/js/treeshaking/cli/utils.js +1 -1
- package/dist/js/treeshaking/runtime/index.js +2 -1
- package/dist/js/treeshaking/runtime/plugin.js +5 -5
- package/dist/js/treeshaking/runtime/utils/apps.js +5 -5
- package/dist/types/runtime/index.d.ts +2 -1
- package/dist/types/runtime/useModuleApps.d.ts +1 -0
- package/package.json +15 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @modern-js/plugin-garfish
|
|
2
2
|
|
|
3
|
+
## 1.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a1198d509: feat: bump babel 7.18.0
|
|
8
|
+
- df0694aba: fix(garfish-plugin): app static properties missing
|
|
9
|
+
- Updated dependencies [a1198d509]
|
|
10
|
+
- @modern-js/plugin-router@1.2.15
|
|
11
|
+
|
|
12
|
+
## 1.5.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 6451a098: fix: cyclic dependencies of @modern-js/core and @moden-js/webpack
|
|
17
|
+
- 45d5643a: feat(webpack): support modify html-webpack-plugin
|
|
18
|
+
- Updated dependencies [be7262e2]
|
|
19
|
+
- Updated dependencies [6451a098]
|
|
20
|
+
- Updated dependencies [d5a2cfd8]
|
|
21
|
+
- Updated dependencies [437367c6]
|
|
22
|
+
- @modern-js/runtime-core@1.4.7
|
|
23
|
+
- @modern-js/utils@1.7.6
|
|
24
|
+
- @modern-js/plugin-router@1.2.14
|
|
25
|
+
|
|
26
|
+
## 1.5.0
|
|
27
|
+
|
|
28
|
+
### Minor Changes
|
|
29
|
+
|
|
30
|
+
- f66fa0e98: feat: support tools.webpackChain config
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- 1dfe08fcd: feat(webpack): add CHAIN_ID constants for webpack chain
|
|
35
|
+
- Updated dependencies [33de0f7ec]
|
|
36
|
+
- @modern-js/utils@1.7.5
|
|
37
|
+
- @modern-js/plugin-router@1.2.14
|
|
38
|
+
|
|
3
39
|
## 1.4.13
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
|
@@ -112,10 +112,10 @@ export default (({
|
|
|
112
112
|
'Access-Control-Allow-Origin': '*'
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
|
-
|
|
116
|
-
chain,
|
|
115
|
+
webpackChain: (chain, {
|
|
117
116
|
webpack,
|
|
118
|
-
env: _env = process.env.NODE_ENV || 'development'
|
|
117
|
+
env: _env = process.env.NODE_ENV || 'development',
|
|
118
|
+
CHAIN_ID
|
|
119
119
|
}) => {
|
|
120
120
|
var _resolveOptions$deplo, _resolveWebpackConfig;
|
|
121
121
|
|
|
@@ -127,13 +127,13 @@ export default (({
|
|
|
127
127
|
|
|
128
128
|
chain.output.libraryTarget('umd');
|
|
129
129
|
|
|
130
|
-
if (resolveOptions !== null && resolveOptions !== void 0 && (_resolveOptions$serve = resolveOptions.server) !== null && _resolveOptions$serve !== void 0 && _resolveOptions$serve.port) {
|
|
131
|
-
chain.output.publicPath(
|
|
130
|
+
if (resolveOptions !== null && resolveOptions !== void 0 && (_resolveOptions$serve = resolveOptions.server) !== null && _resolveOptions$serve !== void 0 && _resolveOptions$serve.port && _env === 'development') {
|
|
131
|
+
chain.output.publicPath(`//localhost:${resolveOptions.server.port}/`);
|
|
132
132
|
} // add comments avoid sourcemap abnormal
|
|
133
133
|
|
|
134
134
|
|
|
135
135
|
if (webpack.BannerPlugin) {
|
|
136
|
-
chain.plugin(
|
|
136
|
+
chain.plugin(CHAIN_ID.PLUGIN.BANNER).use(webpack.BannerPlugin, [{
|
|
137
137
|
banner: 'Micro front-end'
|
|
138
138
|
}]);
|
|
139
139
|
}
|
|
@@ -150,7 +150,7 @@ export default (({
|
|
|
150
150
|
|
|
151
151
|
if (!enableHtmlEntry) {
|
|
152
152
|
chain.output.filename('index.js');
|
|
153
|
-
chain.plugins.delete(
|
|
153
|
+
chain.plugins.delete(`${CHAIN_ID.PLUGIN.HTML}-main`);
|
|
154
154
|
chain.optimization.runtimeChunk(false);
|
|
155
155
|
chain.optimization.splitChunks({
|
|
156
156
|
chunks: 'async'
|
|
@@ -172,7 +172,7 @@ export default (({
|
|
|
172
172
|
},
|
|
173
173
|
|
|
174
174
|
addRuntimeExports() {
|
|
175
|
-
const addExportStatement = `export { default as garfish, default as masterApp } from '${_mfPackagePath}'`;
|
|
175
|
+
const addExportStatement = `export { default as garfish, default as masterApp, hoistNonReactStatics } from '${_mfPackagePath}'`;
|
|
176
176
|
logger('exportStatement', addExportStatement);
|
|
177
177
|
pluginsExportsUtils.addExport(addExportStatement);
|
|
178
178
|
runtimeExportsUtils.addExport(`export * from '${_mfPackagePath}'`);
|
|
@@ -203,6 +203,12 @@ export default (({
|
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
imports.push({
|
|
207
|
+
value: _runtimePluginName,
|
|
208
|
+
specifiers: [{
|
|
209
|
+
imported: 'hoistNonReactStatics'
|
|
210
|
+
}]
|
|
211
|
+
});
|
|
206
212
|
imports.push({
|
|
207
213
|
value: 'react-dom',
|
|
208
214
|
specifiers: [{
|
|
@@ -7,7 +7,7 @@ export const provider = function ({basename, dom}) {
|
|
|
7
7
|
const App = function () {
|
|
8
8
|
return React.createElement(SubApp, props)
|
|
9
9
|
};
|
|
10
|
-
bootstrap(App, node);
|
|
10
|
+
bootstrap(hoistNonReactStatics(App,SubApp), node);
|
|
11
11
|
},
|
|
12
12
|
destroy({ dom }) {
|
|
13
13
|
const node = dom.querySelector('#' + MOUNT_ID) || dom;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default } from "./plugin";
|
|
2
2
|
export { useModuleApps, useModuleApp } from "./useModuleApps";
|
|
3
|
-
export { default as Garfish, default as garfish } from 'garfish';
|
|
3
|
+
export { default as Garfish, default as garfish } from 'garfish';
|
|
4
|
+
export { default as hoistNonReactStatics } from 'hoist-non-react-statics';
|
|
@@ -129,10 +129,10 @@ var _default = ({
|
|
|
129
129
|
'Access-Control-Allow-Origin': '*'
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
|
-
|
|
133
|
-
chain,
|
|
132
|
+
webpackChain: (chain, {
|
|
134
133
|
webpack,
|
|
135
|
-
env: _env = process.env.NODE_ENV || 'development'
|
|
134
|
+
env: _env = process.env.NODE_ENV || 'development',
|
|
135
|
+
CHAIN_ID
|
|
136
136
|
}) => {
|
|
137
137
|
var _resolveOptions$deplo, _resolveWebpackConfig;
|
|
138
138
|
|
|
@@ -144,13 +144,13 @@ var _default = ({
|
|
|
144
144
|
|
|
145
145
|
chain.output.libraryTarget('umd');
|
|
146
146
|
|
|
147
|
-
if (resolveOptions !== null && resolveOptions !== void 0 && (_resolveOptions$serve = resolveOptions.server) !== null && _resolveOptions$serve !== void 0 && _resolveOptions$serve.port) {
|
|
148
|
-
chain.output.publicPath(
|
|
147
|
+
if (resolveOptions !== null && resolveOptions !== void 0 && (_resolveOptions$serve = resolveOptions.server) !== null && _resolveOptions$serve !== void 0 && _resolveOptions$serve.port && _env === 'development') {
|
|
148
|
+
chain.output.publicPath(`//localhost:${resolveOptions.server.port}/`);
|
|
149
149
|
} // add comments avoid sourcemap abnormal
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
if (webpack.BannerPlugin) {
|
|
153
|
-
chain.plugin(
|
|
153
|
+
chain.plugin(CHAIN_ID.PLUGIN.BANNER).use(webpack.BannerPlugin, [{
|
|
154
154
|
banner: 'Micro front-end'
|
|
155
155
|
}]);
|
|
156
156
|
}
|
|
@@ -167,7 +167,7 @@ var _default = ({
|
|
|
167
167
|
|
|
168
168
|
if (!enableHtmlEntry) {
|
|
169
169
|
chain.output.filename('index.js');
|
|
170
|
-
chain.plugins.delete(
|
|
170
|
+
chain.plugins.delete(`${CHAIN_ID.PLUGIN.HTML}-main`);
|
|
171
171
|
chain.optimization.runtimeChunk(false);
|
|
172
172
|
chain.optimization.splitChunks({
|
|
173
173
|
chunks: 'async'
|
|
@@ -189,7 +189,7 @@ var _default = ({
|
|
|
189
189
|
},
|
|
190
190
|
|
|
191
191
|
addRuntimeExports() {
|
|
192
|
-
const addExportStatement = `export { default as garfish, default as masterApp } from '${_mfPackagePath}'`;
|
|
192
|
+
const addExportStatement = `export { default as garfish, default as masterApp, hoistNonReactStatics } from '${_mfPackagePath}'`;
|
|
193
193
|
(0, _util.logger)('exportStatement', addExportStatement);
|
|
194
194
|
pluginsExportsUtils.addExport(addExportStatement);
|
|
195
195
|
runtimeExportsUtils.addExport(`export * from '${_mfPackagePath}'`);
|
|
@@ -220,6 +220,12 @@ var _default = ({
|
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
imports.push({
|
|
224
|
+
value: _runtimePluginName,
|
|
225
|
+
specifiers: [{
|
|
226
|
+
imported: 'hoistNonReactStatics'
|
|
227
|
+
}]
|
|
228
|
+
});
|
|
223
229
|
imports.push({
|
|
224
230
|
value: 'react-dom',
|
|
225
231
|
specifiers: [{
|
|
@@ -16,7 +16,7 @@ export const provider = function ({basename, dom}) {
|
|
|
16
16
|
const App = function () {
|
|
17
17
|
return React.createElement(SubApp, props)
|
|
18
18
|
};
|
|
19
|
-
bootstrap(App, node);
|
|
19
|
+
bootstrap(hoistNonReactStatics(App,SubApp), node);
|
|
20
20
|
},
|
|
21
21
|
destroy({ dom }) {
|
|
22
22
|
const node = dom.querySelector('#' + MOUNT_ID) || dom;
|
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "garfish", {
|
|
|
21
21
|
return _garfish.default;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "hoistNonReactStatics", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _hoistNonReactStatics.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "useModuleApp", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function () {
|
|
@@ -40,4 +46,6 @@ var _useModuleApps = require("./useModuleApps");
|
|
|
40
46
|
|
|
41
47
|
var _garfish = _interopRequireDefault(require("garfish"));
|
|
42
48
|
|
|
49
|
+
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
|
|
50
|
+
|
|
43
51
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
1
2
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { createRuntimeExportsUtils, PLUGIN_SCHEMAS } from '@modern-js/utils';
|
|
7
7
|
import { logger } from "../util";
|
|
@@ -44,10 +44,10 @@ export default (function () {
|
|
|
44
44
|
return PLUGIN_SCHEMAS['@modern-js/plugin-garfish'];
|
|
45
45
|
},
|
|
46
46
|
resolvedConfig: function () {
|
|
47
|
-
var _resolvedConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(config) {
|
|
47
|
+
var _resolvedConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(config) {
|
|
48
48
|
var resolved, _getRuntimeConfig, masterApp, router, nConfig, _router$historyOption;
|
|
49
49
|
|
|
50
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
50
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
51
51
|
while (1) {
|
|
52
52
|
switch (_context.prev = _context.next) {
|
|
53
53
|
case 0:
|
|
@@ -124,13 +124,13 @@ export default (function () {
|
|
|
124
124
|
'Access-Control-Allow-Origin': '*'
|
|
125
125
|
}
|
|
126
126
|
},
|
|
127
|
-
|
|
127
|
+
webpackChain: function webpackChain(chain, _ref3) {
|
|
128
128
|
var _resolveOptions$deplo, _resolveWebpackConfig;
|
|
129
129
|
|
|
130
|
-
var
|
|
131
|
-
_webpack = _ref3.webpack,
|
|
130
|
+
var webpack = _ref3.webpack,
|
|
132
131
|
_ref3$env = _ref3.env,
|
|
133
|
-
env = _ref3$env === void 0 ? process.env.NODE_ENV || 'development' : _ref3$env
|
|
132
|
+
env = _ref3$env === void 0 ? process.env.NODE_ENV || 'development' : _ref3$env,
|
|
133
|
+
CHAIN_ID = _ref3.CHAIN_ID;
|
|
134
134
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
135
135
|
var resolveOptions = useResolvedConfigContext();
|
|
136
136
|
|
|
@@ -139,13 +139,13 @@ export default (function () {
|
|
|
139
139
|
|
|
140
140
|
chain.output.libraryTarget('umd');
|
|
141
141
|
|
|
142
|
-
if (resolveOptions !== null && resolveOptions !== void 0 && (_resolveOptions$serve = resolveOptions.server) !== null && _resolveOptions$serve !== void 0 && _resolveOptions$serve.port) {
|
|
143
|
-
chain.output.publicPath(
|
|
142
|
+
if (resolveOptions !== null && resolveOptions !== void 0 && (_resolveOptions$serve = resolveOptions.server) !== null && _resolveOptions$serve !== void 0 && _resolveOptions$serve.port && env === 'development') {
|
|
143
|
+
chain.output.publicPath("//localhost:".concat(resolveOptions.server.port, "/"));
|
|
144
144
|
} // add comments avoid sourcemap abnormal
|
|
145
145
|
|
|
146
146
|
|
|
147
|
-
if (
|
|
148
|
-
chain.plugin(
|
|
147
|
+
if (webpack.BannerPlugin) {
|
|
148
|
+
chain.plugin(CHAIN_ID.PLUGIN.BANNER).use(webpack.BannerPlugin, [{
|
|
149
149
|
banner: 'Micro front-end'
|
|
150
150
|
}]);
|
|
151
151
|
}
|
|
@@ -162,7 +162,7 @@ export default (function () {
|
|
|
162
162
|
|
|
163
163
|
if (!_enableHtmlEntry) {
|
|
164
164
|
chain.output.filename('index.js');
|
|
165
|
-
chain.plugins["delete"](
|
|
165
|
+
chain.plugins["delete"]("".concat(CHAIN_ID.PLUGIN.HTML, "-main"));
|
|
166
166
|
chain.optimization.runtimeChunk(false);
|
|
167
167
|
chain.optimization.splitChunks({
|
|
168
168
|
chunks: 'async'
|
|
@@ -183,7 +183,7 @@ export default (function () {
|
|
|
183
183
|
};
|
|
184
184
|
},
|
|
185
185
|
addRuntimeExports: function addRuntimeExports() {
|
|
186
|
-
var addExportStatement = "export { default as garfish, default as masterApp } from '".concat(mfPackagePath, "'");
|
|
186
|
+
var addExportStatement = "export { default as garfish, default as masterApp, hoistNonReactStatics } from '".concat(mfPackagePath, "'");
|
|
187
187
|
logger('exportStatement', addExportStatement);
|
|
188
188
|
pluginsExportsUtils.addExport(addExportStatement);
|
|
189
189
|
runtimeExportsUtils.addExport("export * from '".concat(mfPackagePath, "'"));
|
|
@@ -212,6 +212,12 @@ export default (function () {
|
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
imports.push({
|
|
216
|
+
value: runtimePluginName,
|
|
217
|
+
specifiers: [{
|
|
218
|
+
imported: 'hoistNonReactStatics'
|
|
219
|
+
}]
|
|
220
|
+
});
|
|
215
221
|
imports.push({
|
|
216
222
|
value: 'react-dom',
|
|
217
223
|
specifiers: [{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export var makeProvider = function makeProvider() {
|
|
2
|
-
return "\nexport const provider = function ({basename, dom}) {\n return {\n render({basename, dom, props}) {\n const SubApp = render({ props, basename });\n const node = dom.querySelector('#' + MOUNT_ID) || dom;\n const App = function () {\n return React.createElement(SubApp, props)\n };\n bootstrap(App, node);\n },\n destroy({ dom }) {\n const node = dom.querySelector('#' + MOUNT_ID) || dom;\n\n if (node) {\n unmountComponentAtNode(node);\n }\n },\n SubModuleComponent: (props) => {\n const SubApp = render({props, basename});\n\n return createPortal(<SubApp />, dom.querySelector('#' + MOUNT_ID) || dom);\n },\n jupiter_submodule_app_key: (props) => {\n const SubApp = render({props, basename});\n\n return createPortal(<SubApp />, dom.querySelector('#' + MOUNT_ID) || dom);\n }\n }\n};\n\nif (typeof __GARFISH_EXPORTS__ !== 'undefined') {\n __GARFISH_EXPORTS__.provider = provider;\n}\n";
|
|
2
|
+
return "\nexport const provider = function ({basename, dom}) {\n return {\n render({basename, dom, props}) {\n const SubApp = render({ props, basename });\n const node = dom.querySelector('#' + MOUNT_ID) || dom;\n const App = function () {\n return React.createElement(SubApp, props)\n };\n bootstrap(hoistNonReactStatics(App,SubApp), node);\n },\n destroy({ dom }) {\n const node = dom.querySelector('#' + MOUNT_ID) || dom;\n\n if (node) {\n unmountComponentAtNode(node);\n }\n },\n SubModuleComponent: (props) => {\n const SubApp = render({props, basename});\n\n return createPortal(<SubApp />, dom.querySelector('#' + MOUNT_ID) || dom);\n },\n jupiter_submodule_app_key: (props) => {\n const SubApp = render({props, basename});\n\n return createPortal(<SubApp />, dom.querySelector('#' + MOUNT_ID) || dom);\n }\n }\n};\n\nif (typeof __GARFISH_EXPORTS__ !== 'undefined') {\n __GARFISH_EXPORTS__.provider = provider;\n}\n";
|
|
3
3
|
};
|
|
4
4
|
export var makeRenderFunction = function makeRenderFunction(code) {
|
|
5
5
|
var inGarfishToRender = "\n const { basename, props } = arguments[0] || {};\n let renderByGarfish = false;\n const renderByProvider = !!basename;\n\n if (IS_BROWSER && window.Garfish && window.Garfish.activeApps && window.Garfish.activeApps.length !== 0) renderByGarfish = true;\n if (IS_BROWSER && window.Garfish && window.Garfish.apps && Object.keys(window.Garfish.apps).length !== 0) renderByGarfish = true;\n if (typeof __GARFISH_EXPORTS__ !== 'undefined') renderByGarfish = true;\n if (renderByGarfish && !renderByProvider) return null;\n\n function RouterPlugin (routerConfig) {\n if (basename) {\n routerConfig.basename = basename;\n if (routerConfig.supportHtml5History !== false) {\n if (!routerConfig.historyOptions) {\n routerConfig.historyOptions = {\n basename: basename\n };\n } else {\n routerConfig.historyOptions.basename = basename;\n }\n }\n }\n return router(routerConfig);\n }\n ";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default } from "./plugin";
|
|
2
2
|
export { useModuleApps, useModuleApp } from "./useModuleApps";
|
|
3
|
-
export { default as Garfish, default as garfish } from 'garfish';
|
|
3
|
+
export { default as Garfish, default as garfish } from 'garfish';
|
|
4
|
+
export { default as hoistNonReactStatics } from 'hoist-non-react-statics';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
5
|
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
@@ -8,7 +9,6 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
8
9
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
9
10
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
10
11
|
var _excluded = ["manifest"];
|
|
11
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
14
14
|
import { logger } from "../util";
|
|
@@ -24,7 +24,7 @@ function initOptions() {
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
function _initOptions() {
|
|
27
|
-
_initOptions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
27
|
+
_initOptions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
28
28
|
var _window, _window$modern_manife, _window2, _window2$modern_manif;
|
|
29
29
|
|
|
30
30
|
var manifest,
|
|
@@ -35,7 +35,7 @@ function _initOptions() {
|
|
|
35
35
|
_window3$modern_manif,
|
|
36
36
|
_args2 = arguments;
|
|
37
37
|
|
|
38
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
38
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
39
39
|
while (1) {
|
|
40
40
|
switch (_context2.prev = _context2.next) {
|
|
41
41
|
case 0:
|
|
@@ -133,10 +133,10 @@ export default (function (config) {
|
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
var load = /*#__PURE__*/function () {
|
|
136
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
136
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
137
137
|
var GarfishConfig, MApp, _generateApps, appInfoList, apps;
|
|
138
138
|
|
|
139
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
139
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
140
140
|
while (1) {
|
|
141
141
|
switch (_context.prev = _context.next) {
|
|
142
142
|
case 0:
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
1
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
@@ -9,7 +10,6 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
9
10
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
10
11
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
11
12
|
var _excluded = ["match", "history", "setLoadingState"];
|
|
12
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
13
|
// The loading logic of the current component refers to react-loadable https://github.com/jamiebuilds/react-loadable
|
|
14
14
|
import path from 'path';
|
|
15
15
|
import React from 'react'; // eslint-disable-next-line import/no-named-as-default
|
|
@@ -60,10 +60,10 @@ function getAppInstance(options, appInfo, manifest) {
|
|
|
60
60
|
key: "UNSAFE_componentWillMount",
|
|
61
61
|
value: // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
62
62
|
function () {
|
|
63
|
-
var _UNSAFE_componentWillMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
63
|
+
var _UNSAFE_componentWillMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
64
64
|
var _this$props, match, history, setLoadingState, userProps, domId, loadAppOptions, appInstance;
|
|
65
65
|
|
|
66
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
66
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
67
67
|
while (1) {
|
|
68
68
|
switch (_context.prev = _context.next) {
|
|
69
69
|
case 0:
|
|
@@ -188,12 +188,12 @@ function getAppInstance(options, appInfo, manifest) {
|
|
|
188
188
|
}, {
|
|
189
189
|
key: "componentWillUnmount",
|
|
190
190
|
value: function () {
|
|
191
|
-
var _componentWillUnmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
191
|
+
var _componentWillUnmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
192
192
|
var _this$unregisterHisto;
|
|
193
193
|
|
|
194
194
|
var appInstance, _appInfo;
|
|
195
195
|
|
|
196
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
196
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
197
197
|
while (1) {
|
|
198
198
|
switch (_context2.prev = _context2.next) {
|
|
199
199
|
case 0:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default } from './plugin';
|
|
2
2
|
export { useModuleApps, useModuleApp } from './useModuleApps';
|
|
3
3
|
export type { Manifest, ModuleInfo } from './useModuleApps';
|
|
4
|
-
export { default as Garfish, default as garfish } from 'garfish';
|
|
4
|
+
export { default as Garfish, default as garfish } from 'garfish';
|
|
5
|
+
export { default as hoistNonReactStatics } from 'hoist-non-react-statics';
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
export declare type Options = typeof garfish.options;
|
|
4
4
|
export declare type ModuleInfo = GarfishInterfaces.AppInfo & {
|
|
5
5
|
Component?: React.ComponentType | React.ElementType;
|
|
6
|
+
path?: string;
|
|
6
7
|
originInfo?: Record<string, unknown>;
|
|
7
8
|
};
|
|
8
9
|
export declare type ModulesInfo = Array<ModuleInfo>;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.5.2",
|
|
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",
|
|
53
|
-
"@modern-js/utils": "^1.7.
|
|
53
|
+
"@modern-js/utils": "^1.7.5",
|
|
54
54
|
"@types/debug": "^4.1.7",
|
|
55
55
|
"@types/react-loadable": "^5.5.6",
|
|
56
56
|
"debug": "^4.3.2",
|
|
@@ -58,11 +58,19 @@
|
|
|
58
58
|
"hoist-non-react-statics": "^3.3.2",
|
|
59
59
|
"react-loadable": "^5.5.0"
|
|
60
60
|
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"@modern-js/plugin-router": "^1.2.15"
|
|
63
|
+
},
|
|
64
|
+
"peerDependenciesMeta": {
|
|
65
|
+
"@modern-js/plugin-router": {
|
|
66
|
+
"optional": true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
61
69
|
"devDependencies": {
|
|
62
|
-
"@modern-js/core": "1.
|
|
63
|
-
"@modern-js/plugin-router": "1.2.
|
|
64
|
-
"@modern-js/runtime-core": "1.4.
|
|
65
|
-
"@modern-js/types": "1.5.
|
|
70
|
+
"@modern-js/core": "1.11.2",
|
|
71
|
+
"@modern-js/plugin-router": "1.2.15",
|
|
72
|
+
"@modern-js/runtime-core": "1.4.9",
|
|
73
|
+
"@modern-js/types": "1.5.4",
|
|
66
74
|
"@scripts/build": "0.0.0",
|
|
67
75
|
"@scripts/jest-config": "0.0.0",
|
|
68
76
|
"@testing-library/jest-dom": "^5.16.1",
|
|
@@ -82,17 +90,11 @@
|
|
|
82
90
|
"typescript": "^4",
|
|
83
91
|
"webpack-chain": "^6.5.1"
|
|
84
92
|
},
|
|
85
|
-
"peerDependencies": {
|
|
86
|
-
"@modern-js/plugin-router": "^1.2.14",
|
|
87
|
-
"@modern-js/runtime-core": "^1.4.6",
|
|
88
|
-
"react": "^17"
|
|
89
|
-
},
|
|
90
93
|
"sideEffects": false,
|
|
91
94
|
"modernConfig": {},
|
|
92
95
|
"publishConfig": {
|
|
93
96
|
"registry": "https://registry.npmjs.org/",
|
|
94
|
-
"access": "public"
|
|
95
|
-
"types": "./dist/types/runtime/index.d.ts"
|
|
97
|
+
"access": "public"
|
|
96
98
|
},
|
|
97
99
|
"wireit": {
|
|
98
100
|
"build": {
|