@alicloud/alfa-react 1.7.1-alpha.3 → 2.0.0-alpha.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.
@@ -4,7 +4,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
4
  import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- import { getConfig, getI18nMessages } from '@alicloud/alfa-core';
7
+ import { getConfig, getConfigV2, getI18nMessagesV2 } from '@alicloud/alfa-core';
8
8
  import { getConsoleConfig } from '../utils/getConsoleConfig';
9
9
  import { getConsoleGlobal } from '../utils/getConsoleGlobal';
10
10
  // inject consoleConfig & locales after load
@@ -13,7 +13,7 @@ function afterLoadHook(_x) {
13
13
  }
14
14
  function _afterLoadHook() {
15
15
  _afterLoadHook = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(appConfig) {
16
- var app, logger, sandbox, dynamicConfig, channel, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, CONFIG_END_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, i18nMessages, overrides;
16
+ var app, logger, sandbox, dynamicConfig, channel, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, CONFIG_END_TIME, _yield$Promise$all, _yield$Promise$all2, _yield$Promise$all2$, consoleConfig, consoleGlobal, messages, i18nMessages, overrides;
17
17
  return _regeneratorRuntime.wrap(function _callee$(_context) {
18
18
  while (1) switch (_context.prev = _context.next) {
19
19
  case 0:
@@ -23,21 +23,27 @@ function _afterLoadHook() {
23
23
  CONFIG_START_TIME = Date.now();
24
24
  CONFIG_END_TIME = Date.now();
25
25
  if (!dynamicConfig) {
26
- _context.next = 21;
26
+ _context.next = 19;
27
27
  break;
28
28
  }
29
29
  _context.next = 8;
30
- return getConfig(appConfig);
30
+ return Promise.all([getConfigV2(appConfig).then(function (data) {
31
+ if (!data) {
32
+ throw new Error('getConfigV2 returned null or undefined');
33
+ }
34
+ return [data.ALIYUN_CONSOLE_CONFIG, data.ALIYUN_CONSOLE_GLOBAL];
35
+ }).catch(function () {
36
+ return getConfig(appConfig).then(function (data) {
37
+ return [getConsoleConfig(data, defaultConsoleConfig, channel), getConsoleGlobal(data, defaultConsoleGlobal)];
38
+ });
39
+ }), getI18nMessagesV2(appConfig)]);
31
40
  case 8:
32
- configData = _context.sent;
33
- _context.next = 11;
34
- return Promise.all([getConsoleConfig(configData, defaultConsoleConfig, channel), getConsoleGlobal(configData, defaultConsoleGlobal), getI18nMessages(appConfig)]);
35
- case 11:
36
41
  _yield$Promise$all = _context.sent;
37
- _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
38
- consoleConfig = _yield$Promise$all2[0];
39
- consoleGlobal = _yield$Promise$all2[1];
40
- messages = _yield$Promise$all2[2];
42
+ _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
43
+ _yield$Promise$all2$ = _slicedToArray(_yield$Promise$all2[0], 2);
44
+ consoleConfig = _yield$Promise$all2$[0];
45
+ consoleGlobal = _yield$Promise$all2$[1];
46
+ messages = _yield$Promise$all2[1];
41
47
  CONFIG_END_TIME = Date.now();
42
48
  i18nMessages = _objectSpread(_objectSpread({}, window.ALIYUN_CONSOLE_I18N_MESSAGE), messages); // inject global variables when sandbox is valid
43
49
  if (app !== null && app !== void 0 && app.context && !(sandbox !== null && sandbox !== void 0 && sandbox.disable)) {
@@ -46,16 +52,16 @@ function _afterLoadHook() {
46
52
  app.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = i18nMessages;
47
53
  app.context.window.ALIYUN_WIND_MESSAGE = window.ALIYUN_WIND_MESSAGE;
48
54
  }
49
- _context.next = 22;
55
+ _context.next = 20;
50
56
  break;
51
- case 21:
57
+ case 19:
52
58
  if (app !== null && app !== void 0 && app.context && !(sandbox !== null && sandbox !== void 0 && sandbox.disable)) {
53
59
  app.context.window.ALIYUN_CONSOLE_CONFIG = defaultConsoleConfig;
54
60
  app.context.window.ALIYUN_CONSOLE_GLOBAL = defaultConsoleGlobal;
55
61
  app.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = window.ALIYUN_CONSOLE_I18N_MESSAGE;
56
62
  app.context.window.ALIYUN_WIND_MESSAGE = window.ALIYUN_WIND_MESSAGE;
57
63
  }
58
- case 22:
64
+ case 20:
59
65
  overrides = sandbox === null || sandbox === void 0 ? void 0 : sandbox.overrideGlobalVars;
60
66
  if (overrides && app) {
61
67
  Object.entries(overrides).forEach(function (_ref) {
@@ -71,7 +77,7 @@ function _afterLoadHook() {
71
77
  COST: CONFIG_END_TIME - CONFIG_START_TIME
72
78
  });
73
79
  return _context.abrupt("return", appConfig);
74
- case 26:
80
+ case 24:
75
81
  case "end":
76
82
  return _context.stop();
77
83
  }
@@ -1,6 +1,4 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
4
  import { getMainUid, getMD5MainUid } from '@alicloud/alfa-core';
@@ -76,19 +74,6 @@ var mergeConfigDataWithConsoleConfig = function mergeConfigDataWithConsoleConfig
76
74
  FEATURE_STATUS: _objectSpread(_objectSpread({}, consoleConfig === null || consoleConfig === void 0 ? void 0 : consoleConfig.FEATURE_STATUS), processFeatures(features))
77
75
  });
78
76
  };
79
- export var getConsoleConfig = /*#__PURE__*/function () {
80
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(configData, consoleConfig, channel) {
81
- return _regeneratorRuntime.wrap(function _callee$(_context) {
82
- while (1) switch (_context.prev = _context.next) {
83
- case 0:
84
- return _context.abrupt("return", mergeConfigDataWithConsoleConfig(configData, consoleConfig, channel));
85
- case 1:
86
- case "end":
87
- return _context.stop();
88
- }
89
- }, _callee);
90
- }));
91
- return function getConsoleConfig(_x, _x2, _x3) {
92
- return _ref.apply(this, arguments);
93
- };
94
- }();
77
+ export var getConsoleConfig = function getConsoleConfig(configData, consoleConfig, channel) {
78
+ return mergeConfigDataWithConsoleConfig(configData, consoleConfig, channel);
79
+ };
@@ -1,21 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- export var getConsoleGlobal = /*#__PURE__*/function () {
7
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(configData, global) {
8
- return _regeneratorRuntime.wrap(function _callee$(_context) {
9
- while (1) switch (_context.prev = _context.next) {
10
- case 0:
11
- return _context.abrupt("return", _objectSpread(_objectSpread({}, global), configData === null || configData === void 0 ? void 0 : configData.GLOBAL_DATA));
12
- case 1:
13
- case "end":
14
- return _context.stop();
15
- }
16
- }, _callee);
17
- }));
18
- return function getConsoleGlobal(_x, _x2) {
19
- return _ref.apply(this, arguments);
20
- };
21
- }();
4
+ export var getConsoleGlobal = function getConsoleGlobal(configData, global) {
5
+ return _objectSpread(_objectSpread({}, global), configData === null || configData === void 0 ? void 0 : configData.GLOBAL_DATA);
6
+ };
package/es/version.js CHANGED
@@ -1 +1 @@
1
- export var version = '1.7.1-alpha.3';
1
+ export var version = '2.0.0-alpha.1';
@@ -20,7 +20,7 @@ function afterLoadHook(_x) {
20
20
  }
21
21
  function _afterLoadHook() {
22
22
  _afterLoadHook = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(appConfig) {
23
- var app, logger, sandbox, dynamicConfig, channel, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, CONFIG_END_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, i18nMessages, overrides;
23
+ var app, logger, sandbox, dynamicConfig, channel, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, CONFIG_END_TIME, _yield$Promise$all, _yield$Promise$all2, _yield$Promise$all2$, consoleConfig, consoleGlobal, messages, i18nMessages, overrides;
24
24
  return _regenerator.default.wrap(function _callee$(_context) {
25
25
  while (1) switch (_context.prev = _context.next) {
26
26
  case 0:
@@ -30,21 +30,27 @@ function _afterLoadHook() {
30
30
  CONFIG_START_TIME = Date.now();
31
31
  CONFIG_END_TIME = Date.now();
32
32
  if (!dynamicConfig) {
33
- _context.next = 21;
33
+ _context.next = 19;
34
34
  break;
35
35
  }
36
36
  _context.next = 8;
37
- return (0, _alfaCore.getConfig)(appConfig);
37
+ return Promise.all([(0, _alfaCore.getConfigV2)(appConfig).then(function (data) {
38
+ if (!data) {
39
+ throw new Error('getConfigV2 returned null or undefined');
40
+ }
41
+ return [data.ALIYUN_CONSOLE_CONFIG, data.ALIYUN_CONSOLE_GLOBAL];
42
+ }).catch(function () {
43
+ return (0, _alfaCore.getConfig)(appConfig).then(function (data) {
44
+ return [(0, _getConsoleConfig.getConsoleConfig)(data, defaultConsoleConfig, channel), (0, _getConsoleGlobal.getConsoleGlobal)(data, defaultConsoleGlobal)];
45
+ });
46
+ }), (0, _alfaCore.getI18nMessagesV2)(appConfig)]);
38
47
  case 8:
39
- configData = _context.sent;
40
- _context.next = 11;
41
- return Promise.all([(0, _getConsoleConfig.getConsoleConfig)(configData, defaultConsoleConfig, channel), (0, _getConsoleGlobal.getConsoleGlobal)(configData, defaultConsoleGlobal), (0, _alfaCore.getI18nMessages)(appConfig)]);
42
- case 11:
43
48
  _yield$Promise$all = _context.sent;
44
- _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 3);
45
- consoleConfig = _yield$Promise$all2[0];
46
- consoleGlobal = _yield$Promise$all2[1];
47
- messages = _yield$Promise$all2[2];
49
+ _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 2);
50
+ _yield$Promise$all2$ = (0, _slicedToArray2.default)(_yield$Promise$all2[0], 2);
51
+ consoleConfig = _yield$Promise$all2$[0];
52
+ consoleGlobal = _yield$Promise$all2$[1];
53
+ messages = _yield$Promise$all2[1];
48
54
  CONFIG_END_TIME = Date.now();
49
55
  i18nMessages = _objectSpread(_objectSpread({}, window.ALIYUN_CONSOLE_I18N_MESSAGE), messages); // inject global variables when sandbox is valid
50
56
  if (app !== null && app !== void 0 && app.context && !(sandbox !== null && sandbox !== void 0 && sandbox.disable)) {
@@ -53,16 +59,16 @@ function _afterLoadHook() {
53
59
  app.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = i18nMessages;
54
60
  app.context.window.ALIYUN_WIND_MESSAGE = window.ALIYUN_WIND_MESSAGE;
55
61
  }
56
- _context.next = 22;
62
+ _context.next = 20;
57
63
  break;
58
- case 21:
64
+ case 19:
59
65
  if (app !== null && app !== void 0 && app.context && !(sandbox !== null && sandbox !== void 0 && sandbox.disable)) {
60
66
  app.context.window.ALIYUN_CONSOLE_CONFIG = defaultConsoleConfig;
61
67
  app.context.window.ALIYUN_CONSOLE_GLOBAL = defaultConsoleGlobal;
62
68
  app.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = window.ALIYUN_CONSOLE_I18N_MESSAGE;
63
69
  app.context.window.ALIYUN_WIND_MESSAGE = window.ALIYUN_WIND_MESSAGE;
64
70
  }
65
- case 22:
71
+ case 20:
66
72
  overrides = sandbox === null || sandbox === void 0 ? void 0 : sandbox.overrideGlobalVars;
67
73
  if (overrides && app) {
68
74
  Object.entries(overrides).forEach(function (_ref) {
@@ -78,7 +84,7 @@ function _afterLoadHook() {
78
84
  COST: CONFIG_END_TIME - CONFIG_START_TIME
79
85
  });
80
86
  return _context.abrupt("return", appConfig);
81
- case 26:
87
+ case 24:
82
88
  case "end":
83
89
  return _context.stop();
84
90
  }
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.getConsoleConfig = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
9
  var _alfaCore = require("@alicloud/alfa-core");
12
10
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -82,19 +80,6 @@ var mergeConfigDataWithConsoleConfig = function mergeConfigDataWithConsoleConfig
82
80
  FEATURE_STATUS: _objectSpread(_objectSpread({}, consoleConfig === null || consoleConfig === void 0 ? void 0 : consoleConfig.FEATURE_STATUS), processFeatures(features))
83
81
  });
84
82
  };
85
- var getConsoleConfig = exports.getConsoleConfig = /*#__PURE__*/function () {
86
- var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(configData, consoleConfig, channel) {
87
- return _regenerator.default.wrap(function _callee$(_context) {
88
- while (1) switch (_context.prev = _context.next) {
89
- case 0:
90
- return _context.abrupt("return", mergeConfigDataWithConsoleConfig(configData, consoleConfig, channel));
91
- case 1:
92
- case "end":
93
- return _context.stop();
94
- }
95
- }, _callee);
96
- }));
97
- return function getConsoleConfig(_x, _x2, _x3) {
98
- return _ref.apply(this, arguments);
99
- };
100
- }();
83
+ var getConsoleConfig = exports.getConsoleConfig = function getConsoleConfig(configData, consoleConfig, channel) {
84
+ return mergeConfigDataWithConsoleConfig(configData, consoleConfig, channel);
85
+ };
@@ -5,24 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.getConsoleGlobal = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
9
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
10
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
- var getConsoleGlobal = exports.getConsoleGlobal = /*#__PURE__*/function () {
14
- var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(configData, global) {
15
- return _regenerator.default.wrap(function _callee$(_context) {
16
- while (1) switch (_context.prev = _context.next) {
17
- case 0:
18
- return _context.abrupt("return", _objectSpread(_objectSpread({}, global), configData === null || configData === void 0 ? void 0 : configData.GLOBAL_DATA));
19
- case 1:
20
- case "end":
21
- return _context.stop();
22
- }
23
- }, _callee);
24
- }));
25
- return function getConsoleGlobal(_x, _x2) {
26
- return _ref.apply(this, arguments);
27
- };
28
- }();
11
+ var getConsoleGlobal = exports.getConsoleGlobal = function getConsoleGlobal(configData, global) {
12
+ return _objectSpread(_objectSpread({}, global), configData === null || configData === void 0 ? void 0 : configData.GLOBAL_DATA);
13
+ };
package/lib/version.js CHANGED
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = void 0;
7
- var version = exports.version = '1.7.1-alpha.3';
7
+ var version = exports.version = '2.0.0-alpha.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/alfa-react",
3
- "version": "1.7.1-alpha.3",
3
+ "version": "2.0.0-alpha.1",
4
4
  "description": "Alfa Framework (React Version)",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -53,7 +53,7 @@
53
53
  "prop-types": "^15.8.1",
54
54
  "react-lazyload": "^3.2.1",
55
55
  "@alicloud/console-os-loader": "^1.4.45-alpha.1",
56
- "@alicloud/alfa-core": "^1.5.0-alpha.2"
56
+ "@alicloud/alfa-core": "^1.5.0-alpha.8"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "react": ">=16.0.0",
@@ -1,5 +1,5 @@
1
1
  import { AlfaConfig } from '@alicloud/alfa-core';
2
- export declare const getConsoleConfig: (configData: AlfaConfig, consoleConfig: any, channel?: string) => Promise<{
2
+ export declare const getConsoleConfig: (configData: AlfaConfig, consoleConfig: any, channel?: string) => {
3
3
  CHANNEL_LINKS: {
4
4
  [x: string]: string | undefined;
5
5
  };
@@ -32,4 +32,5 @@ export declare const getConsoleConfig: (configData: AlfaConfig, consoleConfig: a
32
32
  portalType?: string | undefined;
33
33
  MAIN_ACCOUNT_PK?: string | undefined;
34
34
  CURRENT_PK?: string | undefined;
35
- }>;
35
+ APP_ID?: string | undefined;
36
+ };
@@ -1,4 +1,4 @@
1
1
  import { AlfaConfig, IWin } from '@alicloud/alfa-core';
2
- export declare const getConsoleGlobal: (configData: AlfaConfig, global: IWin['ALIYUN_CONSOLE_GLOBAL']) => Promise<{
2
+ export declare const getConsoleGlobal: (configData: AlfaConfig, global: IWin['ALIYUN_CONSOLE_GLOBAL']) => {
3
3
  [x: string]: any;
4
- }>;
4
+ };
@@ -1 +1 @@
1
- export declare const version = "1.7.1-alpha.3";
1
+ export declare const version = "2.0.0-alpha.1";
@@ -1,82 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
- import _regeneratorRuntime from "@babel/runtime/regenerator";
5
- 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; }
6
- 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; }
7
- import { getConfig, getI18nMessages } from '@alicloud/alfa-core';
8
- import { getConsoleConfig } from '../utils/getConsoleConfig';
9
- import { getConsoleGlobal } from '../utils/getConsoleGlobal';
10
- // inject consoleConfig & locales after load
11
- function afterLoadHook(_x) {
12
- return _afterLoadHook.apply(this, arguments);
13
- }
14
- function _afterLoadHook() {
15
- _afterLoadHook = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(appConfig) {
16
- var app, logger, sandbox, dynamicConfig, channel, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, CONFIG_END_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, i18nMessages, overrides;
17
- return _regeneratorRuntime.wrap(function _callee$(_context) {
18
- while (1) switch (_context.prev = _context.next) {
19
- case 0:
20
- app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox, dynamicConfig = appConfig.dynamicConfig, channel = appConfig.channel;
21
- defaultConsoleConfig = window.ALIYUN_CONSOLE_CONFIG || {};
22
- defaultConsoleGlobal = window.ALIYUN_CONSOLE_GLOBAL || {};
23
- CONFIG_START_TIME = Date.now();
24
- CONFIG_END_TIME = Date.now();
25
- if (!dynamicConfig) {
26
- _context.next = 21;
27
- break;
28
- }
29
- _context.next = 8;
30
- return getConfig(appConfig);
31
- case 8:
32
- configData = _context.sent;
33
- _context.next = 11;
34
- return Promise.all([getConsoleConfig(configData, defaultConsoleConfig, channel), getConsoleGlobal(configData, defaultConsoleGlobal), getI18nMessages(appConfig)]);
35
- case 11:
36
- _yield$Promise$all = _context.sent;
37
- _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
38
- consoleConfig = _yield$Promise$all2[0];
39
- consoleGlobal = _yield$Promise$all2[1];
40
- messages = _yield$Promise$all2[2];
41
- CONFIG_END_TIME = Date.now();
42
- i18nMessages = _objectSpread(_objectSpread({}, window.ALIYUN_CONSOLE_I18N_MESSAGE), messages); // inject global variables when sandbox is valid
43
- if (app !== null && app !== void 0 && app.context && !(sandbox !== null && sandbox !== void 0 && sandbox.disable)) {
44
- app.context.window.ALIYUN_CONSOLE_CONFIG = consoleConfig;
45
- app.context.window.ALIYUN_CONSOLE_GLOBAL = consoleGlobal;
46
- app.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = i18nMessages;
47
- app.context.window.ALIYUN_WIND_MESSAGE = window.ALIYUN_WIND_MESSAGE;
48
- }
49
- _context.next = 22;
50
- break;
51
- case 21:
52
- if (app !== null && app !== void 0 && app.context && !(sandbox !== null && sandbox !== void 0 && sandbox.disable)) {
53
- app.context.window.ALIYUN_CONSOLE_CONFIG = defaultConsoleConfig;
54
- app.context.window.ALIYUN_CONSOLE_GLOBAL = defaultConsoleGlobal;
55
- app.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = window.ALIYUN_CONSOLE_I18N_MESSAGE;
56
- app.context.window.ALIYUN_WIND_MESSAGE = window.ALIYUN_WIND_MESSAGE;
57
- }
58
- case 22:
59
- overrides = sandbox === null || sandbox === void 0 ? void 0 : sandbox.overrideGlobalVars;
60
- if (overrides && app) {
61
- Object.entries(overrides).forEach(function (_ref) {
62
- var _ref2 = _slicedToArray(_ref, 2),
63
- key = _ref2[0],
64
- value = _ref2[1];
65
- app.context.window[key] = value;
66
- });
67
- }
68
- (logger === null || logger === void 0 ? void 0 : logger.record) && logger.record({
69
- CONFIG_START_TIME: CONFIG_START_TIME,
70
- CONFIG_END_TIME: CONFIG_END_TIME,
71
- COST: CONFIG_END_TIME - CONFIG_START_TIME
72
- });
73
- return _context.abrupt("return", appConfig);
74
- case 26:
75
- case "end":
76
- return _context.stop();
77
- }
78
- }, _callee);
79
- }));
80
- return _afterLoadHook.apply(this, arguments);
81
- }
82
- export default afterLoadHook;
@@ -1,41 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
- import { getManifest } from '@alicloud/alfa-core';
4
- import { version as LOADER_VERSION } from '../version';
5
-
6
- // get manifest before resolve
7
- // normalize name
8
- function beforeResolveHook(_x) {
9
- return _beforeResolveHook.apply(this, arguments);
10
- }
11
- function _beforeResolveHook() {
12
- _beforeResolveHook = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(appConfig) {
13
- var logger, START_TIME, MANIFEST_START_TIME, resolvedManifest, MANIFEST_END_TIME;
14
- return _regeneratorRuntime.wrap(function _callee$(_context) {
15
- while (1) switch (_context.prev = _context.next) {
16
- case 0:
17
- logger = appConfig.logger;
18
- START_TIME = Date.now();
19
- MANIFEST_START_TIME = Date.now();
20
- _context.next = 5;
21
- return getManifest(appConfig);
22
- case 5:
23
- resolvedManifest = _context.sent;
24
- MANIFEST_END_TIME = Date.now();
25
- (logger === null || logger === void 0 ? void 0 : logger.record) && logger.record({
26
- LOADER_VERSION: LOADER_VERSION,
27
- START_TIME: START_TIME,
28
- MANIFEST_START_TIME: MANIFEST_START_TIME,
29
- MANIFEST_END_TIME: MANIFEST_END_TIME
30
- });
31
- appConfig.manifest = resolvedManifest;
32
- return _context.abrupt("return", appConfig);
33
- case 10:
34
- case "end":
35
- return _context.stop();
36
- }
37
- }, _callee);
38
- }));
39
- return _beforeResolveHook.apply(this, arguments);
40
- }
41
- export default beforeResolveHook;
@@ -1,90 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
- var _alfaCore = require("@alicloud/alfa-core");
13
- var _getConsoleConfig = require("../utils/getConsoleConfig");
14
- var _getConsoleGlobal = require("../utils/getConsoleGlobal");
15
- 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; }
16
- 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) { (0, _defineProperty2.default)(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; }
17
- // inject consoleConfig & locales after load
18
- function afterLoadHook(_x) {
19
- return _afterLoadHook.apply(this, arguments);
20
- }
21
- function _afterLoadHook() {
22
- _afterLoadHook = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(appConfig) {
23
- var app, logger, sandbox, dynamicConfig, channel, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, CONFIG_END_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, i18nMessages, overrides;
24
- return _regenerator.default.wrap(function _callee$(_context) {
25
- while (1) switch (_context.prev = _context.next) {
26
- case 0:
27
- app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox, dynamicConfig = appConfig.dynamicConfig, channel = appConfig.channel;
28
- defaultConsoleConfig = window.ALIYUN_CONSOLE_CONFIG || {};
29
- defaultConsoleGlobal = window.ALIYUN_CONSOLE_GLOBAL || {};
30
- CONFIG_START_TIME = Date.now();
31
- CONFIG_END_TIME = Date.now();
32
- if (!dynamicConfig) {
33
- _context.next = 21;
34
- break;
35
- }
36
- _context.next = 8;
37
- return (0, _alfaCore.getConfig)(appConfig);
38
- case 8:
39
- configData = _context.sent;
40
- _context.next = 11;
41
- return Promise.all([(0, _getConsoleConfig.getConsoleConfig)(configData, defaultConsoleConfig, channel), (0, _getConsoleGlobal.getConsoleGlobal)(configData, defaultConsoleGlobal), (0, _alfaCore.getI18nMessages)(appConfig)]);
42
- case 11:
43
- _yield$Promise$all = _context.sent;
44
- _yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 3);
45
- consoleConfig = _yield$Promise$all2[0];
46
- consoleGlobal = _yield$Promise$all2[1];
47
- messages = _yield$Promise$all2[2];
48
- CONFIG_END_TIME = Date.now();
49
- i18nMessages = _objectSpread(_objectSpread({}, window.ALIYUN_CONSOLE_I18N_MESSAGE), messages); // inject global variables when sandbox is valid
50
- if (app !== null && app !== void 0 && app.context && !(sandbox !== null && sandbox !== void 0 && sandbox.disable)) {
51
- app.context.window.ALIYUN_CONSOLE_CONFIG = consoleConfig;
52
- app.context.window.ALIYUN_CONSOLE_GLOBAL = consoleGlobal;
53
- app.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = i18nMessages;
54
- app.context.window.ALIYUN_WIND_MESSAGE = window.ALIYUN_WIND_MESSAGE;
55
- }
56
- _context.next = 22;
57
- break;
58
- case 21:
59
- if (app !== null && app !== void 0 && app.context && !(sandbox !== null && sandbox !== void 0 && sandbox.disable)) {
60
- app.context.window.ALIYUN_CONSOLE_CONFIG = defaultConsoleConfig;
61
- app.context.window.ALIYUN_CONSOLE_GLOBAL = defaultConsoleGlobal;
62
- app.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = window.ALIYUN_CONSOLE_I18N_MESSAGE;
63
- app.context.window.ALIYUN_WIND_MESSAGE = window.ALIYUN_WIND_MESSAGE;
64
- }
65
- case 22:
66
- overrides = sandbox === null || sandbox === void 0 ? void 0 : sandbox.overrideGlobalVars;
67
- if (overrides && app) {
68
- Object.entries(overrides).forEach(function (_ref) {
69
- var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
70
- key = _ref2[0],
71
- value = _ref2[1];
72
- app.context.window[key] = value;
73
- });
74
- }
75
- (logger === null || logger === void 0 ? void 0 : logger.record) && logger.record({
76
- CONFIG_START_TIME: CONFIG_START_TIME,
77
- CONFIG_END_TIME: CONFIG_END_TIME,
78
- COST: CONFIG_END_TIME - CONFIG_START_TIME
79
- });
80
- return _context.abrupt("return", appConfig);
81
- case 26:
82
- case "end":
83
- return _context.stop();
84
- }
85
- }, _callee);
86
- }));
87
- return _afterLoadHook.apply(this, arguments);
88
- }
89
- var _default = afterLoadHook;
90
- exports.default = _default;
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
- var _alfaCore = require("@alicloud/alfa-core");
11
- var _version = require("../version");
12
- // get manifest before resolve
13
- // normalize name
14
- function beforeResolveHook(_x) {
15
- return _beforeResolveHook.apply(this, arguments);
16
- }
17
- function _beforeResolveHook() {
18
- _beforeResolveHook = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(appConfig) {
19
- var logger, START_TIME, MANIFEST_START_TIME, resolvedManifest, MANIFEST_END_TIME;
20
- return _regenerator.default.wrap(function _callee$(_context) {
21
- while (1) switch (_context.prev = _context.next) {
22
- case 0:
23
- logger = appConfig.logger;
24
- START_TIME = Date.now();
25
- MANIFEST_START_TIME = Date.now();
26
- _context.next = 5;
27
- return (0, _alfaCore.getManifest)(appConfig);
28
- case 5:
29
- resolvedManifest = _context.sent;
30
- MANIFEST_END_TIME = Date.now();
31
- (logger === null || logger === void 0 ? void 0 : logger.record) && logger.record({
32
- LOADER_VERSION: _version.version,
33
- START_TIME: START_TIME,
34
- MANIFEST_START_TIME: MANIFEST_START_TIME,
35
- MANIFEST_END_TIME: MANIFEST_END_TIME
36
- });
37
- appConfig.manifest = resolvedManifest;
38
- return _context.abrupt("return", appConfig);
39
- case 10:
40
- case "end":
41
- return _context.stop();
42
- }
43
- }, _callee);
44
- }));
45
- return _beforeResolveHook.apply(this, arguments);
46
- }
47
- var _default = beforeResolveHook;
48
- exports.default = _default;
@@ -1,7 +0,0 @@
1
- import { IAppConfig } from '@alicloud/alfa-core';
2
- declare function afterLoadHook(appConfig: IAppConfig & {
3
- channel?: string;
4
- }): Promise<IAppConfig<any> & {
5
- channel?: string | undefined;
6
- }>;
7
- export default afterLoadHook;
@@ -1,3 +0,0 @@
1
- import { IAppConfig } from '@alicloud/alfa-core';
2
- declare function beforeResolveHook(appConfig: IAppConfig): Promise<IAppConfig<any>>;
3
- export default beforeResolveHook;