module-develop-kit 0.4.3 → 0.5.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.
@@ -1,5 +1,4 @@
1
1
  import { default as default_2 } from 'crypto-js';
2
- import { Plugin as Plugin_2 } from 'vite';
3
2
  import { Ref } from 'vue';
4
3
 
5
4
  /**
@@ -122,7 +121,29 @@ export declare interface ICallConfig extends SipAccount {
122
121
  /**
123
122
  * ice地址
124
123
  */
125
- iceService: string;
124
+ iceService: {
125
+ /**
126
+ * stun 地址
127
+ */
128
+ stunServerUrl: string;
129
+ /**
130
+ * turn 信息
131
+ */
132
+ turnServer?: {
133
+ /**
134
+ * turn 服务器地址,可以多个
135
+ */
136
+ urls: string | string[];
137
+ /**
138
+ * turn 服务器用户名
139
+ */
140
+ username: string;
141
+ /**
142
+ * turn 服务器密码
143
+ */
144
+ credential: string;
145
+ };
146
+ };
126
147
  /**
127
148
  * 是否开发环境
128
149
  */
@@ -295,6 +316,4 @@ export declare const useCall: (callBack?: (status: ECallStatus, callStatusText:
295
316
  getErrorMessage: () => any;
296
317
  };
297
318
 
298
- export declare const vitePluginCompatibilityDetection: () => Plugin_2;
299
-
300
319
  export { }
@@ -0,0 +1,35 @@
1
+ import { HtmlTagDescriptor } from 'vite';
2
+ import { Options } from '@vitejs/plugin-legacy';
3
+ import { Plugin as Plugin_2 } from 'vite';
4
+ import { PluginOption } from 'vite';
5
+
6
+ export declare interface IVitePluginLegacyOptions extends Options {
7
+ /**
8
+ * 是否开启
9
+ * @default true
10
+ */
11
+ start?: boolean;
12
+ /**
13
+ * 是否开启检测
14
+ * @default true
15
+ */
16
+ startDetection?: boolean;
17
+ /**
18
+ * 兼容性检测配置
19
+ */
20
+ detectionConfig?: HtmlTagDescriptor;
21
+ }
22
+
23
+ /**
24
+ * 兼容性检测
25
+ * @param options 可以选择自定义插入内容
26
+ */
27
+ export declare const vitePluginCompatibilityDetection: (options?: HtmlTagDescriptor) => Plugin_2;
28
+
29
+ /**
30
+ * legacy/兼容性检测相关配置
31
+ * @param options
32
+ */
33
+ export declare const vitePluginLegacy: (options?: IVitePluginLegacyOptions) => PluginOption[];
34
+
35
+ export { }
@@ -0,0 +1,30 @@
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="不支持该浏览器"}function e(){document.body?r():window.addEventListener("load",r)}try{!function(){var r=window.navigator.userAgent;function o(r){return r&&Array.isArray(r)&&r[1]?parseFloat(r[1]):null}function n(r){return o(r.match(/Chrom(?:e|ium)\\/(\\d+)\\.?/i))}var t=85;[{name:"Ie",description:"detect IE engine (Trident/MSIE) — 360 在兼容模式下会走 Trident,IE不支持",match:function(r){return/MSIE |Trident\\//i.test(r)},notSupport:!0},{name:"Edge",description:"Edge (Chromium) token: Edg/",match:function(r){return Boolean(r.match(/Edg\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:n,minSupportVersion:t},{name:"Firefox",match:function(r){return Boolean(r.match(/Firefox\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:function(r){return o(r.match(/Firefox\\/(\\d+\\.?\\d*)/i))},minSupportVersion:79},{name:"Opera",description:"Opera 从 2013 年起转向 Chromium 内核,所以现在的 Opera 实际上是一个 Chromium 壳",match:function(r){return Boolean(r.match(/OPR\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:n,minSupportVersion:t},{name:"QQBrowser",description:"QQ 浏览器(基于 Chromium),桌面和移动端",match:function(r){return Boolean(r.match(/QQBrowser\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:n,minSupportVersion:t},{name:"UCBrowser",description:"UC 浏览器,主要在移动端",match:function(r){return Boolean(r.match(/UCBrowser\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:n,minSupportVersion:t},{name:"WeChat",description:"微信内置浏览器(通常基于X5内核/Chromium),移动端",match:function(r){return Boolean(r.match(/MicroMessenger\\/(\\d+\\.?\\d*)/i))},getBrowserVersion:n,minSupportVersion:t},{name:"Chrome",description:"Chrome/Chromium (包含了很多套壳的chrome,Edge也包含了,但是在上面已经处理过了)",match:function(r){return Boolean(r.match(/Chrom(?:e|ium)\\/(\\d+)\\.?/i))},getBrowserVersion:n,minSupportVersion:t},{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 o(r.match(/Version\\/(\\d+)\\.?/i))},minSupportVersion:14.1}].some(function(e){var o=e.match,n=e.getBrowserVersion,t=e.minSupportVersion,i=e.notSupport,a=e.name;if(!o(r))return!1;if(console.log("当前浏览器ua与",a,"匹配"),i)return!1;var c=n?n(r):null;return c?(console.log("当前浏览器:",a,c),c>=(null!=t?t:-1)):(console.log("获取不到当前浏览器版本:",a),!1)})||e()}()}catch(r){console.log("检测脚本执行失败",r),e()}}();`, u = (r) => ({
3
+ name: "vite-plugin-compatibility-detection",
4
+ enforce: "post",
5
+ transformIndexHtml(e) {
6
+ return {
7
+ html: e,
8
+ tags: [
9
+ {
10
+ tag: "script",
11
+ children: s,
12
+ // default head-prepend
13
+ injectTo: "head-prepend",
14
+ ...r || {}
15
+ }
16
+ ]
17
+ };
18
+ }
19
+ }), d = (r) => {
20
+ const e = {
21
+ start: !0,
22
+ startDetection: !0,
23
+ ...r || {}
24
+ }, t = [], { start: n, startDetection: o, detectionConfig: i, ...c } = e;
25
+ return n && (t.push(a(c)), o && t.push(u(i))), t;
26
+ };
27
+ export {
28
+ u as vitePluginCompatibilityDetection,
29
+ d as vitePluginLegacy
30
+ };
package/package.json CHANGED
@@ -1,14 +1,29 @@
1
1
  {
2
2
  "name": "module-develop-kit",
3
- "version": "0.4.3",
3
+ "author": "Front-End team",
4
+ "version": "0.5.0",
5
+ "type": "module",
4
6
  "description": "前端项目通用工具包",
5
7
  "module": "dist/index.es.js",
8
+ "main": "dist/index.es.js",
6
9
  "types": "dist/index.d.ts",
7
10
  "files": [
8
11
  "dist",
9
12
  "package.json",
10
13
  "README.md"
11
14
  ],
15
+ "exports": {
16
+ ".": {
17
+ "import": "./dist/index.es.js",
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.es.js"
20
+ },
21
+ "./vite-plugins": {
22
+ "import": "./dist/vite-plugins/index.es.js",
23
+ "types": "./dist/plugins/index.d.ts",
24
+ "default": "./dist/vite-plugins/index.es.js"
25
+ }
26
+ },
12
27
  "scripts": {
13
28
  "build:dev": "cross-env NODE_ENV=production APP_ENV=production vite build --mode dev",
14
29
  "dev": "npm run build:dev && cross-env NODE_ENV=development APP_ENV=dev vite --mode dev --config test/vite.config.ts --debug",
@@ -17,31 +32,34 @@
17
32
  "prepare": "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'",
18
33
  "test": "vitest"
19
34
  },
20
- "type": "module",
21
- "author": "Front-End team",
22
35
  "devDependencies": {
23
- "@lonely9/eslint-config-team": "^1.2.3",
36
+ "@babel/core": "^7.28.4",
37
+ "@babel/preset-env": "^7.28.3",
38
+ "@lonely9/eslint-config-team": "^1.3.4",
39
+ "@microsoft/api-extractor": "^7.52.13",
40
+ "@types/babel__core": "^7.20.5",
24
41
  "@types/crypto-js": "^4.2.2",
25
- "@types/node": "^22.15.30",
42
+ "@types/node": "^24.4.0",
26
43
  "@types/sdp-transform": "^2.15.0",
27
44
  "@types/sm-crypto": "^0.3.4",
28
- "cross-env": "^7.0.3",
29
- "eslint": "^9.31.0",
30
- "jsdom": "^26.1.0",
31
- "jssip": "^3.10.1",
45
+ "@vitejs/plugin-legacy": "^7.2.1",
46
+ "cross-env": "^10.0.0",
47
+ "eslint": "^9.35.0",
48
+ "jsdom": "^27.0.0",
32
49
  "prettier": "^3.6.2",
33
50
  "sdp-transform": "^2.15.0",
34
- "typescript": "^5.8.3",
35
- "unplugin-dts": "^1.0.0-beta.0",
36
- "vite": "^6.3.5",
37
- "vite-plugin-dts": "^4.5.4",
38
- "vitest": "^3.2.2",
39
- "vue": "^3.5.20",
40
- "vue-tsc": "^3.0.6"
51
+ "terser": "^5.44.0",
52
+ "typescript": "^5.9.2",
53
+ "unplugin-dts": "^1.0.0-beta.6",
54
+ "vite": "^7.1.5",
55
+ "vitest": "^3.2.4",
56
+ "vue": "^3.5.21",
57
+ "vue-tsc": "^3.0.7"
41
58
  },
42
59
  "dependencies": {
43
60
  "crypto-js": "^4.2.0",
44
61
  "gm-crypt": "^0.0.2",
62
+ "jssip": "^3.10.1",
45
63
  "sm-crypto": "^0.3.13"
46
64
  }
47
65
  }