@ascii-fx/vite 0.9.1 → 0.10.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 +7 -3
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -26,11 +26,15 @@ export default defineAsciiConfig({
|
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
```ts
|
|
29
|
-
import
|
|
30
|
-
import
|
|
29
|
+
import { loadFrame, loadProfile } from '@ascii-fx/core'
|
|
30
|
+
import profileRef from 'virtual:ascii-profile/default' // { url, id }
|
|
31
|
+
import heroRef from 'virtual:ascii-frame/hero' // { url, id, profile }
|
|
32
|
+
|
|
33
|
+
const profile = await loadProfile(profileRef)
|
|
34
|
+
const hero = await loadFrame(heroRef, profile)
|
|
31
35
|
```
|
|
32
36
|
|
|
33
|
-
Typed, hashed, and cached like any other Vite asset. Add `@ascii-fx/vite/client` to your `tsconfig` `types` for the module declarations.
|
|
37
|
+
Each module's default export is a small reference whose `url` points at the compiled asset; `loadProfile`, `loadFrame`, and every `profile` prop in `@ascii-fx/react` take the reference as it is. `font` and `image` paths are relative to the config file. Typed, hashed, and cached like any other Vite asset. Add `@ascii-fx/vite/client` to your `tsconfig` `types` for the module declarations.
|
|
34
38
|
|
|
35
39
|
## What it buys you
|
|
36
40
|
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { createHash } from "crypto";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
|
|
4
|
-
import { resolve } from "path";
|
|
4
|
+
import { dirname, resolve } from "path";
|
|
5
5
|
import process from "process";
|
|
6
6
|
import { loadConfigFromFile, normalizePath } from "vite";
|
|
7
7
|
import { decodeProfile, peekFrame } from "@ascii-fx/core";
|
|
@@ -21,6 +21,7 @@ function ascii(options = {}) {
|
|
|
21
21
|
let root = process.cwd();
|
|
22
22
|
let cacheDir = "";
|
|
23
23
|
let config;
|
|
24
|
+
let configBase = root;
|
|
24
25
|
let configDeps = [];
|
|
25
26
|
const profiles = /* @__PURE__ */ new Map();
|
|
26
27
|
const frames = /* @__PURE__ */ new Map();
|
|
@@ -30,6 +31,7 @@ function ascii(options = {}) {
|
|
|
30
31
|
const opt = options.config;
|
|
31
32
|
if (opt && typeof opt === "object") {
|
|
32
33
|
config = opt;
|
|
34
|
+
configBase = root;
|
|
33
35
|
return config;
|
|
34
36
|
}
|
|
35
37
|
const file = resolve(root, typeof opt === "string" ? opt : "ascii-fx.config.ts");
|
|
@@ -40,6 +42,7 @@ function ascii(options = {}) {
|
|
|
40
42
|
);
|
|
41
43
|
}
|
|
42
44
|
configDeps = [normalizePath(loaded.path), ...loaded.dependencies.map((d) => abs(root, d))];
|
|
45
|
+
configBase = dirname(loaded.path);
|
|
43
46
|
config = loaded.config;
|
|
44
47
|
return config;
|
|
45
48
|
}
|
|
@@ -53,7 +56,7 @@ function ascii(options = {}) {
|
|
|
53
56
|
`[ascii-fx] Profile "${name}" is not defined in the config (available: ${Object.keys(cfg.profiles ?? {}).join(", ") || "none"}).`
|
|
54
57
|
);
|
|
55
58
|
}
|
|
56
|
-
const fontPath = abs(
|
|
59
|
+
const fontPath = abs(configBase, pc.font);
|
|
57
60
|
if (!existsSync(fontPath))
|
|
58
61
|
throw new Error(`[ascii-fx] Font not found for profile "${name}": ${fontPath}`);
|
|
59
62
|
const font = new Uint8Array(readFileSync(fontPath));
|
|
@@ -106,7 +109,7 @@ function ascii(options = {}) {
|
|
|
106
109
|
}
|
|
107
110
|
const profileName = fc.profile ?? "default";
|
|
108
111
|
const { profile, fontPath } = await ensureProfile(profileName);
|
|
109
|
-
const imagePath = abs(
|
|
112
|
+
const imagePath = abs(configBase, fc.image);
|
|
110
113
|
if (!existsSync(imagePath))
|
|
111
114
|
throw new Error(`[ascii-fx] Image not found for frame "${name}": ${imagePath}`);
|
|
112
115
|
const imageBytes = new Uint8Array(readFileSync(imagePath));
|
|
@@ -180,6 +183,7 @@ function ascii(options = {}) {
|
|
|
180
183
|
name: "ascii-fx",
|
|
181
184
|
configResolved(resolved) {
|
|
182
185
|
root = resolved.root;
|
|
186
|
+
configBase = root;
|
|
183
187
|
cacheDir = options.cacheDir ? abs(root, options.cacheDir) : abs(root, "node_modules/.ascii-fx");
|
|
184
188
|
config = typeof options.config === "object" ? options.config : void 0;
|
|
185
189
|
configDeps = [];
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createHash } from 'node:crypto'\nimport { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport process from 'node:process'\nimport type { Plugin } from 'vite'\nimport { loadConfigFromFile, normalizePath } from 'vite'\nimport type { AsciiProfile } from '@ascii-fx/core'\nimport { decodeProfile, peekFrame } from '@ascii-fx/core'\nimport type { AsciiConfig } from '@ascii-fx/compiler'\nimport { COMPILER_PACKAGE_VERSION, buildFrame, buildProfile, decodePng } from '@ascii-fx/compiler'\n\nexport { defineAsciiConfig } from '@ascii-fx/compiler'\nexport type { AsciiConfig, AsciiFrameConfig, AsciiProfileConfig } from '@ascii-fx/compiler'\n\nconst PROFILE_PREFIX = 'virtual:ascii-profile/'\nconst FRAME_PREFIX = 'virtual:ascii-frame/'\nconst RESOLVED = '\\0'\n\nexport interface AsciiPluginOptions {\n /** Inline config or path to an ascii-fx.config.(ts|js|mjs). Default './ascii-fx.config.ts'. */\n config?: string | AsciiConfig\n /** Compiled asset cache. Default '<root>/node_modules/.ascii-fx'. */\n cacheDir?: string\n}\n\ninterface ProfileEntry {\n cachePath: string\n profile: AsciiProfile\n fontPath: string\n}\n\ninterface FrameEntry {\n cachePath: string\n profileName: string\n imagePath: string\n fontPath: string\n}\n\nconst sha = (data: string | Uint8Array): string => createHash('sha256').update(data).digest('hex')\n\n// Vite hands watcher ids to watchChange/handleHotUpdate POSIX-normalized, so\n// every path stored for === comparison — and every specifier emitted into a\n// virtual module — must be normalized the same way, or invalidation (and, for\n// specifiers, resolution) is dead on Windows.\nconst abs = (...segments: string[]): string => normalizePath(resolve(...segments))\n\n// Temp + rename: a crash mid-write must not leave a truncated file at the\n// final path, where every later build would trust it. The read sites still\n// treat an undecodable entry as a cache miss, so a bad file from any other\n// cause cannot wedge the build either.\nconst writeAtomic = (path: string, bytes: Uint8Array): void => {\n const tmp = `${path}.tmp-${process.pid}`\n writeFileSync(tmp, bytes)\n renameSync(tmp, path)\n}\n\n/**\n * ASCII FX Vite plugin (spec §17): compiles font profiles and static frames at\n * build time and exposes them as typed virtual modules\n * (`virtual:ascii-profile/<name>`, `virtual:ascii-frame/<name>`). All\n * compilation lives in @ascii-fx/compiler; nothing of it reaches the client\n * bundle — modules resolve to hashed .asciip/.asciif assets via `?url`.\n */\nexport function ascii(options: AsciiPluginOptions = {}): Plugin {\n let root = process.cwd()\n let cacheDir = ''\n let config: AsciiConfig | undefined\n let configDeps: string[] = []\n const profiles = new Map<string, ProfileEntry>()\n const frames = new Map<string, FrameEntry>()\n const pendingHmrIds = new Set<string>()\n\n async function ensureConfig(): Promise<AsciiConfig> {\n if (config) return config\n const opt = options.config\n if (opt && typeof opt === 'object') {\n config = opt\n return config\n }\n const file = resolve(root, typeof opt === 'string' ? opt : 'ascii-fx.config.ts')\n const loaded = await loadConfigFromFile({ command: 'build', mode: 'production' }, file, root)\n if (!loaded) {\n throw new Error(\n `[ascii-fx] Could not load config at ${file}. Create it with defineAsciiConfig({ profiles: ... }).`,\n )\n }\n configDeps = [normalizePath(loaded.path), ...loaded.dependencies.map((d) => abs(root, d))]\n config = loaded.config as AsciiConfig\n return config\n }\n\n async function ensureProfile(name: string): Promise<ProfileEntry> {\n const cached = profiles.get(name)\n if (cached) return cached\n const cfg = await ensureConfig()\n const pc = cfg.profiles?.[name]\n if (!pc) {\n throw new Error(\n `[ascii-fx] Profile \"${name}\" is not defined in the config (available: ${Object.keys(cfg.profiles ?? {}).join(', ') || 'none'}).`,\n )\n }\n const fontPath = abs(root, pc.font)\n if (!existsSync(fontPath))\n throw new Error(`[ascii-fx] Font not found for profile \"${name}\": ${fontPath}`)\n const font = new Uint8Array(readFileSync(fontPath))\n // COMPILER_PACKAGE_VERSION salts the key because the cache dir survives installs: without\n // it, upgrading the packages would keep serving bytes built by the old compiler.\n const key = sha(\n JSON.stringify([\n sha(font),\n pc.face ?? null,\n pc.charset ?? 'ascii',\n pc.characters ?? null,\n pc.shape6 ?? false,\n COMPILER_PACKAGE_VERSION,\n 'asciip/1',\n ]),\n ).slice(0, 16)\n const cachePath = abs(cacheDir, `${name}-${key}.asciip`)\n let profile: AsciiProfile | undefined\n if (existsSync(cachePath)) {\n try {\n profile = decodeProfile(new Uint8Array(readFileSync(cachePath)))\n } catch {\n profile = undefined // corrupt entry — treat as a miss, rebuild over it\n }\n }\n if (profile === undefined) {\n const built = buildProfile({\n font,\n face: pc.face,\n id: name,\n charset: pc.charset,\n characters: pc.characters,\n shape6: pc.shape6,\n })\n mkdirSync(cacheDir, { recursive: true })\n writeAtomic(cachePath, built.binary)\n profile = built.profile\n }\n const entry = { cachePath, profile, fontPath }\n profiles.set(name, entry)\n return entry\n }\n\n async function ensureFrame(name: string): Promise<FrameEntry> {\n const cached = frames.get(name)\n if (cached) return cached\n const cfg = await ensureConfig()\n const fc = cfg.frames?.[name]\n if (!fc) {\n throw new Error(\n `[ascii-fx] Frame \"${name}\" is not defined in the config (available: ${Object.keys(cfg.frames ?? {}).join(', ') || 'none'}).`,\n )\n }\n const profileName = fc.profile ?? 'default'\n const { profile, fontPath } = await ensureProfile(profileName)\n const imagePath = abs(root, fc.image)\n if (!existsSync(imagePath))\n throw new Error(`[ascii-fx] Image not found for frame \"${name}\": ${imagePath}`)\n const imageBytes = new Uint8Array(readFileSync(imagePath))\n // Salted like the profile key: matching lives in @ascii-fx/core, but the fixed release\n // group moves COMPILER_PACKAGE_VERSION whenever any of it changes.\n const key = sha(\n JSON.stringify([\n sha(imageBytes),\n profile.fingerprint,\n fc.columns,\n fc.rows,\n fc.color,\n fc.alpha,\n COMPILER_PACKAGE_VERSION,\n 'asciif/1',\n ]),\n ).slice(0, 16)\n const cachePath = abs(cacheDir, `${name}-${key}.asciif`)\n let cacheHit = false\n if (existsSync(cachePath)) {\n try {\n // Frames are served to the browser without a build-time decode, so a\n // corrupt entry would surface as a runtime failure in the app; peek\n // the header here and rebuild over anything unreadable.\n peekFrame(new Uint8Array(readFileSync(cachePath)))\n cacheHit = true\n } catch {\n cacheHit = false\n }\n }\n if (!cacheHit) {\n const built = buildFrame({\n image: decodePng(imageBytes),\n profile,\n columns: fc.columns,\n rows: fc.rows,\n color: fc.color,\n alpha: fc.alpha,\n })\n mkdirSync(cacheDir, { recursive: true })\n writeAtomic(cachePath, built.binary)\n }\n const entry = { cachePath, profileName, imagePath, fontPath }\n frames.set(name, entry)\n return entry\n }\n\n function invalidateFile(id: string): string[] {\n const affectedProfiles = new Set<string>()\n const affectedFrames = new Set<string>()\n if (configDeps.includes(id)) {\n for (const name of profiles.keys()) affectedProfiles.add(name)\n for (const name of frames.keys()) affectedFrames.add(name)\n config = typeof options.config === 'object' ? options.config : undefined\n configDeps = []\n profiles.clear()\n frames.clear()\n pendingHmrIds.clear()\n } else {\n for (const [name, entry] of profiles) {\n if (entry.fontPath === id) affectedProfiles.add(name)\n }\n for (const [name, entry] of frames) {\n if (\n entry.imagePath === id ||\n entry.fontPath === id ||\n affectedProfiles.has(entry.profileName)\n ) {\n affectedFrames.add(name)\n }\n }\n for (const name of affectedProfiles) profiles.delete(name)\n for (const name of affectedFrames) frames.delete(name)\n }\n return [\n ...Array.from(affectedProfiles, (name) => RESOLVED + PROFILE_PREFIX + name),\n ...Array.from(affectedFrames, (name) => RESOLVED + FRAME_PREFIX + name),\n ]\n }\n\n return {\n name: 'ascii-fx',\n configResolved(resolved) {\n root = resolved.root\n cacheDir = options.cacheDir\n ? abs(root, options.cacheDir)\n : abs(root, 'node_modules/.ascii-fx')\n // Config/watch state resets per build so edits are picked up.\n config = typeof options.config === 'object' ? options.config : undefined\n configDeps = []\n profiles.clear()\n frames.clear()\n pendingHmrIds.clear()\n },\n resolveId(id) {\n if (id.startsWith(PROFILE_PREFIX) || id.startsWith(FRAME_PREFIX)) return RESOLVED + id\n return null\n },\n watchChange(id) {\n for (const moduleId of invalidateFile(id)) pendingHmrIds.add(moduleId)\n },\n handleHotUpdate(ctx) {\n const ids = [...pendingHmrIds, ...invalidateFile(ctx.file)]\n pendingHmrIds.clear()\n if (ids.length === 0) return\n const modules = ids.flatMap((id) => {\n const module = ctx.server.moduleGraph.getModuleById(id)\n if (!module) return []\n ctx.server.moduleGraph.invalidateModule(module)\n return [module]\n })\n return [...new Set([...ctx.modules, ...modules])]\n },\n async load(id) {\n if (id.startsWith(RESOLVED + PROFILE_PREFIX)) {\n const name = id.slice(RESOLVED.length + PROFILE_PREFIX.length)\n const entry = await ensureProfile(name)\n this.addWatchFile(entry.fontPath)\n for (const dep of configDeps) this.addWatchFile(dep)\n return (\n `import url from ${JSON.stringify(`${entry.cachePath}?url`)}\\n` +\n `export default { url, id: ${JSON.stringify(name)} }\\n`\n )\n }\n if (id.startsWith(RESOLVED + FRAME_PREFIX)) {\n const name = id.slice(RESOLVED.length + FRAME_PREFIX.length)\n const entry = await ensureFrame(name)\n this.addWatchFile(entry.imagePath)\n this.addWatchFile(entry.fontPath)\n for (const dep of configDeps) this.addWatchFile(dep)\n return (\n `import url from ${JSON.stringify(`${entry.cachePath}?url`)}\\n` +\n `export default { url, id: ${JSON.stringify(name)}, profile: ${JSON.stringify(entry.profileName)} }\\n`\n )\n }\n return null\n },\n }\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,YAAY,WAAW,cAAc,YAAY,qBAAqB;AAC/E,SAAS,eAAe;AACxB,OAAO,aAAa;AAEpB,SAAS,oBAAoB,qBAAqB;AAElD,SAAS,eAAe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U,IAAI,CAAC;AAAA;AAAA,MAErD;AACA,UAAI,GAAG,WAAW,WAAW,YAAY,GAAG;AAC1C,cAAM,OAAO,GAAG,MAAM,SAAS,SAAS,aAAa,MAAM;AAC3D,cAAM,QAAQ,MAAM,YAAY,IAAI;AACpC,aAAK,aAAa,MAAM,SAAS;AACjC,aAAK,aAAa,MAAM,QAAQ;AAChC,mBAAW,OAAO,WAAY,MAAK,aAAa,GAAG;AACnD,eACE,mBAAmB,KAAK,UAAU,GAAG,MAAM,SAAS,MAAM,CAAC;AAAA,4BAC9B,KAAK,UAAU,IAAI,CAAC,cAAc,KAAK,UAAU,MAAM,WAAW,CAAC;AAAA;AAAA,MAEpG;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createHash } from 'node:crypto'\nimport { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'\nimport { dirname, resolve } from 'node:path'\nimport process from 'node:process'\nimport type { Plugin } from 'vite'\nimport { loadConfigFromFile, normalizePath } from 'vite'\nimport type { AsciiProfile } from '@ascii-fx/core'\nimport { decodeProfile, peekFrame } from '@ascii-fx/core'\nimport type { AsciiConfig } from '@ascii-fx/compiler'\nimport { COMPILER_PACKAGE_VERSION, buildFrame, buildProfile, decodePng } from '@ascii-fx/compiler'\n\nexport { defineAsciiConfig } from '@ascii-fx/compiler'\nexport type { AsciiConfig, AsciiFrameConfig, AsciiProfileConfig } from '@ascii-fx/compiler'\n\nconst PROFILE_PREFIX = 'virtual:ascii-profile/'\nconst FRAME_PREFIX = 'virtual:ascii-frame/'\nconst RESOLVED = '\\0'\n\nexport interface AsciiPluginOptions {\n /** Inline config or path to an ascii-fx.config.(ts|js|mjs). Default './ascii-fx.config.ts'. */\n config?: string | AsciiConfig\n /** Compiled asset cache. Default '<root>/node_modules/.ascii-fx'. */\n cacheDir?: string\n}\n\ninterface ProfileEntry {\n cachePath: string\n profile: AsciiProfile\n fontPath: string\n}\n\ninterface FrameEntry {\n cachePath: string\n profileName: string\n imagePath: string\n fontPath: string\n}\n\nconst sha = (data: string | Uint8Array): string => createHash('sha256').update(data).digest('hex')\n\n// Vite hands watcher ids to watchChange/handleHotUpdate POSIX-normalized, so\n// every path stored for === comparison — and every specifier emitted into a\n// virtual module — must be normalized the same way, or invalidation (and, for\n// specifiers, resolution) is dead on Windows.\nconst abs = (...segments: string[]): string => normalizePath(resolve(...segments))\n\n// Temp + rename: a crash mid-write must not leave a truncated file at the\n// final path, where every later build would trust it. The read sites still\n// treat an undecodable entry as a cache miss, so a bad file from any other\n// cause cannot wedge the build either.\nconst writeAtomic = (path: string, bytes: Uint8Array): void => {\n const tmp = `${path}.tmp-${process.pid}`\n writeFileSync(tmp, bytes)\n renameSync(tmp, path)\n}\n\n/**\n * ASCII FX Vite plugin (spec §17): compiles font profiles and static frames at\n * build time and exposes them as typed virtual modules\n * (`virtual:ascii-profile/<name>`, `virtual:ascii-frame/<name>`). All\n * compilation lives in @ascii-fx/compiler; nothing of it reaches the client\n * bundle — modules resolve to hashed .asciip/.asciif assets via `?url`.\n */\nexport function ascii(options: AsciiPluginOptions = {}): Plugin {\n let root = process.cwd()\n let cacheDir = ''\n let config: AsciiConfig | undefined\n /**\n * What `font` and `image` paths resolve against: the config file's directory, as its\n * JSDoc says, or the Vite root for a config passed inline, which has no file to be\n * relative to. The two are the same place for the default `<root>/ascii-fx.config.ts`.\n */\n let configBase = root\n let configDeps: string[] = []\n const profiles = new Map<string, ProfileEntry>()\n const frames = new Map<string, FrameEntry>()\n const pendingHmrIds = new Set<string>()\n\n async function ensureConfig(): Promise<AsciiConfig> {\n if (config) return config\n const opt = options.config\n if (opt && typeof opt === 'object') {\n config = opt\n configBase = root\n return config\n }\n const file = resolve(root, typeof opt === 'string' ? opt : 'ascii-fx.config.ts')\n const loaded = await loadConfigFromFile({ command: 'build', mode: 'production' }, file, root)\n if (!loaded) {\n throw new Error(\n `[ascii-fx] Could not load config at ${file}. Create it with defineAsciiConfig({ profiles: ... }).`,\n )\n }\n configDeps = [normalizePath(loaded.path), ...loaded.dependencies.map((d) => abs(root, d))]\n configBase = dirname(loaded.path)\n config = loaded.config as AsciiConfig\n return config\n }\n\n async function ensureProfile(name: string): Promise<ProfileEntry> {\n const cached = profiles.get(name)\n if (cached) return cached\n const cfg = await ensureConfig()\n const pc = cfg.profiles?.[name]\n if (!pc) {\n throw new Error(\n `[ascii-fx] Profile \"${name}\" is not defined in the config (available: ${Object.keys(cfg.profiles ?? {}).join(', ') || 'none'}).`,\n )\n }\n const fontPath = abs(configBase, pc.font)\n if (!existsSync(fontPath))\n throw new Error(`[ascii-fx] Font not found for profile \"${name}\": ${fontPath}`)\n const font = new Uint8Array(readFileSync(fontPath))\n // COMPILER_PACKAGE_VERSION salts the key because the cache dir survives installs: without\n // it, upgrading the packages would keep serving bytes built by the old compiler.\n const key = sha(\n JSON.stringify([\n sha(font),\n pc.face ?? null,\n pc.charset ?? 'ascii',\n pc.characters ?? null,\n pc.shape6 ?? false,\n COMPILER_PACKAGE_VERSION,\n 'asciip/1',\n ]),\n ).slice(0, 16)\n const cachePath = abs(cacheDir, `${name}-${key}.asciip`)\n let profile: AsciiProfile | undefined\n if (existsSync(cachePath)) {\n try {\n profile = decodeProfile(new Uint8Array(readFileSync(cachePath)))\n } catch {\n profile = undefined // corrupt entry — treat as a miss, rebuild over it\n }\n }\n if (profile === undefined) {\n const built = buildProfile({\n font,\n face: pc.face,\n id: name,\n charset: pc.charset,\n characters: pc.characters,\n shape6: pc.shape6,\n })\n mkdirSync(cacheDir, { recursive: true })\n writeAtomic(cachePath, built.binary)\n profile = built.profile\n }\n const entry = { cachePath, profile, fontPath }\n profiles.set(name, entry)\n return entry\n }\n\n async function ensureFrame(name: string): Promise<FrameEntry> {\n const cached = frames.get(name)\n if (cached) return cached\n const cfg = await ensureConfig()\n const fc = cfg.frames?.[name]\n if (!fc) {\n throw new Error(\n `[ascii-fx] Frame \"${name}\" is not defined in the config (available: ${Object.keys(cfg.frames ?? {}).join(', ') || 'none'}).`,\n )\n }\n const profileName = fc.profile ?? 'default'\n const { profile, fontPath } = await ensureProfile(profileName)\n const imagePath = abs(configBase, fc.image)\n if (!existsSync(imagePath))\n throw new Error(`[ascii-fx] Image not found for frame \"${name}\": ${imagePath}`)\n const imageBytes = new Uint8Array(readFileSync(imagePath))\n // Salted like the profile key: matching lives in @ascii-fx/core, but the fixed release\n // group moves COMPILER_PACKAGE_VERSION whenever any of it changes.\n const key = sha(\n JSON.stringify([\n sha(imageBytes),\n profile.fingerprint,\n fc.columns,\n fc.rows,\n fc.color,\n fc.alpha,\n COMPILER_PACKAGE_VERSION,\n 'asciif/1',\n ]),\n ).slice(0, 16)\n const cachePath = abs(cacheDir, `${name}-${key}.asciif`)\n let cacheHit = false\n if (existsSync(cachePath)) {\n try {\n // Frames are served to the browser without a build-time decode, so a\n // corrupt entry would surface as a runtime failure in the app; peek\n // the header here and rebuild over anything unreadable.\n peekFrame(new Uint8Array(readFileSync(cachePath)))\n cacheHit = true\n } catch {\n cacheHit = false\n }\n }\n if (!cacheHit) {\n const built = buildFrame({\n image: decodePng(imageBytes),\n profile,\n columns: fc.columns,\n rows: fc.rows,\n color: fc.color,\n alpha: fc.alpha,\n })\n mkdirSync(cacheDir, { recursive: true })\n writeAtomic(cachePath, built.binary)\n }\n const entry = { cachePath, profileName, imagePath, fontPath }\n frames.set(name, entry)\n return entry\n }\n\n function invalidateFile(id: string): string[] {\n const affectedProfiles = new Set<string>()\n const affectedFrames = new Set<string>()\n if (configDeps.includes(id)) {\n for (const name of profiles.keys()) affectedProfiles.add(name)\n for (const name of frames.keys()) affectedFrames.add(name)\n config = typeof options.config === 'object' ? options.config : undefined\n configDeps = []\n profiles.clear()\n frames.clear()\n pendingHmrIds.clear()\n } else {\n for (const [name, entry] of profiles) {\n if (entry.fontPath === id) affectedProfiles.add(name)\n }\n for (const [name, entry] of frames) {\n if (\n entry.imagePath === id ||\n entry.fontPath === id ||\n affectedProfiles.has(entry.profileName)\n ) {\n affectedFrames.add(name)\n }\n }\n for (const name of affectedProfiles) profiles.delete(name)\n for (const name of affectedFrames) frames.delete(name)\n }\n return [\n ...Array.from(affectedProfiles, (name) => RESOLVED + PROFILE_PREFIX + name),\n ...Array.from(affectedFrames, (name) => RESOLVED + FRAME_PREFIX + name),\n ]\n }\n\n return {\n name: 'ascii-fx',\n configResolved(resolved) {\n root = resolved.root\n configBase = root\n cacheDir = options.cacheDir\n ? abs(root, options.cacheDir)\n : abs(root, 'node_modules/.ascii-fx')\n // Config/watch state resets per build so edits are picked up.\n config = typeof options.config === 'object' ? options.config : undefined\n configDeps = []\n profiles.clear()\n frames.clear()\n pendingHmrIds.clear()\n },\n resolveId(id) {\n if (id.startsWith(PROFILE_PREFIX) || id.startsWith(FRAME_PREFIX)) return RESOLVED + id\n return null\n },\n watchChange(id) {\n for (const moduleId of invalidateFile(id)) pendingHmrIds.add(moduleId)\n },\n handleHotUpdate(ctx) {\n const ids = [...pendingHmrIds, ...invalidateFile(ctx.file)]\n pendingHmrIds.clear()\n if (ids.length === 0) return\n const modules = ids.flatMap((id) => {\n const module = ctx.server.moduleGraph.getModuleById(id)\n if (!module) return []\n ctx.server.moduleGraph.invalidateModule(module)\n return [module]\n })\n return [...new Set([...ctx.modules, ...modules])]\n },\n async load(id) {\n if (id.startsWith(RESOLVED + PROFILE_PREFIX)) {\n const name = id.slice(RESOLVED.length + PROFILE_PREFIX.length)\n const entry = await ensureProfile(name)\n this.addWatchFile(entry.fontPath)\n for (const dep of configDeps) this.addWatchFile(dep)\n return (\n `import url from ${JSON.stringify(`${entry.cachePath}?url`)}\\n` +\n `export default { url, id: ${JSON.stringify(name)} }\\n`\n )\n }\n if (id.startsWith(RESOLVED + FRAME_PREFIX)) {\n const name = id.slice(RESOLVED.length + FRAME_PREFIX.length)\n const entry = await ensureFrame(name)\n this.addWatchFile(entry.imagePath)\n this.addWatchFile(entry.fontPath)\n for (const dep of configDeps) this.addWatchFile(dep)\n return (\n `import url from ${JSON.stringify(`${entry.cachePath}?url`)}\\n` +\n `export default { url, id: ${JSON.stringify(name)}, profile: ${JSON.stringify(entry.profileName)} }\\n`\n )\n }\n return null\n },\n }\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,YAAY,WAAW,cAAc,YAAY,qBAAqB;AAC/E,SAAS,SAAS,eAAe;AACjC,OAAO,aAAa;AAEpB,SAAS,oBAAoB,qBAAqB;AAElD,SAAS,eAAe,iBAAiB;AAEzC,SAAS,0BAA0B,YAAY,cAAc,iBAAiB;AAE9E,SAAS,yBAAyB;AAGlC,IAAM,iBAAiB;AACvB,IAAM,eAAe;AACrB,IAAM,WAAW;AAsBjB,IAAM,MAAM,CAAC,SAAsC,WAAW,QAAQ,EAAE,OAAO,IAAI,EAAE,OAAO,KAAK;AAMjG,IAAM,MAAM,IAAI,aAA+B,cAAc,QAAQ,GAAG,QAAQ,CAAC;AAMjF,IAAM,cAAc,CAAC,MAAc,UAA4B;AAC7D,QAAM,MAAM,GAAG,IAAI,QAAQ,QAAQ,GAAG;AACtC,gBAAc,KAAK,KAAK;AACxB,aAAW,KAAK,IAAI;AACtB;AASO,SAAS,MAAM,UAA8B,CAAC,GAAW;AAC9D,MAAI,OAAO,QAAQ,IAAI;AACvB,MAAI,WAAW;AACf,MAAI;AAMJ,MAAI,aAAa;AACjB,MAAI,aAAuB,CAAC;AAC5B,QAAM,WAAW,oBAAI,IAA0B;AAC/C,QAAM,SAAS,oBAAI,IAAwB;AAC3C,QAAM,gBAAgB,oBAAI,IAAY;AAEtC,iBAAe,eAAqC;AAClD,QAAI,OAAQ,QAAO;AACnB,UAAM,MAAM,QAAQ;AACpB,QAAI,OAAO,OAAO,QAAQ,UAAU;AAClC,eAAS;AACT,mBAAa;AACb,aAAO;AAAA,IACT;AACA,UAAM,OAAO,QAAQ,MAAM,OAAO,QAAQ,WAAW,MAAM,oBAAoB;AAC/E,UAAM,SAAS,MAAM,mBAAmB,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AI,CAAC,GAAG,IAAI,SAAS,GAAG,OAAO,CAAC,CAAC;AAAA,IAClD;AAAA,IACA,MAAM,KAAK,IAAI;AACb,UAAI,GAAG,WAAW,WAAW,cAAc,GAAG;AAC5C,cAAM,OAAO,GAAG,MAAM,SAAS,SAAS,eAAe,MAAM;AAC7D,cAAM,QAAQ,MAAM,cAAc,IAAI;AACtC,aAAK,aAAa,MAAM,QAAQ;AAChC,mBAAW,OAAO,WAAY,MAAK,aAAa,GAAG;AACnD,eACE,mBAAmB,KAAK,UAAU,GAAG,MAAM,SAAS,MAAM,CAAC;AAAA,4BAC9B,KAAK,UAAU,IAAI,CAAC;AAAA;AAAA,MAErD;AACA,UAAI,GAAG,WAAW,WAAW,YAAY,GAAG;AAC1C,cAAM,OAAO,GAAG,MAAM,SAAS,SAAS,aAAa,MAAM;AAC3D,cAAM,QAAQ,MAAM,YAAY,IAAI;AACpC,aAAK,aAAa,MAAM,SAAS;AACjC,aAAK,aAAa,MAAM,QAAQ;AAChC,mBAAW,OAAO,WAAY,MAAK,aAAa,GAAG;AACnD,eACE,mBAAmB,KAAK,UAAU,GAAG,MAAM,SAAS,MAAM,CAAC;AAAA,4BAC9B,KAAK,UAAU,IAAI,CAAC,cAAc,KAAK,UAAU,MAAM,WAAW,CAAC;AAAA;AAAA,MAEpG;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ascii-fx/vite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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,16 +40,16 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@ascii-fx/compiler": "0.
|
|
44
|
-
"@ascii-fx/core": "0.
|
|
43
|
+
"@ascii-fx/compiler": "0.10.0",
|
|
44
|
+
"@ascii-fx/core": "0.10.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@types/node": "^26.6.
|
|
47
|
+
"@types/node": "^26.6.6",
|
|
48
48
|
"@types/pngjs": "^6.0.5",
|
|
49
49
|
"pngjs": "^7.0.0",
|
|
50
50
|
"tsup": "^9.0.0",
|
|
51
51
|
"typescript": "^7.0.2",
|
|
52
|
-
"vite": "^8.3.
|
|
52
|
+
"vite": "^8.3.8"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|