Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
6391469
feat: setup branch
florian-lefebvre Dec 18, 2024
fdb3141
Merge branch 'main' into feat/fonts
florian-lefebvre Jan 17, 2025
21b6f35
Merge branch 'main' into feat/fonts
florian-lefebvre Jan 21, 2025
95673fc
feat(fonts): config (#12777)
florian-lefebvre Jan 21, 2025
c6cd69c
Merge branch 'main' into feat/fonts
florian-lefebvre Jan 30, 2025
3c18360
feat(fonts): vite plugin (#13093)
florian-lefebvre Feb 7, 2025
338757d
Merge branch 'main' into feat/fonts
florian-lefebvre Feb 7, 2025
4899359
Merge branch 'main' into feat/fonts
florian-lefebvre Feb 10, 2025
c6bc00f
feat(fonts): rename component (#13207)
florian-lefebvre Feb 10, 2025
363faf9
feat(fonts): add more providers (#13208)
florian-lefebvre Feb 11, 2025
193a9c0
feat(fonts): local provider (#13209)
florian-lefebvre Feb 17, 2025
e97e42a
Merge branch 'main' into feat/fonts
florian-lefebvre Feb 17, 2025
e8aead8
feat(fonts): improve providers (#13263)
florian-lefebvre Feb 18, 2025
918ee30
feat(fonts): improve type handling (#13270)
florian-lefebvre Feb 20, 2025
8bc05a0
feat(fonts): improve cache (#13273)
florian-lefebvre Feb 20, 2025
287b789
refactor(fonts): url proxy (#13274)
florian-lefebvre Feb 20, 2025
868e2ab
feat(fonts): dev headers (#13275)
florian-lefebvre Feb 20, 2025
8e89e80
feat(fonts): better local provider (#13276)
florian-lefebvre Feb 21, 2025
c515886
Merge branch 'main' into feat/fonts
florian-lefebvre Feb 27, 2025
08eff8c
Merge branch 'main' into feat/fonts
florian-lefebvre Feb 27, 2025
4eef143
feat(fonts): fallbacks (#13331)
florian-lefebvre Mar 3, 2025
a84a8b5
Merge branch 'main' into feat/fonts
florian-lefebvre Mar 3, 2025
d8e0743
feat(fonts): refactor loading logic (#13353)
florian-lefebvre Mar 4, 2025
f62a7b7
Merge branch 'main' into feat/fonts
florian-lefebvre Mar 5, 2025
75b1f5b
feat(fonts): css vars (#13362)
florian-lefebvre Mar 5, 2025
0f3419c
feat(fonts): as prop (#13366)
florian-lefebvre Mar 10, 2025
4a784be
Merge branch 'main' into feat/fonts
florian-lefebvre Mar 10, 2025
1f3fc18
Merge branch 'main' into feat/fonts
florian-lefebvre Mar 12, 2025
7ce73a1
feat(fonts): resolve config todos (#13401)
florian-lefebvre Mar 12, 2025
784976d
feat(fonts): use capsize instead of fontaine (#13411)
florian-lefebvre Mar 13, 2025
f01739d
feat(fonts): family name validation (#13417)
florian-lefebvre Mar 13, 2025
22ed30c
fix: zod error path
florian-lefebvre Mar 14, 2025
ef6f9ce
fix(fonts): vite plugin cleanup (#13424)
florian-lefebvre Mar 14, 2025
b70d8c4
feat(fonts): allow disabling automatic fallback generation (#13442)
florian-lefebvre Mar 18, 2025
c3845c8
feat(fonts): add errors (#13425)
florian-lefebvre Mar 19, 2025
e42de26
Merge branch 'main' into feat/fonts
florian-lefebvre Mar 20, 2025
93ffd30
feat(fonts): typegen for <Font /> family prop (#13465)
florian-lefebvre Mar 21, 2025
b6af656
Merge branch 'main' into feat/fonts
florian-lefebvre Mar 21, 2025
2665ebc
Update packages/astro/src/core/errors/errors-data.ts
florian-lefebvre Mar 25, 2025
dc24bdd
Merge branch 'main' into feat/fonts
florian-lefebvre Mar 25, 2025
b470183
Apply suggestions from code review
florian-lefebvre Mar 26, 2025
3fcdba0
fix(fonts): config family types for inferred provider (#13469)
florian-lefebvre Mar 26, 2025
100cd48
Merge branch 'main' into feat/fonts
florian-lefebvre Mar 26, 2025
fedde31
Merge branch 'main' into feat/fonts
florian-lefebvre Mar 30, 2025
af0e0e1
fix(fonts): throw error on unsuccessful responses (#13517)
florian-lefebvre Mar 31, 2025
4250554
fix(fonts): read local fonts files to extract metrics (#13518)
florian-lefebvre Mar 31, 2025
d893932
feat(fonts): set default fallbacks (#13516)
florian-lefebvre Mar 31, 2025
6cd4c14
Merge branch 'main' into feat/fonts
florian-lefebvre Apr 1, 2025
d7b2b51
feat(fonts): update config shape (#13515)
florian-lefebvre Apr 2, 2025
0dbe842
feat(fonts): rename provider type helper (#13533)
florian-lefebvre Apr 2, 2025
78c88b2
feat(fonts): simpler logging (#13535)
florian-lefebvre Apr 2, 2025
0730611
fix(fonts): do not add quotes to family names (#13534)
florian-lefebvre Apr 2, 2025
95b9fef
Merge branch 'main' into feat/fonts
florian-lefebvre Apr 2, 2025
c22561c
feat(fonts): new cssVariable property (#13544)
florian-lefebvre Apr 3, 2025
b350235
Merge branch 'main' into feat/fonts
florian-lefebvre Apr 3, 2025
118a707
feat(fonts): update local family shape (#13553)
florian-lefebvre Apr 4, 2025
7d50c96
Merge branch 'main' into feat/fonts
florian-lefebvre Apr 4, 2025
0362529
feat(fonts): improve local font files deletion (#13559)
florian-lefebvre Apr 4, 2025
8ae9be0
feat(fonts): update local to support entrypoints src and techs (#13556)
florian-lefebvre Apr 4, 2025
5e47be6
Merge branch 'main' into feat/fonts
florian-lefebvre Apr 7, 2025
8454fc9
fix(fonts): patch unifont (#13574)
florian-lefebvre Apr 7, 2025
854eca9
feat(fonts): remove default provider (#13572)
florian-lefebvre Apr 7, 2025
f651fe1
feat(fonts): unifont improvements
florian-lefebvre Apr 9, 2025
8a0b300
Merge branch 'main' into feat/fonts-unifont-improvements
florian-lefebvre Apr 15, 2025
b29229b
Delete .changeset/happy-spies-punch.md
florian-lefebvre Apr 15, 2025
c77011d
Discard changes to packages/astro/src/assets/fonts/providers/utils.ts
florian-lefebvre Apr 15, 2025
2adcb14
Discard changes to packages/astro/src/assets/vite-plugin-assets.ts
florian-lefebvre Apr 15, 2025
b5cf6cd
Discard changes to packages/astro/src/config/index.ts
florian-lefebvre Apr 15, 2025
647253b
Discard changes to packages/astro/src/core/build/util.ts
florian-lefebvre Apr 15, 2025
f75a4af
Discard changes to packages/astro/src/core/sync/index.ts
florian-lefebvre Apr 15, 2025
e80f4b1
Discard changes to packages/astro/src/integrations/hooks.ts
florian-lefebvre Apr 15, 2025
5755d1c
Discard changes to packages/astro/test/fixtures/fonts/src/pages/index…
florian-lefebvre Apr 15, 2025
a4b324c
Discard changes to packages/astro/test/fixtures/fonts/src/pages/prelo…
florian-lefebvre Apr 15, 2025
cc1b9a0
Discard changes to packages/astro/test/types/define-config.ts
florian-lefebvre Apr 15, 2025
0f2f3c7
feat: limit
florian-lefebvre Apr 15, 2025
d1f03c2
Merge branch 'main' into feat/fonts-unifont-improvements
florian-lefebvre Apr 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bright-jokes-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Reduces the number of font files downloaded
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@
"workerd",
"@biomejs/biome",
"sharp"
],
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
}
]
}
}
2 changes: 1 addition & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"tinyglobby": "^0.2.12",
"tsconfck": "^3.1.5",
"ultrahtml": "^1.6.0",
"unifont": "^0.1.7",
"unifont": "~0.2.0",
"unist-util-visit": "^5.0.0",
"unstorage": "^1.15.0",
"vfile": "^6.0.3",
Expand Down
44 changes: 27 additions & 17 deletions packages/astro/src/assets/fonts/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,33 @@ export async function loadFonts({
[family.provider.name!],
);

fonts = result.fonts.map((font) => ({
...font,
src: font.src.map((source) =>
'name' in source
? source
: {
...source,
originalURL: source.url,
url: proxyURL({
value: source.url,
// We only use the url for hashing since the service returns urls with a hash already
hashString,
collect,
}),
},
),
}));
fonts = result.fonts
// Avoid getting too much font files
.filter((font) =>
typeof font.meta?.priority === 'number' ? font.meta.priority === 0 : true,
)
// Collect URLs
.map((font) => ({
...font,
src: font.src
// Limit src to 1 file (eg. if woff2 and woff are present, will only take woff2) to avoid
// downloading too many files
.slice(0, 1)
.map((source) =>
'name' in source
? source
: {
...source,
originalURL: source.url,
url: proxyURL({
value: source.url,
// We only use the url for hashing since the service returns urls with a hash already
hashString,
collect,
}),
},
),
}));
}

for (const data of fonts) {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/config/entrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export { envField } from '../env/config.js';
export { mergeConfig } from '../core/config/merge.js';
export { validateConfig } from '../core/config/validate.js';
export { fontProviders, defineAstroFontProvider } from '../assets/fonts/providers/index.js';
export type { AstroFontProvider as FontProvider } from '../assets/fonts/types.js';
export type { AstroFontProvider } from '../assets/fonts/types.js';

/**
* Return the configuration needed to use the Sharp-based image service
Expand Down
22 changes: 0 additions & 22 deletions patches/[email protected]

This file was deleted.

31 changes: 11 additions & 20 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.