@modern-js/plugin-garfish 2.0.0-beta.3 → 2.0.0-beta.4

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/js/modern/cli/index.js +164 -157
  3. package/dist/js/modern/cli/utils.js +31 -23
  4. package/dist/js/modern/global.d.js +0 -0
  5. package/dist/js/modern/index.js +5 -2
  6. package/dist/js/modern/modern-app.env.d.js +0 -0
  7. package/dist/js/modern/runtime/global.d.js +0 -0
  8. package/dist/js/modern/runtime/index.js +12 -4
  9. package/dist/js/modern/runtime/loadable.js +74 -56
  10. package/dist/js/modern/runtime/plugin.js +114 -79
  11. package/dist/js/modern/runtime/useModuleApps.js +40 -26
  12. package/dist/js/modern/runtime/utils/Context.js +6 -3
  13. package/dist/js/modern/runtime/utils/MApp.js +76 -72
  14. package/dist/js/modern/runtime/utils/apps.js +177 -142
  15. package/dist/js/modern/runtime/utils/setExternal.js +11 -11
  16. package/dist/js/modern/type.d.js +0 -0
  17. package/dist/js/modern/util.js +11 -9
  18. package/dist/js/node/cli/index.js +184 -168
  19. package/dist/js/node/cli/utils.js +45 -30
  20. package/dist/js/node/global.d.js +0 -0
  21. package/dist/js/node/index.js +29 -24
  22. package/dist/js/node/modern-app.env.d.js +0 -0
  23. package/dist/js/node/runtime/global.d.js +0 -0
  24. package/dist/js/node/runtime/index.js +35 -44
  25. package/dist/js/node/runtime/loadable.js +95 -61
  26. package/dist/js/node/runtime/plugin.js +147 -95
  27. package/dist/js/node/runtime/useModuleApps.js +64 -34
  28. package/dist/js/node/runtime/utils/Context.js +30 -10
  29. package/dist/js/node/runtime/utils/MApp.js +107 -84
  30. package/dist/js/node/runtime/utils/apps.js +204 -146
  31. package/dist/js/node/runtime/utils/setExternal.js +35 -18
  32. package/dist/js/node/type.d.js +0 -0
  33. package/dist/js/node/util.js +34 -19
  34. package/dist/js/treeshaking/cli/index.js +402 -284
  35. package/dist/js/treeshaking/cli/utils.js +28 -31
  36. package/dist/js/treeshaking/global.d.js +1 -0
  37. package/dist/js/treeshaking/index.js +3 -2
  38. package/dist/js/treeshaking/modern-app.env.d.js +1 -0
  39. package/dist/js/treeshaking/runtime/global.d.js +1 -0
  40. package/dist/js/treeshaking/runtime/index.js +5 -4
  41. package/dist/js/treeshaking/runtime/loadable.js +230 -109
  42. package/dist/js/treeshaking/runtime/plugin.js +469 -168
  43. package/dist/js/treeshaking/runtime/useModuleApps.js +55 -31
  44. package/dist/js/treeshaking/runtime/utils/Context.js +3 -3
  45. package/dist/js/treeshaking/runtime/utils/MApp.js +348 -180
  46. package/dist/js/treeshaking/runtime/utils/apps.js +536 -230
  47. package/dist/js/treeshaking/runtime/utils/setExternal.js +12 -11
  48. package/dist/js/treeshaking/type.d.js +1 -0
  49. package/dist/js/treeshaking/util.js +7 -9
  50. package/dist/types/cli/index.d.ts +2 -0
  51. package/dist/types/runtime/plugin.d.ts +2 -0
  52. package/dist/types/runtime/utils/setExternal.d.ts +1 -0
  53. package/package.json +10 -10
@@ -1,64 +1,76 @@
1
- const _excluded = ["loadable"];
2
- 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; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
- // logical reference to https://github.com/jamiebuilds/react-loadable/blob/6201c5837b212d6244c57f3748f2b1375096beeb/src/index.js
8
- import { useState, useEffect, useCallback } from 'react';
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
33
+ import { useState, useEffect, useCallback } from "react";
9
34
  import { logger } from "../util";
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- import { Fragment as _Fragment } from "react/jsx-runtime";
12
- import { jsxs as _jsxs } from "react/jsx-runtime";
13
35
  const DEFAULT_LOADABLE = {
14
36
  delay: 200,
15
- timeout: 10000,
37
+ timeout: 1e4,
16
38
  loading: null
17
39
  };
18
- export function Loadable(WrapComponent) {
19
- return function (defaultLoadable) {
40
+ function Loadable(WrapComponent) {
41
+ return function(defaultLoadable) {
20
42
  return function Lodable(props) {
21
- var _props$loadable;
22
- const {
23
- loadable = defaultLoadable !== null && defaultLoadable !== void 0 ? defaultLoadable : DEFAULT_LOADABLE
24
- } = props,
25
- otherProps = _objectWithoutProperties(props, _excluded);
43
+ var _b;
44
+ const _a = props, { loadable = defaultLoadable != null ? defaultLoadable : DEFAULT_LOADABLE } = _a, otherProps = __objRest(_a, ["loadable"]);
26
45
  let delayTimer = null;
27
46
  let timeoutTimer = null;
28
47
  const [state, setState] = useState(() => {
29
- const {
30
- delay,
31
- timeout
32
- } = loadable;
48
+ const { delay, timeout } = loadable;
33
49
  const initState = {
34
50
  error: null,
35
51
  pastDelay: false,
36
52
  timedOut: false,
37
53
  isLoading: false
38
54
  };
39
- if (typeof delay === 'number') {
55
+ if (typeof delay === "number") {
40
56
  if (delay === 0) {
41
57
  initState.pastDelay = true;
42
58
  } else {
43
59
  delayTimer = setTimeout(() => {
44
- setStateWithMountCheck({
45
- pastDelay: true
46
- });
60
+ setStateWithMountCheck({ pastDelay: true });
47
61
  }, delay);
48
62
  }
49
63
  }
50
- if (typeof timeout === 'number') {
64
+ if (typeof timeout === "number") {
51
65
  timeoutTimer = setTimeout(() => {
52
- setStateWithMountCheck({
53
- timedOut: true
54
- });
66
+ setStateWithMountCheck({ timedOut: true });
55
67
  }, timeout);
56
68
  }
57
69
  return initState;
58
70
  });
59
- const LoadingComponent = (_props$loadable = props.loadable) === null || _props$loadable === void 0 ? void 0 : _props$loadable.loading;
71
+ const LoadingComponent = (_b = props.loadable) == null ? void 0 : _b.loading;
60
72
  useEffect(() => {
61
- logger('Loadable render state', {
73
+ logger("Loadable render state", {
62
74
  state,
63
75
  props: otherProps,
64
76
  loadable,
@@ -80,36 +92,42 @@ export function Loadable(WrapComponent) {
80
92
  };
81
93
  }, []);
82
94
  const retry = useCallback(() => {
83
- setState(_objectSpread(_objectSpread({}, state), {}, {
95
+ setState(__spreadProps(__spreadValues({}, state), {
84
96
  error: null,
85
97
  isLoading: true,
86
98
  timedOut: false
87
99
  }));
88
100
  }, [state]);
89
- const setStateWithMountCheck = useCallback(newState => {
90
- setState(state => _objectSpread(_objectSpread({}, state), newState));
91
- }, [state]);
101
+ const setStateWithMountCheck = useCallback(
102
+ (newState) => {
103
+ setState((state2) => __spreadValues(__spreadValues({}, state2), newState));
104
+ },
105
+ [state]
106
+ );
92
107
  const showLoading = (state.isLoading || state.error) && LoadingComponent;
93
- return /*#__PURE__*/_jsxs(_Fragment, {
94
- children: [showLoading && /*#__PURE__*/_jsx(LoadingComponent, {
95
- isLoading: state.isLoading,
96
- pastDelay: state.pastDelay,
97
- timedOut: state.timedOut,
98
- error: state === null || state === void 0 ? void 0 : state.error,
99
- retry: retry
100
- }), /*#__PURE__*/_jsx(WrapComponent, _objectSpread({
101
- style: {
102
- display: showLoading ? 'none' : 'block'
103
- },
104
- setLoadingState: props => {
105
- // loading is not provided and there is a rendering exception
106
- if (props.error && !LoadingComponent) {
107
- throw props.error;
108
+ return /* @__PURE__ */ jsxs(Fragment, {
109
+ children: [
110
+ showLoading && /* @__PURE__ */ jsx(LoadingComponent, {
111
+ isLoading: state.isLoading,
112
+ pastDelay: state.pastDelay,
113
+ timedOut: state.timedOut,
114
+ error: state == null ? void 0 : state.error,
115
+ retry
116
+ }),
117
+ /* @__PURE__ */ jsx(WrapComponent, __spreadValues({
118
+ style: { display: showLoading ? "none" : "block" },
119
+ setLoadingState: (props2) => {
120
+ if (props2.error && !LoadingComponent) {
121
+ throw props2.error;
122
+ }
123
+ setStateWithMountCheck(props2);
108
124
  }
109
- setStateWithMountCheck(props);
110
- }
111
- }, otherProps))]
125
+ }, otherProps))
126
+ ]
112
127
  });
113
128
  };
114
129
  };
115
- }
130
+ }
131
+ export {
132
+ Loadable
133
+ };
@@ -1,114 +1,146 @@
1
- const _excluded = ["manifest"];
2
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
- 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
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
- import GarfishInstance from 'garfish';
8
- import React from 'react';
9
- import hoistNonReactStatics from 'hoist-non-react-statics';
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ var __async = (__this, __arguments, generator) => {
33
+ return new Promise((resolve, reject) => {
34
+ var fulfilled = (value) => {
35
+ try {
36
+ step(generator.next(value));
37
+ } catch (e) {
38
+ reject(e);
39
+ }
40
+ };
41
+ var rejected = (value) => {
42
+ try {
43
+ step(generator.throw(value));
44
+ } catch (e) {
45
+ reject(e);
46
+ }
47
+ };
48
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
49
+ step((generator = generator.apply(__this, __arguments)).next());
50
+ });
51
+ };
52
+ import { jsx } from "react/jsx-runtime";
53
+ import GarfishInstance from "garfish";
54
+ import React from "react";
55
+ import hoistNonReactStatics from "hoist-non-react-statics";
10
56
  import { logger } from "../util";
11
57
  import { GarfishProvider } from "./utils/Context";
12
58
  import setExternal from "./utils/setExternal";
13
59
  import { generateMApp } from "./utils/MApp";
14
60
  import { generateApps } from "./utils/apps";
15
- import { jsx as _jsx } from "react/jsx-runtime";
16
- async function initOptions(manifest = {}, options) {
17
- var _window, _window$modern_manife, _window2, _window2$modern_manif;
18
- let apps = options.apps || [];
19
-
20
- // use manifest modules
21
- if (manifest !== null && manifest !== void 0 && manifest.modules) {
22
- if ((manifest === null || manifest === void 0 ? void 0 : manifest.modules.length) > 0) {
23
- apps = manifest === null || manifest === void 0 ? void 0 : manifest.modules;
61
+ function initOptions() {
62
+ return __async(this, arguments, function* (manifest = {}, options) {
63
+ var _a, _b, _c;
64
+ let apps = options.apps || [];
65
+ if (manifest == null ? void 0 : manifest.modules) {
66
+ if ((manifest == null ? void 0 : manifest.modules.length) > 0) {
67
+ apps = manifest == null ? void 0 : manifest.modules;
68
+ }
69
+ logger("manifest modules", apps);
24
70
  }
25
- logger('manifest modules', apps);
26
- }
27
-
28
- // get module list
29
- if (manifest !== null && manifest !== void 0 && manifest.getAppList) {
30
- const getAppList = await (manifest === null || manifest === void 0 ? void 0 : manifest.getAppList(manifest));
31
- if (getAppList.length > 0) {
32
- apps = getAppList;
71
+ if (manifest == null ? void 0 : manifest.getAppList) {
72
+ const getAppList = yield manifest == null ? void 0 : manifest.getAppList(manifest);
73
+ if (getAppList.length > 0) {
74
+ apps = getAppList;
75
+ }
76
+ logger("getAppList modules", apps);
33
77
  }
34
- logger('getAppList modules', apps);
35
- }
36
-
37
- // get inject modules list
38
- if ((_window = window) !== null && _window !== void 0 && (_window$modern_manife = _window.modern_manifest) !== null && _window$modern_manife !== void 0 && _window$modern_manife.modules && ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$modern_manif = _window2.modern_manifest) === null || _window2$modern_manif === void 0 ? void 0 : _window2$modern_manif.modules.length) > 0) {
39
- var _window3, _window3$modern_manif;
40
- apps = (_window3 = window) === null || _window3 === void 0 ? void 0 : (_window3$modern_manif = _window3.modern_manifest) === null || _window3$modern_manif === void 0 ? void 0 : _window3$modern_manif.modules;
41
- logger('modern_manifest', apps);
42
- }
43
- return _objectSpread(_objectSpread({}, options), {}, {
44
- apps
78
+ if (((_a = window == null ? void 0 : window.modern_manifest) == null ? void 0 : _a.modules) && ((_b = window == null ? void 0 : window.modern_manifest) == null ? void 0 : _b.modules.length) > 0) {
79
+ apps = (_c = window == null ? void 0 : window.modern_manifest) == null ? void 0 : _c.modules;
80
+ logger("modern_manifest", apps);
81
+ }
82
+ return __spreadProps(__spreadValues({}, options), {
83
+ apps
84
+ });
45
85
  });
46
86
  }
47
-
48
- // export default GarfishPlugin;
49
- export default (config => ({
50
- name: '@modern-js/garfish-plugin',
87
+ var plugin_default = (config) => ({
88
+ name: "@modern-js/garfish-plugin",
51
89
  setup: () => {
52
90
  setExternal();
53
- const {
54
- manifest
55
- } = config,
56
- options = _objectWithoutProperties(config, _excluded);
57
- logger('createPlugin', config);
91
+ const _a = config, { manifest } = _a, options = __objRest(_a, ["manifest"]);
92
+ logger("createPlugin", config);
58
93
  const promise = initOptions(manifest, options);
59
94
  return {
60
- hoc({
61
- App
62
- }, next) {
95
+ hoc({ App }, next) {
63
96
  class GetMicroFrontendApp extends React.Component {
64
97
  constructor(props) {
65
98
  super(props);
66
- _defineProperty(this, "state", {
99
+ this.state = {
67
100
  MApp: () => {
68
- logger('MApp init Component Render');
69
- return /*#__PURE__*/React.createElement('div');
101
+ logger("MApp init Component Render");
102
+ return React.createElement("div");
70
103
  },
71
- apps: new Proxy({}, {
72
- get() {
73
- return () => /*#__PURE__*/React.createElement('div');
104
+ apps: new Proxy(
105
+ {},
106
+ {
107
+ get() {
108
+ return () => React.createElement("div");
109
+ }
74
110
  }
75
- }),
111
+ ),
76
112
  appInfoList: []
77
- });
78
- const load = async () => {
79
- GarfishInstance.setOptions(_objectSpread(_objectSpread({}, options), {}, {
80
- insulationVariable: [...(options.insulationVariable || []), '_SERVER_DATA'],
113
+ };
114
+ const load = () => __async(this, null, function* () {
115
+ GarfishInstance.setOptions(__spreadProps(__spreadValues({}, options), {
116
+ insulationVariable: [
117
+ ...options.insulationVariable || [],
118
+ "_SERVER_DATA"
119
+ ],
81
120
  apps: []
82
121
  }));
83
- const GarfishConfig = await promise;
84
- const {
85
- appInfoList,
86
- apps
87
- } = generateApps(GarfishConfig, manifest);
122
+ const GarfishConfig = yield promise;
123
+ const { appInfoList, apps } = generateApps(
124
+ GarfishConfig,
125
+ manifest
126
+ );
88
127
  GarfishInstance.registerApp(appInfoList);
89
128
  const MApp = generateMApp(GarfishConfig, manifest);
90
- logger('initOptions result', {
91
- manifest,
92
- GarfishConfig
93
- });
94
- logger('generateApps', {
95
- MApp,
96
- apps,
97
- appInfoList
98
- });
129
+ logger("initOptions result", { manifest, GarfishConfig });
130
+ logger("generateApps", { MApp, apps, appInfoList });
99
131
  this.setState({
100
132
  MApp,
101
133
  apps,
102
134
  appInfoList
103
135
  });
104
- };
136
+ });
105
137
  load();
106
138
  }
107
139
  render() {
108
- logger('GarfishProvider state', this.state);
109
- return /*#__PURE__*/_jsx(GarfishProvider, {
140
+ logger("GarfishProvider state", this.state);
141
+ return /* @__PURE__ */ jsx(GarfishProvider, {
110
142
  value: this.state,
111
- children: /*#__PURE__*/_jsx(App, _objectSpread(_objectSpread({}, this.props), this.state))
143
+ children: /* @__PURE__ */ jsx(App, __spreadValues(__spreadValues({}, this.props), this.state))
112
144
  });
113
145
  }
114
146
  }
@@ -118,4 +150,7 @@ export default (config => ({
118
150
  }
119
151
  };
120
152
  }
121
- }));
153
+ });
154
+ export {
155
+ plugin_default as default
156
+ };
@@ -1,36 +1,50 @@
1
- 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; }
2
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- import React, { useContext } from 'react';
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ import React, { useContext } from "react";
5
18
  import { logger } from "../util";
6
19
  import { GarfishContext } from "./utils/Context";
7
- export function useModuleApps() {
8
- const {
9
- apps,
10
- MApp,
11
- appInfoList
12
- } = useContext(GarfishContext);
13
- logger('call useModuleApps', _objectSpread({
20
+ function useModuleApps() {
21
+ const { apps, MApp, appInfoList } = useContext(GarfishContext);
22
+ logger("call useModuleApps", __spreadValues({
14
23
  MApp,
15
24
  apps: appInfoList
16
25
  }, apps));
17
- const Info = new Proxy(_objectSpread({
18
- MApp,
19
- apps: appInfoList
20
- }, apps), {
21
- get(target, p, receiver) {
22
- if (typeof p === 'string' && p in target) {
23
- return Reflect.get(target, p, receiver);
26
+ const Info = new Proxy(
27
+ __spreadValues({
28
+ MApp,
29
+ apps: appInfoList
30
+ }, apps),
31
+ {
32
+ get(target, p, receiver) {
33
+ if (typeof p === "string" && p in target) {
34
+ return Reflect.get(target, p, receiver);
35
+ }
36
+ return () => React.createElement("div");
24
37
  }
25
- return () => /*#__PURE__*/React.createElement('div');
26
38
  }
27
- });
39
+ );
28
40
  return Info;
29
41
  }
30
- export function useModuleApp() {
31
- const {
32
- MApp
33
- } = useContext(GarfishContext);
34
- logger('call useModuleApps', MApp);
42
+ function useModuleApp() {
43
+ const { MApp } = useContext(GarfishContext);
44
+ logger("call useModuleApps", MApp);
35
45
  return MApp;
36
- }
46
+ }
47
+ export {
48
+ useModuleApp,
49
+ useModuleApps
50
+ };
@@ -1,4 +1,7 @@
1
- import React from 'react';
2
- const GarfishContext = /*#__PURE__*/React.createContext(null);
1
+ import React from "react";
2
+ const GarfishContext = React.createContext(null);
3
3
  const GarfishProvider = GarfishContext.Provider;
4
- export { GarfishContext, GarfishProvider };
4
+ export {
5
+ GarfishContext,
6
+ GarfishProvider
7
+ };