@alicloud/alfa-core 1.2.2 → 1.3.0-canary.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.
- package/breezr.config.js +3 -3
- package/dist/index.js +4 -4
- package/es/createMicroApp.js +2 -2
- package/es/index.js +5 -4
- package/es/resolveAlfaRelease.js +29 -0
- package/es/types/index.js +0 -0
- package/es/utils/getAlfaConfig.js +79 -0
- package/es/utils/getAlfaLocale.js +56 -0
- package/es/utils/getAlfaManifest.js +55 -0
- package/es/utils/index.js +120 -0
- package/lib/createMicroApp.d.ts +1 -1
- package/lib/createMicroApp.js +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.js +28 -14
- package/lib/resolveAlfaRelease.d.ts +2 -0
- package/lib/resolveAlfaRelease.js +44 -0
- package/lib/types/index.d.ts +99 -0
- package/lib/types/index.js +1 -0
- package/lib/utils/getAlfaConfig.d.ts +7 -0
- package/lib/utils/getAlfaConfig.js +94 -0
- package/lib/utils/getAlfaLocale.d.ts +2 -0
- package/lib/utils/getAlfaLocale.js +71 -0
- package/lib/utils/getAlfaManifest.d.ts +2 -0
- package/lib/utils/getAlfaManifest.js +70 -0
- package/lib/utils/index.d.ts +39 -0
- package/lib/utils/index.js +150 -0
- package/package.json +3 -4
package/es/createMicroApp.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createMicroApp as createConsoleOSMicroApp } from '@alicloud/console-os-kernal';
|
|
2
|
-
import {
|
|
2
|
+
import { getManifestFromConfig, getURL } from './utils';
|
|
3
3
|
export var createMicroApp = function createMicroApp(appConfig) {
|
|
4
4
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5
|
-
var manifest =
|
|
5
|
+
var manifest = getManifestFromConfig(appConfig);
|
|
6
6
|
var url = getURL(appConfig);
|
|
7
7
|
|
|
8
8
|
if (!manifest && !url) {
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { createMicroApp } from './createMicroApp';
|
|
2
|
-
export { getManifest } from './
|
|
3
|
-
export { getConfig } from './
|
|
4
|
-
export {
|
|
5
|
-
export { createEventBus, prefetch } from '@alicloud/console-os-kernal';
|
|
2
|
+
export { getManifest } from './utils/getAlfaManifest';
|
|
3
|
+
export { getConfig } from './utils/getAlfaConfig';
|
|
4
|
+
export { getLocale } from './utils/getAlfaLocale';
|
|
5
|
+
export { createEventBus, prefetch } from '@alicloud/console-os-kernal';
|
|
6
|
+
export { IAppConfig, IOptions, AlfaFactoryOption, AlfaDynamicConfig as AlfaConfig, IWin } from './types';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
import { resolveReleaseUrl } from './utils';
|
|
5
|
+
export var getRelease = /*#__PURE__*/function () {
|
|
6
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(option) {
|
|
7
|
+
var resp;
|
|
8
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
9
|
+
while (1) {
|
|
10
|
+
switch (_context.prev = _context.next) {
|
|
11
|
+
case 0:
|
|
12
|
+
_context.next = 2;
|
|
13
|
+
return axios.get(resolveReleaseUrl(option));
|
|
14
|
+
|
|
15
|
+
case 2:
|
|
16
|
+
resp = _context.sent;
|
|
17
|
+
|
|
18
|
+
case 3:
|
|
19
|
+
case "end":
|
|
20
|
+
return _context.stop();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}, _callee);
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
return function getRelease(_x) {
|
|
27
|
+
return _ref.apply(this, arguments);
|
|
28
|
+
};
|
|
29
|
+
}();
|
|
File without changes
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
|
|
7
|
+
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) { _defineProperty(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; }
|
|
8
|
+
|
|
9
|
+
import axios from 'axios';
|
|
10
|
+
import { resolveConfigUrl } from '.';
|
|
11
|
+
var cachedConfig = {};
|
|
12
|
+
var productReg = /@ali\/alfa-cloud-([a-zA-z]*)-(app|widget)-.*/;
|
|
13
|
+
var defaultConfig = {
|
|
14
|
+
ALL_CHANNEL_FEATURE_STATUS: {},
|
|
15
|
+
ALL_CHANNEL_LINKS: {},
|
|
16
|
+
ALL_FEATURE_STATUS: {}
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* 获取 Alfa 平台配置的 Config
|
|
20
|
+
* @param option
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export var getConfig = /*#__PURE__*/function () {
|
|
25
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(option) {
|
|
26
|
+
var matches, configId, resp, configData;
|
|
27
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
28
|
+
while (1) {
|
|
29
|
+
switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
matches = option.name.match(productReg);
|
|
32
|
+
|
|
33
|
+
if (matches) {
|
|
34
|
+
_context.next = 3;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return _context.abrupt("return", defaultConfig);
|
|
39
|
+
|
|
40
|
+
case 3:
|
|
41
|
+
configId = matches[1] || option.name;
|
|
42
|
+
|
|
43
|
+
if (cachedConfig[configId]) {
|
|
44
|
+
_context.next = 15;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
_context.prev = 5;
|
|
49
|
+
_context.next = 8;
|
|
50
|
+
return axios.get(resolveConfigUrl(_objectSpread(_objectSpread({}, option), {}, {
|
|
51
|
+
name: configId
|
|
52
|
+
})));
|
|
53
|
+
|
|
54
|
+
case 8:
|
|
55
|
+
resp = _context.sent;
|
|
56
|
+
configData = resp.data;
|
|
57
|
+
cachedConfig[configId] = configData;
|
|
58
|
+
_context.next = 15;
|
|
59
|
+
break;
|
|
60
|
+
|
|
61
|
+
case 13:
|
|
62
|
+
_context.prev = 13;
|
|
63
|
+
_context.t0 = _context["catch"](5);
|
|
64
|
+
|
|
65
|
+
case 15:
|
|
66
|
+
return _context.abrupt("return", cachedConfig[configId] || defaultConfig);
|
|
67
|
+
|
|
68
|
+
case 16:
|
|
69
|
+
case "end":
|
|
70
|
+
return _context.stop();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}, _callee, null, [[5, 13]]);
|
|
74
|
+
}));
|
|
75
|
+
|
|
76
|
+
return function getConfig(_x) {
|
|
77
|
+
return _ref.apply(this, arguments);
|
|
78
|
+
};
|
|
79
|
+
}();
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
import { resolveReleaseUrl, getAlfaLocale } from './index';
|
|
5
|
+
export var getLocale = /*#__PURE__*/function () {
|
|
6
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(option) {
|
|
7
|
+
var _releaseConfig$distT, _releaseConfig$locale, _releaseConfig$locale2;
|
|
8
|
+
|
|
9
|
+
var resp, locale, releaseConfig, version, localeEntry, messages, res;
|
|
10
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
|
+
while (1) {
|
|
12
|
+
switch (_context.prev = _context.next) {
|
|
13
|
+
case 0:
|
|
14
|
+
_context.next = 2;
|
|
15
|
+
return axios.get(resolveReleaseUrl(option));
|
|
16
|
+
|
|
17
|
+
case 2:
|
|
18
|
+
resp = _context.sent;
|
|
19
|
+
locale = getAlfaLocale();
|
|
20
|
+
releaseConfig = resp.data;
|
|
21
|
+
version = (_releaseConfig$distT = releaseConfig['dist-tags']) === null || _releaseConfig$distT === void 0 ? void 0 : _releaseConfig$distT['locales-latest'];
|
|
22
|
+
localeEntry = (_releaseConfig$locale = releaseConfig['locales-versions']) === null || _releaseConfig$locale === void 0 ? void 0 : (_releaseConfig$locale2 = _releaseConfig$locale[version]) === null || _releaseConfig$locale2 === void 0 ? void 0 : _releaseConfig$locale2[locale];
|
|
23
|
+
|
|
24
|
+
if (!localeEntry) {// throw new Error(`${option.name} ${locale} entry is not found, please check you release.`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
messages = {};
|
|
28
|
+
_context.prev = 9;
|
|
29
|
+
_context.next = 12;
|
|
30
|
+
return axios.get(localeEntry);
|
|
31
|
+
|
|
32
|
+
case 12:
|
|
33
|
+
res = _context.sent;
|
|
34
|
+
messages = res.data;
|
|
35
|
+
_context.next = 18;
|
|
36
|
+
break;
|
|
37
|
+
|
|
38
|
+
case 16:
|
|
39
|
+
_context.prev = 16;
|
|
40
|
+
_context.t0 = _context["catch"](9);
|
|
41
|
+
|
|
42
|
+
case 18:
|
|
43
|
+
return _context.abrupt("return", messages);
|
|
44
|
+
|
|
45
|
+
case 19:
|
|
46
|
+
case "end":
|
|
47
|
+
return _context.stop();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, _callee, null, [[9, 16]]);
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
return function getLocale(_x) {
|
|
54
|
+
return _ref.apply(this, arguments);
|
|
55
|
+
};
|
|
56
|
+
}();
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
import { resolveReleaseUrl } from '.';
|
|
5
|
+
export var getManifest = /*#__PURE__*/function () {
|
|
6
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(option) {
|
|
7
|
+
var _releaseConfig$distT2;
|
|
8
|
+
|
|
9
|
+
var resp, releaseConfig, version, _releaseConfig$distT, configByVersion;
|
|
10
|
+
|
|
11
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
12
|
+
while (1) {
|
|
13
|
+
switch (_context.prev = _context.next) {
|
|
14
|
+
case 0:
|
|
15
|
+
_context.next = 2;
|
|
16
|
+
return axios.get(resolveReleaseUrl(option));
|
|
17
|
+
|
|
18
|
+
case 2:
|
|
19
|
+
resp = _context.sent;
|
|
20
|
+
releaseConfig = resp.data;
|
|
21
|
+
version = option.version;
|
|
22
|
+
|
|
23
|
+
if (!option.version) {
|
|
24
|
+
version = (_releaseConfig$distT = releaseConfig['dist-tags']) === null || _releaseConfig$distT === void 0 ? void 0 : _releaseConfig$distT.latest;
|
|
25
|
+
} // if version is in dist-tags, return value
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
if ((_releaseConfig$distT2 = releaseConfig['dist-tags']) !== null && _releaseConfig$distT2 !== void 0 && _releaseConfig$distT2[option.version]) {
|
|
29
|
+
version = releaseConfig['dist-tags'][option.version];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
configByVersion = releaseConfig.versions[version];
|
|
33
|
+
|
|
34
|
+
if (configByVersion) {
|
|
35
|
+
_context.next = 10;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
throw new Error("".concat(option.name, "@").concat(version, " is not found, please check you release."));
|
|
40
|
+
|
|
41
|
+
case 10:
|
|
42
|
+
return _context.abrupt("return", releaseConfig.versions[version].entry);
|
|
43
|
+
|
|
44
|
+
case 11:
|
|
45
|
+
case "end":
|
|
46
|
+
return _context.stop();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, _callee);
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
return function getManifest(_x) {
|
|
53
|
+
return _ref.apply(this, arguments);
|
|
54
|
+
};
|
|
55
|
+
}();
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* get alfa env
|
|
3
|
+
* @returns
|
|
4
|
+
*/
|
|
5
|
+
export var getAlfaEnv = function getAlfaEnv() {
|
|
6
|
+
var _window, _window$ALIYUN_CONSOL;
|
|
7
|
+
|
|
8
|
+
if (process.env.NODE_ENV === 'development') {
|
|
9
|
+
return 'local';
|
|
10
|
+
} // default return prod
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
return ((_window = window) === null || _window === void 0 ? void 0 : (_window$ALIYUN_CONSOL = _window.ALIYUN_CONSOLE_CONFIG) === null || _window$ALIYUN_CONSOL === void 0 ? void 0 : _window$ALIYUN_CONSOL.fEnv) || 'prod';
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* get alfa Locale and replace '-' to '_'
|
|
17
|
+
* example: en-US => en_US
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export var getAlfaLocale = function getAlfaLocale() {
|
|
22
|
+
var _window2, _window2$ALIYUN_CONSO;
|
|
23
|
+
|
|
24
|
+
var locale = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$ALIYUN_CONSO = _window2.ALIYUN_CONSOLE_CONFIG) === null || _window2$ALIYUN_CONSO === void 0 ? void 0 : _window2$ALIYUN_CONSO.LOCALE.replace('-', '_');
|
|
25
|
+
if (['zh_CN', 'en_US', 'ja_JP', 'zh_TW', 'zh-HK'].includes(locale)) return locale;
|
|
26
|
+
return 'en_US';
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* get alfa release url
|
|
30
|
+
* @param appId
|
|
31
|
+
* @param env
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
export var getReleaseUrl = function getReleaseUrl(name, env) {
|
|
36
|
+
var cdnUrl = "https://cws.alicdn.com/Release/alfa/".concat(name, "/release.json");
|
|
37
|
+
var cdnPreUrl = "https://cws2.alicdn.com/Prepub/alfa/".concat(name, "/release.json");
|
|
38
|
+
|
|
39
|
+
switch (env) {
|
|
40
|
+
case 'local':
|
|
41
|
+
return process.env.ALFA_RELEASE_URL || cdnPreUrl;
|
|
42
|
+
|
|
43
|
+
case 'daily':
|
|
44
|
+
return cdnPreUrl;
|
|
45
|
+
|
|
46
|
+
case 'pre':
|
|
47
|
+
return cdnPreUrl;
|
|
48
|
+
|
|
49
|
+
case 'prod':
|
|
50
|
+
return cdnUrl;
|
|
51
|
+
|
|
52
|
+
default:
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return undefined;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* get alfa config url
|
|
60
|
+
* @param appId
|
|
61
|
+
* @param env
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
export var getConfigUrl = function getConfigUrl(name, env) {
|
|
66
|
+
var configUrl = "https://cws.alicdn.com/Release/alfa-products/".concat(name, "/config.json");
|
|
67
|
+
var configPreUrl = "https://cws2.alicdn.com/Prepub/alfa-products/".concat(name, "/config.json");
|
|
68
|
+
|
|
69
|
+
switch (env) {
|
|
70
|
+
case 'local':
|
|
71
|
+
return configPreUrl;
|
|
72
|
+
|
|
73
|
+
case 'daily':
|
|
74
|
+
return configPreUrl;
|
|
75
|
+
|
|
76
|
+
case 'pre':
|
|
77
|
+
return configPreUrl;
|
|
78
|
+
|
|
79
|
+
case 'prod':
|
|
80
|
+
return configUrl;
|
|
81
|
+
|
|
82
|
+
default:
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return undefined;
|
|
87
|
+
};
|
|
88
|
+
export var resolveReleaseUrl = function resolveReleaseUrl(option) {
|
|
89
|
+
return getReleaseUrl(option.name, option.env || getAlfaEnv());
|
|
90
|
+
};
|
|
91
|
+
export var resolveConfigUrl = function resolveConfigUrl(option) {
|
|
92
|
+
return getConfigUrl(option.name, option.env || getAlfaEnv());
|
|
93
|
+
};
|
|
94
|
+
export var getURL = function getURL(appConfig) {
|
|
95
|
+
var entry = appConfig.entry;
|
|
96
|
+
var url = '';
|
|
97
|
+
|
|
98
|
+
if (typeof entry === 'string') {
|
|
99
|
+
url = entry;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return url;
|
|
103
|
+
};
|
|
104
|
+
export var getManifestFromConfig = function getManifestFromConfig(appConfig) {
|
|
105
|
+
// 定义了 entry 时,优先从 entry 生成 manifest
|
|
106
|
+
if (appConfig.entry && typeof appConfig.entry !== 'string') {
|
|
107
|
+
return {
|
|
108
|
+
name: appConfig.name,
|
|
109
|
+
resources: {},
|
|
110
|
+
entrypoints: {
|
|
111
|
+
index: {
|
|
112
|
+
js: appConfig.entry.scripts,
|
|
113
|
+
css: appConfig.entry.styles
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return appConfig.manifest;
|
|
120
|
+
};
|
package/lib/createMicroApp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IAppConfig, IOptions } from './types';
|
|
2
|
-
export declare const createMicroApp: <T>(appConfig: IAppConfig<T>, options?: IOptions
|
|
2
|
+
export declare const createMicroApp: <T>(appConfig: IAppConfig<T>, options?: IOptions) => Promise<import("@alicloud/console-os-kernal/lib/application/Application").Application>;
|
package/lib/createMicroApp.js
CHANGED
|
@@ -11,7 +11,7 @@ var _utils = require("./utils");
|
|
|
11
11
|
|
|
12
12
|
var createMicroApp = function createMicroApp(appConfig) {
|
|
13
13
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
14
|
-
var manifest = (0, _utils.
|
|
14
|
+
var manifest = (0, _utils.getManifestFromConfig)(appConfig);
|
|
15
15
|
var url = (0, _utils.getURL)(appConfig);
|
|
16
16
|
|
|
17
17
|
if (!manifest && !url) {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { createMicroApp } from './createMicroApp';
|
|
2
|
-
export { getManifest } from './
|
|
3
|
-
export { getConfig } from './
|
|
4
|
-
export {
|
|
2
|
+
export { getManifest } from './utils/getAlfaManifest';
|
|
3
|
+
export { getConfig } from './utils/getAlfaConfig';
|
|
4
|
+
export { getLocale } from './utils/getAlfaLocale';
|
|
5
5
|
export { createEventBus, prefetch } from '@alicloud/console-os-kernal';
|
|
6
|
+
export { IAppConfig, IOptions, AlfaFactoryOption, AlfaDynamicConfig as AlfaConfig, IWin } from './types';
|
package/lib/index.js
CHANGED
|
@@ -12,13 +12,31 @@ Object.defineProperty(exports, "createMicroApp", {
|
|
|
12
12
|
Object.defineProperty(exports, "getManifest", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return
|
|
15
|
+
return _getAlfaManifest.getManifest;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "getConfig", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function get() {
|
|
21
|
-
return
|
|
21
|
+
return _getAlfaConfig.getConfig;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "getLocale", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _getAlfaLocale.getLocale;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "createEventBus", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _consoleOsKernal.createEventBus;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "prefetch", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _consoleOsKernal.prefetch;
|
|
22
40
|
}
|
|
23
41
|
});
|
|
24
42
|
Object.defineProperty(exports, "IAppConfig", {
|
|
@@ -45,25 +63,21 @@ Object.defineProperty(exports, "AlfaConfig", {
|
|
|
45
63
|
return _types.AlfaDynamicConfig;
|
|
46
64
|
}
|
|
47
65
|
});
|
|
48
|
-
Object.defineProperty(exports, "
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function get() {
|
|
51
|
-
return _consoleOsKernal.createEventBus;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "prefetch", {
|
|
66
|
+
Object.defineProperty(exports, "IWin", {
|
|
55
67
|
enumerable: true,
|
|
56
68
|
get: function get() {
|
|
57
|
-
return
|
|
69
|
+
return _types.IWin;
|
|
58
70
|
}
|
|
59
71
|
});
|
|
60
72
|
|
|
61
73
|
var _createMicroApp = require("./createMicroApp");
|
|
62
74
|
|
|
63
|
-
var
|
|
75
|
+
var _getAlfaManifest = require("./utils/getAlfaManifest");
|
|
76
|
+
|
|
77
|
+
var _getAlfaConfig = require("./utils/getAlfaConfig");
|
|
64
78
|
|
|
65
|
-
var
|
|
79
|
+
var _getAlfaLocale = require("./utils/getAlfaLocale");
|
|
66
80
|
|
|
67
|
-
var
|
|
81
|
+
var _consoleOsKernal = require("@alicloud/console-os-kernal");
|
|
68
82
|
|
|
69
|
-
var
|
|
83
|
+
var _types = require("./types");
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.getRelease = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
15
|
+
|
|
16
|
+
var _utils = require("./utils");
|
|
17
|
+
|
|
18
|
+
var getRelease = /*#__PURE__*/function () {
|
|
19
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(option) {
|
|
20
|
+
var resp;
|
|
21
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
22
|
+
while (1) {
|
|
23
|
+
switch (_context.prev = _context.next) {
|
|
24
|
+
case 0:
|
|
25
|
+
_context.next = 2;
|
|
26
|
+
return _axios.default.get((0, _utils.resolveReleaseUrl)(option));
|
|
27
|
+
|
|
28
|
+
case 2:
|
|
29
|
+
resp = _context.sent;
|
|
30
|
+
|
|
31
|
+
case 3:
|
|
32
|
+
case "end":
|
|
33
|
+
return _context.stop();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, _callee);
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
return function getRelease(_x) {
|
|
40
|
+
return _ref.apply(this, arguments);
|
|
41
|
+
};
|
|
42
|
+
}();
|
|
43
|
+
|
|
44
|
+
exports.getRelease = getRelease;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { OSApplication, SandBoxOption } from '@alicloud/console-os-kernal';
|
|
3
|
+
declare type Channel = string;
|
|
4
|
+
declare type ChannelLinks = Partial<Record<string, string>>;
|
|
5
|
+
declare type ChannelFeatures = Partial<Record<string, {
|
|
6
|
+
status: boolean;
|
|
7
|
+
attribute: {
|
|
8
|
+
customAttrs: Record<string, unknown>;
|
|
9
|
+
regions: {
|
|
10
|
+
region: string[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}>>;
|
|
14
|
+
declare type FeatureStatus = Partial<Record<string, string>>;
|
|
15
|
+
export interface IWin {
|
|
16
|
+
ALIYUN_CONSOLE_I18N_MESSAGE?: Record<string, string>;
|
|
17
|
+
ALIYUN_CONSOLE_CONFIG?: {
|
|
18
|
+
fEnv: string;
|
|
19
|
+
LOCALE: string;
|
|
20
|
+
CHANNEL: string;
|
|
21
|
+
CHANNEL_LINKS: ChannelLinks;
|
|
22
|
+
CHANNEL_FEATURE_STATUS: ChannelFeatures;
|
|
23
|
+
FEATURE_STATUS: FeatureStatus;
|
|
24
|
+
SEC_TOKEN: string;
|
|
25
|
+
portalType: string;
|
|
26
|
+
MAIN_ACCOUNT_PK: string;
|
|
27
|
+
CURRENT_PK: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface IAppManifest {
|
|
31
|
+
scripts: string[];
|
|
32
|
+
styles?: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface IAppConfig<T = any> {
|
|
35
|
+
entry?: IAppManifest | string;
|
|
36
|
+
name: string;
|
|
37
|
+
container?: HTMLElement | null;
|
|
38
|
+
props?: Record<string, T>;
|
|
39
|
+
manifest?: string;
|
|
40
|
+
logger?: {
|
|
41
|
+
debug: () => {};
|
|
42
|
+
error: () => {};
|
|
43
|
+
warn: () => {};
|
|
44
|
+
info: () => {};
|
|
45
|
+
};
|
|
46
|
+
deps?: {
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface IOptions {
|
|
51
|
+
sandbox?: boolean | SandBoxOption;
|
|
52
|
+
beforeMount?: (app: OSApplication) => void;
|
|
53
|
+
afterMount?: (app: OSApplication) => void;
|
|
54
|
+
beforeUnmount?: (app: OSApplication) => void;
|
|
55
|
+
afterUnmount?: (app: OSApplication) => void;
|
|
56
|
+
beforeUpdate?: (app: OSApplication) => void;
|
|
57
|
+
afterUpdate?: (app: OSApplication) => void;
|
|
58
|
+
}
|
|
59
|
+
export interface AlfaVersion {
|
|
60
|
+
entry: string;
|
|
61
|
+
}
|
|
62
|
+
export declare type LOCALE = 'en_US' | 'zh_CN' | 'zh_TW' | 'zh_HK' | 'ja_JP';
|
|
63
|
+
export declare type AlfaLocaleVersion = {
|
|
64
|
+
[key in LOCALE | 'entry']: string;
|
|
65
|
+
};
|
|
66
|
+
declare type Version = string;
|
|
67
|
+
export interface AlfaReleaseConfig {
|
|
68
|
+
'dist-tags': Record<string, string>;
|
|
69
|
+
versions: Record<Version, AlfaVersion>;
|
|
70
|
+
'locales-versions': Record<Version, AlfaLocaleVersion>;
|
|
71
|
+
}
|
|
72
|
+
declare type AlfaChannelLinks = Partial<Record<Channel, ChannelLinks>>;
|
|
73
|
+
declare type AlfaChannelFeatures = Partial<Record<Channel, ChannelFeatures>>;
|
|
74
|
+
interface AlfaFeature {
|
|
75
|
+
enableSampling: boolean;
|
|
76
|
+
enableWhiteList: boolean;
|
|
77
|
+
enableBlockList: boolean;
|
|
78
|
+
sampling: number;
|
|
79
|
+
whiteList: string[];
|
|
80
|
+
blockList: string[];
|
|
81
|
+
}
|
|
82
|
+
declare type AlfaFeatures = Partial<Record<string, AlfaFeature>>;
|
|
83
|
+
export interface AlfaDynamicConfig {
|
|
84
|
+
ALL_CHANNEL_LINKS: AlfaChannelLinks;
|
|
85
|
+
ALL_CHANNEL_FEATURE_STATUS: AlfaChannelFeatures;
|
|
86
|
+
ALL_FEATURE_STATUS: AlfaFeatures;
|
|
87
|
+
}
|
|
88
|
+
export declare type EnvEnum = 'prod' | 'local' | 'pre' | 'daily';
|
|
89
|
+
export interface AlfaFactoryOption extends IOptions {
|
|
90
|
+
name: string;
|
|
91
|
+
version?: string;
|
|
92
|
+
env?: EnvEnum;
|
|
93
|
+
loading?: boolean | React.ReactChild;
|
|
94
|
+
url?: string;
|
|
95
|
+
manifest?: string;
|
|
96
|
+
dependencies?: Record<string, any>;
|
|
97
|
+
dynamicConfig?: boolean;
|
|
98
|
+
}
|
|
99
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|