@alicloud/alfa-react 1.4.0-alpha.4 → 1.4.0-alpha.8

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.
@@ -38,7 +38,8 @@ export default function createApplication(loader) {
38
38
  beforeUnmount = props.beforeUnmount,
39
39
  afterUnmount = props.afterUnmount,
40
40
  beforeUpdate = props.beforeUpdate,
41
- customSandbox = props.sandbox;
41
+ customSandbox = props.sandbox,
42
+ locale = props.locale;
42
43
 
43
44
  var _useState = useState(null),
44
45
  _useState2 = _slicedToArray(_useState, 2),
@@ -86,7 +87,8 @@ export default function createApplication(loader) {
86
87
  afterMount: afterMount,
87
88
  beforeUnmount: beforeUnmount,
88
89
  afterUnmount: afterUnmount,
89
- beforeUpdate: beforeUpdate
90
+ beforeUpdate: beforeUpdate,
91
+ locale: locale
90
92
  });
91
93
 
92
94
  case 2:
@@ -146,7 +148,7 @@ export default function createApplication(loader) {
146
148
  }
147
149
 
148
150
  var dataAttrs = {
149
- 'data-id': version,
151
+ 'data-id': name,
150
152
  'data-version': version,
151
153
  'data-loader': loaderVersion
152
154
  };
package/es/version.js CHANGED
@@ -1 +1 @@
1
- export var version = '1.4.0-alpha.4';
1
+ export var version = '1.4.0-alpha.8';
package/es/widget/env.js CHANGED
@@ -26,6 +26,30 @@ export var ENV = {
26
26
  resourceUrl: resourceProdUrl
27
27
  }
28
28
  };
29
+ var disCdnPrepubUrl = 'https://cws2.alicdn.com/Prepub/pkgs/${id}/release.json';
30
+ var disCdnReleaseUrl = 'https://cws.alicdn.com/Release/pkgs/${id}/release.json';
31
+ export var DIS_ENV = {
32
+ local: {
33
+ releaseUrl: process.env.ALFA_RELEASE_URL || disCdnPrepubUrl,
34
+ configUrl: cdnPrepubConfigUrl,
35
+ resourceUrl: resourceDailyUrl
36
+ },
37
+ daily: {
38
+ releaseUrl: disCdnPrepubUrl,
39
+ configUrl: cdnPrepubConfigUrl,
40
+ resourceUrl: resourceDailyUrl
41
+ },
42
+ pre: {
43
+ releaseUrl: disCdnPrepubUrl,
44
+ configUrl: cdnPrepubConfigUrl,
45
+ resourceUrl: resourceDailyUrl
46
+ },
47
+ prod: {
48
+ releaseUrl: disCdnReleaseUrl,
49
+ configUrl: cdnReleaseConfigUrl,
50
+ resourceUrl: resourceProdUrl
51
+ }
52
+ };
29
53
  export var getConsoleEnv = function getConsoleEnv() {
30
54
  var _window, _window$ALIYUN_CONSOL;
31
55
 
@@ -2,7 +2,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import axios from 'axios';
4
4
  import template from 'lodash/template';
5
- import { ENV, getConsoleEnv } from './env';
5
+ import { ENV, DIS_ENV, getConsoleEnv } from './env';
6
6
  export var cachedRelease = null;
7
7
  var WIDGET_ENTRY_URL = 'https://g.alicdn.com/${id}/${version}/index.js';
8
8
 
@@ -16,52 +16,54 @@ var normalizeEntryUrl = function normalizeEntryUrl(id, version, resourceUrl) {
16
16
 
17
17
  export var getWidgetVersionById = /*#__PURE__*/function () {
18
18
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(option) {
19
- var env, resp, version;
19
+ var _option$central, central, env, Release, resp, version;
20
+
20
21
  return _regeneratorRuntime.wrap(function _callee$(_context) {
21
22
  while (1) {
22
23
  switch (_context.prev = _context.next) {
23
24
  case 0:
24
- env = ENV[option.env || getConsoleEnv()];
25
+ _option$central = option.central, central = _option$central === void 0 ? true : _option$central, env = option.env;
26
+ Release = central ? ENV[env || getConsoleEnv()] : DIS_ENV[env || getConsoleEnv()];
25
27
 
26
28
  if (option.version) {
27
- _context.next = 3;
29
+ _context.next = 4;
28
30
  break;
29
31
  }
30
32
 
31
33
  throw new Error('No Version for Widget');
32
34
 
33
- case 3:
35
+ case 4:
34
36
  if (option.version.endsWith('.x')) {
35
- _context.next = 5;
37
+ _context.next = 6;
36
38
  break;
37
39
  }
38
40
 
39
41
  return _context.abrupt("return", {
40
42
  version: option.version,
41
- entryUrl: normalizeEntryUrl(option.name, option.version, env.resourceUrl || WIDGET_ENTRY_URL)
43
+ entryUrl: normalizeEntryUrl(option.name, option.version, Release.resourceUrl || WIDGET_ENTRY_URL)
42
44
  });
43
45
 
44
- case 5:
46
+ case 6:
45
47
  if (cachedRelease) {
46
- _context.next = 10;
48
+ _context.next = 11;
47
49
  break;
48
50
  }
49
51
 
50
- _context.next = 8;
51
- return axios.get(env.releaseUrl);
52
+ _context.next = 9;
53
+ return axios.get(Release.releaseUrl);
52
54
 
53
- case 8:
55
+ case 9:
54
56
  resp = _context.sent;
55
57
  cachedRelease = resp.data;
56
58
 
57
- case 10:
59
+ case 11:
58
60
  version = cachedRelease[option.name][option.version].latest;
59
61
  return _context.abrupt("return", {
60
62
  version: version,
61
- entryUrl: normalizeEntryUrl(option.name, version, env.resourceUrl || WIDGET_ENTRY_URL)
63
+ entryUrl: normalizeEntryUrl(option.name, version, Release.resourceUrl || WIDGET_ENTRY_URL)
62
64
  });
63
65
 
64
- case 12:
66
+ case 13:
65
67
  case "end":
66
68
  return _context.stop();
67
69
  }
@@ -60,7 +60,8 @@ function createApplication(loader) {
60
60
  beforeUnmount = props.beforeUnmount,
61
61
  afterUnmount = props.afterUnmount,
62
62
  beforeUpdate = props.beforeUpdate,
63
- customSandbox = props.sandbox;
63
+ customSandbox = props.sandbox,
64
+ locale = props.locale;
64
65
 
65
66
  var _useState = (0, _react.useState)(null),
66
67
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -108,7 +109,8 @@ function createApplication(loader) {
108
109
  afterMount: afterMount,
109
110
  beforeUnmount: beforeUnmount,
110
111
  afterUnmount: afterUnmount,
111
- beforeUpdate: beforeUpdate
112
+ beforeUpdate: beforeUpdate,
113
+ locale: locale
112
114
  });
113
115
 
114
116
  case 2:
@@ -167,7 +169,7 @@ function createApplication(loader) {
167
169
  }
168
170
 
169
171
  var dataAttrs = {
170
- 'data-id': version,
172
+ 'data-id': name,
171
173
  'data-version': version,
172
174
  'data-loader': _version.version
173
175
  };
@@ -27,6 +27,7 @@ export interface WidgetFactoryOption extends Omit<AlfaFactoryOption, OmitKeys> {
27
27
  runtimeVersion?: string;
28
28
  alfaLoader?: boolean;
29
29
  theme?: string;
30
+ central?: boolean;
30
31
  }
31
32
  export interface AlfaEnvConfigDescriptor {
32
33
  releaseUrl: string;
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "1.4.0-alpha.4";
1
+ export declare const version = "1.4.0-alpha.8";
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.0-alpha.4';
7
+ var version = '1.4.0-alpha.8';
8
8
  exports.version = version;
@@ -1,3 +1,4 @@
1
1
  import { AlfaEnvConfig, EnvEnum } from '../types';
2
2
  export declare const ENV: AlfaEnvConfig;
3
+ export declare const DIS_ENV: AlfaEnvConfig;
3
4
  export declare const getConsoleEnv: () => EnvEnum;
package/lib/widget/env.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getConsoleEnv = exports.ENV = void 0;
6
+ exports.getConsoleEnv = exports.ENV = exports.DIS_ENV = void 0;
7
7
  var cdnReleaseUrl = 'https://cws.alicdn.com/release.json';
8
8
  var cdnPrepubUrl = 'https://cws.aliyun-inc.com/release.json';
9
9
  var cdnReleaseConfigUrl = 'https://cws.alicdn.com/Release/pkgs/${id}/config.json';
@@ -33,6 +33,31 @@ var ENV = {
33
33
  }
34
34
  };
35
35
  exports.ENV = ENV;
36
+ var disCdnPrepubUrl = 'https://cws2.alicdn.com/Prepub/pkgs/${id}/release.json';
37
+ var disCdnReleaseUrl = 'https://cws.alicdn.com/Release/pkgs/${id}/release.json';
38
+ var DIS_ENV = {
39
+ local: {
40
+ releaseUrl: process.env.ALFA_RELEASE_URL || disCdnPrepubUrl,
41
+ configUrl: cdnPrepubConfigUrl,
42
+ resourceUrl: resourceDailyUrl
43
+ },
44
+ daily: {
45
+ releaseUrl: disCdnPrepubUrl,
46
+ configUrl: cdnPrepubConfigUrl,
47
+ resourceUrl: resourceDailyUrl
48
+ },
49
+ pre: {
50
+ releaseUrl: disCdnPrepubUrl,
51
+ configUrl: cdnPrepubConfigUrl,
52
+ resourceUrl: resourceDailyUrl
53
+ },
54
+ prod: {
55
+ releaseUrl: disCdnReleaseUrl,
56
+ configUrl: cdnReleaseConfigUrl,
57
+ resourceUrl: resourceProdUrl
58
+ }
59
+ };
60
+ exports.DIS_ENV = DIS_ENV;
36
61
 
37
62
  var getConsoleEnv = function getConsoleEnv() {
38
63
  var _window, _window$ALIYUN_CONSOL;
@@ -31,52 +31,54 @@ var normalizeEntryUrl = function normalizeEntryUrl(id, version, resourceUrl) {
31
31
 
32
32
  var getWidgetVersionById = /*#__PURE__*/function () {
33
33
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(option) {
34
- var env, resp, version;
34
+ var _option$central, central, env, Release, resp, version;
35
+
35
36
  return _regenerator.default.wrap(function _callee$(_context) {
36
37
  while (1) {
37
38
  switch (_context.prev = _context.next) {
38
39
  case 0:
39
- env = _env.ENV[option.env || (0, _env.getConsoleEnv)()];
40
+ _option$central = option.central, central = _option$central === void 0 ? true : _option$central, env = option.env;
41
+ Release = central ? _env.ENV[env || (0, _env.getConsoleEnv)()] : _env.DIS_ENV[env || (0, _env.getConsoleEnv)()];
40
42
 
41
43
  if (option.version) {
42
- _context.next = 3;
44
+ _context.next = 4;
43
45
  break;
44
46
  }
45
47
 
46
48
  throw new Error('No Version for Widget');
47
49
 
48
- case 3:
50
+ case 4:
49
51
  if (option.version.endsWith('.x')) {
50
- _context.next = 5;
52
+ _context.next = 6;
51
53
  break;
52
54
  }
53
55
 
54
56
  return _context.abrupt("return", {
55
57
  version: option.version,
56
- entryUrl: normalizeEntryUrl(option.name, option.version, env.resourceUrl || WIDGET_ENTRY_URL)
58
+ entryUrl: normalizeEntryUrl(option.name, option.version, Release.resourceUrl || WIDGET_ENTRY_URL)
57
59
  });
58
60
 
59
- case 5:
61
+ case 6:
60
62
  if (cachedRelease) {
61
- _context.next = 10;
63
+ _context.next = 11;
62
64
  break;
63
65
  }
64
66
 
65
- _context.next = 8;
66
- return _axios.default.get(env.releaseUrl);
67
+ _context.next = 9;
68
+ return _axios.default.get(Release.releaseUrl);
67
69
 
68
- case 8:
70
+ case 9:
69
71
  resp = _context.sent;
70
72
  exports.cachedRelease = cachedRelease = resp.data;
71
73
 
72
- case 10:
74
+ case 11:
73
75
  version = cachedRelease[option.name][option.version].latest;
74
76
  return _context.abrupt("return", {
75
77
  version: version,
76
- entryUrl: normalizeEntryUrl(option.name, version, env.resourceUrl || WIDGET_ENTRY_URL)
78
+ entryUrl: normalizeEntryUrl(option.name, version, Release.resourceUrl || WIDGET_ENTRY_URL)
77
79
  });
78
80
 
79
- case 12:
81
+ case 13:
80
82
  case "end":
81
83
  return _context.stop();
82
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alicloud/alfa-react",
3
- "version": "1.4.0-alpha.4",
3
+ "version": "1.4.0-alpha.8",
4
4
  "description": "Alfa Framework (React Version)",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -39,7 +39,7 @@
39
39
  "typescript": "^3.0.3"
40
40
  },
41
41
  "dependencies": {
42
- "@alicloud/alfa-core": "^1.4.0-alpha.4",
42
+ "@alicloud/alfa-core": "^1.4.0-alpha.8",
43
43
  "@alicloud/console-os-loader": "^1.2.3",
44
44
  "@alicloud/widget-utils-console": "^0.1.6",
45
45
  "classnames": "^2.2.6",
@@ -48,5 +48,5 @@
48
48
  "peerDependencies": {
49
49
  "react": "^16 | ^17"
50
50
  },
51
- "gitHead": "9bec3527bdc87a251ded55c12a2485a7710a4b35"
51
+ "gitHead": "ab4215fada8a4165f7b663af08cd86af17ed029d"
52
52
  }