@alicloud/alfa-react 1.5.1-alpha.3 → 1.5.1-alpha.4
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/es/createApplication.js +9 -4
- package/es/version.js +1 -1
- package/lib/createApplication.js +9 -4
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/types/createApplication.d.ts +1 -0
- package/types/version.d.ts +1 -1
package/es/createApplication.js
CHANGED
|
@@ -97,9 +97,11 @@ export default function createApplication(loader) {
|
|
|
97
97
|
setReleaseVersion = _useState6[1];
|
|
98
98
|
$syncHistory.current = syncHistory;
|
|
99
99
|
$basename.current = basename;
|
|
100
|
-
|
|
100
|
+
|
|
101
|
+
// if (customProps.__innerStamp) console.warn('Please do not use __innerStamp which used in internal.');
|
|
101
102
|
// 更新标记,保证每次更新都会更新
|
|
102
103
|
customProps.__innerStamp = (+new Date()).toString(36);
|
|
104
|
+
customProps.__historyState = history.state;
|
|
103
105
|
if (customProps.path) customProps.path = addLeftSlash(customProps.path);
|
|
104
106
|
|
|
105
107
|
// 受控模式锁定一些参数
|
|
@@ -174,6 +176,12 @@ export default function createApplication(loader) {
|
|
|
174
176
|
popstateEvent.state = history.state;
|
|
175
177
|
(_App = App) === null || _App === void 0 ? void 0 : (_App$context$baseFram = _App.context.baseFrame) === null || _App$context$baseFram === void 0 ? void 0 : (_App$context$baseFram2 = _App$context$baseFram.contentWindow) === null || _App$context$baseFram2 === void 0 ? void 0 : _App$context$baseFram2.dispatchEvent(popstateEvent);
|
|
176
178
|
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* 因为要兼容历史逻辑,所以这段逻辑并不会执行
|
|
182
|
+
* react-router 的路由监听 callback 会先执行并更新子应用内部路由
|
|
183
|
+
* @returns
|
|
184
|
+
*/
|
|
177
185
|
var updateAppHistory = function updateAppHistory() {
|
|
178
186
|
if (App) {
|
|
179
187
|
var nextPath = peelPath(App.context.location);
|
|
@@ -192,7 +200,6 @@ export default function createApplication(loader) {
|
|
|
192
200
|
};
|
|
193
201
|
|
|
194
202
|
// 受控模式下,返回不会触发子应用内的路由更新,需要主动通知
|
|
195
|
-
// 这段逻辑不一定生效,因为我们已经劫持了沙箱内的 history.go 方法
|
|
196
203
|
if ($syncHistory.current) window.addEventListener('popstate', updateAppHistory);
|
|
197
204
|
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
198
205
|
var _app$context$updateBo, _app$context, _app$context$baseFram;
|
|
@@ -272,8 +279,6 @@ export default function createApplication(loader) {
|
|
|
272
279
|
// 劫持微应用的返回
|
|
273
280
|
frameWindow.history.go = function (n) {
|
|
274
281
|
window.history.go(n);
|
|
275
|
-
// 同步更新子应用的 state
|
|
276
|
-
originalReplaceState(history.state, '', peelPath(frameWindow.location));
|
|
277
282
|
};
|
|
278
283
|
}
|
|
279
284
|
}
|
package/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '1.5.1-alpha.
|
|
1
|
+
export var version = '1.5.1-alpha.4';
|
package/lib/createApplication.js
CHANGED
|
@@ -107,9 +107,11 @@ function createApplication(loader) {
|
|
|
107
107
|
setReleaseVersion = _useState6[1];
|
|
108
108
|
$syncHistory.current = syncHistory;
|
|
109
109
|
$basename.current = basename;
|
|
110
|
-
|
|
110
|
+
|
|
111
|
+
// if (customProps.__innerStamp) console.warn('Please do not use __innerStamp which used in internal.');
|
|
111
112
|
// 更新标记,保证每次更新都会更新
|
|
112
113
|
customProps.__innerStamp = (+new Date()).toString(36);
|
|
114
|
+
customProps.__historyState = history.state;
|
|
113
115
|
if (customProps.path) customProps.path = addLeftSlash(customProps.path);
|
|
114
116
|
|
|
115
117
|
// 受控模式锁定一些参数
|
|
@@ -184,6 +186,12 @@ function createApplication(loader) {
|
|
|
184
186
|
popstateEvent.state = history.state;
|
|
185
187
|
(_App = App) === null || _App === void 0 ? void 0 : (_App$context$baseFram = _App.context.baseFrame) === null || _App$context$baseFram === void 0 ? void 0 : (_App$context$baseFram2 = _App$context$baseFram.contentWindow) === null || _App$context$baseFram2 === void 0 ? void 0 : _App$context$baseFram2.dispatchEvent(popstateEvent);
|
|
186
188
|
};
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* 因为要兼容历史逻辑,所以这段逻辑并不会执行
|
|
192
|
+
* react-router 的路由监听 callback 会先执行并更新子应用内部路由
|
|
193
|
+
* @returns
|
|
194
|
+
*/
|
|
187
195
|
var updateAppHistory = function updateAppHistory() {
|
|
188
196
|
if (App) {
|
|
189
197
|
var nextPath = peelPath(App.context.location);
|
|
@@ -202,7 +210,6 @@ function createApplication(loader) {
|
|
|
202
210
|
};
|
|
203
211
|
|
|
204
212
|
// 受控模式下,返回不会触发子应用内的路由更新,需要主动通知
|
|
205
|
-
// 这段逻辑不一定生效,因为我们已经劫持了沙箱内的 history.go 方法
|
|
206
213
|
if ($syncHistory.current) window.addEventListener('popstate', updateAppHistory);
|
|
207
214
|
(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
208
215
|
var _app$context$updateBo, _app$context, _app$context$baseFram;
|
|
@@ -282,8 +289,6 @@ function createApplication(loader) {
|
|
|
282
289
|
// 劫持微应用的返回
|
|
283
290
|
frameWindow.history.go = function (n) {
|
|
284
291
|
window.history.go(n);
|
|
285
|
-
// 同步更新子应用的 state
|
|
286
|
-
originalReplaceState(history.state, '', peelPath(frameWindow.location));
|
|
287
292
|
};
|
|
288
293
|
}
|
|
289
294
|
}
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.5.1-alpha.
|
|
1
|
+
export declare const version = "1.5.1-alpha.4";
|