From 05a14ae86ba45e55e9b8a4b4a9870643038fe0e6 Mon Sep 17 00:00:00 2001 From: Franklin Shera Date: Fri, 6 Oct 2023 20:58:55 +0300 Subject: [PATCH] fix: dompurify --- README.md | 3 +-- package.json | 9 ++++----- src/generator/Generator.ts | 3 +-- webview-ui/rollup.config.js | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2cd529c..2fed575 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ ## Features -- [x] Support for Laravel [9.x](/assets/docs/9.x) and [10.x](/assets/docs/10.x) Docs +- [x] Support for [10.x](/assets/docs/10.x) Docs - [x] Highlighted Codeblocks - [ ] More soon... @@ -31,7 +31,6 @@ - Svelte Webviews - [Markedjs](https://github.com/markedjs/marked) - [Highlightjs](https://github.com/highlightjs/highlight.js/) with GitHub Dark Theme and [Blade Language](https://github.com/miken32/highlightjs-blade) -- [DOMPurify](https://github.com/cure53/DOMPurify) to sanitize html ofcos #### Theme diff --git a/package.json b/package.json index 4738030..b3bd28b 100644 --- a/package.json +++ b/package.json @@ -53,19 +53,19 @@ } }, "scripts": { - "docs:generate": "pnpm run compile && node out/generator/Generator.js", + "docs:generate": "pnpm run compile && node dist/generator/Generator.js", "vscode:prepublish": "pnpm run compile", "compile": "tsc -p ./", "pretest": "pnpm run compile && pnpm run lint", "lint": "eslint src --ext ts", - "test": "node ./out/test/runTest.js", + "test": "node ./dist/test/runTest.js", "watch": "concurrently \"cd webview-ui && pnpm run dev\" \"tsc -watch -p ./\"", "install:all": "pnpm install && cd webview-ui && pnpm install", "start:webview": "cd webview-ui && pnpm run dev", - "build:webview": "cd webview-ui && pnpm run build" + "build:webview": "cd webview-ui && pnpm run build", + "build:all": "pnpm run build:webview && pnpm run compile" }, "devDependencies": { - "@types/dompurify": "^3.0.3", "@types/mocha": "^10.0.2", "@types/node": "~20.8.2", "@types/vscode": "^1.83.0", @@ -73,7 +73,6 @@ "@typescript-eslint/parser": "^6.7.3", "@vscode/test-electron": "^2.3.4", "concurrently": "^8.2.1", - "dompurify": "^3.0.6", "eslint": "^8.50.0", "glob": "^10.3.10", "highlight.js": "^11.8.0", diff --git a/src/generator/Generator.ts b/src/generator/Generator.ts index 74f7f4d..ed2e1a1 100644 --- a/src/generator/Generator.ts +++ b/src/generator/Generator.ts @@ -103,9 +103,8 @@ export default class Generator { const fileContents = getDocContents(f.link); const HTML = await marked.parse(fileContents); - const safeHTML = DOMPurify.sanitize(HTML); - fs.writeFile(fileName, safeHTML, (err) => { + fs.writeFile(fileName, HTML, (err) => { if (err) { throw err; } diff --git a/webview-ui/rollup.config.js b/webview-ui/rollup.config.js index ee16ba5..1d303f1 100644 --- a/webview-ui/rollup.config.js +++ b/webview-ui/rollup.config.js @@ -2,7 +2,7 @@ import svelte from "rollup-plugin-svelte"; import commonjs from "@rollup/plugin-commonjs"; import resolve from "@rollup/plugin-node-resolve"; import livereload from "rollup-plugin-livereload"; -import { terser } from "@rollup/plugin-terser"; +import terser from "@rollup/plugin-terser"; import sveltePreprocess from "svelte-preprocess"; import typescript from "@rollup/plugin-typescript"; import css from "rollup-plugin-css-only";