astro 5.3.0 → 5.4.0
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.astro +1 -9
- package/components/Picture.astro +6 -11
- package/dist/assets/endpoint/generic.js +1 -1
- package/dist/assets/endpoint/node.js +1 -1
- package/dist/assets/internal.js +13 -0
- package/dist/assets/services/service.js +1 -1
- package/dist/assets/utils/imageAttributes.d.ts +1 -9
- package/dist/assets/utils/imageAttributes.js +2 -21
- package/dist/assets/utils/index.d.ts +0 -1
- package/dist/assets/utils/index.js +0 -14
- package/dist/cli/dev/index.js +4 -0
- package/dist/cli/flags.js +2 -1
- package/dist/cli/preview/index.js +4 -0
- package/dist/config/entrypoint.d.ts +2 -0
- package/dist/config/entrypoint.js +5 -1
- package/dist/container/index.js +1 -0
- package/dist/content/content-layer.js +3 -3
- package/dist/content/loaders/glob.js +6 -5
- package/dist/content/runtime-assets.d.ts +1 -1
- package/dist/content/runtime.js +10 -5
- package/dist/content/types-generator.js +6 -11
- package/dist/content/vite-plugin-content-virtual-mod.js +2 -2
- package/dist/core/app/index.js +1 -1
- package/dist/core/app/types.d.ts +7 -0
- package/dist/core/build/generate.js +2 -1
- package/dist/core/build/index.d.ts +10 -0
- package/dist/core/build/plugins/plugin-manifest.js +2 -1
- package/dist/core/build/static-build.d.ts +0 -1
- package/dist/core/build/static-build.js +4 -23
- package/dist/core/config/merge.d.ts +3 -1
- package/dist/core/config/merge.js +2 -2
- package/dist/core/config/schema.d.ts +18 -0
- package/dist/core/config/schema.js +6 -3
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.js +2 -2
- package/dist/core/dev/container.js +2 -2
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/index.d.ts +1 -7
- package/dist/core/index.js +6 -7
- package/dist/core/messages.js +2 -2
- package/dist/core/preview/static-preview-server.js +2 -1
- package/dist/core/render-context.js +1 -0
- package/dist/core/routing/match.js +2 -3
- package/dist/core/routing/rewrite.js +15 -2
- package/dist/integrations/hooks.js +2 -1
- package/dist/runtime/server/render/head.js +3 -0
- package/dist/runtime/server/render/script.js +3 -1
- package/dist/transitions/router.js +1 -1
- package/dist/types/public/config.d.ts +20 -1
- package/dist/types/public/index.d.ts +1 -1
- package/dist/types/public/internal.d.ts +1 -0
- package/dist/vite-plugin-astro-server/plugin.js +1 -0
- package/dist/vite-plugin-markdown/content-entry-type.js +8 -2
- package/dist/vite-plugin-markdown/images.d.ts +1 -1
- package/dist/vite-plugin-markdown/images.js +20 -3
- package/dist/vite-plugin-markdown/index.js +14 -6
- package/package.json +9 -9
- package/dist/assets/utils/remotePattern.d.ts +0 -13
- package/dist/assets/utils/remotePattern.js +0 -56
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { isRemotePath } from "@astrojs/internal-helpers/path";
|
|
2
|
-
function matchPattern(url, remotePattern) {
|
|
3
|
-
return matchProtocol(url, remotePattern.protocol) && matchHostname(url, remotePattern.hostname, true) && matchPort(url, remotePattern.port) && matchPathname(url, remotePattern.pathname, true);
|
|
4
|
-
}
|
|
5
|
-
function matchPort(url, port) {
|
|
6
|
-
return !port || port === url.port;
|
|
7
|
-
}
|
|
8
|
-
function matchProtocol(url, protocol) {
|
|
9
|
-
return !protocol || protocol === url.protocol.slice(0, -1);
|
|
10
|
-
}
|
|
11
|
-
function matchHostname(url, hostname, allowWildcard) {
|
|
12
|
-
if (!hostname) {
|
|
13
|
-
return true;
|
|
14
|
-
} else if (!allowWildcard || !hostname.startsWith("*")) {
|
|
15
|
-
return hostname === url.hostname;
|
|
16
|
-
} else if (hostname.startsWith("**.")) {
|
|
17
|
-
const slicedHostname = hostname.slice(2);
|
|
18
|
-
return slicedHostname !== url.hostname && url.hostname.endsWith(slicedHostname);
|
|
19
|
-
} else if (hostname.startsWith("*.")) {
|
|
20
|
-
const slicedHostname = hostname.slice(1);
|
|
21
|
-
const additionalSubdomains = url.hostname.replace(slicedHostname, "").split(".").filter(Boolean);
|
|
22
|
-
return additionalSubdomains.length === 1;
|
|
23
|
-
}
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
function matchPathname(url, pathname, allowWildcard) {
|
|
27
|
-
if (!pathname) {
|
|
28
|
-
return true;
|
|
29
|
-
} else if (!allowWildcard || !pathname.endsWith("*")) {
|
|
30
|
-
return pathname === url.pathname;
|
|
31
|
-
} else if (pathname.endsWith("/**")) {
|
|
32
|
-
const slicedPathname = pathname.slice(0, -2);
|
|
33
|
-
return slicedPathname !== url.pathname && url.pathname.startsWith(slicedPathname);
|
|
34
|
-
} else if (pathname.endsWith("/*")) {
|
|
35
|
-
const slicedPathname = pathname.slice(0, -1);
|
|
36
|
-
const additionalPathChunks = url.pathname.replace(slicedPathname, "").split("/").filter(Boolean);
|
|
37
|
-
return additionalPathChunks.length === 1;
|
|
38
|
-
}
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
function isRemoteAllowed(src, {
|
|
42
|
-
domains = [],
|
|
43
|
-
remotePatterns = []
|
|
44
|
-
}) {
|
|
45
|
-
if (!isRemotePath(src)) return false;
|
|
46
|
-
const url = new URL(src);
|
|
47
|
-
return domains.some((domain) => matchHostname(url, domain)) || remotePatterns.some((remotePattern) => matchPattern(url, remotePattern));
|
|
48
|
-
}
|
|
49
|
-
export {
|
|
50
|
-
isRemoteAllowed,
|
|
51
|
-
matchHostname,
|
|
52
|
-
matchPathname,
|
|
53
|
-
matchPattern,
|
|
54
|
-
matchPort,
|
|
55
|
-
matchProtocol
|
|
56
|
-
};
|