lukeed / tempura

A light, crispy, and delicious template engine 🍤

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Templates with bare backticks cannot be compiled

yudai-nkt opened this issue · comments

Templates that contain backticks cannot be compiled because they internally create template literals containing unescaped backticks. Reproduction code is shown below:

import { compile } from "tempura";

const foo = compile("\\`") // ok
const bar = compile("`") // not ok
$ node repro.mjs
undefined:4
})


SyntaxError: Unexpected end of input
    at new Function (<anonymous>)
    at compile (file:///Users/ynkt/src/github.com/yudai-nkt/eslint-plugin-uvu/node_modules/tempura/dist/index.mjs:130:9)
    at file:///Users/ynkt/src/github.com/yudai-nkt/eslint-plugin-uvu/repro.mjs:4:13
    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12)

I'd appreciate it if backticks can be compiled without escaping. It would make templating more intuitive and handy.