{"id":41434,"library":"lsp-syntax-highlighter-compiler","title":"LSP Syntax Highlighter Compiler","description":"A compiler package for lsp-syntax-highlighter, transforming language server protocol data into syntax-highlighted HTML. Version 1.0.4. This package is the build-time component that processes grammar and theme definitions; runtime usage is handled by lsp-syntax-highlighter. Low release cadence, primarily used as a dependency. Differentiator: decouples compilation from rendering, enabling pre-compiled syntax data for performance.","status":"active","version":"1.0.4","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install lsp-syntax-highlighter-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add lsp-syntax-highlighter-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add lsp-syntax-highlighter-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for runtime rendering of compiled output","package":"lsp-syntax-highlighter","optional":true}],"imports":[{"note":"ESM only; no default export.","wrong":"const { default: compile } = require('lsp-syntax-highlighter-compiler')","symbol":"compile","correct":"import { compile } from 'lsp-syntax-highlighter-compiler'"},{"note":"Type-only import for TypeScript users.","wrong":"import { CompilerOptions } from 'lsp-syntax-highlighter-compiler'","symbol":"CompilerOptions","correct":"import type { CompilerOptions } from 'lsp-syntax-highlighter-compiler'"},{"note":"Async variant is in subpath export '/async'. Available since v1.0.0.","wrong":"import { compileSource } from 'lsp-syntax-highlighter-compiler'","symbol":"compileSource","correct":"import { compileSource } from 'lsp-syntax-highlighter-compiler/async'"}],"quickstart":{"code":"import { compile } from 'lsp-syntax-highlighter-compiler';\nimport { render } from 'lsp-syntax-highlighter';\n\nconst grammars = []; // your grammar JSON\nconst themes = [];   // your theme JSON\nconst compiled = compile(grammars, themes);\nconst html = render(compiled, 'source code');\nconsole.log(html);","lang":"typescript","description":"Compiles grammars and themes, then renders highlighted HTML."},"warnings":[{"fix":"Wrap single grammars/themes in arrays.","message":"compile() expects grammars and themes arrays, not single objects.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Call JSON.stringify(compiled.toJSON()).","message":"Compiled output cannot be serialized to JSON directly; must use toJSON() method.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.4':24 'build':30 'build-tim':29 'cadenc':50 'compil':4,6,58,64 'compon':32 'data':17,66 'decoupl':57 'definit':38 'depend':55 'differenti':56 'enabl':61 'grammar':35 'handl':42 'highlight':3,12,21,47 'html':22 'javascript':69 'languag':14 'low':48 'lsp':1,10,45 'lsp-syntax-highlight':9,44 'packag':7,26 'perform':68 'pre':63 'pre-compil':62 'primarili':51 'process':34 'protocol':16 'releas':49 'render':60 'runtim':39 'server':15 'syntax':2,11,20,46,65 'syntax-highlight':19 'theme':37 'time':31 'transform':13 'usag':40 'use':52 'version':23","created_at":"2026-06-04T18:52:23.445636+00:00","updated_at":"2026-06-04T18:52:23.445636+00:00","problems":[{"fix":"Use import { compile } from 'lsp-syntax-highlighter-compiler'","cause":"Importing default export instead of named.","error":"TypeError: (intermediate value).compile is not a function"},{"fix":"Wrap grammar in array: compile([grammar], themes)","cause":"Passing single grammar object instead of array.","error":"Error: Grammars must be an array"}],"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":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"lsp-syntax-highlighter-compiler","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}}