@cbjwwwcode/common 0.0.8 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cbjwwwcode/common",
3
- "version": "0.0.8",
3
+ "version": "0.1.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "ISC",
@@ -8,6 +8,7 @@
8
8
  "type": "module",
9
9
  "scripts": {
10
10
  "build": "tsdown",
11
+ "update:deps": "pnpx taze -r -w",
11
12
  "push": "npm publish --access public"
12
13
  },
13
14
  "files": [
@@ -33,12 +34,12 @@
33
34
  "devDependencies": {
34
35
  "@tsdown/css": "^0.23.0",
35
36
  "@types/crypto-js": "^4.2.2",
36
- "@types/node": "^26.6.2",
37
+ "@types/node": "^26.6.4",
37
38
  "@types/nprogress": "^0.2.3",
38
39
  "concurrently": "^10.0.5",
39
40
  "laravel-vite-plugin": "^3.2.0",
40
41
  "rollup-plugin-bundle-stats": "^4.22.3",
41
- "sass": "^1.104.1",
42
+ "sass": "^1.105.1",
42
43
  "sonda": "^0.14.0",
43
44
  "tsdown": "^0.23.0",
44
45
  "typescript": "^6.0.3",
@@ -48,7 +49,7 @@
48
49
  "vite-plugin-externals": "^0.6.2",
49
50
  "vite-plugin-node-polyfills": "^0.28.0",
50
51
  "vite-plugin-vue-devtools": "^8.2.1",
51
- "vite-plus": "^0.3.0"
52
+ "vite-plus": "^0.3.3"
52
53
  },
53
54
  "dependencies": {
54
55
  "@alova/adapter-axios": "^2.0.20",
@@ -60,20 +61,18 @@
60
61
  "@vueuse/integrations": "^14.4.0",
61
62
  "aieditor": "^2.0.0",
62
63
  "alova": "^3.5.5",
63
- "antdv-next": "^1.5.4",
64
- "antdv-next-tiptap": "^1.0.5",
65
64
  "axios": "^1.20.0",
66
65
  "crypto-js": "^4.2.0",
67
66
  "dayjs": "^1.11.23",
68
- "dompurify": "^3.4.15",
67
+ "dompurify": "^3.4.16",
69
68
  "es-toolkit": "^1.52.0",
70
- "esthetic": "catalog:",
69
+ "esthetic": "0.6.4-beta.1",
71
70
  "highlight.js": "^11.12.0",
72
71
  "hucre": "^1.1.0",
73
72
  "idb-keyval": "^6.3.0",
74
73
  "jsbarcode": "^3.12.3",
75
74
  "mitt": "^3.0.1",
76
- "motion-v": "^2.4.4",
75
+ "motion-v": "^2.5.2",
77
76
  "nprogress": "^0.2.0",
78
77
  "path-browserify": "^1.0.1",
79
78
  "vee-validate": "^4.15.1",
@@ -0,0 +1,21 @@
1
+ import type { Config } from 'dompurify'
2
+ import DOMPurify from 'dompurify'
3
+ import { merge } from 'es-toolkit/compat'
4
+
5
+ export {
6
+ DOMPurify
7
+ }
8
+
9
+ export type {
10
+ Config as DOMConfig
11
+ }
12
+
13
+ export function toSafeHtml(html:string, config?: Partial<Config>){
14
+ return DOMPurify.sanitize(html, merge({
15
+ USE_PROFILES: {
16
+ html: true,
17
+ svg: true,
18
+ svgFilters: true,
19
+ }
20
+ }, { ...config }))
21
+ }
package/src/format.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Rules } from 'esthetic';
2
2
  import esthetic from 'esthetic';
3
- import { isString } from "es-toolkit/compat";
3
+ import { isString, merge } from "es-toolkit/compat";
4
4
 
5
5
  const formatMsps = new Set(['text','html','liquid','javascript','markdown','jsx','typescript','tsx','json','css','scss','sass','less','xml','unknown'])
6
6
 
@@ -28,7 +28,7 @@ export {
28
28
  */
29
29
  export function formatCode(code: string, language: Rules['language'], rules?: Rules){
30
30
  language = isString(language) && formatMsps.has(language) ? language : (language=='vue'?'html':'auto')
31
- return esthetic.format(code, {
31
+ return esthetic.format(code, merge({
32
32
  language,
33
33
  // "default" | "recommended" | "strict" | "warrington" | "prettier"
34
34
  // preset: 'recommended',
@@ -64,8 +64,7 @@ export function formatCode(code: string, language: Rules['language'], rules?: Ru
64
64
  noLeadZero: true, //是否移除数字前导零。0.5 变为 .5,0.95rem 变为 .95rem。这是 CSS 压缩中常见的风格。
65
65
  quoteConvert: 'double', //引号转换。"double" 转为双引号,"single" 转为单引号,"none" 不转换。CSS 中属性值(如字体名、content)的引号会受影响。
66
66
  },
67
- ...rules
68
- })
67
+ }, { ...rules }))
69
68
  }
70
69
 
71
70
 
package/src/index.ts CHANGED
@@ -20,4 +20,5 @@ export * from './lowlight';
20
20
  export * from './hucre';
21
21
  export * from './copy';
22
22
  export * from './format';
23
+ export * from './dompurify';
23
24