@ascii-fx/vite 0.2.0 → 0.3.0
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/README.md +33 -15
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,31 +1,49 @@
|
|
|
1
1
|
# @ascii-fx/vite
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Compile glyph profiles and static frames at build time, and import them like any other asset.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pnpm add -D @ascii-fx/vite
|
|
7
|
+
```
|
|
4
8
|
|
|
5
9
|
```ts
|
|
6
10
|
// vite.config.ts
|
|
7
11
|
import { ascii } from '@ascii-fx/vite'
|
|
8
|
-
export default defineConfig({ plugins: [ascii({ config: './ascii-fx.config.ts' })] })
|
|
9
12
|
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
plugins: [ascii({ config: './ascii-fx.config.ts' })],
|
|
15
|
+
})
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```ts
|
|
10
19
|
// ascii-fx.config.ts
|
|
11
20
|
import { defineAsciiConfig } from '@ascii-fx/vite'
|
|
21
|
+
|
|
12
22
|
export default defineAsciiConfig({
|
|
13
|
-
profiles: {
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
frames: {
|
|
17
|
-
hero: { image: './src/assets/hero.png', profile: 'default', columns: 140, color: 'full' },
|
|
18
|
-
},
|
|
23
|
+
profiles: { default: { font: './fonts/GeistMono-Regular.ttf' } },
|
|
24
|
+
frames: { hero: { profile: 'default', image: './src/hero.png', columns: 160 } },
|
|
19
25
|
})
|
|
20
26
|
```
|
|
21
27
|
|
|
22
28
|
```ts
|
|
23
|
-
|
|
24
|
-
import
|
|
25
|
-
import heroRef from 'virtual:ascii-frame/hero' // { url, id, profile }
|
|
26
|
-
|
|
27
|
-
const profile = await loadProfile(profileRef)
|
|
28
|
-
const frame = await loadFrame(heroRef, profile) // zero matching at runtime (spec §16)
|
|
29
|
+
import profileUrl from 'virtual:ascii-profile/default?url'
|
|
30
|
+
import heroUrl from 'virtual:ascii-frame/hero?url'
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
Typed, hashed, and cached like any other Vite asset. Add `@ascii-fx/vite/client` to your `tsconfig` `types` for the module declarations.
|
|
34
|
+
|
|
35
|
+
## What it buys you
|
|
36
|
+
|
|
37
|
+
Compiling a profile costs real time — rasterizing every glyph, building the atlas, deriving structural masks. The runtime packages will do it at startup if they have to, but doing it once at build time means the client downloads a compact binary instead, and gets byte-identical glyphs on every machine rather than whatever the runtime produced that session.
|
|
38
|
+
|
|
39
|
+
A precompiled **frame** goes further: matching already happened, so the client ships glyph ids and colours and does no matching at all. That's the cheapest possible path for a static hero image.
|
|
40
|
+
|
|
41
|
+
## Watching
|
|
42
|
+
|
|
43
|
+
Fonts and images are watched. Change a font and the profiles built from it recompile and hot-reload; change a source image and its frame does. A corrupt cache entry rebuilds rather than failing forever.
|
|
44
|
+
|
|
45
|
+
None of the compiler reaches the client bundle — it runs in Vite's Node context and emits assets.
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
[MIT](../../LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ascii-fx/vite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Vite integration for ASCII FX: build-time profile compilation and static frame generation as virtual modules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ascii",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@ascii-fx/compiler": "0.
|
|
44
|
-
"@ascii-fx/core": "0.
|
|
43
|
+
"@ascii-fx/compiler": "0.3.0",
|
|
44
|
+
"@ascii-fx/core": "0.3.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/node": "^26.2.0",
|