isomorphic-dompurify 1.13.0 → 2.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.
Files changed (3) hide show
  1. package/README.md +12 -15
  2. package/index.js +1 -1
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -39,29 +39,26 @@ Please note that DOMPurify library [doesn't follow Semantic Versioning](https://
39
39
 
40
40
  ## Usage
41
41
 
42
- 1. Import the library:
43
-
42
+ Import:
44
43
  ```javascript
45
- // Import a necessary function in the ES6 way (recommended):
46
- import { sanitize, isSupported } from "isomorphic-dompurify";
47
-
48
- // or the entire module:
49
- import DOMPurify from 'isomorphic-dompurify';
50
-
51
- // or as a CommonJS module:
52
- const DOMPurify = require('isomorphic-dompurify');
44
+ import DOMPurify from "isomorphic-dompurify";
53
45
  ```
46
+ _Importing the entire module for the client/browser version is recommended._
54
47
 
55
- 2. Sanitize a string:
56
-
48
+ Sanitize:
49
+ ```javascript
50
+ const clean = DOMPurify.sanitize(dirtyString);
51
+ ```
52
+ or with [config](https://github.com/cure53/DOMPurify/blob/main/README.md):
57
53
  ```javascript
58
- const clean = DOMPurify.sanitize(dirty);
54
+ const clean = DOMPurify.sanitize(dirtyString, { USE_PROFILES: { html: true } });
59
55
  ```
60
56
 
61
57
  ## Known Issues
62
58
 
63
- 1. [Can't resolve 'canvas' on Next.js serverless app](https://github.com/kkomelin/isomorphic-dompurify/issues/54)
64
- 2. [Starting from 0.16.0, there is a dependency conflict which causes `ReferenceError: TextEncoder is not defined`](https://github.com/kkomelin/isomorphic-dompurify/issues/91)
59
+ 1. Next.js and Remix are mistakenly trying to use the `browser` entry point on server, which causes the `Window is not defined` issue. [#228](https://github.com/kkomelin/isomorphic-dompurify/issues/228) [#214](https://github.com/kkomelin/isomorphic-dompurify/issues/214) https://github.com/vercel/next.js/discussions/58142
60
+ 2. [Can't resolve 'canvas' on Next.js serverless app](https://github.com/kkomelin/isomorphic-dompurify/issues/54)
61
+ 3. [Starting from 0.16.0, there is a dependency conflict which causes `ReferenceError: TextEncoder is not defined`](https://github.com/kkomelin/isomorphic-dompurify/issues/91)
65
62
 
66
63
  ## License
67
64
 
package/index.js CHANGED
@@ -1 +1 @@
1
- function e(e){return e&&e.default||e}module.exports=global.DOMPurify=global.DOMPurify||("undefined"==typeof process?e(require("dompurify")):function(){const r=e(require("dompurify")),{JSDOM:u}=e(require("jsdom")),{window:o}=new u("<!DOCTYPE html>");return r(o)}());
1
+ function e(e){return e&&e.default||e}module.exports=global.DOMPurify=global.DOMPurify||("undefined"!=typeof window?e(require("dompurify")):function(){const r=e(require("dompurify")),{JSDOM:u}=e(require("jsdom")),{window:o}=new u("<!DOCTYPE html>");return r(o)}());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isomorphic-dompurify",
3
- "version": "1.13.0",
3
+ "version": "2.1.0",
4
4
  "description": "Makes it possible to use DOMPurify on server and client in the same way.",
5
5
  "keywords": [
6
6
  "security",
@@ -32,7 +32,7 @@
32
32
  "types": "index.d.ts",
33
33
  "dependencies": {
34
34
  "@types/dompurify": "^3.0.3",
35
- "dompurify": "^3.0.6",
35
+ "dompurify": "^3.0.7",
36
36
  "jsdom": "^23.0.0"
37
37
  },
38
38
  "devDependencies": {