@ascii-fx/vite 0.7.0 → 0.9.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/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -60,6 +60,7 @@ function ascii(options = {}) {
|
|
|
60
60
|
const key = sha(
|
|
61
61
|
JSON.stringify([
|
|
62
62
|
sha(font),
|
|
63
|
+
pc.face ?? null,
|
|
63
64
|
pc.charset ?? "ascii",
|
|
64
65
|
pc.characters ?? null,
|
|
65
66
|
pc.shape6 ?? false,
|
|
@@ -79,6 +80,7 @@ function ascii(options = {}) {
|
|
|
79
80
|
if (profile === void 0) {
|
|
80
81
|
const built = buildProfile({
|
|
81
82
|
font,
|
|
83
|
+
face: pc.face,
|
|
82
84
|
id: name,
|
|
83
85
|
charset: pc.charset,
|
|
84
86
|
characters: pc.characters,
|
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.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 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.cach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AS,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":[]}
|
|
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,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;AACJ,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,aAAO;AAAA,IACT;AACA,UAAM,OAAO,QAAQ,MAAM,OAAO,QAAQ,WAAW,MAAM,oBAAoB;AAC/E,UAAM,SAAS,MAAM,mBAA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AC,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.9.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.9.0",
|
|
44
|
+
"@ascii-fx/core": "0.9.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@types/node": "^26.
|
|
47
|
+
"@types/node": "^26.6.5",
|
|
48
48
|
"@types/pngjs": "^6.0.5",
|
|
49
49
|
"pngjs": "^7.0.0",
|
|
50
50
|
"tsup": "^8.5.1",
|
|
51
51
|
"typescript": "^7.0.2",
|
|
52
|
-
"vite": "^8.
|
|
52
|
+
"vite": "^8.3.4"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|