@alicloud/alfa-react 1.4.0-alpha.3 → 1.4.0-alpha.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/es/version.js CHANGED
@@ -1 +1 @@
1
- export var version = '1.4.0-alpha.3';
1
+ export var version = '1.4.0-alpha.7';
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
  }
@@ -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.3";
1
+ export declare const version = "1.4.0-alpha.7";
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.3';
7
+ var version = '1.4.0-alpha.7';
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.3",
3
+ "version": "1.4.0-alpha.7",
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.3",
42
+ "@alicloud/alfa-core": "^1.4.0-alpha.7",
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": "e81232b14356296973770cd05e403a95209d150c"
51
+ "gitHead": "cbff825e1580a9f4aa47b0d55a79777891deb93b"
52
52
  }