astro 6.1.6 → 6.1.7
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/assets/endpoint/shared.js +7 -0
- package/dist/assets/internal.d.ts +1 -0
- package/dist/assets/internal.js +3 -1
- package/dist/assets/utils/inferSourceFormat.d.ts +6 -0
- package/dist/assets/utils/inferSourceFormat.js +21 -0
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/container.js +2 -2
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages/runtime.js +1 -1
- package/package.json +4 -6
|
@@ -4,6 +4,7 @@ import { isRemoteAllowed } from "@astrojs/internal-helpers/remote";
|
|
|
4
4
|
import * as mime from "mrmime";
|
|
5
5
|
import { getConfiguredImageService } from "../internal.js";
|
|
6
6
|
import { etag } from "../utils/etag.js";
|
|
7
|
+
import { inferSourceFormat } from "../utils/inferSourceFormat.js";
|
|
7
8
|
async function loadRemoteImage(src) {
|
|
8
9
|
try {
|
|
9
10
|
const res = await fetch(src, { redirect: "manual" });
|
|
@@ -31,6 +32,12 @@ const handleImageRequest = async ({
|
|
|
31
32
|
if (!transform?.src) {
|
|
32
33
|
return new Response("Invalid request", { status: 400 });
|
|
33
34
|
}
|
|
35
|
+
if (transform.format === "svg") {
|
|
36
|
+
const sourceFormat = inferSourceFormat(transform.src);
|
|
37
|
+
if (sourceFormat !== "svg") {
|
|
38
|
+
return new Response("Cannot convert non-SVG source to SVG format", { status: 403 });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
34
41
|
let inputBuffer = void 0;
|
|
35
42
|
if (isRemotePath(transform.src)) {
|
|
36
43
|
if (!isRemoteAllowed(transform.src, imageConfig)) {
|
|
@@ -2,6 +2,7 @@ import type { AstroConfig } from '../types/public/config.js';
|
|
|
2
2
|
import type { AstroAdapterClientConfig } from '../types/public/integrations.js';
|
|
3
3
|
import { type ImageService } from './services/service.js';
|
|
4
4
|
import { type GetImageResult, type UnresolvedImageTransform } from './types.js';
|
|
5
|
+
export { verifyOptions } from './services/service.js';
|
|
5
6
|
export declare const cssFitValues: string[];
|
|
6
7
|
export declare function getConfiguredImageService(): Promise<ImageService>;
|
|
7
8
|
export declare function getImage(options: UnresolvedImageTransform, imageConfig: AstroConfig['image'] & AstroAdapterClientConfig): Promise<GetImageResult>;
|
package/dist/assets/internal.js
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { isESMImportedImage, isRemoteImage, resolveSrc } from "./utils/imageKind.js";
|
|
16
16
|
import { inferRemoteSize } from "./utils/remoteProbe.js";
|
|
17
17
|
import { createPlaceholderURL, stringifyPlaceholderURL } from "./utils/url.js";
|
|
18
|
+
import { verifyOptions } from "./services/service.js";
|
|
18
19
|
const cssFitValues = ["fill", "contain", "cover", "scale-down"];
|
|
19
20
|
async function getConfiguredImageService() {
|
|
20
21
|
if (!globalThis?.astroAsset?.imageService) {
|
|
@@ -190,5 +191,6 @@ async function getImage(options, imageConfig) {
|
|
|
190
191
|
export {
|
|
191
192
|
cssFitValues,
|
|
192
193
|
getConfiguredImageService,
|
|
193
|
-
getImage
|
|
194
|
+
getImage,
|
|
195
|
+
verifyOptions
|
|
194
196
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infer the image format from a source path or URL by examining
|
|
3
|
+
* the file extension. For data: URIs, the MIME type is extracted.
|
|
4
|
+
* Returns undefined if the format cannot be determined.
|
|
5
|
+
*/
|
|
6
|
+
export declare function inferSourceFormat(src: string): string | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { removeQueryString } from "@astrojs/internal-helpers/path";
|
|
2
|
+
const DATA_PREFIX = "data:";
|
|
3
|
+
function inferSourceFormat(src) {
|
|
4
|
+
if (src.startsWith(DATA_PREFIX)) {
|
|
5
|
+
const mime = src.slice(DATA_PREFIX.length, src.indexOf(";"));
|
|
6
|
+
if (mime === "image/svg+xml") return "svg";
|
|
7
|
+
const sub = mime.split("/")[1];
|
|
8
|
+
return sub || void 0;
|
|
9
|
+
}
|
|
10
|
+
try {
|
|
11
|
+
const cleanSrc = removeQueryString(src).split("#")[0];
|
|
12
|
+
const lastDot = cleanSrc.lastIndexOf(".");
|
|
13
|
+
if (lastDot === -1) return void 0;
|
|
14
|
+
return cleanSrc.slice(lastDot + 1).toLowerCase();
|
|
15
|
+
} catch {
|
|
16
|
+
return void 0;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
inferSourceFormat
|
|
21
|
+
};
|
|
@@ -192,7 +192,7 @@ ${contentConfig.error.message}`
|
|
|
192
192
|
logger.info("Content config changed");
|
|
193
193
|
shouldClear = true;
|
|
194
194
|
}
|
|
195
|
-
if (previousAstroVersion && previousAstroVersion !== "6.1.
|
|
195
|
+
if (previousAstroVersion && previousAstroVersion !== "6.1.7") {
|
|
196
196
|
logger.info("Astro version changed");
|
|
197
197
|
shouldClear = true;
|
|
198
198
|
}
|
|
@@ -200,8 +200,8 @@ ${contentConfig.error.message}`
|
|
|
200
200
|
logger.info("Clearing content store");
|
|
201
201
|
this.#store.clearAll();
|
|
202
202
|
}
|
|
203
|
-
if ("6.1.
|
|
204
|
-
this.#store.metaStore().set("astro-version", "6.1.
|
|
203
|
+
if ("6.1.7") {
|
|
204
|
+
this.#store.metaStore().set("astro-version", "6.1.7");
|
|
205
205
|
}
|
|
206
206
|
if (currentConfigDigest) {
|
|
207
207
|
this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
package/dist/core/constants.js
CHANGED
|
@@ -26,7 +26,7 @@ async function createContainer({
|
|
|
26
26
|
});
|
|
27
27
|
const {
|
|
28
28
|
base,
|
|
29
|
-
server: { host, headers, open: serverOpen, allowedHosts }
|
|
29
|
+
server: { host, headers, open: serverOpen, allowedHosts, port }
|
|
30
30
|
} = settings.config;
|
|
31
31
|
const isServerOpenURL = typeof serverOpen === "string" && !isRestart;
|
|
32
32
|
const isServerOpenBoolean = serverOpen && !isRestart;
|
|
@@ -50,7 +50,7 @@ async function createContainer({
|
|
|
50
50
|
);
|
|
51
51
|
const viteConfig = await createVite(
|
|
52
52
|
{
|
|
53
|
-
server: { host, headers, open, allowedHosts },
|
|
53
|
+
server: { host, headers, open, allowedHosts, port },
|
|
54
54
|
optimizeDeps: {
|
|
55
55
|
include: rendererClientEntries
|
|
56
56
|
}
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -37,7 +37,7 @@ async function dev(inlineConfig) {
|
|
|
37
37
|
await telemetry.record([]);
|
|
38
38
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
39
39
|
const logger = restart.container.logger;
|
|
40
|
-
const currentVersion = "6.1.
|
|
40
|
+
const currentVersion = "6.1.7";
|
|
41
41
|
const isPrerelease = currentVersion.includes("-");
|
|
42
42
|
if (!isPrerelease) {
|
|
43
43
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.7",
|
|
4
4
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "withastro",
|
|
@@ -153,8 +153,8 @@
|
|
|
153
153
|
"yargs-parser": "^22.0.0",
|
|
154
154
|
"zod": "^4.3.6",
|
|
155
155
|
"@astrojs/internal-helpers": "0.8.0",
|
|
156
|
-
"@astrojs/
|
|
157
|
-
"@astrojs/
|
|
156
|
+
"@astrojs/markdown-remark": "7.1.0",
|
|
157
|
+
"@astrojs/telemetry": "3.3.0"
|
|
158
158
|
},
|
|
159
159
|
"optionalDependencies": {
|
|
160
160
|
"sharp": "^0.34.0"
|
|
@@ -217,9 +217,7 @@
|
|
|
217
217
|
"test:e2e:firefox": "playwright test --config playwright.firefox.config.js",
|
|
218
218
|
"test:types": "tsc --project test/types/tsconfig.json",
|
|
219
219
|
"typecheck:tests": "tsc --project tsconfig.test.json",
|
|
220
|
-
"test:unit": "
|
|
221
|
-
"test:unit:js": "astro-scripts test \"test/units/**/*.test.js\" --teardown ./test/units/teardown.js",
|
|
222
|
-
"test:unit:ts": "astro-scripts test \"test/units/**/*.test.ts\" --strip-types --teardown ./test/units/teardown.js",
|
|
220
|
+
"test:unit": "astro-scripts test \"test/units/**/*.test.ts\" --strip-types --teardown ./test/units/teardown.ts",
|
|
223
221
|
"test:integration": "pnpm run test:integration:js && pnpm run test:integration:ts",
|
|
224
222
|
"test:integration:js": "astro-scripts test \"test/*.test.js\"",
|
|
225
223
|
"test:integration:ts": "astro-scripts test \"test/*.test.ts\" --strip-types"
|