feedsmith 2.0.0-next.6 → 2.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 +12 -13
- package/dist/common/parse.d.ts +3 -3
- package/dist/common/parse.js +6 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/feedsmith)
|
|
6
6
|
[](https://github.com/macieklamberski/feedsmith/blob/main/LICENSE)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Fast, all‑in‑one JavaScript parser and generator for RSS, Atom, RDF, and JSON Feed, with support for popular namespaces and OPML files.
|
|
9
9
|
|
|
10
|
-
Feedsmith
|
|
10
|
+
Feedsmith offers universal and format‑specific parsers that maintain the original feed structure in a clean, object-oriented format while intelligently normalizing legacy elements. Access all feed data without compromising simplicity.
|
|
11
11
|
|
|
12
12
|
**[Read full docs ↗](https://feedsmith.dev)**
|
|
13
13
|
·
|
|
@@ -23,18 +23,18 @@ Feedsmith provides both universal and format-specific parsers that maintain the
|
|
|
23
23
|
|
|
24
24
|
### Core
|
|
25
25
|
|
|
26
|
-
* **Comprehensive
|
|
27
|
-
* **
|
|
28
|
-
* **Smart
|
|
29
|
-
* **Parsing &
|
|
26
|
+
* **Comprehensive support** 🎯 — Supports all major feed formats and namespaces.
|
|
27
|
+
* **Preserves structure** 📦 — Parsed feed object maintains the original feed structure making it easy to access the data.
|
|
28
|
+
* **Smart namespace handling** 🧠 — Normalizes custom namespace prefixes to standard ones (e.g., `<custom:creator>` becomes `dc.creator`).
|
|
29
|
+
* **Parsing & generating** 🔩 — Use one package for both parsing and generating feeds.
|
|
30
30
|
|
|
31
31
|
### Leniency
|
|
32
|
-
* **Normalizes
|
|
32
|
+
* **Normalizes legacy elements** ✨ — Upgrades feed elements to their modern equivalents so that you never need to worry about reading feeds in older formats.
|
|
33
33
|
* **CaSe INSENsiTive** 🐍 — Handles fields and attributes in any case (lowercase, uppercase, mixed).
|
|
34
|
-
* **Forgiving** 🤝 —
|
|
34
|
+
* **Forgiving** 🤝 — Gracefully handles malformed or incomplete feeds and extracts valid data. This makes it suitable for use with real-world feeds that may not strictly follow specifications.
|
|
35
35
|
|
|
36
36
|
### Performance and Type-Safety
|
|
37
|
-
* **Ultrafast parsing** ⚡ — One of the fastest feed parsers
|
|
37
|
+
* **Ultrafast parsing** ⚡ — One of the fastest JavaScript feed parsers ([see benchmarks](/benchmarks)).
|
|
38
38
|
* **Type-safe API** 🛟 — Built with TypeScript from the ground up, it provides complete type definitions for every feed format and namespace.
|
|
39
39
|
* **Tree-shakable** 🍃 — Only include the parts of the library you need, reducing bundle size.
|
|
40
40
|
* **Well-tested** 🔬 — Comprehensive test suite with over 2000 tests and 99% code coverage.
|
|
@@ -59,8 +59,8 @@ Feedsmith aims to fully support all major feed formats and namespaces in complet
|
|
|
59
59
|
|--------|----------|---------|------------|
|
|
60
60
|
| [RSS](http://cyber.law.harvard.edu/rss/rss.html) | 0.9x, 2.0 | ✅ | ✅ |
|
|
61
61
|
| [Atom](https://tools.ietf.org/html/rfc4287) | 0.3, 1.0 | ✅ | ✅ |
|
|
62
|
-
| [JSON Feed](https://jsonfeed.org) | 1.0, 1.1 | ✅ | ✅ |
|
|
63
62
|
| [RDF](https://web.resource.org/rss/1.0/spec) | 0.9, 1.0 | ✅ | ⏳ |
|
|
63
|
+
| [JSON Feed](https://jsonfeed.org) | 1.0, 1.1 | ✅ | ✅ |
|
|
64
64
|
|
|
65
65
|
### Namespaces
|
|
66
66
|
|
|
@@ -98,7 +98,7 @@ For a full overview of all the features, visit the [documentation website](https
|
|
|
98
98
|
npm install feedsmith
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
> **
|
|
101
|
+
> **Migrating from v1.x?** Check out the [migration guide](https://feedsmith.dev/migration-to-2.x).
|
|
102
102
|
|
|
103
103
|
### Parse Any Feed
|
|
104
104
|
|
|
@@ -107,7 +107,7 @@ The simplest way to parse any feed is to use the universal `parseFeed` function:
|
|
|
107
107
|
```typescript
|
|
108
108
|
import { parseFeed } from 'feedsmith'
|
|
109
109
|
|
|
110
|
-
// Works with RSS, Atom,
|
|
110
|
+
// Works with RSS, Atom, RDF, and JSON Feed
|
|
111
111
|
const { format, feed } = parseFeed(feedContent)
|
|
112
112
|
|
|
113
113
|
console.log('Feed format:', format) // rss, atom, json, rdf
|
|
@@ -176,7 +176,6 @@ console.log(rss) // Complete RSS XML
|
|
|
176
176
|
// You can also generate other formats:
|
|
177
177
|
// - generateAtomFeed() for Atom feeds
|
|
178
178
|
// - generateJsonFeed() for JSON feeds
|
|
179
|
-
// - generateRdfFeed() for RDF feeds
|
|
180
179
|
// - generateOpml() for OPML files
|
|
181
180
|
```
|
|
182
181
|
|
package/dist/common/parse.d.ts
CHANGED
|
@@ -4,9 +4,6 @@ import type { Feed as RdfFeed } from '../feeds/rdf/common/types.js';
|
|
|
4
4
|
import type { Feed as RssFeed } from '../feeds/rss/common/types.js';
|
|
5
5
|
import type { DeepPartial } from './types.js';
|
|
6
6
|
export type Feed = {
|
|
7
|
-
format: 'json';
|
|
8
|
-
feed: DeepPartial<JsonFeed<string>>;
|
|
9
|
-
} | {
|
|
10
7
|
format: 'rss';
|
|
11
8
|
feed: DeepPartial<RssFeed<string>>;
|
|
12
9
|
} | {
|
|
@@ -15,5 +12,8 @@ export type Feed = {
|
|
|
15
12
|
} | {
|
|
16
13
|
format: 'rdf';
|
|
17
14
|
feed: DeepPartial<RdfFeed<string>>;
|
|
15
|
+
} | {
|
|
16
|
+
format: 'json';
|
|
17
|
+
feed: DeepPartial<JsonFeed<string>>;
|
|
18
18
|
};
|
|
19
19
|
export declare const parse: (value: unknown) => Feed;
|
package/dist/common/parse.js
CHANGED
|
@@ -8,17 +8,17 @@ import { detect as detectRssFeed } from '../feeds/rss/detect/index.js';
|
|
|
8
8
|
import { parse as parseRssFeed } from '../feeds/rss/parse/index.js';
|
|
9
9
|
import { locales } from './config.js';
|
|
10
10
|
export const parse = (value) => {
|
|
11
|
-
if (detectAtomFeed(value)) {
|
|
12
|
-
return { format: 'atom', feed: parseAtomFeed(value) };
|
|
13
|
-
}
|
|
14
|
-
if (detectJsonFeed(value)) {
|
|
15
|
-
return { format: 'json', feed: parseJsonFeed(value) };
|
|
16
|
-
}
|
|
17
11
|
if (detectRssFeed(value)) {
|
|
18
12
|
return { format: 'rss', feed: parseRssFeed(value) };
|
|
19
13
|
}
|
|
14
|
+
if (detectAtomFeed(value)) {
|
|
15
|
+
return { format: 'atom', feed: parseAtomFeed(value) };
|
|
16
|
+
}
|
|
20
17
|
if (detectRdfFeed(value)) {
|
|
21
18
|
return { format: 'rdf', feed: parseRdfFeed(value) };
|
|
22
19
|
}
|
|
20
|
+
if (detectJsonFeed(value)) {
|
|
21
|
+
return { format: 'json', feed: parseJsonFeed(value) };
|
|
22
|
+
}
|
|
23
23
|
throw new Error(locales.unrecognized);
|
|
24
24
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feedsmith",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "Fast, all‑in‑one parser and generator for RSS, Atom, RDF, and JSON Feed, with support for Podcast, iTunes, Dublin Core, and OPML files.",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/macieklamberski/feedsmith.git"
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"vitepress": "^1.6.4",
|
|
64
64
|
"vitepress-plugin-llms": "^1.7.3"
|
|
65
65
|
},
|
|
66
|
-
"version": "2.0.0
|
|
66
|
+
"version": "2.0.0"
|
|
67
67
|
}
|