@modern-js/plugin-garfish 1.5.1 → 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 CHANGED
@@ -1,5 +1,14 @@
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
+
3
12
  ## 1.5.1
4
13
 
5
14
  ### Patch Changes
@@ -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';
@@ -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:
@@ -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';
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.5.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.6",
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,10 +58,18 @@
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.11.1",
63
- "@modern-js/plugin-router": "1.2.14",
64
- "@modern-js/runtime-core": "1.4.7",
70
+ "@modern-js/core": "1.11.2",
71
+ "@modern-js/plugin-router": "1.2.15",
72
+ "@modern-js/runtime-core": "1.4.9",
65
73
  "@modern-js/types": "1.5.4",
66
74
  "@scripts/build": "0.0.0",
67
75
  "@scripts/jest-config": "0.0.0",
@@ -82,11 +90,6 @@
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.7",
88
- "react": "^17"
89
- },
90
93
  "sideEffects": false,
91
94
  "modernConfig": {},
92
95
  "publishConfig": {