feedparser-rs 0.2.0 → 0.3.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 (4) hide show
  1. package/README.md +76 -116
  2. package/index.d.ts +133 -0
  3. package/index.js +54 -52
  4. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # feedparser-rs
2
2
 
3
- High-performance RSS/Atom/JSON Feed parser written in Rust with Node.js bindings.
3
+ [![npm](https://img.shields.io/npm/v/feedparser-rs)](https://www.npmjs.com/package/feedparser-rs)
4
+ [![Node](https://img.shields.io/node/v/feedparser-rs)](https://www.npmjs.com/package/feedparser-rs)
5
+ [![License](https://img.shields.io/npm/l/feedparser-rs)](LICENSE)
6
+
7
+ High-performance RSS/Atom/JSON Feed parser for Node.js, written in Rust.
4
8
 
5
9
  Drop-in replacement for Python's `feedparser` library, offering 10-100x performance improvement.
6
10
 
@@ -8,9 +12,10 @@ Drop-in replacement for Python's `feedparser` library, offering 10-100x performa
8
12
 
9
13
  - **Fast**: Written in Rust, 10-100x faster than Python feedparser
10
14
  - **Tolerant**: Handles malformed feeds with bozo flag (like feedparser)
11
- - **Multi-format**: Supports RSS 0.9x/1.0/2.0, Atom 0.3/1.0, JSON Feed 1.0/1.1
12
- - **Zero-copy**: Efficient parsing with minimal allocations
15
+ - **Multi-format**: RSS 0.9x/1.0/2.0, Atom 0.3/1.0, JSON Feed 1.0/1.1
16
+ - **HTTP fetching**: Built-in URL fetching with compression support
13
17
  - **TypeScript**: Full TypeScript definitions included
18
+ - **Zero-copy**: Efficient parsing with minimal allocations
14
19
 
15
20
  ## Installation
16
21
 
@@ -22,12 +27,14 @@ yarn add feedparser-rs
22
27
  pnpm add feedparser-rs
23
28
  ```
24
29
 
30
+ > [!IMPORTANT]
31
+ > Requires Node.js 18 or later.
32
+
25
33
  ## Quick Start
26
34
 
27
35
  ```javascript
28
36
  import { parse } from 'feedparser-rs';
29
37
 
30
- // Parse from string
31
38
  const feed = parse(`
32
39
  <?xml version="1.0"?>
33
40
  <rss version="2.0">
@@ -44,8 +51,28 @@ const feed = parse(`
44
51
  console.log(feed.feed.title); // "My Blog"
45
52
  console.log(feed.entries[0].title); // "Hello World"
46
53
  console.log(feed.version); // "rss20"
54
+ ```
55
+
56
+ ## HTTP Fetching
57
+
58
+ Fetch and parse feeds directly from URLs:
59
+
60
+ ```javascript
61
+ import { fetchAndParse } from 'feedparser-rs';
62
+
63
+ const feed = await fetchAndParse('https://example.com/feed.xml');
64
+ console.log(feed.feed.title);
65
+ console.log(`Fetched ${feed.entries.length} entries`);
66
+ ```
67
+
68
+ > [!TIP]
69
+ > `fetchAndParse` automatically handles compression (gzip, deflate, brotli) and follows redirects.
70
+
71
+ ### Parsing from Buffer
72
+
73
+ ```javascript
74
+ import { parse } from 'feedparser-rs';
47
75
 
48
- // Parse from Buffer (e.g., HTTP response)
49
76
  const response = await fetch('https://example.com/feed.xml');
50
77
  const buffer = Buffer.from(await response.arrayBuffer());
51
78
  const feed = parse(buffer);
@@ -66,24 +93,23 @@ Parse a feed from bytes or string.
66
93
  **Throws:**
67
94
  - `Error` if parsing fails catastrophically
68
95
 
69
- **Example:**
70
- ```javascript
71
- const feed = parse('<rss version="2.0">...</rss>');
72
- console.log(feed.feed.title);
73
- console.log(feed.entries.length);
74
- ```
96
+ ### `fetchAndParse(url: string): Promise<ParsedFeed>`
97
+
98
+ Fetch and parse a feed from URL.
99
+
100
+ **Parameters:**
101
+ - `url` - Feed URL to fetch
102
+
103
+ **Returns:**
104
+ - Promise resolving to `ParsedFeed` object
75
105
 
76
106
  ### `detectFormat(source: Buffer | string | Uint8Array): string`
77
107
 
78
108
  Detect feed format without full parsing.
79
109
 
80
- **Parameters:**
81
- - `source` - Feed content as Buffer, string, or Uint8Array
82
-
83
110
  **Returns:**
84
111
  - Format string: `"rss20"`, `"atom10"`, `"json11"`, etc.
85
112
 
86
- **Example:**
87
113
  ```javascript
88
114
  const format = detectFormat('<feed xmlns="http://www.w3.org/2005/Atom">...</feed>');
89
115
  console.log(format); // "atom10"
@@ -114,22 +140,11 @@ interface FeedMeta {
114
140
  link?: string;
115
141
  links: Link[];
116
142
  subtitle?: string;
117
- subtitle_detail?: TextConstruct;
118
143
  updated?: number; // Milliseconds since epoch
119
144
  author?: string;
120
- author_detail?: Person;
121
145
  authors: Person[];
122
- contributors: Person[];
123
- publisher?: string;
124
- publisher_detail?: Person;
125
146
  language?: string;
126
- rights?: string;
127
- rights_detail?: TextConstruct;
128
- generator?: string;
129
- generator_detail?: Generator;
130
147
  image?: Image;
131
- icon?: string;
132
- logo?: string;
133
148
  tags: Tag[];
134
149
  id?: string;
135
150
  ttl?: number;
@@ -142,94 +157,21 @@ interface FeedMeta {
142
157
  interface Entry {
143
158
  id?: string;
144
159
  title?: string;
145
- title_detail?: TextConstruct;
146
160
  link?: string;
147
161
  links: Link[];
148
162
  summary?: string;
149
- summary_detail?: TextConstruct;
150
163
  content: Content[];
151
164
  published?: number; // Milliseconds since epoch
152
165
  updated?: number;
153
- created?: number;
154
- expired?: number;
155
166
  author?: string;
156
- author_detail?: Person;
157
167
  authors: Person[];
158
- contributors: Person[];
159
- publisher?: string;
160
- publisher_detail?: Person;
161
168
  tags: Tag[];
162
169
  enclosures: Enclosure[];
163
- comments?: string;
164
- source?: Source;
165
170
  }
166
171
  ```
167
172
 
168
- ### Other Types
169
-
170
- ```typescript
171
- interface TextConstruct {
172
- value: string;
173
- type: "text" | "html" | "xhtml";
174
- language?: string;
175
- base?: string;
176
- }
177
-
178
- interface Link {
179
- href: string;
180
- rel?: string;
181
- type?: string;
182
- title?: string;
183
- length?: number;
184
- hreflang?: string;
185
- }
186
-
187
- interface Person {
188
- name?: string;
189
- email?: string;
190
- uri?: string;
191
- }
192
-
193
- interface Tag {
194
- term: string;
195
- scheme?: string;
196
- label?: string;
197
- }
198
-
199
- interface Image {
200
- url: string;
201
- title?: string;
202
- link?: string;
203
- width?: number;
204
- height?: number;
205
- description?: string;
206
- }
207
-
208
- interface Enclosure {
209
- url: string;
210
- length?: number;
211
- type?: string;
212
- }
213
-
214
- interface Content {
215
- value: string;
216
- type?: string;
217
- language?: string;
218
- base?: string;
219
- }
220
-
221
- interface Generator {
222
- value: string;
223
- uri?: string;
224
- version?: string;
225
- }
226
-
227
- interface Source {
228
- title?: string;
229
- link?: string;
230
- id?: string;
231
- }
232
- ```
173
+ > [!NOTE]
174
+ > See `index.d.ts` for complete type definitions including `Link`, `Person`, `Tag`, `Image`, `Enclosure`, and more.
233
175
 
234
176
  ## Error Handling
235
177
 
@@ -248,11 +190,9 @@ console.log(feed.feed.title); // "Broken"
248
190
 
249
191
  ## Dates
250
192
 
251
- All date fields are returned as milliseconds since Unix epoch (number type). Convert to JavaScript Date:
193
+ All date fields are returned as milliseconds since Unix epoch. Convert to JavaScript Date:
252
194
 
253
195
  ```javascript
254
- const feed = parse(xmlWithDates);
255
-
256
196
  const entry = feed.entries[0];
257
197
  if (entry.published) {
258
198
  const date = new Date(entry.published);
@@ -262,23 +202,35 @@ if (entry.published) {
262
202
 
263
203
  ## Performance
264
204
 
265
- Benchmarks vs Python feedparser (parsing 100KB RSS feed):
205
+ Benchmarks on Apple M1 Pro:
206
+
207
+ | Feed Size | Time | Throughput |
208
+ |-----------|------|------------|
209
+ | Small (2 KB) | 0.01 ms | 187 MB/s |
210
+ | Medium (20 KB) | 0.09 ms | 214 MB/s |
211
+ | Large (200 KB) | 0.94 ms | 213 MB/s |
212
+
213
+ ### vs Python feedparser
266
214
 
267
- | Library | Time | Speedup |
268
- |---------|------|---------|
269
- | feedparser-rs | 0.5ms | 100x |
270
- | feedparser (Python) | 50ms | 1x |
215
+ | Operation | feedparser-rs | Python feedparser | Speedup |
216
+ |-----------|---------------|-------------------|---------|
217
+ | Parse 20 KB RSS | 0.09 ms | 8.5 ms | **94x** |
218
+ | Parse 200 KB RSS | 0.94 ms | 85 ms | **90x** |
271
219
 
272
- See [benchmarks/](../../benchmarks/) for detailed results and methodology.
220
+ > [!TIP]
221
+ > For best performance, pass `Buffer` instead of `string` to avoid UTF-8 conversion overhead.
273
222
 
274
223
  ## Platform Support
275
224
 
276
225
  Pre-built binaries available for:
277
- - macOS (Intel & Apple Silicon)
278
- - Linux (x64, ARM64)
279
- - Windows (x64)
280
226
 
281
- Supported Node.js versions: 18, 20, 22
227
+ | Platform | Architecture |
228
+ |----------|--------------|
229
+ | macOS | Intel (x64), Apple Silicon (arm64) |
230
+ | Linux | x64, arm64 |
231
+ | Windows | x64 |
232
+
233
+ Supported Node.js versions: 18, 20, 22+
282
234
 
283
235
  ## Development
284
236
 
@@ -291,15 +243,23 @@ npm run build
291
243
 
292
244
  # Run tests
293
245
  npm test
246
+
247
+ # Run tests with coverage
248
+ npm run test:coverage
294
249
  ```
295
250
 
296
251
  ## License
297
252
 
298
- MIT OR Apache-2.0
253
+ Licensed under either of:
254
+
255
+ - [Apache License, Version 2.0](../../LICENSE-APACHE)
256
+ - [MIT License](../../LICENSE-MIT)
257
+
258
+ at your option.
299
259
 
300
260
  ## Links
301
261
 
302
262
  - [GitHub](https://github.com/bug-ops/feedparser-rs)
303
263
  - [npm](https://www.npmjs.com/package/feedparser-rs)
304
- - [Documentation](https://docs.rs/feedparser-rs-core)
264
+ - [Rust API Documentation](https://docs.rs/feedparser-rs)
305
265
  - [Changelog](../../CHANGELOG.md)
package/index.d.ts CHANGED
@@ -81,6 +81,12 @@ export interface Entry {
81
81
  comments?: string
82
82
  /** Source feed reference */
83
83
  source?: Source
84
+ /** Podcast transcripts */
85
+ podcastTranscripts: Array<PodcastTranscript>
86
+ /** Podcast persons */
87
+ podcastPersons: Array<PodcastPerson>
88
+ /** License URL (Creative Commons, etc.) */
89
+ license?: string
84
90
  }
85
91
 
86
92
  /** Feed metadata */
@@ -99,6 +105,8 @@ export interface FeedMeta {
99
105
  subtitleDetail?: TextConstruct
100
106
  /** Last update date (milliseconds since epoch) */
101
107
  updated?: number
108
+ /** Initial publication date (milliseconds since epoch) */
109
+ published?: number
102
110
  /** Primary author name */
103
111
  author?: string
104
112
  /** Detailed author information */
@@ -133,6 +141,16 @@ export interface FeedMeta {
133
141
  id?: string
134
142
  /** Time-to-live (update frequency hint) in minutes */
135
143
  ttl?: number
144
+ /** License URL (Creative Commons, etc.) */
145
+ license?: string
146
+ /** Syndication module metadata (RSS 1.0) */
147
+ syndication?: SyndicationMeta
148
+ /** Dublin Core creator (author fallback) */
149
+ dcCreator?: string
150
+ /** Dublin Core publisher */
151
+ dcPublisher?: string
152
+ /** Dublin Core rights (copyright) */
153
+ dcRights?: string
136
154
  }
137
155
 
138
156
  /** Generator metadata */
@@ -214,8 +232,87 @@ export interface ParsedFeed {
214
232
  version: string
215
233
  /** XML namespaces (prefix -> URI) */
216
234
  namespaces: Record<string, string>
235
+ /** HTTP status code (if fetched from URL) */
236
+ status?: number
237
+ /** Final URL after redirects (if fetched from URL) */
238
+ href?: string
239
+ /** ETag header from HTTP response */
240
+ etag?: string
241
+ /** Last-Modified header from HTTP response */
242
+ modified?: string
243
+ /** HTTP response headers (if fetched from URL) */
244
+ headers?: Record<string, string>
217
245
  }
218
246
 
247
+ /**
248
+ * Parse feed from HTTP/HTTPS URL with conditional GET support
249
+ *
250
+ * Fetches the feed from the given URL and parses it. Supports conditional GET
251
+ * using ETag and Last-Modified headers for bandwidth-efficient caching.
252
+ *
253
+ * # Arguments
254
+ *
255
+ * * `url` - HTTP or HTTPS URL to fetch
256
+ * * `etag` - Optional ETag from previous fetch for conditional GET
257
+ * * `modified` - Optional Last-Modified timestamp from previous fetch
258
+ * * `user_agent` - Optional custom User-Agent header
259
+ *
260
+ * # Returns
261
+ *
262
+ * Parsed feed result with HTTP metadata fields populated:
263
+ * - `status`: HTTP status code (200, 304, etc.)
264
+ * - `href`: Final URL after redirects
265
+ * - `etag`: ETag header value (for next request)
266
+ * - `modified`: Last-Modified header value (for next request)
267
+ * - `headers`: Full HTTP response headers
268
+ *
269
+ * On 304 Not Modified, returns a feed with empty entries but status=304.
270
+ *
271
+ * # Examples
272
+ *
273
+ * ```javascript
274
+ * const feedparser = require('feedparser-rs');
275
+ *
276
+ * // First fetch
277
+ * const feed = await feedparser.parseUrl("https://example.com/feed.xml");
278
+ * console.log(feed.feed.title);
279
+ * console.log(`ETag: ${feed.etag}`);
280
+ *
281
+ * // Subsequent fetch with caching
282
+ * const feed2 = await feedparser.parseUrl(
283
+ * "https://example.com/feed.xml",
284
+ * feed.etag,
285
+ * feed.modified
286
+ * );
287
+ *
288
+ * if (feed2.status === 304) {
289
+ * console.log("Feed not modified, use cached version");
290
+ * }
291
+ * ```
292
+ */
293
+ export declare function parseUrl(url: string, etag?: string | undefined | null, modified?: string | undefined | null, userAgent?: string | undefined | null): ParsedFeed
294
+
295
+ /**
296
+ * Parse feed from URL with custom resource limits
297
+ *
298
+ * Like `parseUrl` but allows specifying custom limits for DoS protection.
299
+ *
300
+ * # Examples
301
+ *
302
+ * ```javascript
303
+ * const feedparser = require('feedparser-rs');
304
+ *
305
+ * const feed = await feedparser.parseUrlWithOptions(
306
+ * "https://example.com/feed.xml",
307
+ * null, // etag
308
+ * null, // modified
309
+ * null, // user_agent
310
+ * 10485760 // max_size: 10MB
311
+ * );
312
+ * ```
313
+ */
314
+ export declare function parseUrlWithOptions(url: string, etag?: string | undefined | null, modified?: string | undefined | null, userAgent?: string | undefined | null, maxSize?: number | undefined | null): ParsedFeed
315
+
219
316
  /**
220
317
  * Parse an RSS/Atom/JSON Feed with custom size limit
221
318
  *
@@ -244,6 +341,32 @@ export interface Person {
244
341
  uri?: string
245
342
  }
246
343
 
344
+ /** Podcast person metadata */
345
+ export interface PodcastPerson {
346
+ /** Person's name */
347
+ name: string
348
+ /** Person's role (e.g., "host", "guest") */
349
+ role?: string
350
+ /** Person's group (e.g., "cast", "crew") */
351
+ group?: string
352
+ /** Person's image URL */
353
+ img?: string
354
+ /** Person's URL/website */
355
+ href?: string
356
+ }
357
+
358
+ /** Podcast transcript metadata */
359
+ export interface PodcastTranscript {
360
+ /** Transcript URL */
361
+ url: string
362
+ /** Transcript type (e.g., "text/plain", "application/srt") */
363
+ type?: string
364
+ /** Transcript language */
365
+ language?: string
366
+ /** Relationship type (e.g., "captions", "chapters") */
367
+ rel?: string
368
+ }
369
+
247
370
  /** Source reference (for entries) */
248
371
  export interface Source {
249
372
  /** Source title */
@@ -254,6 +377,16 @@ export interface Source {
254
377
  id?: string
255
378
  }
256
379
 
380
+ /** Syndication module metadata (RSS 1.0) */
381
+ export interface SyndicationMeta {
382
+ /** Update period (hourly, daily, weekly, monthly, yearly) */
383
+ updatePeriod?: string
384
+ /** Number of times updated per period */
385
+ updateFrequency?: number
386
+ /** Base date for update schedule (ISO 8601) */
387
+ updateBase?: string
388
+ }
389
+
257
390
  /** Tag/category */
258
391
  export interface Tag {
259
392
  /** Tag term/label */
package/index.js CHANGED
@@ -77,8 +77,8 @@ function requireNative() {
77
77
  try {
78
78
  const binding = require('feedparser-rs-android-arm64')
79
79
  const bindingPackageVersion = require('feedparser-rs-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
82
  }
83
83
  return binding
84
84
  } catch (e) {
@@ -93,8 +93,8 @@ function requireNative() {
93
93
  try {
94
94
  const binding = require('feedparser-rs-android-arm-eabi')
95
95
  const bindingPackageVersion = require('feedparser-rs-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
98
  }
99
99
  return binding
100
100
  } catch (e) {
@@ -114,8 +114,8 @@ function requireNative() {
114
114
  try {
115
115
  const binding = require('feedparser-rs-win32-x64-gnu')
116
116
  const bindingPackageVersion = require('feedparser-rs-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
119
  }
120
120
  return binding
121
121
  } catch (e) {
@@ -130,8 +130,8 @@ function requireNative() {
130
130
  try {
131
131
  const binding = require('feedparser-rs-win32-x64-msvc')
132
132
  const bindingPackageVersion = require('feedparser-rs-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
135
  }
136
136
  return binding
137
137
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('feedparser-rs-win32-ia32-msvc')
149
149
  const bindingPackageVersion = require('feedparser-rs-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -163,8 +163,8 @@ function requireNative() {
163
163
  try {
164
164
  const binding = require('feedparser-rs-win32-arm64-msvc')
165
165
  const bindingPackageVersion = require('feedparser-rs-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
168
  }
169
169
  return binding
170
170
  } catch (e) {
@@ -182,8 +182,8 @@ function requireNative() {
182
182
  try {
183
183
  const binding = require('feedparser-rs-darwin-universal')
184
184
  const bindingPackageVersion = require('feedparser-rs-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
187
  }
188
188
  return binding
189
189
  } catch (e) {
@@ -198,8 +198,8 @@ function requireNative() {
198
198
  try {
199
199
  const binding = require('feedparser-rs-darwin-x64')
200
200
  const bindingPackageVersion = require('feedparser-rs-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
203
  }
204
204
  return binding
205
205
  } catch (e) {
@@ -214,8 +214,8 @@ function requireNative() {
214
214
  try {
215
215
  const binding = require('feedparser-rs-darwin-arm64')
216
216
  const bindingPackageVersion = require('feedparser-rs-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
219
  }
220
220
  return binding
221
221
  } catch (e) {
@@ -234,8 +234,8 @@ function requireNative() {
234
234
  try {
235
235
  const binding = require('feedparser-rs-freebsd-x64')
236
236
  const bindingPackageVersion = require('feedparser-rs-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
239
  }
240
240
  return binding
241
241
  } catch (e) {
@@ -250,8 +250,8 @@ function requireNative() {
250
250
  try {
251
251
  const binding = require('feedparser-rs-freebsd-arm64')
252
252
  const bindingPackageVersion = require('feedparser-rs-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
255
  }
256
256
  return binding
257
257
  } catch (e) {
@@ -271,8 +271,8 @@ function requireNative() {
271
271
  try {
272
272
  const binding = require('feedparser-rs-linux-x64-musl')
273
273
  const bindingPackageVersion = require('feedparser-rs-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
276
  }
277
277
  return binding
278
278
  } catch (e) {
@@ -287,8 +287,8 @@ function requireNative() {
287
287
  try {
288
288
  const binding = require('feedparser-rs-linux-x64-gnu')
289
289
  const bindingPackageVersion = require('feedparser-rs-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
292
  }
293
293
  return binding
294
294
  } catch (e) {
@@ -305,8 +305,8 @@ function requireNative() {
305
305
  try {
306
306
  const binding = require('feedparser-rs-linux-arm64-musl')
307
307
  const bindingPackageVersion = require('feedparser-rs-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
310
  }
311
311
  return binding
312
312
  } catch (e) {
@@ -321,8 +321,8 @@ function requireNative() {
321
321
  try {
322
322
  const binding = require('feedparser-rs-linux-arm64-gnu')
323
323
  const bindingPackageVersion = require('feedparser-rs-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
326
  }
327
327
  return binding
328
328
  } catch (e) {
@@ -339,8 +339,8 @@ function requireNative() {
339
339
  try {
340
340
  const binding = require('feedparser-rs-linux-arm-musleabihf')
341
341
  const bindingPackageVersion = require('feedparser-rs-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
344
  }
345
345
  return binding
346
346
  } catch (e) {
@@ -355,8 +355,8 @@ function requireNative() {
355
355
  try {
356
356
  const binding = require('feedparser-rs-linux-arm-gnueabihf')
357
357
  const bindingPackageVersion = require('feedparser-rs-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
360
  }
361
361
  return binding
362
362
  } catch (e) {
@@ -373,8 +373,8 @@ function requireNative() {
373
373
  try {
374
374
  const binding = require('feedparser-rs-linux-loong64-musl')
375
375
  const bindingPackageVersion = require('feedparser-rs-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
378
  }
379
379
  return binding
380
380
  } catch (e) {
@@ -389,8 +389,8 @@ function requireNative() {
389
389
  try {
390
390
  const binding = require('feedparser-rs-linux-loong64-gnu')
391
391
  const bindingPackageVersion = require('feedparser-rs-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
394
  }
395
395
  return binding
396
396
  } catch (e) {
@@ -407,8 +407,8 @@ function requireNative() {
407
407
  try {
408
408
  const binding = require('feedparser-rs-linux-riscv64-musl')
409
409
  const bindingPackageVersion = require('feedparser-rs-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -423,8 +423,8 @@ function requireNative() {
423
423
  try {
424
424
  const binding = require('feedparser-rs-linux-riscv64-gnu')
425
425
  const bindingPackageVersion = require('feedparser-rs-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
428
  }
429
429
  return binding
430
430
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('feedparser-rs-linux-ppc64-gnu')
442
442
  const bindingPackageVersion = require('feedparser-rs-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('feedparser-rs-linux-s390x-gnu')
458
458
  const bindingPackageVersion = require('feedparser-rs-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -476,8 +476,8 @@ function requireNative() {
476
476
  try {
477
477
  const binding = require('feedparser-rs-openharmony-arm64')
478
478
  const bindingPackageVersion = require('feedparser-rs-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
481
  }
482
482
  return binding
483
483
  } catch (e) {
@@ -492,8 +492,8 @@ function requireNative() {
492
492
  try {
493
493
  const binding = require('feedparser-rs-openharmony-x64')
494
494
  const bindingPackageVersion = require('feedparser-rs-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
497
  }
498
498
  return binding
499
499
  } catch (e) {
@@ -508,8 +508,8 @@ function requireNative() {
508
508
  try {
509
509
  const binding = require('feedparser-rs-openharmony-arm')
510
510
  const bindingPackageVersion = require('feedparser-rs-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '0.1.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
- throw new Error(`Native binding package version mismatch, expected 0.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '0.2.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 0.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
513
  }
514
514
  return binding
515
515
  } catch (e) {
@@ -574,4 +574,6 @@ if (!nativeBinding) {
574
574
  module.exports = nativeBinding
575
575
  module.exports.detectFormat = nativeBinding.detectFormat
576
576
  module.exports.parse = nativeBinding.parse
577
+ module.exports.parseUrl = nativeBinding.parseUrl
578
+ module.exports.parseUrlWithOptions = nativeBinding.parseUrlWithOptions
577
579
  module.exports.parseWithOptions = nativeBinding.parseWithOptions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feedparser-rs",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "High-performance RSS/Atom/JSON Feed parser for Node.js",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -47,4 +47,4 @@
47
47
  "@napi-rs/cli": "^3.5",
48
48
  "c8": "^10.1.3"
49
49
  }
50
- }
50
+ }