@alicloud/alfa-react 1.4.30-alpha.1 → 1.4.30-alpha.3

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.
@@ -60,6 +60,7 @@ export default function createApplication(loader) {
60
60
  var tagName = normalizeName(props.name);
61
61
  $puppeteer.current = puppeteer;
62
62
  $basename.current = basename;
63
+ if ($puppeteer.current) customProps.consoleBase = null;
63
64
  var sandbox = useMemo(function () {
64
65
  var _UA_Opt, _RISK_INFO, _um;
65
66
 
@@ -115,6 +116,7 @@ export default function createApplication(loader) {
115
116
  var App;
116
117
  var originalPushState;
117
118
  var originalReplaceState;
119
+ var originalGo;
118
120
 
119
121
  _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
120
122
  var _app$context$updateBo, _app$context, _app$context$baseFram;
@@ -173,7 +175,8 @@ export default function createApplication(loader) {
173
175
 
174
176
  if (frameWindow) {
175
177
  originalPushState = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.pushState;
176
- originalReplaceState = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.replaceState; // update context history according to path
178
+ originalReplaceState = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.replaceState;
179
+ originalGo = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.go; // update context history according to path
177
180
 
178
181
  if (path) originalReplaceState(null, '', path);
179
182
 
@@ -187,6 +190,10 @@ export default function createApplication(loader) {
187
190
  window.history.replaceState(data, unused, "".concat($basename.current || '', "/").concat(_url).replace(/\/\//g, '/'));
188
191
  originalReplaceState(data, unused, _url);
189
192
  };
193
+
194
+ frameWindow.history.go = function (n) {
195
+ window.history.go(n);
196
+ };
190
197
  }
191
198
  }
192
199
 
@@ -212,14 +219,19 @@ export default function createApplication(loader) {
212
219
  });
213
220
 
214
221
  return function () {
215
- var _App$context$baseFram;
222
+ var _App$context$baseFram, _App$context$baseFram2;
216
223
 
217
224
  isUnmounted = true;
218
225
  if (!App) return;
219
226
  App.unmount();
220
- var frameWindow = (_App$context$baseFram = App.context.baseFrame) === null || _App$context$baseFram === void 0 ? void 0 : _App$context$baseFram.contentWindow;
221
- if (frameWindow && originalPushState) frameWindow.history.pushState = originalPushState;
222
- if (frameWindow && originalReplaceState) frameWindow.history.pushState = originalReplaceState; // 在沙箱中嵌套时,必须销毁实例,避免第二次加载时异常
227
+ var frameHistory = (_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.history;
228
+
229
+ if (frameHistory) {
230
+ if (originalPushState !== frameHistory.pushState) frameHistory.pushState = originalPushState;
231
+ if (originalReplaceState !== frameHistory.replaceState) frameHistory.pushState = originalReplaceState;
232
+ if (originalGo !== frameHistory.go) frameHistory.go = originalGo;
233
+ } // 在沙箱中嵌套时,必须销毁实例,避免第二次加载时异常
234
+
223
235
 
224
236
  if (isOsContext()) App.destroy();
225
237
  };
package/es/version.js CHANGED
@@ -1 +1 @@
1
- export var version = '1.4.30-alpha.1';
1
+ export var version = '1.4.30-alpha.3';
@@ -82,6 +82,7 @@ function createApplication(loader) {
82
82
  var tagName = (0, _utils.normalizeName)(props.name);
83
83
  $puppeteer.current = puppeteer;
84
84
  $basename.current = basename;
85
+ if ($puppeteer.current) customProps.consoleBase = null;
85
86
  var sandbox = (0, _react.useMemo)(function () {
86
87
  var _UA_Opt, _RISK_INFO, _um;
87
88
 
@@ -137,6 +138,7 @@ function createApplication(loader) {
137
138
  var App;
138
139
  var originalPushState;
139
140
  var originalReplaceState;
141
+ var originalGo;
140
142
  (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
141
143
  var _app$context$updateBo, _app$context, _app$context$baseFram;
142
144
 
@@ -194,7 +196,8 @@ function createApplication(loader) {
194
196
 
195
197
  if (frameWindow) {
196
198
  originalPushState = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.pushState;
197
- originalReplaceState = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.replaceState; // update context history according to path
199
+ originalReplaceState = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.replaceState;
200
+ originalGo = frameWindow === null || frameWindow === void 0 ? void 0 : frameWindow.history.go; // update context history according to path
198
201
 
199
202
  if (path) originalReplaceState(null, '', path);
200
203
 
@@ -208,6 +211,10 @@ function createApplication(loader) {
208
211
  window.history.replaceState(data, unused, "".concat($basename.current || '', "/").concat(_url).replace(/\/\//g, '/'));
209
212
  originalReplaceState(data, unused, _url);
210
213
  };
214
+
215
+ frameWindow.history.go = function (n) {
216
+ window.history.go(n);
217
+ };
211
218
  }
212
219
  }
213
220
 
@@ -232,14 +239,19 @@ function createApplication(loader) {
232
239
  });
233
240
  });
234
241
  return function () {
235
- var _App$context$baseFram;
242
+ var _App$context$baseFram, _App$context$baseFram2;
236
243
 
237
244
  isUnmounted = true;
238
245
  if (!App) return;
239
246
  App.unmount();
240
- var frameWindow = (_App$context$baseFram = App.context.baseFrame) === null || _App$context$baseFram === void 0 ? void 0 : _App$context$baseFram.contentWindow;
241
- if (frameWindow && originalPushState) frameWindow.history.pushState = originalPushState;
242
- if (frameWindow && originalReplaceState) frameWindow.history.pushState = originalReplaceState; // 在沙箱中嵌套时,必须销毁实例,避免第二次加载时异常
247
+ var frameHistory = (_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.history;
248
+
249
+ if (frameHistory) {
250
+ if (originalPushState !== frameHistory.pushState) frameHistory.pushState = originalPushState;
251
+ if (originalReplaceState !== frameHistory.replaceState) frameHistory.pushState = originalReplaceState;
252
+ if (originalGo !== frameHistory.go) frameHistory.go = originalGo;
253
+ } // 在沙箱中嵌套时,必须销毁实例,避免第二次加载时异常
254
+
243
255
 
244
256
  if ((0, _utils.isOsContext)()) App.destroy();
245
257
  };
package/lib/version.js CHANGED
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = void 0;
7
- var version = '1.4.30-alpha.1';
7
+ var version = '1.4.30-alpha.3';
8
8
  exports.version = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/alfa-react",
3
- "version": "1.4.30-alpha.1",
3
+ "version": "1.4.30-alpha.3",
4
4
  "description": "Alfa Framework (React Version)",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -1 +1 @@
1
- export declare const version = "1.4.30-alpha.1";
1
+ export declare const version = "1.4.30-alpha.3";