@alicloud/alfa-react 1.4.4 → 1.4.7
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 +5 -21
- package/es/createApplication.js +43 -33
- package/es/version.js +1 -1
- package/lib/createApplication.js +42 -33
- package/lib/version.js +1 -1
- package/package.json +4 -4
- package/types/version.d.ts +1 -1
package/es/createApplication.js
CHANGED
|
@@ -62,42 +62,52 @@ export default function createApplication(loader) {
|
|
|
62
62
|
'_console_base_ready_'])
|
|
63
63
|
});
|
|
64
64
|
}, [customSandbox]);
|
|
65
|
+
var memoOptions = useMemo(function () {
|
|
66
|
+
return {
|
|
67
|
+
entry: entry,
|
|
68
|
+
// deprecated
|
|
69
|
+
url: url,
|
|
70
|
+
// deprecated
|
|
71
|
+
name: name,
|
|
72
|
+
version: version,
|
|
73
|
+
manifest: manifest,
|
|
74
|
+
container: container,
|
|
75
|
+
props: customProps,
|
|
76
|
+
sandbox: sandbox,
|
|
77
|
+
logger: customLogger,
|
|
78
|
+
deps: deps,
|
|
79
|
+
env: env,
|
|
80
|
+
beforeMount: beforeMount,
|
|
81
|
+
afterMount: afterMount,
|
|
82
|
+
beforeUnmount: beforeUnmount,
|
|
83
|
+
afterUnmount: afterUnmount,
|
|
84
|
+
beforeUpdate: beforeUpdate,
|
|
85
|
+
locale: locale
|
|
86
|
+
};
|
|
87
|
+
}, []);
|
|
65
88
|
useEffect(function () {
|
|
89
|
+
var App;
|
|
90
|
+
|
|
66
91
|
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
67
|
-
var _yield$loader$registe,
|
|
92
|
+
var _yield$loader$registe, app, logger;
|
|
68
93
|
|
|
69
94
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
70
95
|
while (1) {
|
|
71
96
|
switch (_context.prev = _context.next) {
|
|
72
97
|
case 0:
|
|
73
98
|
_context.next = 2;
|
|
74
|
-
return loader.register({
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
name: name,
|
|
78
|
-
version: version,
|
|
79
|
-
manifest: manifest,
|
|
80
|
-
container: container || appRef.current,
|
|
81
|
-
props: customProps,
|
|
82
|
-
sandbox: sandbox,
|
|
83
|
-
logger: customLogger,
|
|
84
|
-
deps: deps,
|
|
85
|
-
env: env,
|
|
86
|
-
beforeMount: beforeMount,
|
|
87
|
-
afterMount: afterMount,
|
|
88
|
-
beforeUnmount: beforeUnmount,
|
|
89
|
-
afterUnmount: afterUnmount,
|
|
90
|
-
beforeUpdate: beforeUpdate,
|
|
91
|
-
locale: locale
|
|
92
|
-
});
|
|
99
|
+
return loader.register(_objectSpread(_objectSpread({}, memoOptions), {}, {
|
|
100
|
+
container: memoOptions.container || appRef.current
|
|
101
|
+
}));
|
|
93
102
|
|
|
94
103
|
case 2:
|
|
95
104
|
_yield$loader$registe = _context.sent;
|
|
96
|
-
|
|
105
|
+
app = _yield$loader$registe.app;
|
|
97
106
|
logger = _yield$loader$registe.logger;
|
|
107
|
+
App = app;
|
|
98
108
|
|
|
99
|
-
if (
|
|
100
|
-
_context.next =
|
|
109
|
+
if (app) {
|
|
110
|
+
_context.next = 8;
|
|
101
111
|
break;
|
|
102
112
|
}
|
|
103
113
|
|
|
@@ -106,9 +116,9 @@ export default function createApplication(loader) {
|
|
|
106
116
|
E_MSG: 'load app failed.'
|
|
107
117
|
}));
|
|
108
118
|
|
|
109
|
-
case
|
|
119
|
+
case 8:
|
|
110
120
|
if (appRef.current) {
|
|
111
|
-
_context.next =
|
|
121
|
+
_context.next = 10;
|
|
112
122
|
break;
|
|
113
123
|
}
|
|
114
124
|
|
|
@@ -117,16 +127,16 @@ export default function createApplication(loader) {
|
|
|
117
127
|
E_MSG: 'cannot find container.'
|
|
118
128
|
}));
|
|
119
129
|
|
|
120
|
-
case
|
|
121
|
-
_context.next =
|
|
122
|
-
return
|
|
130
|
+
case 10:
|
|
131
|
+
_context.next = 12;
|
|
132
|
+
return app.mount(appRef.current, {
|
|
123
133
|
customProps: customProps
|
|
124
134
|
});
|
|
125
135
|
|
|
126
|
-
case 11:
|
|
127
|
-
setApp(App);
|
|
128
|
-
|
|
129
136
|
case 12:
|
|
137
|
+
setApp(app);
|
|
138
|
+
|
|
139
|
+
case 13:
|
|
130
140
|
case "end":
|
|
131
141
|
return _context.stop();
|
|
132
142
|
}
|
|
@@ -139,9 +149,9 @@ export default function createApplication(loader) {
|
|
|
139
149
|
});
|
|
140
150
|
|
|
141
151
|
return function () {
|
|
142
|
-
|
|
152
|
+
App && App.unmount();
|
|
143
153
|
};
|
|
144
|
-
}, [
|
|
154
|
+
}, [memoOptions]);
|
|
145
155
|
|
|
146
156
|
if (app) {
|
|
147
157
|
app.update(customProps);
|
package/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '1.4.
|
|
1
|
+
export var version = '1.4.7';
|
package/lib/createApplication.js
CHANGED
|
@@ -84,42 +84,51 @@ function createApplication(loader) {
|
|
|
84
84
|
'_console_base_ready_'])
|
|
85
85
|
});
|
|
86
86
|
}, [customSandbox]);
|
|
87
|
+
var memoOptions = (0, _react.useMemo)(function () {
|
|
88
|
+
return {
|
|
89
|
+
entry: entry,
|
|
90
|
+
// deprecated
|
|
91
|
+
url: url,
|
|
92
|
+
// deprecated
|
|
93
|
+
name: name,
|
|
94
|
+
version: version,
|
|
95
|
+
manifest: manifest,
|
|
96
|
+
container: container,
|
|
97
|
+
props: customProps,
|
|
98
|
+
sandbox: sandbox,
|
|
99
|
+
logger: customLogger,
|
|
100
|
+
deps: deps,
|
|
101
|
+
env: env,
|
|
102
|
+
beforeMount: beforeMount,
|
|
103
|
+
afterMount: afterMount,
|
|
104
|
+
beforeUnmount: beforeUnmount,
|
|
105
|
+
afterUnmount: afterUnmount,
|
|
106
|
+
beforeUpdate: beforeUpdate,
|
|
107
|
+
locale: locale
|
|
108
|
+
};
|
|
109
|
+
}, []);
|
|
87
110
|
(0, _react.useEffect)(function () {
|
|
111
|
+
var App;
|
|
88
112
|
(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
89
|
-
var _yield$loader$registe,
|
|
113
|
+
var _yield$loader$registe, app, logger;
|
|
90
114
|
|
|
91
115
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
92
116
|
while (1) {
|
|
93
117
|
switch (_context.prev = _context.next) {
|
|
94
118
|
case 0:
|
|
95
119
|
_context.next = 2;
|
|
96
|
-
return loader.register({
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
name: name,
|
|
100
|
-
version: version,
|
|
101
|
-
manifest: manifest,
|
|
102
|
-
container: container || appRef.current,
|
|
103
|
-
props: customProps,
|
|
104
|
-
sandbox: sandbox,
|
|
105
|
-
logger: customLogger,
|
|
106
|
-
deps: deps,
|
|
107
|
-
env: env,
|
|
108
|
-
beforeMount: beforeMount,
|
|
109
|
-
afterMount: afterMount,
|
|
110
|
-
beforeUnmount: beforeUnmount,
|
|
111
|
-
afterUnmount: afterUnmount,
|
|
112
|
-
beforeUpdate: beforeUpdate,
|
|
113
|
-
locale: locale
|
|
114
|
-
});
|
|
120
|
+
return loader.register(_objectSpread(_objectSpread({}, memoOptions), {}, {
|
|
121
|
+
container: memoOptions.container || appRef.current
|
|
122
|
+
}));
|
|
115
123
|
|
|
116
124
|
case 2:
|
|
117
125
|
_yield$loader$registe = _context.sent;
|
|
118
|
-
|
|
126
|
+
app = _yield$loader$registe.app;
|
|
119
127
|
logger = _yield$loader$registe.logger;
|
|
128
|
+
App = app;
|
|
120
129
|
|
|
121
|
-
if (
|
|
122
|
-
_context.next =
|
|
130
|
+
if (app) {
|
|
131
|
+
_context.next = 8;
|
|
123
132
|
break;
|
|
124
133
|
}
|
|
125
134
|
|
|
@@ -128,9 +137,9 @@ function createApplication(loader) {
|
|
|
128
137
|
E_MSG: 'load app failed.'
|
|
129
138
|
}));
|
|
130
139
|
|
|
131
|
-
case
|
|
140
|
+
case 8:
|
|
132
141
|
if (appRef.current) {
|
|
133
|
-
_context.next =
|
|
142
|
+
_context.next = 10;
|
|
134
143
|
break;
|
|
135
144
|
}
|
|
136
145
|
|
|
@@ -139,16 +148,16 @@ function createApplication(loader) {
|
|
|
139
148
|
E_MSG: 'cannot find container.'
|
|
140
149
|
}));
|
|
141
150
|
|
|
142
|
-
case
|
|
143
|
-
_context.next =
|
|
144
|
-
return
|
|
151
|
+
case 10:
|
|
152
|
+
_context.next = 12;
|
|
153
|
+
return app.mount(appRef.current, {
|
|
145
154
|
customProps: customProps
|
|
146
155
|
});
|
|
147
156
|
|
|
148
|
-
case 11:
|
|
149
|
-
setApp(App);
|
|
150
|
-
|
|
151
157
|
case 12:
|
|
158
|
+
setApp(app);
|
|
159
|
+
|
|
160
|
+
case 13:
|
|
152
161
|
case "end":
|
|
153
162
|
return _context.stop();
|
|
154
163
|
}
|
|
@@ -160,9 +169,9 @@ function createApplication(loader) {
|
|
|
160
169
|
});
|
|
161
170
|
});
|
|
162
171
|
return function () {
|
|
163
|
-
|
|
172
|
+
App && App.unmount();
|
|
164
173
|
};
|
|
165
|
-
}, [
|
|
174
|
+
}, [memoOptions]);
|
|
166
175
|
|
|
167
176
|
if (app) {
|
|
168
177
|
app.update(customProps);
|
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.7",
|
|
4
4
|
"description": "Alfa Framework (React Version)",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"react": "^16.9.0",
|
|
38
38
|
"react-dom": "^16.9.0",
|
|
39
39
|
"ts-jest": "^23.10.5",
|
|
40
|
-
"
|
|
40
|
+
"tslib": "^2.4.0",
|
|
41
41
|
"typescript": "^3.0.3"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@alicloud/alfa-core": "^1.4.
|
|
44
|
+
"@alicloud/alfa-core": "^1.4.7",
|
|
45
45
|
"@alicloud/console-os-loader": "^1.2.3",
|
|
46
46
|
"@alicloud/widget-utils-console": "^0.1.6",
|
|
47
47
|
"classnames": "^2.2.6",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"react": "^16 | ^17"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "e709647e402cd7cc1ee465156505552215a22db5"
|
|
54
54
|
}
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.4.
|
|
1
|
+
export declare const version = "1.4.7";
|