Skip to content

Commit 58a2397

Browse files
committed
Upgrade to Astro v5
This happens to improve the prefetch behaviour so that it only happens on link hover instead of on page load.
1 parent 3bfc793 commit 58a2397

10 files changed

+2945
-3026
lines changed

site/.astro/content-assets.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default new Map();

site/.astro/content-modules.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default new Map();

site/.astro/content.d.ts

+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
declare module 'astro:content' {
2+
interface Render {
3+
'.mdx': Promise<{
4+
Content: import('astro').MarkdownInstance<{}>['Content'];
5+
headings: import('astro').MarkdownHeading[];
6+
remarkPluginFrontmatter: Record<string, any>;
7+
components: import('astro').MDXInstance<{}>['components'];
8+
}>;
9+
}
10+
}
11+
12+
declare module 'astro:content' {
13+
export interface RenderResult {
14+
Content: import('astro/runtime/server/index.js').AstroComponentFactory;
15+
headings: import('astro').MarkdownHeading[];
16+
remarkPluginFrontmatter: Record<string, any>;
17+
}
18+
interface Render {
19+
'.md': Promise<RenderResult>;
20+
}
21+
22+
export interface RenderedContent {
23+
html: string;
24+
metadata?: {
25+
imagePaths: Array<string>;
26+
[key: string]: unknown;
27+
};
28+
}
29+
}
30+
31+
declare module 'astro:content' {
32+
type Flatten<T> = T extends { [K: string]: infer U } ? U : never;
33+
34+
export type CollectionKey = keyof AnyEntryMap;
35+
export type CollectionEntry<C extends CollectionKey> = Flatten<AnyEntryMap[C]>;
36+
37+
export type ContentCollectionKey = keyof ContentEntryMap;
38+
export type DataCollectionKey = keyof DataEntryMap;
39+
40+
type AllValuesOf<T> = T extends any ? T[keyof T] : never;
41+
type ValidContentEntrySlug<C extends keyof ContentEntryMap> = AllValuesOf<
42+
ContentEntryMap[C]
43+
>['slug'];
44+
45+
export type ReferenceDataEntry<
46+
C extends CollectionKey,
47+
E extends keyof DataEntryMap[C] = string,
48+
> = {
49+
collection: C;
50+
id: E;
51+
};
52+
export type ReferenceContentEntry<
53+
C extends keyof ContentEntryMap,
54+
E extends ValidContentEntrySlug<C> | (string & {}) = string,
55+
> = {
56+
collection: C;
57+
slug: E;
58+
};
59+
60+
/** @deprecated Use `getEntry` instead. */
61+
export function getEntryBySlug<
62+
C extends keyof ContentEntryMap,
63+
E extends ValidContentEntrySlug<C> | (string & {}),
64+
>(
65+
collection: C,
66+
// Note that this has to accept a regular string too, for SSR
67+
entrySlug: E,
68+
): E extends ValidContentEntrySlug<C>
69+
? Promise<CollectionEntry<C>>
70+
: Promise<CollectionEntry<C> | undefined>;
71+
72+
/** @deprecated Use `getEntry` instead. */
73+
export function getDataEntryById<C extends keyof DataEntryMap, E extends keyof DataEntryMap[C]>(
74+
collection: C,
75+
entryId: E,
76+
): Promise<CollectionEntry<C>>;
77+
78+
export function getCollection<C extends keyof AnyEntryMap, E extends CollectionEntry<C>>(
79+
collection: C,
80+
filter?: (entry: CollectionEntry<C>) => entry is E,
81+
): Promise<E[]>;
82+
export function getCollection<C extends keyof AnyEntryMap>(
83+
collection: C,
84+
filter?: (entry: CollectionEntry<C>) => unknown,
85+
): Promise<CollectionEntry<C>[]>;
86+
87+
export function getEntry<
88+
C extends keyof ContentEntryMap,
89+
E extends ValidContentEntrySlug<C> | (string & {}),
90+
>(
91+
entry: ReferenceContentEntry<C, E>,
92+
): E extends ValidContentEntrySlug<C>
93+
? Promise<CollectionEntry<C>>
94+
: Promise<CollectionEntry<C> | undefined>;
95+
export function getEntry<
96+
C extends keyof DataEntryMap,
97+
E extends keyof DataEntryMap[C] | (string & {}),
98+
>(
99+
entry: ReferenceDataEntry<C, E>,
100+
): E extends keyof DataEntryMap[C]
101+
? Promise<DataEntryMap[C][E]>
102+
: Promise<CollectionEntry<C> | undefined>;
103+
export function getEntry<
104+
C extends keyof ContentEntryMap,
105+
E extends ValidContentEntrySlug<C> | (string & {}),
106+
>(
107+
collection: C,
108+
slug: E,
109+
): E extends ValidContentEntrySlug<C>
110+
? Promise<CollectionEntry<C>>
111+
: Promise<CollectionEntry<C> | undefined>;
112+
export function getEntry<
113+
C extends keyof DataEntryMap,
114+
E extends keyof DataEntryMap[C] | (string & {}),
115+
>(
116+
collection: C,
117+
id: E,
118+
): E extends keyof DataEntryMap[C]
119+
? string extends keyof DataEntryMap[C]
120+
? Promise<DataEntryMap[C][E]> | undefined
121+
: Promise<DataEntryMap[C][E]>
122+
: Promise<CollectionEntry<C> | undefined>;
123+
124+
/** Resolve an array of entry references from the same collection */
125+
export function getEntries<C extends keyof ContentEntryMap>(
126+
entries: ReferenceContentEntry<C, ValidContentEntrySlug<C>>[],
127+
): Promise<CollectionEntry<C>[]>;
128+
export function getEntries<C extends keyof DataEntryMap>(
129+
entries: ReferenceDataEntry<C, keyof DataEntryMap[C]>[],
130+
): Promise<CollectionEntry<C>[]>;
131+
132+
export function render<C extends keyof AnyEntryMap>(
133+
entry: AnyEntryMap[C][string],
134+
): Promise<RenderResult>;
135+
136+
export function reference<C extends keyof AnyEntryMap>(
137+
collection: C,
138+
): import('astro/zod').ZodEffects<
139+
import('astro/zod').ZodString,
140+
C extends keyof ContentEntryMap
141+
? ReferenceContentEntry<C, ValidContentEntrySlug<C>>
142+
: ReferenceDataEntry<C, keyof DataEntryMap[C]>
143+
>;
144+
// Allow generic `string` to avoid excessive type errors in the config
145+
// if `dev` is not running to update as you edit.
146+
// Invalid collection names will be caught at build time.
147+
export function reference<C extends string>(
148+
collection: C,
149+
): import('astro/zod').ZodEffects<import('astro/zod').ZodString, never>;
150+
151+
type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T;
152+
type InferEntrySchema<C extends keyof AnyEntryMap> = import('astro/zod').infer<
153+
ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']>
154+
>;
155+
156+
type ContentEntryMap = {
157+
158+
};
159+
160+
type DataEntryMap = {
161+
162+
};
163+
164+
type AnyEntryMap = ContentEntryMap & DataEntryMap;
165+
166+
export type ContentConfig = typeof import("../src/content.config.mjs");
167+
}

site/.astro/data-store.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[["Map",1,2],"meta::meta",["Map",3,4,5,6],"astro-version","5.2.5","astro-config-digest","{\"root\":{},\"srcDir\":{},\"publicDir\":{},\"outDir\":{},\"cacheDir\":{},\"site\":\"https://open-ui.org\",\"compressHTML\":true,\"base\":\"/\",\"trailingSlash\":\"ignore\",\"output\":\"static\",\"scopedStyleStrategy\":\"attribute\",\"build\":{\"format\":\"directory\",\"client\":{},\"server\":{},\"assets\":\"_astro\",\"serverEntry\":\"entry.mjs\",\"redirects\":true,\"inlineStylesheets\":\"auto\",\"concurrency\":1},\"server\":{\"open\":false,\"host\":false,\"port\":3000,\"streaming\":true},\"redirects\":{},\"prefetch\":{\"prefetchAll\":true},\"image\":{\"endpoint\":{\"route\":\"/_image\"},\"service\":{\"entrypoint\":\"astro/assets/services/sharp\",\"config\":{}},\"domains\":[],\"remotePatterns\":[]},\"devToolbar\":{\"enabled\":true},\"markdown\":{\"syntaxHighlight\":\"shiki\",\"shikiConfig\":{\"langs\":[],\"langAlias\":{},\"theme\":\"github-dark\",\"themes\":{},\"wrap\":true,\"transformers\":[]},\"remarkPlugins\":[],\"rehypePlugins\":[],\"remarkRehype\":{},\"gfm\":true,\"smartypants\":true},\"security\":{\"checkOrigin\":true},\"env\":{\"schema\":{},\"validateSecrets\":false},\"experimental\":{\"clientPrerender\":false,\"contentIntellisense\":false,\"responsiveImages\":false,\"serializeConfig\":false},\"legacy\":{\"collections\":false}}"]

site/.astro/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"_variables": {
3+
"lastUpdateCheck": 1738930819805
4+
}
5+
}

site/.astro/types.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference types="astro/client" />
2+
/// <reference path="content.d.ts" />

site/astro.config.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { defineConfig } from 'astro/config'
22
import react from '@astrojs/react'
33
import sitemap from '@astrojs/sitemap'
44
import mdx from '@astrojs/mdx'
5-
import prefetch from '@astrojs/prefetch'
65
import compress from 'astro-compress'
76
import { rehypeHeadingIds } from '@astrojs/markdown-remark'
87
import { autolinkHeadingsPlugin } from './src/plugins/rehypeHeadings'
@@ -18,10 +17,12 @@ export default defineConfig({
1817
mdx({
1918
rehypePlugins: [rehypeHeadingIds, autolinkHeadingsPlugin, rehypeResponsiveTables],
2019
}),
21-
prefetch(),
2220
compress(),
2321
],
2422
site: 'https://open-ui.org',
23+
prefetch: {
24+
prefetchAll: true,
25+
},
2526
markdown: {
2627
shikiConfig: {
2728
langs: [],

site/package.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@
3232
]
3333
},
3434
"devDependencies": {
35-
"@astrojs/mdx": "^1.1.1",
36-
"@astrojs/prefetch": "^0.4.1",
37-
"@astrojs/react": "^3.0.3",
38-
"@astrojs/sitemap": "^3.0.1",
39-
"astro": "^3.2.4",
40-
"astro-compress": "^2.0.15",
35+
"@astrojs/mdx": "^4.0.8",
36+
"@astrojs/react": "4.2.0",
37+
"@astrojs/sitemap": "3.2.1",
38+
"astro": "5.2.5",
39+
"astro-compress": "^2.3.6",
4140
"eslint": "^8.18.0",
4241
"eslint-plugin-react": "^7.30.0",
4342
"hast-util-to-string": "^2.0.0",

site/src/components/contributors.astro

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const CONTRIBUTORS = [];
66
const fetchContributors = async (page) => {
77
const response = await fetch(`${CONTRIBUTORS_URL}?page=${page}`);
88
const contributors = await response.json();
9-
CONTRIBUTORS.push(...contributors);
9+
if (Array.isArray(contributors))
10+
CONTRIBUTORS.push(...contributors);
1011
};
1112
1213
// Fetch contributors from page 1

0 commit comments

Comments
 (0)