astro 5.1.3 → 5.1.5
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/astro-jsx.d.ts +3 -1
- package/components/Image.astro +0 -1
- package/components/Picture.astro +1 -2
- package/components/ResponsiveImage.astro +13 -0
- package/components/ResponsivePicture.astro +11 -0
- package/dist/assets/build/generate.d.ts +1 -2
- package/dist/assets/build/generate.js +34 -17
- package/dist/assets/build/remote.d.ts +1 -1
- package/dist/assets/vite-plugin-assets.js +4 -3
- package/dist/container/index.js +2 -1
- package/dist/content/content-layer.d.ts +1 -1
- package/dist/content/content-layer.js +4 -6
- package/dist/content/mutable-data-store.d.ts +1 -1
- package/dist/content/mutable-data-store.js +21 -13
- package/dist/content/vite-plugin-content-virtual-mod.js +16 -13
- package/dist/core/app/index.js +13 -1
- package/dist/core/build/css-asset-name.js +1 -1
- package/dist/core/build/generate.js +4 -2
- package/dist/core/build/index.js +3 -2
- package/dist/core/build/static-build.js +1 -1
- package/dist/core/compile/compile.js +1 -2
- package/dist/core/compile/style.js +2 -1
- package/dist/core/config/schema.d.ts +49 -31
- package/dist/core/config/schema.js +2 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/container.js +2 -1
- package/dist/core/dev/dev.js +5 -7
- package/dist/core/errors/dev/utils.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/middleware/sequence.js +5 -1
- package/dist/core/middleware/vite-plugin.js +1 -1
- package/dist/core/render/params-and-props.js +1 -1
- package/dist/core/render-context.js +17 -3
- package/dist/core/request.d.ts +3 -3
- package/dist/core/request.js +4 -2
- package/dist/core/routing/manifest/create.d.ts +0 -1
- package/dist/core/routing/manifest/create.js +2 -21
- package/dist/core/routing/manifest/parts.d.ts +2 -0
- package/dist/core/routing/manifest/parts.js +22 -0
- package/dist/core/routing/manifest/segment.d.ts +1 -0
- package/dist/core/routing/manifest/segment.js +22 -0
- package/dist/core/routing/rewrite.d.ts +5 -1
- package/dist/core/routing/rewrite.js +22 -15
- package/dist/core/sync/index.d.ts +4 -2
- package/dist/core/sync/index.js +15 -12
- package/dist/core/util.d.ts +2 -2
- package/dist/core/util.js +5 -2
- package/dist/env/schema.d.ts +48 -30
- package/dist/env/schema.js +20 -1
- package/dist/vite-plugin-astro/compile.js +1 -1
- package/dist/vite-plugin-astro-server/request.js +1 -1
- package/dist/vite-plugin-astro-server/route.js +1 -1
- package/dist/vite-plugin-markdown/content-entry-type.js +1 -6
- package/dist/vite-plugin-markdown/index.js +1 -1
- package/dist/vite-plugin-scanner/index.js +1 -2
- package/package.json +5 -1
package/dist/env/schema.d.ts
CHANGED
|
@@ -192,62 +192,80 @@ declare const EnvFieldType: z.ZodUnion<[z.ZodObject<{
|
|
|
192
192
|
optional?: boolean | undefined;
|
|
193
193
|
}>]>;
|
|
194
194
|
export type EnvFieldType = z.infer<typeof EnvFieldType>;
|
|
195
|
-
declare const EnvFieldMetadata: z.
|
|
196
|
-
context: z.ZodLiteral<"client">;
|
|
197
|
-
access: z.ZodLiteral<"public">;
|
|
198
|
-
}, "strip", z.ZodTypeAny, {
|
|
195
|
+
declare const EnvFieldMetadata: z.ZodEffects<z.ZodType<{
|
|
199
196
|
context: "client";
|
|
200
197
|
access: "public";
|
|
201
|
-
}
|
|
198
|
+
} | {
|
|
199
|
+
context: "server";
|
|
200
|
+
access: "public";
|
|
201
|
+
} | {
|
|
202
|
+
context: "server";
|
|
203
|
+
access: "secret";
|
|
204
|
+
}, z.ZodTypeDef, {
|
|
202
205
|
context: "client";
|
|
203
206
|
access: "public";
|
|
204
|
-
}
|
|
205
|
-
context: z.ZodLiteral<"server">;
|
|
206
|
-
access: z.ZodLiteral<"public">;
|
|
207
|
-
}, "strip", z.ZodTypeAny, {
|
|
207
|
+
} | {
|
|
208
208
|
context: "server";
|
|
209
209
|
access: "public";
|
|
210
|
-
}
|
|
210
|
+
} | {
|
|
211
211
|
context: "server";
|
|
212
|
+
access: "secret";
|
|
213
|
+
}>, {
|
|
214
|
+
context: "client";
|
|
212
215
|
access: "public";
|
|
213
|
-
}
|
|
214
|
-
context:
|
|
215
|
-
access:
|
|
216
|
-
}
|
|
216
|
+
} | {
|
|
217
|
+
context: "server";
|
|
218
|
+
access: "public";
|
|
219
|
+
} | {
|
|
217
220
|
context: "server";
|
|
218
221
|
access: "secret";
|
|
219
222
|
}, {
|
|
223
|
+
context: "client";
|
|
224
|
+
access: "public";
|
|
225
|
+
} | {
|
|
226
|
+
context: "server";
|
|
227
|
+
access: "public";
|
|
228
|
+
} | {
|
|
220
229
|
context: "server";
|
|
221
230
|
access: "secret";
|
|
222
|
-
}
|
|
223
|
-
export declare const EnvSchema: z.ZodRecord<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, z.ZodIntersection<z.
|
|
224
|
-
context: z.ZodLiteral<"client">;
|
|
225
|
-
access: z.ZodLiteral<"public">;
|
|
226
|
-
}, "strip", z.ZodTypeAny, {
|
|
231
|
+
}>;
|
|
232
|
+
export declare const EnvSchema: z.ZodRecord<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, z.ZodIntersection<z.ZodEffects<z.ZodType<{
|
|
227
233
|
context: "client";
|
|
228
234
|
access: "public";
|
|
229
|
-
}
|
|
235
|
+
} | {
|
|
236
|
+
context: "server";
|
|
237
|
+
access: "public";
|
|
238
|
+
} | {
|
|
239
|
+
context: "server";
|
|
240
|
+
access: "secret";
|
|
241
|
+
}, z.ZodTypeDef, {
|
|
230
242
|
context: "client";
|
|
231
243
|
access: "public";
|
|
232
|
-
}
|
|
233
|
-
context: z.ZodLiteral<"server">;
|
|
234
|
-
access: z.ZodLiteral<"public">;
|
|
235
|
-
}, "strip", z.ZodTypeAny, {
|
|
244
|
+
} | {
|
|
236
245
|
context: "server";
|
|
237
246
|
access: "public";
|
|
238
|
-
}
|
|
247
|
+
} | {
|
|
239
248
|
context: "server";
|
|
249
|
+
access: "secret";
|
|
250
|
+
}>, {
|
|
251
|
+
context: "client";
|
|
240
252
|
access: "public";
|
|
241
|
-
}
|
|
242
|
-
context:
|
|
243
|
-
access:
|
|
244
|
-
}
|
|
253
|
+
} | {
|
|
254
|
+
context: "server";
|
|
255
|
+
access: "public";
|
|
256
|
+
} | {
|
|
245
257
|
context: "server";
|
|
246
258
|
access: "secret";
|
|
247
259
|
}, {
|
|
260
|
+
context: "client";
|
|
261
|
+
access: "public";
|
|
262
|
+
} | {
|
|
263
|
+
context: "server";
|
|
264
|
+
access: "public";
|
|
265
|
+
} | {
|
|
248
266
|
context: "server";
|
|
249
267
|
access: "secret";
|
|
250
|
-
}
|
|
268
|
+
}>, z.ZodUnion<[z.ZodObject<{
|
|
251
269
|
type: z.ZodLiteral<"string">;
|
|
252
270
|
optional: z.ZodOptional<z.ZodBoolean>;
|
|
253
271
|
default: z.ZodOptional<z.ZodString>;
|
package/dist/env/schema.js
CHANGED
|
@@ -64,11 +64,30 @@ const SecretServerEnvFieldMetadata = z.object({
|
|
|
64
64
|
context: z.literal("server"),
|
|
65
65
|
access: z.literal("secret")
|
|
66
66
|
});
|
|
67
|
-
const
|
|
67
|
+
const _EnvFieldMetadata = z.union([
|
|
68
68
|
PublicClientEnvFieldMetadata,
|
|
69
69
|
PublicServerEnvFieldMetadata,
|
|
70
70
|
SecretServerEnvFieldMetadata
|
|
71
71
|
]);
|
|
72
|
+
const EnvFieldMetadata = z.custom().superRefine((data, ctx) => {
|
|
73
|
+
const result = _EnvFieldMetadata.safeParse(data);
|
|
74
|
+
if (result.success) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
for (const issue of result.error.issues) {
|
|
78
|
+
if (issue.code === z.ZodIssueCode.invalid_union) {
|
|
79
|
+
ctx.addIssue({
|
|
80
|
+
code: z.ZodIssueCode.custom,
|
|
81
|
+
message: `**Invalid combination** of "access" and "context" options:
|
|
82
|
+
Secret client variables are not supported. Please review the configuration of \`env.schema.${ctx.path.at(-1)}\`.
|
|
83
|
+
Learn more at https://docs.astro.build/en/guides/environment-variables/#variable-types`,
|
|
84
|
+
path: ["context", "access"]
|
|
85
|
+
});
|
|
86
|
+
} else {
|
|
87
|
+
ctx.addIssue(issue);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
72
91
|
const EnvSchemaKey = z.string().min(1).refine(([firstChar]) => isNaN(Number.parseInt(firstChar)), {
|
|
73
92
|
message: "A valid variable name cannot start with a number."
|
|
74
93
|
}).refine((str) => /^[A-Z0-9_]+$/.test(str), {
|
|
@@ -12,8 +12,8 @@ async function compileAstro({
|
|
|
12
12
|
try {
|
|
13
13
|
transformResult = await compile(compileProps);
|
|
14
14
|
esbuildResult = await transformWithEsbuild(transformResult.code, compileProps.filename, {
|
|
15
|
+
...compileProps.viteConfig.esbuild,
|
|
15
16
|
loader: "ts",
|
|
16
|
-
target: "esnext",
|
|
17
17
|
sourcemap: "external",
|
|
18
18
|
tsconfigRaw: {
|
|
19
19
|
compilerOptions: {
|
|
@@ -17,7 +17,7 @@ async function handleRequest({
|
|
|
17
17
|
if (config.trailingSlash === "never" && !incomingRequest.url) {
|
|
18
18
|
pathname = "";
|
|
19
19
|
} else {
|
|
20
|
-
pathname = url.pathname;
|
|
20
|
+
pathname = decodeURI(url.pathname);
|
|
21
21
|
}
|
|
22
22
|
url.pathname = removeTrailingForwardSlash(config.base) + url.pathname;
|
|
23
23
|
let body = void 0;
|
|
@@ -179,7 +179,7 @@ async function handleRoute({
|
|
|
179
179
|
const fourOhFourRoute = await matchRoute("/404", manifestData, pipeline);
|
|
180
180
|
if (fourOhFourRoute) {
|
|
181
181
|
renderContext = await RenderContext.create({
|
|
182
|
-
locals
|
|
182
|
+
locals,
|
|
183
183
|
pipeline,
|
|
184
184
|
pathname,
|
|
185
185
|
middleware: isDefaultPrerendered404(fourOhFourRoute.route) ? void 0 : middleware,
|
|
@@ -17,12 +17,7 @@ const markdownContentEntryType = {
|
|
|
17
17
|
async getRenderFunction(config) {
|
|
18
18
|
const processor = await createMarkdownProcessor(config.markdown);
|
|
19
19
|
return async function renderToString(entry) {
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
html: ""
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
const result = await processor.render(entry.body, {
|
|
20
|
+
const result = await processor.render(entry.body ?? "", {
|
|
26
21
|
frontmatter: entry.data,
|
|
27
22
|
// @ts-expect-error Internal API
|
|
28
23
|
fileURL: entry.filePath ? pathToFileURL(entry.filePath) : void 0
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
createMarkdownProcessor,
|
|
5
5
|
isFrontmatterValid
|
|
6
6
|
} from "@astrojs/markdown-remark";
|
|
7
|
-
import { normalizePath } from "vite";
|
|
8
7
|
import { safeParseFrontmatter } from "../content/utils.js";
|
|
9
8
|
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
10
9
|
import { isMarkdownFile, isPage } from "../core/util.js";
|
|
10
|
+
import { normalizePath } from "../core/viteUtils.js";
|
|
11
11
|
import { shorthash } from "../runtime/server/shorthash.js";
|
|
12
12
|
import { createDefaultAstroMetadata } from "../vite-plugin-astro/metadata.js";
|
|
13
13
|
import { getFileInfo } from "../vite-plugin-utils/index.js";
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { extname } from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { bold } from "kleur/colors";
|
|
4
|
-
import { normalizePath } from "vite";
|
|
5
4
|
import { warnMissingAdapter } from "../core/dev/adapter-validation.js";
|
|
6
5
|
import { getRoutePrerenderOption } from "../core/routing/manifest/prerender.js";
|
|
7
6
|
import { isEndpoint, isPage } from "../core/util.js";
|
|
8
|
-
import { rootRelativePath } from "../core/viteUtils.js";
|
|
7
|
+
import { normalizePath, rootRelativePath } from "../core/viteUtils.js";
|
|
9
8
|
const KNOWN_FILE_EXTENSIONS = [".astro", ".js", ".ts"];
|
|
10
9
|
function astroScannerPlugin({
|
|
11
10
|
settings,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.5",
|
|
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",
|
|
@@ -211,6 +211,10 @@
|
|
|
211
211
|
"publishConfig": {
|
|
212
212
|
"provenance": true
|
|
213
213
|
},
|
|
214
|
+
"funding": {
|
|
215
|
+
"type": "opencollective",
|
|
216
|
+
"url": "https://opencollective.com/astrodotbuild"
|
|
217
|
+
},
|
|
214
218
|
"scripts": {
|
|
215
219
|
"prebuild": "astro-scripts prebuild --to-string \"src/runtime/server/astro-island.ts\" \"src/runtime/client/{idle,load,media,only,visible}.ts\"",
|
|
216
220
|
"build": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm && tsc",
|