@alicloud/console-base-conf-parse-env 1.4.7 → 1.4.9-beta.0
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.
|
@@ -8,7 +8,7 @@ exports.default = getChannel;
|
|
|
8
8
|
var _consoleOneConfig = _interopRequireDefault(require("@alicloud/console-one-config"));
|
|
9
9
|
function getFallbackChannel(site, mainDomain) {
|
|
10
10
|
// 兜底逻辑,非 OneConsole 应用可能没获取到全局变量
|
|
11
|
-
if (mainDomain === 'idptcloud01.com') {
|
|
11
|
+
if (mainDomain === 'idptcloud01.com' || mainDomain === 'idptcloud01-inc.com') {
|
|
12
12
|
return 'EA134';
|
|
13
13
|
}
|
|
14
14
|
switch (site) {
|
|
@@ -17,7 +17,19 @@ var _getChannel = _interopRequireDefault(require("./get-channel"));
|
|
|
17
17
|
function parseEnv() {
|
|
18
18
|
var _hostname$match;
|
|
19
19
|
var _ref = (0, _sandboxEscape.getWindow)(),
|
|
20
|
-
|
|
20
|
+
location = _ref.location;
|
|
21
|
+
|
|
22
|
+
// 兼容本地开发环境
|
|
23
|
+
var hostname = location.hostname;
|
|
24
|
+
if (hostname === 'localhost' || hostname === '127.0.0.1') {
|
|
25
|
+
hostname = 'console.aliyun.com';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// 兼容 about:blank 协议
|
|
29
|
+
var protocol = location.protocol;
|
|
30
|
+
if (protocol !== 'http:' && protocol !== 'https:') {
|
|
31
|
+
protocol = 'https:';
|
|
32
|
+
}
|
|
21
33
|
var ENV = (0, _getEnv.default)();
|
|
22
34
|
var SITE = (0, _getSite.default)();
|
|
23
35
|
var ENV_IS_DEV = ENV === _enum.EEnv.DEV;
|
|
@@ -36,14 +48,14 @@ function parseEnv() {
|
|
|
36
48
|
|
|
37
49
|
/**
|
|
38
50
|
* 需要兼容的域名:
|
|
39
|
-
* {product}.console.aliyun.com 阿里云控制台(不区分国内、国际)
|
|
40
|
-
* {product}.alibabacloud.com 国际站
|
|
41
|
-
* {product}.console.alibabacloud.com 国际站控制台
|
|
42
|
-
* {product}.console.{region}.com 一国一云控制台
|
|
51
|
+
* {product}.console.aliyun.com 阿里云控制台(不区分国内、国际)
|
|
52
|
+
* {product}.alibabacloud.com 国际站
|
|
53
|
+
* {product}.console.alibabacloud.com 国际站控制台
|
|
54
|
+
* {product}.console.{region}.com 一国一云控制台
|
|
43
55
|
* aliyun-inc.com、alibaba-inc.com 内网强制改为 aliyun.com(OpenAPI 需支持免登)
|
|
44
56
|
* about:blank 其他
|
|
45
|
-
*
|
|
46
|
-
* fecs 请求域名规则:`{前缀}.console.{后缀}.{顶级域名}`
|
|
57
|
+
*
|
|
58
|
+
* fecs 请求域名规则:`{前缀}.console.{后缀}.{顶级域名}`
|
|
47
59
|
* 前缀:虚商环境 fecs4service || 本地&预发 pre-fecs,日常&线上 fecs
|
|
48
60
|
* 后缀:获取 domain 最后的路径,并以 aliyun 作为兜底
|
|
49
61
|
* 顶级域名:测试环境是 test,其他环境是 com
|
|
@@ -58,7 +70,7 @@ function parseEnv() {
|
|
|
58
70
|
var FECS_HOST = "".concat(prefixDomain, ".console.").concat(suffixDomain, ".").concat(topDomain);
|
|
59
71
|
|
|
60
72
|
// 这个不推荐用 protocol-relative,Firefox 调用 CORS 时,有可能 request.header.Origin 是 null 而导致接口失败...
|
|
61
|
-
var FECS_URL_BASE = "
|
|
73
|
+
var FECS_URL_BASE = "".concat(protocol, "//").concat(FECS_HOST);
|
|
62
74
|
|
|
63
75
|
// 输出主域名,方便非 console 的业务方使用
|
|
64
76
|
var MAIN_DOMAIN = "".concat(suffixDomain, ".").concat(topDomain);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ONE_CONF from '@alicloud/console-one-config';
|
|
2
2
|
function getFallbackChannel(site, mainDomain) {
|
|
3
3
|
// 兜底逻辑,非 OneConsole 应用可能没获取到全局变量
|
|
4
|
-
if (mainDomain === 'idptcloud01.com') {
|
|
4
|
+
if (mainDomain === 'idptcloud01.com' || mainDomain === 'idptcloud01-inc.com') {
|
|
5
5
|
return 'EA134';
|
|
6
6
|
}
|
|
7
7
|
switch (site) {
|
|
@@ -11,7 +11,19 @@ import getChannel from './get-channel';
|
|
|
11
11
|
export default function parseEnv() {
|
|
12
12
|
var _hostname$match;
|
|
13
13
|
var _ref = getWindow(),
|
|
14
|
-
|
|
14
|
+
location = _ref.location;
|
|
15
|
+
|
|
16
|
+
// 兼容本地开发环境
|
|
17
|
+
var hostname = location.hostname;
|
|
18
|
+
if (hostname === 'localhost' || hostname === '127.0.0.1') {
|
|
19
|
+
hostname = 'console.aliyun.com';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// 兼容 about:blank 协议
|
|
23
|
+
var protocol = location.protocol;
|
|
24
|
+
if (protocol !== 'http:' && protocol !== 'https:') {
|
|
25
|
+
protocol = 'https:';
|
|
26
|
+
}
|
|
15
27
|
var ENV = getEnv();
|
|
16
28
|
var SITE = getSite();
|
|
17
29
|
var ENV_IS_DEV = ENV === EEnv.DEV;
|
|
@@ -30,14 +42,14 @@ export default function parseEnv() {
|
|
|
30
42
|
|
|
31
43
|
/**
|
|
32
44
|
* 需要兼容的域名:
|
|
33
|
-
* {product}.console.aliyun.com 阿里云控制台(不区分国内、国际)
|
|
34
|
-
* {product}.alibabacloud.com 国际站
|
|
35
|
-
* {product}.console.alibabacloud.com 国际站控制台
|
|
36
|
-
* {product}.console.{region}.com 一国一云控制台
|
|
45
|
+
* {product}.console.aliyun.com 阿里云控制台(不区分国内、国际)
|
|
46
|
+
* {product}.alibabacloud.com 国际站
|
|
47
|
+
* {product}.console.alibabacloud.com 国际站控制台
|
|
48
|
+
* {product}.console.{region}.com 一国一云控制台
|
|
37
49
|
* aliyun-inc.com、alibaba-inc.com 内网强制改为 aliyun.com(OpenAPI 需支持免登)
|
|
38
50
|
* about:blank 其他
|
|
39
|
-
*
|
|
40
|
-
* fecs 请求域名规则:`{前缀}.console.{后缀}.{顶级域名}`
|
|
51
|
+
*
|
|
52
|
+
* fecs 请求域名规则:`{前缀}.console.{后缀}.{顶级域名}`
|
|
41
53
|
* 前缀:虚商环境 fecs4service || 本地&预发 pre-fecs,日常&线上 fecs
|
|
42
54
|
* 后缀:获取 domain 最后的路径,并以 aliyun 作为兜底
|
|
43
55
|
* 顶级域名:测试环境是 test,其他环境是 com
|
|
@@ -52,7 +64,7 @@ export default function parseEnv() {
|
|
|
52
64
|
var FECS_HOST = "".concat(prefixDomain, ".console.").concat(suffixDomain, ".").concat(topDomain);
|
|
53
65
|
|
|
54
66
|
// 这个不推荐用 protocol-relative,Firefox 调用 CORS 时,有可能 request.header.Origin 是 null 而导致接口失败...
|
|
55
|
-
var FECS_URL_BASE = "
|
|
67
|
+
var FECS_URL_BASE = "".concat(protocol, "//").concat(FECS_HOST);
|
|
56
68
|
|
|
57
69
|
// 输出主域名,方便非 console 的业务方使用
|
|
58
70
|
var MAIN_DOMAIN = "".concat(suffixDomain, ".").concat(topDomain);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alicloud/console-base-conf-parse-env",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9-beta.0",
|
|
4
4
|
"description": "ConsoleBase CONF.ENV parse",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"build:cjs": "breezr build --engine babel",
|
|
41
41
|
"build:bundle": "breezr build --engine webpack",
|
|
42
42
|
"build:types": "tsc -p tsconfig-declaration.json --outDir build/types --declaration --emitDeclarationOnly",
|
|
43
|
-
"build": "
|
|
43
|
+
"build": "pnpm build:esm && pnpm build:cjs && pnpm build:types",
|
|
44
44
|
"clean": "rm -rf build",
|
|
45
|
-
"prepublishOnly": "
|
|
45
|
+
"prepublishOnly": "pnpm clean && pnpm build"
|
|
46
46
|
}
|
|
47
47
|
}
|