janus-parse 2.1.1 → 2.2.1

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 CHANGED
@@ -12,7 +12,7 @@ A lightweight, high-performance, isomorphic HTML text extractor and sanitizer bu
12
12
 
13
13
  Here is exactly what it handles:
14
14
 
15
- 1. **Completely removes blocked tags**: If a tag is blacklisted (like `script` or `style`), it doesn't just empty the content—it deletes the entire element so no empty HTML tags are left behind in your final string.
15
+ 1. **Completely removes blocked tags**: If a tag is blacklisted (like `script` or `style`), it doesn't just empty the content, it deletes the entire element so no empty HTML tags are left behind in your final string.
16
16
  2. **Keeps specific HTML intact**: You can pass tags into `tagsToPreserve` (like `<code>` or `<iframe>`). It will keep their full HTML layout exactly as it is while stripping out generic structural tags like `<div>` or `<span>`.
17
17
  3. **Cleans up messy whitespace**: It automatically strips out layout code indentations, tabs, and random line breaks, squashing them down into uniform, single spaces.
18
18
 
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../lib/client/stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,KAAK,uBAAuB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,YAAY,CAAC,EAAE,WAAW,CAAC;CAC5B,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,EACtC,GAAG,EACH,MAAM,EACN,QAAQ,EACR,YAAY,GACb,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAS3C"}
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../lib/client/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,KAAK,uBAAuB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,YAAY,CAAC,EAAE,WAAW,CAAC;CAC5B,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,EACtC,GAAG,EACH,MAAM,EACN,QAAQ,EACR,YAAY,GACb,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAS3C"}
@@ -1,4 +1,3 @@
1
- import { janusClient } from "./client.js";
2
1
  export async function janusClientStream({ url, config, encoding, fetchOptions, }) {
3
2
  const response = await fetch(url, fetchOptions);
4
3
  if (!response.ok || !response.body) {
@@ -22,5 +21,6 @@ async function _janusClient(inputStream, config, encoding = "utf8") {
22
21
  finally {
23
22
  reader.releaseLock();
24
23
  }
24
+ const { janusClient } = await import("./client.js");
25
25
  return janusClient(text, config);
26
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../lib/server/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAa7C,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,MAAsB,mBAS/B"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../lib/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAa7C,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,MAAsB,mBAU/B"}
@@ -1,4 +1,3 @@
1
- import { parse } from "node-html-parser";
2
1
  import { validateText, getTags, normalizeWhitespace, serialize, } from "../utils/index.js";
3
2
  const defaultConfig = {
4
3
  tagsToRemove: [],
@@ -6,6 +5,7 @@ const defaultConfig = {
6
5
  };
7
6
  export async function janusServer(text, config = defaultConfig) {
8
7
  validateText(text);
8
+ const { parse } = await import("node-html-parser");
9
9
  const root = parse(text);
10
10
  const { removedTags, preservedTags } = getTags(config);
11
11
  return normalizeWhitespace(serialize({ node: root, removedTags, preservedTags }));
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "janus-parse",
3
3
  "license": "MIT",
4
- "version": "2.1.1",
5
- "packageManager": "pnpm@11.20.0",
4
+ "version": "2.2.1",
5
+ "packageManager": "pnpm@12.16.1",
6
6
  "keywords": [
7
7
  "html-parser",
8
8
  "text-extractor",
@@ -73,27 +73,27 @@
73
73
  "bundle:size": "tsx scripts/bundle-size.ts"
74
74
  },
75
75
  "dependencies": {
76
- "node-html-parser": "9.0.1"
76
+ "node-html-parser": "9.0.6"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@eslint/js": "^10.0.1",
80
80
  "@semantic-release/commit-analyzer": "^13.0.1",
81
- "@semantic-release/github": "^12.0.9",
82
- "@semantic-release/npm": "^13.1.5",
81
+ "@semantic-release/github": "12.0.10",
82
+ "@semantic-release/npm": "13.2.0",
83
83
  "@semantic-release/release-notes-generator": "^14.1.1",
84
- "@types/node": "^26.1.1",
85
- "esbuild": "^0.28.1",
86
- "eslint": "^10.7.0",
84
+ "@types/node": "26.6.6",
85
+ "eslint": "10.14.0",
86
+ "esbuild": "^0.28.2",
87
87
  "eslint-import-resolver-typescript": "^4.4.5",
88
88
  "eslint-plugin-import-x": "^4.17.1",
89
- "eslint-plugin-unicorn": "^72.0.0",
90
- "happy-dom": "^20.11.1",
91
- "prettier": "^3.9.6",
89
+ "happy-dom": "21.0.4",
90
+ "eslint-plugin-unicorn": "79.0.0",
91
+ "prettier": "3.9.10",
92
92
  "semantic-release": "^25.0.8",
93
- "tsx": "4.23.1",
93
+ "tsx": "4.23.15",
94
94
  "typescript": "6.0.3",
95
- "typescript-eslint": "^8.65.0",
96
- "vitest": "^4.1.10"
95
+ "typescript-eslint": "8.72.1",
96
+ "vitest": "5.0.5"
97
97
  },
98
98
  "prettier": {},
99
99
  "--Typescript V 7--": "cannot use TS v7 until typescript-eslint adds support"