module-develop-kit 0.5.13 → 0.5.14

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,4 +1,4 @@
1
- const t = '"use strict";try{import.meta.url,import("_").catch(()=>1),async function*(){}().next()}catch(t){console.log("not support")}';
1
+ const t = `(()=>{function t(){var t;t=()=>{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: 80%; 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: center"><a href="https://www.google.cn/chrome/" target="_blank" class="know-btn" 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="不支持该浏览器"},document.body?t():window.addEventListener("load",t,{once:!0})}try{(function(){try{return new Function('9007199254740991n === BigInt("12345678901234567890");2 ?? 1;3 || 4;window?.a?.b?.c;Promise.allSettled([1, 2, 3]);"a?.b".matchAll(/./g);import("___").catch(() => 1);\\n if(!window.globalThis){throw new Error("no globalThis");}')(),!0}catch(t){return!1}})()||t()}catch(o){console.log("检测脚本执行失败",o),t()}})();`;
2
2
  export {
3
3
  t as default
4
4
  };
@@ -1,12 +1,23 @@
1
- import p from "@vitejs/plugin-legacy";
2
- import { vitePluginCompatibilityDetection as c } from "./vitePluginCompatibilityDetection.js";
3
- const g = (i) => {
1
+ import c from "@vitejs/plugin-legacy";
2
+ import { vitePluginCompatibilityDetection as l } from "./vitePluginCompatibilityDetection.js";
3
+ const f = {
4
+ targets: "since 2021 and > 0.1% in CN",
5
+ renderModernChunks: !1,
6
+ modernPolyfills: !1
7
+ }, g = (o) => {
4
8
  const e = {
5
- start: !0,
6
- startDetection: !0,
7
- ...i || {}
8
- }, t = [], { start: o, startDetection: n, detectionConfig: r, ...s } = e;
9
- return o && (t.push(p(s)), n && t.push(c(r))), t;
9
+ open: !0,
10
+ openDetection: !0,
11
+ ...o || {}
12
+ }, i = e.detectionConfig?.platform === "h5", t = [], { open: s, openDetection: r, detectionConfig: p, ...n } = e;
13
+ return s && (t.push(
14
+ c(
15
+ i ? {
16
+ ...f,
17
+ ...n || {}
18
+ } : n
19
+ )
20
+ ), r && t.push(l(p))), t;
10
21
  };
11
22
  export {
12
23
  g as getCompatibilityPlugins
@@ -1,22 +1,20 @@
1
- import p from "../../commonjs-virtual-dir/_virtual_mobile-compatibility-detection.js";
1
+ import r from "../../commonjs-virtual-dir/_virtual_mobile-compatibility-detection.js";
2
2
  import n from "../../commonjs-virtual-dir/_virtual_pc-compatibility-detection.js";
3
- const a = (e) => {
4
- const t = e || { platform: "pc" };
5
- t.platform === "mobile" && (t.attrs || (t.attrs = {}), t.attrs.type = "module");
6
- const { platform: i, ...o } = t;
3
+ const m = (t) => {
4
+ const { platform: i, ...e } = t || { platform: "pc" };
7
5
  return {
8
6
  name: "vite-plugin-compatibility-detection",
9
7
  enforce: "post",
10
- transformIndexHtml(r) {
8
+ transformIndexHtml(o) {
11
9
  return {
12
- html: r,
10
+ html: o,
13
11
  tags: [
14
12
  {
15
13
  tag: "script",
16
- children: i === "mobile" ? p : n,
14
+ children: i === "h5" ? r : n,
17
15
  // default head-prepend
18
16
  injectTo: "head-prepend",
19
- ...o || {}
17
+ ...e || {}
20
18
  }
21
19
  ]
22
20
  };
@@ -24,5 +22,5 @@ const a = (e) => {
24
22
  };
25
23
  };
26
24
  export {
27
- a as vitePluginCompatibilityDetection
25
+ m as vitePluginCompatibilityDetection
28
26
  };
@@ -14,20 +14,20 @@ export declare interface IVitePluginCompatibilityDetectionOptions extends Partia
14
14
  * 检测平台
15
15
  * @default pc
16
16
  */
17
- platform?: "pc" | "mobile";
17
+ platform?: "pc" | "h5";
18
18
  }
19
19
 
20
20
  export declare interface IVitePluginLegacyOptions extends Options {
21
21
  /**
22
- * 是否开启
22
+ * 是否开启检测/legacy的加载。开发环境可以关闭,加快启动速度。
23
23
  * @default true
24
24
  */
25
- start?: boolean;
25
+ open?: boolean;
26
26
  /**
27
- * 是否开启检测
27
+ * 是否开启兼容性检测
28
28
  * @default true
29
29
  */
30
- startDetection?: boolean;
30
+ openDetection?: boolean;
31
31
  /**
32
32
  * 兼容性检测配置
33
33
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "module-develop-kit",
3
3
  "author": "Front-End team",
4
- "version": "0.5.13",
4
+ "version": "0.5.14",
5
5
  "type": "module",
6
6
  "description": "前端项目通用工具包",
7
7
  "module": "dist/main.js",