@alicloud/alfa-react 1.3.0-canary.5 → 1.3.0-canary.6
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/dist/index.js +4 -4
- package/es/app/createIsomorphicMicroApp.js +1 -1
- package/es/app.js +7 -1
- package/es/utils.js +3 -0
- package/lib/app/createIsomorphicMicroApp.d.ts +2 -0
- package/lib/app/createIsomorphicMicroApp.js +2 -2
- package/lib/app.js +7 -0
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +8 -2
- package/package.json +3 -3
- package/lib/createAlfaApp.d.ts +0 -4
- package/lib/createAlfaApp.js +0 -135
- package/lib/createAlfaWidget.d.ts +0 -4
- package/lib/createAlfaWidget.js +0 -145
- package/lib/createApplication.d.ts +0 -12
- package/lib/createApplication.js +0 -133
- package/lib/types/base.d.ts +0 -11
- package/lib/types/base.js +0 -37
- package/lib/types/index.d.ts +0 -86
- package/lib/types/index.js +0 -5
- package/lib/utils/getConsoleConfig.d.ts +0 -21
- package/lib/utils/getConsoleConfig.js +0 -102
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -12
package/lib/types/index.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import React from 'React';
|
|
3
|
-
import { createMicroApp, IAppConfig } from '@alicloud/alfa-core';
|
|
4
|
-
export interface AlfaVersion {
|
|
5
|
-
entry: string;
|
|
6
|
-
}
|
|
7
|
-
declare type Version = string;
|
|
8
|
-
export interface AlfaReleaseConfig {
|
|
9
|
-
versions: Record<Version, AlfaVersion>;
|
|
10
|
-
'dist-tag': Record<string, string>;
|
|
11
|
-
}
|
|
12
|
-
export declare type EnvEnum = 'prod' | 'local' | 'pre' | 'daily';
|
|
13
|
-
export interface AlfaFactoryOption extends IAppConfig {
|
|
14
|
-
loading?: boolean | React.ReactChild;
|
|
15
|
-
dependencies?: Record<string, any>;
|
|
16
|
-
className?: string;
|
|
17
|
-
style?: Record<string, any>;
|
|
18
|
-
unstable_runtime?: {
|
|
19
|
-
css?: Record<string, string>;
|
|
20
|
-
js?: Record<string, string>;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
declare type OmitKeys = 'manifest';
|
|
24
|
-
export interface WidgetFactoryOption extends Omit<AlfaFactoryOption, OmitKeys> {
|
|
25
|
-
runtimeVersion?: string;
|
|
26
|
-
alfaLoader?: boolean;
|
|
27
|
-
theme?: string;
|
|
28
|
-
}
|
|
29
|
-
export interface AlfaEnvConfigDescriptor {
|
|
30
|
-
releaseUrl: string;
|
|
31
|
-
configUrl?: string;
|
|
32
|
-
cdnBackupUrl?: string;
|
|
33
|
-
resourceUrl?: string;
|
|
34
|
-
}
|
|
35
|
-
export interface AlfaEnvConfig {
|
|
36
|
-
daily: AlfaEnvConfigDescriptor;
|
|
37
|
-
local: AlfaEnvConfigDescriptor;
|
|
38
|
-
pre: AlfaEnvConfigDescriptor;
|
|
39
|
-
prod: AlfaEnvConfigDescriptor;
|
|
40
|
-
}
|
|
41
|
-
export interface WidgetReleaseConfig {
|
|
42
|
-
[id: string]: {
|
|
43
|
-
[version: string]: {
|
|
44
|
-
latest: string;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export interface WidgetCWSConfig {
|
|
49
|
-
conf: {
|
|
50
|
-
[channel: string]: {
|
|
51
|
-
[key: string]: string;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
features: {
|
|
55
|
-
[channel: string]: {
|
|
56
|
-
[key: string]: boolean;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
links: {
|
|
60
|
-
[channel: string]: {
|
|
61
|
-
[key: string]: string;
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
locales: {
|
|
65
|
-
[locale: string]: {
|
|
66
|
-
messages: {
|
|
67
|
-
[key: string]: string;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
export interface WidgetRuntime {
|
|
73
|
-
react: any;
|
|
74
|
-
reactDom: any;
|
|
75
|
-
axios: any;
|
|
76
|
-
'prop-types': any;
|
|
77
|
-
'@ali/wind': any;
|
|
78
|
-
'@ali/wind-utils-console': any;
|
|
79
|
-
'@ali/wind-intl': any;
|
|
80
|
-
'@ali/wind-intl/lib/Provider': any;
|
|
81
|
-
'@ali/wind-intl/lib/withRcIntl': any;
|
|
82
|
-
'@ali/widget-utils-console': any;
|
|
83
|
-
}
|
|
84
|
-
declare type ThenArg<T> = T extends PromiseLike<infer U> ? U : T;
|
|
85
|
-
export declare type MicroApplication = ThenArg<ReturnType<typeof createMicroApp>>;
|
|
86
|
-
export {};
|
package/lib/types/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { IAppConfig } from '@alicloud/alfa-core';
|
|
2
|
-
export declare const getConsoleConfig: (config: IAppConfig, consoleConfig: any) => Promise<{
|
|
3
|
-
CHANNEL_LINKS: Partial<Record<string, string>>;
|
|
4
|
-
CHANNEL_FEATURE_STATUS: Partial<Record<string, {
|
|
5
|
-
status: boolean;
|
|
6
|
-
attribute: {
|
|
7
|
-
customAttrs: Record<string, unknown>;
|
|
8
|
-
regions: {
|
|
9
|
-
region: string[];
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
}>>;
|
|
13
|
-
FEATURE_STATUS: Partial<Record<string, boolean>>;
|
|
14
|
-
fEnv?: string | undefined;
|
|
15
|
-
LOCALE?: string | undefined;
|
|
16
|
-
CHANNEL?: string | undefined;
|
|
17
|
-
SEC_TOKEN?: string | undefined;
|
|
18
|
-
portalType?: string | undefined;
|
|
19
|
-
MAIN_ACCOUNT_PK?: string | undefined;
|
|
20
|
-
CURRENT_PK?: string | undefined;
|
|
21
|
-
}>;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.getConsoleConfig = void 0;
|
|
9
|
-
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
|
-
var _alfaCore = require("@alicloud/alfa-core");
|
|
17
|
-
|
|
18
|
-
var _md = _interopRequireDefault(require("crypto-js/md5"));
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* transform
|
|
26
|
-
* @param features
|
|
27
|
-
*/
|
|
28
|
-
//@ts-ignore
|
|
29
|
-
var processFeatures = function processFeatures(features) {
|
|
30
|
-
return Object.keys(features).reduce(function (newFeatures, key) {
|
|
31
|
-
var _ALIYUN_CONSOLE_CONFI;
|
|
32
|
-
|
|
33
|
-
var feature = features[key];
|
|
34
|
-
if (!feature) return newFeatures;
|
|
35
|
-
var uid = ((_ALIYUN_CONSOLE_CONFI = window.ALIYUN_CONSOLE_CONFIG) === null || _ALIYUN_CONSOLE_CONFI === void 0 ? void 0 : _ALIYUN_CONSOLE_CONFI.CURRENT_PK) || '';
|
|
36
|
-
var md5Uid = (0, _md.default)(uid).toString();
|
|
37
|
-
var enableBlockList = feature.enableBlockList,
|
|
38
|
-
enableSampling = feature.enableSampling,
|
|
39
|
-
enableWhiteList = feature.enableWhiteList,
|
|
40
|
-
sampling = feature.sampling,
|
|
41
|
-
blockList = feature.blockList,
|
|
42
|
-
whiteList = feature.whiteList;
|
|
43
|
-
|
|
44
|
-
if (enableBlockList && blockList.includes(md5Uid)) {
|
|
45
|
-
newFeatures[key] = false;
|
|
46
|
-
} else if (enableWhiteList && whiteList.includes(md5Uid)) {
|
|
47
|
-
newFeatures[key] = true;
|
|
48
|
-
} else if (enableSampling) {
|
|
49
|
-
var gray = uid.substring(uid.length - 2);
|
|
50
|
-
if (Number(gray) >= sampling * 100 || sampling === 0) newFeatures[key] = false;
|
|
51
|
-
newFeatures[key] = true;
|
|
52
|
-
} else {
|
|
53
|
-
newFeatures[key] = false;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return newFeatures;
|
|
57
|
-
}, {});
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
var mergeConfigDataWithConsoleConfig = function mergeConfigDataWithConsoleConfig(configData, consoleConfig) {
|
|
61
|
-
var _window, _window$ALIYUN_CONSOL, _configData$ALL_CHANN, _configData$ALL_CHANN2;
|
|
62
|
-
|
|
63
|
-
var channel = ((_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.CHANNEL) || 'OFFICIAL';
|
|
64
|
-
var channelLinks = ((_configData$ALL_CHANN = configData.ALL_CHANNEL_LINKS) === null || _configData$ALL_CHANN === void 0 ? void 0 : _configData$ALL_CHANN[channel]) || {};
|
|
65
|
-
var channelFeatures = ((_configData$ALL_CHANN2 = configData.ALL_CHANNEL_FEATURE_STATUS) === null || _configData$ALL_CHANN2 === void 0 ? void 0 : _configData$ALL_CHANN2[channel]) || {}; //@ts-ignore
|
|
66
|
-
|
|
67
|
-
var features = configData.ALL_FEATURE_STATUS || {};
|
|
68
|
-
return _objectSpread(_objectSpread({}, consoleConfig), {}, {
|
|
69
|
-
CHANNEL_LINKS: channelLinks,
|
|
70
|
-
CHANNEL_FEATURE_STATUS: channelFeatures,
|
|
71
|
-
FEATURE_STATUS: processFeatures(features)
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
var getConsoleConfig = /*#__PURE__*/function () {
|
|
76
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(config, consoleConfig) {
|
|
77
|
-
var configData;
|
|
78
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
79
|
-
while (1) {
|
|
80
|
-
switch (_context.prev = _context.next) {
|
|
81
|
-
case 0:
|
|
82
|
-
_context.next = 2;
|
|
83
|
-
return (0, _alfaCore.getConfig)(config);
|
|
84
|
-
|
|
85
|
-
case 2:
|
|
86
|
-
configData = _context.sent;
|
|
87
|
-
return _context.abrupt("return", mergeConfigDataWithConsoleConfig(configData, consoleConfig));
|
|
88
|
-
|
|
89
|
-
case 4:
|
|
90
|
-
case "end":
|
|
91
|
-
return _context.stop();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}, _callee);
|
|
95
|
-
}));
|
|
96
|
-
|
|
97
|
-
return function getConsoleConfig(_x, _x2) {
|
|
98
|
-
return _ref.apply(this, arguments);
|
|
99
|
-
};
|
|
100
|
-
}();
|
|
101
|
-
|
|
102
|
-
exports.getConsoleConfig = getConsoleConfig;
|
package/lib/utils/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const normalizeName: (name: string) => string;
|
package/lib/utils/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.normalizeName = void 0;
|
|
7
|
-
|
|
8
|
-
var normalizeName = function normalizeName(name) {
|
|
9
|
-
return name.replace(/@/g, '').replace(/\//g, '-');
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
exports.normalizeName = normalizeName;
|