mirror of
https://github.com/modernweb-dev/rocket.git
synced 2026-03-22 15:54:02 +00:00
Compare commits
2 Commits
fix/checkL
...
check-html
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2a4b80f1e | ||
|
|
f343c5030a |
@@ -1,5 +1,11 @@
|
||||
# check-html-links
|
||||
|
||||
## 0.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- f343c50: When reading bigger files, especially bigger files with all content on one line it could mean a read chunk is in the middle of a character. This can lead to strange symbols in the resulting string. The `hightWaterMark` is now increased from the node default of 16KB to 256KB. Additionally, the `hightWaterMark` is now synced for reading and parsing.
|
||||
|
||||
## 0.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "check-html-links",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
|
||||
@@ -15,10 +15,12 @@ import path from 'path';
|
||||
const require = createRequire(import.meta.url);
|
||||
const { SaxEventType, SAXParser } = saxWasm;
|
||||
|
||||
const streamOptions = { highWaterMark: 256 * 1024 };
|
||||
|
||||
const saxPath = require.resolve('sax-wasm/lib/sax-wasm.wasm');
|
||||
const saxWasmBuffer = fs.readFileSync(saxPath);
|
||||
const parserReferences = new SAXParser(SaxEventType.Attribute);
|
||||
const parserIds = new SAXParser(SaxEventType.Attribute /*, { highWaterMark: 256 * 1024 } */);
|
||||
const parserReferences = new SAXParser(SaxEventType.Attribute, streamOptions);
|
||||
const parserIds = new SAXParser(SaxEventType.Attribute, streamOptions);
|
||||
|
||||
/** @type {Error[]} */
|
||||
let checkLocalFiles = [];
|
||||
@@ -76,7 +78,7 @@ function extractReferences(htmlFilePath) {
|
||||
};
|
||||
|
||||
return new Promise(resolve => {
|
||||
const readable = fs.createReadStream(htmlFilePath);
|
||||
const readable = fs.createReadStream(htmlFilePath, streamOptions);
|
||||
readable.on('data', chunk => {
|
||||
// @ts-expect-error
|
||||
parserReferences.write(chunk);
|
||||
@@ -112,7 +114,7 @@ function idExists(filePath, id) {
|
||||
};
|
||||
|
||||
return new Promise(resolve => {
|
||||
const readable = fs.createReadStream(filePath);
|
||||
const readable = fs.createReadStream(filePath, streamOptions);
|
||||
readable.on('data', chunk => {
|
||||
// @ts-expect-error
|
||||
parserIds.write(chunk);
|
||||
|
||||
Reference in New Issue
Block a user