@modern-js/plugin-garfish 2.48.0 → 2.48.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.
@@ -31,7 +31,6 @@ __export(plugin_exports, {
31
31
  default: () => plugin_default
32
32
  });
33
33
  module.exports = __toCommonJS(plugin_exports);
34
- var import_define_property = require("@swc/helpers/_/_define_property");
35
34
  var import_jsx_runtime = require("react/jsx-runtime");
36
35
  var import_garfish = __toESM(require("garfish"));
37
36
  var import_react = __toESM(require("react"));
@@ -88,7 +87,7 @@ var plugin_default = (config) => ({
88
87
  }
89
88
  constructor(props) {
90
89
  super(props);
91
- (0, import_define_property._)(this, "state", {
90
+ this.state = {
92
91
  MApp: () => {
93
92
  (0, import_util.logger)("MApp init Component Render");
94
93
  return /* @__PURE__ */ import_react.default.createElement("div");
@@ -99,7 +98,7 @@ var plugin_default = (config) => ({
99
98
  }
100
99
  }),
101
100
  appInfoList: []
102
- });
101
+ };
103
102
  const load = async () => {
104
103
  import_garfish.default.setOptions({
105
104
  ...options,
@@ -31,7 +31,6 @@ __export(MApp_exports, {
31
31
  generateMApp: () => generateMApp
32
32
  });
33
33
  module.exports = __toCommonJS(MApp_exports);
34
- var import_define_property = require("@swc/helpers/_/_define_property");
35
34
  var import_jsx_runtime = require("react/jsx-runtime");
36
35
  var import_react = __toESM(require("react"));
37
36
  var import_garfish = __toESM(require("garfish"));
@@ -166,9 +165,9 @@ function generateMApp(options, manifest) {
166
165
  }
167
166
  constructor(...args) {
168
167
  super(...args);
169
- (0, import_define_property._)(this, "state", {
168
+ this.state = {
170
169
  domId: (0, import_util.generateSubAppContainerKey)()
171
- });
170
+ };
172
171
  }
173
172
  }
174
173
  return (0, import_loadable.Loadable)(MApp)(manifest === null || manifest === void 0 ? void 0 : manifest.loadable);
@@ -1,8 +1,6 @@
1
1
  import { _ as _assert_this_initialized } from "@swc/helpers/_/_assert_this_initialized";
2
2
  import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
3
3
  import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
4
- import { _ as _create_class } from "@swc/helpers/_/_create_class";
5
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
6
4
  import { _ as _inherits } from "@swc/helpers/_/_inherits";
7
5
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
8
6
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
@@ -91,7 +89,7 @@ function plugin_default(config) {
91
89
  _class_call_check(this, GetMicroFrontendApp2);
92
90
  var _this;
93
91
  _this = _super.call(this, props);
94
- _define_property(_assert_this_initialized(_this), "state", {
92
+ _this.state = {
95
93
  MApp: function() {
96
94
  logger("MApp init Component Render");
97
95
  return /* @__PURE__ */ React.createElement("div");
@@ -104,7 +102,7 @@ function plugin_default(config) {
104
102
  }
105
103
  }),
106
104
  appInfoList: []
107
- });
105
+ };
108
106
  var _this1 = _assert_this_initialized(_this);
109
107
  var load = function() {
110
108
  var _ref = _async_to_generator(function() {
@@ -154,18 +152,14 @@ function plugin_default(config) {
154
152
  load();
155
153
  return _this;
156
154
  }
157
- _create_class(GetMicroFrontendApp2, [
158
- {
159
- key: "render",
160
- value: function render() {
161
- logger("GarfishProvider state", this.state);
162
- return /* @__PURE__ */ _jsx(GarfishProvider, {
163
- value: this.state,
164
- children: /* @__PURE__ */ _jsx(App, _object_spread({}, this.props))
165
- });
166
- }
167
- }
168
- ]);
155
+ var _proto = GetMicroFrontendApp2.prototype;
156
+ _proto.render = function render() {
157
+ logger("GarfishProvider state", this.state);
158
+ return /* @__PURE__ */ _jsx(GarfishProvider, {
159
+ value: this.state,
160
+ children: /* @__PURE__ */ _jsx(App, _object_spread({}, this.props))
161
+ });
162
+ };
169
163
  return GetMicroFrontendApp2;
170
164
  }(React.Component);
171
165
  return next({
@@ -1,7 +1,4 @@
1
- import { _ as _assert_this_initialized } from "@swc/helpers/_/_assert_this_initialized";
2
1
  import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
3
- import { _ as _create_class } from "@swc/helpers/_/_create_class";
4
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
5
2
  import { _ as _inherits } from "@swc/helpers/_/_inherits";
6
3
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
7
4
  import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
@@ -21,174 +18,161 @@ function generateMApp(options, manifest) {
21
18
  _class_call_check(this, MApp2);
22
19
  var _this;
23
20
  _this = _super.apply(this, arguments);
24
- _define_property(_assert_this_initialized(_this), "state", {
21
+ _this.state = {
25
22
  domId: generateSubAppContainerKey()
26
- });
23
+ };
27
24
  return _this;
28
25
  }
29
- _create_class(MApp2, [
30
- {
31
- key: "componentDidMount",
32
- value: function componentDidMount() {
33
- var _this = this;
34
- var domId = this.state.domId;
35
- var setLoadingState = this.props.setLoadingState;
36
- var beforeLoad = options.beforeLoad, beforeMount = options.beforeMount, errorLoadApp = options.errorLoadApp, errorMountApp = options.errorMountApp, errorUnmountApp = options.errorUnmountApp;
37
- Garfish.router.setRouterConfig({
38
- listening: true
39
- });
40
- var garfishOptions = {
41
- domGetter: "#".concat(domId),
42
- beforeLoad: function beforeLoad1(appInfo) {
43
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
44
- args[_key - 1] = arguments[_key];
45
- }
46
- logger("MApp beforeLoad", [
47
- appInfo
48
- ]);
49
- if (appInfo.activeWhen) {
50
- setLoadingState({
51
- isLoading: true,
52
- error: null
53
- });
54
- }
55
- return beforeLoad === null || beforeLoad === void 0 ? void 0 : beforeLoad.apply(void 0, [
56
- appInfo
57
- ].concat(_to_consumable_array(args)));
58
- },
59
- beforeMount: function beforeMount1(appInfo) {
60
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
61
- args[_key - 1] = arguments[_key];
62
- }
63
- logger("MApp beforeMount", args);
64
- if (appInfo.activeWhen) {
65
- setLoadingState({
66
- isLoading: false
67
- });
68
- }
69
- return beforeMount === null || beforeMount === void 0 ? void 0 : beforeMount.apply(void 0, [
70
- appInfo
71
- ].concat(_to_consumable_array(args)));
72
- },
73
- errorLoadApp: function errorLoadApp1(error, appInfo) {
74
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
75
- args[_key - 2] = arguments[_key];
76
- }
77
- logger("MApp errorLoadApp", error, args);
78
- if (appInfo.activeWhen) {
79
- setLoadingState({
80
- error
81
- });
82
- }
83
- return errorLoadApp === null || errorLoadApp === void 0 ? void 0 : errorLoadApp.apply(void 0, [
84
- error,
85
- appInfo
86
- ].concat(_to_consumable_array(args)));
87
- },
88
- errorMountApp: function errorMountApp1(error, appInfo) {
89
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
90
- args[_key - 2] = arguments[_key];
91
- }
92
- logger("MApp errorMountApp", error, args);
93
- if (appInfo.activeWhen) {
94
- setLoadingState({
95
- error
26
+ var _proto = MApp2.prototype;
27
+ _proto.componentDidMount = function componentDidMount() {
28
+ var _this = this;
29
+ var domId = this.state.domId;
30
+ var setLoadingState = this.props.setLoadingState;
31
+ var beforeLoad = options.beforeLoad, beforeMount = options.beforeMount, errorLoadApp = options.errorLoadApp, errorMountApp = options.errorMountApp, errorUnmountApp = options.errorUnmountApp;
32
+ Garfish.router.setRouterConfig({
33
+ listening: true
34
+ });
35
+ var garfishOptions = {
36
+ domGetter: "#".concat(domId),
37
+ beforeLoad: function beforeLoad1(appInfo) {
38
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
39
+ args[_key - 1] = arguments[_key];
40
+ }
41
+ logger("MApp beforeLoad", [
42
+ appInfo
43
+ ]);
44
+ if (appInfo.activeWhen) {
45
+ setLoadingState({
46
+ isLoading: true,
47
+ error: null
48
+ });
49
+ }
50
+ return beforeLoad === null || beforeLoad === void 0 ? void 0 : beforeLoad.apply(void 0, [
51
+ appInfo
52
+ ].concat(_to_consumable_array(args)));
53
+ },
54
+ beforeMount: function beforeMount1(appInfo) {
55
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
56
+ args[_key - 1] = arguments[_key];
57
+ }
58
+ logger("MApp beforeMount", args);
59
+ if (appInfo.activeWhen) {
60
+ setLoadingState({
61
+ isLoading: false
62
+ });
63
+ }
64
+ return beforeMount === null || beforeMount === void 0 ? void 0 : beforeMount.apply(void 0, [
65
+ appInfo
66
+ ].concat(_to_consumable_array(args)));
67
+ },
68
+ errorLoadApp: function errorLoadApp1(error, appInfo) {
69
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
70
+ args[_key - 2] = arguments[_key];
71
+ }
72
+ logger("MApp errorLoadApp", error, args);
73
+ if (appInfo.activeWhen) {
74
+ setLoadingState({
75
+ error
76
+ });
77
+ }
78
+ return errorLoadApp === null || errorLoadApp === void 0 ? void 0 : errorLoadApp.apply(void 0, [
79
+ error,
80
+ appInfo
81
+ ].concat(_to_consumable_array(args)));
82
+ },
83
+ errorMountApp: function errorMountApp1(error, appInfo) {
84
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
85
+ args[_key - 2] = arguments[_key];
86
+ }
87
+ logger("MApp errorMountApp", error, args);
88
+ if (appInfo.activeWhen) {
89
+ setLoadingState({
90
+ error
91
+ });
92
+ }
93
+ return errorMountApp === null || errorMountApp === void 0 ? void 0 : errorMountApp.apply(void 0, [
94
+ error,
95
+ appInfo
96
+ ].concat(_to_consumable_array(args)));
97
+ },
98
+ errorUnmountApp: function errorUnmountApp1(error, appInfo) {
99
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
100
+ args[_key - 2] = arguments[_key];
101
+ }
102
+ logger("MApp errorUnmountApp", error, args);
103
+ if (appInfo.activeWhen) {
104
+ setLoadingState({
105
+ error
106
+ });
107
+ }
108
+ return errorUnmountApp === null || errorUnmountApp === void 0 ? void 0 : errorUnmountApp.apply(void 0, [
109
+ error,
110
+ appInfo
111
+ ].concat(_to_consumable_array(args)));
112
+ },
113
+ customLoader: function(provider) {
114
+ var render = provider.render, destroy = provider.destroy, SubModuleComponent = provider.SubModuleComponent, jupiter_submodule_app_key = provider.jupiter_submodule_app_key;
115
+ var componetRenderMode = (manifest === null || manifest === void 0 ? void 0 : manifest.componentRender) && (SubModuleComponent || jupiter_submodule_app_key);
116
+ return {
117
+ mount: function(appInfo) {
118
+ var transferProps = _this.filterTransferProps();
119
+ appInfo.props = _object_spread({}, appInfo.props, transferProps);
120
+ if (componetRenderMode) {
121
+ _this.setState({
122
+ SubModuleComponent: SubModuleComponent !== null && SubModuleComponent !== void 0 ? SubModuleComponent : jupiter_submodule_app_key
96
123
  });
124
+ return void 0;
125
+ } else {
126
+ logger("MicroApp customer render", appInfo);
127
+ return render === null || render === void 0 ? void 0 : render.apply(provider, [
128
+ appInfo
129
+ ]);
97
130
  }
98
- return errorMountApp === null || errorMountApp === void 0 ? void 0 : errorMountApp.apply(void 0, [
99
- error,
100
- appInfo
101
- ].concat(_to_consumable_array(args)));
102
131
  },
103
- errorUnmountApp: function errorUnmountApp1(error, appInfo) {
104
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
105
- args[_key - 2] = arguments[_key];
106
- }
107
- logger("MApp errorUnmountApp", error, args);
108
- if (appInfo.activeWhen) {
109
- setLoadingState({
110
- error
111
- });
132
+ unmount: function(appInfo) {
133
+ var transferProps = _this.filterTransferProps();
134
+ appInfo.props = _object_spread({}, appInfo.props, transferProps);
135
+ if (componetRenderMode) {
136
+ return void 0;
112
137
  }
113
- return errorUnmountApp === null || errorUnmountApp === void 0 ? void 0 : errorUnmountApp.apply(void 0, [
114
- error,
138
+ logger("MicroApp customer destroy", appInfo);
139
+ return destroy === null || destroy === void 0 ? void 0 : destroy.apply(provider, [
115
140
  appInfo
116
- ].concat(_to_consumable_array(args)));
117
- },
118
- customLoader: function(provider) {
119
- var render = provider.render, destroy = provider.destroy, SubModuleComponent = provider.SubModuleComponent, jupiter_submodule_app_key = provider.jupiter_submodule_app_key;
120
- var componetRenderMode = (manifest === null || manifest === void 0 ? void 0 : manifest.componentRender) && (SubModuleComponent || jupiter_submodule_app_key);
121
- return {
122
- mount: function(appInfo) {
123
- var transferProps = _this.filterTransferProps();
124
- appInfo.props = _object_spread({}, appInfo.props, transferProps);
125
- if (componetRenderMode) {
126
- _this.setState({
127
- SubModuleComponent: SubModuleComponent !== null && SubModuleComponent !== void 0 ? SubModuleComponent : jupiter_submodule_app_key
128
- });
129
- return void 0;
130
- } else {
131
- logger("MicroApp customer render", appInfo);
132
- return render === null || render === void 0 ? void 0 : render.apply(provider, [
133
- appInfo
134
- ]);
135
- }
136
- },
137
- unmount: function(appInfo) {
138
- var transferProps = _this.filterTransferProps();
139
- appInfo.props = _object_spread({}, appInfo.props, transferProps);
140
- if (componetRenderMode) {
141
- return void 0;
142
- }
143
- logger("MicroApp customer destroy", appInfo);
144
- return destroy === null || destroy === void 0 ? void 0 : destroy.apply(provider, [
145
- appInfo
146
- ]);
147
- }
148
- };
141
+ ]);
149
142
  }
150
143
  };
151
- logger("MApp componentDidMount", {
152
- garfishRunning: Garfish.running,
153
- garfishOptions
154
- });
155
- if (!Garfish.running) {
156
- Garfish.run(garfishOptions);
157
- }
158
- }
159
- },
160
- {
161
- key: "componentWillUnmount",
162
- value: function componentWillUnmount() {
163
- Garfish.router.setRouterConfig({
164
- listening: false
165
- });
166
- logger("MApp componentWillUnmount");
167
- }
168
- },
169
- {
170
- key: "filterTransferProps",
171
- value: function filterTransferProps() {
172
- var _this_props = this.props, style = _this_props.style, setLoadingState = _this_props.setLoadingState, others = _object_without_properties(_this_props, [
173
- "style",
174
- "setLoadingState"
175
- ]);
176
- return others;
177
- }
178
- },
179
- {
180
- key: "render",
181
- value: function render() {
182
- var style = this.props.style;
183
- var SubModuleComponent = this.state.SubModuleComponent;
184
- return /* @__PURE__ */ _jsx("div", {
185
- style: _object_spread({}, style),
186
- id: generateSubAppContainerKey(),
187
- children: SubModuleComponent && /* @__PURE__ */ _jsx(SubModuleComponent, {})
188
- });
189
144
  }
145
+ };
146
+ logger("MApp componentDidMount", {
147
+ garfishRunning: Garfish.running,
148
+ garfishOptions
149
+ });
150
+ if (!Garfish.running) {
151
+ Garfish.run(garfishOptions);
190
152
  }
191
- ]);
153
+ };
154
+ _proto.componentWillUnmount = function componentWillUnmount() {
155
+ Garfish.router.setRouterConfig({
156
+ listening: false
157
+ });
158
+ logger("MApp componentWillUnmount");
159
+ };
160
+ _proto.filterTransferProps = function filterTransferProps() {
161
+ var _this_props = this.props, style = _this_props.style, setLoadingState = _this_props.setLoadingState, others = _object_without_properties(_this_props, [
162
+ "style",
163
+ "setLoadingState"
164
+ ]);
165
+ return others;
166
+ };
167
+ _proto.render = function render() {
168
+ var style = this.props.style;
169
+ var SubModuleComponent = this.state.SubModuleComponent;
170
+ return /* @__PURE__ */ _jsx("div", {
171
+ style: _object_spread({}, style),
172
+ id: generateSubAppContainerKey(),
173
+ children: SubModuleComponent && /* @__PURE__ */ _jsx(SubModuleComponent, {})
174
+ });
175
+ };
192
176
  return MApp2;
193
177
  }(React.Component);
194
178
  return Loadable(MApp)(manifest === null || manifest === void 0 ? void 0 : manifest.loadable);
@@ -1,4 +1,3 @@
1
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import GarfishInstance from "garfish";
4
3
  import React from "react";
@@ -55,7 +54,7 @@ var plugin_default = (config) => ({
55
54
  }
56
55
  constructor(props) {
57
56
  super(props);
58
- _define_property(this, "state", {
57
+ this.state = {
59
58
  MApp: () => {
60
59
  logger("MApp init Component Render");
61
60
  return /* @__PURE__ */ React.createElement("div");
@@ -66,7 +65,7 @@ var plugin_default = (config) => ({
66
65
  }
67
66
  }),
68
67
  appInfoList: []
69
- });
68
+ };
70
69
  const load = async () => {
71
70
  GarfishInstance.setOptions({
72
71
  ...options,
@@ -1,4 +1,3 @@
1
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import React from "react";
4
3
  import Garfish from "garfish";
@@ -133,9 +132,9 @@ function generateMApp(options, manifest) {
133
132
  }
134
133
  constructor(...args) {
135
134
  super(...args);
136
- _define_property(this, "state", {
135
+ this.state = {
137
136
  domId: generateSubAppContainerKey()
138
- });
137
+ };
139
138
  }
140
139
  }
141
140
  return Loadable(MApp)(manifest === null || manifest === void 0 ? void 0 : manifest.loadable);
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.48.0",
18
+ "version": "2.48.1",
19
19
  "jsnext:source": "./src/cli/index.ts",
20
20
  "types": "./dist/types/cli/index.d.ts",
21
21
  "typesVersions": {
@@ -70,15 +70,15 @@
70
70
  "hoist-non-react-statics": "^3.3.2",
71
71
  "react-loadable": "^5.5.0",
72
72
  "@swc/helpers": "0.5.3",
73
- "@modern-js/utils": "2.48.0"
73
+ "@modern-js/utils": "2.48.1"
74
74
  },
75
75
  "peerDependencies": {
76
- "@modern-js/runtime": "^2.48.0",
76
+ "@modern-js/runtime": "^2.48.1",
77
77
  "react": ">=17",
78
78
  "react-dom": ">=17"
79
79
  },
80
80
  "devDependencies": {
81
- "@rsbuild/shared": "0.4.8",
81
+ "@rsbuild/shared": "0.4.15",
82
82
  "@testing-library/dom": "^8.14.0",
83
83
  "@testing-library/jest-dom": "^5.16.1",
84
84
  "@testing-library/react": "^13.4.0",
@@ -93,13 +93,13 @@
93
93
  "react-dom": "^18",
94
94
  "react-router-dom": "6.22.0",
95
95
  "typescript": "^5",
96
- "@modern-js/core": "2.48.0",
97
- "@modern-js/app-tools": "2.48.0",
98
- "@modern-js/plugin-router-v5": "2.48.0",
99
- "@modern-js/runtime": "2.48.0",
100
- "@modern-js/types": "2.48.0",
101
- "@scripts/build": "2.48.0",
102
- "@scripts/jest-config": "2.48.0"
96
+ "@modern-js/core": "2.48.1",
97
+ "@modern-js/app-tools": "2.48.1",
98
+ "@modern-js/plugin-router-v5": "2.48.1",
99
+ "@modern-js/runtime": "2.48.1",
100
+ "@modern-js/types": "2.48.1",
101
+ "@scripts/build": "2.48.1",
102
+ "@scripts/jest-config": "2.48.1"
103
103
  },
104
104
  "sideEffects": false,
105
105
  "publishConfig": {