From b5f364a6e36f13f6d8e1a1e9667f0f3c20e0ea38 Mon Sep 17 00:00:00 2001
From: Arsh <69170106+lilnasy@users.noreply.github.com>
Date: Fri, 15 Nov 2024 20:18:59 +0530
Subject: [PATCH] automatic font loading
---
...K3E20CsoJ9j1DDkjHcQ5ZL8xRaxru9no1P2w.woff2 | Bin 14536 -> 0 bytes
astro.config.ts | 13 ++-
env.d.ts | 7 +-
lib/font-loader.ts | 83 ++++++++++++++++++
precompress.ts => lib/precompress.ts | 0
package.json | 3 +-
pages/index.astro | 10 +--
pnpm-lock.yaml | 51 ++++++-----
8 files changed, 128 insertions(+), 39 deletions(-)
delete mode 100644 assets/wXK3E20CsoJ9j1DDkjHcQ5ZL8xRaxru9no1P2w.woff2
create mode 100644 lib/font-loader.ts
rename precompress.ts => lib/precompress.ts (100%)
diff --git a/assets/wXK3E20CsoJ9j1DDkjHcQ5ZL8xRaxru9no1P2w.woff2 b/assets/wXK3E20CsoJ9j1DDkjHcQ5ZL8xRaxru9no1P2w.woff2
deleted file mode 100644
index fbf3830a54486dd1f4501e7f477b7b4e83e39f89..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 14536
zcmV;(I5)?4Pew8T0RR91065414*&oF0DY(c061&_0RR9100000000000000000000
z00006U>1vD0D&wB5($EH5eN!_)kuM@Fbjh)00A}vBm;(A1Rw>2Xa|E`3>F*NW+m*{
zivrGr0Acm}@uDc5q~0hbA(}n%|7Ro}Lk7cdfc7$bMnnl^Wx94UIhnj_T3cy#E_T=J
z=A4y|Z!4!yDzxwp^9#w)efBsFl1*ylx$X}?=rP6_PyYlLSVnjV$*_pp*o35`FGv3m
ztmzUEZ`i|5O
29S#fpFZ_oKDHtuNn)==;6j`rNmx
z*M$^?N{JkV3sIvn4u!+=CBje`i!jJvbN@QanS^IvI+Ns+mt<+ld*rni2nKBZ-E)9l
zG|5xZv;nNrbm9O1xu@;(J~YB{WTC_uNCFwmy2qN9*|cG1L=+XU#b631+1}oJ?eV+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XLXJ3GeWwK7rP0=KO!e=9$%1-%xrmH>!^4VM&F+1T7xp=@>V*s*fh
zizV+!VXLB%?ZG%3JR6vLN`;1cVC-E~wi_>^ITZcomvXMhpS$A&O**Vmb?QS~YgJ
zog_N(DRs=7iKrZ)*{67hGf+MPTe2>-ePsh^$4#+nJ5v}v-WkO4U}s3F>3*1MXDXfi
zoe>(LjC1z|SZn)k-y}-V(5juSK9%Hql~J;&7cHnNp<7G1Yj!OqQZW
zRkm7#3?0w%GjKKL84S
zA|EN`z%=Qiq_g18vhl30o=vvbN%8srwlpl3*Y+E5l5YH(j~_ncUg}E
m&N=T)LBJBfe@uPTV6{4&aPsGtDZ>EJa0&&Cw$TIp1$+Q;YUpkN
diff --git a/astro.config.ts b/astro.config.ts
index 7581470..adee5a9 100644
--- a/astro.config.ts
+++ b/astro.config.ts
@@ -1,20 +1,17 @@
-import { fileURLToPath } from "node:url"
import { defineConfig, type ViteUserConfig } from "astro/config"
import node from "@withastro/node"
import preact from "@preact/preset-vite"
import emotion from "astro-emotion"
-import precompress from "./precompress.ts"
+import precompress from "./lib/precompress.ts"
+import fontLoader from "./lib/font-loader.ts"
+
const vite: ViteUserConfig = {
- plugins: [ preact() ],
+ assetsInclude: "font:*",
+ plugins: [ preact(), fontLoader() ],
ssr: {
noExternal: import.meta.env.PROD || undefined
},
- resolve: {
- alias: {
- assets: fileURLToPath(new URL("./assets", import.meta.url))
- }
- },
build: {
assetsInlineLimit: 0,
sourcemap: true,
diff --git a/env.d.ts b/env.d.ts
index 0e42fad..ef39b17 100644
--- a/env.d.ts
+++ b/env.d.ts
@@ -1,3 +1,8 @@
///
///
-///
\ No newline at end of file
+///
+
+declare module 'font:*' {
+ const href: string
+ export default href
+}
diff --git a/lib/font-loader.ts b/lib/font-loader.ts
new file mode 100644
index 0000000..5ab6816
--- /dev/null
+++ b/lib/font-loader.ts
@@ -0,0 +1,83 @@
+import path from "node:path"
+import crypto from "node:crypto"
+import fs from "node:fs"
+import type { Plugin } from "vite"
+
+export default function (): Plugin {
+ let root: string
+ let metadata: Record
+ function metadataFilePath() {
+ return path.join(root, "node_modules", ".fonts", "metadata.json")
+ }
+ function readMetadata() {
+ if (metadata) return metadata
+ const metadataFilePath = path.join(root, "node_modules", ".fonts", "metadata.json")
+ try {
+ const metadataText = fs.readFileSync(metadataFilePath, "utf8")
+ metadata = JSON.parse(metadataText)
+ } catch {
+ fs.writeFileSync(metadataFilePath, "{}")
+ metadata = {}
+ }
+ return metadata
+ }
+ function writeMetadata() {
+ fs.writeFileSync(metadataFilePath(), JSON.stringify(metadata, null, 4))
+ }
+ const resolveId: Plugin["resolveId"] = async function (id) {
+ if (id.startsWith("font:") === false && id.startsWith("/font:") === false) {
+ return
+ }
+ const query = id.startsWith("font:") ? id.slice(5) : id.slice(6)
+ try {
+ const metadata = readMetadata()
+ const filePath = metadata[query]
+ if (filePath) return filePath
+ }
+ catch {
+ // continue
+ }
+ const cssResponse = await fetch(`https://fonts.googleapis.com/css2?${query}`, {
+ headers: {
+ "User-Agent": "AppleWebKit/537.36 Chrome/130.0.0.0"
+ }
+ })
+ const cssText = await cssResponse.text()
+ const [ fontPath ] = /(?<=url\()https:\/\/fonts.gstatic.com\/(\S)+(?=\))/.exec(cssText)!
+ const fontResponse = await fetch(fontPath)
+ const fontBuffer = await fontResponse.arrayBuffer()
+ const fontBytes = new Uint8Array(fontBuffer)
+ const hash = crypto.hash("md5", fontBytes)
+ const filePath = path.join(root, "node_modules", ".fonts", `${hash}.woff2`)
+ fs.mkdirSync(path.dirname(filePath))
+ fs.writeFileSync(filePath, fontBytes)
+ const metadata = readMetadata()
+ metadata[query] = filePath
+ writeMetadata()
+ return filePath
+ }
+ return {
+ name: "font-loader",
+ config() {
+ return {
+ resolve: {
+ alias: [{
+ find: /font:/,
+ replacement: "font:",
+ // url() in css can only be hooked into this way,
+ // and even then the url must start with a forward
+ // slash - dunno why, just vite being vite
+ customResolver: { resolveId }
+ }]
+ }
+ }
+ },
+ configureServer({ config }) {
+ root = config.root
+ },
+ configResolved(config) {
+ root = config.root
+ },
+ resolveId
+ }
+}
\ No newline at end of file
diff --git a/precompress.ts b/lib/precompress.ts
similarity index 100%
rename from precompress.ts
rename to lib/precompress.ts
diff --git a/package.json b/package.json
index f59ce73..55075e9 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,7 @@
"devDependencies": {
"@preact/preset-vite": "^2.9.1",
"@withastro/node": "^8.4.0",
- "astro": "^4.16.9",
+ "astro": "^4.16.13",
"astro-emotion": "^2.0.0",
"canvas-confetti": "^1.9.3",
"clsx": "^2.1.1",
@@ -18,6 +18,7 @@
"preact": "^10.24.3",
"preact-render-to-string": "^6.5.11",
"typescript": "^5.6.3",
+ "vite": "^5.4.10",
"ws": "^8.18.0"
},
"packageManager": "pnpm@9.12.1",
diff --git a/pages/index.astro b/pages/index.astro
index dc4b5f3..cc9024a 100644
--- a/pages/index.astro
+++ b/pages/index.astro
@@ -3,7 +3,7 @@ import favicon from "./_favicon.svg"
import { h } from "preact"
import { renderToString } from "preact-render-to-string"
import { GameUISSR } from "components/GameUI.tsx"
-import font from "assets/wXK3E20CsoJ9j1DDkjHcQ5ZL8xRaxru9no1P2w.woff2"
+// import font from "font:family=Sue Ellen Francisco"
import "../tokens.css"
---
@@ -14,14 +14,14 @@ import "../tokens.css"
Tic Tac Toe
-
+
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index fa565bd..9244e8c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -30,13 +30,13 @@ importers:
devDependencies:
'@preact/preset-vite':
specifier: ^2.9.1
- version: 2.9.1(patch_hash=wx4a2puiselz4n5hatk6npe6l4)(@babel/core@7.26.0)(preact@10.24.3(patch_hash=nmwo7i2pfqokqkren3uyzcqkya))(vite@5.4.10(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2))
+ version: 2.9.1(patch_hash=wx4a2puiselz4n5hatk6npe6l4)(@babel/core@7.26.0)(preact@10.24.3(patch_hash=nmwo7i2pfqokqkren3uyzcqkya))(vite@5.4.11(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2))
'@withastro/node':
specifier: ^8.4.0
- version: 8.4.0(astro@4.16.9(patch_hash=etcf34y5ycd4ewbhb2nylfitly)(@types/node@22.4.2)(rollup@4.24.0)(typescript@5.6.3))
+ version: 8.4.0(astro@4.16.13(patch_hash=etcf34y5ycd4ewbhb2nylfitly)(@types/node@22.4.2)(rollup@4.24.0)(typescript@5.6.3))
astro:
- specifier: ^4.16.9
- version: 4.16.9(patch_hash=etcf34y5ycd4ewbhb2nylfitly)(@types/node@22.4.2)(rollup@4.24.0)(typescript@5.6.3)
+ specifier: ^4.16.13
+ version: 4.16.13(patch_hash=etcf34y5ycd4ewbhb2nylfitly)(@types/node@22.4.2)(rollup@4.24.0)(typescript@5.6.3)
astro-emotion:
specifier: ^2.0.0
version: 2.0.0
@@ -58,6 +58,9 @@ importers:
typescript:
specifier: ^5.6.3
version: 5.6.3
+ vite:
+ specifier: ^5.4.10
+ version: 5.4.11(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2)
ws:
specifier: ^8.18.0
version: 8.18.0(patch_hash=kx7tmpitapmudddeuody7gwvtq)
@@ -806,8 +809,8 @@ packages:
astro-emotion@2.0.0:
resolution: {integrity: sha512-VT5aZh8wAv3lkdlK+og2b2y1pcsNj1AW1gTm7NKJRpTOV4hmFN9MdK1j0FA3aKDmw9fJ6DqocaVlJMP9+eBOhw==}
- astro@4.16.9:
- resolution: {integrity: sha512-DFYzPZooVArKSGu969BBByUV44tJMVDPGKxgqWNFBaIrkvGljdVUqQSVwD+/iPYACoSkI8BRYvDMEBDkathIUQ==}
+ astro@4.16.13:
+ resolution: {integrity: sha512-Mtd76+BC0zLWqoXpf9xc731AhdH4MNh5JFHYdLRvSH0Nqn48hA64dPGh/cWsJvh/DZFmC0NTZusM1Qq2gyNaVg==}
engines: {node: ^18.17.1 || ^20.3.0 || >=21.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0'}
hasBin: true
@@ -1926,8 +1929,8 @@ packages:
vfile@6.0.3:
resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==}
- vite@5.4.10:
- resolution: {integrity: sha512-1hvaPshuPUtxeQ0hsVH3Mud0ZanOLwVTneA1EgbAM5LhaZEqyPWGRQ7BtaMvUrTDeEaC8pxtj6a6jku3x4z6SQ==}
+ vite@5.4.11:
+ resolution: {integrity: sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==}
engines: {node: ^18.0.0 || >=20.0.0}
hasBin: true
peerDependencies:
@@ -2580,13 +2583,13 @@ snapshots:
'@oslojs/encoding@1.1.0': {}
- '@preact/preset-vite@2.9.1(patch_hash=wx4a2puiselz4n5hatk6npe6l4)(@babel/core@7.26.0)(preact@10.24.3(patch_hash=nmwo7i2pfqokqkren3uyzcqkya))(vite@5.4.10(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2))':
+ '@preact/preset-vite@2.9.1(patch_hash=wx4a2puiselz4n5hatk6npe6l4)(@babel/core@7.26.0)(preact@10.24.3(patch_hash=nmwo7i2pfqokqkren3uyzcqkya))(vite@5.4.11(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2))':
dependencies:
'@babel/code-frame': 7.25.7
'@babel/core': 7.26.0
'@babel/plugin-transform-react-jsx': 7.25.7(@babel/core@7.26.0)
'@babel/plugin-transform-react-jsx-development': 7.25.7(@babel/core@7.26.0)
- '@prefresh/vite': 2.4.6(preact@10.24.3(patch_hash=nmwo7i2pfqokqkren3uyzcqkya))(vite@5.4.10(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2))
+ '@prefresh/vite': 2.4.6(preact@10.24.3(patch_hash=nmwo7i2pfqokqkren3uyzcqkya))(vite@5.4.11(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2))
'@rollup/pluginutils': 4.2.1
babel-plugin-transform-hook-names: 1.0.2(@babel/core@7.26.0)
debug: 4.3.7
@@ -2595,7 +2598,7 @@ snapshots:
node-html-parser: 6.1.13
source-map: 0.7.4
stack-trace: 1.0.0-pre2
- vite: 5.4.10(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2)
+ vite: 5.4.11(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2)
transitivePeerDependencies:
- preact
- supports-color
@@ -2608,7 +2611,7 @@ snapshots:
'@prefresh/utils@1.2.0': {}
- '@prefresh/vite@2.4.6(preact@10.24.3(patch_hash=nmwo7i2pfqokqkren3uyzcqkya))(vite@5.4.10(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2))':
+ '@prefresh/vite@2.4.6(preact@10.24.3(patch_hash=nmwo7i2pfqokqkren3uyzcqkya))(vite@5.4.11(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2))':
dependencies:
'@babel/core': 7.25.7
'@prefresh/babel-plugin': 0.5.1
@@ -2616,7 +2619,7 @@ snapshots:
'@prefresh/utils': 1.2.0
'@rollup/pluginutils': 4.2.1
preact: 10.24.3(patch_hash=nmwo7i2pfqokqkren3uyzcqkya)
- vite: 5.4.10(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2)
+ vite: 5.4.11(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2)
transitivePeerDependencies:
- supports-color
@@ -2710,7 +2713,7 @@ snapshots:
'@types/babel__core@7.20.5':
dependencies:
- '@babel/parser': 7.25.7
+ '@babel/parser': 7.26.2
'@babel/types': 7.26.0
'@types/babel__generator': 7.6.8
'@types/babel__template': 7.4.4
@@ -2722,7 +2725,7 @@ snapshots:
'@types/babel__template@7.4.4':
dependencies:
- '@babel/parser': 7.25.7
+ '@babel/parser': 7.26.2
'@babel/types': 7.26.0
'@types/babel__traverse@7.20.6':
@@ -2765,10 +2768,10 @@ snapshots:
'@ungap/structured-clone@1.2.0': {}
- '@withastro/node@8.4.0(astro@4.16.9(patch_hash=etcf34y5ycd4ewbhb2nylfitly)(@types/node@22.4.2)(rollup@4.24.0)(typescript@5.6.3))':
+ '@withastro/node@8.4.0(astro@4.16.13(patch_hash=etcf34y5ycd4ewbhb2nylfitly)(@types/node@22.4.2)(rollup@4.24.0)(typescript@5.6.3))':
dependencies:
'@types/ws': 8.5.12
- astro: 4.16.9(patch_hash=etcf34y5ycd4ewbhb2nylfitly)(@types/node@22.4.2)(rollup@4.24.0)(typescript@5.6.3)
+ astro: 4.16.13(patch_hash=etcf34y5ycd4ewbhb2nylfitly)(@types/node@22.4.2)(rollup@4.24.0)(typescript@5.6.3)
send: 0.19.1
server-destroy: 1.0.1
ws: 8.18.0(patch_hash=kx7tmpitapmudddeuody7gwvtq)
@@ -2815,7 +2818,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
- astro@4.16.9(patch_hash=etcf34y5ycd4ewbhb2nylfitly)(@types/node@22.4.2)(rollup@4.24.0)(typescript@5.6.3):
+ astro@4.16.13(patch_hash=etcf34y5ycd4ewbhb2nylfitly)(@types/node@22.4.2)(rollup@4.24.0)(typescript@5.6.3):
dependencies:
'@astrojs/compiler': 2.10.3
'@astrojs/internal-helpers': 0.4.1
@@ -2871,8 +2874,8 @@ snapshots:
tsconfck: 3.1.4(typescript@5.6.3)
unist-util-visit: 5.0.0
vfile: 6.0.3
- vite: 5.4.10(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2)
- vitefu: 1.0.3(vite@5.4.10(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2))
+ vite: 5.4.11(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2)
+ vitefu: 1.0.3(vite@5.4.11(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2))
which-pm: 3.0.0
xxhash-wasm: 1.0.2
yargs-parser: 21.1.1
@@ -3433,7 +3436,7 @@ snapshots:
magicast@0.3.5:
dependencies:
- '@babel/parser': 7.25.7
+ '@babel/parser': 7.26.2
'@babel/types': 7.26.0
source-map-js: 1.2.1
@@ -4269,7 +4272,7 @@ snapshots:
'@types/unist': 3.0.3
vfile-message: 4.0.2
- vite@5.4.10(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2):
+ vite@5.4.11(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2):
dependencies:
esbuild: 0.21.5
postcss: 8.4.47
@@ -4278,9 +4281,9 @@ snapshots:
'@types/node': 22.4.2
fsevents: 2.3.3
- vitefu@1.0.3(vite@5.4.10(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2)):
+ vitefu@1.0.3(vite@5.4.11(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2)):
optionalDependencies:
- vite: 5.4.10(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2)
+ vite: 5.4.11(patch_hash=t7mv5eo4jnpkrovnpp7p2hvsn4)(@types/node@22.4.2)
web-namespaces@2.0.1: {}