astro 5.7.4 → 5.7.6
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/components/image.css +5 -12
- package/dist/assets/fonts/config.d.ts +6 -22
- package/dist/assets/fonts/config.js +2 -3
- package/dist/assets/fonts/constants.d.ts +1 -1
- package/dist/assets/fonts/providers/index.d.ts +1 -1
- package/dist/assets/fonts/providers/index.js +3 -2
- package/dist/assets/fonts/utils.d.ts +2 -2
- package/dist/assets/fonts/utils.js +9 -6
- package/dist/assets/fonts/vite-plugin-fonts.js +29 -10
- package/dist/assets/internal.js +0 -2
- package/dist/assets/layout.js +4 -4
- package/dist/assets/services/service.d.ts +1 -1
- package/dist/assets/types.d.ts +4 -4
- package/dist/assets/utils/etag.d.ts +0 -11
- package/dist/assets/utils/etag.js +1 -2
- package/dist/assets/utils/vendor/image-size/lookup.d.ts +0 -2
- package/dist/assets/utils/vendor/image-size/lookup.js +0 -10
- package/dist/cli/add/index.d.ts +0 -9
- package/dist/cli/add/index.js +1 -2
- package/dist/cli/info/index.d.ts +0 -1
- package/dist/cli/info/index.js +0 -1
- package/dist/cli/preferences/index.d.ts +0 -2
- package/dist/container/index.js +1 -6
- package/dist/content/content-layer.d.ts +2 -7
- package/dist/content/content-layer.js +4 -6
- package/dist/content/index.d.ts +1 -2
- package/dist/content/index.js +1 -5
- package/dist/content/loaders/file.d.ts +2 -1
- package/dist/content/loaders/glob.d.ts +3 -2
- package/dist/content/utils.d.ts +1 -12
- package/dist/content/utils.js +0 -13
- package/dist/content/vite-plugin-content-virtual-mod.d.ts +0 -16
- package/dist/content/vite-plugin-content-virtual-mod.js +1 -3
- package/dist/core/app/index.js +3 -4
- package/dist/core/app/pipeline.d.ts +2 -3
- package/dist/core/app/pipeline.js +1 -3
- package/dist/core/app/types.d.ts +3 -2
- package/dist/core/build/consts.d.ts +0 -1
- package/dist/core/build/consts.js +1 -3
- package/dist/core/build/index.d.ts +2 -1
- package/dist/core/build/page-data.d.ts +3 -2
- package/dist/core/build/plugin.d.ts +1 -1
- package/dist/core/build/plugins/plugin-analyzer.d.ts +0 -2
- package/dist/core/build/plugins/plugin-analyzer.js +1 -2
- package/dist/core/build/plugins/plugin-chunks.d.ts +0 -2
- package/dist/core/build/plugins/plugin-chunks.js +1 -2
- package/dist/core/build/plugins/plugin-component-entry.d.ts +0 -8
- package/dist/core/build/plugins/plugin-component-entry.js +1 -3
- package/dist/core/build/plugins/plugin-internals.d.ts +0 -2
- package/dist/core/build/plugins/plugin-internals.js +1 -2
- package/dist/core/build/plugins/plugin-renderers.d.ts +0 -2
- package/dist/core/build/plugins/plugin-renderers.js +1 -2
- package/dist/core/build/plugins/plugin-scripts.d.ts +0 -5
- package/dist/core/build/plugins/plugin-scripts.js +1 -2
- package/dist/core/build/plugins/plugin-ssr.d.ts +0 -1
- package/dist/core/build/plugins/plugin-ssr.js +0 -1
- package/dist/core/build/plugins/util.d.ts +0 -9
- package/dist/core/build/plugins/util.js +0 -2
- package/dist/core/build/types.d.ts +1 -1
- package/dist/core/config/config.d.ts +0 -1
- package/dist/core/config/config.js +0 -1
- package/dist/core/config/index.d.ts +1 -2
- package/dist/core/config/index.js +0 -2
- package/dist/core/config/schemas/base.d.ts +21 -19
- package/dist/core/config/schemas/base.js +1 -1
- package/dist/core/config/schemas/relative.d.ts +25 -25
- package/dist/core/config/timer.d.ts +0 -5
- package/dist/core/config/tsconfig.d.ts +1 -1
- package/dist/core/constants.d.ts +0 -4
- package/dist/core/constants.js +1 -3
- package/dist/core/cookies/index.d.ts +1 -1
- package/dist/core/cookies/index.js +2 -4
- package/dist/core/cookies/response.d.ts +0 -1
- package/dist/core/cookies/response.js +1 -5
- package/dist/core/dev/container.d.ts +2 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/index.d.ts +1 -1
- package/dist/core/dev/index.js +1 -2
- package/dist/core/dev/restart.d.ts +1 -1
- package/dist/core/encryption.d.ts +0 -8
- package/dist/core/encryption.js +1 -7
- package/dist/core/errors/errors-data.d.ts +2 -1
- package/dist/core/errors/errors-data.js +2 -1
- package/dist/core/errors/index.d.ts +1 -2
- package/dist/core/errors/index.js +0 -2
- package/dist/core/logger/core.d.ts +3 -9
- package/dist/core/logger/core.js +1 -5
- package/dist/core/messages.d.ts +0 -1
- package/dist/core/messages.js +2 -11
- package/dist/core/middleware/sequence.js +3 -0
- package/dist/core/preview/static-preview-server.d.ts +2 -1
- package/dist/core/redirects/index.d.ts +0 -1
- package/dist/core/redirects/index.js +0 -2
- package/dist/core/render/index.d.ts +0 -17
- package/dist/core/render/ssr-element.d.ts +0 -2
- package/dist/core/render/ssr-element.js +0 -2
- package/dist/core/render-context.js +4 -0
- package/dist/core/request.d.ts +1 -1
- package/dist/core/routing/3xx.d.ts +2 -1
- package/dist/core/routing/astro-designed-error-pages.d.ts +0 -1
- package/dist/core/routing/astro-designed-error-pages.js +1 -16
- package/dist/core/routing/index.d.ts +2 -3
- package/dist/core/routing/index.js +3 -8
- package/dist/core/routing/manifest/create.d.ts +2 -3
- package/dist/core/routing/manifest/create.js +4 -2
- package/dist/core/routing/request.d.ts +0 -1
- package/dist/core/routing/request.js +1 -2
- package/dist/core/routing/rewrite.d.ts +3 -2
- package/dist/core/server-islands/vite-plugin-server-islands.d.ts +0 -1
- package/dist/core/server-islands/vite-plugin-server-islands.js +0 -1
- package/dist/core/sync/index.d.ts +2 -1
- package/dist/core/util.d.ts +0 -1
- package/dist/core/util.js +0 -1
- package/dist/events/session.d.ts +1 -1
- package/dist/integrations/features-validation.d.ts +1 -3
- package/dist/integrations/features-validation.js +0 -2
- package/dist/preferences/index.d.ts +4 -4
- package/dist/type-utils.d.ts +0 -4
- package/dist/types/public/config.d.ts +36 -20
- package/dist/types/typed-emitter.d.ts +2 -1
- package/dist/vite-plugin-astro/hmr.d.ts +2 -1
- package/dist/vite-plugin-astro/query.d.ts +3 -2
- package/dist/vite-plugin-astro/types.d.ts +2 -1
- package/dist/vite-plugin-astro-server/controller.d.ts +2 -2
- package/dist/vite-plugin-astro-server/plugin.d.ts +2 -1
- package/dist/vite-plugin-astro-server/response.d.ts +0 -1
- package/dist/vite-plugin-astro-server/response.js +0 -12
- package/dist/vite-plugin-astro-server/route.d.ts +1 -1
- package/dist/vite-plugin-astro-server/server-state.d.ts +3 -3
- package/dist/vite-plugin-astro-server/server-state.js +0 -4
- package/dist/vite-plugin-load-fallback/index.d.ts +1 -1
- package/dist/vite-plugin-scanner/index.d.ts +2 -1
- package/package.json +5 -11
- package/templates/env.mjs +1 -0
package/components/image.css
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
[data-astro-image] {
|
|
2
|
-
width: 100%;
|
|
3
|
-
height: auto;
|
|
1
|
+
:where([data-astro-image]) {
|
|
4
2
|
object-fit: var(--fit);
|
|
5
3
|
object-position: var(--pos);
|
|
6
|
-
aspect-ratio: var(--w) / var(--h);
|
|
7
4
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
max-width: calc(var(--w) * 1px);
|
|
11
|
-
max-height: calc(var(--h) * 1px);
|
|
5
|
+
:where([data-astro-image='full-width']) {
|
|
6
|
+
width: 100%;
|
|
12
7
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
width: calc(var(--w) * 1px);
|
|
16
|
-
height: calc(var(--h) * 1px);
|
|
8
|
+
:where([data-astro-image='constrained']) {
|
|
9
|
+
max-width: 100%;
|
|
17
10
|
}
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const requiredFamilyAttributesSchema: z.ZodObject<{
|
|
3
|
-
/**
|
|
4
|
-
* The font family name, as identified by your font provider.
|
|
5
|
-
*/
|
|
6
|
-
name: z.ZodString;
|
|
7
|
-
/**
|
|
8
|
-
* A valid [ident](https://developer.mozilla.org/en-US/docs/Web/CSS/ident) in the form of a CSS variable (i.e. starting with `--`).
|
|
9
|
-
*/
|
|
10
|
-
cssVariable: z.ZodString;
|
|
11
|
-
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
name: string;
|
|
13
|
-
cssVariable: string;
|
|
14
|
-
}, {
|
|
15
|
-
name: string;
|
|
16
|
-
cssVariable: string;
|
|
17
|
-
}>;
|
|
18
2
|
export declare const fontProviderSchema: z.ZodObject<{
|
|
19
3
|
/**
|
|
20
4
|
* URL, path relative to the root or package import.
|
|
@@ -59,7 +43,7 @@ export declare const localFontFamilySchema: z.ZodObject<z.objectUtil.extendShape
|
|
|
59
43
|
|
|
60
44
|
* If the last font in the `fallbacks` array is a [generic family name](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#generic-name), an [optimized fallback](https://developer.chrome.com/blog/font-fallbacks) using font metrics will be generated. To disable this optimization, set `optimizedFallbacks` to false.
|
|
61
45
|
*/
|
|
62
|
-
fallbacks: z.ZodOptional<z.ZodArray<z.ZodString, "
|
|
46
|
+
fallbacks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
63
47
|
/**
|
|
64
48
|
* @default `true`
|
|
65
49
|
*
|
|
@@ -189,7 +173,7 @@ export declare const localFontFamilySchema: z.ZodObject<z.objectUtil.extendShape
|
|
|
189
173
|
featureSettings?: string | undefined;
|
|
190
174
|
variationSettings?: string | undefined;
|
|
191
175
|
}[]];
|
|
192
|
-
fallbacks?:
|
|
176
|
+
fallbacks?: string[] | undefined;
|
|
193
177
|
optimizedFallbacks?: boolean | undefined;
|
|
194
178
|
}, {
|
|
195
179
|
name: string;
|
|
@@ -226,7 +210,7 @@ export declare const localFontFamilySchema: z.ZodObject<z.objectUtil.extendShape
|
|
|
226
210
|
featureSettings?: string | undefined;
|
|
227
211
|
variationSettings?: string | undefined;
|
|
228
212
|
}[]];
|
|
229
|
-
fallbacks?:
|
|
213
|
+
fallbacks?: string[] | undefined;
|
|
230
214
|
optimizedFallbacks?: boolean | undefined;
|
|
231
215
|
}>;
|
|
232
216
|
export declare const remoteFontFamilySchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
@@ -292,7 +276,7 @@ export declare const remoteFontFamilySchema: z.ZodObject<z.objectUtil.extendShap
|
|
|
292
276
|
|
|
293
277
|
* If the last font in the `fallbacks` array is a [generic family name](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#generic-name), an [optimized fallback](https://developer.chrome.com/blog/font-fallbacks) using font metrics will be generated. To disable this optimization, set `optimizedFallbacks` to false.
|
|
294
278
|
*/
|
|
295
|
-
fallbacks: z.ZodOptional<z.ZodArray<z.ZodString, "
|
|
279
|
+
fallbacks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
296
280
|
/**
|
|
297
281
|
* @default `true`
|
|
298
282
|
*
|
|
@@ -348,7 +332,7 @@ export declare const remoteFontFamilySchema: z.ZodObject<z.objectUtil.extendShap
|
|
|
348
332
|
entrypoint: string | URL;
|
|
349
333
|
config?: Record<string, any> | undefined;
|
|
350
334
|
};
|
|
351
|
-
fallbacks?:
|
|
335
|
+
fallbacks?: string[] | undefined;
|
|
352
336
|
optimizedFallbacks?: boolean | undefined;
|
|
353
337
|
display?: "fallback" | "auto" | "optional" | "block" | "swap" | undefined;
|
|
354
338
|
unicodeRange?: [string, ...string[]] | undefined;
|
|
@@ -365,7 +349,7 @@ export declare const remoteFontFamilySchema: z.ZodObject<z.objectUtil.extendShap
|
|
|
365
349
|
entrypoint: string | URL;
|
|
366
350
|
config?: Record<string, any> | undefined;
|
|
367
351
|
};
|
|
368
|
-
fallbacks?:
|
|
352
|
+
fallbacks?: string[] | undefined;
|
|
369
353
|
optimizedFallbacks?: boolean | undefined;
|
|
370
354
|
display?: "fallback" | "auto" | "optional" | "block" | "swap" | undefined;
|
|
371
355
|
unicodeRange?: [string, ...string[]] | undefined;
|
|
@@ -57,7 +57,7 @@ const fallbacksSchema = z.object({
|
|
|
57
57
|
|
|
58
58
|
* If the last font in the `fallbacks` array is a [generic family name](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family#generic-name), an [optimized fallback](https://developer.chrome.com/blog/font-fallbacks) using font metrics will be generated. To disable this optimization, set `optimizedFallbacks` to false.
|
|
59
59
|
*/
|
|
60
|
-
fallbacks: z.array(z.string()).
|
|
60
|
+
fallbacks: z.array(z.string()).optional(),
|
|
61
61
|
/**
|
|
62
62
|
* @default `true`
|
|
63
63
|
*
|
|
@@ -152,6 +152,5 @@ const remoteFontFamilySchema = requiredFamilyAttributesSchema.merge(
|
|
|
152
152
|
export {
|
|
153
153
|
fontProviderSchema,
|
|
154
154
|
localFontFamilySchema,
|
|
155
|
-
remoteFontFamilySchema
|
|
156
|
-
requiredFamilyAttributesSchema
|
|
155
|
+
remoteFontFamilySchema
|
|
157
156
|
};
|
|
@@ -3,7 +3,7 @@ export declare const DEFAULTS: {
|
|
|
3
3
|
weights: string[];
|
|
4
4
|
styles: ["normal", "italic"];
|
|
5
5
|
subsets: [string, string, string, string, string, string, string];
|
|
6
|
-
fallbacks: [
|
|
6
|
+
fallbacks: string[];
|
|
7
7
|
optimizedFallbacks: true;
|
|
8
8
|
};
|
|
9
9
|
export declare const VIRTUAL_MODULE_ID = "virtual:astro:assets/fonts/internal";
|
|
@@ -21,7 +21,7 @@ declare function fontsource(): {
|
|
|
21
21
|
config?: Record<string, any> | undefined;
|
|
22
22
|
};
|
|
23
23
|
/** [Google](https://fonts.google.com/) */
|
|
24
|
-
declare function google(): {
|
|
24
|
+
declare function google(config?: Parameters<typeof providers.google>[0]): {
|
|
25
25
|
entrypoint: string | URL;
|
|
26
26
|
config?: Record<string, any> | undefined;
|
|
27
27
|
};
|
|
@@ -19,9 +19,10 @@ function fontsource() {
|
|
|
19
19
|
entrypoint: "astro/assets/fonts/providers/fontsource"
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
function google() {
|
|
22
|
+
function google(config) {
|
|
23
23
|
return defineAstroFontProvider({
|
|
24
|
-
entrypoint: "astro/assets/fonts/providers/google"
|
|
24
|
+
entrypoint: "astro/assets/fonts/providers/google",
|
|
25
|
+
config
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
const fontProviders = {
|
|
@@ -6,7 +6,6 @@ import { type ResolveProviderOptions } from './providers/utils.js';
|
|
|
6
6
|
import type { FontFamily, FontType, ResolvedFontFamily } from './types.js';
|
|
7
7
|
export declare function toCSS(properties: Record<string, string | undefined>, indent?: number): string;
|
|
8
8
|
export declare function renderFontFace(properties: Record<string, string | undefined>): string;
|
|
9
|
-
export declare function unifontFontFaceDataToProperties(font: Partial<unifont.FontFaceData>): Record<string, string | undefined>;
|
|
10
9
|
export declare function generateFontFace(family: string, font: unifont.FontFaceData): string;
|
|
11
10
|
export declare function renderFontSrc(sources: Exclude<unifont.FontFaceData['src'][number], string>[]): string;
|
|
12
11
|
export declare function withoutQuotes(str: string): string;
|
|
@@ -77,9 +76,10 @@ export declare function generateFallbacksCSS({ family, fallbacks: _fallbacks, fo
|
|
|
77
76
|
* one of the built-in providers and resolve it. The most important part is that if a
|
|
78
77
|
* provider is not provided but `src` is, then it's inferred as the local provider.
|
|
79
78
|
*/
|
|
80
|
-
export declare function resolveFontFamily({ family, generateNameWithHash, root, resolveMod, }: Omit<ResolveProviderOptions, 'provider'> & {
|
|
79
|
+
export declare function resolveFontFamily({ family, generateNameWithHash, root, resolveMod, resolveLocalEntrypoint, }: Omit<ResolveProviderOptions, 'provider'> & {
|
|
81
80
|
family: FontFamily;
|
|
82
81
|
generateNameWithHash: (family: FontFamily) => string;
|
|
82
|
+
resolveLocalEntrypoint: (url: string) => string;
|
|
83
83
|
}): Promise<ResolvedFontFamily>;
|
|
84
84
|
export declare function sortObjectByKey<T extends Record<string, any>>(unordered: T): T;
|
|
85
85
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { extname } from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
4
|
import { AstroError, AstroErrorData } from "../../core/errors/index.js";
|
|
5
5
|
import { DEFAULT_FALLBACKS, FONT_TYPES, LOCAL_PROVIDER_NAME, SYSTEM_METRICS } from "./constants.js";
|
|
6
6
|
import { resolveProvider } from "./providers/utils.js";
|
|
@@ -137,7 +137,7 @@ function dedupe(arr) {
|
|
|
137
137
|
}
|
|
138
138
|
function resolveVariants({
|
|
139
139
|
variants,
|
|
140
|
-
|
|
140
|
+
resolveEntrypoint: _resolveEntrypoint
|
|
141
141
|
}) {
|
|
142
142
|
return variants.map((variant) => ({
|
|
143
143
|
...variant,
|
|
@@ -147,7 +147,7 @@ function resolveVariants({
|
|
|
147
147
|
const url = (isValue ? value : value.url).toString();
|
|
148
148
|
const tech = isValue ? void 0 : value.tech;
|
|
149
149
|
return {
|
|
150
|
-
url:
|
|
150
|
+
url: _resolveEntrypoint(url),
|
|
151
151
|
tech
|
|
152
152
|
};
|
|
153
153
|
})
|
|
@@ -157,14 +157,18 @@ async function resolveFontFamily({
|
|
|
157
157
|
family,
|
|
158
158
|
generateNameWithHash,
|
|
159
159
|
root,
|
|
160
|
-
resolveMod
|
|
160
|
+
resolveMod,
|
|
161
|
+
resolveLocalEntrypoint
|
|
161
162
|
}) {
|
|
162
163
|
const nameWithHash = generateNameWithHash(family);
|
|
163
164
|
if (family.provider === LOCAL_PROVIDER_NAME) {
|
|
164
165
|
return {
|
|
165
166
|
...family,
|
|
166
167
|
nameWithHash,
|
|
167
|
-
variants: resolveVariants({
|
|
168
|
+
variants: resolveVariants({
|
|
169
|
+
variants: family.variants,
|
|
170
|
+
resolveEntrypoint: resolveLocalEntrypoint
|
|
171
|
+
}),
|
|
168
172
|
fallbacks: family.fallbacks ? dedupe(family.fallbacks) : void 0
|
|
169
173
|
};
|
|
170
174
|
}
|
|
@@ -241,6 +245,5 @@ export {
|
|
|
241
245
|
resolveFontFamily,
|
|
242
246
|
sortObjectByKey,
|
|
243
247
|
toCSS,
|
|
244
|
-
unifontFontFaceDataToProperties,
|
|
245
248
|
withoutQuotes
|
|
246
249
|
};
|
|
@@ -21,6 +21,7 @@ import { generateFallbackFontFace, readMetrics } from "./metrics.js";
|
|
|
21
21
|
import {
|
|
22
22
|
cache,
|
|
23
23
|
extractFontType,
|
|
24
|
+
resolveEntrypoint,
|
|
24
25
|
resolveFontFamily,
|
|
25
26
|
sortObjectByKey,
|
|
26
27
|
withoutQuotes
|
|
@@ -49,14 +50,17 @@ function fontsPlugin({ settings, sync, logger }) {
|
|
|
49
50
|
if (!settings.config.experimental.fonts) {
|
|
50
51
|
return {
|
|
51
52
|
name: "astro:fonts:fallback",
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
resolveId(id) {
|
|
54
|
+
if (id === VIRTUAL_MODULE_ID) {
|
|
55
|
+
return RESOLVED_VIRTUAL_MODULE_ID;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
load(id) {
|
|
59
|
+
if (id === RESOLVED_VIRTUAL_MODULE_ID) {
|
|
60
|
+
return {
|
|
61
|
+
code: ""
|
|
62
|
+
};
|
|
63
|
+
}
|
|
60
64
|
}
|
|
61
65
|
};
|
|
62
66
|
}
|
|
@@ -81,16 +85,31 @@ function fontsPlugin({ settings, sync, logger }) {
|
|
|
81
85
|
hashToUrlMap = /* @__PURE__ */ new Map();
|
|
82
86
|
resolvedMap = /* @__PURE__ */ new Map();
|
|
83
87
|
const families = [];
|
|
88
|
+
const root = settings.config.root;
|
|
89
|
+
const pathsToWarn = /* @__PURE__ */ new Set();
|
|
84
90
|
for (const family of settings.config.experimental.fonts) {
|
|
85
91
|
families.push(
|
|
86
92
|
await resolveFontFamily({
|
|
87
93
|
family,
|
|
88
|
-
root
|
|
94
|
+
root,
|
|
89
95
|
resolveMod,
|
|
90
|
-
generateNameWithHash: (_family) => `${withoutQuotes(_family.name)}-${h64ToString(JSON.stringify(sortObjectByKey(_family)))}
|
|
96
|
+
generateNameWithHash: (_family) => `${withoutQuotes(_family.name)}-${h64ToString(JSON.stringify(sortObjectByKey(_family)))}`,
|
|
97
|
+
resolveLocalEntrypoint: (url) => {
|
|
98
|
+
const resolvedPath = fileURLToPath(resolveEntrypoint(root, url));
|
|
99
|
+
if (resolvedPath.startsWith(fileURLToPath(settings.config.publicDir))) {
|
|
100
|
+
pathsToWarn.add(resolvedPath);
|
|
101
|
+
}
|
|
102
|
+
return resolvedPath;
|
|
103
|
+
}
|
|
91
104
|
})
|
|
92
105
|
);
|
|
93
106
|
}
|
|
107
|
+
for (const path of [...pathsToWarn]) {
|
|
108
|
+
logger.warn(
|
|
109
|
+
"assets",
|
|
110
|
+
`Found a local font file ${JSON.stringify(path)} in the \`public/\` folder. To avoid duplicated files in the build output, move this file into \`src/\``
|
|
111
|
+
);
|
|
112
|
+
}
|
|
94
113
|
await loadFonts({
|
|
95
114
|
base: baseUrl,
|
|
96
115
|
families,
|
package/dist/assets/internal.js
CHANGED
|
@@ -112,8 +112,6 @@ async function getImage(options, imageConfig) {
|
|
|
112
112
|
if (layout !== "none") {
|
|
113
113
|
resolvedOptions.style = addCSSVarsToStyle(
|
|
114
114
|
{
|
|
115
|
-
w: String(resolvedOptions.width),
|
|
116
|
-
h: String(resolvedOptions.height),
|
|
117
115
|
fit: cssFitValues.includes(resolvedOptions.fit ?? "") && resolvedOptions.fit,
|
|
118
116
|
pos: resolvedOptions.position
|
|
119
117
|
},
|
package/dist/assets/layout.js
CHANGED
|
@@ -66,7 +66,7 @@ const getWidths = ({
|
|
|
66
66
|
if (layout === "fixed") {
|
|
67
67
|
return originalWidth && width > originalWidth ? [originalWidth] : [width, maxSize];
|
|
68
68
|
}
|
|
69
|
-
if (layout === "
|
|
69
|
+
if (layout === "constrained") {
|
|
70
70
|
return [
|
|
71
71
|
// Always include the image at 1x and 2x the specified width
|
|
72
72
|
width,
|
|
@@ -86,13 +86,13 @@ const getSizesAttribute = ({
|
|
|
86
86
|
switch (layout) {
|
|
87
87
|
// If screen is wider than the max size then image width is the max size,
|
|
88
88
|
// otherwise it's the width of the screen
|
|
89
|
-
case
|
|
89
|
+
case "constrained":
|
|
90
90
|
return `(min-width: ${width}px) ${width}px, 100vw`;
|
|
91
91
|
// Image is always the same width, whatever the size of the screen
|
|
92
|
-
case
|
|
92
|
+
case "fixed":
|
|
93
93
|
return `${width}px`;
|
|
94
94
|
// Image is always the width of the screen
|
|
95
|
-
case
|
|
95
|
+
case "full-width":
|
|
96
96
|
return `100vw`;
|
|
97
97
|
case "none":
|
|
98
98
|
default:
|
|
@@ -44,7 +44,7 @@ interface SharedServiceProps<T extends Record<string, any> = Record<string, any>
|
|
|
44
44
|
validateOptions?: (options: ImageTransform, imageConfig: ImageConfig<T>) => ImageTransform | Promise<ImageTransform>;
|
|
45
45
|
}
|
|
46
46
|
export type ExternalImageService<T extends Record<string, any> = Record<string, any>> = SharedServiceProps<T>;
|
|
47
|
-
|
|
47
|
+
type LocalImageTransform = {
|
|
48
48
|
src: string;
|
|
49
49
|
[key: string]: any;
|
|
50
50
|
};
|
package/dist/assets/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type ImageQualityPreset = 'low' | 'mid' | 'high' | 'max' | (string & {});
|
|
|
5
5
|
export type ImageQuality = ImageQualityPreset | number;
|
|
6
6
|
export type ImageInputFormat = (typeof VALID_INPUT_FORMATS)[number];
|
|
7
7
|
export type ImageOutputFormat = (typeof VALID_OUTPUT_FORMATS)[number] | (string & {});
|
|
8
|
-
export type ImageLayout = '
|
|
8
|
+
export type ImageLayout = 'constrained' | 'fixed' | 'full-width' | 'none';
|
|
9
9
|
export type ImageFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down' | (string & {});
|
|
10
10
|
export type AssetsGlobalStaticImagesList = Map<string, {
|
|
11
11
|
originalSrcPath: string | undefined;
|
|
@@ -140,15 +140,15 @@ type ImageSharedProps<T> = T & {
|
|
|
140
140
|
/**
|
|
141
141
|
* The layout type for responsive images. Requires the `experimental.responsiveImages` flag to be enabled in the Astro config.
|
|
142
142
|
*
|
|
143
|
-
* Allowed values are `
|
|
143
|
+
* Allowed values are `constrained`, `fixed`, `full-width` or `none`. Defaults to value of `image.experimentalLayout`.
|
|
144
144
|
*
|
|
145
|
-
* - `
|
|
145
|
+
* - `constrained` - The image will scale to fit the container, maintaining its aspect ratio, but will not exceed the specified dimensions.
|
|
146
146
|
* - `fixed` - The image will maintain its original dimensions.
|
|
147
147
|
* - `full-width` - The image will scale to fit the container, maintaining its aspect ratio, even if that means the image will exceed its original dimensions.
|
|
148
148
|
*
|
|
149
149
|
* **Example**:
|
|
150
150
|
* ```astro
|
|
151
|
-
* <Image src={...} layout="
|
|
151
|
+
* <Image src={...} layout="constrained" alt="..." />
|
|
152
152
|
* ```
|
|
153
153
|
*/
|
|
154
154
|
layout?: ImageLayout;
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FNV-1a Hash implementation
|
|
3
|
-
* @author Travis Webb (tjwebb) <me@traviswebb.com>
|
|
4
|
-
*
|
|
5
|
-
* Ported from https://github.com/tjwebb/fnv-plus/blob/master/index.js
|
|
6
|
-
* License https://github.com/tjwebb/fnv-plus#license
|
|
7
|
-
*
|
|
8
|
-
* Simplified, optimized and add modified for 52 bit, which provides a larger hash space
|
|
9
|
-
* and still making use of Javascript's 53-bit integer space.
|
|
10
|
-
*/
|
|
11
|
-
export declare const fnv1a52: (str: string) => number;
|
|
12
1
|
export declare const etag: (payload: string, weak?: boolean) => string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { imageType } from './types/index.js';
|
|
2
1
|
import type { ISizeCalculationResult } from './types/interface.ts';
|
|
3
2
|
/**
|
|
4
3
|
* Return size information based on an Uint8Array
|
|
@@ -7,4 +6,3 @@ import type { ISizeCalculationResult } from './types/interface.ts';
|
|
|
7
6
|
* @returns {ISizeCalculationResult}
|
|
8
7
|
*/
|
|
9
8
|
export declare function lookup(input: Uint8Array): ISizeCalculationResult;
|
|
10
|
-
export declare const disableTypes: (types: imageType[]) => void;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { typeHandlers } from "./types/index.js";
|
|
2
2
|
import { detector } from "./detector.js";
|
|
3
|
-
const globalOptions = {
|
|
4
|
-
disabledTypes: []
|
|
5
|
-
};
|
|
6
3
|
function lookup(input) {
|
|
7
4
|
const type = detector(input);
|
|
8
5
|
if (typeof type !== "undefined") {
|
|
9
|
-
if (globalOptions.disabledTypes.includes(type)) {
|
|
10
|
-
throw new TypeError("disabled file type: " + type);
|
|
11
|
-
}
|
|
12
6
|
const size = typeHandlers.get(type).calculate(input);
|
|
13
7
|
if (size !== void 0) {
|
|
14
8
|
size.type = size.type ?? type;
|
|
@@ -17,10 +11,6 @@ function lookup(input) {
|
|
|
17
11
|
}
|
|
18
12
|
throw new TypeError("unsupported file type: " + type);
|
|
19
13
|
}
|
|
20
|
-
const disableTypes = (types) => {
|
|
21
|
-
globalOptions.disabledTypes = types;
|
|
22
|
-
};
|
|
23
14
|
export {
|
|
24
|
-
disableTypes,
|
|
25
15
|
lookup
|
|
26
16
|
};
|
package/dist/cli/add/index.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import { type ProxifiedModule } from 'magicast';
|
|
2
1
|
import { type Flags } from '../flags.js';
|
|
3
2
|
interface AddOptions {
|
|
4
3
|
flags: Flags;
|
|
5
4
|
}
|
|
6
|
-
interface IntegrationInfo {
|
|
7
|
-
id: string;
|
|
8
|
-
packageName: string;
|
|
9
|
-
integrationName: string;
|
|
10
|
-
dependencies: [name: string, version: string][];
|
|
11
|
-
type: 'integration' | 'adapter';
|
|
12
|
-
}
|
|
13
5
|
export declare function add(names: string[], { flags }: AddOptions): Promise<void>;
|
|
14
|
-
export declare function setAdapter(mod: ProxifiedModule<any>, adapter: IntegrationInfo, exportName: string): void;
|
|
15
6
|
export {};
|
package/dist/cli/add/index.js
CHANGED
package/dist/cli/info/index.d.ts
CHANGED
|
@@ -8,6 +8,5 @@ export declare function getInfoOutput({ userConfig, print, }: {
|
|
|
8
8
|
print: boolean;
|
|
9
9
|
}): Promise<string>;
|
|
10
10
|
export declare function printInfo({ flags }: InfoOptions): Promise<void>;
|
|
11
|
-
export declare function copyToClipboard(text: string, force?: boolean): Promise<void>;
|
|
12
11
|
export declare function readFromClipboard(): string;
|
|
13
12
|
export {};
|
package/dist/cli/info/index.js
CHANGED
|
@@ -2,7 +2,5 @@ import { type Flags } from '../flags.js';
|
|
|
2
2
|
interface PreferencesOptions {
|
|
3
3
|
flags: Flags;
|
|
4
4
|
}
|
|
5
|
-
declare const PREFERENCES_SUBCOMMANDS: readonly ["get", "set", "enable", "disable", "delete", "reset", "list"];
|
|
6
|
-
export type Subcommand = (typeof PREFERENCES_SUBCOMMANDS)[number];
|
|
7
5
|
export declare function preferences(subcommand: string, key: string, value: string | undefined, { flags }: PreferencesOptions): Promise<number>;
|
|
8
6
|
export {};
|
package/dist/container/index.js
CHANGED
|
@@ -55,11 +55,6 @@ class experimental_AstroContainer {
|
|
|
55
55
|
* @private
|
|
56
56
|
*/
|
|
57
57
|
#withManifest = false;
|
|
58
|
-
/**
|
|
59
|
-
* Internal function responsible for importing a renderer
|
|
60
|
-
* @private
|
|
61
|
-
*/
|
|
62
|
-
#getRenderer;
|
|
63
58
|
constructor({
|
|
64
59
|
streaming = false,
|
|
65
60
|
manifest,
|
|
@@ -187,7 +182,7 @@ class experimental_AstroContainer {
|
|
|
187
182
|
this.#pipeline.manifest.renderers[rendererIndex] = renderer;
|
|
188
183
|
}
|
|
189
184
|
// NOTE: we keep this private via TS instead via `#` so it's still available on the surface, so we can play with it.
|
|
190
|
-
// @ematipico: I plan to use it for a possible integration that could help people
|
|
185
|
+
// @ts-expect-error @ematipico: I plan to use it for a possible integration that could help people
|
|
191
186
|
static async createFromManifest(manifest) {
|
|
192
187
|
const astroConfig = await validateConfig(ASTRO_CONFIG_DEFAULTS, process.cwd(), "container");
|
|
193
188
|
const container = new experimental_AstroContainer({
|
|
@@ -2,16 +2,14 @@ import type { FSWatcher } from 'vite';
|
|
|
2
2
|
import type { Logger } from '../core/logger/core.js';
|
|
3
3
|
import type { AstroSettings } from '../types/astro.js';
|
|
4
4
|
import type { RefreshContentOptions } from '../types/public/content.js';
|
|
5
|
-
import type { LoaderContext } from './loaders/types.js';
|
|
6
5
|
import type { MutableDataStore } from './mutable-data-store.js';
|
|
7
|
-
|
|
6
|
+
interface ContentLayerOptions {
|
|
8
7
|
store: MutableDataStore;
|
|
9
8
|
settings: AstroSettings;
|
|
10
9
|
logger: Logger;
|
|
11
10
|
watcher?: FSWatcher;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
export declare class ContentLayer {
|
|
12
|
+
declare class ContentLayer {
|
|
15
13
|
#private;
|
|
16
14
|
constructor({ settings, logger, store, watcher }: ContentLayerOptions);
|
|
17
15
|
/**
|
|
@@ -33,9 +31,6 @@ export declare class ContentLayer {
|
|
|
33
31
|
sync(options?: RefreshContentOptions): Promise<void>;
|
|
34
32
|
regenerateCollectionFileManifest(): Promise<void>;
|
|
35
33
|
}
|
|
36
|
-
export declare function simpleLoader<TData extends {
|
|
37
|
-
id: string;
|
|
38
|
-
}>(handler: CollectionLoader<TData>, context: LoaderContext): Promise<void>;
|
|
39
34
|
/**
|
|
40
35
|
* Get the path to the data store file.
|
|
41
36
|
* During development, this is in the `.astro` directory so that the Vite watcher can see it.
|
|
@@ -153,7 +153,7 @@ ${contentConfig.error.message}`);
|
|
|
153
153
|
logger.info("Content config changed");
|
|
154
154
|
shouldClear = true;
|
|
155
155
|
}
|
|
156
|
-
if (previousAstroVersion && previousAstroVersion !== "5.7.
|
|
156
|
+
if (previousAstroVersion && previousAstroVersion !== "5.7.6") {
|
|
157
157
|
logger.info("Astro version changed");
|
|
158
158
|
shouldClear = true;
|
|
159
159
|
}
|
|
@@ -161,8 +161,8 @@ ${contentConfig.error.message}`);
|
|
|
161
161
|
logger.info("Clearing content store");
|
|
162
162
|
this.#store.clearAll();
|
|
163
163
|
}
|
|
164
|
-
if ("5.7.
|
|
165
|
-
await this.#store.metaStore().set("astro-version", "5.7.
|
|
164
|
+
if ("5.7.6") {
|
|
165
|
+
await this.#store.metaStore().set("astro-version", "5.7.6");
|
|
166
166
|
}
|
|
167
167
|
if (currentConfigDigest) {
|
|
168
168
|
await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -343,8 +343,6 @@ function contentLayerSingleton() {
|
|
|
343
343
|
}
|
|
344
344
|
const globalContentLayer = contentLayerSingleton();
|
|
345
345
|
export {
|
|
346
|
-
ContentLayer,
|
|
347
346
|
getDataStoreFile,
|
|
348
|
-
globalContentLayer
|
|
349
|
-
simpleLoader
|
|
347
|
+
globalContentLayer
|
|
350
348
|
};
|
package/dist/content/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { CONTENT_FLAG, PROPAGATED_ASSET_FLAG } from './consts.js';
|
|
2
1
|
export { attachContentServerListeners } from './server-listeners.js';
|
|
3
2
|
export { createContentTypesGenerator } from './types-generator.js';
|
|
4
|
-
export {
|
|
3
|
+
export { getContentPaths, hasAssetPropagationFlag } from './utils.js';
|
|
5
4
|
export { astroContentAssetPropagationPlugin } from './vite-plugin-content-assets.js';
|
|
6
5
|
export { astroContentImportPlugin } from './vite-plugin-content-imports.js';
|
|
7
6
|
export { astroContentVirtualModPlugin } from './vite-plugin-content-virtual-mod.js';
|
package/dist/content/index.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import { CONTENT_FLAG, PROPAGATED_ASSET_FLAG } from "./consts.js";
|
|
2
1
|
import { attachContentServerListeners } from "./server-listeners.js";
|
|
3
2
|
import { createContentTypesGenerator } from "./types-generator.js";
|
|
4
|
-
import {
|
|
3
|
+
import { getContentPaths, hasAssetPropagationFlag } from "./utils.js";
|
|
5
4
|
import { astroContentAssetPropagationPlugin } from "./vite-plugin-content-assets.js";
|
|
6
5
|
import { astroContentImportPlugin } from "./vite-plugin-content-imports.js";
|
|
7
6
|
import { astroContentVirtualModPlugin } from "./vite-plugin-content-virtual-mod.js";
|
|
8
7
|
export {
|
|
9
|
-
CONTENT_FLAG,
|
|
10
|
-
PROPAGATED_ASSET_FLAG,
|
|
11
8
|
astroContentAssetPropagationPlugin,
|
|
12
9
|
astroContentImportPlugin,
|
|
13
10
|
astroContentVirtualModPlugin,
|
|
14
11
|
attachContentServerListeners,
|
|
15
|
-
contentObservable,
|
|
16
12
|
createContentTypesGenerator,
|
|
17
13
|
getContentPaths,
|
|
18
14
|
hasAssetPropagationFlag
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Loader } from './types.js';
|
|
2
|
-
|
|
2
|
+
interface FileOptions {
|
|
3
3
|
/**
|
|
4
4
|
* the parsing function to use for this data
|
|
5
5
|
* @default JSON.parse or yaml.load, depending on the extension of the file
|
|
@@ -12,3 +12,4 @@ export interface FileOptions {
|
|
|
12
12
|
* @param options Additional options for the file loader
|
|
13
13
|
*/
|
|
14
14
|
export declare function file(fileName: string, options?: FileOptions): Loader;
|
|
15
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Loader } from './types.js';
|
|
2
|
-
|
|
2
|
+
interface GenerateIdOptions {
|
|
3
3
|
/** The path to the entry file, relative to the base directory. */
|
|
4
4
|
entry: string;
|
|
5
5
|
/** The base directory URL. */
|
|
@@ -7,7 +7,7 @@ export interface GenerateIdOptions {
|
|
|
7
7
|
/** The parsed, unvalidated data of the entry. */
|
|
8
8
|
data: Record<string, unknown>;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
interface GlobOptions {
|
|
11
11
|
/** The glob pattern to match files, relative to the base directory */
|
|
12
12
|
pattern: string | Array<string>;
|
|
13
13
|
/** The base directory to resolve the glob pattern from. Relative to the root directory, or an absolute file URL. Defaults to `.` */
|
|
@@ -28,3 +28,4 @@ export declare function glob(globOptions: GlobOptions & {
|
|
|
28
28
|
/** @deprecated */
|
|
29
29
|
_legacy?: true;
|
|
30
30
|
}): Loader;
|
|
31
|
+
export {};
|