@stacksjs/stx 0.2.0 → 0.2.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.
- package/dist/a11y.d.ts +109 -5
- package/dist/analytics.d.ts +40 -0
- package/dist/animation.d.ts +90 -0
- package/dist/app.d.ts +51 -0
- package/dist/ast.d.ts +286 -0
- package/dist/async-components.d.ts +101 -0
- package/dist/auth.d.ts +1 -3
- package/dist/browser-composables.d.ts +314 -0
- package/dist/build-optimizer.d.ts +126 -0
- package/dist/build-views.d.ts +37 -0
- package/dist/bundle-analyzer/collector.d.ts +66 -0
- package/dist/bundle-analyzer/index.d.ts +60 -0
- package/dist/bundle-analyzer/report.d.ts +39 -0
- package/dist/bundle-analyzer/treemap.d.ts +19 -0
- package/dist/bundle-analyzer.js +499 -0
- package/dist/caching.d.ts +7 -0
- package/dist/cli.js +10880 -1199
- package/dist/client/directive.d.ts +10 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/router.d.ts +36 -0
- package/dist/client/stx-router.browser.d.ts +0 -0
- package/dist/client-script.d.ts +22 -0
- package/dist/component-hmr.d.ts +120 -0
- package/dist/components.d.ts +23 -1
- package/dist/composables/index.d.ts +277 -0
- package/dist/composables/use-battery.d.ts +46 -0
- package/dist/composables/use-broadcast-channel.d.ts +58 -0
- package/dist/composables/use-clipboard.d.ts +34 -0
- package/dist/composables/use-cookie.d.ts +70 -0
- package/dist/composables/use-device-orientation.d.ts +109 -0
- package/dist/composables/use-event-source.d.ts +77 -0
- package/dist/composables/use-eye-dropper.d.ts +107 -0
- package/dist/composables/use-fetch.d.ts +84 -0
- package/dist/composables/use-fullscreen.d.ts +47 -0
- package/dist/composables/use-geolocation.d.ts +62 -0
- package/dist/composables/use-idle.d.ts +84 -0
- package/dist/composables/use-intersection-observer.d.ts +81 -0
- package/dist/composables/use-keyboard.d.ts +100 -0
- package/dist/composables/use-media-query.d.ts +56 -0
- package/dist/composables/use-mouse.d.ts +64 -0
- package/dist/composables/use-mutation-observer.d.ts +101 -0
- package/dist/composables/use-network.d.ts +40 -0
- package/dist/composables/use-notification.d.ts +89 -0
- package/dist/composables/use-permissions.d.ts +109 -0
- package/dist/composables/use-resize-observer.d.ts +60 -0
- package/dist/composables/use-share.d.ts +70 -0
- package/dist/composables/use-speech.d.ts +117 -0
- package/dist/composables/use-storage.d.ts +64 -0
- package/dist/composables/use-text-selection.d.ts +97 -0
- package/dist/composables/use-wake-lock.d.ts +85 -0
- package/dist/composables/use-websocket.d.ts +69 -0
- package/dist/composables/use-window.d.ts +84 -0
- package/dist/composables.d.ts +268 -0
- package/dist/composition-api.d.ts +190 -0
- package/dist/computed.d.ts +137 -0
- package/dist/conditionals.d.ts +14 -2
- package/dist/config.d.ts +35 -2
- package/dist/craft-bridge.d.ts +319 -0
- package/dist/craft-compiler.d.ts +229 -0
- package/dist/craft-components.d.ts +411 -0
- package/dist/craft-entry.d.ts +5 -0
- package/dist/craft-ssr.d.ts +134 -0
- package/dist/craft.js +1553 -0
- package/dist/csp.d.ts +229 -0
- package/dist/database.d.ts +407 -0
- package/dist/database.js +5 -0
- package/dist/defer.d.ts +4 -0
- package/dist/deploy/config-generators.d.ts +75 -0
- package/dist/deploy/index.d.ts +84 -0
- package/dist/deploy/netlify.d.ts +109 -0
- package/dist/dev-server/crosswind.d.ts +54 -0
- package/dist/dev-server/index.d.ts +7 -0
- package/dist/dev-server/keyboard-shortcuts.d.ts +34 -0
- package/dist/dev-server/native-window.d.ts +40 -0
- package/dist/dev-server/port-utils.d.ts +27 -0
- package/dist/dev-server/terminal-colors.d.ts +60 -0
- package/dist/dev-server/theme-selector.d.ts +32 -0
- package/dist/dev-server/types.d.ts +92 -0
- package/dist/dev-server.d.ts +21 -0
- package/dist/devtools.d.ts +142 -0
- package/dist/directive-api.d.ts +111 -0
- package/dist/dynamic-components.d.ts +14 -0
- package/dist/edge-runtime.d.ts +200 -0
- package/dist/env.d.ts +9 -0
- package/dist/error-boundaries.d.ts +71 -0
- package/dist/error-handling.d.ts +1 -101
- package/dist/errors/codes.d.ts +99 -0
- package/dist/errors/formatter.d.ts +64 -0
- package/dist/errors/index.d.ts +56 -0
- package/dist/errors/logger.d.ts +74 -0
- package/dist/errors/sanitizer.d.ts +43 -0
- package/dist/errors/types.d.ts +79 -0
- package/dist/events.d.ts +106 -0
- package/dist/expressions.d.ts +86 -11
- package/dist/forms-validation.d.ts +173 -0
- package/dist/forms.d.ts +157 -8
- package/dist/head.d.ts +225 -0
- package/dist/heatmap.d.ts +125 -0
- package/dist/hot-reload.d.ts +87 -0
- package/dist/hydration-runtime.d.ts +47 -0
- package/dist/hydration.d.ts +161 -0
- package/dist/i18n.d.ts +239 -3
- package/dist/image-optimization/build-plugin.d.ts +53 -0
- package/dist/image-optimization/component.d.ts +46 -0
- package/dist/image-optimization/directive.d.ts +30 -0
- package/dist/image-optimization/index.d.ts +86 -0
- package/dist/image-optimization/processor.d.ts +112 -0
- package/dist/includes.d.ts +94 -9
- package/dist/index.d.ts +63 -3
- package/dist/index.js +11603 -1318
- package/dist/init.d.ts +32 -2
- package/dist/interactive.d.ts +14 -0
- package/dist/internal-markdown.d.ts +22 -0
- package/dist/jsx-runtime.d.ts +110 -0
- package/dist/keep-alive.d.ts +87 -0
- package/dist/lazy-loader.d.ts +122 -0
- package/dist/loading-indicator.d.ts +40 -0
- package/dist/loops.d.ts +22 -1
- package/dist/media/client/blur-up.d.ts +65 -0
- package/dist/media/client/index.d.ts +77 -0
- package/dist/media/client/lazy-load.d.ts +73 -0
- package/dist/media/client/upload-handler.d.ts +79 -0
- package/dist/media/image/component.d.ts +46 -0
- package/dist/media/image/directive.d.ts +9 -0
- package/dist/media/image/editing.d.ts +212 -0
- package/dist/media/image/index.d.ts +118 -0
- package/dist/media/image/placeholder.d.ts +78 -0
- package/dist/media/image/processor/cache.d.ts +32 -0
- package/dist/media/image/processor/index.d.ts +12 -0
- package/dist/media/image/processor/optimizer.d.ts +13 -0
- package/dist/media/image/processor/responsive.d.ts +17 -0
- package/dist/media/image/srcset.d.ts +158 -0
- package/dist/media/index.d.ts +295 -0
- package/dist/media/manager/embed.d.ts +25 -0
- package/dist/media/protected/component.d.ts +34 -0
- package/dist/media/protected/index.d.ts +34 -0
- package/dist/media/protected/signature.d.ts +72 -0
- package/dist/media/shared/cache.d.ts +54 -0
- package/dist/media/shared/hash.d.ts +24 -0
- package/dist/media/shared/index.d.ts +2 -0
- package/dist/media/types.d.ts +1051 -0
- package/dist/media/upload/component.d.ts +23 -0
- package/dist/media/upload/index.d.ts +1 -0
- package/dist/media/video/directive.d.ts +9 -0
- package/dist/media/video/index.d.ts +47 -0
- package/dist/media/video/processor/cache.d.ts +33 -0
- package/dist/media/video/processor/index.d.ts +21 -0
- package/dist/media/video/processor/streaming.d.ts +19 -0
- package/dist/media/video/processor/thumbnail.d.ts +28 -0
- package/dist/media/video/processor/transcoder.d.ts +9 -0
- package/dist/middleware.d.ts +42 -3
- package/dist/native-build.d.ts +74 -0
- package/dist/parser/directive-parser.d.ts +79 -0
- package/dist/parser/expression-parser.d.ts +59 -0
- package/dist/parser/index.d.ts +35 -0
- package/dist/parser/tokenizer.d.ts +81 -0
- package/dist/partial-hydration.d.ts +88 -0
- package/dist/performance-utils.d.ts +146 -3
- package/dist/plugin-system.d.ts +128 -0
- package/dist/precompiler.d.ts +108 -0
- package/dist/production-build.d.ts +199 -0
- package/dist/props.d.ts +199 -0
- package/dist/pwa/audit.d.ts +42 -0
- package/dist/pwa/directives.d.ts +29 -0
- package/dist/pwa/icons.d.ts +39 -0
- package/dist/pwa/index.d.ts +59 -0
- package/dist/pwa/inject.d.ts +22 -0
- package/dist/pwa/manifest.d.ts +104 -0
- package/dist/pwa/offline.d.ts +8 -0
- package/dist/pwa/precache.d.ts +29 -0
- package/dist/pwa/service-worker.d.ts +21 -0
- package/dist/pwa/workbox-strategies.d.ts +100 -0
- package/dist/pwa/workbox.d.ts +52 -0
- package/dist/pwa.d.ts +51 -0
- package/dist/pwa.js +8124 -0
- package/dist/reactive-bindings.d.ts +24 -0
- package/dist/reactive.d.ts +100 -0
- package/dist/reactivity.d.ts +253 -0
- package/dist/route-middleware.d.ts +232 -0
- package/dist/router.d.ts +31 -0
- package/dist/routes.d.ts +0 -7
- package/dist/runtime.d.ts +140 -0
- package/dist/safe-evaluator.d.ts +117 -3
- package/dist/scaffolding.d.ts +113 -0
- package/dist/seo.d.ts +120 -7
- package/dist/server-components.d.ts +134 -0
- package/dist/signals.d.ts +501 -0
- package/dist/slots.d.ts +63 -0
- package/dist/source-maps.d.ts +117 -0
- package/dist/ssg.d.ts +157 -0
- package/dist/ssg.js +6831 -0
- package/dist/ssr.d.ts +107 -0
- package/dist/state-management.d.ts +324 -0
- package/dist/stores-client.d.ts +70 -0
- package/dist/story/addons.d.ts +123 -0
- package/dist/story/analytics.d.ts +92 -0
- package/dist/story/auto-stories.d.ts +38 -0
- package/dist/story/bookmarks.d.ts +53 -0
- package/dist/story/bun-test.d.ts +44 -0
- package/dist/story/cli.d.ts +34 -0
- package/dist/story/collect/analyzer.d.ts +33 -0
- package/dist/story/collect/index.d.ts +27 -0
- package/dist/story/collect/parser.d.ts +17 -0
- package/dist/story/collect/scanner.d.ts +13 -0
- package/dist/story/collect/tree.d.ts +17 -0
- package/dist/story/commands/build.d.ts +14 -0
- package/dist/story/commands/dev.d.ts +16 -0
- package/dist/story/commands/index.d.ts +6 -0
- package/dist/story/commands/preview.d.ts +15 -0
- package/dist/story/compiled-output.d.ts +26 -0
- package/dist/story/composition.d.ts +47 -0
- package/dist/story/config-watcher.d.ts +26 -0
- package/dist/story/config.d.ts +26 -0
- package/dist/story/context.d.ts +21 -0
- package/dist/story/controls/index.d.ts +54 -0
- package/dist/story/crosswind.d.ts +29 -0
- package/dist/story/desktop-preview.d.ts +34 -0
- package/dist/story/docs-generator.d.ts +30 -0
- package/dist/story/errors.d.ts +47 -0
- package/dist/story/figma-export.d.ts +169 -0
- package/dist/story/generator.d.ts +21 -0
- package/dist/story/hmr.d.ts +64 -0
- package/dist/story/hot-swap.d.ts +35 -0
- package/dist/story/index.d.ts +51 -0
- package/dist/story/interactions.d.ts +52 -0
- package/dist/story/keyboard-shortcuts.d.ts +34 -0
- package/dist/story/output.d.ts +85 -0
- package/dist/story/performance.d.ts +76 -0
- package/dist/story/presets.d.ts +62 -0
- package/dist/story/props-validation.d.ts +45 -0
- package/dist/story/renderer.d.ts +53 -0
- package/dist/story/search-index.d.ts +47 -0
- package/dist/story/search.d.ts +45 -0
- package/dist/story/server.d.ts +21 -0
- package/dist/story/setup.d.ts +47 -0
- package/dist/story/snapshots.d.ts +65 -0
- package/dist/story/testing.d.ts +58 -0
- package/dist/story/theme.d.ts +68 -0
- package/dist/story/types.d.ts +249 -0
- package/dist/story/ui/code-panel.d.ts +42 -0
- package/dist/story/ui/controls-panel.d.ts +25 -0
- package/dist/story/ui/index.d.ts +4 -0
- package/dist/story/ui/navigation.d.ts +55 -0
- package/dist/story/ui/preview.d.ts +46 -0
- package/dist/story/visual-testing.d.ts +45 -0
- package/dist/streaming.d.ts +82 -2
- package/dist/suspense.d.ts +83 -0
- package/dist/teleport.d.ts +9 -0
- package/dist/testing.d.ts +289 -0
- package/dist/transitions.d.ts +87 -0
- package/dist/type-checker.d.ts +109 -0
- package/dist/types/component-types.d.ts +129 -0
- package/dist/types/config-types.d.ts +336 -0
- package/dist/types/context-types.d.ts +99 -0
- package/dist/types/csp-types.d.ts +79 -0
- package/dist/types/directive-types.d.ts +259 -0
- package/dist/types/index.d.ts +98 -0
- package/dist/types/pwa-types.d.ts +218 -0
- package/dist/types.d.ts +1 -315
- package/dist/typescript-templates.d.ts +178 -0
- package/dist/utils.d.ts +52 -6
- package/dist/validator.d.ts +77 -0
- package/dist/variable-extractor.d.ts +39 -0
- package/dist/view-composers.d.ts +154 -9
- package/dist/virtual-scrolling.d.ts +103 -0
- package/dist/visual-editor.d.ts +209 -0
- package/dist/visual-testing.d.ts +109 -0
- package/dist/visual-testing.js +126 -0
- package/dist/vue-template.d.ts +16 -0
- package/dist/web-components/css-scoping.d.ts +54 -0
- package/dist/web-components/index.d.ts +20 -0
- package/dist/web-components/reactive-generator.d.ts +72 -0
- package/dist/web-components.d.ts +222 -2
- package/dist/x-element.d.ts +35 -0
- package/package.json +41 -11
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { Breakpoint, ImageFormat, ImageParams, ImageVariant, SrcsetData, SrcsetOptions, } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Generate a width-based srcset string
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const srcset = generateWidthSrcset('/images/hero.jpg', [320, 640, 1024])
|
|
8
|
+
* // Result: "/images/hero.jpg?w=320 320w, /images/hero.jpg?w=640 640w, /images/hero.jpg?w=1024 1024w"
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function generateWidthSrcset(src: string, widths?: number[], params?: ImageParams, format?: ImageFormat): string;
|
|
12
|
+
/**
|
|
13
|
+
* Generate width-based srcset with automatic width calculation
|
|
14
|
+
*
|
|
15
|
+
* Uses a tolerance-based approach similar to imgix.js to calculate optimal widths
|
|
16
|
+
* between min and max values.
|
|
17
|
+
*
|
|
18
|
+
* @param src - Image source URL
|
|
19
|
+
* @param minWidth - Minimum width (default: 320)
|
|
20
|
+
* @param maxWidth - Maximum width (default: 2560)
|
|
21
|
+
* @param tolerance - Width tolerance factor (default: 0.08 = 8%)
|
|
22
|
+
*/
|
|
23
|
+
export declare function generateAutoWidthSrcset(src: string, minWidth?: number, maxWidth?: number, tolerance?: number, params?: ImageParams, format?: ImageFormat): string;
|
|
24
|
+
/**
|
|
25
|
+
* Calculate optimal widths between min and max using tolerance factor
|
|
26
|
+
*
|
|
27
|
+
* Similar to imgix.js srcset generation algorithm
|
|
28
|
+
*/
|
|
29
|
+
export declare function calculateOptimalWidths(minWidth: number, maxWidth: number, tolerance?: number): number[];
|
|
30
|
+
/**
|
|
31
|
+
* Generate a DPR-based srcset for fixed-width images
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const srcset = generateDprSrcset('/images/avatar.jpg', 200, [1, 2, 3])
|
|
36
|
+
* // Result: "/images/avatar.jpg?w=200 1x, /images/avatar.jpg?w=400 2x, /images/avatar.jpg?w=600 3x"
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function generateDprSrcset(src: string, width: number, dprValues?: number[], params?: ImageParams, format?: ImageFormat): string;
|
|
40
|
+
/**
|
|
41
|
+
* Generate DPR-based srcset with variable quality
|
|
42
|
+
*
|
|
43
|
+
* Reduces quality for higher DPR values to maintain reasonable file sizes
|
|
44
|
+
* (similar to imgix variable quality feature)
|
|
45
|
+
*/
|
|
46
|
+
export declare function generateDprSrcsetWithVariableQuality(src: string, width: number, dprValues?: number[], baseQuality?: number, params?: ImageParams, format?: ImageFormat): string;
|
|
47
|
+
/**
|
|
48
|
+
* Generate a sizes attribute from breakpoint definitions
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const sizes = generateSizesAttribute({
|
|
53
|
+
* '768px': '100vw',
|
|
54
|
+
* '1024px': '50vw',
|
|
55
|
+
* })
|
|
56
|
+
* // Result: "(max-width: 768px) 100vw, (max-width: 1024px) 50vw, 100vw"
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function generateSizesAttribute(breakpoints: Record<string, string>, defaultSize?: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Generate sizes from named breakpoints
|
|
62
|
+
*/
|
|
63
|
+
export declare function generateSizesFromBreakpoints(breakpoints: Breakpoint[], defaultSize?: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Build an image URL with transformation parameters
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const url = buildImageUrl('/images/hero.jpg', { w: 800, h: 600, fit: 'crop', q: 85 })
|
|
70
|
+
* // Result: "/images/hero.jpg?w=800&h=600&fit=crop&q=85"
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function buildImageUrl(src: string, params?: ImageParams): string;
|
|
74
|
+
/**
|
|
75
|
+
* Parse image parameters from a URL
|
|
76
|
+
*/
|
|
77
|
+
export declare function parseImageUrl(url: string): { src: string; params: ImageParams };
|
|
78
|
+
/**
|
|
79
|
+
* Generate complete srcset data for all formats
|
|
80
|
+
*
|
|
81
|
+
* @returns Array of srcset data for each format
|
|
82
|
+
*/
|
|
83
|
+
export declare function generateSrcsetData(options: SrcsetOptions): SrcsetData[];
|
|
84
|
+
/**
|
|
85
|
+
* Generate a complete <picture> element's source tags
|
|
86
|
+
*/
|
|
87
|
+
export declare function generateSourceTags(srcsetData: SrcsetData[], sizes?: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Get the best variant for a given width from a list of variants
|
|
90
|
+
*/
|
|
91
|
+
export declare function getBestVariant(variants: ImageVariant[], targetWidth: number): ImageVariant | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Get the fallback variant (middle resolution JPEG)
|
|
94
|
+
*/
|
|
95
|
+
export declare function getFallbackVariant(variants: ImageVariant[], preferFormat?: ImageFormat): ImageVariant | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Group variants by format
|
|
98
|
+
*/
|
|
99
|
+
export declare function groupVariantsByFormat(variants: ImageVariant[]): Map<ImageFormat, ImageVariant[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Get MIME type for a format
|
|
102
|
+
*/
|
|
103
|
+
export declare function getMimeType(format: ImageFormat): string;
|
|
104
|
+
/**
|
|
105
|
+
* Get file extension for a format
|
|
106
|
+
*/
|
|
107
|
+
export declare function getFormatExtension(format: ImageFormat): string;
|
|
108
|
+
/**
|
|
109
|
+
* Detect image format from file extension or URL
|
|
110
|
+
*/
|
|
111
|
+
export declare function detectFormat(src: string): ImageFormat | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Default breakpoint widths for responsive images
|
|
114
|
+
*/
|
|
115
|
+
export declare const DEFAULT_WIDTHS: readonly [320, 480, 640, 768, 1024, 1280, 1536, 1920, 2560];
|
|
116
|
+
/**
|
|
117
|
+
* Default DPR values for fixed-width images
|
|
118
|
+
*/
|
|
119
|
+
export declare const DEFAULT_DPR_VALUES: readonly [1, 1.5, 2, 3];
|
|
120
|
+
/**
|
|
121
|
+
* Default output formats in order of preference
|
|
122
|
+
*/
|
|
123
|
+
export declare const DEFAULT_FORMATS: ImageFormat[];
|
|
124
|
+
/**
|
|
125
|
+
* MIME types for each format
|
|
126
|
+
*/
|
|
127
|
+
export declare const MIME_TYPES: {
|
|
128
|
+
avif: 'image/avif';
|
|
129
|
+
webp: 'image/webp';
|
|
130
|
+
jpeg: 'image/jpeg';
|
|
131
|
+
png: 'image/png';
|
|
132
|
+
gif: 'image/gif'
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* File extensions for each format
|
|
136
|
+
*/
|
|
137
|
+
export declare const FORMAT_EXTENSIONS: {
|
|
138
|
+
avif: 'avif';
|
|
139
|
+
webp: 'webp';
|
|
140
|
+
jpeg: 'jpg';
|
|
141
|
+
png: 'png';
|
|
142
|
+
gif: 'gif'
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Common responsive sizes patterns
|
|
146
|
+
*/
|
|
147
|
+
export declare const COMMON_SIZES: {
|
|
148
|
+
/** Full width on all screens */
|
|
149
|
+
fullWidth: '100vw';
|
|
150
|
+
/** Half width on desktop, full on mobile */
|
|
151
|
+
halfDesktop: '(max-width: 768px) 100vw, 50vw';
|
|
152
|
+
/** Third width on desktop, full on mobile */
|
|
153
|
+
thirdDesktop: '(max-width: 768px) 100vw, 33.33vw';
|
|
154
|
+
/** Quarter width on desktop, half on tablet, full on mobile */
|
|
155
|
+
quarterDesktop: '(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw';
|
|
156
|
+
/** Content width (centered with max-width) */
|
|
157
|
+
contentWidth: '(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px'
|
|
158
|
+
};
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import type { MediaConfig } from './types';
|
|
2
|
+
export type {
|
|
3
|
+
// Placeholder types
|
|
4
|
+
PlaceholderStrategy,
|
|
5
|
+
PlaceholderOptions,
|
|
6
|
+
PlaceholderResult,
|
|
7
|
+
|
|
8
|
+
// Image types (prefixed to avoid conflicts with image-optimization)
|
|
9
|
+
ImageFormat as MediaImageFormat,
|
|
10
|
+
ImageFit,
|
|
11
|
+
ImageCrop,
|
|
12
|
+
ImageParams,
|
|
13
|
+
ImageVariant,
|
|
14
|
+
ProcessedImage,
|
|
15
|
+
ImgProps,
|
|
16
|
+
ImgDirectiveOptions,
|
|
17
|
+
ImageRenderContext as MediaImageRenderContext,
|
|
18
|
+
ImageRenderResult,
|
|
19
|
+
|
|
20
|
+
// Enhanced image types (ts-images integration)
|
|
21
|
+
EnhancedImgProps,
|
|
22
|
+
ProcessedImageResult,
|
|
23
|
+
ResponsiveVariantSet,
|
|
24
|
+
TsImagesConfig,
|
|
25
|
+
ImageOptimizationPreset,
|
|
26
|
+
ImageTransformation,
|
|
27
|
+
ImageTransformationConfig,
|
|
28
|
+
FormatQualitySettings,
|
|
29
|
+
WatermarkConfig,
|
|
30
|
+
WatermarkPosition,
|
|
31
|
+
ArtDirectionConfig,
|
|
32
|
+
|
|
33
|
+
// Video types
|
|
34
|
+
VideoSource,
|
|
35
|
+
VideoEmbedType,
|
|
36
|
+
PlyrControl,
|
|
37
|
+
PlyrOptions,
|
|
38
|
+
VideoProps,
|
|
39
|
+
VideoDirectiveOptions,
|
|
40
|
+
VideoRenderResult,
|
|
41
|
+
|
|
42
|
+
// Enhanced video types (ts-videos integration)
|
|
43
|
+
EnhancedVideoProps,
|
|
44
|
+
ProcessedVideoResult,
|
|
45
|
+
TsVideosConfig,
|
|
46
|
+
VideoQualityPreset,
|
|
47
|
+
VideoPlatformPreset,
|
|
48
|
+
VideoCodec,
|
|
49
|
+
AudioCodec,
|
|
50
|
+
TranscodeConfig,
|
|
51
|
+
TranscodeResult,
|
|
52
|
+
ThumbnailResult,
|
|
53
|
+
PosterGenerationConfig,
|
|
54
|
+
SpriteSheetConfig,
|
|
55
|
+
StreamingConfig,
|
|
56
|
+
StreamingQualityLevel,
|
|
57
|
+
HLSResult,
|
|
58
|
+
DASHResult,
|
|
59
|
+
WaveformConfig,
|
|
60
|
+
|
|
61
|
+
// Upload types
|
|
62
|
+
UploadConfig,
|
|
63
|
+
UploadProgress,
|
|
64
|
+
UploadResult,
|
|
65
|
+
FileValidationResult,
|
|
66
|
+
MediaUploadProps,
|
|
67
|
+
UploadDirectiveOptions,
|
|
68
|
+
|
|
69
|
+
// Protected media types
|
|
70
|
+
SignedUrl,
|
|
71
|
+
SignatureConfig,
|
|
72
|
+
BatchSignatureRequest,
|
|
73
|
+
BatchSignatureResult,
|
|
74
|
+
ProtectedAuthContext,
|
|
75
|
+
ProtectedMediaProps,
|
|
76
|
+
ProtectedDirectiveOptions,
|
|
77
|
+
|
|
78
|
+
// Media manager types
|
|
79
|
+
MediaManagerConfig,
|
|
80
|
+
MediaItem,
|
|
81
|
+
|
|
82
|
+
// Configuration types
|
|
83
|
+
MediaConfig,
|
|
84
|
+
MediaImageConfig,
|
|
85
|
+
MediaVideoConfig,
|
|
86
|
+
MediaUploadConfig,
|
|
87
|
+
MediaProtectedConfig,
|
|
88
|
+
MediaCacheConfig,
|
|
89
|
+
|
|
90
|
+
// Client types
|
|
91
|
+
LazyLoadOptions,
|
|
92
|
+
BlurUpOptions,
|
|
93
|
+
|
|
94
|
+
// Utility types
|
|
95
|
+
Breakpoint,
|
|
96
|
+
SrcsetOptions,
|
|
97
|
+
SrcsetData,
|
|
98
|
+
} from './types';
|
|
99
|
+
export type { ExtendedVideoRenderContext } from './video';
|
|
100
|
+
export type { CacheConfig, CacheEntry } from './shared';
|
|
101
|
+
/**
|
|
102
|
+
* Default media configuration
|
|
103
|
+
*/
|
|
104
|
+
export declare const defaultMediaConfig: MediaConfig;
|
|
105
|
+
export {
|
|
106
|
+
// Component
|
|
107
|
+
renderImgComponent,
|
|
108
|
+
parseImgComponent,
|
|
109
|
+
processImgComponents,
|
|
110
|
+
|
|
111
|
+
// Directive
|
|
112
|
+
createImgDirective,
|
|
113
|
+
imgDirective,
|
|
114
|
+
|
|
115
|
+
// Srcset generation (prefixed to avoid conflicts with image-optimization)
|
|
116
|
+
DEFAULT_WIDTHS as MEDIA_DEFAULT_WIDTHS,
|
|
117
|
+
DEFAULT_DPR_VALUES,
|
|
118
|
+
DEFAULT_FORMATS as MEDIA_DEFAULT_FORMATS,
|
|
119
|
+
MIME_TYPES,
|
|
120
|
+
COMMON_SIZES,
|
|
121
|
+
generateWidthSrcset,
|
|
122
|
+
generateAutoWidthSrcset,
|
|
123
|
+
calculateOptimalWidths,
|
|
124
|
+
generateDprSrcset,
|
|
125
|
+
generateDprSrcsetWithVariableQuality,
|
|
126
|
+
generateSizesAttribute,
|
|
127
|
+
generateSizesFromBreakpoints,
|
|
128
|
+
buildImageUrl,
|
|
129
|
+
parseImageUrl,
|
|
130
|
+
generateSrcsetData,
|
|
131
|
+
generateSourceTags,
|
|
132
|
+
getBestVariant,
|
|
133
|
+
getFallbackVariant,
|
|
134
|
+
groupVariantsByFormat,
|
|
135
|
+
getMimeType,
|
|
136
|
+
getFormatExtension,
|
|
137
|
+
detectFormat,
|
|
138
|
+
|
|
139
|
+
// Placeholder generation
|
|
140
|
+
DEFAULT_PLACEHOLDER_OPTIONS,
|
|
141
|
+
BLUR_UP_CSS,
|
|
142
|
+
generatePlaceholder,
|
|
143
|
+
generateThumbhashPlaceholder,
|
|
144
|
+
generateLQIP,
|
|
145
|
+
extractDominantColor,
|
|
146
|
+
generateColorPlaceholder,
|
|
147
|
+
decodeThumbhash,
|
|
148
|
+
generatePlaceholderCSS,
|
|
149
|
+
generatePlaceholderStyle,
|
|
150
|
+
getCachedPlaceholder,
|
|
151
|
+
clearPlaceholderCache,
|
|
152
|
+
getPlaceholderCacheStats,
|
|
153
|
+
|
|
154
|
+
// Editing API
|
|
155
|
+
buildUrl,
|
|
156
|
+
parseUrl,
|
|
157
|
+
mergeParams,
|
|
158
|
+
resize,
|
|
159
|
+
crop,
|
|
160
|
+
thumbnail,
|
|
161
|
+
contain,
|
|
162
|
+
cover,
|
|
163
|
+
blur,
|
|
164
|
+
sharpen,
|
|
165
|
+
grayscale,
|
|
166
|
+
sepia,
|
|
167
|
+
invert,
|
|
168
|
+
brightness,
|
|
169
|
+
contrast,
|
|
170
|
+
saturation,
|
|
171
|
+
rotate,
|
|
172
|
+
flipHorizontal,
|
|
173
|
+
flipVertical,
|
|
174
|
+
format,
|
|
175
|
+
quality,
|
|
176
|
+
auto,
|
|
177
|
+
watermark,
|
|
178
|
+
PRESETS,
|
|
179
|
+
applyPreset,
|
|
180
|
+
srcsetUrls,
|
|
181
|
+
dprUrls,
|
|
182
|
+
validateParams,
|
|
183
|
+
sanitizeParams,
|
|
184
|
+
} from './image';
|
|
185
|
+
export {
|
|
186
|
+
processImage,
|
|
187
|
+
optimizeImage,
|
|
188
|
+
applyTransformations,
|
|
189
|
+
generateResponsiveVariants,
|
|
190
|
+
generateSrcset,
|
|
191
|
+
getCachedImageResult,
|
|
192
|
+
setCachedImageResult,
|
|
193
|
+
clearImageCache,
|
|
194
|
+
ImageProcessorCache,
|
|
195
|
+
} from './image/processor';
|
|
196
|
+
export {
|
|
197
|
+
renderVideoComponent,
|
|
198
|
+
parseVideoDirectiveOptions,
|
|
199
|
+
// Directive
|
|
200
|
+
createVideoDirective,
|
|
201
|
+
videoDirective,
|
|
202
|
+
} from './video';
|
|
203
|
+
export {
|
|
204
|
+
processVideo,
|
|
205
|
+
analyzeVideo,
|
|
206
|
+
generatePoster,
|
|
207
|
+
generateThumbnails,
|
|
208
|
+
generateSpriteSheet,
|
|
209
|
+
generateHLSManifest,
|
|
210
|
+
generateDASHManifest,
|
|
211
|
+
getCachedVideoResult,
|
|
212
|
+
setCachedVideoResult,
|
|
213
|
+
clearVideoCache,
|
|
214
|
+
VideoProcessorCache,
|
|
215
|
+
} from './video/processor';
|
|
216
|
+
export { renderMediaUpload } from './upload';
|
|
217
|
+
export {
|
|
218
|
+
// URL signing
|
|
219
|
+
signUrl,
|
|
220
|
+
batchSignUrls,
|
|
221
|
+
smartBatchSign,
|
|
222
|
+
|
|
223
|
+
// Validation
|
|
224
|
+
isSignatureValid,
|
|
225
|
+
getTimeUntilExpiry,
|
|
226
|
+
shouldRefreshSignature,
|
|
227
|
+
|
|
228
|
+
// Auth helpers
|
|
229
|
+
checkAuthAccess,
|
|
230
|
+
buildAuthParams,
|
|
231
|
+
|
|
232
|
+
// Cache
|
|
233
|
+
getCachedSignature,
|
|
234
|
+
clearSignatureCache,
|
|
235
|
+
pruneSignatureCache,
|
|
236
|
+
|
|
237
|
+
// Component
|
|
238
|
+
renderProtectedImg,
|
|
239
|
+
renderProtectedVideo,
|
|
240
|
+
processProtectedMedia,
|
|
241
|
+
parseProtectedArgs,
|
|
242
|
+
|
|
243
|
+
// Runtime
|
|
244
|
+
generateSignatureRuntime,
|
|
245
|
+
} from './protected';
|
|
246
|
+
export { generateMediaManagerEmbed, generateSimpleMediaPicker } from './manager/embed';
|
|
247
|
+
export {
|
|
248
|
+
// Lazy loading
|
|
249
|
+
isNativeLazySupported,
|
|
250
|
+
isIntersectionObserverSupported,
|
|
251
|
+
initLazyLoading,
|
|
252
|
+
loadElement,
|
|
253
|
+
lazyLoad,
|
|
254
|
+
lazyLoadAll,
|
|
255
|
+
createLazyObserver,
|
|
256
|
+
observeElement,
|
|
257
|
+
disconnectObserver,
|
|
258
|
+
generateLazyLoadRuntime,
|
|
259
|
+
|
|
260
|
+
// Blur-up
|
|
261
|
+
initBlurUp,
|
|
262
|
+
initAllBlurUp,
|
|
263
|
+
renderThumbhashToCanvas,
|
|
264
|
+
thumbHashToRGBA,
|
|
265
|
+
thumbHashToDataURL,
|
|
266
|
+
parseThumbhashString,
|
|
267
|
+
crossfadeTransition,
|
|
268
|
+
generateBlurUpRuntime,
|
|
269
|
+
generateBlurUpCSS,
|
|
270
|
+
|
|
271
|
+
// Upload handler
|
|
272
|
+
validateFile,
|
|
273
|
+
uploadFile,
|
|
274
|
+
uploadFiles,
|
|
275
|
+
generateImagePreview,
|
|
276
|
+
generateVideoPreview,
|
|
277
|
+
generateUploadRuntime,
|
|
278
|
+
|
|
279
|
+
// Combined runtime
|
|
280
|
+
generateMediaRuntime,
|
|
281
|
+
generateMinifiedMediaRuntime,
|
|
282
|
+
} from './client';
|
|
283
|
+
export {
|
|
284
|
+
hashFile,
|
|
285
|
+
hashBuffer,
|
|
286
|
+
hashString,
|
|
287
|
+
generateCacheKey,
|
|
288
|
+
getFileMtime,
|
|
289
|
+
fileExists,
|
|
290
|
+
getCached,
|
|
291
|
+
setCached,
|
|
292
|
+
clearCache,
|
|
293
|
+
getCacheStats,
|
|
294
|
+
pruneCache,
|
|
295
|
+
} from './shared';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { MediaManagerConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Generate HTML and script for embedding a media manager
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const { html, script } = generateMediaManagerEmbed({
|
|
8
|
+
* src: 'https://media-manager.example.com/embed.js',
|
|
9
|
+
* apiKey: 'your-api-key',
|
|
10
|
+
* bucket: 'uploads',
|
|
11
|
+
* })
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function generateMediaManagerEmbed(config: MediaManagerConfig): { html: string; script: string };
|
|
15
|
+
/**
|
|
16
|
+
* Generate a simple media picker modal
|
|
17
|
+
*
|
|
18
|
+
* For use when a full media manager is not available,
|
|
19
|
+
* provides a basic file browser interface.
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateSimpleMediaPicker(options: {
|
|
22
|
+
accept?: string
|
|
23
|
+
multiple?: boolean
|
|
24
|
+
onSelect?: string
|
|
25
|
+
}): { html: string; script: string; css: string };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { } from './signature';
|
|
2
|
+
import type { ProtectedMediaProps, } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Render a protected image component
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const html = await renderProtectedImg({
|
|
9
|
+
* src: '/api/media/secure-image.jpg',
|
|
10
|
+
* alt: 'Secure content',
|
|
11
|
+
* signatureEndpoint: '/api/sign',
|
|
12
|
+
* auth: { role: 'premium' },
|
|
13
|
+
* })
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function renderProtectedImg(props: ProtectedMediaProps): Promise<{ html: string; script?: string }>;
|
|
17
|
+
/**
|
|
18
|
+
* Render a protected video component
|
|
19
|
+
*/
|
|
20
|
+
export declare function renderProtectedVideo(props: ProtectedMediaProps & {
|
|
21
|
+
poster?: string
|
|
22
|
+
controls?: boolean
|
|
23
|
+
autoplay?: boolean
|
|
24
|
+
muted?: boolean
|
|
25
|
+
loop?: boolean
|
|
26
|
+
}): Promise<{ html: string; script?: string }>;
|
|
27
|
+
/**
|
|
28
|
+
* Collect all protected media elements from content and batch sign
|
|
29
|
+
*/
|
|
30
|
+
export declare function processProtectedMedia(content: string, signatureEndpoint: string): Promise<{ html: string; script: string }>;
|
|
31
|
+
/**
|
|
32
|
+
* Parse @protected directive arguments
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseProtectedArgs(content: string, params: Record<string, unknown>, context: Record<string, unknown>): ProtectedMediaProps;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export {
|
|
2
|
+
// URL signing
|
|
3
|
+
signUrl,
|
|
4
|
+
batchSignUrls,
|
|
5
|
+
smartBatchSign,
|
|
6
|
+
|
|
7
|
+
// Validation
|
|
8
|
+
isSignatureValid,
|
|
9
|
+
getTimeUntilExpiry,
|
|
10
|
+
shouldRefreshSignature,
|
|
11
|
+
|
|
12
|
+
// Auth helpers
|
|
13
|
+
checkAuthAccess,
|
|
14
|
+
buildAuthParams,
|
|
15
|
+
|
|
16
|
+
// Cache
|
|
17
|
+
getCachedSignature,
|
|
18
|
+
clearSignatureCache,
|
|
19
|
+
pruneSignatureCache,
|
|
20
|
+
|
|
21
|
+
// Runtime
|
|
22
|
+
generateSignatureRuntime,
|
|
23
|
+
} from './signature';
|
|
24
|
+
export {
|
|
25
|
+
// Components
|
|
26
|
+
renderProtectedImg,
|
|
27
|
+
renderProtectedVideo,
|
|
28
|
+
|
|
29
|
+
// Processing
|
|
30
|
+
processProtectedMedia,
|
|
31
|
+
|
|
32
|
+
// Directive helpers
|
|
33
|
+
parseProtectedArgs,
|
|
34
|
+
} from './component';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { BatchSignatureResult, ProtectedAuthContext, SignatureConfig, SignedUrl, } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Sign a single URL for protected access
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const signed = await signUrl('/media/secure-video.mp4', {
|
|
8
|
+
* endpoint: '/api/sign',
|
|
9
|
+
* expirationSeconds: 3600,
|
|
10
|
+
* })
|
|
11
|
+
* console.log(signed.url) // URL with signature query param
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function signUrl(src: string, config: SignatureConfig): Promise<SignedUrl>;
|
|
15
|
+
/**
|
|
16
|
+
* Sign multiple URLs in a single batch request
|
|
17
|
+
*
|
|
18
|
+
* This minimizes API calls when a page has multiple protected media items.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const result = await batchSignUrls(
|
|
23
|
+
* ['/media/video1.mp4', '/media/video2.mp4'],
|
|
24
|
+
* { endpoint: '/api/batch-sign' }
|
|
25
|
+
* )
|
|
26
|
+
* console.log(result.signatures.get('/media/video1.mp4'))
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function batchSignUrls(sources: string[], config: SignatureConfig): Promise<BatchSignatureResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Smart batch signing that groups requests for efficiency
|
|
32
|
+
*/
|
|
33
|
+
export declare function smartBatchSign(sources: string[], config: SignatureConfig, batchSize?: number): Promise<BatchSignatureResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Check if a signed URL is still valid (not expired)
|
|
36
|
+
*/
|
|
37
|
+
export declare function isSignatureValid(signedUrl: SignedUrl): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Get time until signature expires (in ms)
|
|
40
|
+
*/
|
|
41
|
+
export declare function getTimeUntilExpiry(signedUrl: SignedUrl): number;
|
|
42
|
+
/**
|
|
43
|
+
* Check if signature should be refreshed (within refresh window)
|
|
44
|
+
*
|
|
45
|
+
* @param signedUrl - The signed URL to check
|
|
46
|
+
* @param refreshWindowMs - Time before expiry to trigger refresh (default: 5 minutes)
|
|
47
|
+
*/
|
|
48
|
+
export declare function shouldRefreshSignature(signedUrl: SignedUrl, refreshWindowMs?: number): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Check if user has access based on auth context
|
|
51
|
+
*/
|
|
52
|
+
export declare function checkAuthAccess(auth: ProtectedAuthContext): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Build auth params for signature request
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildAuthParams(auth: ProtectedAuthContext): Record<string, unknown>;
|
|
57
|
+
/**
|
|
58
|
+
* Get signed URL from cache or fetch new
|
|
59
|
+
*/
|
|
60
|
+
export declare function getCachedSignature(src: string, config: SignatureConfig): Promise<SignedUrl>;
|
|
61
|
+
/**
|
|
62
|
+
* Clear signature cache
|
|
63
|
+
*/
|
|
64
|
+
export declare function clearSignatureCache(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Remove expired signatures from cache
|
|
67
|
+
*/
|
|
68
|
+
export declare function pruneSignatureCache(): number;
|
|
69
|
+
/**
|
|
70
|
+
* Generate client-side signature handler runtime
|
|
71
|
+
*/
|
|
72
|
+
export declare function generateSignatureRuntime(): string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get item from cache
|
|
3
|
+
*/
|
|
4
|
+
export declare function getCached<T>(src: string, options: Record<string, unknown>, type: 'image' | 'video', config?: CacheConfig): Promise<T | null>;
|
|
5
|
+
/**
|
|
6
|
+
* Set item in cache
|
|
7
|
+
*/
|
|
8
|
+
export declare function setCached<T>(src: string, options: Record<string, unknown>, data: T, type: 'image' | 'video', config?: CacheConfig): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Clear cache for a specific source
|
|
11
|
+
*/
|
|
12
|
+
export declare function clearCacheForSource(src: string, type: 'image' | 'video', config?: CacheConfig): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Clear entire cache
|
|
15
|
+
*/
|
|
16
|
+
export declare function clearCache(type: 'image' | 'video' | 'all', config?: CacheConfig): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Get cache statistics
|
|
19
|
+
*/
|
|
20
|
+
export declare function getCacheStats(config?: CacheConfig): Promise<{
|
|
21
|
+
memoryEntries: number
|
|
22
|
+
diskEntries: { image: number; video: number }
|
|
23
|
+
totalSizeMB: number
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Prune old cache entries
|
|
27
|
+
*/
|
|
28
|
+
export declare function pruneCache(config?: CacheConfig): Promise<number>;
|
|
29
|
+
/**
|
|
30
|
+
* Default cache configuration
|
|
31
|
+
*/
|
|
32
|
+
export declare const defaultCacheConfig: CacheConfig;
|
|
33
|
+
/**
|
|
34
|
+
* Cache entry metadata
|
|
35
|
+
*/
|
|
36
|
+
export declare interface CacheEntry<T = unknown> {
|
|
37
|
+
key: string
|
|
38
|
+
src: string
|
|
39
|
+
srcHash: string
|
|
40
|
+
srcMtime: number
|
|
41
|
+
optionsHash: string
|
|
42
|
+
data: T
|
|
43
|
+
createdAt: number
|
|
44
|
+
lastAccessedAt: number
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Cache configuration
|
|
48
|
+
*/
|
|
49
|
+
export declare interface CacheConfig {
|
|
50
|
+
enabled: boolean
|
|
51
|
+
directory: string
|
|
52
|
+
maxAge: number
|
|
53
|
+
maxSize: number
|
|
54
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate SHA-256 hash of file content
|
|
3
|
+
*/
|
|
4
|
+
export declare function hashFile(filePath: string): Promise<string>;
|
|
5
|
+
/**
|
|
6
|
+
* Generate hash from buffer
|
|
7
|
+
*/
|
|
8
|
+
export declare function hashBuffer(buffer: Buffer | Uint8Array): string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate hash from string
|
|
11
|
+
*/
|
|
12
|
+
export declare function hashString(str: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Generate cache key from source path and options
|
|
15
|
+
*/
|
|
16
|
+
export declare function generateCacheKey(src: string, options: Record<string, unknown>): string;
|
|
17
|
+
/**
|
|
18
|
+
* Get file modification time for cache validation
|
|
19
|
+
*/
|
|
20
|
+
export declare function getFileMtime(filePath: string): Promise<number>;
|
|
21
|
+
/**
|
|
22
|
+
* Check if file exists
|
|
23
|
+
*/
|
|
24
|
+
export declare function fileExists(filePath: string): Promise<boolean>;
|