@frybynite/image-cloud 0.6.5 → 0.7.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.
Files changed (38) hide show
  1. package/README.md +1 -28
  2. package/dist/image-cloud-auto-init.js +759 -345
  3. package/dist/image-cloud-auto-init.js.map +1 -1
  4. package/dist/image-cloud.js +1040 -1085
  5. package/dist/image-cloud.js.map +1 -1
  6. package/dist/image-cloud.umd.js +5 -5
  7. package/dist/image-cloud.umd.js.map +1 -1
  8. package/dist/index.d.ts +0 -31
  9. package/dist/react.d.ts +0 -31
  10. package/dist/react.js +848 -434
  11. package/dist/react.js.map +1 -1
  12. package/dist/vue.d.ts +0 -31
  13. package/dist/vue.js +856 -442
  14. package/dist/vue.js.map +1 -1
  15. package/dist/web-component.d.ts +0 -31
  16. package/dist/web-component.js +843 -429
  17. package/dist/web-component.js.map +1 -1
  18. package/package.json +14 -27
  19. package/dist/composite-BSJXKGwG.js +0 -63
  20. package/dist/composite-BSJXKGwG.js.map +0 -1
  21. package/dist/google-drive-DK2v0Xay.js +0 -227
  22. package/dist/google-drive-DK2v0Xay.js.map +0 -1
  23. package/dist/image-cloud-CO9PMUGK.js +0 -38
  24. package/dist/image-cloud-CO9PMUGK.js.map +0 -1
  25. package/dist/loaders/all.d.ts +0 -1683
  26. package/dist/loaders/all.js +0 -463
  27. package/dist/loaders/all.js.map +0 -1
  28. package/dist/loaders/composite.d.ts +0 -1683
  29. package/dist/loaders/composite.js +0 -63
  30. package/dist/loaders/composite.js.map +0 -1
  31. package/dist/loaders/google-drive.d.ts +0 -1683
  32. package/dist/loaders/google-drive.js +0 -227
  33. package/dist/loaders/google-drive.js.map +0 -1
  34. package/dist/loaders/static.d.ts +0 -1683
  35. package/dist/loaders/static.js +0 -186
  36. package/dist/loaders/static.js.map +0 -1
  37. package/dist/static-D9YjTesh.js +0 -186
  38. package/dist/static-D9YjTesh.js.map +0 -1
@@ -1,186 +0,0 @@
1
- import { LoaderRegistry as n } from "@frybynite/image-cloud";
2
- class a {
3
- constructor(e) {
4
- if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = e.validateUrls !== !1, this.validationTimeout = e.validationTimeout ?? 5e3, this.validationMethod = e.validationMethod ?? "head", this.debugLogging = e.debugLogging ?? !1, this.sources = e.sources ?? [], !this.sources || this.sources.length === 0)
5
- throw new Error("StaticImageLoader requires at least one source to be configured");
6
- this.log("StaticImageLoader initialized with config:", e);
7
- }
8
- /**
9
- * Prepare the loader by discovering all images from configured sources
10
- * @param filter - Filter to apply to discovered images
11
- */
12
- async prepare(e) {
13
- this._discoveredUrls = [], this.log(`Processing ${this.sources.length} source(s)`);
14
- for (const r of this.sources)
15
- try {
16
- const t = await this.processSource(r, e);
17
- this._discoveredUrls.push(...t);
18
- } catch (t) {
19
- console.warn("Failed to process source:", r, t);
20
- }
21
- this._prepared = !0, this.log(`Successfully loaded ${this._discoveredUrls.length} image(s)`);
22
- }
23
- /**
24
- * Get the number of discovered images
25
- * @throws Error if called before prepare()
26
- */
27
- imagesLength() {
28
- if (!this._prepared)
29
- throw new Error("StaticImageLoader.imagesLength() called before prepare()");
30
- return this._discoveredUrls.length;
31
- }
32
- /**
33
- * Get the ordered list of image URLs
34
- * @throws Error if called before prepare()
35
- */
36
- imageURLs() {
37
- if (!this._prepared)
38
- throw new Error("StaticImageLoader.imageURLs() called before prepare()");
39
- return [...this._discoveredUrls];
40
- }
41
- /**
42
- * Check if the loader has been prepared
43
- */
44
- isPrepared() {
45
- return this._prepared;
46
- }
47
- /**
48
- * Process a single source object using shape-based detection
49
- * @param source - Source configuration detected by key presence
50
- * @param filter - Filter to apply to discovered images
51
- * @returns Promise resolving to array of valid URLs from this source
52
- */
53
- async processSource(e, r) {
54
- return e ? "urls" in e ? await this.processUrls(e.urls, r) : "path" in e ? await this.processPath(e.path, e.files, r) : "json" in e ? await this.processJson(e.json, r) : (console.warn("Unknown source shape:", e), []) : (console.warn("Invalid source object:", e), []);
55
- }
56
- /**
57
- * Process a list of direct URLs
58
- * @param urls - Array of image URLs
59
- * @param filter - Filter to apply to discovered images
60
- * @returns Promise resolving to array of validated URLs
61
- */
62
- async processUrls(e, r) {
63
- if (!Array.isArray(e))
64
- return console.warn("URLs must be an array:", e), [];
65
- const t = [];
66
- for (const i of e) {
67
- const s = i.split("/").pop() || i;
68
- if (!r.isAllowed(s)) {
69
- this.log(`Skipping filtered URL: ${i}`);
70
- continue;
71
- }
72
- this.validateUrls ? await this.validateUrl(i) ? t.push(i) : console.warn(`Skipping invalid/missing URL: ${i}`) : t.push(i);
73
- }
74
- return t;
75
- }
76
- /**
77
- * Process a path-based source
78
- * @param basePath - Base path (relative or absolute)
79
- * @param files - Array of filenames
80
- * @param filter - Filter to apply to discovered images
81
- * @returns Promise resolving to array of validated URLs
82
- */
83
- async processPath(e, r, t) {
84
- if (!Array.isArray(r))
85
- return console.warn("files must be an array:", r), [];
86
- const i = [];
87
- for (const s of r) {
88
- if (!t.isAllowed(s)) {
89
- this.log(`Skipping filtered file: ${s}`);
90
- continue;
91
- }
92
- const o = this.constructUrl(e, s);
93
- this.validateUrls ? await this.validateUrl(o) ? i.push(o) : console.warn(`Skipping invalid/missing file: ${o}`) : i.push(o);
94
- }
95
- return i;
96
- }
97
- /**
98
- * Process a JSON endpoint source
99
- * Fetches a JSON endpoint that returns { images: string[] }
100
- * @param url - JSON endpoint URL
101
- * @param filter - Filter to apply to discovered images
102
- * @returns Promise resolving to array of validated URLs
103
- */
104
- async processJson(e, r) {
105
- this.log(`Fetching JSON endpoint: ${e}`);
106
- const t = new AbortController(), i = setTimeout(() => t.abort(), 1e4);
107
- try {
108
- const s = await fetch(e, { signal: t.signal });
109
- if (clearTimeout(i), !s.ok)
110
- throw new Error(`HTTP ${s.status} fetching ${e}`);
111
- const o = await s.json();
112
- if (!o || !Array.isArray(o.images))
113
- throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');
114
- return this.log(`JSON endpoint returned ${o.images.length} image(s)`), await this.processUrls(o.images, r);
115
- } catch (s) {
116
- throw clearTimeout(i), s instanceof Error && s.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${e}`) : s;
117
- }
118
- }
119
- /**
120
- * Validate a single URL using HEAD request
121
- * @param url - URL to validate
122
- * @returns Promise resolving to true if valid and accessible
123
- */
124
- async validateUrl(e) {
125
- if (this.validationMethod === "none")
126
- return !0;
127
- if (this.validationMethod === "simple")
128
- try {
129
- return typeof window < "u" ? new URL(e, window.location.origin) : new URL(e), !0;
130
- } catch {
131
- return !1;
132
- }
133
- if (typeof window > "u")
134
- return !0;
135
- if (!(e.startsWith(window.location.origin) || e.startsWith("/")))
136
- return this.log(`Skipping validation for cross-origin URL: ${e}`), !0;
137
- try {
138
- const t = new AbortController(), i = setTimeout(() => t.abort(), this.validationTimeout), s = await fetch(e, {
139
- method: "HEAD",
140
- signal: t.signal
141
- });
142
- return clearTimeout(i), s.ok ? !0 : (this.log(`Validation failed for ${e}: HTTP ${s.status}`), !1);
143
- } catch (t) {
144
- return t instanceof Error && (t.name === "AbortError" ? this.log(`Validation timeout for ${e}`) : this.log(`Validation failed for ${e}:`, t.message)), !1;
145
- }
146
- }
147
- /**
148
- * Construct full URL from basePath and filename
149
- * @param basePath - Base path (relative or absolute)
150
- * @param filename - Filename to append
151
- * @returns Complete URL
152
- */
153
- constructUrl(e, r) {
154
- const t = e.replace(/\/$/, "");
155
- if (this.isAbsoluteUrl(e))
156
- return `${t}/${r}`;
157
- if (typeof window > "u")
158
- return `${t}/${r}`;
159
- const i = window.location.origin, o = (e.startsWith("/") ? e : "/" + e).replace(/\/$/, "");
160
- return `${i}${o}/${r}`;
161
- }
162
- /**
163
- * Check if URL is absolute (contains protocol)
164
- * @param url - URL to check
165
- * @returns True if absolute URL
166
- */
167
- isAbsoluteUrl(e) {
168
- try {
169
- return new URL(e), !0;
170
- } catch {
171
- return !1;
172
- }
173
- }
174
- /**
175
- * Debug logging helper
176
- * @param args - Arguments to log
177
- */
178
- log(...e) {
179
- this.debugLogging && typeof console < "u" && console.log(...e);
180
- }
181
- }
182
- n.registerLoader("static", a);
183
- export {
184
- a as StaticImageLoader
185
- };
186
- //# sourceMappingURL=static.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"static.js","sources":["../../src/loaders/StaticImageLoader.ts","../../src/loaders/index-static.ts"],"sourcesContent":["/**\n * StaticImageLoader.ts\n * Loads images from predefined URL sources and local paths\n * Compatible with ImageCloud's loader interface\n *\n * Public API:\n * - prepare(filter) - Async discovery of images\n * - imagesLength() - Get count of discovered images\n * - imageURLs() - Get ordered list of image URLs\n * - isPrepared() - Check if loader has been prepared\n */\n\nimport type { ImageLoader, IImageFilter, StaticSource, StaticLoaderInnerConfig } from '../config/types';\n\nexport class StaticImageLoader implements ImageLoader {\n private validateUrls: boolean;\n private validationTimeout: number;\n private validationMethod: 'head' | 'simple' | 'none';\n private sources: StaticSource[];\n private debugLogging: boolean;\n\n // State for new interface\n private _prepared: boolean = false;\n private _discoveredUrls: string[] = [];\n\n constructor(config: StaticLoaderInnerConfig) {\n this.validateUrls = config.validateUrls !== false;\n this.validationTimeout = config.validationTimeout ?? 5000;\n this.validationMethod = config.validationMethod ?? 'head';\n this.debugLogging = config.debugLogging ?? false;\n this.sources = config.sources ?? [];\n\n // Validate that we have sources configured\n if (!this.sources || this.sources.length === 0) {\n throw new Error('StaticImageLoader requires at least one source to be configured');\n }\n\n this.log('StaticImageLoader initialized with config:', config);\n }\n\n /**\n * Prepare the loader by discovering all images from configured sources\n * @param filter - Filter to apply to discovered images\n */\n async prepare(filter: IImageFilter): Promise<void> {\n this._discoveredUrls = [];\n\n this.log(`Processing ${this.sources.length} source(s)`);\n\n // Process sources sequentially to preserve order\n for (const source of this.sources) {\n try {\n const urls = await this.processSource(source, filter);\n this._discoveredUrls.push(...urls);\n } catch (error) {\n console.warn('Failed to process source:', source, error);\n // Continue processing other sources\n }\n }\n\n this._prepared = true;\n this.log(`Successfully loaded ${this._discoveredUrls.length} image(s)`);\n }\n\n /**\n * Get the number of discovered images\n * @throws Error if called before prepare()\n */\n imagesLength(): number {\n if (!this._prepared) {\n throw new Error('StaticImageLoader.imagesLength() called before prepare()');\n }\n return this._discoveredUrls.length;\n }\n\n /**\n * Get the ordered list of image URLs\n * @throws Error if called before prepare()\n */\n imageURLs(): string[] {\n if (!this._prepared) {\n throw new Error('StaticImageLoader.imageURLs() called before prepare()');\n }\n return [...this._discoveredUrls];\n }\n\n /**\n * Check if the loader has been prepared\n */\n isPrepared(): boolean {\n return this._prepared;\n }\n\n /**\n * Process a single source object using shape-based detection\n * @param source - Source configuration detected by key presence\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of valid URLs from this source\n */\n private async processSource(source: StaticSource, filter: IImageFilter): Promise<string[]> {\n if (!source) {\n console.warn('Invalid source object:', source);\n return [];\n }\n\n if ('urls' in source) {\n return await this.processUrls(source.urls, filter);\n } else if ('path' in source) {\n return await this.processPath(source.path, source.files, filter);\n } else if ('json' in source) {\n return await this.processJson(source.json, filter);\n } else {\n console.warn('Unknown source shape:', source);\n return [];\n }\n }\n\n /**\n * Process a list of direct URLs\n * @param urls - Array of image URLs\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of validated URLs\n */\n private async processUrls(urls: string[], filter: IImageFilter): Promise<string[]> {\n if (!Array.isArray(urls)) {\n console.warn('URLs must be an array:', urls);\n return [];\n }\n\n const validUrls: string[] = [];\n\n for (const url of urls) {\n // Apply filter based on URL filename\n const filename = url.split('/').pop() || url;\n if (!filter.isAllowed(filename)) {\n this.log(`Skipping filtered URL: ${url}`);\n continue;\n }\n\n if (this.validateUrls) {\n const isValid = await this.validateUrl(url);\n if (isValid) {\n validUrls.push(url);\n } else {\n console.warn(`Skipping invalid/missing URL: ${url}`);\n }\n } else {\n // No validation - add all URLs\n validUrls.push(url);\n }\n }\n\n return validUrls;\n }\n\n /**\n * Process a path-based source\n * @param basePath - Base path (relative or absolute)\n * @param files - Array of filenames\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of validated URLs\n */\n private async processPath(basePath: string, files: string[], filter: IImageFilter): Promise<string[]> {\n\n if (!Array.isArray(files)) {\n console.warn('files must be an array:', files);\n return [];\n }\n\n const validUrls: string[] = [];\n\n for (const file of files) {\n // Apply filter based on filename\n if (!filter.isAllowed(file)) {\n this.log(`Skipping filtered file: ${file}`);\n continue;\n }\n\n const url = this.constructUrl(basePath, file);\n\n if (this.validateUrls) {\n const isValid = await this.validateUrl(url);\n if (isValid) {\n validUrls.push(url);\n } else {\n console.warn(`Skipping invalid/missing file: ${url}`);\n }\n } else {\n // No validation - add all URLs\n validUrls.push(url);\n }\n }\n\n return validUrls;\n }\n\n /**\n * Process a JSON endpoint source\n * Fetches a JSON endpoint that returns { images: string[] }\n * @param url - JSON endpoint URL\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of validated URLs\n */\n private async processJson(url: string, filter: IImageFilter): Promise<string[]> {\n\n this.log(`Fetching JSON endpoint: ${url}`);\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), 10000);\n\n try {\n const response = await fetch(url, { signal: controller.signal });\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status} fetching ${url}`);\n }\n\n const data = await response.json();\n\n if (!data || !Array.isArray(data.images)) {\n throw new Error(`JSON source must return JSON with shape { \"images\": [\"url1\", \"url2\", ...] }`);\n }\n\n this.log(`JSON endpoint returned ${data.images.length} image(s)`);\n\n // Process the URLs through the standard URL processing pipeline\n return await this.processUrls(data.images, filter);\n } catch (error) {\n clearTimeout(timeoutId);\n if (error instanceof Error && error.name === 'AbortError') {\n throw new Error(`Timeout fetching JSON endpoint: ${url}`);\n }\n throw error;\n }\n }\n\n /**\n * Validate a single URL using HEAD request\n * @param url - URL to validate\n * @returns Promise resolving to true if valid and accessible\n */\n private async validateUrl(url: string): Promise<boolean> {\n if (this.validationMethod === 'none') {\n return true;\n }\n\n if (this.validationMethod === 'simple') {\n // Basic URL format check\n try {\n if (typeof window !== 'undefined') {\n new URL(url, window.location.origin);\n } else {\n new URL(url);\n }\n return true;\n } catch {\n return false;\n }\n }\n\n // validationMethod === 'head' (default)\n // For cross-origin URLs, we can't validate due to CORS\n // So we only validate same-origin URLs\n if (typeof window === 'undefined') {\n return true; // In non-browser environment, assume valid\n }\n\n const isSameOrigin = url.startsWith(window.location.origin) ||\n url.startsWith('/');\n\n if (!isSameOrigin) {\n // Cross-origin URL - assume valid, can't validate due to CORS\n this.log(`Skipping validation for cross-origin URL: ${url}`);\n return true;\n }\n\n // Same-origin URL - validate with HEAD request\n try {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.validationTimeout);\n\n const response = await fetch(url, {\n method: 'HEAD',\n signal: controller.signal\n });\n\n clearTimeout(timeoutId);\n\n if (response.ok) {\n return true;\n } else {\n this.log(`Validation failed for ${url}: HTTP ${response.status}`);\n return false;\n }\n\n } catch (error) {\n if (error instanceof Error) {\n if (error.name === 'AbortError') {\n this.log(`Validation timeout for ${url}`);\n } else {\n this.log(`Validation failed for ${url}:`, error.message);\n }\n }\n return false;\n }\n }\n\n /**\n * Construct full URL from basePath and filename\n * @param basePath - Base path (relative or absolute)\n * @param filename - Filename to append\n * @returns Complete URL\n */\n private constructUrl(basePath: string, filename: string): string {\n // Remove trailing slash from basePath\n const cleanBase = basePath.replace(/\\/$/, '');\n\n // Check if basePath is absolute URL\n if (this.isAbsoluteUrl(basePath)) {\n return `${cleanBase}/${filename}`;\n }\n\n // Relative path - prepend current origin\n if (typeof window === 'undefined') {\n return `${cleanBase}/${filename}`; // In non-browser environment, return as-is\n }\n\n const origin = window.location.origin;\n // Ensure basePath starts with /\n const normalizedPath = basePath.startsWith('/') ? basePath : '/' + basePath;\n const cleanPath = normalizedPath.replace(/\\/$/, '');\n\n return `${origin}${cleanPath}/${filename}`;\n }\n\n /**\n * Check if URL is absolute (contains protocol)\n * @param url - URL to check\n * @returns True if absolute URL\n */\n private isAbsoluteUrl(url: string): boolean {\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Debug logging helper\n * @param args - Arguments to log\n */\n private log(...args: unknown[]): void {\n if (this.debugLogging && typeof console !== 'undefined') {\n console.log(...args);\n }\n }\n}\n","import { LoaderRegistry } from '@frybynite/image-cloud';\nimport { StaticImageLoader } from './StaticImageLoader';\n\nLoaderRegistry.registerLoader('static', StaticImageLoader);\n\nexport { StaticImageLoader };\n"],"names":["StaticImageLoader","config","filter","source","urls","error","validUrls","url","filename","basePath","files","file","controller","timeoutId","response","data","cleanBase","origin","cleanPath","args","LoaderRegistry"],"mappings":";AAcO,MAAMA,EAAyC;AAAA,EAWpD,YAAYC,GAAiC;AAQ3C,QAXF,KAAQ,YAAqB,IAC7B,KAAQ,kBAA4B,CAAA,GAGlC,KAAK,eAAeA,EAAO,iBAAiB,IAC5C,KAAK,oBAAoBA,EAAO,qBAAqB,KACrD,KAAK,mBAAmBA,EAAO,oBAAoB,QACnD,KAAK,eAAeA,EAAO,gBAAgB,IAC3C,KAAK,UAAUA,EAAO,WAAW,CAAA,GAG7B,CAAC,KAAK,WAAW,KAAK,QAAQ,WAAW;AAC3C,YAAM,IAAI,MAAM,iEAAiE;AAGnF,SAAK,IAAI,8CAA8CA,CAAM;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,QAAQC,GAAqC;AACjD,SAAK,kBAAkB,CAAA,GAEvB,KAAK,IAAI,cAAc,KAAK,QAAQ,MAAM,YAAY;AAGtD,eAAWC,KAAU,KAAK;AACxB,UAAI;AACF,cAAMC,IAAO,MAAM,KAAK,cAAcD,GAAQD,CAAM;AACpD,aAAK,gBAAgB,KAAK,GAAGE,CAAI;AAAA,MACnC,SAASC,GAAO;AACd,gBAAQ,KAAK,6BAA6BF,GAAQE,CAAK;AAAA,MAEzD;AAGF,SAAK,YAAY,IACjB,KAAK,IAAI,uBAAuB,KAAK,gBAAgB,MAAM,WAAW;AAAA,EACxE;AAAA;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;AAC7B,aAAO,GAAGO,CAAS,IAAIR,CAAQ;AAIjC,QAAI,OAAO,SAAW;AACpB,aAAO,GAAGQ,CAAS,IAAIR,CAAQ;AAGjC,UAAMS,IAAS,OAAO,SAAS,QAGzBC,KADiBT,EAAS,WAAW,GAAG,IAAIA,IAAW,MAAMA,GAClC,QAAQ,OAAO,EAAE;AAElD,WAAO,GAAGQ,CAAM,GAAGC,CAAS,IAAIV,CAAQ;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOQ,cAAcD,GAAsB;AAC1C,QAAI;AACF,iBAAI,IAAIA,CAAG,GACJ;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMQ,OAAOY,GAAuB;AACpC,IAAI,KAAK,gBAAgB,OAAO,UAAY,OAC1C,QAAQ,IAAI,GAAGA,CAAI;AAAA,EAEvB;AACF;ACpWAC,EAAe,eAAe,UAAUpB,CAAiB;"}
@@ -1,186 +0,0 @@
1
- import { e as a } from "./image-cloud-CO9PMUGK.js";
2
- class n {
3
- constructor(t) {
4
- if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = t.validateUrls !== !1, this.validationTimeout = t.validationTimeout ?? 5e3, this.validationMethod = t.validationMethod ?? "head", this.debugLogging = t.debugLogging ?? !1, this.sources = t.sources ?? [], !this.sources || this.sources.length === 0)
5
- throw new Error("StaticImageLoader requires at least one source to be configured");
6
- this.log("StaticImageLoader initialized with config:", t);
7
- }
8
- /**
9
- * Prepare the loader by discovering all images from configured sources
10
- * @param filter - Filter to apply to discovered images
11
- */
12
- async prepare(t) {
13
- this._discoveredUrls = [], this.log(`Processing ${this.sources.length} source(s)`);
14
- for (const r of this.sources)
15
- try {
16
- const s = await this.processSource(r, t);
17
- this._discoveredUrls.push(...s);
18
- } catch (s) {
19
- console.warn("Failed to process source:", r, s);
20
- }
21
- this._prepared = !0, this.log(`Successfully loaded ${this._discoveredUrls.length} image(s)`);
22
- }
23
- /**
24
- * Get the number of discovered images
25
- * @throws Error if called before prepare()
26
- */
27
- imagesLength() {
28
- if (!this._prepared)
29
- throw new Error("StaticImageLoader.imagesLength() called before prepare()");
30
- return this._discoveredUrls.length;
31
- }
32
- /**
33
- * Get the ordered list of image URLs
34
- * @throws Error if called before prepare()
35
- */
36
- imageURLs() {
37
- if (!this._prepared)
38
- throw new Error("StaticImageLoader.imageURLs() called before prepare()");
39
- return [...this._discoveredUrls];
40
- }
41
- /**
42
- * Check if the loader has been prepared
43
- */
44
- isPrepared() {
45
- return this._prepared;
46
- }
47
- /**
48
- * Process a single source object using shape-based detection
49
- * @param source - Source configuration detected by key presence
50
- * @param filter - Filter to apply to discovered images
51
- * @returns Promise resolving to array of valid URLs from this source
52
- */
53
- async processSource(t, r) {
54
- return t ? "urls" in t ? await this.processUrls(t.urls, r) : "path" in t ? await this.processPath(t.path, t.files, r) : "json" in t ? await this.processJson(t.json, r) : (console.warn("Unknown source shape:", t), []) : (console.warn("Invalid source object:", t), []);
55
- }
56
- /**
57
- * Process a list of direct URLs
58
- * @param urls - Array of image URLs
59
- * @param filter - Filter to apply to discovered images
60
- * @returns Promise resolving to array of validated URLs
61
- */
62
- async processUrls(t, r) {
63
- if (!Array.isArray(t))
64
- return console.warn("URLs must be an array:", t), [];
65
- const s = [];
66
- for (const i of t) {
67
- const o = i.split("/").pop() || i;
68
- if (!r.isAllowed(o)) {
69
- this.log(`Skipping filtered URL: ${i}`);
70
- continue;
71
- }
72
- this.validateUrls ? await this.validateUrl(i) ? s.push(i) : console.warn(`Skipping invalid/missing URL: ${i}`) : s.push(i);
73
- }
74
- return s;
75
- }
76
- /**
77
- * Process a path-based source
78
- * @param basePath - Base path (relative or absolute)
79
- * @param files - Array of filenames
80
- * @param filter - Filter to apply to discovered images
81
- * @returns Promise resolving to array of validated URLs
82
- */
83
- async processPath(t, r, s) {
84
- if (!Array.isArray(r))
85
- return console.warn("files must be an array:", r), [];
86
- const i = [];
87
- for (const o of r) {
88
- if (!s.isAllowed(o)) {
89
- this.log(`Skipping filtered file: ${o}`);
90
- continue;
91
- }
92
- const e = this.constructUrl(t, o);
93
- this.validateUrls ? await this.validateUrl(e) ? i.push(e) : console.warn(`Skipping invalid/missing file: ${e}`) : i.push(e);
94
- }
95
- return i;
96
- }
97
- /**
98
- * Process a JSON endpoint source
99
- * Fetches a JSON endpoint that returns { images: string[] }
100
- * @param url - JSON endpoint URL
101
- * @param filter - Filter to apply to discovered images
102
- * @returns Promise resolving to array of validated URLs
103
- */
104
- async processJson(t, r) {
105
- this.log(`Fetching JSON endpoint: ${t}`);
106
- const s = new AbortController(), i = setTimeout(() => s.abort(), 1e4);
107
- try {
108
- const o = await fetch(t, { signal: s.signal });
109
- if (clearTimeout(i), !o.ok)
110
- throw new Error(`HTTP ${o.status} fetching ${t}`);
111
- const e = await o.json();
112
- if (!e || !Array.isArray(e.images))
113
- throw new Error('JSON source must return JSON with shape { "images": ["url1", "url2", ...] }');
114
- return this.log(`JSON endpoint returned ${e.images.length} image(s)`), await this.processUrls(e.images, r);
115
- } catch (o) {
116
- throw clearTimeout(i), o instanceof Error && o.name === "AbortError" ? new Error(`Timeout fetching JSON endpoint: ${t}`) : o;
117
- }
118
- }
119
- /**
120
- * Validate a single URL using HEAD request
121
- * @param url - URL to validate
122
- * @returns Promise resolving to true if valid and accessible
123
- */
124
- async validateUrl(t) {
125
- if (this.validationMethod === "none")
126
- return !0;
127
- if (this.validationMethod === "simple")
128
- try {
129
- return typeof window < "u" ? new URL(t, window.location.origin) : new URL(t), !0;
130
- } catch {
131
- return !1;
132
- }
133
- if (typeof window > "u")
134
- return !0;
135
- if (!(t.startsWith(window.location.origin) || t.startsWith("/")))
136
- return this.log(`Skipping validation for cross-origin URL: ${t}`), !0;
137
- try {
138
- const r = new AbortController(), s = setTimeout(() => r.abort(), this.validationTimeout), i = await fetch(t, {
139
- method: "HEAD",
140
- signal: r.signal
141
- });
142
- return clearTimeout(s), i.ok ? !0 : (this.log(`Validation failed for ${t}: HTTP ${i.status}`), !1);
143
- } catch (r) {
144
- return r instanceof Error && (r.name === "AbortError" ? this.log(`Validation timeout for ${t}`) : this.log(`Validation failed for ${t}:`, r.message)), !1;
145
- }
146
- }
147
- /**
148
- * Construct full URL from basePath and filename
149
- * @param basePath - Base path (relative or absolute)
150
- * @param filename - Filename to append
151
- * @returns Complete URL
152
- */
153
- constructUrl(t, r) {
154
- const s = t.replace(/\/$/, "");
155
- if (this.isAbsoluteUrl(t))
156
- return `${s}/${r}`;
157
- if (typeof window > "u")
158
- return `${s}/${r}`;
159
- const i = window.location.origin, o = (t.startsWith("/") ? t : "/" + t).replace(/\/$/, "");
160
- return `${i}${o}/${r}`;
161
- }
162
- /**
163
- * Check if URL is absolute (contains protocol)
164
- * @param url - URL to check
165
- * @returns True if absolute URL
166
- */
167
- isAbsoluteUrl(t) {
168
- try {
169
- return new URL(t), !0;
170
- } catch {
171
- return !1;
172
- }
173
- }
174
- /**
175
- * Debug logging helper
176
- * @param args - Arguments to log
177
- */
178
- log(...t) {
179
- this.debugLogging && typeof console < "u" && console.log(...t);
180
- }
181
- }
182
- a.registerLoader("static", n);
183
- export {
184
- n as StaticImageLoader
185
- };
186
- //# sourceMappingURL=static-D9YjTesh.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"static-D9YjTesh.js","sources":["loaders/static.js"],"sourcesContent":["import { LoaderRegistry as n } from \"@frybynite/image-cloud\";\nclass a {\n constructor(e) {\n if (this._prepared = !1, this._discoveredUrls = [], this.validateUrls = e.validateUrls !== !1, this.validationTimeout = e.validationTimeout ?? 5e3, this.validationMethod = e.validationMethod ?? \"head\", this.debugLogging = e.debugLogging ?? !1, this.sources = e.sources ?? [], !this.sources || this.sources.length === 0)\n throw new Error(\"StaticImageLoader requires at least one source to be configured\");\n this.log(\"StaticImageLoader initialized with config:\", e);\n }\n /**\n * Prepare the loader by discovering all images from configured sources\n * @param filter - Filter to apply to discovered images\n */\n async prepare(e) {\n this._discoveredUrls = [], this.log(`Processing ${this.sources.length} source(s)`);\n for (const r of this.sources)\n try {\n const t = await this.processSource(r, e);\n this._discoveredUrls.push(...t);\n } catch (t) {\n console.warn(\"Failed to process source:\", r, t);\n }\n this._prepared = !0, this.log(`Successfully loaded ${this._discoveredUrls.length} image(s)`);\n }\n /**\n * Get the number of discovered images\n * @throws Error if called before prepare()\n */\n imagesLength() {\n if (!this._prepared)\n throw new Error(\"StaticImageLoader.imagesLength() called before prepare()\");\n return this._discoveredUrls.length;\n }\n /**\n * Get the ordered list of image URLs\n * @throws Error if called before prepare()\n */\n imageURLs() {\n if (!this._prepared)\n throw new Error(\"StaticImageLoader.imageURLs() called before prepare()\");\n return [...this._discoveredUrls];\n }\n /**\n * Check if the loader has been prepared\n */\n isPrepared() {\n return this._prepared;\n }\n /**\n * Process a single source object using shape-based detection\n * @param source - Source configuration detected by key presence\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of valid URLs from this source\n */\n async processSource(e, r) {\n return e ? \"urls\" in e ? await this.processUrls(e.urls, r) : \"path\" in e ? await this.processPath(e.path, e.files, r) : \"json\" in e ? await this.processJson(e.json, r) : (console.warn(\"Unknown source shape:\", e), []) : (console.warn(\"Invalid source object:\", e), []);\n }\n /**\n * Process a list of direct URLs\n * @param urls - Array of image URLs\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of validated URLs\n */\n async processUrls(e, r) {\n if (!Array.isArray(e))\n return console.warn(\"URLs must be an array:\", e), [];\n const t = [];\n for (const i of e) {\n const s = i.split(\"/\").pop() || i;\n if (!r.isAllowed(s)) {\n this.log(`Skipping filtered URL: ${i}`);\n continue;\n }\n this.validateUrls ? await this.validateUrl(i) ? t.push(i) : console.warn(`Skipping invalid/missing URL: ${i}`) : t.push(i);\n }\n return t;\n }\n /**\n * Process a path-based source\n * @param basePath - Base path (relative or absolute)\n * @param files - Array of filenames\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of validated URLs\n */\n async processPath(e, r, t) {\n if (!Array.isArray(r))\n return console.warn(\"files must be an array:\", r), [];\n const i = [];\n for (const s of r) {\n if (!t.isAllowed(s)) {\n this.log(`Skipping filtered file: ${s}`);\n continue;\n }\n const o = this.constructUrl(e, s);\n this.validateUrls ? await this.validateUrl(o) ? i.push(o) : console.warn(`Skipping invalid/missing file: ${o}`) : i.push(o);\n }\n return i;\n }\n /**\n * Process a JSON endpoint source\n * Fetches a JSON endpoint that returns { images: string[] }\n * @param url - JSON endpoint URL\n * @param filter - Filter to apply to discovered images\n * @returns Promise resolving to array of validated URLs\n */\n async processJson(e, r) {\n this.log(`Fetching JSON endpoint: ${e}`);\n const t = new AbortController(), i = setTimeout(() => t.abort(), 1e4);\n try {\n const s = await fetch(e, { signal: t.signal });\n if (clearTimeout(i), !s.ok)\n throw new Error(`HTTP ${s.status} fetching ${e}`);\n const o = await s.json();\n if (!o || !Array.isArray(o.images))\n throw new Error('JSON source must return JSON with shape { \"images\": [\"url1\", \"url2\", ...] }');\n return this.log(`JSON endpoint returned ${o.images.length} image(s)`), await this.processUrls(o.images, r);\n } catch (s) {\n throw clearTimeout(i), s instanceof Error && s.name === \"AbortError\" ? new Error(`Timeout fetching JSON endpoint: ${e}`) : s;\n }\n }\n /**\n * Validate a single URL using HEAD request\n * @param url - URL to validate\n * @returns Promise resolving to true if valid and accessible\n */\n async validateUrl(e) {\n if (this.validationMethod === \"none\")\n return !0;\n if (this.validationMethod === \"simple\")\n try {\n return typeof window < \"u\" ? new URL(e, window.location.origin) : new URL(e), !0;\n } catch {\n return !1;\n }\n if (typeof window > \"u\")\n return !0;\n if (!(e.startsWith(window.location.origin) || e.startsWith(\"/\")))\n return this.log(`Skipping validation for cross-origin URL: ${e}`), !0;\n try {\n const t = new AbortController(), i = setTimeout(() => t.abort(), this.validationTimeout), s = await fetch(e, {\n method: \"HEAD\",\n signal: t.signal\n });\n return clearTimeout(i), s.ok ? !0 : (this.log(`Validation failed for ${e}: HTTP ${s.status}`), !1);\n } catch (t) {\n return t instanceof Error && (t.name === \"AbortError\" ? this.log(`Validation timeout for ${e}`) : this.log(`Validation failed for ${e}:`, t.message)), !1;\n }\n }\n /**\n * Construct full URL from basePath and filename\n * @param basePath - Base path (relative or absolute)\n * @param filename - Filename to append\n * @returns Complete URL\n */\n constructUrl(e, r) {\n const t = e.replace(/\\/$/, \"\");\n if (this.isAbsoluteUrl(e))\n return `${t}/${r}`;\n if (typeof window > \"u\")\n return `${t}/${r}`;\n const i = window.location.origin, o = (e.startsWith(\"/\") ? e : \"/\" + e).replace(/\\/$/, \"\");\n return `${i}${o}/${r}`;\n }\n /**\n * Check if URL is absolute (contains protocol)\n * @param url - URL to check\n * @returns True if absolute URL\n */\n isAbsoluteUrl(e) {\n try {\n return new URL(e), !0;\n } catch {\n return !1;\n }\n }\n /**\n * Debug logging helper\n * @param args - Arguments to log\n */\n log(...e) {\n this.debugLogging && typeof console < \"u\" && console.log(...e);\n }\n}\nn.registerLoader(\"static\", a);\nexport {\n a as StaticImageLoader\n};\n//# sourceMappingURL=static.js.map\n"],"names":["a","e","t","s","o","i","n"],"mappings":";AACA,MAAMA,EAAE;AAAA,EACN,YAAYC,GAAG;AACb,QAAI,KAAK,YAAY,IAAI,KAAK,kBAAkB,CAAA,GAAI,KAAK,eAAeA,EAAE,iBAAiB,IAAI,KAAK,oBAAoBA,EAAE,qBAAqB,KAAK,KAAK,mBAAmBA,EAAE,oBAAoB,QAAQ,KAAK,eAAeA,EAAE,gBAAgB,IAAI,KAAK,UAAUA,EAAE,WAAW,CAAA,GAAI,CAAC,KAAK,WAAW,KAAK,QAAQ,WAAW;AAC3T,YAAM,IAAI,MAAM,iEAAiE;AACnF,SAAK,IAAI,8CAA8CA,CAAC;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAQA,GAAG;AACf,SAAK,kBAAkB,IAAI,KAAK,IAAI,cAAc,KAAK,QAAQ,MAAM,YAAY;AACjF,eAAW,KAAK,KAAK;AACnB,UAAI;AAC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