feedcanon 0.9.0 → 0.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.
@@ -1,6 +1,6 @@
1
- import { ExistsFn, FetchFn, FetchFnOptions, FetchFnResponse, FindCanonicalOptions, NormalizeOptions, OnExistsFn, OnFetchFn, OnMatchFn, ParserAdapter, PlatformHandler } from "./types.cjs";
1
+ import { ExistsFn, FeedsmithFeed, FetchFn, FetchFnOptions, FetchFnResponse, FindCanonicalOptions, NormalizeOptions, OnExistsFn, OnFetchFn, OnMatchFn, ParserAdapter, PlatformHandler } from "./types.cjs";
2
2
  import { defaultPlatforms, defaultStrippedParams, defaultTiers } from "./defaults.cjs";
3
3
  import { findCanonical } from "./index.cjs";
4
4
  import { feedburnerHandler } from "./platforms/feedburner.cjs";
5
5
  import { addMissingProtocol, feedsmithParser, normalizeUrl, resolveFeedProtocol, resolveUrl } from "./utils.cjs";
6
- export { type ExistsFn, type FetchFn, type FetchFnOptions, type FetchFnResponse, type FindCanonicalOptions, type NormalizeOptions, type OnExistsFn, type OnFetchFn, type OnMatchFn, type ParserAdapter, type PlatformHandler, addMissingProtocol, defaultPlatforms, defaultStrippedParams, defaultTiers, feedburnerHandler, feedsmithParser, findCanonical, normalizeUrl, resolveFeedProtocol, resolveUrl };
6
+ export { type ExistsFn, type FeedsmithFeed, type FetchFn, type FetchFnOptions, type FetchFnResponse, type FindCanonicalOptions, type NormalizeOptions, type OnExistsFn, type OnFetchFn, type OnMatchFn, type ParserAdapter, type PlatformHandler, addMissingProtocol, defaultPlatforms, defaultStrippedParams, defaultTiers, feedburnerHandler, feedsmithParser, findCanonical, normalizeUrl, resolveFeedProtocol, resolveUrl };
package/dist/exports.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { ExistsFn, FetchFn, FetchFnOptions, FetchFnResponse, FindCanonicalOptions, NormalizeOptions, OnExistsFn, OnFetchFn, OnMatchFn, ParserAdapter, PlatformHandler } from "./types.js";
1
+ import { ExistsFn, FeedsmithFeed, FetchFn, FetchFnOptions, FetchFnResponse, FindCanonicalOptions, NormalizeOptions, OnExistsFn, OnFetchFn, OnMatchFn, ParserAdapter, PlatformHandler } from "./types.js";
2
2
  import { defaultPlatforms, defaultStrippedParams, defaultTiers } from "./defaults.js";
3
3
  import { findCanonical } from "./index.js";
4
4
  import { feedburnerHandler } from "./platforms/feedburner.js";
5
5
  import { addMissingProtocol, feedsmithParser, normalizeUrl, resolveFeedProtocol, resolveUrl } from "./utils.js";
6
- export { type ExistsFn, type FetchFn, type FetchFnOptions, type FetchFnResponse, type FindCanonicalOptions, type NormalizeOptions, type OnExistsFn, type OnFetchFn, type OnMatchFn, type ParserAdapter, type PlatformHandler, addMissingProtocol, defaultPlatforms, defaultStrippedParams, defaultTiers, feedburnerHandler, feedsmithParser, findCanonical, normalizeUrl, resolveFeedProtocol, resolveUrl };
6
+ export { type ExistsFn, type FeedsmithFeed, type FetchFn, type FetchFnOptions, type FetchFnResponse, type FindCanonicalOptions, type NormalizeOptions, type OnExistsFn, type OnFetchFn, type OnMatchFn, type ParserAdapter, type PlatformHandler, addMissingProtocol, defaultPlatforms, defaultStrippedParams, defaultTiers, feedburnerHandler, feedsmithParser, findCanonical, normalizeUrl, resolveFeedProtocol, resolveUrl };
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { FindCanonicalOptions } from "./types.cjs";
1
+ import { FeedsmithFeed, FindCanonicalOptions } from "./types.cjs";
2
2
 
3
3
  //#region src/index.d.ts
4
- declare const findCanonical: <TFeed, TExisting>(inputUrl: string, options?: FindCanonicalOptions<TFeed, TExisting>) => Promise<string | undefined>;
4
+ declare const findCanonical: <TFeed = FeedsmithFeed, TExisting = unknown>(inputUrl: string, options?: FindCanonicalOptions<TFeed, TExisting>) => Promise<string | undefined>;
5
5
  //#endregion
6
6
  export { findCanonical };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { FindCanonicalOptions } from "./types.js";
1
+ import { FeedsmithFeed, FindCanonicalOptions } from "./types.js";
2
2
 
3
3
  //#region src/index.d.ts
4
- declare const findCanonical: <TFeed, TExisting>(inputUrl: string, options?: FindCanonicalOptions<TFeed, TExisting>) => Promise<string | undefined>;
4
+ declare const findCanonical: <TFeed = FeedsmithFeed, TExisting = unknown>(inputUrl: string, options?: FindCanonicalOptions<TFeed, TExisting>) => Promise<string | undefined>;
5
5
  //#endregion
6
6
  export { findCanonical };
package/dist/types.d.cts CHANGED
@@ -1,4 +1,7 @@
1
+ import * as feedsmith0 from "feedsmith";
2
+
1
3
  //#region src/types.d.ts
4
+ type FeedsmithFeed = ReturnType<typeof feedsmith0.parseFeed>;
2
5
  type ParserAdapter<T> = {
3
6
  parse: (body: string) => T | undefined;
4
7
  getSelfUrl: (parsed: T) => string | undefined;
@@ -39,7 +42,7 @@ type OnExistsFn<T> = (data: {
39
42
  data: T;
40
43
  }) => void;
41
44
  type ExistsFn<T = unknown> = (url: string) => Promise<T | undefined>;
42
- type FindCanonicalOptions<TFeed = unknown, TExisting = unknown> = {
45
+ type FindCanonicalOptions<TFeed = FeedsmithFeed, TExisting = unknown> = {
43
46
  parser?: ParserAdapter<TFeed>;
44
47
  fetchFn?: FetchFn;
45
48
  existsFn?: ExistsFn<TExisting>;
@@ -61,4 +64,4 @@ type FetchFnResponse = {
61
64
  };
62
65
  type FetchFn = (url: string, options?: FetchFnOptions) => Promise<FetchFnResponse>;
63
66
  //#endregion
64
- export { ExistsFn, FetchFn, FetchFnOptions, FetchFnResponse, FindCanonicalOptions, NormalizeOptions, OnExistsFn, OnFetchFn, OnMatchFn, ParserAdapter, PlatformHandler };
67
+ export { ExistsFn, FeedsmithFeed, FetchFn, FetchFnOptions, FetchFnResponse, FindCanonicalOptions, NormalizeOptions, OnExistsFn, OnFetchFn, OnMatchFn, ParserAdapter, PlatformHandler };
package/dist/types.d.ts CHANGED
@@ -1,4 +1,7 @@
1
+ import * as feedsmith0 from "feedsmith";
2
+
1
3
  //#region src/types.d.ts
4
+ type FeedsmithFeed = ReturnType<typeof feedsmith0.parseFeed>;
2
5
  type ParserAdapter<T> = {
3
6
  parse: (body: string) => T | undefined;
4
7
  getSelfUrl: (parsed: T) => string | undefined;
@@ -39,7 +42,7 @@ type OnExistsFn<T> = (data: {
39
42
  data: T;
40
43
  }) => void;
41
44
  type ExistsFn<T = unknown> = (url: string) => Promise<T | undefined>;
42
- type FindCanonicalOptions<TFeed = unknown, TExisting = unknown> = {
45
+ type FindCanonicalOptions<TFeed = FeedsmithFeed, TExisting = unknown> = {
43
46
  parser?: ParserAdapter<TFeed>;
44
47
  fetchFn?: FetchFn;
45
48
  existsFn?: ExistsFn<TExisting>;
@@ -61,4 +64,4 @@ type FetchFnResponse = {
61
64
  };
62
65
  type FetchFn = (url: string, options?: FetchFnOptions) => Promise<FetchFnResponse>;
63
66
  //#endregion
64
- export { ExistsFn, FetchFn, FetchFnOptions, FetchFnResponse, FindCanonicalOptions, NormalizeOptions, OnExistsFn, OnFetchFn, OnMatchFn, ParserAdapter, PlatformHandler };
67
+ export { ExistsFn, FeedsmithFeed, FetchFn, FetchFnOptions, FetchFnResponse, FindCanonicalOptions, NormalizeOptions, OnExistsFn, OnFetchFn, OnMatchFn, ParserAdapter, PlatformHandler };
package/dist/utils.cjs CHANGED
@@ -136,9 +136,7 @@ const feedsmithParser = {
136
136
  parse: (body) => {
137
137
  try {
138
138
  return (0, feedsmith.parseFeed)(body);
139
- } catch {
140
- return;
141
- }
139
+ } catch {}
142
140
  },
143
141
  getSelfUrl: (parsed) => {
144
142
  switch (parsed.format) {
package/dist/utils.d.cts CHANGED
@@ -1,11 +1,10 @@
1
- import { NormalizeOptions, ParserAdapter } from "./types.cjs";
2
- import { parseFeed } from "feedsmith";
1
+ import { FeedsmithFeed, NormalizeOptions, ParserAdapter } from "./types.cjs";
3
2
 
4
3
  //#region src/utils.d.ts
5
4
  declare const resolveFeedProtocol: (url: string, protocol?: "http" | "https") => string;
6
5
  declare const addMissingProtocol: (url: string, protocol?: "http" | "https") => string;
7
6
  declare const resolveUrl: (url: string, base?: string) => string | undefined;
8
7
  declare const normalizeUrl: (url: string, options?: NormalizeOptions) => string;
9
- declare const feedsmithParser: ParserAdapter<ReturnType<typeof parseFeed>>;
8
+ declare const feedsmithParser: ParserAdapter<FeedsmithFeed>;
10
9
  //#endregion
11
10
  export { addMissingProtocol, feedsmithParser, normalizeUrl, resolveFeedProtocol, resolveUrl };
package/dist/utils.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- import { NormalizeOptions, ParserAdapter } from "./types.js";
2
- import { parseFeed } from "feedsmith";
1
+ import { FeedsmithFeed, NormalizeOptions, ParserAdapter } from "./types.js";
3
2
 
4
3
  //#region src/utils.d.ts
5
4
  declare const resolveFeedProtocol: (url: string, protocol?: "http" | "https") => string;
6
5
  declare const addMissingProtocol: (url: string, protocol?: "http" | "https") => string;
7
6
  declare const resolveUrl: (url: string, base?: string) => string | undefined;
8
7
  declare const normalizeUrl: (url: string, options?: NormalizeOptions) => string;
9
- declare const feedsmithParser: ParserAdapter<ReturnType<typeof parseFeed>>;
8
+ declare const feedsmithParser: ParserAdapter<FeedsmithFeed>;
10
9
  //#endregion
11
10
  export { addMissingProtocol, feedsmithParser, normalizeUrl, resolveFeedProtocol, resolveUrl };
package/dist/utils.js CHANGED
@@ -136,9 +136,7 @@ const feedsmithParser = {
136
136
  parse: (body) => {
137
137
  try {
138
138
  return parseFeed(body);
139
- } catch {
140
- return;
141
- }
139
+ } catch {}
142
140
  },
143
141
  getSelfUrl: (parsed) => {
144
142
  switch (parsed.format) {
package/package.json CHANGED
@@ -60,5 +60,5 @@
60
60
  "kvalita": "1.9.0",
61
61
  "tsdown": "^0.18.2"
62
62
  },
63
- "version": "0.9.0"
63
+ "version": "0.9.2"
64
64
  }