@hylid/env 4.0.28-alpha.2 → 4.0.29

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/lib/utils.js CHANGED
@@ -44,23 +44,26 @@ export function notice(text) {
44
44
  }
45
45
  export function getSettingName() {
46
46
  var _a;
47
+ var ENV_KEY = '__hy_env__';
47
48
  var clientMatch = ((_a = window.location.search) === null || _a === void 0 ? void 0 : _a.match(/__app__=([^&]*)/)) || [];
48
49
  var client = clientMatch[1];
49
50
  var platformMatch = window.location.search.match(/__platform__=([^&]*)/) || [];
50
51
  var platform = platformMatch[1];
51
- if (client || platform) {
52
- localStorage.setItem('__hy_env__', JSON.stringify({
53
- client: client,
54
- platform: platform
55
- }));
52
+ var env = JSON.parse(localStorage.getItem(ENV_KEY) || '{}') || {};
53
+ if (client) {
54
+ env.client = client;
56
55
  }
56
+ if (platform) {
57
+ env.platform = platform;
58
+ }
59
+ localStorage.setItem(ENV_KEY, JSON.stringify(env));
57
60
  if (clientMatch[1]) {
58
61
  var search = window.location.search.replace(new RegExp("".concat(clientMatch[0], "(&)*")), '');
59
62
  var hash = window.location.hash || '';
60
63
  var newUrl = "".concat(window.location.pathname).concat(search).concat(hash);
61
64
  history.replaceState(null, '', newUrl);
62
65
  }
63
- var cached = JSON.parse(localStorage.getItem('__hy_env__') || '{}');
66
+ var cached = JSON.parse(localStorage.getItem(ENV_KEY) || '{}');
64
67
  var crossBridgeStorage = localStorage.getItem('_CB__app__');
65
68
  return crossBridgeStorage ? __assign(__assign({}, cached), {
66
69
  client: crossBridgeStorage
package/lib/version.js CHANGED
@@ -1 +1 @@
1
- export default '4.0.28-alpha.2';
1
+ export default '4.0.29';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hylid/env",
3
- "version": "4.0.28-alpha.2",
3
+ "version": "4.0.29",
4
4
  "main": "lib/index.js",
5
5
  "files": [
6
6
  "lib"
@@ -10,5 +10,6 @@
10
10
  },
11
11
  "license": "MIT",
12
12
  "sideEffects": false,
13
- "registry": "https://registry.npmjs.org/"
13
+ "registry": "https://registry.npmjs.org/",
14
+ "repository": "git@code.alipay.com:ant-ife/hylid-bridge.git"
14
15
  }