feedcanon 1.5.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports.cjs +1 -0
- package/dist/exports.d.cts +2 -2
- package/dist/exports.d.ts +2 -2
- package/dist/exports.js +2 -2
- package/dist/utils.cjs +7 -0
- package/dist/utils.d.cts +2 -1
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +7 -1
- package/package.json +5 -6
package/dist/exports.cjs
CHANGED
|
@@ -17,4 +17,5 @@ exports.fixMalformedProtocol = require_utils.fixMalformedProtocol;
|
|
|
17
17
|
exports.normalizeUrl = require_utils.normalizeUrl;
|
|
18
18
|
exports.resolveFeedProtocol = require_utils.resolveFeedProtocol;
|
|
19
19
|
exports.resolveUrl = require_utils.resolveUrl;
|
|
20
|
+
exports.upgradeProtocol = require_utils.upgradeProtocol;
|
|
20
21
|
exports.wordpressProbe = require_wordpress.wordpressProbe;
|
package/dist/exports.d.cts
CHANGED
|
@@ -4,5 +4,5 @@ import { findCanonical } from "./index.cjs";
|
|
|
4
4
|
import { wordpressProbe } from "./probes/wordpress.cjs";
|
|
5
5
|
import { bloggerRewrite } from "./rewrites/blogger.cjs";
|
|
6
6
|
import { feedburnerRewrite } from "./rewrites/feedburner.cjs";
|
|
7
|
-
import { addMissingProtocol, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl } from "./utils.cjs";
|
|
8
|
-
export { type DefaultParserResult, type ExistsFn, type FetchFn, type FetchFnOptions, type FetchFnResponse, type FindCanonicalOptions, type NormalizeOptions, type OnExistsFn, type OnFetchFn, type OnMatchFn, type ParserAdapter, type Probe, type Rewrite, type Tier, addMissingProtocol, bloggerRewrite, defaultFetch, defaultParser, defaultStrippedParams, defaultTiers, feedburnerRewrite, findCanonical, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl, wordpressProbe };
|
|
7
|
+
import { addMissingProtocol, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl, upgradeProtocol } from "./utils.cjs";
|
|
8
|
+
export { type DefaultParserResult, type ExistsFn, type FetchFn, type FetchFnOptions, type FetchFnResponse, type FindCanonicalOptions, type NormalizeOptions, type OnExistsFn, type OnFetchFn, type OnMatchFn, type ParserAdapter, type Probe, type Rewrite, type Tier, addMissingProtocol, bloggerRewrite, defaultFetch, defaultParser, defaultStrippedParams, defaultTiers, feedburnerRewrite, findCanonical, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl, upgradeProtocol, wordpressProbe };
|
package/dist/exports.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ import { findCanonical } from "./index.js";
|
|
|
4
4
|
import { wordpressProbe } from "./probes/wordpress.js";
|
|
5
5
|
import { bloggerRewrite } from "./rewrites/blogger.js";
|
|
6
6
|
import { feedburnerRewrite } from "./rewrites/feedburner.js";
|
|
7
|
-
import { addMissingProtocol, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl } from "./utils.js";
|
|
8
|
-
export { type DefaultParserResult, type ExistsFn, type FetchFn, type FetchFnOptions, type FetchFnResponse, type FindCanonicalOptions, type NormalizeOptions, type OnExistsFn, type OnFetchFn, type OnMatchFn, type ParserAdapter, type Probe, type Rewrite, type Tier, addMissingProtocol, bloggerRewrite, defaultFetch, defaultParser, defaultStrippedParams, defaultTiers, feedburnerRewrite, findCanonical, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl, wordpressProbe };
|
|
7
|
+
import { addMissingProtocol, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl, upgradeProtocol } from "./utils.js";
|
|
8
|
+
export { type DefaultParserResult, type ExistsFn, type FetchFn, type FetchFnOptions, type FetchFnResponse, type FindCanonicalOptions, type NormalizeOptions, type OnExistsFn, type OnFetchFn, type OnMatchFn, type ParserAdapter, type Probe, type Rewrite, type Tier, addMissingProtocol, bloggerRewrite, defaultFetch, defaultParser, defaultStrippedParams, defaultTiers, feedburnerRewrite, findCanonical, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl, upgradeProtocol, wordpressProbe };
|
package/dist/exports.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { addMissingProtocol, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl } from "./utils.js";
|
|
1
|
+
import { addMissingProtocol, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl, upgradeProtocol } from "./utils.js";
|
|
2
2
|
import { defaultFetch, defaultParser, defaultStrippedParams, defaultTiers } from "./defaults.js";
|
|
3
3
|
import { findCanonical } from "./index.js";
|
|
4
4
|
import { wordpressProbe } from "./probes/wordpress.js";
|
|
5
5
|
import { bloggerRewrite } from "./rewrites/blogger.js";
|
|
6
6
|
import { feedburnerRewrite } from "./rewrites/feedburner.js";
|
|
7
|
-
export { addMissingProtocol, bloggerRewrite, defaultFetch, defaultParser, defaultStrippedParams, defaultTiers, feedburnerRewrite, findCanonical, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl, wordpressProbe };
|
|
7
|
+
export { addMissingProtocol, bloggerRewrite, defaultFetch, defaultParser, defaultStrippedParams, defaultTiers, feedburnerRewrite, findCanonical, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl, upgradeProtocol, wordpressProbe };
|
package/dist/utils.cjs
CHANGED
|
@@ -16,6 +16,8 @@ const safePathCharsRegex = /[a-zA-Z0-9._~!$&'()*+,;=:@-]/;
|
|
|
16
16
|
const httpsLetterRegex = /s/i;
|
|
17
17
|
const protocolPrefixRegex = /^https?:\/\//;
|
|
18
18
|
const wwwPrefixRegex = /^www\./;
|
|
19
|
+
const httpProtocolRegex = /^http:\/\//i;
|
|
20
|
+
const httpsProtocolRegex = /^https:\/\//i;
|
|
19
21
|
const validUrlRegex = /^https?:\/\/(?:www\.|[a-vx-z0-9])/i;
|
|
20
22
|
const doubledProtocolRegex = /^\/?[htps]{2,7}[:\s=.\\/]+([htps]{2,7})[:\s=.\\/]+[.,:/]*(www[./]+)?/i;
|
|
21
23
|
const singleMalformedRegex = /^\/?(?:h[htps():]{1,10}|t{1,2}ps?)[:\s=.\\/]+[.,:/]*(www[./]+)?/i;
|
|
@@ -77,6 +79,10 @@ const addMissingProtocol = (url, protocol = "https") => {
|
|
|
77
79
|
if (firstChar === " " || firstChar === " " || firstChar === "\n") return url;
|
|
78
80
|
return `${protocol}://${url}`;
|
|
79
81
|
};
|
|
82
|
+
const upgradeProtocol = (url, protocol = "https") => {
|
|
83
|
+
if (protocol === "https") return url.replace(httpProtocolRegex, "https://");
|
|
84
|
+
return url.replace(httpsProtocolRegex, "http://");
|
|
85
|
+
};
|
|
80
86
|
const resolveUrl = (url, base) => {
|
|
81
87
|
if (url.startsWith("#") && !base) return;
|
|
82
88
|
let resolvedUrl;
|
|
@@ -206,3 +212,4 @@ exports.neutralizeUrls = neutralizeUrls;
|
|
|
206
212
|
exports.normalizeUrl = normalizeUrl;
|
|
207
213
|
exports.resolveFeedProtocol = resolveFeedProtocol;
|
|
208
214
|
exports.resolveUrl = resolveUrl;
|
|
215
|
+
exports.upgradeProtocol = upgradeProtocol;
|
package/dist/utils.d.cts
CHANGED
|
@@ -4,7 +4,8 @@ import { NormalizeOptions } from "./types.cjs";
|
|
|
4
4
|
declare const fixMalformedProtocol: (url: string) => string;
|
|
5
5
|
declare const resolveFeedProtocol: (url: string, protocol?: "http" | "https") => string;
|
|
6
6
|
declare const addMissingProtocol: (url: string, protocol?: "http" | "https") => string;
|
|
7
|
+
declare const upgradeProtocol: (url: string, protocol?: "http" | "https") => string;
|
|
7
8
|
declare const resolveUrl: (url: string, base?: string) => string | undefined;
|
|
8
9
|
declare const normalizeUrl: (url: string, options?: NormalizeOptions) => string;
|
|
9
10
|
//#endregion
|
|
10
|
-
export { addMissingProtocol, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl };
|
|
11
|
+
export { addMissingProtocol, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl, upgradeProtocol };
|
package/dist/utils.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { NormalizeOptions } from "./types.js";
|
|
|
4
4
|
declare const fixMalformedProtocol: (url: string) => string;
|
|
5
5
|
declare const resolveFeedProtocol: (url: string, protocol?: "http" | "https") => string;
|
|
6
6
|
declare const addMissingProtocol: (url: string, protocol?: "http" | "https") => string;
|
|
7
|
+
declare const upgradeProtocol: (url: string, protocol?: "http" | "https") => string;
|
|
7
8
|
declare const resolveUrl: (url: string, base?: string) => string | undefined;
|
|
8
9
|
declare const normalizeUrl: (url: string, options?: NormalizeOptions) => string;
|
|
9
10
|
//#endregion
|
|
10
|
-
export { addMissingProtocol, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl };
|
|
11
|
+
export { addMissingProtocol, fixMalformedProtocol, normalizeUrl, resolveFeedProtocol, resolveUrl, upgradeProtocol };
|
package/dist/utils.js
CHANGED
|
@@ -16,6 +16,8 @@ const safePathCharsRegex = /[a-zA-Z0-9._~!$&'()*+,;=:@-]/;
|
|
|
16
16
|
const httpsLetterRegex = /s/i;
|
|
17
17
|
const protocolPrefixRegex = /^https?:\/\//;
|
|
18
18
|
const wwwPrefixRegex = /^www\./;
|
|
19
|
+
const httpProtocolRegex = /^http:\/\//i;
|
|
20
|
+
const httpsProtocolRegex = /^https:\/\//i;
|
|
19
21
|
const validUrlRegex = /^https?:\/\/(?:www\.|[a-vx-z0-9])/i;
|
|
20
22
|
const doubledProtocolRegex = /^\/?[htps]{2,7}[:\s=.\\/]+([htps]{2,7})[:\s=.\\/]+[.,:/]*(www[./]+)?/i;
|
|
21
23
|
const singleMalformedRegex = /^\/?(?:h[htps():]{1,10}|t{1,2}ps?)[:\s=.\\/]+[.,:/]*(www[./]+)?/i;
|
|
@@ -77,6 +79,10 @@ const addMissingProtocol = (url, protocol = "https") => {
|
|
|
77
79
|
if (firstChar === " " || firstChar === " " || firstChar === "\n") return url;
|
|
78
80
|
return `${protocol}://${url}`;
|
|
79
81
|
};
|
|
82
|
+
const upgradeProtocol = (url, protocol = "https") => {
|
|
83
|
+
if (protocol === "https") return url.replace(httpProtocolRegex, "https://");
|
|
84
|
+
return url.replace(httpsProtocolRegex, "http://");
|
|
85
|
+
};
|
|
80
86
|
const resolveUrl = (url, base) => {
|
|
81
87
|
if (url.startsWith("#") && !base) return;
|
|
82
88
|
let resolvedUrl;
|
|
@@ -197,4 +203,4 @@ const neutralizeUrls = (text, urls) => {
|
|
|
197
203
|
return text.replace(new RegExp(`https?://(?:www\\.)?${hostPattern}(?=[/"]|\\\\")(/)?`, "g"), "/").replace(trailingSlashRegex, "$1$2");
|
|
198
204
|
};
|
|
199
205
|
//#endregion
|
|
200
|
-
export { addMissingProtocol, applyProbes, applyRewrites, createSignature, fixMalformedProtocol, neutralizeUrls, normalizeUrl, resolveFeedProtocol, resolveUrl };
|
|
206
|
+
export { addMissingProtocol, applyProbes, applyRewrites, createSignature, fixMalformedProtocol, neutralizeUrls, normalizeUrl, resolveFeedProtocol, resolveUrl, upgradeProtocol };
|
package/package.json
CHANGED
|
@@ -55,14 +55,13 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"entities": "^7.0.1",
|
|
58
|
-
"feedsmith": "^2.9.
|
|
59
|
-
"typescript": "^6.0.2"
|
|
58
|
+
"feedsmith": "^2.9.4"
|
|
60
59
|
},
|
|
61
60
|
"devDependencies": {
|
|
62
|
-
"@types/bun": "^1.3.
|
|
63
|
-
"kvalita": "1.
|
|
64
|
-
"tsdown": "^0.
|
|
61
|
+
"@types/bun": "^1.3.13",
|
|
62
|
+
"kvalita": "1.13.0",
|
|
63
|
+
"tsdown": "^0.22.0",
|
|
65
64
|
"vitepress": "^2.0.0-alpha.17"
|
|
66
65
|
},
|
|
67
|
-
"version": "1.
|
|
66
|
+
"version": "1.6.0"
|
|
68
67
|
}
|