@alicloud/alfa-react 1.4.6 → 1.4.9-alpha.2
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/dist/index.js +5 -20
- package/es/addGlobalRequestInterceptor.js +4 -0
- package/es/createApplication.js +20 -13
- package/es/index.js +2 -1
- package/es/version.js +1 -1
- package/lib/addGlobalRequestInterceptor.js +12 -0
- package/lib/createApplication.js +19 -13
- package/lib/index.js +8 -0
- package/lib/version.js +1 -1
- package/package.json +5 -3
- package/types/addGlobalRequestInterceptor.d.ts +2 -0
- package/types/index.d.ts +1 -0
- package/types/version.d.ts +1 -1
package/es/createApplication.js
CHANGED
|
@@ -86,8 +86,12 @@ export default function createApplication(loader) {
|
|
|
86
86
|
};
|
|
87
87
|
}, []);
|
|
88
88
|
useEffect(function () {
|
|
89
|
+
var App;
|
|
90
|
+
|
|
89
91
|
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
90
|
-
var
|
|
92
|
+
var _app$context$updateBo, _app$context;
|
|
93
|
+
|
|
94
|
+
var _yield$loader$registe, app, logger;
|
|
91
95
|
|
|
92
96
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
93
97
|
while (1) {
|
|
@@ -100,11 +104,12 @@ export default function createApplication(loader) {
|
|
|
100
104
|
|
|
101
105
|
case 2:
|
|
102
106
|
_yield$loader$registe = _context.sent;
|
|
103
|
-
|
|
107
|
+
app = _yield$loader$registe.app;
|
|
104
108
|
logger = _yield$loader$registe.logger;
|
|
109
|
+
App = app;
|
|
105
110
|
|
|
106
|
-
if (
|
|
107
|
-
_context.next =
|
|
111
|
+
if (app) {
|
|
112
|
+
_context.next = 8;
|
|
108
113
|
break;
|
|
109
114
|
}
|
|
110
115
|
|
|
@@ -113,9 +118,9 @@ export default function createApplication(loader) {
|
|
|
113
118
|
E_MSG: 'load app failed.'
|
|
114
119
|
}));
|
|
115
120
|
|
|
116
|
-
case
|
|
121
|
+
case 8:
|
|
117
122
|
if (appRef.current) {
|
|
118
|
-
_context.next =
|
|
123
|
+
_context.next = 10;
|
|
119
124
|
break;
|
|
120
125
|
}
|
|
121
126
|
|
|
@@ -124,16 +129,18 @@ export default function createApplication(loader) {
|
|
|
124
129
|
E_MSG: 'cannot find container.'
|
|
125
130
|
}));
|
|
126
131
|
|
|
127
|
-
case
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
case 10:
|
|
133
|
+
// update body in sandbox context
|
|
134
|
+
(_app$context$updateBo = (_app$context = app.context).updateBody) === null || _app$context$updateBo === void 0 ? void 0 : _app$context$updateBo.call(_app$context, memoOptions.sandbox.disableFakeBody ? document.body : appRef.current);
|
|
135
|
+
_context.next = 13;
|
|
136
|
+
return app.mount(appRef.current, {
|
|
130
137
|
customProps: customProps
|
|
131
138
|
});
|
|
132
139
|
|
|
133
|
-
case
|
|
134
|
-
setApp(
|
|
140
|
+
case 13:
|
|
141
|
+
setApp(app);
|
|
135
142
|
|
|
136
|
-
case
|
|
143
|
+
case 14:
|
|
137
144
|
case "end":
|
|
138
145
|
return _context.stop();
|
|
139
146
|
}
|
|
@@ -146,7 +153,7 @@ export default function createApplication(loader) {
|
|
|
146
153
|
});
|
|
147
154
|
|
|
148
155
|
return function () {
|
|
149
|
-
|
|
156
|
+
App && App.unmount();
|
|
150
157
|
};
|
|
151
158
|
}, [memoOptions]);
|
|
152
159
|
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as createAlfaApp } from './createAlfaApp';
|
|
2
2
|
export { default as createAlfaWidget } from './createAlfaWidget';
|
|
3
|
-
export { eventEmitter as widgetEventEmitter } from './widget/index';
|
|
3
|
+
export { eventEmitter as widgetEventEmitter } from './widget/index';
|
|
4
|
+
export { default as addGlobalRequestInterceptor } from './addGlobalRequestInterceptor'; // todo
|
|
4
5
|
|
|
5
6
|
export { createEventBus, prefetch } from '@alicloud/alfa-core';
|
package/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '1.4.
|
|
1
|
+
export var version = '1.4.9-alpha.2';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = addGlobalRequestInterceptor;
|
|
7
|
+
|
|
8
|
+
var _alfaCore = require("@alicloud/alfa-core");
|
|
9
|
+
|
|
10
|
+
function addGlobalRequestInterceptor(interceptor) {
|
|
11
|
+
(0, _alfaCore.addRequestInterceptor)(interceptor);
|
|
12
|
+
}
|
package/lib/createApplication.js
CHANGED
|
@@ -108,8 +108,11 @@ function createApplication(loader) {
|
|
|
108
108
|
};
|
|
109
109
|
}, []);
|
|
110
110
|
(0, _react.useEffect)(function () {
|
|
111
|
+
var App;
|
|
111
112
|
(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
112
|
-
var
|
|
113
|
+
var _app$context$updateBo, _app$context;
|
|
114
|
+
|
|
115
|
+
var _yield$loader$registe, app, logger;
|
|
113
116
|
|
|
114
117
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
115
118
|
while (1) {
|
|
@@ -122,11 +125,12 @@ function createApplication(loader) {
|
|
|
122
125
|
|
|
123
126
|
case 2:
|
|
124
127
|
_yield$loader$registe = _context.sent;
|
|
125
|
-
|
|
128
|
+
app = _yield$loader$registe.app;
|
|
126
129
|
logger = _yield$loader$registe.logger;
|
|
130
|
+
App = app;
|
|
127
131
|
|
|
128
|
-
if (
|
|
129
|
-
_context.next =
|
|
132
|
+
if (app) {
|
|
133
|
+
_context.next = 8;
|
|
130
134
|
break;
|
|
131
135
|
}
|
|
132
136
|
|
|
@@ -135,9 +139,9 @@ function createApplication(loader) {
|
|
|
135
139
|
E_MSG: 'load app failed.'
|
|
136
140
|
}));
|
|
137
141
|
|
|
138
|
-
case
|
|
142
|
+
case 8:
|
|
139
143
|
if (appRef.current) {
|
|
140
|
-
_context.next =
|
|
144
|
+
_context.next = 10;
|
|
141
145
|
break;
|
|
142
146
|
}
|
|
143
147
|
|
|
@@ -146,16 +150,18 @@ function createApplication(loader) {
|
|
|
146
150
|
E_MSG: 'cannot find container.'
|
|
147
151
|
}));
|
|
148
152
|
|
|
149
|
-
case
|
|
150
|
-
|
|
151
|
-
|
|
153
|
+
case 10:
|
|
154
|
+
// update body in sandbox context
|
|
155
|
+
(_app$context$updateBo = (_app$context = app.context).updateBody) === null || _app$context$updateBo === void 0 ? void 0 : _app$context$updateBo.call(_app$context, memoOptions.sandbox.disableFakeBody ? document.body : appRef.current);
|
|
156
|
+
_context.next = 13;
|
|
157
|
+
return app.mount(appRef.current, {
|
|
152
158
|
customProps: customProps
|
|
153
159
|
});
|
|
154
160
|
|
|
155
|
-
case
|
|
156
|
-
setApp(
|
|
161
|
+
case 13:
|
|
162
|
+
setApp(app);
|
|
157
163
|
|
|
158
|
-
case
|
|
164
|
+
case 14:
|
|
159
165
|
case "end":
|
|
160
166
|
return _context.stop();
|
|
161
167
|
}
|
|
@@ -167,7 +173,7 @@ function createApplication(loader) {
|
|
|
167
173
|
});
|
|
168
174
|
});
|
|
169
175
|
return function () {
|
|
170
|
-
|
|
176
|
+
App && App.unmount();
|
|
171
177
|
};
|
|
172
178
|
}, [memoOptions]);
|
|
173
179
|
|
package/lib/index.js
CHANGED
|
@@ -5,6 +5,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
Object.defineProperty(exports, "addGlobalRequestInterceptor", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _addGlobalRequestInterceptor.default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
8
14
|
Object.defineProperty(exports, "createAlfaApp", {
|
|
9
15
|
enumerable: true,
|
|
10
16
|
get: function get() {
|
|
@@ -42,4 +48,6 @@ var _createAlfaWidget = _interopRequireDefault(require("./createAlfaWidget"));
|
|
|
42
48
|
|
|
43
49
|
var _index = require("./widget/index");
|
|
44
50
|
|
|
51
|
+
var _addGlobalRequestInterceptor = _interopRequireDefault(require("./addGlobalRequestInterceptor"));
|
|
52
|
+
|
|
45
53
|
var _alfaCore = require("@alicloud/alfa-core");
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alicloud/alfa-react",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9-alpha.2",
|
|
4
4
|
"description": "Alfa Framework (React Version)",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@alicloud/console-toolkit-cli": "^1.0.0",
|
|
27
27
|
"@alicloud/console-toolkit-preset-wind-component": "^1.0.0",
|
|
28
|
+
"@types/axios": "^0.14.0",
|
|
28
29
|
"@types/chai": "^4.1.7",
|
|
29
30
|
"@types/classnames": "^2.2.9",
|
|
30
31
|
"@types/crypto-js": "^4.0.2",
|
|
@@ -37,10 +38,11 @@
|
|
|
37
38
|
"react": "^16.9.0",
|
|
38
39
|
"react-dom": "^16.9.0",
|
|
39
40
|
"ts-jest": "^23.10.5",
|
|
41
|
+
"tslib": "^2.4.0",
|
|
40
42
|
"typescript": "^3.0.3"
|
|
41
43
|
},
|
|
42
44
|
"dependencies": {
|
|
43
|
-
"@alicloud/alfa-core": "^1.4.
|
|
45
|
+
"@alicloud/alfa-core": "^1.4.9-alpha.2",
|
|
44
46
|
"@alicloud/console-os-loader": "^1.2.3",
|
|
45
47
|
"@alicloud/widget-utils-console": "^0.1.6",
|
|
46
48
|
"classnames": "^2.2.6",
|
|
@@ -49,5 +51,5 @@
|
|
|
49
51
|
"peerDependencies": {
|
|
50
52
|
"react": "^16 | ^17"
|
|
51
53
|
},
|
|
52
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "79ca36eb444681042c6b76a3094327094a48e21b"
|
|
53
55
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as createAlfaApp } from './createAlfaApp';
|
|
2
2
|
export { default as createAlfaWidget } from './createAlfaWidget';
|
|
3
3
|
export { eventEmitter as widgetEventEmitter } from './widget/index';
|
|
4
|
+
export { default as addGlobalRequestInterceptor } from './addGlobalRequestInterceptor';
|
|
4
5
|
export { createEventBus, prefetch } from '@alicloud/alfa-core';
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.4.
|
|
1
|
+
export declare const version = "1.4.9-alpha.2";
|