{"id":24896,"library":"akore","title":"Akore","description":"Akore is a powerful transpiler maker for JavaScript/TypeScript, currently at version 2.2.0. It provides a robust framework for parsing, analyzing, and transforming code, allowing developers to build custom transpilers with ease. Key differentiators include an extensible architecture with concepts like Schema, Registry, Lexer, and BaseTranspiler, and support for both JavaScript and TypeScript. Release cadence is not specified but appears active with recent updates. It requires Node.js >=16 and npm >=8. Compared to alternatives like Babel or SWC, Akore focuses on simplifying the creation of custom transpiler pipelines rather than being a pre-built transpiler.","status":"active","version":"2.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/KodekoStudios/akore","tags":["javascript","transpiler","typescript"],"install":[{"cmd":"npm install akore","lang":"bash","label":"npm"},{"cmd":"yarn add akore","lang":"bash","label":"yarn"},{"cmd":"pnpm add akore","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"TypeScript support requires TypeScript to be installed as a peer dependency for type checking and transformation.","package":"typescript","optional":true}],"imports":[{"note":"Akore is ESM-only since v2; CommonJS require is not supported.","wrong":"const { Schema } = require('akore')","symbol":"Schema","correct":"import { Schema } from 'akore'"},{"note":"Registry is a named export, not a default export.","wrong":"import registry from 'akore'","symbol":"Registry","correct":"import { Registry } from 'akore'"},{"note":"The class is named BaseTranspiler, not Transpiler.","wrong":"import { Transpiler } from 'akore'","symbol":"BaseTranspiler","correct":"import { BaseTranspiler } from 'akore'"},{"note":"Lexer is a named export, not a default export.","wrong":"import Lexer from 'akore'","symbol":"Lexer","correct":"import { Lexer } from 'akore'"}],"quickstart":{"code":"import { Schema, Registry, BaseTranspiler, Lexer } from 'akore';\n\n// Create a schema for a simple language\nconst numberSchema = new Schema('number', { type: 'number' });\n\n// Create a registry and register schemas\nconst registry = new Registry();\nregistry.set('number', numberSchema);\n\n// Define a custom lexer (minimal example)\nclass MyLexer extends Lexer {\n  tokenize(code) {\n    // Simplified tokenization\n    if (code === '42') {\n      return [{ type: 'number', value: 42 }];\n    }\n    return [];\n  }\n}\n\n// Create a transpiler using the registry\nconst transpiler = new BaseTranspiler(registry);\n\n// Example code to transpile\nconst code = '42';\nconst tokens = new MyLexer().tokenize(code);\nconst result = tokens.map(t => t.value).join(' ');\nconsole.log(result); // Output: 42","lang":"typescript","description":"Demonstrates creating a Schema, Registry, custom Lexer, and BaseTranspiler to transpile a simple number token."},"warnings":[{"fix":"Switch to ESM imports: use 'import' statements and ensure package.json has 'type': 'module'.","message":"Version 2.0.0 dropped CommonJS support; require() throws a runtime error.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Replace all 'import { Transpiler }' with 'import { BaseTranspiler }'.","message":"Version 2.0.0 renamed 'Transpiler' class to 'BaseTranspiler'. Old imports break.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use new Schema('identifier', schemaObject) pattern instead of Schema(schemaObject, 'identifier').","message":"Schema constructor argument order changed in v2.1.0: 'identifier' and 'schema' swapped.","severity":"deprecated","affected_versions":">=2.1.0"},{"fix":"Always extend Lexer and implement the tokenize method returning an array of tokens.","message":"Lexer must be subclassed; the base class throws an error if tokenize is not overridden.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use optional chaining: registry.get('key')?.validate(data) or check for undefined.","message":"Registry inherits from Map but get() returns Schema | undefined; TypeScript strict mode requires null checks.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure first argument is a string: new Schema('mySchema', { type: 'string' }).","cause":"Passing a non-string value as the first argument to new Schema() before v2.1.0.","error":"Error: The Schema identifier must be a string."},{"fix":"Update to akore ^2.0.0 and use registry.set/get as Map methods.","cause":"Using an older version where Registry did not extend Map; the API was different.","error":"TypeError: registry.get is not a function"},{"fix":"Change import to: import { BaseTranspiler } from 'akore'.","cause":"Importing 'Transpiler' which was renamed to 'BaseTranspiler' in v2.","error":"SyntaxError: Named export 'Transpiler' not found."},{"fix":"Set 'type': 'module' in package.json or use dynamic import: const akore = await import('akore').","cause":"Akore is ESM-only; using require() in a CommonJS project or missing 'type': 'module' in package.json.","error":"Cannot find module 'akore' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}