@rspress/plugin-rss 1.41.3 → 1.42.1-canary-20240226
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/dist/index.cjs +17 -8
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +17 -8
- package/package.json +5 -6
- package/static/global-components/FeedsAnnotations.tsx +3 -2
package/dist/index.cjs
CHANGED
@@ -53,10 +53,6 @@ const external_node_path_namespaceObject = require("node:path");
|
|
53
53
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
54
54
|
const external_node_url_namespaceObject = require("node:url");
|
55
55
|
const external_feed_namespaceObject = require("feed");
|
56
|
-
const PluginName = '@rspress/plugin-rss';
|
57
|
-
const PluginComponents = {
|
58
|
-
FeedsAnnotations: '@rspress/plugin-rss/FeedsAnnotations'
|
59
|
-
};
|
60
56
|
function notNullish(n) {
|
61
57
|
return null != n;
|
62
58
|
}
|
@@ -126,6 +122,10 @@ function toAuthors(author) {
|
|
126
122
|
}));
|
127
123
|
return authors.length ? authors : void 0;
|
128
124
|
}
|
125
|
+
const PluginName = '@rspress/plugin-rss';
|
126
|
+
const PluginComponents = {
|
127
|
+
FeedsAnnotations: '@rspress/plugin-rss/FeedsAnnotations'
|
128
|
+
};
|
129
129
|
function testPage(test, page, base = '/') {
|
130
130
|
if (Array.isArray(test)) return test.some((item)=>testPage(item, page, base));
|
131
131
|
if ('function' == typeof test) return test(page, base);
|
@@ -193,6 +193,16 @@ function getOutputInfo({ id, output }, { siteUrl, output: globalOutput }) {
|
|
193
193
|
sorting
|
194
194
|
};
|
195
195
|
}
|
196
|
+
function _define_property(obj, key, value) {
|
197
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
198
|
+
value: value,
|
199
|
+
enumerable: true,
|
200
|
+
configurable: true,
|
201
|
+
writable: true
|
202
|
+
});
|
203
|
+
else obj[key] = value;
|
204
|
+
return obj;
|
205
|
+
}
|
196
206
|
class FeedsSet {
|
197
207
|
set({ feed, output, siteUrl }, config) {
|
198
208
|
this.feeds = (Array.isArray(feed) ? feed : [
|
@@ -226,8 +236,8 @@ class FeedsSet {
|
|
226
236
|
return this.feeds.slice(0);
|
227
237
|
}
|
228
238
|
constructor(){
|
229
|
-
this
|
230
|
-
this
|
239
|
+
_define_property(this, "feeds", []);
|
240
|
+
_define_property(this, "feedsMapById", Object.create(null));
|
231
241
|
}
|
232
242
|
}
|
233
243
|
function getRssItems(feeds, page, config, siteUrl) {
|
@@ -256,9 +266,8 @@ function pluginRss(pluginRssOptions) {
|
|
256
266
|
_config = config;
|
257
267
|
feedsSet.set(pluginRssOptions, config);
|
258
268
|
},
|
259
|
-
async extendPageData (
|
269
|
+
async extendPageData (pageData) {
|
260
270
|
if (!_rssWorkaround) return;
|
261
|
-
const pageData = _pageData;
|
262
271
|
_rssWorkaround[pageData.id] = _rssWorkaround[pageData.id] || getRssItems(feedsSet.get(), pageData, _config, pluginRssOptions.siteUrl);
|
263
272
|
const feeds = await _rssWorkaround[pageData.id];
|
264
273
|
const showRssList = new Set(concatArray(pageData.frontmatter['link-rss']));
|
package/dist/index.d.ts
CHANGED
@@ -7,8 +7,8 @@ import type { RspressPlugin } from '@rspress/shared';
|
|
7
7
|
import type { UserConfig } from '@rspress/shared';
|
8
8
|
|
9
9
|
export declare function createFeed(options: Omit<FeedChannel, 'test' | 'item' | 'output'> & {
|
10
|
-
item?:
|
11
|
-
test?:
|
10
|
+
item?: unknown;
|
11
|
+
test?: unknown;
|
12
12
|
output: ResolvedOutput;
|
13
13
|
}, config: UserConfig): FeedOptions;
|
14
14
|
|
package/dist/index.mjs
CHANGED
@@ -2,10 +2,6 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_feed__ from "feed";
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
5
|
-
const PluginName = '@rspress/plugin-rss';
|
6
|
-
const PluginComponents = {
|
7
|
-
FeedsAnnotations: '@rspress/plugin-rss/FeedsAnnotations'
|
8
|
-
};
|
9
5
|
function notNullish(n) {
|
10
6
|
return null != n;
|
11
7
|
}
|
@@ -74,6 +70,10 @@ function toAuthors(author) {
|
|
74
70
|
}));
|
75
71
|
return authors.length ? authors : void 0;
|
76
72
|
}
|
73
|
+
const PluginName = '@rspress/plugin-rss';
|
74
|
+
const PluginComponents = {
|
75
|
+
FeedsAnnotations: '@rspress/plugin-rss/FeedsAnnotations'
|
76
|
+
};
|
77
77
|
function testPage(test, page, base = '/') {
|
78
78
|
if (Array.isArray(test)) return test.some((item)=>testPage(item, page, base));
|
79
79
|
if ('function' == typeof test) return test(page, base);
|
@@ -141,6 +141,16 @@ function getOutputInfo({ id, output }, { siteUrl, output: globalOutput }) {
|
|
141
141
|
sorting
|
142
142
|
};
|
143
143
|
}
|
144
|
+
function _define_property(obj, key, value) {
|
145
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
146
|
+
value: value,
|
147
|
+
enumerable: true,
|
148
|
+
configurable: true,
|
149
|
+
writable: true
|
150
|
+
});
|
151
|
+
else obj[key] = value;
|
152
|
+
return obj;
|
153
|
+
}
|
144
154
|
class FeedsSet {
|
145
155
|
set({ feed, output, siteUrl }, config) {
|
146
156
|
this.feeds = (Array.isArray(feed) ? feed : [
|
@@ -174,8 +184,8 @@ class FeedsSet {
|
|
174
184
|
return this.feeds.slice(0);
|
175
185
|
}
|
176
186
|
constructor(){
|
177
|
-
this
|
178
|
-
this
|
187
|
+
_define_property(this, "feeds", []);
|
188
|
+
_define_property(this, "feedsMapById", Object.create(null));
|
179
189
|
}
|
180
190
|
}
|
181
191
|
function getRssItems(feeds, page, config, siteUrl) {
|
@@ -204,9 +214,8 @@ function pluginRss(pluginRssOptions) {
|
|
204
214
|
_config = config;
|
205
215
|
feedsSet.set(pluginRssOptions, config);
|
206
216
|
},
|
207
|
-
async extendPageData (
|
217
|
+
async extendPageData (pageData) {
|
208
218
|
if (!_rssWorkaround) return;
|
209
|
-
const pageData = _pageData;
|
210
219
|
_rssWorkaround[pageData.id] = _rssWorkaround[pageData.id] || getRssItems(feedsSet.get(), pageData, _config, pluginRssOptions.siteUrl);
|
211
220
|
const feeds = await _rssWorkaround[pageData.id];
|
212
221
|
const showRssList = new Set(concatArray(pageData.frontmatter['link-rss']));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspress/plugin-rss",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.42.1-canary-20240226",
|
4
4
|
"description": "A plugin for rss generation for rspress",
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
6
6
|
"repository": {
|
@@ -26,19 +26,19 @@
|
|
26
26
|
],
|
27
27
|
"dependencies": {
|
28
28
|
"feed": "^4.2.2",
|
29
|
-
"@rspress/shared": "1.
|
29
|
+
"@rspress/shared": "1.42.1-canary-20240226"
|
30
30
|
},
|
31
31
|
"devDependencies": {
|
32
|
-
"@rslib/core": "0.
|
32
|
+
"@rslib/core": "0.5.2",
|
33
33
|
"@types/node": "^18.11.17",
|
34
34
|
"@types/react": "^18.3.18",
|
35
35
|
"react": "^18.3.1",
|
36
36
|
"typescript": "^5.5.3",
|
37
|
-
"@rspress/runtime": "1.
|
37
|
+
"@rspress/runtime": "1.42.1-canary-20240226"
|
38
38
|
},
|
39
39
|
"peerDependencies": {
|
40
40
|
"react": ">=17.0.0",
|
41
|
-
"rspress": "^1.
|
41
|
+
"rspress": "^1.42.0"
|
42
42
|
},
|
43
43
|
"engines": {
|
44
44
|
"node": ">=14.17.6"
|
@@ -48,7 +48,6 @@
|
|
48
48
|
"provenance": true,
|
49
49
|
"registry": "https://registry.npmjs.org/"
|
50
50
|
},
|
51
|
-
"jsnext:source": "./src/index.ts",
|
52
51
|
"scripts": {
|
53
52
|
"build": "rslib build",
|
54
53
|
"dev": "rslib build -w",
|
@@ -1,10 +1,11 @@
|
|
1
|
-
|
1
|
+
/// <reference path="../../index.d.ts" />
|
2
|
+
|
2
3
|
import type { LinkHTMLAttributes } from 'react';
|
3
4
|
import { Helmet, usePageData } from 'rspress/runtime';
|
4
5
|
|
5
6
|
export default function FeedsAnnotations() {
|
6
7
|
const { page } = usePageData();
|
7
|
-
const feeds =
|
8
|
+
const feeds = page.feeds || [];
|
8
9
|
|
9
10
|
return (
|
10
11
|
<Helmet>
|