url-sanitizer 2.3.1 → 4.0.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/README.md +166 -74
- package/dist/url-sanitizer-wo-dompurify.min.js +1 -1
- package/dist/url-sanitizer-wo-dompurify.min.js.map +4 -4
- package/dist/url-sanitizer.min.js +4 -4
- package/dist/url-sanitizer.min.js.map +4 -4
- package/package.json +16 -14
- package/src/lib/file/text-chars.json +1 -1
- package/src/mjs/common.js +7 -6
- package/src/mjs/constant.js +39 -19
- package/src/mjs/dompurify.js +6 -0
- package/src/mjs/file-reader.js +125 -68
- package/src/mjs/regexp.js +79 -0
- package/src/mjs/sanitizer.js +416 -249
- package/src/mjs/text-chars.js +68 -0
- package/src/mjs/uri-util.js +176 -172
- package/types/mjs/common.d.ts +2 -2
- package/types/mjs/constant.d.ts +5 -17
- package/types/mjs/dompurify.d.ts +1 -1
- package/types/mjs/file-reader.d.ts +10 -10
- package/types/mjs/regexp.d.ts +12 -0
- package/types/mjs/sanitizer.d.ts +26 -15
- package/types/mjs/text-chars.d.ts +3 -0
- package/types/mjs/uri-util.d.ts +9 -10
- package/src/mjs/lib-util.js +0 -37
- package/types/mjs/lib-util.d.ts +0 -3
package/src/mjs/lib-util.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* lib-util.js
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import fs from 'node:fs';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
|
|
8
|
-
/* constants */
|
|
9
|
-
const CHAR = 'utf8';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* parse json
|
|
13
|
-
* @param {string} url - file url
|
|
14
|
-
* @returns {string|Array|object} - parsed json
|
|
15
|
-
*/
|
|
16
|
-
export const parseJson = url => {
|
|
17
|
-
const { href } = new URL(url, import.meta.url);
|
|
18
|
-
const filePath = fileURLToPath(href);
|
|
19
|
-
const file = fs.readFileSync(filePath, {
|
|
20
|
-
encoding: CHAR,
|
|
21
|
-
flag: 'r'
|
|
22
|
-
});
|
|
23
|
-
const content = JSON.parse(file);
|
|
24
|
-
return content;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* text chars
|
|
29
|
-
* @type {Array.<number>}
|
|
30
|
-
*/
|
|
31
|
-
export const textChars = parseJson('../lib/file/text-chars.json');
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* uri schemes
|
|
35
|
-
* @type {Array.<string>}
|
|
36
|
-
*/
|
|
37
|
-
export const uriSchemes = parseJson('../lib/iana/uri-schemes.json');
|
package/types/mjs/lib-util.d.ts
DELETED