module-develop-kit 0.5.4 → 0.5.5
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import a from "@vitejs/plugin-legacy";
|
|
2
|
-
const s = `"use strict";!function(){function r(){document.body.innerHTML='<div style="width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); position: fixed; left: 0; top: 0"><div style="width: 480px; background-color: #fff; margin: 200px auto; padding: 18px 22px 18px 16px; border-radius: 12px;"><div style="color: #4e5969; font-size: 14px; margin: 24px 0 26px 0">推荐使用谷歌浏览器访问系统,以获得更优操作体验,减少兼容问题</div><div style="display: flex; justify-content: flex-end"><a href="https://www.google.cn/chrome/" target="_blank" style="width: 146px;height: 32px;color: #fff;background-color: #2954ff;text-align: center;font-size: 14px;cursor: pointer;border-radius: 4px;text-decoration: none;display: flex;align-items: center;justify-content: center;">下载谷歌浏览器</a></div></div></div>',document.title="不支持该浏览器"}
|
|
2
|
+
const s = `"use strict";!function(){var r=function(r){document.body?r():window.addEventListener("load",r,{once:!0})};function e(){r(function(){document.body.innerHTML='<div style="width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); position: fixed; left: 0; top: 0"><div style="width: 480px; background-color: #fff; margin: 200px auto; padding: 18px 22px 18px 16px; border-radius: 12px;"><div style="color: #4e5969; font-size: 14px; margin: 24px 0 26px 0">推荐使用谷歌浏览器访问系统,以获得更优操作体验,减少兼容问题</div><div style="display: flex; justify-content: flex-end"><a href="https://www.google.cn/chrome/" target="_blank" style="width: 146px;height: 32px;color: #fff;background-color: #2954ff;text-align: center;font-size: 14px;cursor: pointer;border-radius: 4px;text-decoration: none;display: flex;align-items: center;justify-content: center;">下载谷歌浏览器</a></div></div></div>',document.title="不支持该浏览器"})}try{!function(){var o=window.navigator.userAgent;function n(r){return r&&Array.isArray(r)&&r[1]?String(r[1]):null}function t(r){return n(r.match(/Chrom(?:e|ium)\\/(\\d+(\\.\\d+)*)/i))}function i(r,e){if(!e||!r)return!1;for(var o=String(r).split(".").map(Number),n=String(e).split(".").map(Number),t=0;t<Math.max(o.length,n.length);t++){var i=o[t]||0,c=n[t]||0;if(i>c)return!0;if(i<c)return!1}return!0}var c=85;function a(){r(function(){var r=document.getElementById("vite-legacy-polyfill");if(r){var e=document.createElement("script");e.src=r.src,document.head.appendChild(e)}else console.warn("没有找到vite-legacy-polyfill的加载入口")})}var s=[{name:"Ie",description:"detect IE engine (Trident/MSIE) — 360 在兼容模式下会走 Trident,IE不支持",match:function(r){return/MSIE |Trident\\//i.test(r)},notSupport:!0},{name:"360Browser",description:"360 安全/极速浏览器 (基于 Chromium)",match:function(r){return/(360SE|360EE)/i.test(r)},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"Edge",description:"Edge (Chromium) token: Edg/",match:function(r){return Boolean(r.match(/Edg\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"Firefox",match:function(r){return Boolean(r.match(/Firefox\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:function(r){return n(r.match(/Firefox\\/(\\d+(\\.\\d+)*)/i))},minSupportVersion:79,forceLoadPolyfills:function(r){return i("104",n(r.match(/Firefox\\/(\\d+(\\.\\d+)*)/i)))}},{name:"Opera",description:"Opera 从 2013 年起转向 Chromium 内核,所以现在的 Opera 实际上是一个 Chromium 壳",match:function(r){return Boolean(r.match(/OPR\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"QQBrowser",description:"QQ 浏览器(基于 Chromium),桌面和移动端",match:function(r){return Boolean(r.match(/QQBrowser\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"UCBrowser",description:"UC 浏览器,主要在移动端",match:function(r){return Boolean(r.match(/UCBrowser\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"WeChat",description:"微信内置浏览器(通常基于X5内核/Chromium),移动端",match:function(r){return Boolean(r.match(/MicroMessenger\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:!0},{name:"Chrome",description:"Chrome/Chromium (包含了很多套壳的chrome,Edge也包含了,但是在上面已经处理过了)",match:function(r){return Boolean(r.match(/Chrom(?:e|ium)\\/(\\d+)\\.?/i))},getBrowserVersion:t,minSupportVersion:c,forceLoadPolyfills:function(r){return i("107",t(r))}},{name:"Safari",description:'Safari: 包含 "Version/X Y Safari/" 没有 Chrome/Chromium/Edg/OPR',match:function(r){return!/Chrom(e|ium)|Edg|OPR|QQBrowser/i.test(r)},getBrowserVersion:function(r){return n(r.match(/Version\\/(\\d+(\\.\\d+)*)/i))},minSupportVersion:14.1,forceLoadPolyfills:function(r){return i("16",n(r.match(/Version\\/(\\d+(\\.\\d+)*)/i)))}}];if(s.some(function(r){var e=r.match,n=r.getBrowserVersion,t=r.minSupportVersion,c=r.notSupport,a=r.name;if(!e(o))return!1;if(console.log("当前浏览器ua与",a,"匹配"),c)return!1;var s=n?n(o):null;return s?(console.log("当前浏览器:",a,s),i(s,t)):(console.log("获取不到当前浏览器版本:",a),!1)}))try{var u=s.find(function(r){return r.match(o)}),d=null==u?void 0:u.forceLoadPolyfills;d&&("function"==typeof d?d(o)&&a():a())}catch(r){console.log("polyfills 强制加载失败",r)}else e()}()}catch(r){console.log("检测脚本执行失败",r),e()}}();`, u = (r) => ({
|
|
3
3
|
name: "vite-plugin-compatibility-detection",
|
|
4
4
|
enforce: "post",
|
|
5
5
|
transformIndexHtml(e) {
|
|
@@ -21,10 +21,10 @@ const s = `"use strict";!function(){function r(){document.body.innerHTML='<div s
|
|
|
21
21
|
start: !0,
|
|
22
22
|
startDetection: !0,
|
|
23
23
|
...r || {}
|
|
24
|
-
},
|
|
25
|
-
return
|
|
24
|
+
}, t = [], { start: o, startDetection: n, detectionConfig: i, ...c } = e;
|
|
25
|
+
return o && (t.push(a(c)), n && t.push(u(i))), t;
|
|
26
26
|
};
|
|
27
27
|
export {
|
|
28
28
|
l as getCompatibilityPlugins,
|
|
29
|
-
|
|
29
|
+
u as vitePluginCompatibilityDetection
|
|
30
30
|
};
|