{"id":42348,"library":"yuku-parser","title":"yuku-parser","description":"High-performance JavaScript/TypeScript parser written in Zig, producing ESTree-compliant AST for JS/JSX and TypeScript-ESTree AST for TS/TSX. Features full support for Stage 3 decorators, import defer, import source, and hashbang. Provides fast offset-to-line/column resolution via locOf/locNear. Current stable version is 0.5.28. Released under Apache-2.0 license. Key differentiator: extreme speed (native Zig) while maintaining spec compliance identical to Acorn and @typescript-eslint/parser.","status":"active","version":"0.5.28","language":"javascript","source_language":"en","source_url":"https://github.com/yuku-toolchain/yuku","tags":["javascript","acorn","ast","babel","compiler","ecmascript","espree","fast","typescript"],"install":[{"cmd":"npm install yuku-parser","lang":"bash","label":"npm"},{"cmd":"yarn add yuku-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add yuku-parser","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Companion toolkit for AST walking, builders, type guards, and validators","package":"yuku-ast","optional":true}],"imports":[{"note":"Package is ESM-only; CommonJS require not supported.","wrong":"const { parse } = require('yuku-parser');","symbol":"parse","correct":"import { parse } from 'yuku-parser';"},{"note":"Exported from main entry point.","wrong":"import { langFromPath } from 'yuku-parser/lang';","symbol":"langFromPath","correct":"import { langFromPath } from 'yuku-parser';"},{"note":"Exported from main entry point.","wrong":"import { sourceTypeFromPath } from 'yuku-parser/path';","symbol":"sourceTypeFromPath","correct":"import { sourceTypeFromPath } from 'yuku-parser';"},{"note":"Use import type for type-only imports in TypeScript; runtime import will fail because AST types are not values.","wrong":"import { Node } from 'yuku-parser';","symbol":"Node type","correct":"import type { Node, Statement, Expression, Identifier } from 'yuku-parser';"}],"quickstart":{"code":"import { parse, langFromPath, sourceTypeFromPath } from 'yuku-parser';\n\nconst filePath = 'component.tsx';\nconst lang = langFromPath(filePath); // \"tsx\"\nconst sourceType = sourceTypeFromPath(filePath); // \"module\"\n\nconst source = `\nimport { useState } from 'react';\nconst App = () => {\n  const [count, setCount] = useState(0);\n  return <div>{count}</div>;\n};\n`;\n\nconst result = parse(source, {\n  lang: lang,\n  sourceType: sourceType\n});\n\nconsole.log(\"AST:\", result.program);\nconsole.log(\"Diagnostics:\", result.diagnostics);\n\n// Convert offset to line:column\nif (result.program.body.length > 0) {\n  const start = result.program.body[0].start;\n  const { line, column } = result.locOf(start);\n  console.log(`First statement starts at line ${line}, column ${column}`);\n}","lang":"typescript","description":"Parses a JSX/TSX file, converts offset to line/column, and shows diagnostics."},"warnings":[{"fix":"Use import syntax or dynamic import().","message":"Package is ESM-only; CommonJS require() will throw.","severity":"breaking","affected_versions":">=0.1"},{"fix":"Use import type ... from 'yuku-parser' for type annotations; do not import for runtime access.","message":"AST node types are exported as types only; cannot be used as runtime values.","severity":"gotcha","affected_versions":">=0.1"},{"fix":"When comparing with ESTree 'loc' values, lines are 1-based and columns 0-based.","message":"locOf and locNear return line (1-based) and column (0-based), which may differ from some other parsers using 0-based lines.","severity":"gotcha","affected_versions":">=0.1"},{"fix":"Use locOf() to convert to line/column if byte positions are needed; otherwise handle UTF-16 offsets.","message":"AST fields 'start' and 'end' use UTF-16 code units, not byte offsets.","severity":"deprecated","affected_versions":">=0.1"}],"env_vars":null,"search_vec":"'-2.0':57 '/column':45 '/parser':76 '0.5.28':53 '3':31 'acorn':71,78 'apach':56 'ast':16,23,79 'babel':80 'compil':81 'complianc':68 'compliant':15 'current':49 'decor':32 'defer':34 'differenti':60 'ecmascript':82 'eslint':75 'espre':83 'estre':14,22 'estree-compli':13 'extrem':61 'fast':40,84 'featur':26 'full':27 'hashbang':38 'high':5 'high-perform':4 'ident':69 'import':33,35 'javascript':77 'javascript/typescript':7 'js/jsx':18 'key':59 'licens':58 'line':44 'locof/locnear':48 'maintain':66 'nativ':63 'offset':42 'offset-to-lin':41 'parser':3,8 'perform':6 'produc':12 'provid':39 'releas':54 'resolut':46 'sourc':36 'spec':67 'speed':62 'stabl':50 'stage':30 'support':28 'ts/tsx':25 'typescript':21,74,85 'typescript-eslint':73 'typescript-estre':20 'version':51 'via':47 'written':9 'yuku':2 'yuku-pars':1 'zig':11,64","created_at":"2026-06-04T18:56:49.587838+00:00","updated_at":"2026-06-04T18:56:49.587838+00:00","problems":[{"fix":"Check lang and sourceType options match the file content; ensure source is valid.","cause":"Source contains syntax that is not valid JS/TS in the specified lang or sourceType.","error":"SyntaxError: Unexpected token"},{"fix":"Switch to import { parse } from 'yuku-parser'; or use dynamic import().","cause":"Using CommonJS require with ESM-only package.","error":"TypeError: (0 , yuku_parser.parse) is not a function"},{"fix":"Use import type { Node } from 'yuku-parser'; for type-only imports.","cause":"Trying to import type 'Node' as a runtime value.","error":"Module '\"yuku-parser\"' has no exported member 'Node'."},{"fix":"Ensure package is installed; set 'moduleResolution': 'node16' or 'nodenext' in tsconfig.","cause":"Package not installed or TypeScript version incompatible (needs moduleResolution: node16/nodenext).","error":"Cannot find module 'yuku-parser' 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://github.com/yuku-toolchain/yuku#readme","github":"https://github.com/yuku-toolchain/yuku","docs":null,"changelog":null,"pypi":null,"npm":"yuku-parser","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}}