@alicloud/alfa-react 1.4.21 → 1.4.22

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.
@@ -39,7 +39,9 @@ export default function createApplication(loader) {
39
39
  afterUnmount = props.afterUnmount,
40
40
  beforeUpdate = props.beforeUpdate,
41
41
  customSandbox = props.sandbox,
42
- locale = props.locale;
42
+ locale = props.locale,
43
+ _props$dynamicConfig = props.dynamicConfig,
44
+ dynamicConfig = _props$dynamicConfig === void 0 ? true : _props$dynamicConfig;
43
45
 
44
46
  var _useState = useState(null),
45
47
  _useState2 = _slicedToArray(_useState, 2),
@@ -74,7 +76,8 @@ export default function createApplication(loader) {
74
76
  externalsVars: [].concat(_toConsumableArray((customSandbox === null || customSandbox === void 0 ? void 0 : customSandbox.externalsVars) || []), [// global vars used in ConsoleBase.forApp
75
77
  '_console_base_ready_'], aliyunExternalsVars)
76
78
  });
77
- }, [customSandbox]);
79
+ }, [customSandbox]); // 固化第一次的配置
80
+
78
81
  var memoOptions = useMemo(function () {
79
82
  return {
80
83
  entry: entry,
@@ -95,7 +98,8 @@ export default function createApplication(loader) {
95
98
  beforeUnmount: beforeUnmount,
96
99
  afterUnmount: afterUnmount,
97
100
  beforeUpdate: beforeUpdate,
98
- locale: locale
101
+ locale: locale,
102
+ dynamicConfig: dynamicConfig
99
103
  };
100
104
  }, []);
101
105
  useEffect(function () {
@@ -18,25 +18,39 @@ function afterLoadHook(_x) {
18
18
 
19
19
  function _afterLoadHook() {
20
20
  _afterLoadHook = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(appConfig) {
21
- var app, logger, sandbox, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, CONFIG_END_TIME, i18nMessages, END_TIME;
21
+ var app, logger, sandbox, dynamicConfig, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, CONFIG_END_TIME, i18nMessages, END_TIME;
22
22
 
23
23
  return _regeneratorRuntime.wrap(function _callee$(_context) {
24
24
  while (1) {
25
25
  switch (_context.prev = _context.next) {
26
26
  case 0:
27
- app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox;
27
+ app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox, dynamicConfig = appConfig.dynamicConfig;
28
28
  defaultConsoleConfig = window.ALIYUN_CONSOLE_CONFIG || {};
29
29
  defaultConsoleGlobal = window.ALIYUN_CONSOLE_GLOBAL || {};
30
30
  CONFIG_START_TIME = Date.now();
31
- _context.next = 6;
31
+
32
+ if (!dynamicConfig) {
33
+ _context.next = 10;
34
+ break;
35
+ }
36
+
37
+ _context.next = 7;
32
38
  return getConfig(appConfig);
33
39
 
34
- case 6:
35
- configData = _context.sent;
36
- _context.next = 9;
40
+ case 7:
41
+ _context.t0 = _context.sent;
42
+ _context.next = 11;
43
+ break;
44
+
45
+ case 10:
46
+ _context.t0 = {};
47
+
48
+ case 11:
49
+ configData = _context.t0;
50
+ _context.next = 14;
37
51
  return Promise.all([getConsoleConfig(configData, defaultConsoleConfig), getConsoleGlobal(configData, defaultConsoleGlobal), getI18nMessages(appConfig)]);
38
52
 
39
- case 9:
53
+ case 14:
40
54
  _yield$Promise$all = _context.sent;
41
55
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
42
56
  consoleConfig = _yield$Promise$all2[0];
@@ -56,12 +70,13 @@ function _afterLoadHook() {
56
70
  (logger === null || logger === void 0 ? void 0 : logger.record) && logger.record({
57
71
  CONFIG_START_TIME: CONFIG_START_TIME,
58
72
  CONFIG_END_TIME: CONFIG_END_TIME,
59
- END_TIME: END_TIME
73
+ END_TIME: END_TIME,
74
+ COST: CONFIG_END_TIME - CONFIG_START_TIME
60
75
  });
61
76
  (logger === null || logger === void 0 ? void 0 : logger.send) && logger.send();
62
77
  return _context.abrupt("return", appConfig);
63
78
 
64
- case 21:
79
+ case 26:
65
80
  case "end":
66
81
  return _context.stop();
67
82
  }
package/es/version.js CHANGED
@@ -1 +1 @@
1
- export var version = '1.4.21';
1
+ export var version = '1.4.22';
@@ -61,7 +61,9 @@ function createApplication(loader) {
61
61
  afterUnmount = props.afterUnmount,
62
62
  beforeUpdate = props.beforeUpdate,
63
63
  customSandbox = props.sandbox,
64
- locale = props.locale;
64
+ locale = props.locale,
65
+ _props$dynamicConfig = props.dynamicConfig,
66
+ dynamicConfig = _props$dynamicConfig === void 0 ? true : _props$dynamicConfig;
65
67
 
66
68
  var _useState = (0, _react.useState)(null),
67
69
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -96,7 +98,8 @@ function createApplication(loader) {
96
98
  externalsVars: [].concat((0, _toConsumableArray2.default)((customSandbox === null || customSandbox === void 0 ? void 0 : customSandbox.externalsVars) || []), [// global vars used in ConsoleBase.forApp
97
99
  '_console_base_ready_'], aliyunExternalsVars)
98
100
  });
99
- }, [customSandbox]);
101
+ }, [customSandbox]); // 固化第一次的配置
102
+
100
103
  var memoOptions = (0, _react.useMemo)(function () {
101
104
  return {
102
105
  entry: entry,
@@ -117,7 +120,8 @@ function createApplication(loader) {
117
120
  beforeUnmount: beforeUnmount,
118
121
  afterUnmount: afterUnmount,
119
122
  beforeUpdate: beforeUpdate,
120
- locale: locale
123
+ locale: locale,
124
+ dynamicConfig: dynamicConfig
121
125
  };
122
126
  }, []);
123
127
  (0, _react.useEffect)(function () {
@@ -32,25 +32,39 @@ function afterLoadHook(_x) {
32
32
 
33
33
  function _afterLoadHook() {
34
34
  _afterLoadHook = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(appConfig) {
35
- var app, logger, sandbox, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, CONFIG_END_TIME, i18nMessages, END_TIME;
35
+ var app, logger, sandbox, dynamicConfig, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, CONFIG_END_TIME, i18nMessages, END_TIME;
36
36
 
37
37
  return _regenerator.default.wrap(function _callee$(_context) {
38
38
  while (1) {
39
39
  switch (_context.prev = _context.next) {
40
40
  case 0:
41
- app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox;
41
+ app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox, dynamicConfig = appConfig.dynamicConfig;
42
42
  defaultConsoleConfig = window.ALIYUN_CONSOLE_CONFIG || {};
43
43
  defaultConsoleGlobal = window.ALIYUN_CONSOLE_GLOBAL || {};
44
44
  CONFIG_START_TIME = Date.now();
45
- _context.next = 6;
45
+
46
+ if (!dynamicConfig) {
47
+ _context.next = 10;
48
+ break;
49
+ }
50
+
51
+ _context.next = 7;
46
52
  return (0, _alfaCore.getConfig)(appConfig);
47
53
 
48
- case 6:
49
- configData = _context.sent;
50
- _context.next = 9;
54
+ case 7:
55
+ _context.t0 = _context.sent;
56
+ _context.next = 11;
57
+ break;
58
+
59
+ case 10:
60
+ _context.t0 = {};
61
+
62
+ case 11:
63
+ configData = _context.t0;
64
+ _context.next = 14;
51
65
  return Promise.all([(0, _getConsoleConfig.getConsoleConfig)(configData, defaultConsoleConfig), (0, _getConsoleGlobal.getConsoleGlobal)(configData, defaultConsoleGlobal), (0, _alfaCore.getI18nMessages)(appConfig)]);
52
66
 
53
- case 9:
67
+ case 14:
54
68
  _yield$Promise$all = _context.sent;
55
69
  _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 3);
56
70
  consoleConfig = _yield$Promise$all2[0];
@@ -70,12 +84,13 @@ function _afterLoadHook() {
70
84
  (logger === null || logger === void 0 ? void 0 : logger.record) && logger.record({
71
85
  CONFIG_START_TIME: CONFIG_START_TIME,
72
86
  CONFIG_END_TIME: CONFIG_END_TIME,
73
- END_TIME: END_TIME
87
+ END_TIME: END_TIME,
88
+ COST: CONFIG_END_TIME - CONFIG_START_TIME
74
89
  });
75
90
  (logger === null || logger === void 0 ? void 0 : logger.send) && logger.send();
76
91
  return _context.abrupt("return", appConfig);
77
92
 
78
- case 21:
93
+ case 26:
79
94
  case "end":
80
95
  return _context.stop();
81
96
  }
package/lib/version.js CHANGED
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = void 0;
7
- var version = '1.4.21';
7
+ var version = '1.4.22';
8
8
  exports.version = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/alfa-react",
3
- "version": "1.4.21",
3
+ "version": "1.4.22",
4
4
  "description": "Alfa Framework (React Version)",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -42,14 +42,14 @@
42
42
  "typescript": "^3.0.3"
43
43
  },
44
44
  "dependencies": {
45
- "@alicloud/alfa-core": "^1.4.20",
45
+ "@alicloud/alfa-core": "^1.4.22",
46
46
  "@alicloud/console-os-loader": "^1.4.14-alpha.1",
47
47
  "@alicloud/widget-utils-console": "^0.1.6",
48
48
  "classnames": "^2.2.6",
49
49
  "crypto-js": "^4.1.1"
50
50
  },
51
51
  "peerDependencies": {
52
- "react": "^16 | ^17"
52
+ "react": ">=16.0.0"
53
53
  },
54
- "gitHead": "653b7123710c4860c883b56b48f5939bf9cae446"
54
+ "gitHead": "9d31b9c70337a55eb5759eec9812101c5ef67a94"
55
55
  }
@@ -19,6 +19,7 @@ export interface AlfaFactoryOption extends IAppConfig {
19
19
  css?: Record<string, string>;
20
20
  js?: Record<string, string>;
21
21
  };
22
+ dynamicConfig?: boolean;
22
23
  runtimeVersion?: string;
23
24
  fallbackRender?: (error: Error) => Element;
24
25
  }
@@ -1 +1 @@
1
- export declare const version = "1.4.21";
1
+ export declare const version = "1.4.22";