@absolutejs/absolute 0.19.0-beta.176 → 0.19.0-beta.178
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/.absolutejs/eslint-cache +1 -1
- package/.absolutejs/tsconfig.tsbuildinfo +1 -1
- package/ROADMAP.md +191 -191
- package/dist/Image-fpjk72vg.vue +140 -0
- package/dist/src/angular/components/image.component.d.ts +33 -0
- package/dist/src/angular/components/index.d.ts +1 -0
- package/dist/src/angular/components/index.js +395 -0
- package/dist/src/angular/components/index.js.map +11 -0
- package/dist/{angular → src/angular}/index.js +11 -1
- package/dist/{angular → src/angular}/index.js.map +2 -2
- package/dist/src/build/optimizeHtmlImages.d.ts +2 -0
- package/dist/{build.js → src/build.js} +496 -243
- package/dist/{build.js.map → src/build.js.map} +7 -5
- package/dist/{index.js → src/index.js} +746 -276
- package/dist/{index.js.map → src/index.js.map} +9 -6
- package/dist/src/plugins/imageOptimizer.d.ts +2 -0
- package/dist/src/react/components/Image.d.ts +2 -0
- package/dist/src/react/components/index.d.ts +1 -0
- package/dist/{react → src/react}/hooks/index.js +11 -1
- package/dist/{react → src/react}/hooks/index.js.map +2 -2
- package/dist/{react → src/react}/index.js +11 -1
- package/dist/{react → src/react}/index.js.map +2 -2
- package/dist/{svelte → src/svelte}/index.js +11 -1
- package/dist/{svelte → src/svelte}/index.js.map +2 -2
- package/dist/src/utils/imageProcessing.d.ts +33 -0
- package/dist/src/vue/components/index.d.ts +1 -0
- package/dist/src/vue/components/index.js +84 -0
- package/dist/src/vue/components/index.js.map +9 -0
- package/dist/{vue → src/vue}/index.js +11 -1
- package/dist/{vue → src/vue}/index.js.map +2 -2
- package/dist/svelte/components/Head.svelte +147 -0
- package/dist/svelte/components/Image.svelte +158 -0
- package/dist/svelte/components/JsonLd.svelte +20 -0
- package/dist/types/build.d.ts +2 -0
- package/dist/types/image.d.ts +77 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +19 -4
- package/types/build.ts +3 -0
- package/types/image.ts +91 -0
- package/types/index.ts +1 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { JsonLdSchema, WithContext } from '../../../types/jsonLd';
|
|
3
|
+
|
|
4
|
+
let { schema }: { schema: JsonLdSchema | JsonLdSchema[] } = $props();
|
|
5
|
+
|
|
6
|
+
const data = $derived<
|
|
7
|
+
WithContext<JsonLdSchema> | WithContext<JsonLdSchema>[]
|
|
8
|
+
>(
|
|
9
|
+
Array.isArray(schema)
|
|
10
|
+
? schema.map((s) => ({
|
|
11
|
+
'@context': 'https://schema.org' as const,
|
|
12
|
+
...s
|
|
13
|
+
}))
|
|
14
|
+
: { '@context': 'https://schema.org' as const, ...schema }
|
|
15
|
+
);
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<svelte:head>
|
|
19
|
+
{@html `<script type="application/ld+json">${JSON.stringify(data)}</script>`}
|
|
20
|
+
</svelte:head>
|
package/dist/types/build.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { build } from '../src/core/build';
|
|
2
2
|
import { devBuild } from '../src/core/devBuild';
|
|
3
|
+
import type { ImageConfig } from './image';
|
|
3
4
|
import type { SitemapConfig } from './sitemap';
|
|
4
5
|
export type BuildOptions = {
|
|
5
6
|
/** When true, build() throws on error instead of exit(1) - used by HMR rebuilds */
|
|
@@ -45,6 +46,7 @@ export type BuildConfig = {
|
|
|
45
46
|
https?: boolean;
|
|
46
47
|
};
|
|
47
48
|
static?: StaticConfig;
|
|
49
|
+
images?: ImageConfig;
|
|
48
50
|
sitemap?: SitemapConfig;
|
|
49
51
|
};
|
|
50
52
|
export type BuildResult = ReturnType<typeof build>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export type ImageFormat = 'webp' | 'avif' | 'jpeg' | 'png';
|
|
2
|
+
export type RemotePattern = {
|
|
3
|
+
protocol?: 'http' | 'https';
|
|
4
|
+
hostname: string;
|
|
5
|
+
port?: string;
|
|
6
|
+
pathname?: string;
|
|
7
|
+
};
|
|
8
|
+
export type ImageLoaderParams = {
|
|
9
|
+
src: string;
|
|
10
|
+
width: number;
|
|
11
|
+
quality: number;
|
|
12
|
+
};
|
|
13
|
+
export type ImageLoader = (params: ImageLoaderParams) => string;
|
|
14
|
+
export type ImageConfig = {
|
|
15
|
+
/** Breakpoints for device-width responsive images (default: [640, 750, 828, 1080, 1200, 1920, 2048, 3840]) */
|
|
16
|
+
deviceSizes?: number[];
|
|
17
|
+
/** Breakpoints for fixed-width images (default: [16, 32, 48, 64, 96, 128, 256, 384]) */
|
|
18
|
+
imageSizes?: number[];
|
|
19
|
+
/** Output formats in preference order (default: ['webp']). Add 'avif' for smaller files at slower encode. */
|
|
20
|
+
formats?: ImageFormat[];
|
|
21
|
+
/** Minimum cache TTL in seconds (default: 60) */
|
|
22
|
+
minimumCacheTTL?: number;
|
|
23
|
+
/** Allowed remote image origins */
|
|
24
|
+
remotePatterns?: RemotePattern[];
|
|
25
|
+
/** Default quality 1-100 (default: 75) */
|
|
26
|
+
quality?: number;
|
|
27
|
+
/** Custom URL builder — overrides the default optimization endpoint */
|
|
28
|
+
loader?: ImageLoader;
|
|
29
|
+
/** Optimization endpoint path (default: '/_absolute/image') */
|
|
30
|
+
path?: string;
|
|
31
|
+
/** Globally disable image optimization — serve images as-is */
|
|
32
|
+
unoptimized?: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type ImageProps = {
|
|
35
|
+
/** Image source URL or path */
|
|
36
|
+
src: string;
|
|
37
|
+
/** Alt text for accessibility (required) */
|
|
38
|
+
alt: string;
|
|
39
|
+
/** Intrinsic width in pixels (required unless fill) */
|
|
40
|
+
width?: number;
|
|
41
|
+
/** Intrinsic height in pixels (required unless fill) */
|
|
42
|
+
height?: number;
|
|
43
|
+
/** Fill parent container with position: absolute */
|
|
44
|
+
fill?: boolean;
|
|
45
|
+
/** Quality 1-100 (default: 75) */
|
|
46
|
+
quality?: number;
|
|
47
|
+
/** Responsive sizes attribute (e.g., "(max-width: 768px) 100vw, 50vw") */
|
|
48
|
+
sizes?: string;
|
|
49
|
+
/** Custom URL builder for this image */
|
|
50
|
+
loader?: ImageLoader;
|
|
51
|
+
/** Bypass optimization for this image */
|
|
52
|
+
unoptimized?: boolean;
|
|
53
|
+
/** Loading strategy (default: "lazy") */
|
|
54
|
+
loading?: 'lazy' | 'eager';
|
|
55
|
+
/** Add <link rel="preload"> and set loading="eager" + fetchPriority="high" */
|
|
56
|
+
priority?: boolean;
|
|
57
|
+
/** Placeholder while loading: "blur" uses blurDataURL, "empty" shows nothing, or pass a data URI */
|
|
58
|
+
placeholder?: 'blur' | 'empty' | string;
|
|
59
|
+
/** Base64 blur placeholder data URI (auto-generated for build-time images) */
|
|
60
|
+
blurDataURL?: string;
|
|
61
|
+
/** CSS class name */
|
|
62
|
+
className?: string;
|
|
63
|
+
/** Inline styles */
|
|
64
|
+
style?: Record<string, string | number>;
|
|
65
|
+
/** Callback when image loads */
|
|
66
|
+
onLoad?: (() => void) | ((event: Event) => void);
|
|
67
|
+
/** Callback on load error */
|
|
68
|
+
onError?: (() => void) | ((event: Event) => void);
|
|
69
|
+
/** CORS setting */
|
|
70
|
+
crossOrigin?: 'anonymous' | 'use-credentials' | '';
|
|
71
|
+
/** Referrer policy */
|
|
72
|
+
referrerPolicy?: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
|
|
73
|
+
/** Fetch priority hint */
|
|
74
|
+
fetchPriority?: 'high' | 'low' | 'auto';
|
|
75
|
+
/** Override the final src attribute on the rendered <img> */
|
|
76
|
+
overrideSrc?: string;
|
|
77
|
+
};
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -78,14 +78,25 @@
|
|
|
78
78
|
"types": "./dist/src/svelte/index.d.ts"
|
|
79
79
|
},
|
|
80
80
|
"./svelte/components/Head.svelte": {
|
|
81
|
-
"import": "./
|
|
81
|
+
"import": "./dist/svelte/components/Head.svelte"
|
|
82
|
+
},
|
|
83
|
+
"./svelte/components/Image.svelte": {
|
|
84
|
+
"import": "./dist/svelte/components/Image.svelte"
|
|
82
85
|
},
|
|
83
86
|
"./svelte/components/JsonLd.svelte": {
|
|
84
|
-
"import": "./
|
|
87
|
+
"import": "./dist/svelte/components/JsonLd.svelte"
|
|
85
88
|
},
|
|
86
89
|
"./vue": {
|
|
87
90
|
"import": "./dist/vue/index.js",
|
|
88
91
|
"types": "./dist/src/vue/index.d.ts"
|
|
92
|
+
},
|
|
93
|
+
"./vue/components": {
|
|
94
|
+
"import": "./dist/vue/components/index.js",
|
|
95
|
+
"types": "./dist/src/vue/components/index.d.ts"
|
|
96
|
+
},
|
|
97
|
+
"./angular/components": {
|
|
98
|
+
"import": "./dist/angular/components/index.js",
|
|
99
|
+
"types": "./dist/src/angular/components/index.d.ts"
|
|
89
100
|
}
|
|
90
101
|
},
|
|
91
102
|
"license": "BSL-1.1",
|
|
@@ -115,6 +126,7 @@
|
|
|
115
126
|
"react-refresh": "^0.18.0",
|
|
116
127
|
"svelte": "^5.35.2",
|
|
117
128
|
"vue": "^3.5.27",
|
|
129
|
+
"sharp": ">=0.33.0",
|
|
118
130
|
"zone.js": "^0.15.0"
|
|
119
131
|
},
|
|
120
132
|
"peerDependenciesMeta": {
|
|
@@ -151,6 +163,9 @@
|
|
|
151
163
|
"vue": {
|
|
152
164
|
"optional": true
|
|
153
165
|
},
|
|
166
|
+
"sharp": {
|
|
167
|
+
"optional": true
|
|
168
|
+
},
|
|
154
169
|
"zone.js": {
|
|
155
170
|
"optional": true
|
|
156
171
|
}
|
|
@@ -160,7 +175,7 @@
|
|
|
160
175
|
"url": "git+https://github.com/absolutejs/absolutejs.git"
|
|
161
176
|
},
|
|
162
177
|
"scripts": {
|
|
163
|
-
"build": "rm -rf dist && bun build src/index.ts src/build.ts src/angular/index.ts src/react/index.ts src/react/hooks/index.ts src/svelte/index.ts src/vue/index.ts --outdir dist --sourcemap --target=bun --external react --external react-dom --external vue --external @vue/compiler-sfc --external vue/server-renderer --external svelte --external svelte/compiler --external svelte/server --external elysia --external @elysiajs/static --external @angular/compiler-cli --external @angular/core --external @angular/common --external @angular/platform-browser --external @angular/platform-server --external @angular/ssr --external zone.js --external debug --external @absolutejs/native-linux-x64 --external @absolutejs/native-linux-arm64 --external @absolutejs/native-darwin-x64 --external @absolutejs/native-darwin-arm64 && bun build src/cli/index.ts --outfile dist/cli/index.js --target=bun && tsc --emitDeclarationOnly --project tsconfig.build.json && mkdir -p dist/dev && cp -r src/dev/client dist/dev/client",
|
|
178
|
+
"build": "rm -rf dist && bun build src/index.ts src/build.ts src/angular/index.ts src/angular/components/index.ts src/react/index.ts src/react/hooks/index.ts src/svelte/index.ts src/vue/index.ts src/vue/components/index.ts --outdir dist --sourcemap --target=bun --external react --external react-dom --external vue --external @vue/compiler-sfc --external vue/server-renderer --external svelte --external svelte/compiler --external svelte/server --external elysia --external @elysiajs/static --external @angular/compiler-cli --external @angular/core --external @angular/common --external @angular/platform-browser --external @angular/platform-server --external @angular/ssr --external zone.js --external debug --external sharp --external @absolutejs/native-linux-x64 --external @absolutejs/native-linux-arm64 --external @absolutejs/native-darwin-x64 --external @absolutejs/native-darwin-arm64 && bun build src/cli/index.ts --outfile dist/cli/index.js --target=bun && tsc --emitDeclarationOnly --project tsconfig.build.json && mkdir -p dist/dev && cp -r src/dev/client dist/dev/client && mkdir -p dist/svelte/components && cp src/svelte/components/*.svelte dist/svelte/components/",
|
|
164
179
|
"build:native": "./native/build.sh",
|
|
165
180
|
"db:push": "drizzle-kit push",
|
|
166
181
|
"db:studio": "drizzle-kit studio",
|
|
@@ -174,5 +189,5 @@
|
|
|
174
189
|
"typecheck": "bun run vue-tsc --noEmit"
|
|
175
190
|
},
|
|
176
191
|
"types": "./dist/src/index.d.ts",
|
|
177
|
-
"version": "0.19.0-beta.
|
|
192
|
+
"version": "0.19.0-beta.178"
|
|
178
193
|
}
|
package/types/build.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { build } from '../src/core/build';
|
|
2
2
|
import { devBuild } from '../src/core/devBuild';
|
|
3
|
+
import type { ImageConfig } from './image';
|
|
3
4
|
import type { SitemapConfig } from './sitemap';
|
|
4
5
|
|
|
5
6
|
export type BuildOptions = {
|
|
@@ -55,6 +56,8 @@ export type BuildConfig = {
|
|
|
55
56
|
};
|
|
56
57
|
// Static site generation — pre-render routes at build time
|
|
57
58
|
static?: StaticConfig;
|
|
59
|
+
// Image optimization — on-demand resizing, format conversion, caching
|
|
60
|
+
images?: ImageConfig;
|
|
58
61
|
// Sitemap generation — auto-discovers page routes on server start
|
|
59
62
|
sitemap?: SitemapConfig;
|
|
60
63
|
};
|
package/types/image.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export type ImageFormat = 'webp' | 'avif' | 'jpeg' | 'png';
|
|
2
|
+
|
|
3
|
+
export type RemotePattern = {
|
|
4
|
+
protocol?: 'http' | 'https';
|
|
5
|
+
hostname: string;
|
|
6
|
+
port?: string;
|
|
7
|
+
pathname?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type ImageLoaderParams = {
|
|
11
|
+
src: string;
|
|
12
|
+
width: number;
|
|
13
|
+
quality: number;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type ImageLoader = (params: ImageLoaderParams) => string;
|
|
17
|
+
|
|
18
|
+
export type ImageConfig = {
|
|
19
|
+
/** Breakpoints for device-width responsive images (default: [640, 750, 828, 1080, 1200, 1920, 2048, 3840]) */
|
|
20
|
+
deviceSizes?: number[];
|
|
21
|
+
/** Breakpoints for fixed-width images (default: [16, 32, 48, 64, 96, 128, 256, 384]) */
|
|
22
|
+
imageSizes?: number[];
|
|
23
|
+
/** Output formats in preference order (default: ['webp']). Add 'avif' for smaller files at slower encode. */
|
|
24
|
+
formats?: ImageFormat[];
|
|
25
|
+
/** Minimum cache TTL in seconds (default: 60) */
|
|
26
|
+
minimumCacheTTL?: number;
|
|
27
|
+
/** Allowed remote image origins */
|
|
28
|
+
remotePatterns?: RemotePattern[];
|
|
29
|
+
/** Default quality 1-100 (default: 75) */
|
|
30
|
+
quality?: number;
|
|
31
|
+
/** Custom URL builder — overrides the default optimization endpoint */
|
|
32
|
+
loader?: ImageLoader;
|
|
33
|
+
/** Optimization endpoint path (default: '/_absolute/image') */
|
|
34
|
+
path?: string;
|
|
35
|
+
/** Globally disable image optimization — serve images as-is */
|
|
36
|
+
unoptimized?: boolean;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type ImageProps = {
|
|
40
|
+
/** Image source URL or path */
|
|
41
|
+
src: string;
|
|
42
|
+
/** Alt text for accessibility (required) */
|
|
43
|
+
alt: string;
|
|
44
|
+
/** Intrinsic width in pixels (required unless fill) */
|
|
45
|
+
width?: number;
|
|
46
|
+
/** Intrinsic height in pixels (required unless fill) */
|
|
47
|
+
height?: number;
|
|
48
|
+
/** Fill parent container with position: absolute */
|
|
49
|
+
fill?: boolean;
|
|
50
|
+
/** Quality 1-100 (default: 75) */
|
|
51
|
+
quality?: number;
|
|
52
|
+
/** Responsive sizes attribute (e.g., "(max-width: 768px) 100vw, 50vw") */
|
|
53
|
+
sizes?: string;
|
|
54
|
+
/** Custom URL builder for this image */
|
|
55
|
+
loader?: ImageLoader;
|
|
56
|
+
/** Bypass optimization for this image */
|
|
57
|
+
unoptimized?: boolean;
|
|
58
|
+
/** Loading strategy (default: "lazy") */
|
|
59
|
+
loading?: 'lazy' | 'eager';
|
|
60
|
+
/** Add <link rel="preload"> and set loading="eager" + fetchPriority="high" */
|
|
61
|
+
priority?: boolean;
|
|
62
|
+
/** Placeholder while loading: "blur" uses blurDataURL, "empty" shows nothing, or pass a data URI */
|
|
63
|
+
placeholder?: 'blur' | 'empty' | string;
|
|
64
|
+
/** Base64 blur placeholder data URI (auto-generated for build-time images) */
|
|
65
|
+
blurDataURL?: string;
|
|
66
|
+
/** CSS class name */
|
|
67
|
+
className?: string;
|
|
68
|
+
/** Inline styles */
|
|
69
|
+
style?: Record<string, string | number>;
|
|
70
|
+
/** Callback when image loads */
|
|
71
|
+
onLoad?: (() => void) | ((event: Event) => void);
|
|
72
|
+
/** Callback on load error */
|
|
73
|
+
onError?: (() => void) | ((event: Event) => void);
|
|
74
|
+
/** CORS setting */
|
|
75
|
+
crossOrigin?: 'anonymous' | 'use-credentials' | '';
|
|
76
|
+
/** Referrer policy */
|
|
77
|
+
referrerPolicy?:
|
|
78
|
+
| ''
|
|
79
|
+
| 'no-referrer'
|
|
80
|
+
| 'no-referrer-when-downgrade'
|
|
81
|
+
| 'origin'
|
|
82
|
+
| 'origin-when-cross-origin'
|
|
83
|
+
| 'same-origin'
|
|
84
|
+
| 'strict-origin'
|
|
85
|
+
| 'strict-origin-when-cross-origin'
|
|
86
|
+
| 'unsafe-url';
|
|
87
|
+
/** Fetch priority hint */
|
|
88
|
+
fetchPriority?: 'high' | 'low' | 'auto';
|
|
89
|
+
/** Override the final src attribute on the rendered <img> */
|
|
90
|
+
overrideSrc?: string;
|
|
91
|
+
};
|