@libsrcdev/gatsby-remark-images-anywhere 0.1.3 → 0.1.5
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/index.d.ts +84 -2
- package/dist/index.js +138 -70739
- package/package.json +9 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Node, NodePluginArgs } from "gatsby";
|
|
2
2
|
import { FileSystemNode } from "gatsby-source-filesystem";
|
|
3
|
-
import { Literal } from "mdast";
|
|
3
|
+
import { Literal, Literal as RemarkLiteral, Node as RemarkNode } from "mdast";
|
|
4
4
|
|
|
5
5
|
//#region src/custom-http-headers/http-request-header-options.d.ts
|
|
6
6
|
type HttpRequestHeaderOptions = {
|
|
@@ -55,6 +55,87 @@ interface Options extends Partial<MarkupOptions>, HttpRequestHeaderOptions {
|
|
|
55
55
|
[key: string]: unknown;
|
|
56
56
|
}
|
|
57
57
|
//#endregion
|
|
58
|
+
//#region src/constants.d.ts
|
|
59
|
+
declare const CLASS_WRAPPER = "gria-image-wrapper";
|
|
60
|
+
declare const CLASS_PADDING = "gria-image-padding";
|
|
61
|
+
declare const CLASS_LINK = "gria-image-link";
|
|
62
|
+
declare const CLASS_IMAGE = "gria-image";
|
|
63
|
+
declare const CLASS_PLACEHOLDER = "gria-image-placeholder";
|
|
64
|
+
declare const SUPPORT_EXTS: string[];
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/custom-http-headers/is-trusted-url.d.ts
|
|
67
|
+
type UrlCheckOptions = {
|
|
68
|
+
allowedDomains: string[];
|
|
69
|
+
schemes?: string[];
|
|
70
|
+
allowSubdomains?: boolean;
|
|
71
|
+
maxSubdomainDepth?: number;
|
|
72
|
+
allowedPorts?: string[] | null;
|
|
73
|
+
disallowedQueryParams?: string[];
|
|
74
|
+
};
|
|
75
|
+
declare function isTrustedUrl(input: string, options: UrlCheckOptions): boolean;
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/custom-http-headers/http-header-trusted-provider.d.ts
|
|
78
|
+
declare function httpHeaderTrustedProvider(options: UrlCheckOptions, headerBuilder: (url: string) => Record<string, string> | undefined): (url: string) => Record<string, string> | undefined;
|
|
79
|
+
declare function forTrustedDomains(domains: string[], headerBuilder: (url: string) => Record<string, string> | undefined): (url: string) => Record<string, string> | undefined;
|
|
80
|
+
declare const buildRequestHttpHeadersWith: (httpHeaderProviders: HttpRequestHeaderProvider[]) => (url: string) => Record<string, string> | undefined;
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/default-markup.d.ts
|
|
83
|
+
declare const defaultMarkup: CreateMarkup;
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/relative-protocol-whitelist.d.ts
|
|
86
|
+
type MakeWhitelistTest = (whitelist: string[]) => (url: string) => boolean;
|
|
87
|
+
declare const makeWhitelistTest: MakeWhitelistTest;
|
|
88
|
+
declare const isWhitelisted: (url: string) => boolean;
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/util-download-image.d.ts
|
|
91
|
+
declare const downloadImage: ({
|
|
92
|
+
id,
|
|
93
|
+
url,
|
|
94
|
+
getCache,
|
|
95
|
+
getNode,
|
|
96
|
+
touchNode,
|
|
97
|
+
cache,
|
|
98
|
+
createNode,
|
|
99
|
+
createNodeId,
|
|
100
|
+
reporter,
|
|
101
|
+
dangerouslyBuildImageRequestHttpHeaders
|
|
102
|
+
}: any) => Promise<any>;
|
|
103
|
+
declare const processImage: ({
|
|
104
|
+
file,
|
|
105
|
+
reporter,
|
|
106
|
+
cache,
|
|
107
|
+
pathPrefix,
|
|
108
|
+
sharpMethod,
|
|
109
|
+
imageOptions
|
|
110
|
+
}: {
|
|
111
|
+
sharpMethod: SharpMethod;
|
|
112
|
+
} & {
|
|
113
|
+
[key: string]: any;
|
|
114
|
+
}) => Promise<SharpResult>;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/util-html-to-md.d.ts
|
|
117
|
+
type RemarkImageNode = RemarkLiteral & {
|
|
118
|
+
url?: string;
|
|
119
|
+
title?: string;
|
|
120
|
+
alt?: string;
|
|
121
|
+
data: Record<string, any>;
|
|
122
|
+
};
|
|
123
|
+
declare const toMdNode: (node: RemarkLiteral) => RemarkImageNode | null;
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/utils.d.ts
|
|
126
|
+
/**
|
|
127
|
+
* Resolves a potentially incomplete URL to a full URL with protocol
|
|
128
|
+
* @param url - The URL to resolve (can be protocol-relative or full)
|
|
129
|
+
* @returns The full URL with protocol, or null if invalid or relative
|
|
130
|
+
*/
|
|
131
|
+
declare function resolveFullUrl(url: string): string | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* Resolves a relative URL by validating and returning it if it's relative
|
|
134
|
+
* @param url - The URL to check and resolve
|
|
135
|
+
* @returns The relative URL if valid, or undefined if not relative or invalid
|
|
136
|
+
*/
|
|
137
|
+
declare function resolveRelativeUrl(url: string): string | undefined;
|
|
138
|
+
//#endregion
|
|
58
139
|
//#region src/index.d.ts
|
|
59
140
|
declare function remarkImagesAnywhere({
|
|
60
141
|
markdownAST: mdast,
|
|
@@ -69,4 +150,5 @@ declare function remarkImagesAnywhere({
|
|
|
69
150
|
cache,
|
|
70
151
|
pathPrefix
|
|
71
152
|
}: Args, pluginOptions: Options): Promise<(null | undefined)[]>;
|
|
72
|
-
|
|
153
|
+
//#endregion
|
|
154
|
+
export { Args, CLASS_IMAGE, CLASS_LINK, CLASS_PADDING, CLASS_PLACEHOLDER, CLASS_WRAPPER, CreateMarkup, CreateMarkupArgs, HttpRequestHeaderOptions, HttpRequestHeaderProvider, MarkupOptions, Options, RemarkImageNode, type RemarkLiteral, type RemarkNode, SUPPORT_EXTS, SharpMethod, SharpResult, UrlCheckOptions, buildRequestHttpHeadersWith, remarkImagesAnywhere as default, defaultMarkup, downloadImage, forTrustedDomains, httpHeaderTrustedProvider, isTrustedUrl, isWhitelisted, makeWhitelistTest, processImage, resolveFullUrl, resolveRelativeUrl, toMdNode };
|