absolute json paths

This commit is contained in:
Chris Wanstrath 2025-11-06 11:07:52 -08:00
parent 4ff6368a8c
commit cafa9108bb

View File

@ -1,12 +1,17 @@
import { globals } from 'shrimp'
import { AnsiUp } from 'ansi_up'
import { join, dirname } from 'path'
import { fileURLToPath } from 'url'
const __dirname = dirname(fileURLToPath(import.meta.url))
const dataDir = join(__dirname, '..', 'data')
const buffer: string[] = []
const NOSPACE_TOKEN = '!!ribbit-nospace!!'
const TAG_TOKEN = '!!ribbit-tag!!'
const SELF_CLOSING = new Set(await Bun.file('./data/self-closing.json').json())
const HTML5_TAGS = await Bun.file('./data/tags.json').json()
const HTML5_ATTRS = new Set(await Bun.file('./data/attrs.json').json())
const SELF_CLOSING = new Set(await Bun.file(join(dataDir, 'self-closing.json')).json())
const HTML5_TAGS = await Bun.file(join(dataDir, 'tags.json')).json()
const HTML5_ATTRS = new Set(await Bun.file(join(dataDir, 'attrs.json')).json())
export function wrapCode(code: string): string {
return "ribbit do:\n " + code + "\nend"