feedsmith 3.0.0-beta.1 → 3.0.0-beta.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.
@@ -43,6 +43,7 @@ const parserConfig = {
43
43
  ignorePiTags: true,
44
44
  ignoreDeclaration: true,
45
45
  attributeNamePrefix: "@",
46
+ jPath: false,
46
47
  transformTagName: (name) => name.toLowerCase(),
47
48
  transformAttributeName: (name) => name.toLowerCase()
48
49
  };
@@ -43,6 +43,7 @@ const parserConfig = {
43
43
  ignorePiTags: true,
44
44
  ignoreDeclaration: true,
45
45
  attributeNamePrefix: "@",
46
+ jPath: false,
46
47
  transformTagName: (name) => name.toLowerCase(),
47
48
  transformAttributeName: (name) => name.toLowerCase()
48
49
  };
@@ -409,9 +409,30 @@ const parseJsonObject = (value) => {
409
409
  return JSON.parse(value);
410
410
  } catch {}
411
411
  };
412
+ const namespaceContainers = [
413
+ "media:group",
414
+ "media:content",
415
+ "media:group.media:content",
416
+ "media:embed",
417
+ "podcast:liveitem",
418
+ "itunes:owner"
419
+ ];
420
+ const expandStopNodes = (stopNodes, feedContainerPaths) => {
421
+ const set = /* @__PURE__ */ new Set();
422
+ for (const node of stopNodes) {
423
+ const suffix = node.slice(2);
424
+ const prefix = suffix.split(":")[0];
425
+ for (const feedPath of feedContainerPaths) {
426
+ set.add(`${feedPath}.${suffix}`);
427
+ for (const nsContainer of namespaceContainers) if (nsContainer.split(":")[0] === prefix) set.add(`${feedPath}.${nsContainer}.${suffix}`);
428
+ }
429
+ }
430
+ return [...set];
431
+ };
412
432
  //#endregion
413
433
  exports.createNamespaceNormalizator = createNamespaceNormalizator;
414
434
  exports.detectNamespaces = detectNamespaces;
435
+ exports.expandStopNodes = expandStopNodes;
415
436
  exports.generateBoolean = generateBoolean;
416
437
  exports.generateCdataString = generateCdataString;
417
438
  exports.generateCsvOf = generateCsvOf;
@@ -409,5 +409,25 @@ const parseJsonObject = (value) => {
409
409
  return JSON.parse(value);
410
410
  } catch {}
411
411
  };
412
+ const namespaceContainers = [
413
+ "media:group",
414
+ "media:content",
415
+ "media:group.media:content",
416
+ "media:embed",
417
+ "podcast:liveitem",
418
+ "itunes:owner"
419
+ ];
420
+ const expandStopNodes = (stopNodes, feedContainerPaths) => {
421
+ const set = /* @__PURE__ */ new Set();
422
+ for (const node of stopNodes) {
423
+ const suffix = node.slice(2);
424
+ const prefix = suffix.split(":")[0];
425
+ for (const feedPath of feedContainerPaths) {
426
+ set.add(`${feedPath}.${suffix}`);
427
+ for (const nsContainer of namespaceContainers) if (nsContainer.split(":")[0] === prefix) set.add(`${feedPath}.${nsContainer}.${suffix}`);
428
+ }
429
+ }
430
+ return [...set];
431
+ };
412
432
  //#endregion
413
- export { createNamespaceNormalizator, detectNamespaces, generateBoolean, generateCdataString, generateCsvOf, generateNamespaceAttrs, generateNumber, generatePlainString, generateRdfResource, generateRfc3339Date, generateRfc822Date, generateTextOrCdataString, generateXml, generateYesNoBoolean, isNonEmptyString, isNonEmptyStringOrNumber, isObject, isPresent, parseArrayOf, parseBoolean, parseCsvOf, parseDate, parseJsonObject, parseNumber, parseSingular, parseSingularOf, parseString, parseYesNoBoolean, retrieveRdfResourceOrText, retrieveText, trimArray, trimObject };
433
+ export { createNamespaceNormalizator, detectNamespaces, expandStopNodes, generateBoolean, generateCdataString, generateCsvOf, generateNamespaceAttrs, generateNumber, generatePlainString, generateRdfResource, generateRfc3339Date, generateRfc822Date, generateTextOrCdataString, generateXml, generateYesNoBoolean, isNonEmptyString, isNonEmptyStringOrNumber, isObject, isPresent, parseArrayOf, parseBoolean, parseCsvOf, parseDate, parseJsonObject, parseNumber, parseSingular, parseSingularOf, parseString, parseYesNoBoolean, retrieveRdfResourceOrText, retrieveText, trimArray, trimObject };
@@ -1,9 +1,14 @@
1
1
  const require_config = require("../../../common/config.cjs");
2
2
  const require_utils = require("../../../common/utils.cjs");
3
+ const require_Expression = require("../../../node_modules/path-expression-matcher/src/Expression.cjs");
3
4
  let fast_xml_parser = require("fast-xml-parser");
4
5
  //#region src/feeds/atom/parse/config.ts
5
6
  const stopNodes = [
6
- ...require_config.namespaceStopNodes,
7
+ ...require_utils.expandStopNodes(require_config.namespaceStopNodes, [
8
+ "feed",
9
+ "feed.entry",
10
+ "feed.entry.source"
11
+ ]),
7
12
  "feed.author.name",
8
13
  "feed.author.uri",
9
14
  "feed.author.url",
@@ -66,7 +71,7 @@ const stopNodes = [
66
71
  ];
67
72
  const parser = new fast_xml_parser.XMLParser({
68
73
  ...require_config.parserConfig,
69
- stopNodes
74
+ stopNodes: stopNodes.map((node) => new require_Expression.default(node))
70
75
  });
71
76
  const normalizeNamespaces = require_utils.createNamespaceNormalizator(require_config.namespaceUris, require_config.namespacePrefixes, ["atom"]);
72
77
  //#endregion
@@ -1,9 +1,14 @@
1
1
  import { namespacePrefixes, namespaceStopNodes, namespaceUris, parserConfig } from "../../../common/config.js";
2
- import { createNamespaceNormalizator } from "../../../common/utils.js";
2
+ import { createNamespaceNormalizator, expandStopNodes } from "../../../common/utils.js";
3
+ import Expression from "../../../node_modules/path-expression-matcher/src/Expression.js";
3
4
  import { XMLParser } from "fast-xml-parser";
4
5
  //#region src/feeds/atom/parse/config.ts
5
6
  const stopNodes = [
6
- ...namespaceStopNodes,
7
+ ...expandStopNodes(namespaceStopNodes, [
8
+ "feed",
9
+ "feed.entry",
10
+ "feed.entry.source"
11
+ ]),
7
12
  "feed.author.name",
8
13
  "feed.author.uri",
9
14
  "feed.author.url",
@@ -66,7 +71,7 @@ const stopNodes = [
66
71
  ];
67
72
  const parser = new XMLParser({
68
73
  ...parserConfig,
69
- stopNodes
74
+ stopNodes: stopNodes.map((node) => new Expression(node))
70
75
  });
71
76
  const normalizeNamespaces = createNamespaceNormalizator(namespaceUris, namespacePrefixes, ["atom"]);
72
77
  //#endregion
@@ -1,9 +1,15 @@
1
1
  const require_config = require("../../../common/config.cjs");
2
2
  const require_utils = require("../../../common/utils.cjs");
3
+ const require_Expression = require("../../../node_modules/path-expression-matcher/src/Expression.cjs");
3
4
  let fast_xml_parser = require("fast-xml-parser");
4
5
  //#region src/feeds/rdf/parse/config.ts
5
6
  const stopNodes = [
6
- ...require_config.namespaceStopNodes,
7
+ ...require_utils.expandStopNodes(require_config.namespaceStopNodes, [
8
+ "rdf:rdf.channel",
9
+ "rdf:rdf.item",
10
+ "rdf:rdf.image",
11
+ "rdf:rdf.textinput"
12
+ ]),
7
13
  "rdf:rdf.channel.title",
8
14
  "rdf:rdf.channel.link",
9
15
  "rdf:rdf.channel.description",
@@ -20,7 +26,7 @@ const stopNodes = [
20
26
  ];
21
27
  const parser = new fast_xml_parser.XMLParser({
22
28
  ...require_config.parserConfig,
23
- stopNodes
29
+ stopNodes: stopNodes.map((node) => new require_Expression.default(node))
24
30
  });
25
31
  const normalizeNamespaces = require_utils.createNamespaceNormalizator(require_config.namespaceUris, require_config.namespacePrefixes, ["rdf", "rss"]);
26
32
  //#endregion
@@ -1,9 +1,15 @@
1
1
  import { namespacePrefixes, namespaceStopNodes, namespaceUris, parserConfig } from "../../../common/config.js";
2
- import { createNamespaceNormalizator } from "../../../common/utils.js";
2
+ import { createNamespaceNormalizator, expandStopNodes } from "../../../common/utils.js";
3
+ import Expression from "../../../node_modules/path-expression-matcher/src/Expression.js";
3
4
  import { XMLParser } from "fast-xml-parser";
4
5
  //#region src/feeds/rdf/parse/config.ts
5
6
  const stopNodes = [
6
- ...namespaceStopNodes,
7
+ ...expandStopNodes(namespaceStopNodes, [
8
+ "rdf:rdf.channel",
9
+ "rdf:rdf.item",
10
+ "rdf:rdf.image",
11
+ "rdf:rdf.textinput"
12
+ ]),
7
13
  "rdf:rdf.channel.title",
8
14
  "rdf:rdf.channel.link",
9
15
  "rdf:rdf.channel.description",
@@ -20,7 +26,7 @@ const stopNodes = [
20
26
  ];
21
27
  const parser = new XMLParser({
22
28
  ...parserConfig,
23
- stopNodes
29
+ stopNodes: stopNodes.map((node) => new Expression(node))
24
30
  });
25
31
  const normalizeNamespaces = createNamespaceNormalizator(namespaceUris, namespacePrefixes, ["rdf", "rss"]);
26
32
  //#endregion
@@ -1,5 +1,6 @@
1
1
  const require_config = require("../../../common/config.cjs");
2
2
  const require_utils = require("../../../common/utils.cjs");
3
+ const require_Expression = require("../../../node_modules/path-expression-matcher/src/Expression.cjs");
3
4
  let fast_xml_parser = require("fast-xml-parser");
4
5
  //#region src/feeds/rss/parse/config.ts
5
6
  const sharedStopNodes = [
@@ -25,7 +26,12 @@ const sharedStopNodes = [
25
26
  "item.source"
26
27
  ];
27
28
  const stopNodes = [
28
- ...require_config.namespaceStopNodes,
29
+ ...require_utils.expandStopNodes(require_config.namespaceStopNodes, [
30
+ "rss.channel",
31
+ "rss.channel.item",
32
+ "rss",
33
+ "rss.item"
34
+ ]),
29
35
  "rss.channel.title",
30
36
  "rss.channel.link",
31
37
  "rss.channel.description",
@@ -48,7 +54,7 @@ const stopNodes = [
48
54
  ];
49
55
  const parser = new fast_xml_parser.XMLParser({
50
56
  ...require_config.parserConfig,
51
- stopNodes
57
+ stopNodes: stopNodes.map((node) => new require_Expression.default(node))
52
58
  });
53
59
  const normalizeNamespaces = require_utils.createNamespaceNormalizator(require_config.namespaceUris, require_config.namespacePrefixes);
54
60
  //#endregion
@@ -1,5 +1,6 @@
1
1
  import { namespacePrefixes, namespaceStopNodes, namespaceUris, parserConfig } from "../../../common/config.js";
2
- import { createNamespaceNormalizator } from "../../../common/utils.js";
2
+ import { createNamespaceNormalizator, expandStopNodes } from "../../../common/utils.js";
3
+ import Expression from "../../../node_modules/path-expression-matcher/src/Expression.js";
3
4
  import { XMLParser } from "fast-xml-parser";
4
5
  //#region src/feeds/rss/parse/config.ts
5
6
  const sharedStopNodes = [
@@ -25,7 +26,12 @@ const sharedStopNodes = [
25
26
  "item.source"
26
27
  ];
27
28
  const stopNodes = [
28
- ...namespaceStopNodes,
29
+ ...expandStopNodes(namespaceStopNodes, [
30
+ "rss.channel",
31
+ "rss.channel.item",
32
+ "rss",
33
+ "rss.item"
34
+ ]),
29
35
  "rss.channel.title",
30
36
  "rss.channel.link",
31
37
  "rss.channel.description",
@@ -48,7 +54,7 @@ const stopNodes = [
48
54
  ];
49
55
  const parser = new XMLParser({
50
56
  ...parserConfig,
51
- stopNodes
57
+ stopNodes: stopNodes.map((node) => new Expression(node))
52
58
  });
53
59
  const normalizeNamespaces = createNamespaceNormalizator(namespaceUris, namespacePrefixes);
54
60
  //#endregion
@@ -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,24 +1,25 @@
1
1
  const require_config = require("../../common/config.cjs");
2
+ const require_Expression = require("../../node_modules/path-expression-matcher/src/Expression.cjs");
2
3
  let fast_xml_parser = require("fast-xml-parser");
3
4
  //#region src/opml/parse/config.ts
4
5
  const stopNodes = [
5
6
  "opml.head.title",
6
- "opml.head.dateCreated",
7
- "opml.head.dateModified",
8
- "opml.head.ownerName",
9
- "opml.head.ownerEmail",
10
- "opml.head.ownerId",
7
+ "opml.head.datecreated",
8
+ "opml.head.datemodified",
9
+ "opml.head.ownername",
10
+ "opml.head.owneremail",
11
+ "opml.head.ownerid",
11
12
  "opml.head.docs",
12
- "opml.head.expansionState",
13
- "opml.head.vertScrollState",
14
- "opml.head.windowTop",
15
- "opml.head.windowLeft",
16
- "opml.head.windowBottom",
17
- "opml.head.windowRight"
13
+ "opml.head.expansionstate",
14
+ "opml.head.vertscrollstate",
15
+ "opml.head.windowtop",
16
+ "opml.head.windowleft",
17
+ "opml.head.windowbottom",
18
+ "opml.head.windowright"
18
19
  ];
19
20
  const parser = new fast_xml_parser.XMLParser({
20
21
  ...require_config.parserConfig,
21
- stopNodes
22
+ stopNodes: stopNodes.map((node) => new require_Expression.default(node))
22
23
  });
23
24
  //#endregion
24
25
  exports.parser = parser;
@@ -1,24 +1,25 @@
1
1
  import { parserConfig } from "../../common/config.js";
2
+ import Expression from "../../node_modules/path-expression-matcher/src/Expression.js";
2
3
  import { XMLParser } from "fast-xml-parser";
3
4
  //#region src/opml/parse/config.ts
4
5
  const stopNodes = [
5
6
  "opml.head.title",
6
- "opml.head.dateCreated",
7
- "opml.head.dateModified",
8
- "opml.head.ownerName",
9
- "opml.head.ownerEmail",
10
- "opml.head.ownerId",
7
+ "opml.head.datecreated",
8
+ "opml.head.datemodified",
9
+ "opml.head.ownername",
10
+ "opml.head.owneremail",
11
+ "opml.head.ownerid",
11
12
  "opml.head.docs",
12
- "opml.head.expansionState",
13
- "opml.head.vertScrollState",
14
- "opml.head.windowTop",
15
- "opml.head.windowLeft",
16
- "opml.head.windowBottom",
17
- "opml.head.windowRight"
13
+ "opml.head.expansionstate",
14
+ "opml.head.vertscrollstate",
15
+ "opml.head.windowtop",
16
+ "opml.head.windowleft",
17
+ "opml.head.windowbottom",
18
+ "opml.head.windowright"
18
19
  ];
19
20
  const parser = new XMLParser({
20
21
  ...parserConfig,
21
- stopNodes
22
+ stopNodes: stopNodes.map((node) => new Expression(node))
22
23
  });
23
24
  //#endregion
24
25
  export { parser };
package/package.json CHANGED
@@ -54,14 +54,14 @@
54
54
  "docs:build": "vitepress build docs"
55
55
  },
56
56
  "dependencies": {
57
- "entities": "^8.0.0",
58
- "fast-xml-parser": "~5.4.2"
57
+ "entities": "^7.0.1",
58
+ "fast-xml-parser": "~5.5.12"
59
59
  },
60
60
  "devDependencies": {
61
- "@types/bun": "^1.3.11",
61
+ "@types/bun": "^1.3.12",
62
62
  "kvalita": "^1.12.4",
63
- "tsdown": "^0.21.7",
63
+ "tsdown": "^0.21.8",
64
64
  "vitepress": "^2.0.0-alpha.17"
65
65
  },
66
- "version": "3.0.0-beta.1"
66
+ "version": "3.0.0-beta.2"
67
67
  }