{"id":15065,"library":"yamlparser","title":"Legacy CommonJS YAML Parser","description":"The `yamlparser` package is an extremely old and unmaintained JavaScript YAML parser, last published in May 2013 with its only version being 0.0.2. It was created as a CommonJS port of an earlier client-side JavaScript YAML parser and aims to handle 'simply structured YAML files' rather than fully implementing the YAML specification. The package's GitHub repository was archived in December 2022, officially marking it as read-only and abandoned. Due to its age, lack of updates, and limited feature set, it is not suitable for modern applications. Users requiring YAML parsing functionality should consider actively maintained alternatives like `js-yaml` or `yaml` that support current YAML specifications and modern JavaScript environments (ESM).","status":"abandoned","version":"0.0.2","language":"javascript","source_language":"en","source_url":"git://github.com/h4evr/commonjs-javascript-yaml-parser","tags":["javascript"],"install":[{"cmd":"npm install yamlparser","lang":"bash","label":"npm"},{"cmd":"yarn add yamlparser","lang":"bash","label":"yarn"},{"cmd":"pnpm add yamlparser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is strictly CommonJS. There is no official documentation for its API, but a `parse` method is inferred as the primary interface for parsing YAML strings. ESM imports are not supported.","wrong":"import { parse } from 'yamlparser';","symbol":"parse","correct":"const yamlparser = require('yamlparser');\nconst parsed = yamlparser.parse(yamlString);"}],"quickstart":{"code":"const yamlparser = require('yamlparser');\n\nconst yamlString = `\nname: John Doe\nage: 30\ncities:\n  - New York\n  - London\nactive: true\n`;\n\ntry {\n  const data = yamlparser.parse(yamlString);\n  console.log('Parsed YAML:', data);\n  // Expected output: { name: 'John Doe', age: 30, cities: [ 'New York', 'London' ], active: true }\n} catch (error) {\n  console.error('Failed to parse YAML:', error.message);\n}\n\n// Example with invalid YAML (may throw an error or produce unexpected results depending on implementation)\nconst invalidYamlString = `\nkey: value\n  another_key: indented_incorrectly\n`;\ntry {\n  const invalidData = yamlparser.parse(invalidYamlString);\n  console.log('Parsed invalid YAML:', invalidData);\n} catch (error) {\n  console.error('Failed to parse invalid YAML as expected:', error.message);\n}","lang":"javascript","description":"Demonstrates how to import the `yamlparser` module using CommonJS `require` and parse a simple YAML string. Note the lack of error handling guarantees for malformed YAML due to limited spec support and undocumented API."},"warnings":[{"fix":"Migrate to a currently maintained YAML parser like `js-yaml` or `yaml`.","message":"The `yamlparser` package is entirely abandoned. Its GitHub repository was archived in December 2022, and it has not been updated since its initial release in 2013. Using this package introduces significant security vulnerabilities due to unpatched issues and lack of maintenance.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"If stuck in a CJS environment, use `const yamlparser = require('yamlparser');`. For new projects, prefer modern parsers with ESM support.","message":"This package is strictly CommonJS (CJS) and does not support ES Modules (ESM). Attempting to import it using `import` statements in an ESM project will result in a runtime error.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Due to the undocumented API and abandoned status, it is strongly recommended not to use this package. If forced to use it, thorough testing of its behavior for all expected YAML inputs is necessary.","message":"The package documentation is explicitly marked as 'ToDo' on npm, meaning there is no official API documentation. The exact methods and their behavior (e.g., `parse`, `load`, error handling) are not specified and must be inferred or found through source code analysis.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Avoid using this parser for any YAML that utilizes advanced features. For full YAML specification compliance, use modern, actively maintained libraries.","message":"The package explicitly states it 'does not intend to implement all the aspects formalized in the YAML specs,' focusing only on 'simply structured YAML files.' Complex YAML features (e.g., anchors, tags, specific data types) may not be supported or may be parsed incorrectly.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"This package is CommonJS-only. Ensure your project is configured for CommonJS or use a dynamic `import()` if bridging CJS and ESM. However, the fundamental fix is to migrate to a modern YAML parser that supports ESM.","cause":"Attempting to `require()` an ES Module or using `import` to load this CommonJS package in an ES Module context.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported. Instead change the require of ... to a dynamic import() call."},{"fix":"Due to the lack of documentation, you would typically need to inspect the source code to determine the correct function to call. However, the recommended fix is to switch to a well-documented and maintained YAML parsing library.","cause":"The specific API for `yamlparser` is not officially documented. While `parse` is a common method for parsers, the module might export its parsing functionality differently (e.g., directly as a function `require('yamlparser')(yamlString)` or with a different method name).","error":"TypeError: yamlparser.parse is not a function"}],"ecosystem":"npm"}