{"id":26608,"library":"vmf-transpiler","title":"VMF Transpiler","description":"VMF Transpiler is a library for converting between Valve Map Format (VMF) used by the Hammer editor and JSON. Version 1.0.0, based on leops/vmfparser. It provides parse() and compile() functions for bidirectional conversion, with support for VMF-specific features like multiple values per key (converted to arrays). It is a lightweight utility for game development tooling involving Source Engine maps. Currently stable but single-version release with no published updates.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/birjolaxew/vmf-transpiler","tags":["javascript","vmf","transpiler","parser","valve","source-engine","hammer"],"install":[{"cmd":"npm install vmf-transpiler","lang":"bash","label":"npm"},{"cmd":"yarn add vmf-transpiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add vmf-transpiler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM module; named exports only.","wrong":"const vmf = require('vmf-transpiler'); vmf.parse()","symbol":"parse","correct":"import { parse } from 'vmf-transpiler'"},{"note":"No default export; only named exports.","wrong":"import vmf from 'vmf-transpiler'; vmf.compile()","symbol":"compile","correct":"import { compile } from 'vmf-transpiler'"},{"note":"For CommonJS, use dynamic import() or use ESM.","wrong":"const vmf = require('vmf-transpiler')","symbol":"whole module","correct":"import * as vmf from 'vmf-transpiler'"}],"quickstart":{"code":"import { parse, compile } from 'vmf-transpiler';\n\n// Example VMF string\nconst vmfSource = `\"entity\"\n{\n  \"id\" \"1\"\n  \"classname\" \"info_player_start\"\n  \"origin\" \"0 0 0\"\n}`;\n\n// Parse VMF to JSON\nconst json = parse(vmfSource);\nconsole.log(json);\n// Output: { entity: { id: '1', classname: 'info_player_start', origin: '0 0 0' } }\n\n// Compile JSON back to VMF\nconst vmfOutput = compile(json);\nconsole.log(vmfOutput);\n// Output: \"entity\"\\n{\\n\\t\"id\" \"1\"\\n\\t\"classname\" \"info_player_start\"\\n\\t\"origin\" \"0 0 0\"\\n}","lang":"typescript","description":"Shows importing parse and compile, converting a VMF string to a JSON object, and back to VMF string."},"warnings":[{"fix":"Handle output values that can be strings or arrays; check Array.isArray().","message":"Duplicate keys in VMF become arrays in JSON, which may be unexpected.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use ast: true option to get an AST if order matters.","message":"The parse method does not preserve key order beyond what JavaScript objects support.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Write ambient declarations or use @ts-ignore.","message":"No TypeScript types shipped; module does not include type definitions.","severity":"breaking","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":"Use import { parse } from 'vmf-transpiler' instead of import parse from 'vmf-transpiler'.","cause":"Using default import instead of named import.","error":"TypeError: vmf_transpiler_1.parse is not a function"},{"fix":"Run npm install vmf-transpiler, or check that the package name is correct.","cause":"Module not installed or not in node_modules.","error":"Cannot find module 'vmf-transpiler'"},{"fix":"Ensure input to parse() is VMF format, not JSON.","cause":"Passing a JSON string to parse instead of VMF string.","error":"SyntaxError: Unexpected token ':' in JSON at position ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}