{"id":25815,"library":"jsx-lua-transpiler","title":"JSX Lua Transpiler","description":"A TypeScript library (v1.1.2) that transpiles JSX-like syntax into Lua tables. It parses JSX expressions embedded in Lua code and converts them to a structured table format with type, name, atts (attributes), and children fields. This enables writing HTML-like markup inside Lua, particularly useful for Lua-based UI frameworks or game engines. The package ships TypeScript declarations and requires TypeScript 5+ as a peer dependency. Compared to general Lua transpilers, it is focused specifically on JSX-to-Lua conversion with no overhead. The project is maintained by a single developer on GitHub.","status":"active","version":"1.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/ankushKun/jsx-lua-transpiler","tags":["javascript","jsx","lua","transpiler","typescript"],"install":[{"cmd":"npm install jsx-lua-transpiler","lang":"bash","label":"npm"},{"cmd":"yarn add jsx-lua-transpiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add jsx-lua-transpiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as peer dependency for TypeScript type definitions and compilation.","package":"typescript","optional":true}],"imports":[{"note":"The package is ESM-only (TypeScript source). Default export not available.","wrong":"const transpileLuaX = require('jsx-lua-transpiler')","symbol":"transpileLuaX","correct":"import { transpileLuaX } from 'jsx-lua-transpiler'"},{"note":"TranspileResult is a type, use 'import type' to avoid runtime import.","wrong":"import { TranspileResult } from 'jsx-lua-transpiler'","symbol":"TranspileResult","correct":"import type { TranspileResult } from 'jsx-lua-transpiler'"},{"note":"No default export; only named export exists.","wrong":"import transpileLuaX from 'jsx-lua-transpiler'","symbol":"default","correct":"import { transpileLuaX } from 'jsx-lua-transpiler'"}],"quickstart":{"code":"import { transpileLuaX } from 'jsx-lua-transpiler';\n\nconst luaCode = `\nlocal element = <div class=\"container\">\n    <h1>Hello World</h1>\n    <img src=\"image.jpg\" alt=\"An image\" />\n</div>\n\nprint(element)\n`;\n\nconst transpiled = transpileLuaX(luaCode);\nconsole.log(transpiled);\n// Output: {\n//   type: 'html', name: 'div', atts: { class: 'container' },\n//   children: [\n//     { type: 'html', name: 'h1', atts: {}, children: [{ type: 'text', text: 'Hello World' }] },\n//     { type: 'html', name: 'img', atts: { src: 'image.jpg', alt: 'An image' }, children: [] }\n//   ]\n// }","lang":"typescript","description":"Demonstrates converting JSX-like syntax within Lua code into a nested Lua table representation using transpileLuaX."},"warnings":[{"fix":"Update code expecting old format; adjust Lua code that processes the transpiled tables.","message":"v1.0.0 changed output table structure: children now always an array, not table with numeric indices.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure JSX is not inside a Lua string literal. Use raw code blocks.","message":"JSX must be written as literal in Lua string; strings containing JSX are not transpiled.","severity":"gotcha","affected_versions":">=1.1.2"},{"fix":"Always close self-closing tags with />.","message":"Self-closing tags (like <img />) require the trailing slash; otherwise parsed incorrectly.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update to v1.1.0+ and access output.code instead of plain string.","message":"transpileLuaX function behavior changed in v1.1.0: now returns an object with 'code' field.","severity":"deprecated","affected_versions":"<1.1.0"},{"fix":"Use attribute names without hyphens or wrap in quotes if needed.","message":"HTML tag attributes with hyphens (e.g., data-value) may not be recognized; use camelCase or quoted strings.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'5':69 'att':36 'attribut':37 'base':55 'children':39 'code':24 'compar':74 'convers':88 'convert':26 'declar':65 'depend':73 'develop':99 'embed':21 'enabl':42 'engin':60 'express':20 'field':40 'focus':81 'format':32 'framework':57 'game':59 'general':76 'github':101 'html':45 'html-like':44 'insid':48 'javascript':102 'jsx':1,11,19,85,103 'jsx-like':10 'jsx-to-lua':84 'librari':6 'like':12,46 'lua':2,15,23,49,54,77,87,104 'lua-bas':53 'maintain':95 'markup':47 'name':35 'overhead':91 'packag':62 'pars':18 'particular':50 'peer':72 'project':93 'requir':67 'ship':63 'singl':98 'specif':82 'structur':30 'syntax':13 'tabl':16,31 'transpil':3,9,78,105 'type':34 'typescript':5,64,68,106 'ui':56 'use':51 'v1.1.2':7 'write':43","created_at":"2026-05-01T13:46:43.099345+00:00","updated_at":"2026-05-01T13:46:43.099345+00:00","problems":[{"fix":"Run 'npm install typescript@^5' as a dev dependency.","cause":"Missing TypeScript peer dependency or not installed.","error":"Cannot find module 'jsx-lua-transpiler' or its corresponding type declarations"},{"fix":"Wrap JSX in a Lua string and pass to transpileLuaX.","cause":"Trying to use JSX outside of Lua code string assignment.","error":"Expected a assignment or function call and instead saw an expression"},{"fix":"Use 'import { transpileLuaX } from 'jsx-lua-transpiler''.","cause":"Importing default export instead of named export.","error":"TypeError: transpileLuaX is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/ankushKun/jsx-lua-transpiler","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/jsx-lua-transpiler","openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}