confbox is a utility library for parsing and serializing various configuration file formats, including YAML, TOML, JSONC (JSON with Comments), JSON5, INI, and standard JSON. The current stable version is 0.2.4, and the package maintains an active development cadence, releasing minor updates and patches regularly. Key differentiators include its claim of zero runtime dependencies for the end-user, tree-shakability for efficient bundling, and out-of-the-box TypeScript type definitions. It also features logic to preserve code style, such as indentation and whitespace, for certain formats during round-trip parsing and stringifying. While it wraps several established parsing libraries internally, it presents a unified, simplified API. For more complex configuration loading scenarios, the unjs/c12 library is recommended as an alternative.
npm install confboxVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing a YAML string, modifying the resulting object, and stringifying it back.
Migrate all imports from `const { someFunc } = require('confbox')` to `import { someFunc } from 'confbox'`. Ensure your project environment (Node.js version, bundler configuration) supports ESM.Be aware that INI output will be canonicalized. If style preservation is critical for INI, consider alternative dedicated INI parsers or processing the raw text directly.
Monitor `confbox` release notes for dependency updates. If encountering unexpected parsing behavior, consult the documentation or issues of the respective underlying parser library (e.g., `js-yaml` for YAML).
If specific JSON indentation is required, always explicitly pass an `options` object to `stringifyJSON`, e.g., `stringifyJSON(value, { indent: 4 })` or `stringifyJSON(value, { indent: null })` for no indentation.Change `const { parseYAML } = require('confbox');` to `import { parseYAML } from 'confbox';` and ensure your project is configured for ES modules.Verify that you are using named imports for the specific functions you need, e.g., `import { parseYAML } from 'confbox';`.Run `npm install confbox`, `yarn add confbox`, or `pnpm add confbox` to install the package. If the issue persists, check your module resolution configuration.
No dependency data recorded yet.