rusteerio 0.1.1 → 1.0.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/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/README.md +7 -0
- package/THIRD_PARTY_NOTICES.md +32 -1
- package/dist/{chunk-DKULX6VO.mjs → chunk-DMRD3FGC.mjs} +1 -1
- package/dist/chunk-DMRD3FGC.mjs.map +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/slim.cjs.map +1 -1
- package/dist/slim.mjs +1 -1
- package/native/src/arena.rs +54 -535
- package/native/src/codec.rs +62 -18
- package/native/src/hook_sink.rs +77 -3
- package/native/src/lib.rs +245 -18
- package/native/src/markup_tokenizer.rs +668 -0
- package/native/src/tokenizer.rs +355 -199
- package/native/vendor/README.md +3 -2
- package/native/vendor/html5ever-0.35.0/src/tokenizer/mod.rs +23 -13
- package/package.json +1 -1
- package/rusteerio.darwin-arm64.node +0 -0
- package/rusteerio.darwin-x64.node +0 -0
- package/rusteerio.linux-arm64-gnu.node +0 -0
- package/rusteerio.linux-arm64-musl.node +0 -0
- package/rusteerio.linux-x64-gnu.node +0 -0
- package/rusteerio.linux-x64-musl.node +0 -0
- package/rusteerio.win32-arm64-msvc.node +0 -0
- package/rusteerio.win32-x64-msvc.node +0 -0
- package/scripts/generate-notices.mjs +11 -0
- package/scripts/notices/htmlparser2-MIT.txt +18 -0
- package/scripts/notices/sources.json +6 -0
- package/src/router.ts +3 -2
- package/dist/chunk-DKULX6VO.mjs.map +0 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -98,6 +98,11 @@ function packageNotices(pkg) {
|
|
|
98
98
|
const upstreamLicense = notice('Cheerio MIT LICENSE',
|
|
99
99
|
'https://github.com/cheeriojs/cheerio/blob/e3c7aaf9ed64fe3cb9a181e58a41c0fdd6dbfbfc/LICENSE',
|
|
100
100
|
read(join(cacheDir, 'cheerio-MIT.txt')));
|
|
101
|
+
const htmlparser2License = cachedNotice({
|
|
102
|
+
cache: 'htmlparser2-MIT.txt',
|
|
103
|
+
name: 'htmlparser2 MIT LICENSE',
|
|
104
|
+
source: 'https://raw.githubusercontent.com/fb55/htmlparser2/57ace50bf6eb3bfab0468deafe10d0a8a2f233aa/LICENSE',
|
|
105
|
+
});
|
|
101
106
|
const vendoredCheerioLicense = join(root, 'test', 'upstream', 'LICENSE');
|
|
102
107
|
if (existsSync(vendoredCheerioLicense) && read(vendoredCheerioLicense) !== read(join(cacheDir, 'cheerio-MIT.txt'))) {
|
|
103
108
|
throw new Error('Vendored Cheerio license differs from the pinned upstream notice');
|
|
@@ -128,6 +133,12 @@ const parts = [
|
|
|
128
133
|
'',
|
|
129
134
|
`- [${upstreamLicense.name}](#notice-${upstreamLicense.digest.slice(0, 16)}) — [upstream source](${upstreamLicense.source})`,
|
|
130
135
|
'',
|
|
136
|
+
'## htmlparser2 tokenizer port',
|
|
137
|
+
'',
|
|
138
|
+
'The htmlparser2-compatible markup tokenizer in `native/src/markup_tokenizer.rs` ports the state machine of htmlparser2 10.1.0, commit `57ace50bf6eb3bfab0468deafe10d0a8a2f233aa`. Its original MIT notice is reproduced here.',
|
|
139
|
+
'',
|
|
140
|
+
`- [${htmlparser2License.name}](#notice-${htmlparser2License.digest.slice(0, 16)}) — [upstream source](https://github.com/fb55/htmlparser2/blob/57ace50bf6eb3bfab0468deafe10d0a8a2f233aa/LICENSE)`,
|
|
141
|
+
'',
|
|
131
142
|
`## Rust dependencies (${records.length} locked packages)`,
|
|
132
143
|
];
|
|
133
144
|
for (const { pkg, notices, reason } of records) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
|
|
2
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3
|
+
of this software and associated documentation files (the "Software"), to
|
|
4
|
+
deal in the Software without restriction, including without limitation the
|
|
5
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
6
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
7
|
+
furnished to do so, subject to the following conditions:
|
|
8
|
+
|
|
9
|
+
The above copyright notice and this permission notice shall be included in
|
|
10
|
+
all copies or substantial portions of the Software.
|
|
11
|
+
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
13
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
14
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
15
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
16
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
17
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
18
|
+
IN THE SOFTWARE.
|
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
"https://raw.githubusercontent.com/cheeriojs/cheerio/e3c7aaf9ed64fe3cb9a181e58a41c0fdd6dbfbfc/LICENSE"
|
|
8
8
|
]
|
|
9
9
|
},
|
|
10
|
+
"htmlparser2-MIT.txt": {
|
|
11
|
+
"sha256": "204cfa747341660e4da64cd23e8c876c6b20279d247f48564993d3fc4a2eab47",
|
|
12
|
+
"sources": [
|
|
13
|
+
"https://raw.githubusercontent.com/fb55/htmlparser2/57ace50bf6eb3bfab0468deafe10d0a8a2f233aa/LICENSE"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
10
16
|
"html5ever-AUTHORS.txt": {
|
|
11
17
|
"sha256": "02930215f07fb88b2ec9503a2a1b2345fdcbd351f525c652583fb9df6bc271b9",
|
|
12
18
|
"sources": [
|
package/src/router.ts
CHANGED
|
@@ -2,10 +2,11 @@ import { requireNative, type NativeDocument, type NativeNodeRecord } from './nat
|
|
|
2
2
|
import { hasParserHooks, parseNativeDocument } from './hooks.js';
|
|
3
3
|
import type { CheerioOptions } from './types.js';
|
|
4
4
|
|
|
5
|
+
interface NativeMemoryStats { live: number; slots: number; retained: number; reclaimed: number; immutableNodes: number; externalBytes: number }
|
|
5
6
|
interface ManagedNativeDocument extends NativeDocument {
|
|
6
7
|
retain?(ids: number[]): void;
|
|
7
8
|
release?(ids: number[]): void;
|
|
8
|
-
collectGarbage?():
|
|
9
|
+
collectGarbage?(): NativeMemoryStats;
|
|
9
10
|
}
|
|
10
11
|
interface PinRecord { global: number; document: WeakRef<ManagedNativeDocument>; local: number }
|
|
11
12
|
interface Handle { global: number; document: ManagedNativeDocument; local: number; data?: object; pin: PinRecord }
|
|
@@ -105,7 +106,7 @@ export class RoutedDocument implements NativeDocument {
|
|
|
105
106
|
retainNode(id: number): void { this.lookup(id); }
|
|
106
107
|
retainNodes(ids: number[]): object { return ids.filter((id) => id !== undefined).map((id) => this.lookup(id)); }
|
|
107
108
|
nodeDocument(id: number): NativeDocument { return new RoutedDocument(this.raw, this.options, this.lookup(id)); }
|
|
108
|
-
collectGarbage():
|
|
109
|
+
collectGarbage(): NativeMemoryStats | undefined { registry.snapshots.delete(this.raw); return this.raw.collectGarbage?.(); }
|
|
109
110
|
retainNodeData(id: number, data: object): void { this.lookup(id).data = data; }
|
|
110
111
|
nodeData(id: number): object | undefined { return this.lookup(id).data; }
|
|
111
112
|
nodeDataOperation(id: number): (command: string, args: any) => any {
|