{"id":26319,"library":"riot-compiler","title":"riot-compiler","description":"Compiler for Riot.js .tag files, transforming custom tag syntax (HTML + JavaScript) into standard JavaScript modules. Current stable version is 10.0.1 (2024), with major breaking changes in v10.0.0: dropped Node <22, switched from `assert` to `with` for JSON imports, and changed boolean attribute handling on root nodes. v9.x series is in maintenance. Key differentiator: tightly coupled to Riot.js library, designed specifically for Riot's tag-based component model. Release cadence: irregular, with major versions tied to Riot.js updates.","status":"active","version":"3.6.0","language":"javascript","source_language":"en","source_url":"https://github.com/riot/compiler","tags":["javascript","riot","virtualdom","tag","compiler"],"install":[{"cmd":"npm install riot-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add riot-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add riot-compiler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only since v10.0.0; CommonJS not supported.","wrong":"const compile = require('riot-compiler').compile","symbol":"compile","correct":"import { compile } from 'riot-compiler'"},{"note":"Named export, not default.","wrong":"import registerPreprocessor from 'riot-compiler'","symbol":"registerPreprocessor","correct":"import { registerPreprocessor } from 'riot-compiler'"},{"note":"Class export for programmatic use; ESM only since v10.","wrong":"const RiotCompiler = require('riot-compiler')","symbol":"RiotCompiler","correct":"import { RiotCompiler } from 'riot-compiler'"}],"quickstart":{"code":"import { compile } from 'riot-compiler';\nconst code = compile(`<my-tag>\\n  <p>{ message }</p>\\n  <script>\\n    export default {\\n      message: 'Hello'\\n    }\\n  </script>\\n</my-tag>`);\nconsole.log(code);","lang":"typescript","description":"Compile a basic Riot.js .tag file with an ES module script tag."},"warnings":[{"fix":"Update Node.js version to >=22; ensure imports use ESM syntax.","message":"v10.0.0 drops support for Node.js <22 and removes CommonJS support.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Review component templates: use explicit attribute bindings or update Riot.js to latest.","message":"v10.0.0 changes boolean attribute handling on root nodes: attributes are no longer automatically set as properties.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Update JSON import statements: replace `assert { type: 'json' }` with `with { type: 'json' }`.","message":"v10.0.0 switches JSON imports from 'assert' to 'with' syntax.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Upgrade to v10.x for ongoing support.","message":"v9.x is no longer actively maintained; security patches only.","severity":"deprecated","affected_versions":">=9.0.0 <10.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add \"type\": \"module\" to your package.json or rename file to .mjs.","cause":"Trying to use ESM import in a CommonJS module without 'type': 'module' in package.json.","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Replace `assert { type: 'json' }` with `with { type: 'json' }`.","cause":"Using old JSON import syntax with 'assert' in Node >=22.","error":"Error: The 'assert' option is deprecated. Please use 'with' instead."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}