astro 4.3.4 → 4.3.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.
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.3.4";
1
+ const ASTRO_VERSION = "4.3.5";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
23
23
  base: restart.container.settings.config.base
24
24
  })
25
25
  );
26
- const currentVersion = "4.3.4";
26
+ const currentVersion = "4.3.5";
27
27
  if (currentVersion.includes("-")) {
28
28
  logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
29
29
  }
@@ -36,7 +36,7 @@ function serverStart({
36
36
  host,
37
37
  base
38
38
  }) {
39
- const version = "4.3.4";
39
+ const version = "4.3.5";
40
40
  const localPrefix = `${dim("\u2503")} Local `;
41
41
  const networkPrefix = `${dim("\u2503")} Network `;
42
42
  const emptyPrefix = " ".repeat(11);
@@ -261,7 +261,7 @@ function printHelp({
261
261
  message.push(
262
262
  linebreak(),
263
263
  ` ${bgGreen(black(` ${commandName} `))} ${green(
264
- `v${"4.3.4"}`
264
+ `v${"4.3.5"}`
265
265
  )} ${headline}`
266
266
  );
267
267
  }
@@ -37,7 +37,13 @@ function createI18nMiddleware(i18n, base, trailingSlash, buildFormat) {
37
37
  return void 0;
38
38
  };
39
39
  const prefixOtherLocales = (url, response) => {
40
- const pathnameContainsDefaultLocale = url.pathname.includes(`/${i18n.defaultLocale}`);
40
+ let pathnameContainsDefaultLocale = false;
41
+ for (const segment of url.pathname.split("/")) {
42
+ if (normalizeTheLocale(segment) === normalizeTheLocale(i18n.defaultLocale)) {
43
+ pathnameContainsDefaultLocale = true;
44
+ break;
45
+ }
46
+ }
41
47
  if (pathnameContainsDefaultLocale) {
42
48
  const newLocation = url.pathname.replace(`/${i18n.defaultLocale}`, "");
43
49
  response.headers.set("Location", newLocation);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.3.4",
3
+ "version": "4.3.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",
@@ -96,6 +96,7 @@
96
96
  "content-types.template.d.ts",
97
97
  "content-module.template.mjs",
98
98
  "astro-jsx.d.ts",
99
+ "types/content.d.ts",
99
100
  "types.d.ts",
100
101
  "README.md",
101
102
  "vendor"
@@ -231,10 +232,11 @@
231
232
  "dev": "astro-scripts dev --copy-wasm --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.{ts,js}\"",
232
233
  "postbuild": "astro-scripts copy \"src/**/*.astro\" && astro-scripts copy \"src/**/*.wasm\"",
233
234
  "test:unit": "mocha --exit --timeout 30000 ./test/units/**/*.test.js",
234
- "test:unit:match": "mocha --exit --timeout 30000 ./test/units/**/*.test.js -g",
235
- "test": "pnpm run test:unit && mocha --exit --timeout 30000 --ignore **/lit-element.test.js && mocha --timeout 30000 **/lit-element.test.js",
235
+ "test:unit:match": "mocha --exit --timeout 30000 ./test/units/**/*.test.js -g --ignore **/*.nodetest.js",
236
+ "test": "pnpm run test:node && pnpm run test:unit && mocha --exit --timeout 30000 --ignore **/*.nodetest.js --ignore **/lit-element.test.js && mocha --timeout 30000 **/lit-element.test.js --ignore **/*.nodetest.js",
236
237
  "test:match": "mocha --timeout 30000 -g",
237
238
  "test:e2e": "playwright test",
238
- "test:e2e:match": "playwright test -g"
239
+ "test:e2e:match": "playwright test -g",
240
+ "test:node": "astro-scripts test \"test/**/*.nodetest.js\""
239
241
  }
240
242
  }
@@ -0,0 +1,75 @@
1
+ declare module 'astro:content' {
2
+ export { z } from 'astro/zod';
3
+
4
+ // This needs to be in sync with ImageMetadata
5
+ export type ImageFunction = () => import('astro/zod').ZodObject<{
6
+ src: import('astro/zod').ZodString;
7
+ width: import('astro/zod').ZodNumber;
8
+ height: import('astro/zod').ZodNumber;
9
+ format: import('astro/zod').ZodUnion<
10
+ [
11
+ import('astro/zod').ZodLiteral<'png'>,
12
+ import('astro/zod').ZodLiteral<'jpg'>,
13
+ import('astro/zod').ZodLiteral<'jpeg'>,
14
+ import('astro/zod').ZodLiteral<'tiff'>,
15
+ import('astro/zod').ZodLiteral<'webp'>,
16
+ import('astro/zod').ZodLiteral<'gif'>,
17
+ import('astro/zod').ZodLiteral<'svg'>,
18
+ import('astro/zod').ZodLiteral<'avif'>,
19
+ ]
20
+ >;
21
+ }>;
22
+
23
+ type BaseSchemaWithoutEffects =
24
+ | import('astro/zod').AnyZodObject
25
+ | import('astro/zod').ZodUnion<[BaseSchemaWithoutEffects, ...BaseSchemaWithoutEffects[]]>
26
+ | import('astro/zod').ZodDiscriminatedUnion<string, import('astro/zod').AnyZodObject[]>
27
+ | import('astro/zod').ZodIntersection<BaseSchemaWithoutEffects, BaseSchemaWithoutEffects>;
28
+
29
+ type BaseSchema =
30
+ | BaseSchemaWithoutEffects
31
+ | import('astro/zod').ZodEffects<BaseSchemaWithoutEffects>;
32
+
33
+ export type SchemaContext = { image: ImageFunction };
34
+
35
+ type DataCollectionConfig<S extends BaseSchema> = {
36
+ type: 'data';
37
+ schema?: S | ((context: SchemaContext) => S);
38
+ };
39
+
40
+ type ContentCollectionConfig<S extends BaseSchema> = {
41
+ type?: 'content';
42
+ schema?: S | ((context: SchemaContext) => S);
43
+ };
44
+
45
+ type CollectionConfig<S extends BaseSchema> =
46
+ | ContentCollectionConfig<S>
47
+ | DataCollectionConfig<S>;
48
+
49
+ export function defineCollection<S extends BaseSchema>(
50
+ input: CollectionConfig<S>
51
+ ): CollectionConfig<S>;
52
+
53
+ /** Run `astro sync` to generate high fidelity types */
54
+ export const getEntryBySlug: (...args: any[]) => any;
55
+ /** Run `astro sync` to generate high fidelity types */
56
+ export const getDataEntryById: (...args: any[]) => any;
57
+ /** Run `astro sync` to generate high fidelity types */
58
+ export const getCollection: (...args: any[]) => any;
59
+ /** Run `astro sync` to generate high fidelity types */
60
+ export const getEntry: (...args: any[]) => any;
61
+ /** Run `astro sync` to generate high fidelity types */
62
+ export const getEntries: (...args: any[]) => any;
63
+ /** Run `astro sync` to generate high fidelity types */
64
+ export const reference: (...args: any[]) => any;
65
+ /** Run `astro sync` to generate high fidelity types */
66
+ export type CollectionKey = any;
67
+ /** Run `astro sync` to generate high fidelity types */
68
+ export type CollectionEntry<C> = any;
69
+ /** Run `astro sync` to generate high fidelity types */
70
+ export type ContentCollectionKey = any;
71
+ /** Run `astro sync` to generate high fidelity types */
72
+ export type DataCollectionKey = any;
73
+ /** Run `astro sync` to generate high fidelity types */
74
+ export type ContentConfig = any;
75
+ }