New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

svelte-purify

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-purify - npm Package Compare versions

Comparing version 0.1.2 to 1.0.0

14

package.json
{
"name": "svelte-purify",
"description": "💎 Safe html expansion for Svelte with DOMPurify",
"version": "0.1.2",
"version": "1.0.0",
"main": "dist/index.js",

@@ -56,12 +56,12 @@ "type": "module",

"devDependencies": {
"@jill64/eslint-config-svelte": "1.0.0",
"@jill64/playwright-config": "1.0.0",
"@jill64/eslint-config-svelte": "1.0.1",
"@jill64/playwright-config": "1.4.2",
"@jill64/prettier-config": "1.0.0",
"@jill64/sentry-sveltekit-edge": "0.0.1",
"@jill64/sentry-sveltekit-edge": "0.1.0",
"@playwright/test": "1.40.1",
"@sveltejs/adapter-vercel": "3.1.0",
"@sveltejs/kit": "1.27.6",
"@sveltejs/kit": "1.27.7",
"svelte": "4.2.8",
"typescript": "5.3.2",
"vite": "5.0.5"
"typescript": "5.3.3",
"vite": "5.0.7"
},

@@ -68,0 +68,0 @@ "dependencies": {

@@ -10,1 +10,51 @@ <!----- BEGIN GHOST DOCS HEADER ----->

<!----- END GHOST DOCS HEADER ----->
## Installation
```sh
npm i svelte-purify
```
## Usage
```svelte
<script>
import { Render } from 'svelte-purify'
const code = '<h1>Hello World</h1>'
</script>
<Render html={code} config={/* DOMPurify Config */} />
<!-- Equivalent to {@html code} -->
```
## SSR
`Render` uses DOMPurify internally and only works in the browser or at Node runtime.
There are two options for use in non-node environments such as the edge.
1. Use Browser Only Entry Point
In this case, html is not rendered on the server.
```svelte
<script>
import { Render } from 'svelte-purify/browser-only'
</script>
<Render html={/* ... */} />
```
2. Use [`svelte-sanitize`](https://github.com/jill64/svelte-sanitize)
Enables the use of html rendering in non-node environments at the expense of detailed compatibility.
Please check the link for details.
```svelte
<script>
import { Render } from 'svelte-sanitize'
</script>
<Render html={/* ... */} />
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc