@alicloud/alfa-react 1.4.40-alpha.0 → 1.5.0-alpha.0
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/LICENSE +21 -0
- package/es/components/ErrorBoundary/ErrorPanel.js +0 -2
- package/es/components/ErrorBoundary/index.js +7 -19
- package/es/components/Loading/Paragraph.js +9 -25
- package/es/components/Loading/Skeleton.js +14 -46
- package/es/components/Loading/Title.js +3 -8
- package/es/components/Loading/index.js +0 -2
- package/es/createAlfaApp.js +6 -10
- package/es/createAlfaWidget.js +16 -28
- package/es/createApplication.js +154 -188
- package/es/hooks/beforeLoadHook.js +60 -81
- package/es/hooks/beforeResolveHook.js +24 -29
- package/es/index.js +2 -2
- package/es/types/base.js +0 -9
- package/es/utils/counter.js +1 -3
- package/es/utils/getConsoleConfig.js +13 -32
- package/es/utils/getConsoleGlobal.js +6 -13
- package/es/utils/index.js +2 -1
- package/es/version.js +1 -1
- package/es/widget/emitter.js +2 -11
- package/es/widget/env.js +2 -4
- package/es/widget/getWidgetConfigById.js +19 -27
- package/es/widget/getWidgetDeps.js +104 -130
- package/es/widget/getWidgetVersionById.js +79 -106
- package/es/widget.js +45 -58
- package/lib/addGlobalRequestInterceptor.js +0 -2
- package/lib/components/ErrorBoundary/ErrorPanel.js +0 -5
- package/lib/components/ErrorBoundary/index.js +7 -25
- package/lib/components/Loading/Paragraph.js +9 -32
- package/lib/components/Loading/Skeleton.js +14 -60
- package/lib/components/Loading/Title.js +3 -14
- package/lib/components/Loading/index.js +0 -6
- package/lib/createAlfaApp.js +6 -24
- package/lib/createAlfaWidget.js +16 -45
- package/lib/createApplication.js +154 -199
- package/lib/hooks/beforeLoadHook.js +60 -88
- package/lib/hooks/beforeResolveHook.js +21 -33
- package/lib/index.js +0 -9
- package/lib/types/base.js +0 -14
- package/lib/utils/counter.js +1 -4
- package/lib/utils/getConsoleConfig.js +12 -37
- package/lib/utils/getConsoleGlobal.js +6 -18
- package/lib/utils/index.js +2 -5
- package/lib/version.js +1 -1
- package/lib/widget/emitter.js +2 -16
- package/lib/widget/env.js +2 -6
- package/lib/widget/getWidgetConfigById.js +19 -36
- package/lib/widget/getWidgetDeps.js +103 -146
- package/lib/widget/getWidgetVersionById.js +79 -113
- package/lib/widget/index.js +0 -8
- package/lib/widget.js +45 -72
- package/package.json +22 -19
- package/types/components/ErrorBoundary/index.d.ts +1 -1
- package/types/components/Loading/Paragraph.d.ts +1 -1
- package/types/components/Loading/Skeleton.d.ts +2 -2
- package/types/createAlfaApp.d.ts +7 -1
- package/types/createAlfaWidget.d.ts +2 -2
- package/types/createApplication.d.ts +1 -0
- package/types/types/index.d.ts +5 -5
- package/types/utils/getConsoleConfig.d.ts +4 -2
- package/types/utils/getConsoleGlobal.d.ts +3 -1
- package/types/version.d.ts +1 -1
- package/types/widget/getWidgetDeps.d.ts +1 -1
- package/dist/index.js +0 -21
- package/es/app.js +0 -194
- package/es/hooks/afterLoadHook.js +0 -69
- package/lib/app.d.ts +0 -3
- package/lib/app.js +0 -223
- package/lib/components/ErrorBoundary/ErrorPanel.d.ts +0 -6
- package/lib/components/ErrorBoundary/index.d.ts +0 -17
- package/lib/components/Loading/Paragraph.d.ts +0 -14
- package/lib/components/Loading/Skeleton.d.ts +0 -19
- package/lib/components/Loading/Title.d.ts +0 -8
- package/lib/components/Loading/index.d.ts +0 -4
- package/lib/components/Loading/style.d.ts +0 -2
- package/lib/createAlfaApp.d.ts +0 -7
- package/lib/createAlfaWidget.d.ts +0 -4
- package/lib/createApplication.d.ts +0 -12
- package/lib/hooks/afterLoadHook.d.ts +0 -3
- package/lib/hooks/afterLoadHook.js +0 -84
- package/lib/hooks/beforeLoadHook.d.ts +0 -3
- package/lib/hooks/beforeResolveHook.d.ts +0 -3
- package/lib/index.d.ts +0 -4
- package/lib/types/base.d.ts +0 -11
- package/lib/types/index.d.ts +0 -91
- package/lib/utils/getConsoleConfig.d.ts +0 -1
- package/lib/utils/getConsoleGlobal.d.ts +0 -1
- package/lib/utils/index.d.ts +0 -1
- package/lib/version.d.ts +0 -1
- package/lib/widget/emitter.d.ts +0 -8
- package/lib/widget/env.d.ts +0 -4
- package/lib/widget/getWidgetConfigById.d.ts +0 -2
- package/lib/widget/getWidgetDeps.d.ts +0 -2
- package/lib/widget/getWidgetVersionById.d.ts +0 -6
- package/lib/widget/index.d.ts +0 -4
- package/lib/widget.d.ts +0 -2
|
@@ -1,84 +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.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
|
-
|
|
18
|
-
var _alfaCore = require("@alicloud/alfa-core");
|
|
19
|
-
|
|
20
|
-
var _getConsoleConfig = require("../utils/getConsoleConfig");
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
24
|
-
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; }
|
|
25
|
-
|
|
26
|
-
// inject consoleConfig & locales after load
|
|
27
|
-
function afterLoadHook(_x) {
|
|
28
|
-
return _afterLoadHook.apply(this, arguments);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function _afterLoadHook() {
|
|
32
|
-
_afterLoadHook = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(appConfig) {
|
|
33
|
-
var app, logger, defaultConsoleConfig, CONFIG_START_TIME, _yield$Promise$all$ca, _yield$Promise$all$ca2, consoleConfig, messages, CONFIG_END_TIME, i18nMessages, END_TIME;
|
|
34
|
-
|
|
35
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
36
|
-
while (1) {
|
|
37
|
-
switch (_context.prev = _context.next) {
|
|
38
|
-
case 0:
|
|
39
|
-
app = appConfig.app, logger = appConfig.logger;
|
|
40
|
-
defaultConsoleConfig = window.ALIYUN_CONSOLE_CONFIG || {};
|
|
41
|
-
CONFIG_START_TIME = Date.now();
|
|
42
|
-
_context.next = 5;
|
|
43
|
-
return Promise.all([(0, _getConsoleConfig.getConsoleConfig)(appConfig, defaultConsoleConfig), (0, _alfaCore.getLocale)(appConfig)]).catch(function (e) {
|
|
44
|
-
logger === null || logger === void 0 ? void 0 : logger.error({
|
|
45
|
-
E_MSG: 'fetch config & locale error.',
|
|
46
|
-
E_STACK: e
|
|
47
|
-
});
|
|
48
|
-
return [{}, {}];
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
case 5:
|
|
52
|
-
_yield$Promise$all$ca = _context.sent;
|
|
53
|
-
_yield$Promise$all$ca2 = (0, _slicedToArray2.default)(_yield$Promise$all$ca, 2);
|
|
54
|
-
consoleConfig = _yield$Promise$all$ca2[0];
|
|
55
|
-
messages = _yield$Promise$all$ca2[1];
|
|
56
|
-
CONFIG_END_TIME = Date.now();
|
|
57
|
-
i18nMessages = _objectSpread(_objectSpread({}, window.ALIYUN_CONSOLE_I18N_MESSAGE), messages);
|
|
58
|
-
|
|
59
|
-
if (app && app.context) {
|
|
60
|
-
app.context.window.ALIYUN_CONSOLE_CONFIG = consoleConfig;
|
|
61
|
-
app.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = i18nMessages; // (app.context.history as any) = {};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
END_TIME = Date.now();
|
|
65
|
-
logger === null || logger === void 0 ? void 0 : logger.record({
|
|
66
|
-
CONFIG_START_TIME: CONFIG_START_TIME,
|
|
67
|
-
CONFIG_END_TIME: CONFIG_END_TIME,
|
|
68
|
-
END_TIME: END_TIME
|
|
69
|
-
});
|
|
70
|
-
logger === null || logger === void 0 ? void 0 : logger.send();
|
|
71
|
-
return _context.abrupt("return", appConfig);
|
|
72
|
-
|
|
73
|
-
case 16:
|
|
74
|
-
case "end":
|
|
75
|
-
return _context.stop();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}, _callee);
|
|
79
|
-
}));
|
|
80
|
-
return _afterLoadHook.apply(this, arguments);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
var _default = afterLoadHook;
|
|
84
|
-
exports.default = _default;
|
package/lib/index.d.ts
DELETED
package/lib/types/base.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React, { HTMLAttributes } from 'react';
|
|
2
|
-
import { IAppConfig, IOptions, AlfaEnvEnum } from '@alicloud/alfa-core';
|
|
3
|
-
export interface IProps<T = any> extends HTMLAttributes<Element>, IAppConfig, IOptions {
|
|
4
|
-
loading?: boolean | React.ReactChild;
|
|
5
|
-
consoleConfig?: any;
|
|
6
|
-
i18nMessages?: any;
|
|
7
|
-
env?: AlfaEnvEnum;
|
|
8
|
-
dependencies?: any;
|
|
9
|
-
}
|
|
10
|
-
export default class MicroAppBase<T> extends React.Component<Partial<IProps<T>>> {
|
|
11
|
-
}
|
package/lib/types/index.d.ts
DELETED
|
@@ -1,91 +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
|
-
runtimeVersion?: string;
|
|
23
|
-
fallbackRender?: (error: Error) => Element;
|
|
24
|
-
}
|
|
25
|
-
declare type OmitKeys = 'manifest';
|
|
26
|
-
export interface WidgetFactoryOption extends Omit<AlfaFactoryOption, OmitKeys> {
|
|
27
|
-
runtimeVersion?: string;
|
|
28
|
-
alfaLoader?: boolean;
|
|
29
|
-
theme?: string;
|
|
30
|
-
central?: boolean;
|
|
31
|
-
host?: string;
|
|
32
|
-
configHost?: string;
|
|
33
|
-
}
|
|
34
|
-
export interface AlfaEnvConfigDescriptor {
|
|
35
|
-
releaseUrl: string;
|
|
36
|
-
configUrl?: string;
|
|
37
|
-
cdnBackupUrl?: string;
|
|
38
|
-
resourceUrl?: string;
|
|
39
|
-
}
|
|
40
|
-
export interface AlfaEnvConfig {
|
|
41
|
-
daily: AlfaEnvConfigDescriptor;
|
|
42
|
-
local: AlfaEnvConfigDescriptor;
|
|
43
|
-
pre: AlfaEnvConfigDescriptor;
|
|
44
|
-
prod: AlfaEnvConfigDescriptor;
|
|
45
|
-
}
|
|
46
|
-
export interface WidgetReleaseConfig {
|
|
47
|
-
[id: string]: {
|
|
48
|
-
[version: string]: {
|
|
49
|
-
latest: string;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export interface WidgetCWSConfig {
|
|
54
|
-
conf: {
|
|
55
|
-
[channel: string]: {
|
|
56
|
-
[key: string]: string;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
features: {
|
|
60
|
-
[channel: string]: {
|
|
61
|
-
[key: string]: boolean;
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
links: {
|
|
65
|
-
[channel: string]: {
|
|
66
|
-
[key: string]: string;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
locales: {
|
|
70
|
-
[locale: string]: {
|
|
71
|
-
messages: {
|
|
72
|
-
[key: string]: string;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
export interface WidgetRuntime {
|
|
78
|
-
react: any;
|
|
79
|
-
reactDom: any;
|
|
80
|
-
axios: any;
|
|
81
|
-
'prop-types': any;
|
|
82
|
-
'@ali/wind': any;
|
|
83
|
-
'@ali/wind-utils-console': any;
|
|
84
|
-
'@ali/wind-intl': any;
|
|
85
|
-
'@ali/wind-intl/lib/Provider': any;
|
|
86
|
-
'@ali/wind-intl/lib/withRcIntl': any;
|
|
87
|
-
'@ali/widget-utils-console': any;
|
|
88
|
-
}
|
|
89
|
-
declare type ThenArg<T> = T extends PromiseLike<infer U> ? U : T;
|
|
90
|
-
export declare type MicroApplication = ThenArg<ReturnType<typeof createMicroApp>>;
|
|
91
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getConsoleConfig: (configData: any, consoleConfig: any) => Promise<any>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getConsoleGlobal: (configData: any, global: any) => Promise<any>;
|
package/lib/utils/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const normalizeName: (name: string) => string;
|
package/lib/version.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const version = "1.4.0";
|
package/lib/widget/emitter.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from 'events';
|
|
3
|
-
declare class WidgetEventEmitter extends EventEmitter {
|
|
4
|
-
refersh(widgetId: string): boolean;
|
|
5
|
-
refershWidget(widgetId: string): boolean;
|
|
6
|
-
}
|
|
7
|
-
declare const _default: WidgetEventEmitter;
|
|
8
|
-
export default _default;
|
package/lib/widget/env.d.ts
DELETED
package/lib/widget/index.d.ts
DELETED
package/lib/widget.d.ts
DELETED