@alicloud/alfa-react 1.3.0-alpha.1 → 1.3.0-canary.11

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 (56) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.js +6 -6
  3. package/es/app/createIsomorphicMicroApp.js +45 -0
  4. package/es/app/getConsoleConfig.js +49 -0
  5. package/es/app.js +48 -45
  6. package/es/components/ErrorBoundary/index.js +1 -0
  7. package/es/components/Loading/index.js +17 -1
  8. package/es/context.js +7 -0
  9. package/es/index.js +2 -2
  10. package/es/utils/getConsoleConfig.js +3 -1
  11. package/es/utils.js +3 -0
  12. package/es/widget/emitter.js +4 -4
  13. package/es/widget/getWidgetConfigById.js +6 -5
  14. package/es/widget/getWidgetDeps.js +3 -3
  15. package/es/widget.js +1 -1
  16. package/lib/app/createIsomorphicMicroApp.d.ts +2 -0
  17. package/lib/app/createIsomorphicMicroApp.js +65 -0
  18. package/lib/app/getConsoleConfig.d.ts +2 -0
  19. package/lib/{utils → app}/getConsoleConfig.js +7 -45
  20. package/lib/app.d.ts +1 -2
  21. package/lib/app.js +48 -43
  22. package/lib/base.d.ts +1 -4
  23. package/lib/components/ErrorBoundary/index.js +1 -0
  24. package/lib/components/Loading/Title.d.ts +0 -1
  25. package/lib/components/Loading/index.d.ts +5 -2
  26. package/lib/components/Loading/index.js +18 -1
  27. package/lib/context.d.ts +7 -0
  28. package/lib/context.js +15 -0
  29. package/lib/index.d.ts +2 -2
  30. package/lib/index.js +4 -6
  31. package/lib/types.d.ts +7 -5
  32. package/lib/utils.d.ts +1 -0
  33. package/lib/utils.js +8 -2
  34. package/lib/widget/emitter.d.ts +1 -0
  35. package/lib/widget/emitter.js +4 -4
  36. package/lib/widget/getWidgetConfigById.js +6 -5
  37. package/lib/widget/getWidgetDeps.js +2 -2
  38. package/lib/widget.d.ts +1 -2
  39. package/lib/widget.js +2 -2
  40. package/package.json +6 -10
  41. package/es/utils/checkOptions.js +0 -13
  42. package/lib/createAlfaApp.d.ts +0 -4
  43. package/lib/createAlfaApp.js +0 -135
  44. package/lib/createAlfaWidget.d.ts +0 -4
  45. package/lib/createAlfaWidget.js +0 -145
  46. package/lib/createApplication.d.ts +0 -13
  47. package/lib/createApplication.js +0 -133
  48. package/lib/types/base.d.ts +0 -11
  49. package/lib/types/base.js +0 -37
  50. package/lib/types/index.d.ts +0 -86
  51. package/lib/types/index.js +0 -5
  52. package/lib/utils/checkOptions.d.ts +0 -0
  53. package/lib/utils/checkOptions.js +0 -14
  54. package/lib/utils/getConsoleConfig.d.ts +0 -21
  55. package/lib/utils/index.d.ts +0 -1
  56. package/lib/utils/index.js +0 -12
package/lib/app.js CHANGED
@@ -31,14 +31,16 @@ var _alfaCore = require("@alicloud/alfa-core");
31
31
 
32
32
  var _Loading = _interopRequireDefault(require("./components/Loading"));
33
33
 
34
- var _types = require("./types");
35
-
36
34
  var _ErrorBoundary = _interopRequireDefault(require("./components/ErrorBoundary"));
37
35
 
38
- var _getConsoleConfig = require("./utils/getConsoleConfig");
36
+ var _getConsoleConfig = require("./app/getConsoleConfig");
37
+
38
+ var _createIsomorphicMicroApp = require("./app/createIsomorphicMicroApp");
39
39
 
40
40
  var _utils = require("./utils");
41
41
 
42
+ var _types = require("./types");
43
+
42
44
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
43
45
 
44
46
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -55,8 +57,10 @@ var getProps = function getProps(props) {
55
57
  delete parcelProps.loading;
56
58
  delete parcelProps.entry;
57
59
  delete parcelProps.container;
58
- delete parcelProps.logger;
59
- delete parcelProps.env;
60
+ delete parcelProps.logger; // @ts-ignore
61
+
62
+ delete parcelProps.env; // @ts-ignore
63
+
60
64
  delete parcelProps.dependencies;
61
65
  return parcelProps;
62
66
  };
@@ -67,8 +71,7 @@ var Application = function Application(props) {
67
71
  loading = props.loading,
68
72
  style = props.style,
69
73
  className = props.className,
70
- consoleConfig = props.consoleConfig,
71
- i18nMessages = props.i18nMessages;
74
+ consoleConfig = props.consoleConfig;
72
75
 
73
76
  var _useState = (0, _react.useState)(false),
74
77
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -83,7 +86,7 @@ var Application = function Application(props) {
83
86
  var appRef = (0, _react.useRef)(null);
84
87
  (0, _react.useEffect)(function () {
85
88
  (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
86
- var App;
89
+ var app;
87
90
  return _regenerator.default.wrap(function _callee$(_context) {
88
91
  while (1) {
89
92
  switch (_context.prev = _context.next) {
@@ -97,35 +100,27 @@ var Application = function Application(props) {
97
100
  });
98
101
 
99
102
  case 2:
100
- App = _context.sent;
103
+ app = _context.sent;
101
104
 
102
- if (App.context && App.context) {
103
- App.context.window.ALIYUN_CONSOLE_CONFIG = consoleConfig;
104
- App.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = i18nMessages;
105
+ if (app.context && app.context.baseFrame) {
106
+ // @ts-ignore
107
+ app.context.baseFrame.contentWindow.ALIYUN_CONSOLE_CONFIG = consoleConfig;
105
108
  }
106
109
 
107
110
  _context.next = 6;
108
- return App.load();
111
+ return app.load();
109
112
 
110
113
  case 6:
111
- if (appRef.current) {
112
- _context.next = 8;
113
- break;
114
- }
115
-
116
- return _context.abrupt("return");
117
-
118
- case 8:
119
- _context.next = 10;
120
- return App.mount(appRef.current, {
114
+ _context.next = 8;
115
+ return app.mount(appRef.current, {
121
116
  customProps: getProps(props)
122
117
  });
123
118
 
124
- case 10:
119
+ case 8:
125
120
  setMounted(true);
126
- setApp(App);
121
+ setApp(app);
127
122
 
128
- case 12:
123
+ case 10:
129
124
  case "end":
130
125
  return _context.stop();
131
126
  }
@@ -142,23 +137,31 @@ var Application = function Application(props) {
142
137
  }
143
138
 
144
139
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !mounted && /*#__PURE__*/_react.default.createElement(_Loading.default, {
140
+ microAppContainer: name,
145
141
  loading: loading
146
142
  }), sandbox && sandbox !== true && sandbox.disableFakeBody ? /*#__PURE__*/_react.default.createElement(name, {
147
143
  style: style,
148
144
  className: className,
149
145
  ref: appRef,
150
146
  dataId: name
151
- }) : /*#__PURE__*/_react.default.createElement(name, {}, /*#__PURE__*/_react.default.createElement('div', {
152
- ref: appRef
153
- })));
147
+ }) : /*#__PURE__*/_react.default.createElement(name, {
148
+ children: /*#__PURE__*/_react.default.createElement('div', {
149
+ ref: appRef
150
+ })
151
+ }));
154
152
  };
155
153
 
156
154
  function createAlfaApp(option) {
157
155
  var name = option.name,
158
156
  loading = option.loading,
159
157
  manifest = option.manifest;
158
+
159
+ if ((0, _utils.isSSR)()) {
160
+ return (0, _createIsomorphicMicroApp.createIsomorphicAlfaApp)(option);
161
+ }
162
+
160
163
  var AlfaApp = /*#__PURE__*/(0, _react.lazy)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
161
- var resolvedManifest, consoleConfig, messages, i18nMessages, App;
164
+ var resolvedManifest, consoleConfig, AlfaApp;
162
165
  return _regenerator.default.wrap(function _callee2$(_context2) {
163
166
  while (1) {
164
167
  switch (_context2.prev = _context2.next) {
@@ -177,34 +180,35 @@ function createAlfaApp(option) {
177
180
  resolvedManifest = _context2.sent;
178
181
 
179
182
  case 5:
183
+ // @ts-ignore
180
184
  consoleConfig = window.ALIYUN_CONSOLE_CONFIG || {};
181
- _context2.next = 8;
185
+
186
+ if (!option.dynamicConfig) {
187
+ _context2.next = 10;
188
+ break;
189
+ }
190
+
191
+ _context2.next = 9;
182
192
  return (0, _getConsoleConfig.getConsoleConfig)(option, consoleConfig);
183
193
 
184
- case 8:
194
+ case 9:
185
195
  consoleConfig = _context2.sent;
186
- _context2.next = 11;
187
- return (0, _alfaCore.getLocale)(option);
188
-
189
- case 11:
190
- messages = _context2.sent;
191
- i18nMessages = _objectSpread(_objectSpread({}, window.ALIYUN_CONSOLE_I18N_MESSAGE), messages);
192
196
 
193
- App = function App(props) {
197
+ case 10:
198
+ AlfaApp = function AlfaApp(props) {
194
199
  return /*#__PURE__*/_react.default.createElement(Application, (0, _extends2.default)({
195
200
  manifest: resolvedManifest
196
201
  }, props, {
197
202
  name: (0, _utils.normalizeName)(name),
198
- consoleConfig: consoleConfig,
199
- i18nMessages: i18nMessages
203
+ consoleConfig: consoleConfig
200
204
  }));
201
205
  };
202
206
 
203
207
  return _context2.abrupt("return", {
204
- default: App
208
+ default: AlfaApp
205
209
  });
206
210
 
207
- case 15:
211
+ case 12:
208
212
  case "end":
209
213
  return _context2.stop();
210
214
  }
@@ -214,6 +218,7 @@ function createAlfaApp(option) {
214
218
  return function (props) {
215
219
  return /*#__PURE__*/_react.default.createElement(_ErrorBoundary.default, props, /*#__PURE__*/_react.default.createElement(_react.Suspense, {
216
220
  fallback: /*#__PURE__*/_react.default.createElement(_Loading.default, {
221
+ microAppContainer: (0, _utils.normalizeName)(name),
217
222
  loading: loading
218
223
  })
219
224
  }, /*#__PURE__*/_react.default.createElement(AlfaApp, (0, _extends2.default)({}, option, {
package/lib/base.d.ts CHANGED
@@ -1,11 +1,8 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
- import { IAppConfig, IOptions, AlfaEnvEnum } from '@alicloud/alfa-core';
2
+ import { IAppConfig, IOptions } from '@alicloud/alfa-core';
3
3
  export interface IProps<T = any> extends HTMLAttributes<Element>, IAppConfig, IOptions {
4
4
  loading?: boolean | React.ReactChild;
5
5
  consoleConfig?: any;
6
- i18nMessages?: any;
7
- env?: AlfaEnvEnum;
8
- dependencies?: any;
9
6
  }
10
7
  export default class MicroAppBase<T> extends React.Component<Partial<IProps<T>>> {
11
8
  }
@@ -63,6 +63,7 @@ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
63
63
  (0, _isFunction.default)((_window = window) === null || _window === void 0 ? void 0 : (_window$__bl = _window.__bl) === null || _window$__bl === void 0 ? void 0 : _window$__bl.error) && window.__bl.error(error, errorInfo);
64
64
  }
65
65
 
66
+ console.error(error);
66
67
  this.props.appDidCatch && this.props.appDidCatch(error);
67
68
  }
68
69
  }, {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface SkeletonTitleProps {
3
2
  prefixCls?: string;
4
3
  className?: string;
@@ -1,4 +1,7 @@
1
1
  import React from 'react';
2
- export default function getLoading({ loading }: {
2
+ interface IProps {
3
3
  loading?: boolean | React.ReactChild;
4
- }): JSX.Element | null;
4
+ microAppContainer?: string;
5
+ }
6
+ export default function getLoading({ loading, microAppContainer }: IProps): JSX.Element | null;
7
+ export {};
@@ -11,8 +11,25 @@ var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _Skeleton = _interopRequireDefault(require("./Skeleton"));
13
13
 
14
+ var initialPath = window.location.pathname;
15
+
14
16
  function getLoading(_ref) {
15
- var loading = _ref.loading;
17
+ var loading = _ref.loading,
18
+ microAppContainer = _ref.microAppContainer;
19
+
20
+ // 第一次如果是 ssr 出来的内容直接拿 ssr 的内容作为骨架做展示
21
+ // 防止出现首屏抖动
22
+ if (microAppContainer) {
23
+ var node = document.querySelector(microAppContainer); //@ts-ignore
24
+
25
+ if (initialPath === window.location.pathname && window.__isSSR) {
26
+ return /*#__PURE__*/_react.default.createElement("div", {
27
+ dangerouslySetInnerHTML: {
28
+ __html: node ? node.innerHTML : ''
29
+ }
30
+ });
31
+ }
32
+ }
16
33
 
17
34
  if (loading === false) {
18
35
  return null;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { IIsomorphicEnvironment } from '@alicloud/alfa-core';
3
+ /**
4
+ * 用来提供 ssr 状态下的获取 服务端 manifest & bundle 的实现
5
+ */
6
+ declare const EnvContext: import("react").Context<Partial<IIsomorphicEnvironment>>;
7
+ export default EnvContext;
package/lib/context.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ /**
11
+ * 用来提供 ssr 状态下的获取 服务端 manifest & bundle 的实现
12
+ */
13
+ var EnvContext = /*#__PURE__*/(0, _react.createContext)({});
14
+ var _default = EnvContext;
15
+ exports.default = _default;
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { default as createAlfaApp } from './createAlfaApp';
2
- export { default as createAlfaWidget } from './createAlfaWidget';
1
+ export { createAlfaWidget } from './widget';
2
+ export { createAlfaApp } from './app';
3
3
  export { eventEmitter as widgetEventEmitter } from './widget/index';
4
4
  export { createEventBus, prefetch } from '@alicloud/alfa-core';
package/lib/index.js CHANGED
@@ -1,20 +1,18 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  Object.defineProperty(exports, "createAlfaApp", {
9
7
  enumerable: true,
10
8
  get: function get() {
11
- return _createAlfaApp.default;
9
+ return _app.createAlfaApp;
12
10
  }
13
11
  });
14
12
  Object.defineProperty(exports, "createAlfaWidget", {
15
13
  enumerable: true,
16
14
  get: function get() {
17
- return _createAlfaWidget.default;
15
+ return _widget.createAlfaWidget;
18
16
  }
19
17
  });
20
18
  Object.defineProperty(exports, "createEventBus", {
@@ -36,9 +34,9 @@ Object.defineProperty(exports, "widgetEventEmitter", {
36
34
  }
37
35
  });
38
36
 
39
- var _createAlfaApp = _interopRequireDefault(require("./createAlfaApp"));
37
+ var _widget = require("./widget");
40
38
 
41
- var _createAlfaWidget = _interopRequireDefault(require("./createAlfaWidget"));
39
+ var _app = require("./app");
42
40
 
43
41
  var _index = require("./widget/index");
44
42
 
package/lib/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import React from 'React';
3
- import { createMicroApp, IAppConfig } from '@alicloud/alfa-core';
3
+ import { createMicroApp, IOptions } from '@alicloud/alfa-core';
4
4
  export interface AlfaVersion {
5
5
  entry: string;
6
6
  }
@@ -10,18 +10,20 @@ export interface AlfaReleaseConfig {
10
10
  'dist-tag': Record<string, string>;
11
11
  }
12
12
  export declare type EnvEnum = 'prod' | 'local' | 'pre' | 'daily';
13
- export interface AlfaFactoryOption extends IAppConfig {
13
+ export interface AlfaFactoryOption extends IOptions {
14
+ name: string;
15
+ version?: string;
14
16
  loading?: boolean | React.ReactChild;
17
+ env?: EnvEnum;
18
+ url?: string;
19
+ manifest?: string;
15
20
  dependencies?: Record<string, any>;
16
21
  dynamicConfig?: boolean;
17
- className?: string;
18
- style?: Record<string, any>;
19
22
  }
20
23
  declare type OmitKeys = 'manifest';
21
24
  export interface WidgetFactoryOption extends Omit<AlfaFactoryOption, OmitKeys> {
22
25
  runtimeVersion?: string;
23
26
  alfaLoader?: boolean;
24
- theme?: string;
25
27
  }
26
28
  export interface AlfaEnvConfigDescriptor {
27
29
  releaseUrl: string;
package/lib/utils.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export declare const normalizeName: (name: string) => string;
2
+ export declare const isSSR: () => boolean;
package/lib/utils.js CHANGED
@@ -3,10 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.normalizeName = void 0;
6
+ exports.normalizeName = exports.isSSR = void 0;
7
7
 
8
8
  var normalizeName = function normalizeName(name) {
9
9
  return name.replace(/@/g, '').replace(/\//g, '-');
10
10
  };
11
11
 
12
- exports.normalizeName = normalizeName;
12
+ exports.normalizeName = normalizeName;
13
+
14
+ var isSSR = function isSSR() {
15
+ return typeof document === 'undefined';
16
+ };
17
+
18
+ exports.isSSR = isSSR;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
3
  declare class WidgetEventEmitter extends EventEmitter {
4
+ constructor();
4
5
  refersh(widgetId: string): boolean;
5
6
  refershWidget(widgetId: string): boolean;
6
7
  }
@@ -30,13 +30,13 @@ var WidgetEventEmitter = /*#__PURE__*/function (_EventEmitter) {
30
30
 
31
31
  function WidgetEventEmitter() {
32
32
  (0, _classCallCheck2.default)(this, WidgetEventEmitter);
33
- return _super.apply(this, arguments);
34
- }
33
+ return _super.call(this);
34
+ } // Compatible with the old api, this may get removed at sometime later.
35
+
35
36
 
36
37
  (0, _createClass2.default)(WidgetEventEmitter, [{
37
38
  key: "refersh",
38
- value: // Compatible with the old api, this may get removed at sometime later.
39
- function refersh(widgetId) {
39
+ value: function refersh(widgetId) {
40
40
  return this.emit("".concat(widgetId, ":REFRESH"));
41
41
  }
42
42
  }, {
@@ -27,25 +27,26 @@ var getWidgetConfigById = /*#__PURE__*/function () {
27
27
  switch (_context.prev = _context.next) {
28
28
  case 0:
29
29
  env = _env.ENV[option.env || (0, _env.getConsoleEnv)()];
30
+ console.log(env.configUrl);
30
31
 
31
32
  if (cachedConfig[option.name]) {
32
- _context.next = 6;
33
+ _context.next = 7;
33
34
  break;
34
35
  }
35
36
 
36
- _context.next = 4;
37
+ _context.next = 5;
37
38
  return _axios.default.get((0, _template.default)(env.configUrl)({
38
39
  id: option.name
39
40
  }));
40
41
 
41
- case 4:
42
+ case 5:
42
43
  resp = _context.sent;
43
44
  cachedConfig[option.name] = resp.data;
44
45
 
45
- case 6:
46
+ case 7:
46
47
  return _context.abrupt("return", cachedConfig[option.name]);
47
48
 
48
- case 7:
49
+ case 8:
49
50
  case "end":
50
51
  return _context.stop();
51
52
  }
@@ -57,7 +57,7 @@ var createWidget = function createWidget(option) {
57
57
 
58
58
  var id = _ref.id,
59
59
  version = _ref.version;
60
- return (0, _widget.createCWSWidget)({
60
+ return (0, _widget.createAlfaWidget)({
61
61
  name: id,
62
62
  version: version,
63
63
  dependencies: option === null || option === void 0 ? void 0 : option.dependencies,
@@ -185,7 +185,7 @@ var getWidgetDeps = /*#__PURE__*/function () {
185
185
  react: _react.default,
186
186
  'react-dom': _reactDom.default,
187
187
  'prop-types': propTypes,
188
- axios: _axios.default
188
+ 'axios': _axios.default
189
189
  }, cachedRuntime[version].default), {}, (_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, WIDGET_UTILS_PKG_NAME, injectedWidgetUtils), (0, _defineProperty2.default)(_objectSpread2, '@ali/widget-utils-config', injectedWidgetUtils), (0, _defineProperty2.default)(_objectSpread2, '@ali/widget-loader', createWidget), _objectSpread2)));
190
190
 
191
191
  case 31:
package/lib/widget.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import { WidgetFactoryOption } from './types';
3
- export declare function createCWSWidget<T>(option: WidgetFactoryOption): (props: T) => JSX.Element;
2
+ export declare function createAlfaWidget<T>(option: WidgetFactoryOption): (props: T) => JSX.Element;
package/lib/widget.js CHANGED
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.createCWSWidget = createCWSWidget;
10
+ exports.createAlfaWidget = createAlfaWidget;
11
11
 
12
12
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
13
 
@@ -37,7 +37,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
37
37
 
38
38
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
39
39
 
40
- function createCWSWidget(option) {
40
+ function createAlfaWidget(option) {
41
41
  var AlfaWidget = /*#__PURE__*/(0, _react.lazy)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
42
42
  var url, config, _yield$getWidgetVersi, version, entryUrl, deps;
43
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/alfa-react",
3
- "version": "1.3.0-alpha.1",
3
+ "version": "1.3.0-canary.11",
4
4
  "description": "Alfa Framework (React Version)",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -9,7 +9,7 @@
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "start": "breezr start-storybook",
12
- "prepublish": "npm run build && npm run babel && npm run babel:esm",
12
+ "prepublish": "npm run clean && npm run build && npm run babel && npm run babel:esm",
13
13
  "babel": "breezr build --engine babel && tsc --emitDeclarationOnly -d --declarationDir ./lib",
14
14
  "babel:esm": "breezr build --engine babel --es-module",
15
15
  "build": "breezr build --engine webpack",
@@ -19,14 +19,11 @@
19
19
  "access": "public"
20
20
  },
21
21
  "devDependencies": {
22
- "@ali/home-widget-runtime": "^1.1.6",
23
22
  "@alicloud/console-toolkit-cli": "^1.0.0",
24
23
  "@alicloud/console-toolkit-preset-wind-component": "^1.0.0",
25
24
  "@types/chai": "^4.1.7",
26
25
  "@types/classnames": "^2.2.9",
27
- "@types/crypto-js": "^4.0.2",
28
26
  "@types/jest": "^23.3.13",
29
- "@types/lodash": "^4.14.176",
30
27
  "@types/react": "^16.9.2",
31
28
  "@types/react-dom": "^16.9.0",
32
29
  "@types/single-spa-react": "^2.8.3",
@@ -38,14 +35,13 @@
38
35
  "typescript": "^3.0.3"
39
36
  },
40
37
  "dependencies": {
41
- "@alicloud/alfa-core": "^1.3.0-alpha.3",
42
- "@alicloud/console-os-loader": "^1.2.3",
38
+ "@alicloud/alfa-core": "1.3.0-canary.7",
39
+ "@alicloud/console-os-loader": "1.3.0-canary.5",
43
40
  "@alicloud/widget-utils-console": "^0.1.6",
44
- "classnames": "^2.2.6",
45
- "crypto-js": "^4.1.1"
41
+ "classnames": "^2.2.6"
46
42
  },
47
43
  "peerDependencies": {
48
44
  "react": "^16 | ^17"
49
45
  },
50
- "gitHead": "43925181e0a3e489559b7ab1bb6c68e59e00d58e"
46
+ "gitHead": "92b51c833b6fd5aa584c0bbbab6470a79c96f8c4"
51
47
  }
@@ -1,13 +0,0 @@
1
- // import { AlfaFactoryOption } from '@alicloud/alfa-core';
2
- // enum Type {
3
- // app = 'app',
4
- // widget = 'widget'
5
- // }
6
- // const getType = (name: string): Type => {
7
- // return Type.app;
8
- // };
9
- // const checkOptions = <T extends AlfaFactoryOption>(option: T, type: Type): T => {
10
- // const { name } = option;
11
- // const type = get
12
- // };
13
- // export default checkOptions;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { AlfaFactoryOption } from './types';
3
- declare function createAlfaApp<P = any>(option: AlfaFactoryOption): (() => null) | React.MemoExoticComponent<(props: P) => JSX.Element>;
4
- export default createAlfaApp;