feedsmith 3.0.0-rc.2 → 3.0.0-rc.3

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 (37) hide show
  1. package/dist/common/config.cjs +1 -0
  2. package/dist/common/config.js +29 -28
  3. package/dist/common/utils.cjs +113 -125
  4. package/dist/common/utils.js +111 -124
  5. package/dist/feeds/atom/generate/config.cjs +6 -2
  6. package/dist/feeds/atom/generate/config.js +5 -1
  7. package/dist/feeds/atom/generate/utils.cjs +45 -8
  8. package/dist/feeds/atom/generate/utils.js +47 -11
  9. package/dist/feeds/atom/parse/config.cjs +4 -70
  10. package/dist/feeds/atom/parse/config.js +5 -68
  11. package/dist/feeds/atom/parse/index.cjs +20 -3
  12. package/dist/feeds/atom/parse/index.js +20 -3
  13. package/dist/feeds/atom/parse/utils.cjs +99 -6
  14. package/dist/feeds/atom/parse/utils.js +96 -8
  15. package/dist/feeds/json/parse/utils.cjs +29 -29
  16. package/dist/feeds/json/parse/utils.js +30 -30
  17. package/dist/feeds/rdf/parse/config.cjs +14 -24
  18. package/dist/feeds/rdf/parse/config.js +15 -22
  19. package/dist/feeds/rdf/parse/index.cjs +20 -3
  20. package/dist/feeds/rdf/parse/index.js +20 -3
  21. package/dist/feeds/rss/generate/config.cjs +6 -2
  22. package/dist/feeds/rss/generate/config.js +5 -1
  23. package/dist/feeds/rss/parse/config.cjs +0 -9
  24. package/dist/feeds/rss/parse/config.js +2 -9
  25. package/dist/feeds/rss/parse/index.cjs +19 -3
  26. package/dist/feeds/rss/parse/index.js +19 -3
  27. package/dist/namespaces/atom/common/config.cjs +68 -0
  28. package/dist/namespaces/atom/common/config.js +65 -1
  29. package/dist/namespaces/rawvoice/parse/utils.cjs +1 -1
  30. package/dist/namespaces/rawvoice/parse/utils.js +2 -2
  31. package/dist/node_modules/trousse/dist/json.cjs +16 -0
  32. package/dist/node_modules/trousse/dist/json.js +16 -0
  33. package/dist/node_modules/trousse/dist/locales.cjs +15 -0
  34. package/dist/node_modules/trousse/dist/locales.js +15 -0
  35. package/dist/node_modules/trousse/dist/urls.cjs +9 -0
  36. package/dist/node_modules/trousse/dist/urls.js +9 -0
  37. package/package.json +1 -1
@@ -1,27 +1,20 @@
1
- import { namespacePrefixes, namespaceStopNodes, namespaceUris, parserConfig } from "../../../common/config.js";
2
- import { createNamespaceNormalizator } from "../../../common/utils.js";
3
- import { XMLParser } from "fast-xml-parser";
1
+ import { namespaceStopNodes } from "../../../common/config.js";
4
2
  //#region src/feeds/rdf/parse/config.ts
5
3
  const stopNodes = [
6
4
  ...namespaceStopNodes,
7
- "rdf:rdf.channel.title",
8
- "rdf:rdf.channel.link",
9
- "rdf:rdf.channel.description",
10
- "rdf:rdf.image.title",
11
- "rdf:rdf.image.link",
12
- "rdf:rdf.image.url",
13
- "rdf:rdf.item.title",
14
- "rdf:rdf.item.link",
15
- "rdf:rdf.item.description",
16
- "rdf:rdf.textinput.title",
17
- "rdf:rdf.textinput.description",
18
- "rdf:rdf.textinput.name",
19
- "rdf:rdf.textinput.link"
5
+ "rdf.channel.title",
6
+ "rdf.channel.link",
7
+ "rdf.channel.description",
8
+ "rdf.image.title",
9
+ "rdf.image.link",
10
+ "rdf.image.url",
11
+ "rdf.item.title",
12
+ "rdf.item.link",
13
+ "rdf.item.description",
14
+ "rdf.textinput.title",
15
+ "rdf.textinput.description",
16
+ "rdf.textinput.name",
17
+ "rdf.textinput.link"
20
18
  ];
21
- const parser = new XMLParser({
22
- ...parserConfig,
23
- stopNodes
24
- });
25
- const normalizeNamespaces = createNamespaceNormalizator(namespaceUris, namespacePrefixes, ["rdf", "rss"]);
26
19
  //#endregion
27
- export { normalizeNamespaces, parser, stopNodes };
20
+ export { stopNodes };
@@ -1,18 +1,35 @@
1
1
  const require_errors = require("../../../common/errors.cjs");
2
2
  const require_config = require("../../../common/config.cjs");
3
+ const require_utils = require("../../../common/utils.cjs");
3
4
  const require_index = require("../detect/index.cjs");
4
5
  const require_config$1 = require("./config.cjs");
5
- const require_utils = require("./utils.cjs");
6
+ const require_utils$1 = require("./utils.cjs");
7
+ let fast_xml_parser = require("fast-xml-parser");
6
8
  //#region src/feeds/rdf/parse/index.ts
9
+ const createNamespaceOptions = require_utils.createNamespaceResolver({
10
+ namespaceUris: require_config.namespaceUris,
11
+ namespacePrefixes: require_config.namespacePrefixes,
12
+ primaryNamespaces: ["rdf", "rss"]
13
+ });
14
+ let namespaceOptions = createNamespaceOptions();
15
+ const parser = new fast_xml_parser.XMLParser({
16
+ ...require_config.parserConfig,
17
+ stopNodes: require_config$1.stopNodes,
18
+ transformTagName: (name) => namespaceOptions.transformTagName(name),
19
+ transformAttributeName: (name) => namespaceOptions.transformAttributeName(name),
20
+ attributeValueProcessor: (name, value) => namespaceOptions.attributeValueProcessor(name, value),
21
+ updateTag: (name) => namespaceOptions.updateTag(name)
22
+ });
7
23
  const parse = (value, options) => {
8
24
  if (!require_index.detect(value)) throw new require_errors.DetectError(require_config.locales.invalidFeedFormat);
9
25
  let normalized;
10
26
  try {
11
- normalized = require_config$1.normalizeNamespaces(require_config$1.parser.parse(value));
27
+ namespaceOptions = createNamespaceOptions(value);
28
+ normalized = parser.parse(value);
12
29
  } catch (error) {
13
30
  throw new require_errors.MalformedError(require_config.locales.invalidFeedFormat, { cause: error });
14
31
  }
15
- const parsed = require_utils.retrieveFeed(normalized, options);
32
+ const parsed = require_utils$1.retrieveFeed(normalized, options);
16
33
  if (!parsed) throw new require_errors.ParseError(require_config.locales.invalidFeedFormat);
17
34
  return parsed;
18
35
  };
@@ -1,14 +1,31 @@
1
1
  import { DetectError, MalformedError, ParseError } from "../../../common/errors.js";
2
- import { locales } from "../../../common/config.js";
2
+ import { locales, namespacePrefixes, namespaceUris, parserConfig } from "../../../common/config.js";
3
+ import { createNamespaceResolver } from "../../../common/utils.js";
3
4
  import { detect } from "../detect/index.js";
4
- import { normalizeNamespaces, parser } from "./config.js";
5
+ import { stopNodes } from "./config.js";
5
6
  import { retrieveFeed } from "./utils.js";
7
+ import { XMLParser } from "fast-xml-parser";
6
8
  //#region src/feeds/rdf/parse/index.ts
9
+ const createNamespaceOptions = createNamespaceResolver({
10
+ namespaceUris,
11
+ namespacePrefixes,
12
+ primaryNamespaces: ["rdf", "rss"]
13
+ });
14
+ let namespaceOptions = createNamespaceOptions();
15
+ const parser = new XMLParser({
16
+ ...parserConfig,
17
+ stopNodes,
18
+ transformTagName: (name) => namespaceOptions.transformTagName(name),
19
+ transformAttributeName: (name) => namespaceOptions.transformAttributeName(name),
20
+ attributeValueProcessor: (name, value) => namespaceOptions.attributeValueProcessor(name, value),
21
+ updateTag: (name) => namespaceOptions.updateTag(name)
22
+ });
7
23
  const parse = (value, options) => {
8
24
  if (!detect(value)) throw new DetectError(locales.invalidFeedFormat);
9
25
  let normalized;
10
26
  try {
11
- normalized = normalizeNamespaces(parser.parse(value));
27
+ namespaceOptions = createNamespaceOptions(value);
28
+ normalized = parser.parse(value);
12
29
  } catch (error) {
13
30
  throw new MalformedError(locales.invalidFeedFormat, { cause: error });
14
31
  }
@@ -1,5 +1,9 @@
1
- const require_config = require("../../../common/config.cjs");
1
+ const require_config = require("../../../namespaces/atom/common/config.cjs");
2
+ const require_config$1 = require("../../../common/config.cjs");
2
3
  //#region src/feeds/rss/generate/config.ts
3
- const builder = new (require("fast-xml-parser")).XMLBuilder({ ...require_config.builderConfig });
4
+ const builder = new (require("fast-xml-parser")).XMLBuilder({
5
+ ...require_config$1.builderConfig,
6
+ stopNodes: require_config.textConstructs.map((element) => `..atom:${element}[type=xhtml]`)
7
+ });
4
8
  //#endregion
5
9
  exports.builder = builder;
@@ -1,6 +1,10 @@
1
+ import { textConstructs } from "../../../namespaces/atom/common/config.js";
1
2
  import { builderConfig } from "../../../common/config.js";
2
3
  import { XMLBuilder } from "fast-xml-parser";
3
4
  //#region src/feeds/rss/generate/config.ts
4
- const builder = new XMLBuilder({ ...builderConfig });
5
+ const builder = new XMLBuilder({
6
+ ...builderConfig,
7
+ stopNodes: textConstructs.map((element) => `..atom:${element}[type=xhtml]`)
8
+ });
5
9
  //#endregion
6
10
  export { builder };
@@ -1,6 +1,4 @@
1
1
  const require_config = require("../../../common/config.cjs");
2
- const require_utils = require("../../../common/utils.cjs");
3
- let fast_xml_parser = require("fast-xml-parser");
4
2
  //#region src/feeds/rss/parse/config.ts
5
3
  const sharedStopNodes = [
6
4
  "image.description",
@@ -46,12 +44,5 @@ const stopNodes = [
46
44
  ...sharedStopNodes.map((node) => `rss.channel.${node}`),
47
45
  ...sharedStopNodes.map((node) => `rss.${node}`)
48
46
  ];
49
- const parser = new fast_xml_parser.XMLParser({
50
- ...require_config.parserConfig,
51
- stopNodes
52
- });
53
- const normalizeNamespaces = require_utils.createNamespaceNormalizator(require_config.namespaceUris, require_config.namespacePrefixes);
54
47
  //#endregion
55
- exports.normalizeNamespaces = normalizeNamespaces;
56
- exports.parser = parser;
57
48
  exports.stopNodes = stopNodes;
@@ -1,6 +1,4 @@
1
- import { namespacePrefixes, namespaceStopNodes, namespaceUris, parserConfig } from "../../../common/config.js";
2
- import { createNamespaceNormalizator } from "../../../common/utils.js";
3
- import { XMLParser } from "fast-xml-parser";
1
+ import { namespaceStopNodes } from "../../../common/config.js";
4
2
  //#region src/feeds/rss/parse/config.ts
5
3
  const sharedStopNodes = [
6
4
  "image.description",
@@ -46,10 +44,5 @@ const stopNodes = [
46
44
  ...sharedStopNodes.map((node) => `rss.channel.${node}`),
47
45
  ...sharedStopNodes.map((node) => `rss.${node}`)
48
46
  ];
49
- const parser = new XMLParser({
50
- ...parserConfig,
51
- stopNodes
52
- });
53
- const normalizeNamespaces = createNamespaceNormalizator(namespaceUris, namespacePrefixes);
54
47
  //#endregion
55
- export { normalizeNamespaces, parser, stopNodes };
48
+ export { stopNodes };
@@ -1,18 +1,34 @@
1
1
  const require_errors = require("../../../common/errors.cjs");
2
2
  const require_config = require("../../../common/config.cjs");
3
+ const require_utils = require("../../../common/utils.cjs");
3
4
  const require_index = require("../detect/index.cjs");
4
5
  const require_config$1 = require("./config.cjs");
5
- const require_utils = require("./utils.cjs");
6
+ const require_utils$1 = require("./utils.cjs");
7
+ let fast_xml_parser = require("fast-xml-parser");
6
8
  //#region src/feeds/rss/parse/index.ts
9
+ const createNamespaceOptions = require_utils.createNamespaceResolver({
10
+ namespaceUris: require_config.namespaceUris,
11
+ namespacePrefixes: require_config.namespacePrefixes
12
+ });
13
+ let namespaceOptions = createNamespaceOptions();
14
+ const parser = new fast_xml_parser.XMLParser({
15
+ ...require_config.parserConfig,
16
+ stopNodes: require_config$1.stopNodes,
17
+ transformTagName: (name) => namespaceOptions.transformTagName(name),
18
+ transformAttributeName: (name) => namespaceOptions.transformAttributeName(name),
19
+ attributeValueProcessor: (name, value) => namespaceOptions.attributeValueProcessor(name, value),
20
+ updateTag: (name) => namespaceOptions.updateTag(name)
21
+ });
7
22
  const parse = (value, options) => {
8
23
  if (!require_index.detect(value)) throw new require_errors.DetectError(require_config.locales.invalidFeedFormat);
9
24
  let normalized;
10
25
  try {
11
- normalized = require_config$1.normalizeNamespaces(require_config$1.parser.parse(value));
26
+ namespaceOptions = createNamespaceOptions(value);
27
+ normalized = parser.parse(value);
12
28
  } catch (error) {
13
29
  throw new require_errors.MalformedError(require_config.locales.invalidFeedFormat, { cause: error });
14
30
  }
15
- const parsed = require_utils.retrieveFeed(normalized, options);
31
+ const parsed = require_utils$1.retrieveFeed(normalized, options);
16
32
  if (!parsed) throw new require_errors.ParseError(require_config.locales.invalidFeedFormat);
17
33
  return parsed;
18
34
  };
@@ -1,14 +1,30 @@
1
1
  import { DetectError, MalformedError, ParseError } from "../../../common/errors.js";
2
- import { locales } from "../../../common/config.js";
2
+ import { locales, namespacePrefixes, namespaceUris, parserConfig } from "../../../common/config.js";
3
+ import { createNamespaceResolver } from "../../../common/utils.js";
3
4
  import { detect } from "../detect/index.js";
4
- import { normalizeNamespaces, parser } from "./config.js";
5
+ import { stopNodes } from "./config.js";
5
6
  import { retrieveFeed } from "./utils.js";
7
+ import { XMLParser } from "fast-xml-parser";
6
8
  //#region src/feeds/rss/parse/index.ts
9
+ const createNamespaceOptions = createNamespaceResolver({
10
+ namespaceUris,
11
+ namespacePrefixes
12
+ });
13
+ let namespaceOptions = createNamespaceOptions();
14
+ const parser = new XMLParser({
15
+ ...parserConfig,
16
+ stopNodes,
17
+ transformTagName: (name) => namespaceOptions.transformTagName(name),
18
+ transformAttributeName: (name) => namespaceOptions.transformAttributeName(name),
19
+ attributeValueProcessor: (name, value) => namespaceOptions.attributeValueProcessor(name, value),
20
+ updateTag: (name) => namespaceOptions.updateTag(name)
21
+ });
7
22
  const parse = (value, options) => {
8
23
  if (!detect(value)) throw new DetectError(locales.invalidFeedFormat);
9
24
  let normalized;
10
25
  try {
11
- normalized = normalizeNamespaces(parser.parse(value));
26
+ namespaceOptions = createNamespaceOptions(value);
27
+ normalized = parser.parse(value);
12
28
  } catch (error) {
13
29
  throw new MalformedError(locales.invalidFeedFormat, { cause: error });
14
30
  }
@@ -7,5 +7,73 @@ const uris = [
7
7
  "http://purl.org/atom/ns#",
8
8
  "https://purl.org/atom/ns#"
9
9
  ];
10
+ const textConstructs = [
11
+ "title",
12
+ "subtitle",
13
+ "rights",
14
+ "summary",
15
+ "content"
16
+ ];
17
+ const personPaths = (parent) => [
18
+ `${parent}.name`,
19
+ `${parent}.uri`,
20
+ `${parent}.url`,
21
+ `${parent}.email`
22
+ ];
23
+ const feedPaths = [
24
+ ...personPaths("author"),
25
+ "category",
26
+ ...personPaths("contributor"),
27
+ "generator",
28
+ "icon",
29
+ "id",
30
+ "link",
31
+ "logo",
32
+ "rights",
33
+ "subtitle",
34
+ "tagline",
35
+ "title",
36
+ "updated",
37
+ "modified"
38
+ ];
39
+ const entryPaths = [
40
+ ...personPaths("author"),
41
+ "category",
42
+ "content",
43
+ ...personPaths("contributor"),
44
+ "id",
45
+ "link",
46
+ "published",
47
+ "issued",
48
+ "created",
49
+ "rights",
50
+ ...personPaths("source.author"),
51
+ "source.category",
52
+ ...personPaths("source.contributor"),
53
+ "source.generator",
54
+ "source.icon",
55
+ "source.id",
56
+ "source.link",
57
+ "source.logo",
58
+ "source.rights",
59
+ "source.subtitle",
60
+ "source.title",
61
+ "source.updated",
62
+ "source.modified",
63
+ "summary",
64
+ "title",
65
+ "updated",
66
+ "modified"
67
+ ];
68
+ const prefixSegments = (path) => {
69
+ return path.split(".").map((segment) => `atom:${segment}`).join(".");
70
+ };
71
+ const stopNodes = [.../* @__PURE__ */ new Set([...feedPaths, ...entryPaths])].map((path) => {
72
+ return `*.${prefixSegments(path)}`;
73
+ });
10
74
  //#endregion
75
+ exports.entryPaths = entryPaths;
76
+ exports.feedPaths = feedPaths;
77
+ exports.stopNodes = stopNodes;
78
+ exports.textConstructs = textConstructs;
11
79
  exports.uris = uris;
@@ -7,5 +7,69 @@ const uris = [
7
7
  "http://purl.org/atom/ns#",
8
8
  "https://purl.org/atom/ns#"
9
9
  ];
10
+ const textConstructs = [
11
+ "title",
12
+ "subtitle",
13
+ "rights",
14
+ "summary",
15
+ "content"
16
+ ];
17
+ const personPaths = (parent) => [
18
+ `${parent}.name`,
19
+ `${parent}.uri`,
20
+ `${parent}.url`,
21
+ `${parent}.email`
22
+ ];
23
+ const feedPaths = [
24
+ ...personPaths("author"),
25
+ "category",
26
+ ...personPaths("contributor"),
27
+ "generator",
28
+ "icon",
29
+ "id",
30
+ "link",
31
+ "logo",
32
+ "rights",
33
+ "subtitle",
34
+ "tagline",
35
+ "title",
36
+ "updated",
37
+ "modified"
38
+ ];
39
+ const entryPaths = [
40
+ ...personPaths("author"),
41
+ "category",
42
+ "content",
43
+ ...personPaths("contributor"),
44
+ "id",
45
+ "link",
46
+ "published",
47
+ "issued",
48
+ "created",
49
+ "rights",
50
+ ...personPaths("source.author"),
51
+ "source.category",
52
+ ...personPaths("source.contributor"),
53
+ "source.generator",
54
+ "source.icon",
55
+ "source.id",
56
+ "source.link",
57
+ "source.logo",
58
+ "source.rights",
59
+ "source.subtitle",
60
+ "source.title",
61
+ "source.updated",
62
+ "source.modified",
63
+ "summary",
64
+ "title",
65
+ "updated",
66
+ "modified"
67
+ ];
68
+ const prefixSegments = (path) => {
69
+ return path.split(".").map((segment) => `atom:${segment}`).join(".");
70
+ };
71
+ const stopNodes = [.../* @__PURE__ */ new Set([...feedPaths, ...entryPaths])].map((path) => {
72
+ return `*.${prefixSegments(path)}`;
73
+ });
10
74
  //#endregion
11
- export { uris };
75
+ export { entryPaths, feedPaths, stopNodes, textConstructs, uris };
@@ -31,7 +31,7 @@ const parseAlternateEnclosure = (value) => {
31
31
  const parseSubscribe = (value) => {
32
32
  if (!require_is.isPlainObject(value)) return;
33
33
  const subscribe = {};
34
- for (const key in value) if (key.startsWith("@")) {
34
+ for (const key in value) if (require_utils.isXmlAttributeKey(key)) {
35
35
  const attrName = key.slice(1);
36
36
  const attrValue = require_utils.parseString(value[key]);
37
37
  if (attrValue) subscribe[attrName] = attrValue;
@@ -1,5 +1,5 @@
1
1
  import { isPlainObject } from "../../../node_modules/trousse/dist/is.js";
2
- import { parseArrayOf, parseDate, parseNumber, parseSingularOf, parseString, parseYesNoBoolean, retrieveText, trimObject } from "../../../common/utils.js";
2
+ import { isXmlAttributeKey, parseArrayOf, parseDate, parseNumber, parseSingularOf, parseString, parseYesNoBoolean, retrieveText, trimObject } from "../../../common/utils.js";
3
3
  //#region src/namespaces/rawvoice/parse/utils.ts
4
4
  const parseRating = (value) => {
5
5
  return trimObject({
@@ -31,7 +31,7 @@ const parseAlternateEnclosure = (value) => {
31
31
  const parseSubscribe = (value) => {
32
32
  if (!isPlainObject(value)) return;
33
33
  const subscribe = {};
34
- for (const key in value) if (key.startsWith("@")) {
34
+ for (const key in value) if (isXmlAttributeKey(key)) {
35
35
  const attrName = key.slice(1);
36
36
  const attrValue = parseString(value[key]);
37
37
  if (attrValue) subscribe[attrName] = attrValue;
@@ -0,0 +1,16 @@
1
+ //#region node_modules/trousse/dist/json.js
2
+ const isWhitespaceCode = (code) => {
3
+ return code >= 9 && code <= 13 || code === 32 || code === 160 || code === 5760 || code >= 8192 && code <= 8202 || code === 8232 || code === 8233 || code === 8239 || code === 8287 || code === 12288 || code === 65279;
4
+ };
5
+ const isJsonLike = (value) => {
6
+ if (value.length < 2) return false;
7
+ let start = 0;
8
+ let end = value.length - 1;
9
+ while (start < end && isWhitespaceCode(value.charCodeAt(start))) start++;
10
+ while (end > start && isWhitespaceCode(value.charCodeAt(end))) end--;
11
+ const first = value.charCodeAt(start);
12
+ const last = value.charCodeAt(end);
13
+ return first === 123 && last === 125 || first === 91 && last === 93;
14
+ };
15
+ //#endregion
16
+ exports.isJsonLike = isJsonLike;
@@ -0,0 +1,16 @@
1
+ //#region node_modules/trousse/dist/json.js
2
+ const isWhitespaceCode = (code) => {
3
+ return code >= 9 && code <= 13 || code === 32 || code === 160 || code === 5760 || code >= 8192 && code <= 8202 || code === 8232 || code === 8233 || code === 8239 || code === 8287 || code === 12288 || code === 65279;
4
+ };
5
+ const isJsonLike = (value) => {
6
+ if (value.length < 2) return false;
7
+ let start = 0;
8
+ let end = value.length - 1;
9
+ while (start < end && isWhitespaceCode(value.charCodeAt(start))) start++;
10
+ while (end > start && isWhitespaceCode(value.charCodeAt(end))) end--;
11
+ const first = value.charCodeAt(start);
12
+ const last = value.charCodeAt(end);
13
+ return first === 123 && last === 125 || first === 91 && last === 93;
14
+ };
15
+ //#endregion
16
+ export { isJsonLike };
@@ -0,0 +1,15 @@
1
+ //#region node_modules/trousse/dist/locales.js
2
+ const escapableRegex = /[&<>"']/g;
3
+ const escapeHtml = (value) => {
4
+ return value.replace(escapableRegex, (char) => {
5
+ switch (char) {
6
+ case "&": return "&amp;";
7
+ case "<": return "&lt;";
8
+ case ">": return "&gt;";
9
+ case "\"": return "&quot;";
10
+ default: return "&#39;";
11
+ }
12
+ });
13
+ };
14
+ //#endregion
15
+ exports.escapeHtml = escapeHtml;
@@ -0,0 +1,15 @@
1
+ //#region node_modules/trousse/dist/locales.js
2
+ const escapableRegex = /[&<>"']/g;
3
+ const escapeHtml = (value) => {
4
+ return value.replace(escapableRegex, (char) => {
5
+ switch (char) {
6
+ case "&": return "&amp;";
7
+ case "<": return "&lt;";
8
+ case ">": return "&gt;";
9
+ case "\"": return "&quot;";
10
+ default: return "&#39;";
11
+ }
12
+ });
13
+ };
14
+ //#endregion
15
+ export { escapeHtml };
@@ -0,0 +1,9 @@
1
+ //#region node_modules/trousse/dist/urls.js
2
+ const parseUrl = (value, base) => {
3
+ if (value instanceof URL && base === void 0) return value;
4
+ try {
5
+ return new URL(value, base);
6
+ } catch {}
7
+ };
8
+ //#endregion
9
+ exports.parseUrl = parseUrl;
@@ -0,0 +1,9 @@
1
+ //#region node_modules/trousse/dist/urls.js
2
+ const parseUrl = (value, base) => {
3
+ if (value instanceof URL && base === void 0) return value;
4
+ try {
5
+ return new URL(value, base);
6
+ } catch {}
7
+ };
8
+ //#endregion
9
+ export { parseUrl };
package/package.json CHANGED
@@ -64,5 +64,5 @@
64
64
  "tsdown": "^0.22.7",
65
65
  "vitepress": "^2.0.0-alpha.18"
66
66
  },
67
- "version": "3.0.0-rc.2"
67
+ "version": "3.0.0-rc.3"
68
68
  }