ifs-code-tools 1.0.1 → 1.0.2-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.
- package/dist/index.cjs +17 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9707,7 +9707,13 @@ var moduleCache = /* @__PURE__ */ new Map();
|
|
|
9707
9707
|
var loadedStyles = /* @__PURE__ */ new Set();
|
|
9708
9708
|
var loadingPromises = /* @__PURE__ */ new Map();
|
|
9709
9709
|
var WIDGET_CDN_BASE = "https://mos.m.taobao.com/mixo";
|
|
9710
|
-
var IFS_CDN_BASE = "
|
|
9710
|
+
var IFS_CDN_BASE = `https://${location.hostname.startsWith("ifs.alibaba.net") || location.hostname.startsWith("local.code.iconfont.cn") ? "ifs.alibaba.net" : location.hostname.startsWith("pre-code.iconfont.cn") ? "pre-code.iconfont.cn" : "code.iconfont.cn"}/ifs/api/getPublishFileUrlOpen`;
|
|
9711
|
+
var isIntranet = [
|
|
9712
|
+
"mixo.alibaba-inc.com",
|
|
9713
|
+
"pre-mixo.alibaba-inc.com",
|
|
9714
|
+
"local.mixo.alibaba-inc.com",
|
|
9715
|
+
"mixo.alibaba.net"
|
|
9716
|
+
].some((v) => location.hostname.includes(v));
|
|
9711
9717
|
async function getOssWidget(appId) {
|
|
9712
9718
|
const requestUrl = `${IFS_CDN_BASE}?appId=${appId}&env=online`;
|
|
9713
9719
|
const ossConfig = await fetch(requestUrl).then((res) => res.json());
|
|
@@ -9755,14 +9761,18 @@ async function getWidgetResourceConfig(appId, version) {
|
|
|
9755
9761
|
}
|
|
9756
9762
|
async function resolveWidgetUrlsByAppId(appId) {
|
|
9757
9763
|
let config;
|
|
9758
|
-
|
|
9759
|
-
config = await getOssWidget(appId);
|
|
9760
|
-
} catch (error) {
|
|
9761
|
-
console.error(`Failed to get OSS widget for appId: ${appId}`, error);
|
|
9762
|
-
}
|
|
9763
|
-
if (!config?.js) {
|
|
9764
|
+
if (isIntranet) {
|
|
9764
9765
|
const version = await getWidgetVersion(appId);
|
|
9765
9766
|
config = await getWidgetResourceConfig(appId, version);
|
|
9767
|
+
} else {
|
|
9768
|
+
try {
|
|
9769
|
+
config = await getOssWidget(appId);
|
|
9770
|
+
} catch (error) {
|
|
9771
|
+
console.error(`Failed to get OSS widget for appId: ${appId}`, error);
|
|
9772
|
+
}
|
|
9773
|
+
}
|
|
9774
|
+
if (!config) {
|
|
9775
|
+
throw new Error(`Failed to get widget config for appId: ${appId}`);
|
|
9766
9776
|
}
|
|
9767
9777
|
const jsBlob = new Blob([config.js], { type: "application/javascript" });
|
|
9768
9778
|
const moduleUrl = URL.createObjectURL(jsBlob);
|