From 06667ee0afabe6c1075ec15e8276dfddb1f42d75 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sun, 27 Nov 2022 14:39:31 +0800 Subject: [PATCH] chore: cleanup deps --- composables/sanitize.ts | 11 ---------- composables/useCacheStorage.ts | 28 ------------------------ package.json | 2 -- pnpm-lock.yaml | 39 ---------------------------------- 4 files changed, 80 deletions(-) delete mode 100644 composables/sanitize.ts delete mode 100644 composables/useCacheStorage.ts diff --git a/composables/sanitize.ts b/composables/sanitize.ts deleted file mode 100644 index 49890a73..00000000 --- a/composables/sanitize.ts +++ /dev/null @@ -1,11 +0,0 @@ -import SanitizeHTML from 'sanitize-html' - -export function sanitize(text: string) { - return SanitizeHTML(text, { - allowedAttributes: { - a: ['href', 'name', 'target', 'class'], - span: ['class'], - img: ['src', 'srcset', 'alt', 'title', 'width', 'height', 'loading'], - }, - }) -} diff --git a/composables/useCacheStorage.ts b/composables/useCacheStorage.ts deleted file mode 100644 index 2ec46bf0..00000000 --- a/composables/useCacheStorage.ts +++ /dev/null @@ -1,28 +0,0 @@ -export function useCacheStorage( - key: string, - getter: () => T | Promise, - TTL = 1000 * 60 * 60 * 12, // 12 hours -) { - const storage = useLocalStorage(key, { - time: 0, - value: null as T | null, - }) - - if (storage.value.time + TTL < Date.now()) { - Promise.resolve(getter()).then((v) => { - storage.value = { - time: Date.now(), - value: v, - } - }) - } - - return computed({ - get() { - return storage.value.value - }, - set(v) { - storage.value.value = v - }, - }) -} diff --git a/package.json b/package.json index a3efb76c..2345681e 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,6 @@ "@types/fs-extra": "^9.0.13", "@types/js-yaml": "^4.0.5", "@types/prettier": "^2.7.1", - "@types/sanitize-html": "^2.6.2", "@types/wicg-file-system-access": "^2020.9.5", "@unocss/nuxt": "^0.46.5", "@vitejs/plugin-vue": "^3.2.0", @@ -59,7 +58,6 @@ "postcss-nested": "^6.0.0", "prettier": "^2.8.0", "rollup-plugin-node-polyfills": "^0.2.1", - "sanitize-html": "^2.7.3", "shiki": "^0.11.1", "theme-vitesse": "^0.6.0", "tippy.js": "^6.3.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c91a3738..82372ff8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,7 +20,6 @@ specifiers: '@types/fs-extra': ^9.0.13 '@types/js-yaml': ^4.0.5 '@types/prettier': ^2.7.1 - '@types/sanitize-html': ^2.6.2 '@types/wicg-file-system-access': ^2020.9.5 '@unocss/nuxt': ^0.46.5 '@vitejs/plugin-vue': ^3.2.0 @@ -44,7 +43,6 @@ specifiers: postcss-nested: ^6.0.0 prettier: ^2.8.0 rollup-plugin-node-polyfills: ^0.2.1 - sanitize-html: ^2.7.3 shiki: ^0.11.1 theme-vitesse: ^0.6.0 tippy.js: ^6.3.7 @@ -77,7 +75,6 @@ devDependencies: '@types/fs-extra': 9.0.13 '@types/js-yaml': 4.0.5 '@types/prettier': 2.7.1 - '@types/sanitize-html': 2.6.2 '@types/wicg-file-system-access': 2020.9.5 '@unocss/nuxt': 0.46.5 '@vitejs/plugin-vue': 3.2.0 @@ -101,7 +98,6 @@ devDependencies: postcss-nested: 6.0.0 prettier: 2.8.0 rollup-plugin-node-polyfills: 0.2.1 - sanitize-html: 2.7.3 shiki: 0.11.1 theme-vitesse: 0.6.0 tippy.js: 6.3.7 @@ -1434,12 +1430,6 @@ packages: resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} dev: true - /@types/sanitize-html/2.6.2: - resolution: {integrity: sha512-7Lu2zMQnmHHQGKXVvCOhSziQMpa+R2hMHFefzbYoYMHeaXR0uXqNeOc3JeQQQ8/6Xa2Br/P1IQTLzV09xxAiUQ==} - dependencies: - htmlparser2: 6.1.0 - dev: true - /@types/semver/7.3.13: resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==} dev: true @@ -4521,15 +4511,6 @@ packages: engines: {node: '>=8'} dev: true - /htmlparser2/6.1.0: - resolution: {integrity: sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==} - dependencies: - domelementtype: 2.3.0 - domhandler: 4.3.1 - domutils: 2.8.0 - entities: 2.2.0 - dev: true - /htmlparser2/8.0.1: resolution: {integrity: sha512-4lVbmc1diZC7GUJQtRQ5yBAeUCL1exyMwmForWkRLnwyzWBFxN633SALPMGYaWZvKe9j1pRZJpauvmxENSp/EA==} dependencies: @@ -4811,11 +4792,6 @@ packages: engines: {node: '>=8'} dev: true - /is-plain-object/5.0.0: - resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==} - engines: {node: '>=0.10.0'} - dev: true - /is-primitive/3.0.1: resolution: {integrity: sha512-GljRxhWvlCNRfZyORiH77FwdFwGcMO620o37EOYC0ORWdq+WYNVqW0w2Juzew4M+L81l6/QS3t5gkkihyRqv9w==} engines: {node: '>=0.10.0'} @@ -5881,10 +5857,6 @@ packages: protocols: 2.0.1 dev: true - /parse-srcset/1.0.2: - resolution: {integrity: sha512-/2qh0lav6CmI15FzA3i/2Bzk2zCgQhGMkvhOhKNcBVQ1ldgpbfiNTVslmooUmWJcADi1f1kIeynbDRVzNlfR6Q==} - dev: true - /parse-url/8.1.0: resolution: {integrity: sha512-xDvOoLU5XRrcOZvnI6b8zA6n9O9ejNk/GExuz1yBuWUGn9KA97GI6HTs6u02wKara1CeVmZhH+0TZFdWScR89w==} dependencies: @@ -6729,17 +6701,6 @@ packages: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} dev: true - /sanitize-html/2.7.3: - resolution: {integrity: sha512-jMaHG29ak4miiJ8wgqA1849iInqORgNv7SLfSw9LtfOhEUQ1C0YHKH73R+hgyufBW9ZFeJrb057k9hjlfBCVlw==} - dependencies: - deepmerge: 4.2.2 - escape-string-regexp: 4.0.0 - htmlparser2: 6.1.0 - is-plain-object: 5.0.0 - parse-srcset: 1.0.2 - postcss: 8.4.19 - dev: true - /scule/1.0.0: resolution: {integrity: sha512-4AsO/FrViE/iDNEPaAQlb77tf0csuq27EsVpy6ett584EcRTp6pTDLoGWVxCD77y5iU5FauOvhsI4o1APwPoSQ==} dev: true