astro 4.16.18 → 4.16.19
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/build/generate.js +2 -2
- package/dist/assets/endpoint/generic.js +2 -1
- package/dist/assets/endpoint/node.js +2 -1
- package/dist/assets/internal.js +2 -1
- package/dist/assets/services/service.js +2 -2
- package/dist/assets/utils/remotePattern.js +2 -1
- package/dist/assets/utils/resolveImports.js +2 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/path.d.ts +1 -0
- package/dist/core/path.js +8 -0
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { getOutDirWithinCwd } from "../../core/build/common.js";
|
|
|
5
5
|
import { getTimeStat } from "../../core/build/util.js";
|
|
6
6
|
import { AstroError } from "../../core/errors/errors.js";
|
|
7
7
|
import { AstroErrorData } from "../../core/errors/index.js";
|
|
8
|
-
import { isRemotePath, removeLeadingForwardSlash } from "../../core/path.js";
|
|
8
|
+
import { isCoreRemotePath, isRemotePath, removeLeadingForwardSlash } from "../../core/path.js";
|
|
9
9
|
import { isServerLikeOutput } from "../../core/util.js";
|
|
10
10
|
import { getConfiguredImageService } from "../internal.js";
|
|
11
11
|
import { isESMImportedImage } from "../utils/imageKind.js";
|
|
@@ -179,7 +179,7 @@ function getStaticImageList() {
|
|
|
179
179
|
return globalThis.astroAsset.staticImages;
|
|
180
180
|
}
|
|
181
181
|
async function loadImage(path, env) {
|
|
182
|
-
if (
|
|
182
|
+
if (isCoreRemotePath(path)) {
|
|
183
183
|
const remoteImage = await loadRemoteImage(path);
|
|
184
184
|
return {
|
|
185
185
|
data: remoteImage.data,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { imageConfig } from "astro:assets";
|
|
2
2
|
import { isRemotePath } from "@astrojs/internal-helpers/path";
|
|
3
3
|
import * as mime from "mrmime";
|
|
4
|
+
import { isCoreRemotePath } from "../../core/path.js";
|
|
4
5
|
import { getConfiguredImageService } from "../internal.js";
|
|
5
6
|
import { etag } from "../utils/etag.js";
|
|
6
7
|
import { isRemoteAllowed } from "../utils/remotePattern.js";
|
|
@@ -30,7 +31,7 @@ const GET = async ({ request }) => {
|
|
|
30
31
|
throw new Error("Incorrect transform returned by `parseURL`");
|
|
31
32
|
}
|
|
32
33
|
let inputBuffer = void 0;
|
|
33
|
-
const isRemoteImage =
|
|
34
|
+
const isRemoteImage = isCoreRemotePath(transform.src);
|
|
34
35
|
const sourceUrl = isRemoteImage ? new URL(transform.src) : new URL(transform.src, url.origin);
|
|
35
36
|
if (isRemoteImage && isRemoteAllowed(transform.src, imageConfig) === false) {
|
|
36
37
|
return new Response("Forbidden", { status: 403 });
|
|
@@ -5,6 +5,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
5
5
|
import { assetsDir, imageConfig, outDir } from "astro:assets";
|
|
6
6
|
import { isRemotePath, removeQueryString } from "@astrojs/internal-helpers/path";
|
|
7
7
|
import * as mime from "mrmime";
|
|
8
|
+
import { isCoreRemotePath } from "../../core/path.js";
|
|
8
9
|
import { getConfiguredImageService } from "../internal.js";
|
|
9
10
|
import { etag } from "../utils/etag.js";
|
|
10
11
|
import { isRemoteAllowed } from "../utils/remotePattern.js";
|
|
@@ -72,7 +73,7 @@ const GET = async ({ request }) => {
|
|
|
72
73
|
return new Response("Internal Server Error", { status: 500 });
|
|
73
74
|
}
|
|
74
75
|
let inputBuffer = void 0;
|
|
75
|
-
if (
|
|
76
|
+
if (isCoreRemotePath(transform.src)) {
|
|
76
77
|
if (isRemoteAllowed(transform.src, imageConfig) === false) {
|
|
77
78
|
return new Response("Forbidden", { status: 403 });
|
|
78
79
|
}
|
package/dist/assets/internal.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isRemotePath } from "@astrojs/internal-helpers/path";
|
|
2
2
|
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
3
|
+
import { isCoreRemotePath } from "../core/path.js";
|
|
3
4
|
import { DEFAULT_HASH_PROPS } from "./consts.js";
|
|
4
5
|
import { isLocalService } from "./services/service.js";
|
|
5
6
|
import {
|
|
@@ -48,7 +49,7 @@ async function getImage(options, imageConfig) {
|
|
|
48
49
|
...options,
|
|
49
50
|
src: await resolveSrc(options.src)
|
|
50
51
|
};
|
|
51
|
-
if (options.inferSize && isRemoteImage(resolvedOptions.src) &&
|
|
52
|
+
if (options.inferSize && isRemoteImage(resolvedOptions.src) && isCoreRemotePath(resolvedOptions.src)) {
|
|
52
53
|
const result = await inferRemoteSize(resolvedOptions.src);
|
|
53
54
|
resolvedOptions.width ??= result.width;
|
|
54
55
|
resolvedOptions.height ??= result.height;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AstroError, AstroErrorData } from "../../core/errors/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { isCoreRemotePath, joinPaths } from "../../core/path.js";
|
|
3
3
|
import { DEFAULT_HASH_PROPS, DEFAULT_OUTPUT_FORMAT, VALID_SUPPORTED_FORMATS } from "../consts.js";
|
|
4
4
|
import { isESMImportedImage } from "../utils/imageKind.js";
|
|
5
5
|
import { isRemoteAllowed } from "../utils/remotePattern.js";
|
|
@@ -30,7 +30,7 @@ const baseService = {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
if (!isESMImportedImage(options.src)) {
|
|
33
|
-
if (options.src.startsWith("/@fs/") || !
|
|
33
|
+
if (options.src.startsWith("/@fs/") || !isCoreRemotePath(options.src) && !options.src.startsWith("/")) {
|
|
34
34
|
throw new AstroError({
|
|
35
35
|
...AstroErrorData.LocalImageUsedWrongly,
|
|
36
36
|
message: AstroErrorData.LocalImageUsedWrongly.message(options.src)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isRemotePath } from "@astrojs/internal-helpers/path";
|
|
2
|
+
import { isCoreRemotePath } from "../../core/path.js";
|
|
2
3
|
function matchPattern(url, remotePattern) {
|
|
3
4
|
return matchProtocol(url, remotePattern.protocol) && matchHostname(url, remotePattern.hostname, true) && matchPort(url, remotePattern.port) && matchPathname(url, remotePattern.pathname, true);
|
|
4
5
|
}
|
|
@@ -42,7 +43,7 @@ function isRemoteAllowed(src, {
|
|
|
42
43
|
domains = [],
|
|
43
44
|
remotePatterns = []
|
|
44
45
|
}) {
|
|
45
|
-
if (!
|
|
46
|
+
if (!isCoreRemotePath(src)) return false;
|
|
46
47
|
const url = new URL(src);
|
|
47
48
|
return domains.some((domain) => matchHostname(url, domain)) || remotePatterns.some((remotePattern) => matchPattern(url, remotePattern));
|
|
48
49
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { isRemotePath, removeBase } from "@astrojs/internal-helpers/path";
|
|
2
2
|
import { CONTENT_IMAGE_FLAG, IMAGE_IMPORT_PREFIX } from "../../content/consts.js";
|
|
3
|
+
import { isCoreRemotePath } from "../../core/path.js";
|
|
3
4
|
import { shorthash } from "../../runtime/server/shorthash.js";
|
|
4
5
|
import { VALID_INPUT_FORMATS } from "../consts.js";
|
|
5
6
|
function imageSrcToImportId(imageSrc, filePath) {
|
|
6
7
|
imageSrc = removeBase(imageSrc, IMAGE_IMPORT_PREFIX);
|
|
7
|
-
if (
|
|
8
|
+
if (isCoreRemotePath(imageSrc)) {
|
|
8
9
|
return;
|
|
9
10
|
}
|
|
10
11
|
const ext = imageSrc.split(".").at(-1);
|
|
@@ -121,7 +121,7 @@ class ContentLayer {
|
|
|
121
121
|
logger.info("Content config changed");
|
|
122
122
|
shouldClear = true;
|
|
123
123
|
}
|
|
124
|
-
if (previousAstroVersion !== "4.16.
|
|
124
|
+
if (previousAstroVersion !== "4.16.19") {
|
|
125
125
|
logger.info("Astro version changed");
|
|
126
126
|
shouldClear = true;
|
|
127
127
|
}
|
|
@@ -129,8 +129,8 @@ class ContentLayer {
|
|
|
129
129
|
logger.info("Clearing content store");
|
|
130
130
|
this.#store.clearAll();
|
|
131
131
|
}
|
|
132
|
-
if ("4.16.
|
|
133
|
-
await this.#store.metaStore().set("astro-version", "4.16.
|
|
132
|
+
if ("4.16.19") {
|
|
133
|
+
await this.#store.metaStore().set("astro-version", "4.16.19");
|
|
134
134
|
}
|
|
135
135
|
if (currentConfigDigest) {
|
|
136
136
|
await this.#store.metaStore().set("config-digest", currentConfigDigest);
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
|
|
|
22
22
|
await telemetry.record([]);
|
|
23
23
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
24
24
|
const logger = restart.container.logger;
|
|
25
|
-
const currentVersion = "4.16.
|
|
25
|
+
const currentVersion = "4.16.19";
|
|
26
26
|
const isPrerelease = currentVersion.includes("-");
|
|
27
27
|
if (!isPrerelease) {
|
|
28
28
|
try {
|
package/dist/core/messages.js
CHANGED
|
@@ -38,7 +38,7 @@ function serverStart({
|
|
|
38
38
|
host,
|
|
39
39
|
base
|
|
40
40
|
}) {
|
|
41
|
-
const version = "4.16.
|
|
41
|
+
const version = "4.16.19";
|
|
42
42
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
43
43
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
44
44
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -274,7 +274,7 @@ function printHelp({
|
|
|
274
274
|
message.push(
|
|
275
275
|
linebreak(),
|
|
276
276
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
277
|
-
`v${"4.16.
|
|
277
|
+
`v${"4.16.19"}`
|
|
278
278
|
)} ${headline}`
|
|
279
279
|
);
|
|
280
280
|
}
|
package/dist/core/path.d.ts
CHANGED
package/dist/core/path.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
+
import { isRemotePath as _externalIsRemotePath } from "@astrojs/internal-helpers/path";
|
|
1
2
|
export * from "@astrojs/internal-helpers/path";
|
|
3
|
+
const URL_PROTOCOL_REGEX = /^(?:(?:http|ftp|https|ws):?\/\/|\/\/)/;
|
|
4
|
+
function isCoreRemotePath(path) {
|
|
5
|
+
return URL_PROTOCOL_REGEX.test(path) || _externalIsRemotePath(path);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
isCoreRemotePath
|
|
9
|
+
};
|