{"id":42172,"library":"typstx","title":"typstx","description":"A pre-release (v0.0.1-beta.1) Typst MDX compiler that transforms Typst markup into JSX, integrating with rehype and the MDX ecosystem. It allows using Typst syntax alongside JSX components in MDX documents, with a compiler that can be used programmatically. Not yet stable; APIs may change. Differentiated from @mdx-js/mdx by supporting Typst instead of Markdown.","status":"maintenance","version":"0.0.1-beta.1","language":"javascript","source_language":"en","source_url":"https://github.com/overflowcat/hastx","tags":["javascript","jsx","typst","mdx","rehype"],"install":[{"cmd":"npm install typstx","lang":"bash","label":"npm"},{"cmd":"yarn add typstx","lang":"bash","label":"yarn"},{"cmd":"pnpm add typstx","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core MDX compiler for parsing and transformation, typstx builds on top of it","package":"@mdx-js/mdx","optional":false},{"reason":"Needed for HTML processing; typstx likely uses rehype plugins","package":"rehype","optional":true}],"imports":[{"note":"ESM-only package; requires Node.js 16+","wrong":"const { compile } = require('typstx')","symbol":"compile","correct":"import { compile } from 'typstx'"},{"note":"Synchronous variant; useful for server-side rendering without await","wrong":null,"symbol":"compileSync","correct":"import { compileSync } from 'typstx'"},{"note":"No default export exported; do not use default import","wrong":"import { default as typstx } from 'typstx'","symbol":"default","correct":"import typstx from 'typstx'"}],"quickstart":{"code":"import fs from 'node:fs/promises';\nimport { compile } from 'typstx';\n\nconst file = await fs.readFile('example.typ');\nconst compiled = await compile(file);\nconsole.log(String(compiled));\n// Outputs: compiled JSX code","lang":"typescript","description":"Compiles a Typst file to JSX using the asynchronous compile function, demonstrating basic usage."},"warnings":[{"fix":"Lock version to 0.0.1-beta.1 and expect future updates to break compatibility.","message":"typstx versions prior to 1.0.0 are unstable and may undergo breaking changes.","severity":"deprecated","affected_versions":"<1.0.0"},{"fix":"Use import syntax or switch to Node >=16","message":"Package is ESM-only. CommonJS require() will fail.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use named imports like import { compile } from 'typstx'","message":"No default export. Import named exports only.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use String(result) or result.toString()","message":"Expected but undocumented: compile returns a VFile object, not a string. Call String() to get code.","severity":"breaking","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'/mdx':53 'allow':24 'alongsid':28 'api':45 'chang':47 'compil':9,36 'compon':30 'differenti':48 'document':33 'ecosystem':22 'instead':57 'integr':16 'javascript':60 'js':52 'jsx':15,29,61 'markdown':59 'markup':13 'may':46 'mdx':8,21,32,51,63 'mdx-js':50 'pre':4 'pre-releas':3 'programmat':41 'rehyp':18,64 'releas':5 'stabl':44 'support':55 'syntax':27 'transform':11 'typst':7,12,26,56,62 'typstx':1 'use':25,40 'v0.0.1-beta.1':6 'yet':43","created_at":"2026-06-04T18:55:58.021458+00:00","updated_at":"2026-06-04T18:55:58.021458+00:00","problems":[{"fix":"Change import to import { compile } from 'typstx'","cause":"Attempting to use default import instead of named import.","error":"TypeError: typstx__WEBPACK_IMPORTED_MODULE_0__.compile is not a function"},{"fix":"Convert to ES module (type: module in package.json) or use dynamic import.","cause":"Using CommonJS require() with ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/node_modules/typstx/index.js from /path/script.js not supported."},{"fix":"Add declare module 'typstx'; in a .d.ts file or use @ts-ignore.","cause":"Package has no TypeScript type declarations yet (v0.0.1-beta.1).","error":"Cannot find module 'typstx' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://overflow.cat","github":"https://github.com/overflowcat/hastx","docs":null,"changelog":null,"pypi":null,"npm":"typstx","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}