feedsmith 2.9.0 → 2.9.2
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 +1 -1
- package/dist/common/config.cjs +101 -273
- package/dist/common/config.js +100 -272
- package/dist/common/parse.cjs +11 -13
- package/dist/common/parse.js +1 -3
- package/dist/common/utils.cjs +99 -24
- package/dist/common/utils.js +98 -24
- package/dist/feeds/atom/detect/index.cjs +7 -7
- package/dist/feeds/atom/detect/index.js +5 -5
- package/dist/feeds/atom/generate/config.cjs +3 -6
- package/dist/feeds/atom/generate/config.js +1 -3
- package/dist/feeds/atom/generate/index.cjs +5 -7
- package/dist/feeds/atom/generate/index.js +1 -3
- package/dist/feeds/atom/generate/utils.cjs +24 -26
- package/dist/feeds/atom/generate/utils.js +1 -3
- package/dist/feeds/atom/parse/config.cjs +13 -6
- package/dist/feeds/atom/parse/config.js +12 -6
- package/dist/feeds/atom/parse/index.cjs +6 -9
- package/dist/feeds/atom/parse/index.js +4 -7
- package/dist/feeds/atom/parse/utils.cjs +68 -70
- package/dist/feeds/atom/parse/utils.js +46 -48
- package/dist/feeds/json/detect/index.cjs +3 -5
- package/dist/feeds/json/detect/index.js +1 -3
- package/dist/feeds/json/generate/index.cjs +2 -4
- package/dist/feeds/json/generate/index.js +1 -3
- package/dist/feeds/json/generate/utils.cjs +2 -4
- package/dist/feeds/json/generate/utils.js +1 -3
- package/dist/feeds/json/parse/index.cjs +5 -7
- package/dist/feeds/json/parse/index.js +1 -3
- package/dist/feeds/json/parse/utils.cjs +2 -4
- package/dist/feeds/json/parse/utils.js +1 -3
- package/dist/feeds/rdf/detect/index.cjs +7 -7
- package/dist/feeds/rdf/detect/index.js +5 -5
- package/dist/feeds/rdf/parse/config.cjs +13 -5
- package/dist/feeds/rdf/parse/config.js +12 -5
- package/dist/feeds/rdf/parse/index.cjs +6 -9
- package/dist/feeds/rdf/parse/index.js +4 -7
- package/dist/feeds/rdf/parse/utils.cjs +27 -29
- package/dist/feeds/rdf/parse/utils.js +15 -17
- package/dist/feeds/rss/detect/index.cjs +8 -7
- package/dist/feeds/rss/detect/index.js +7 -6
- package/dist/feeds/rss/generate/config.cjs +3 -6
- package/dist/feeds/rss/generate/config.js +1 -3
- package/dist/feeds/rss/generate/index.cjs +5 -7
- package/dist/feeds/rss/generate/index.js +1 -3
- package/dist/feeds/rss/generate/utils.cjs +31 -33
- package/dist/feeds/rss/generate/utils.js +1 -3
- package/dist/feeds/rss/parse/config.cjs +37 -26
- package/dist/feeds/rss/parse/config.js +36 -26
- package/dist/feeds/rss/parse/index.cjs +6 -9
- package/dist/feeds/rss/parse/index.js +4 -7
- package/dist/feeds/rss/parse/utils.cjs +103 -95
- package/dist/feeds/rss/parse/utils.js +75 -67
- package/dist/index.cjs +16 -16
- package/dist/index.js +1 -2
- package/dist/namespaces/acast/common/config.cjs +18 -0
- package/dist/namespaces/acast/common/config.js +17 -0
- package/dist/namespaces/acast/generate/utils.cjs +2 -4
- package/dist/namespaces/acast/generate/utils.js +1 -3
- package/dist/namespaces/acast/parse/utils.cjs +10 -12
- package/dist/namespaces/acast/parse/utils.js +9 -11
- package/dist/namespaces/admin/common/config.cjs +11 -0
- package/dist/namespaces/admin/common/config.js +10 -0
- package/dist/namespaces/admin/generate/utils.cjs +2 -4
- package/dist/namespaces/admin/generate/utils.js +1 -3
- package/dist/namespaces/admin/parse/utils.cjs +4 -6
- package/dist/namespaces/admin/parse/utils.js +3 -5
- package/dist/namespaces/app/common/config.cjs +11 -0
- package/dist/namespaces/app/common/config.js +10 -0
- package/dist/namespaces/app/generate/utils.cjs +2 -4
- package/dist/namespaces/app/generate/utils.js +1 -3
- package/dist/namespaces/app/parse/utils.cjs +4 -6
- package/dist/namespaces/app/parse/utils.js +3 -5
- package/dist/namespaces/arxiv/common/config.cjs +16 -0
- package/dist/namespaces/arxiv/common/config.js +15 -0
- package/dist/namespaces/arxiv/generate/utils.cjs +2 -4
- package/dist/namespaces/arxiv/generate/utils.js +1 -3
- package/dist/namespaces/arxiv/parse/utils.cjs +6 -8
- package/dist/namespaces/arxiv/parse/utils.js +5 -7
- package/dist/namespaces/atom/common/config.cjs +11 -0
- package/dist/namespaces/atom/common/config.js +11 -0
- package/dist/namespaces/atom/generate/utils.cjs +2 -4
- package/dist/namespaces/atom/generate/utils.js +1 -3
- package/dist/namespaces/atom/parse/utils.cjs +2 -4
- package/dist/namespaces/atom/parse/utils.js +1 -3
- package/dist/namespaces/blogchannel/common/config.cjs +15 -0
- package/dist/namespaces/blogchannel/common/config.js +14 -0
- package/dist/namespaces/blogchannel/generate/utils.cjs +2 -4
- package/dist/namespaces/blogchannel/generate/utils.js +1 -3
- package/dist/namespaces/blogchannel/parse/utils.cjs +5 -7
- package/dist/namespaces/blogchannel/parse/utils.js +4 -6
- package/dist/namespaces/cc/common/config.cjs +25 -0
- package/dist/namespaces/cc/common/config.js +24 -0
- package/dist/namespaces/cc/generate/utils.cjs +2 -4
- package/dist/namespaces/cc/generate/utils.js +1 -3
- package/dist/namespaces/cc/parse/utils.cjs +13 -15
- package/dist/namespaces/cc/parse/utils.js +12 -14
- package/dist/namespaces/content/common/config.cjs +11 -0
- package/dist/namespaces/content/common/config.js +10 -0
- package/dist/namespaces/content/generate/utils.cjs +2 -4
- package/dist/namespaces/content/generate/utils.js +1 -3
- package/dist/namespaces/content/parse/utils.cjs +3 -5
- package/dist/namespaces/content/parse/utils.js +2 -4
- package/dist/namespaces/creativecommons/common/config.cjs +15 -0
- package/dist/namespaces/creativecommons/common/config.js +14 -0
- package/dist/namespaces/creativecommons/generate/utils.cjs +2 -4
- package/dist/namespaces/creativecommons/generate/utils.js +1 -3
- package/dist/namespaces/creativecommons/parse/utils.cjs +3 -5
- package/dist/namespaces/creativecommons/parse/utils.js +2 -4
- package/dist/namespaces/dc/common/config.cjs +35 -0
- package/dist/namespaces/dc/common/config.js +34 -0
- package/dist/namespaces/dc/generate/utils.cjs +2 -4
- package/dist/namespaces/dc/generate/utils.js +1 -3
- package/dist/namespaces/dc/parse/utils.cjs +30 -32
- package/dist/namespaces/dc/parse/utils.js +29 -31
- package/dist/namespaces/dcterms/common/config.cjs +75 -0
- package/dist/namespaces/dcterms/common/config.js +74 -0
- package/dist/namespaces/dcterms/generate/utils.cjs +2 -4
- package/dist/namespaces/dcterms/generate/utils.js +1 -3
- package/dist/namespaces/dcterms/parse/utils.cjs +91 -93
- package/dist/namespaces/dcterms/parse/utils.js +90 -92
- package/dist/namespaces/feedpress/common/config.cjs +25 -0
- package/dist/namespaces/feedpress/common/config.js +24 -0
- package/dist/namespaces/feedpress/generate/utils.cjs +2 -4
- package/dist/namespaces/feedpress/generate/utils.js +1 -3
- package/dist/namespaces/feedpress/parse/utils.cjs +7 -9
- package/dist/namespaces/feedpress/parse/utils.js +6 -8
- package/dist/namespaces/geo/common/config.cjs +10 -0
- package/dist/namespaces/geo/common/config.js +9 -0
- package/dist/namespaces/geo/generate/utils.cjs +2 -4
- package/dist/namespaces/geo/generate/utils.js +1 -3
- package/dist/namespaces/geo/parse/utils.cjs +5 -7
- package/dist/namespaces/geo/parse/utils.js +4 -6
- package/dist/namespaces/georss/common/config.cjs +22 -0
- package/dist/namespaces/georss/common/config.js +21 -0
- package/dist/namespaces/georss/generate/utils.cjs +2 -4
- package/dist/namespaces/georss/generate/utils.js +1 -3
- package/dist/namespaces/georss/parse/utils.cjs +10 -11
- package/dist/namespaces/georss/parse/utils.js +9 -10
- package/dist/namespaces/googleplay/common/config.cjs +22 -0
- package/dist/namespaces/googleplay/common/config.js +21 -0
- package/dist/namespaces/googleplay/generate/utils.cjs +2 -4
- package/dist/namespaces/googleplay/generate/utils.js +1 -3
- package/dist/namespaces/googleplay/parse/utils.cjs +10 -12
- package/dist/namespaces/googleplay/parse/utils.js +9 -11
- package/dist/namespaces/itunes/common/config.cjs +24 -0
- package/dist/namespaces/itunes/common/config.js +23 -0
- package/dist/namespaces/itunes/generate/utils.cjs +2 -4
- package/dist/namespaces/itunes/generate/utils.js +1 -3
- package/dist/namespaces/itunes/parse/utils.cjs +29 -30
- package/dist/namespaces/itunes/parse/utils.js +28 -29
- package/dist/namespaces/media/common/config.cjs +49 -0
- package/dist/namespaces/media/common/config.js +48 -0
- package/dist/namespaces/media/generate/utils.cjs +2 -4
- package/dist/namespaces/media/generate/utils.js +1 -3
- package/dist/namespaces/media/parse/utils.cjs +21 -23
- package/dist/namespaces/media/parse/utils.js +20 -22
- package/dist/namespaces/opensearch/common/config.cjs +17 -0
- package/dist/namespaces/opensearch/common/config.js +16 -0
- package/dist/namespaces/opensearch/generate/utils.cjs +2 -4
- package/dist/namespaces/opensearch/generate/utils.js +1 -3
- package/dist/namespaces/opensearch/parse/utils.cjs +5 -7
- package/dist/namespaces/opensearch/parse/utils.js +4 -6
- package/dist/namespaces/pingback/common/config.cjs +15 -0
- package/dist/namespaces/pingback/common/config.js +14 -0
- package/dist/namespaces/pingback/generate/utils.cjs +2 -4
- package/dist/namespaces/pingback/generate/utils.js +1 -3
- package/dist/namespaces/pingback/parse/utils.cjs +5 -7
- package/dist/namespaces/pingback/parse/utils.js +4 -6
- package/dist/namespaces/podcast/common/config.cjs +28 -0
- package/dist/namespaces/podcast/common/config.js +27 -0
- package/dist/namespaces/podcast/generate/utils.cjs +2 -4
- package/dist/namespaces/podcast/generate/utils.js +1 -3
- package/dist/namespaces/podcast/parse/utils.cjs +8 -8
- package/dist/namespaces/podcast/parse/utils.js +7 -7
- package/dist/namespaces/prism/common/config.cjs +138 -0
- package/dist/namespaces/prism/common/config.js +137 -0
- package/dist/namespaces/prism/generate/utils.cjs +2 -4
- package/dist/namespaces/prism/generate/utils.js +1 -3
- package/dist/namespaces/prism/parse/utils.cjs +139 -141
- package/dist/namespaces/prism/parse/utils.js +138 -140
- package/dist/namespaces/psc/common/config.cjs +9 -0
- package/dist/namespaces/psc/common/config.js +9 -0
- package/dist/namespaces/psc/generate/utils.cjs +2 -4
- package/dist/namespaces/psc/generate/utils.js +1 -3
- package/dist/namespaces/psc/parse/utils.cjs +2 -4
- package/dist/namespaces/psc/parse/utils.js +1 -3
- package/dist/namespaces/rawvoice/common/config.cjs +29 -0
- package/dist/namespaces/rawvoice/common/config.js +28 -0
- package/dist/namespaces/rawvoice/generate/utils.cjs +2 -4
- package/dist/namespaces/rawvoice/generate/utils.js +1 -3
- package/dist/namespaces/rawvoice/parse/utils.cjs +9 -11
- package/dist/namespaces/rawvoice/parse/utils.js +8 -10
- package/dist/namespaces/rdf/common/config.cjs +6 -0
- package/dist/namespaces/rdf/common/config.js +5 -0
- package/dist/namespaces/rdf/parse/utils.cjs +2 -4
- package/dist/namespaces/rdf/parse/utils.js +1 -3
- package/dist/namespaces/rss/common/config.cjs +9 -0
- package/dist/namespaces/rss/common/config.js +9 -0
- package/dist/namespaces/slash/common/config.cjs +16 -0
- package/dist/namespaces/slash/common/config.js +15 -0
- package/dist/namespaces/slash/generate/utils.cjs +2 -4
- package/dist/namespaces/slash/generate/utils.js +1 -3
- package/dist/namespaces/slash/parse/utils.cjs +6 -8
- package/dist/namespaces/slash/parse/utils.js +5 -7
- package/dist/namespaces/source/common/config.cjs +25 -0
- package/dist/namespaces/source/common/config.js +24 -0
- package/dist/namespaces/source/generate/utils.cjs +2 -4
- package/dist/namespaces/source/generate/utils.js +1 -3
- package/dist/namespaces/source/parse/utils.cjs +13 -15
- package/dist/namespaces/source/parse/utils.js +12 -14
- package/dist/namespaces/spotify/common/config.cjs +11 -0
- package/dist/namespaces/spotify/common/config.js +10 -0
- package/dist/namespaces/spotify/generate/utils.cjs +2 -4
- package/dist/namespaces/spotify/generate/utils.js +1 -3
- package/dist/namespaces/spotify/parse/utils.cjs +3 -5
- package/dist/namespaces/spotify/parse/utils.js +2 -4
- package/dist/namespaces/sy/common/config.cjs +15 -0
- package/dist/namespaces/sy/common/config.js +14 -0
- package/dist/namespaces/sy/generate/utils.cjs +2 -4
- package/dist/namespaces/sy/generate/utils.js +1 -3
- package/dist/namespaces/sy/parse/utils.cjs +5 -7
- package/dist/namespaces/sy/parse/utils.js +4 -6
- package/dist/namespaces/thr/common/config.cjs +15 -0
- package/dist/namespaces/thr/common/config.js +14 -0
- package/dist/namespaces/thr/generate/utils.cjs +2 -4
- package/dist/namespaces/thr/generate/utils.js +1 -3
- package/dist/namespaces/thr/parse/utils.cjs +3 -5
- package/dist/namespaces/thr/parse/utils.js +2 -4
- package/dist/namespaces/trackback/common/config.cjs +11 -0
- package/dist/namespaces/trackback/common/config.js +10 -0
- package/dist/namespaces/trackback/generate/utils.cjs +2 -4
- package/dist/namespaces/trackback/generate/utils.js +1 -3
- package/dist/namespaces/trackback/parse/utils.cjs +4 -6
- package/dist/namespaces/trackback/parse/utils.js +3 -5
- package/dist/namespaces/wfw/common/config.cjs +11 -0
- package/dist/namespaces/wfw/common/config.js +10 -0
- package/dist/namespaces/wfw/generate/utils.cjs +2 -4
- package/dist/namespaces/wfw/generate/utils.js +1 -3
- package/dist/namespaces/wfw/parse/utils.cjs +4 -6
- package/dist/namespaces/wfw/parse/utils.js +3 -5
- package/dist/namespaces/yt/common/config.cjs +15 -0
- package/dist/namespaces/yt/common/config.js +14 -0
- package/dist/namespaces/yt/generate/utils.cjs +2 -4
- package/dist/namespaces/yt/generate/utils.js +1 -3
- package/dist/namespaces/yt/parse/utils.cjs +6 -8
- package/dist/namespaces/yt/parse/utils.js +5 -7
- package/dist/node_modules/path-expression-matcher/src/Expression.cjs +153 -0
- package/dist/node_modules/path-expression-matcher/src/Expression.js +153 -0
- package/dist/opml/generate/config.cjs +3 -6
- package/dist/opml/generate/config.js +1 -3
- package/dist/opml/generate/index.cjs +5 -7
- package/dist/opml/generate/index.js +1 -3
- package/dist/opml/generate/utils.cjs +2 -4
- package/dist/opml/generate/utils.js +1 -3
- package/dist/opml/parse/config.cjs +15 -17
- package/dist/opml/parse/config.js +14 -16
- package/dist/opml/parse/index.cjs +4 -6
- package/dist/opml/parse/index.js +1 -3
- package/dist/opml/parse/utils.cjs +17 -19
- package/dist/opml/parse/utils.js +16 -18
- package/dist/types.js +1 -1
- package/package.json +7 -7
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const require_utils = require(
|
|
2
|
-
|
|
1
|
+
const require_utils = require("../../../common/utils.cjs");
|
|
3
2
|
//#region src/namespaces/thr/parse/utils.ts
|
|
4
3
|
const parseInReplyTo = (value) => {
|
|
5
4
|
if (!require_utils.isObject(value)) return;
|
|
@@ -20,11 +19,10 @@ const retrieveLink = (value) => {
|
|
|
20
19
|
const retrieveItem = (value) => {
|
|
21
20
|
if (!require_utils.isObject(value)) return;
|
|
22
21
|
return require_utils.trimObject({
|
|
23
|
-
total: require_utils.parseSingularOf(value["thr:total"], (value
|
|
22
|
+
total: require_utils.parseSingularOf(value["thr:total"], (value) => require_utils.parseNumber(require_utils.retrieveText(value))),
|
|
24
23
|
inReplyTos: require_utils.parseArrayOf(value["thr:in-reply-to"], parseInReplyTo)
|
|
25
24
|
});
|
|
26
25
|
};
|
|
27
|
-
|
|
28
26
|
//#endregion
|
|
29
27
|
exports.retrieveItem = retrieveItem;
|
|
30
|
-
exports.retrieveLink = retrieveLink;
|
|
28
|
+
exports.retrieveLink = retrieveLink;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isObject, parseArrayOf, parseDate, parseNumber, parseSingularOf, parseString, retrieveText, trimObject } from "../../../common/utils.js";
|
|
2
|
-
|
|
3
2
|
//#region src/namespaces/thr/parse/utils.ts
|
|
4
3
|
const parseInReplyTo = (value) => {
|
|
5
4
|
if (!isObject(value)) return;
|
|
@@ -20,10 +19,9 @@ const retrieveLink = (value) => {
|
|
|
20
19
|
const retrieveItem = (value) => {
|
|
21
20
|
if (!isObject(value)) return;
|
|
22
21
|
return trimObject({
|
|
23
|
-
total: parseSingularOf(value["thr:total"], (value
|
|
22
|
+
total: parseSingularOf(value["thr:total"], (value) => parseNumber(retrieveText(value))),
|
|
24
23
|
inReplyTos: parseArrayOf(value["thr:in-reply-to"], parseInReplyTo)
|
|
25
24
|
});
|
|
26
25
|
};
|
|
27
|
-
|
|
28
26
|
//#endregion
|
|
29
|
-
export { retrieveItem, retrieveLink };
|
|
27
|
+
export { retrieveItem, retrieveLink };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/namespaces/trackback/common/config.ts
|
|
2
|
+
const uris = [
|
|
3
|
+
"http://madskills.com/public/xml/rss/module/trackback/",
|
|
4
|
+
"https://madskills.com/public/xml/rss/module/trackback/",
|
|
5
|
+
"http://madskills.com/public/xml/rss/module/trackback",
|
|
6
|
+
"https://madskills.com/public/xml/rss/module/trackback"
|
|
7
|
+
];
|
|
8
|
+
const stopNodes = ["*.trackback:ping", "*.trackback:about"];
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.stopNodes = stopNodes;
|
|
11
|
+
exports.uris = uris;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/namespaces/trackback/common/config.ts
|
|
2
|
+
const uris = [
|
|
3
|
+
"http://madskills.com/public/xml/rss/module/trackback/",
|
|
4
|
+
"https://madskills.com/public/xml/rss/module/trackback/",
|
|
5
|
+
"http://madskills.com/public/xml/rss/module/trackback",
|
|
6
|
+
"https://madskills.com/public/xml/rss/module/trackback"
|
|
7
|
+
];
|
|
8
|
+
const stopNodes = ["*.trackback:ping", "*.trackback:about"];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { stopNodes, uris };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const require_utils = require(
|
|
2
|
-
|
|
1
|
+
const require_utils = require("../../../common/utils.cjs");
|
|
3
2
|
//#region src/namespaces/trackback/generate/utils.ts
|
|
4
3
|
const generateItem = (item) => {
|
|
5
4
|
if (!require_utils.isObject(item)) return;
|
|
@@ -8,6 +7,5 @@ const generateItem = (item) => {
|
|
|
8
7
|
"trackback:about": require_utils.trimArray(item.abouts, require_utils.generateCdataString)
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
|
-
exports.generateItem = generateItem;
|
|
11
|
+
exports.generateItem = generateItem;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { generateCdataString, isObject, trimArray, trimObject } from "../../../common/utils.js";
|
|
2
|
-
|
|
3
2
|
//#region src/namespaces/trackback/generate/utils.ts
|
|
4
3
|
const generateItem = (item) => {
|
|
5
4
|
if (!isObject(item)) return;
|
|
@@ -8,6 +7,5 @@ const generateItem = (item) => {
|
|
|
8
7
|
"trackback:about": trimArray(item.abouts, generateCdataString)
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
|
-
export { generateItem };
|
|
11
|
+
export { generateItem };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
const require_utils = require(
|
|
2
|
-
|
|
1
|
+
const require_utils = require("../../../common/utils.cjs");
|
|
3
2
|
//#region src/namespaces/trackback/parse/utils.ts
|
|
4
3
|
const retrieveItem = (value) => {
|
|
5
4
|
if (!require_utils.isObject(value)) return;
|
|
6
5
|
return require_utils.trimObject({
|
|
7
|
-
ping: require_utils.parseSingularOf(value["trackback:ping"], (value
|
|
8
|
-
abouts: require_utils.parseArrayOf(value["trackback:about"], (value
|
|
6
|
+
ping: require_utils.parseSingularOf(value["trackback:ping"], (value) => require_utils.retrieveRdfResourceOrText(value, require_utils.parseString)),
|
|
7
|
+
abouts: require_utils.parseArrayOf(value["trackback:about"], (value) => require_utils.retrieveRdfResourceOrText(value, require_utils.parseString))
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
|
-
exports.retrieveItem = retrieveItem;
|
|
11
|
+
exports.retrieveItem = retrieveItem;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { isObject, parseArrayOf, parseSingularOf, parseString, retrieveRdfResourceOrText, trimObject } from "../../../common/utils.js";
|
|
2
|
-
|
|
3
2
|
//#region src/namespaces/trackback/parse/utils.ts
|
|
4
3
|
const retrieveItem = (value) => {
|
|
5
4
|
if (!isObject(value)) return;
|
|
6
5
|
return trimObject({
|
|
7
|
-
ping: parseSingularOf(value["trackback:ping"], (value
|
|
8
|
-
abouts: parseArrayOf(value["trackback:about"], (value
|
|
6
|
+
ping: parseSingularOf(value["trackback:ping"], (value) => retrieveRdfResourceOrText(value, parseString)),
|
|
7
|
+
abouts: parseArrayOf(value["trackback:about"], (value) => retrieveRdfResourceOrText(value, parseString))
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
|
-
export { retrieveItem };
|
|
11
|
+
export { retrieveItem };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/namespaces/wfw/common/config.ts
|
|
2
|
+
const uris = [
|
|
3
|
+
"http://wellformedweb.org/CommentAPI/",
|
|
4
|
+
"https://wellformedweb.org/CommentAPI/",
|
|
5
|
+
"http://wellformedweb.org/CommentAPI",
|
|
6
|
+
"https://wellformedweb.org/CommentAPI"
|
|
7
|
+
];
|
|
8
|
+
const stopNodes = ["*.wfw:comment", "*.wfw:commentrss"];
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.stopNodes = stopNodes;
|
|
11
|
+
exports.uris = uris;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/namespaces/wfw/common/config.ts
|
|
2
|
+
const uris = [
|
|
3
|
+
"http://wellformedweb.org/CommentAPI/",
|
|
4
|
+
"https://wellformedweb.org/CommentAPI/",
|
|
5
|
+
"http://wellformedweb.org/CommentAPI",
|
|
6
|
+
"https://wellformedweb.org/CommentAPI"
|
|
7
|
+
];
|
|
8
|
+
const stopNodes = ["*.wfw:comment", "*.wfw:commentrss"];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { stopNodes, uris };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const require_utils = require(
|
|
2
|
-
|
|
1
|
+
const require_utils = require("../../../common/utils.cjs");
|
|
3
2
|
//#region src/namespaces/wfw/generate/utils.ts
|
|
4
3
|
const generateItem = (item) => {
|
|
5
4
|
if (!require_utils.isObject(item)) return;
|
|
@@ -8,6 +7,5 @@ const generateItem = (item) => {
|
|
|
8
7
|
"wfw:commentRss": require_utils.generateCdataString(item.commentRss)
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
|
-
exports.generateItem = generateItem;
|
|
11
|
+
exports.generateItem = generateItem;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { generateCdataString, isObject, trimObject } from "../../../common/utils.js";
|
|
2
|
-
|
|
3
2
|
//#region src/namespaces/wfw/generate/utils.ts
|
|
4
3
|
const generateItem = (item) => {
|
|
5
4
|
if (!isObject(item)) return;
|
|
@@ -8,6 +7,5 @@ const generateItem = (item) => {
|
|
|
8
7
|
"wfw:commentRss": generateCdataString(item.commentRss)
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
|
-
export { generateItem };
|
|
11
|
+
export { generateItem };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
const require_utils = require(
|
|
2
|
-
|
|
1
|
+
const require_utils = require("../../../common/utils.cjs");
|
|
3
2
|
//#region src/namespaces/wfw/parse/utils.ts
|
|
4
3
|
const retrieveItem = (value) => {
|
|
5
4
|
if (!require_utils.isObject(value)) return;
|
|
6
5
|
return require_utils.trimObject({
|
|
7
|
-
comment: require_utils.parseSingularOf(value["wfw:comment"], (value
|
|
8
|
-
commentRss: require_utils.parseSingularOf(value["wfw:commentrss"], (value
|
|
6
|
+
comment: require_utils.parseSingularOf(value["wfw:comment"], (value) => require_utils.parseString(require_utils.retrieveText(value))),
|
|
7
|
+
commentRss: require_utils.parseSingularOf(value["wfw:commentrss"], (value) => require_utils.parseString(require_utils.retrieveText(value)))
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
|
-
exports.retrieveItem = retrieveItem;
|
|
11
|
+
exports.retrieveItem = retrieveItem;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { isObject, parseSingularOf, parseString, retrieveText, trimObject } from "../../../common/utils.js";
|
|
2
|
-
|
|
3
2
|
//#region src/namespaces/wfw/parse/utils.ts
|
|
4
3
|
const retrieveItem = (value) => {
|
|
5
4
|
if (!isObject(value)) return;
|
|
6
5
|
return trimObject({
|
|
7
|
-
comment: parseSingularOf(value["wfw:comment"], (value
|
|
8
|
-
commentRss: parseSingularOf(value["wfw:commentrss"], (value
|
|
6
|
+
comment: parseSingularOf(value["wfw:comment"], (value) => parseString(retrieveText(value))),
|
|
7
|
+
commentRss: parseSingularOf(value["wfw:commentrss"], (value) => parseString(retrieveText(value)))
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
|
-
export { retrieveItem };
|
|
11
|
+
export { retrieveItem };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/namespaces/yt/common/config.ts
|
|
2
|
+
const uris = [
|
|
3
|
+
"http://www.youtube.com/xml/schemas/2015",
|
|
4
|
+
"https://www.youtube.com/xml/schemas/2015",
|
|
5
|
+
"http://www.youtube.com/xml/schemas/2015/",
|
|
6
|
+
"https://www.youtube.com/xml/schemas/2015/"
|
|
7
|
+
];
|
|
8
|
+
const stopNodes = [
|
|
9
|
+
"*.yt:videoid",
|
|
10
|
+
"*.yt:channelid",
|
|
11
|
+
"*.yt:playlistid"
|
|
12
|
+
];
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.stopNodes = stopNodes;
|
|
15
|
+
exports.uris = uris;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/namespaces/yt/common/config.ts
|
|
2
|
+
const uris = [
|
|
3
|
+
"http://www.youtube.com/xml/schemas/2015",
|
|
4
|
+
"https://www.youtube.com/xml/schemas/2015",
|
|
5
|
+
"http://www.youtube.com/xml/schemas/2015/",
|
|
6
|
+
"https://www.youtube.com/xml/schemas/2015/"
|
|
7
|
+
];
|
|
8
|
+
const stopNodes = [
|
|
9
|
+
"*.yt:videoid",
|
|
10
|
+
"*.yt:channelid",
|
|
11
|
+
"*.yt:playlistid"
|
|
12
|
+
];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { stopNodes, uris };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const require_utils = require(
|
|
2
|
-
|
|
1
|
+
const require_utils = require("../../../common/utils.cjs");
|
|
3
2
|
//#region src/namespaces/yt/generate/utils.ts
|
|
4
3
|
const generateItem = (item) => {
|
|
5
4
|
if (!require_utils.isObject(item)) return;
|
|
@@ -15,7 +14,6 @@ const generateFeed = (feed) => {
|
|
|
15
14
|
"yt:playlistId": require_utils.generateCdataString(feed.playlistId)
|
|
16
15
|
});
|
|
17
16
|
};
|
|
18
|
-
|
|
19
17
|
//#endregion
|
|
20
18
|
exports.generateFeed = generateFeed;
|
|
21
|
-
exports.generateItem = generateItem;
|
|
19
|
+
exports.generateItem = generateItem;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { generateCdataString, isObject, trimObject } from "../../../common/utils.js";
|
|
2
|
-
|
|
3
2
|
//#region src/namespaces/yt/generate/utils.ts
|
|
4
3
|
const generateItem = (item) => {
|
|
5
4
|
if (!isObject(item)) return;
|
|
@@ -15,6 +14,5 @@ const generateFeed = (feed) => {
|
|
|
15
14
|
"yt:playlistId": generateCdataString(feed.playlistId)
|
|
16
15
|
});
|
|
17
16
|
};
|
|
18
|
-
|
|
19
17
|
//#endregion
|
|
20
|
-
export { generateFeed, generateItem };
|
|
18
|
+
export { generateFeed, generateItem };
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
const require_utils = require(
|
|
2
|
-
|
|
1
|
+
const require_utils = require("../../../common/utils.cjs");
|
|
3
2
|
//#region src/namespaces/yt/parse/utils.ts
|
|
4
3
|
const retrieveItem = (value) => {
|
|
5
4
|
if (!require_utils.isObject(value)) return;
|
|
6
5
|
return require_utils.trimObject({
|
|
7
|
-
videoId: require_utils.parseSingularOf(value["yt:videoid"], (value
|
|
8
|
-
channelId: require_utils.parseSingularOf(value["yt:channelid"], (value
|
|
6
|
+
videoId: require_utils.parseSingularOf(value["yt:videoid"], (value) => require_utils.parseString(require_utils.retrieveText(value))),
|
|
7
|
+
channelId: require_utils.parseSingularOf(value["yt:channelid"], (value) => require_utils.parseString(require_utils.retrieveText(value)))
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
10
|
const retrieveFeed = (value) => {
|
|
12
11
|
if (!require_utils.isObject(value)) return;
|
|
13
12
|
return require_utils.trimObject({
|
|
14
|
-
channelId: require_utils.parseSingularOf(value["yt:channelid"], (value
|
|
15
|
-
playlistId: require_utils.parseSingularOf(value["yt:playlistid"], (value
|
|
13
|
+
channelId: require_utils.parseSingularOf(value["yt:channelid"], (value) => require_utils.parseString(require_utils.retrieveText(value))),
|
|
14
|
+
playlistId: require_utils.parseSingularOf(value["yt:playlistid"], (value) => require_utils.parseString(require_utils.retrieveText(value)))
|
|
16
15
|
});
|
|
17
16
|
};
|
|
18
|
-
|
|
19
17
|
//#endregion
|
|
20
18
|
exports.retrieveFeed = retrieveFeed;
|
|
21
|
-
exports.retrieveItem = retrieveItem;
|
|
19
|
+
exports.retrieveItem = retrieveItem;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { isObject, parseSingularOf, parseString, retrieveText, trimObject } from "../../../common/utils.js";
|
|
2
|
-
|
|
3
2
|
//#region src/namespaces/yt/parse/utils.ts
|
|
4
3
|
const retrieveItem = (value) => {
|
|
5
4
|
if (!isObject(value)) return;
|
|
6
5
|
return trimObject({
|
|
7
|
-
videoId: parseSingularOf(value["yt:videoid"], (value
|
|
8
|
-
channelId: parseSingularOf(value["yt:channelid"], (value
|
|
6
|
+
videoId: parseSingularOf(value["yt:videoid"], (value) => parseString(retrieveText(value))),
|
|
7
|
+
channelId: parseSingularOf(value["yt:channelid"], (value) => parseString(retrieveText(value)))
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
10
|
const retrieveFeed = (value) => {
|
|
12
11
|
if (!isObject(value)) return;
|
|
13
12
|
return trimObject({
|
|
14
|
-
channelId: parseSingularOf(value["yt:channelid"], (value
|
|
15
|
-
playlistId: parseSingularOf(value["yt:playlistid"], (value
|
|
13
|
+
channelId: parseSingularOf(value["yt:channelid"], (value) => parseString(retrieveText(value))),
|
|
14
|
+
playlistId: parseSingularOf(value["yt:playlistid"], (value) => parseString(retrieveText(value)))
|
|
16
15
|
});
|
|
17
16
|
};
|
|
18
|
-
|
|
19
17
|
//#endregion
|
|
20
|
-
export { retrieveFeed, retrieveItem };
|
|
18
|
+
export { retrieveFeed, retrieveItem };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
//#region node_modules/path-expression-matcher/src/Expression.js
|
|
2
|
+
/**
|
|
3
|
+
* Expression - Parses and stores a tag pattern expression
|
|
4
|
+
*
|
|
5
|
+
* Patterns are parsed once and stored in an optimized structure for fast matching.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const expr = new Expression("root.users.user");
|
|
9
|
+
* const expr2 = new Expression("..user[id]:first");
|
|
10
|
+
* const expr3 = new Expression("root/users/user", { separator: '/' });
|
|
11
|
+
*/
|
|
12
|
+
var Expression = class {
|
|
13
|
+
/**
|
|
14
|
+
* Create a new Expression
|
|
15
|
+
* @param {string} pattern - Pattern string (e.g., "root.users.user", "..user[id]")
|
|
16
|
+
* @param {Object} options - Configuration options
|
|
17
|
+
* @param {string} options.separator - Path separator (default: '.')
|
|
18
|
+
*/
|
|
19
|
+
constructor(pattern, options = {}, data) {
|
|
20
|
+
this.pattern = pattern;
|
|
21
|
+
this.separator = options.separator || ".";
|
|
22
|
+
this.segments = this._parse(pattern);
|
|
23
|
+
this.data = data;
|
|
24
|
+
this._hasDeepWildcard = this.segments.some((seg) => seg.type === "deep-wildcard");
|
|
25
|
+
this._hasAttributeCondition = this.segments.some((seg) => seg.attrName !== void 0);
|
|
26
|
+
this._hasPositionSelector = this.segments.some((seg) => seg.position !== void 0);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parse pattern string into segments
|
|
30
|
+
* @private
|
|
31
|
+
* @param {string} pattern - Pattern to parse
|
|
32
|
+
* @returns {Array} Array of segment objects
|
|
33
|
+
*/
|
|
34
|
+
_parse(pattern) {
|
|
35
|
+
const segments = [];
|
|
36
|
+
let i = 0;
|
|
37
|
+
let currentPart = "";
|
|
38
|
+
while (i < pattern.length) if (pattern[i] === this.separator) if (i + 1 < pattern.length && pattern[i + 1] === this.separator) {
|
|
39
|
+
if (currentPart.trim()) {
|
|
40
|
+
segments.push(this._parseSegment(currentPart.trim()));
|
|
41
|
+
currentPart = "";
|
|
42
|
+
}
|
|
43
|
+
segments.push({ type: "deep-wildcard" });
|
|
44
|
+
i += 2;
|
|
45
|
+
} else {
|
|
46
|
+
if (currentPart.trim()) segments.push(this._parseSegment(currentPart.trim()));
|
|
47
|
+
currentPart = "";
|
|
48
|
+
i++;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
currentPart += pattern[i];
|
|
52
|
+
i++;
|
|
53
|
+
}
|
|
54
|
+
if (currentPart.trim()) segments.push(this._parseSegment(currentPart.trim()));
|
|
55
|
+
return segments;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Parse a single segment
|
|
59
|
+
* @private
|
|
60
|
+
* @param {string} part - Segment string (e.g., "user", "ns::user", "user[id]", "ns::user:first")
|
|
61
|
+
* @returns {Object} Segment object
|
|
62
|
+
*/
|
|
63
|
+
_parseSegment(part) {
|
|
64
|
+
const segment = { type: "tag" };
|
|
65
|
+
let bracketContent = null;
|
|
66
|
+
let withoutBrackets = part;
|
|
67
|
+
const bracketMatch = part.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
|
|
68
|
+
if (bracketMatch) {
|
|
69
|
+
withoutBrackets = bracketMatch[1] + bracketMatch[3];
|
|
70
|
+
if (bracketMatch[2]) {
|
|
71
|
+
const content = bracketMatch[2].slice(1, -1);
|
|
72
|
+
if (content) bracketContent = content;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
let namespace = void 0;
|
|
76
|
+
let tagAndPosition = withoutBrackets;
|
|
77
|
+
if (withoutBrackets.includes("::")) {
|
|
78
|
+
const nsIndex = withoutBrackets.indexOf("::");
|
|
79
|
+
namespace = withoutBrackets.substring(0, nsIndex).trim();
|
|
80
|
+
tagAndPosition = withoutBrackets.substring(nsIndex + 2).trim();
|
|
81
|
+
if (!namespace) throw new Error(`Invalid namespace in pattern: ${part}`);
|
|
82
|
+
}
|
|
83
|
+
let tag = void 0;
|
|
84
|
+
let positionMatch = null;
|
|
85
|
+
if (tagAndPosition.includes(":")) {
|
|
86
|
+
const colonIndex = tagAndPosition.lastIndexOf(":");
|
|
87
|
+
const tagPart = tagAndPosition.substring(0, colonIndex).trim();
|
|
88
|
+
const posPart = tagAndPosition.substring(colonIndex + 1).trim();
|
|
89
|
+
if ([
|
|
90
|
+
"first",
|
|
91
|
+
"last",
|
|
92
|
+
"odd",
|
|
93
|
+
"even"
|
|
94
|
+
].includes(posPart) || /^nth\(\d+\)$/.test(posPart)) {
|
|
95
|
+
tag = tagPart;
|
|
96
|
+
positionMatch = posPart;
|
|
97
|
+
} else tag = tagAndPosition;
|
|
98
|
+
} else tag = tagAndPosition;
|
|
99
|
+
if (!tag) throw new Error(`Invalid segment pattern: ${part}`);
|
|
100
|
+
segment.tag = tag;
|
|
101
|
+
if (namespace) segment.namespace = namespace;
|
|
102
|
+
if (bracketContent) if (bracketContent.includes("=")) {
|
|
103
|
+
const eqIndex = bracketContent.indexOf("=");
|
|
104
|
+
segment.attrName = bracketContent.substring(0, eqIndex).trim();
|
|
105
|
+
segment.attrValue = bracketContent.substring(eqIndex + 1).trim();
|
|
106
|
+
} else segment.attrName = bracketContent.trim();
|
|
107
|
+
if (positionMatch) {
|
|
108
|
+
const nthMatch = positionMatch.match(/^nth\((\d+)\)$/);
|
|
109
|
+
if (nthMatch) {
|
|
110
|
+
segment.position = "nth";
|
|
111
|
+
segment.positionValue = parseInt(nthMatch[1], 10);
|
|
112
|
+
} else segment.position = positionMatch;
|
|
113
|
+
}
|
|
114
|
+
return segment;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get the number of segments
|
|
118
|
+
* @returns {number}
|
|
119
|
+
*/
|
|
120
|
+
get length() {
|
|
121
|
+
return this.segments.length;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Check if expression contains deep wildcard
|
|
125
|
+
* @returns {boolean}
|
|
126
|
+
*/
|
|
127
|
+
hasDeepWildcard() {
|
|
128
|
+
return this._hasDeepWildcard;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Check if expression has attribute conditions
|
|
132
|
+
* @returns {boolean}
|
|
133
|
+
*/
|
|
134
|
+
hasAttributeCondition() {
|
|
135
|
+
return this._hasAttributeCondition;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Check if expression has position selectors
|
|
139
|
+
* @returns {boolean}
|
|
140
|
+
*/
|
|
141
|
+
hasPositionSelector() {
|
|
142
|
+
return this._hasPositionSelector;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get string representation
|
|
146
|
+
* @returns {string}
|
|
147
|
+
*/
|
|
148
|
+
toString() {
|
|
149
|
+
return this.pattern;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
//#endregion
|
|
153
|
+
exports.default = Expression;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
//#region node_modules/path-expression-matcher/src/Expression.js
|
|
2
|
+
/**
|
|
3
|
+
* Expression - Parses and stores a tag pattern expression
|
|
4
|
+
*
|
|
5
|
+
* Patterns are parsed once and stored in an optimized structure for fast matching.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const expr = new Expression("root.users.user");
|
|
9
|
+
* const expr2 = new Expression("..user[id]:first");
|
|
10
|
+
* const expr3 = new Expression("root/users/user", { separator: '/' });
|
|
11
|
+
*/
|
|
12
|
+
var Expression = class {
|
|
13
|
+
/**
|
|
14
|
+
* Create a new Expression
|
|
15
|
+
* @param {string} pattern - Pattern string (e.g., "root.users.user", "..user[id]")
|
|
16
|
+
* @param {Object} options - Configuration options
|
|
17
|
+
* @param {string} options.separator - Path separator (default: '.')
|
|
18
|
+
*/
|
|
19
|
+
constructor(pattern, options = {}, data) {
|
|
20
|
+
this.pattern = pattern;
|
|
21
|
+
this.separator = options.separator || ".";
|
|
22
|
+
this.segments = this._parse(pattern);
|
|
23
|
+
this.data = data;
|
|
24
|
+
this._hasDeepWildcard = this.segments.some((seg) => seg.type === "deep-wildcard");
|
|
25
|
+
this._hasAttributeCondition = this.segments.some((seg) => seg.attrName !== void 0);
|
|
26
|
+
this._hasPositionSelector = this.segments.some((seg) => seg.position !== void 0);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parse pattern string into segments
|
|
30
|
+
* @private
|
|
31
|
+
* @param {string} pattern - Pattern to parse
|
|
32
|
+
* @returns {Array} Array of segment objects
|
|
33
|
+
*/
|
|
34
|
+
_parse(pattern) {
|
|
35
|
+
const segments = [];
|
|
36
|
+
let i = 0;
|
|
37
|
+
let currentPart = "";
|
|
38
|
+
while (i < pattern.length) if (pattern[i] === this.separator) if (i + 1 < pattern.length && pattern[i + 1] === this.separator) {
|
|
39
|
+
if (currentPart.trim()) {
|
|
40
|
+
segments.push(this._parseSegment(currentPart.trim()));
|
|
41
|
+
currentPart = "";
|
|
42
|
+
}
|
|
43
|
+
segments.push({ type: "deep-wildcard" });
|
|
44
|
+
i += 2;
|
|
45
|
+
} else {
|
|
46
|
+
if (currentPart.trim()) segments.push(this._parseSegment(currentPart.trim()));
|
|
47
|
+
currentPart = "";
|
|
48
|
+
i++;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
currentPart += pattern[i];
|
|
52
|
+
i++;
|
|
53
|
+
}
|
|
54
|
+
if (currentPart.trim()) segments.push(this._parseSegment(currentPart.trim()));
|
|
55
|
+
return segments;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Parse a single segment
|
|
59
|
+
* @private
|
|
60
|
+
* @param {string} part - Segment string (e.g., "user", "ns::user", "user[id]", "ns::user:first")
|
|
61
|
+
* @returns {Object} Segment object
|
|
62
|
+
*/
|
|
63
|
+
_parseSegment(part) {
|
|
64
|
+
const segment = { type: "tag" };
|
|
65
|
+
let bracketContent = null;
|
|
66
|
+
let withoutBrackets = part;
|
|
67
|
+
const bracketMatch = part.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
|
|
68
|
+
if (bracketMatch) {
|
|
69
|
+
withoutBrackets = bracketMatch[1] + bracketMatch[3];
|
|
70
|
+
if (bracketMatch[2]) {
|
|
71
|
+
const content = bracketMatch[2].slice(1, -1);
|
|
72
|
+
if (content) bracketContent = content;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
let namespace = void 0;
|
|
76
|
+
let tagAndPosition = withoutBrackets;
|
|
77
|
+
if (withoutBrackets.includes("::")) {
|
|
78
|
+
const nsIndex = withoutBrackets.indexOf("::");
|
|
79
|
+
namespace = withoutBrackets.substring(0, nsIndex).trim();
|
|
80
|
+
tagAndPosition = withoutBrackets.substring(nsIndex + 2).trim();
|
|
81
|
+
if (!namespace) throw new Error(`Invalid namespace in pattern: ${part}`);
|
|
82
|
+
}
|
|
83
|
+
let tag = void 0;
|
|
84
|
+
let positionMatch = null;
|
|
85
|
+
if (tagAndPosition.includes(":")) {
|
|
86
|
+
const colonIndex = tagAndPosition.lastIndexOf(":");
|
|
87
|
+
const tagPart = tagAndPosition.substring(0, colonIndex).trim();
|
|
88
|
+
const posPart = tagAndPosition.substring(colonIndex + 1).trim();
|
|
89
|
+
if ([
|
|
90
|
+
"first",
|
|
91
|
+
"last",
|
|
92
|
+
"odd",
|
|
93
|
+
"even"
|
|
94
|
+
].includes(posPart) || /^nth\(\d+\)$/.test(posPart)) {
|
|
95
|
+
tag = tagPart;
|
|
96
|
+
positionMatch = posPart;
|
|
97
|
+
} else tag = tagAndPosition;
|
|
98
|
+
} else tag = tagAndPosition;
|
|
99
|
+
if (!tag) throw new Error(`Invalid segment pattern: ${part}`);
|
|
100
|
+
segment.tag = tag;
|
|
101
|
+
if (namespace) segment.namespace = namespace;
|
|
102
|
+
if (bracketContent) if (bracketContent.includes("=")) {
|
|
103
|
+
const eqIndex = bracketContent.indexOf("=");
|
|
104
|
+
segment.attrName = bracketContent.substring(0, eqIndex).trim();
|
|
105
|
+
segment.attrValue = bracketContent.substring(eqIndex + 1).trim();
|
|
106
|
+
} else segment.attrName = bracketContent.trim();
|
|
107
|
+
if (positionMatch) {
|
|
108
|
+
const nthMatch = positionMatch.match(/^nth\((\d+)\)$/);
|
|
109
|
+
if (nthMatch) {
|
|
110
|
+
segment.position = "nth";
|
|
111
|
+
segment.positionValue = parseInt(nthMatch[1], 10);
|
|
112
|
+
} else segment.position = positionMatch;
|
|
113
|
+
}
|
|
114
|
+
return segment;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Get the number of segments
|
|
118
|
+
* @returns {number}
|
|
119
|
+
*/
|
|
120
|
+
get length() {
|
|
121
|
+
return this.segments.length;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Check if expression contains deep wildcard
|
|
125
|
+
* @returns {boolean}
|
|
126
|
+
*/
|
|
127
|
+
hasDeepWildcard() {
|
|
128
|
+
return this._hasDeepWildcard;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Check if expression has attribute conditions
|
|
132
|
+
* @returns {boolean}
|
|
133
|
+
*/
|
|
134
|
+
hasAttributeCondition() {
|
|
135
|
+
return this._hasAttributeCondition;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Check if expression has position selectors
|
|
139
|
+
* @returns {boolean}
|
|
140
|
+
*/
|
|
141
|
+
hasPositionSelector() {
|
|
142
|
+
return this._hasPositionSelector;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get string representation
|
|
146
|
+
* @returns {string}
|
|
147
|
+
*/
|
|
148
|
+
toString() {
|
|
149
|
+
return this.pattern;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
//#endregion
|
|
153
|
+
export { Expression as default };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
const require_config = require(
|
|
2
|
-
let fast_xml_parser = require("fast-xml-parser");
|
|
3
|
-
|
|
1
|
+
const require_config = require("../../common/config.cjs");
|
|
4
2
|
//#region src/opml/generate/config.ts
|
|
5
|
-
const builder = new
|
|
6
|
-
|
|
3
|
+
const builder = new (require("fast-xml-parser")).XMLBuilder({ ...require_config.builderConfig });
|
|
7
4
|
//#endregion
|
|
8
|
-
exports.builder = builder;
|
|
5
|
+
exports.builder = builder;
|