Registry / serialization / vmf-transpiler

vmf-transpiler

JSON →
library1.0.0jsnpmunverified

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.

npm install vmf-transpiler
INSTALL
IMPORT
SIG · VMF-TRANSPILER
V
vmf-transpiler
serializationjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse
import { parse } from 'vmf-transpiler'
const vmf = require('vmf-transpiler'); vmf.parse()
ESM module; named exports only.
compile
import { compile } from 'vmf-transpiler'
import vmf from 'vmf-transpiler'; vmf.compile()
No default export; only named exports.
whole module
import * as vmf from 'vmf-transpiler'
const vmf = require('vmf-transpiler')
For CommonJS, use dynamic import() or use ESM.

Shows importing parse and compile, converting a VMF string to a JSON object, and back to VMF string.

import { parse, compile } from 'vmf-transpiler'; // Example VMF string const vmfSource = `"entity" { "id" "1" "classname" "info_player_start" "origin" "0 0 0" }`; // Parse VMF to JSON const json = parse(vmfSource); console.log(json); // Output: { entity: { id: '1', classname: 'info_player_start', origin: '0 0 0' } } // Compile JSON back to VMF const vmfOutput = compile(json); console.log(vmfOutput); // Output: "entity"\n{\n\t"id" "1"\n\t"classname" "info_player_start"\n\t"origin" "0 0 0"\n}
Debug
Known issues
gotchaDuplicate keys in VMF become arrays in JSON, which may be unexpected.
fix
Handle output values that can be strings or arrays; check Array.isArray().
affects: >=1.0.0
gotchaThe parse method does not preserve key order beyond what JavaScript objects support.
fix
Use ast: true option to get an AST if order matters.
affects: >=1.0.0
breakingNo TypeScript types shipped; module does not include type definitions.
fix
Write ambient declarations or use @ts-ignore.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: vmf_transpiler_1.parse is not a function
Using default import instead of named import.
fix
Use import { parse } from 'vmf-transpiler' instead of import parse from 'vmf-transpiler'.
Cannot find module 'vmf-transpiler'
Module not installed or not in node_modules.
fix
Run npm install vmf-transpiler, or check that the package name is correct.
SyntaxError: Unexpected token ':' in JSON at position ...
Passing a JSON string to parse instead of VMF string.
fix
Ensure input to parse() is VMF format, not JSON.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
vmf-transpiler — npm install vmf-transpiler · libregistry