"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_smol_manifest = require('../../smol/manifest.js');
const require_eco_manifest_detect_format = require('./detect-format.js');
const require_eco_manifest_manifest_error = require('./manifest-error.js');
const require_eco_manifest_parse_lockfile = require('./parse-lockfile.js');
const require_eco_manifest_parse_manifest = require('./parse-manifest.js');

//#region src/eco/manifest/parse.ts
/**
* @file `parse(filename, content)` — auto-detects format from filename then
*   dispatches to `parseManifest` or `parseLockfile`. Throws
*   `ManifestError(ERR_UNKNOWN_FORMAT)` when the filename doesn't match any
*   recognized manifest or lockfile basename.
*/
function jsParse(filename, content) {
	const format = require_eco_manifest_detect_format.detectFormat(filename);
	if (!format) throw new require_eco_manifest_manifest_error.ManifestError(`Unknown file format: ${filename}`, "ERR_UNKNOWN_FORMAT");
	if (format.type === "manifest") return require_eco_manifest_parse_manifest.parseManifest(content, format.ecosystem);
	return require_eco_manifest_parse_lockfile.parseLockfile(content, format.ecosystem, format.format);
}
const _smol = /* @__PURE__ */ require_smol_manifest.getSmolManifest();
/* c8 ignore start - smol-fallback branch is smol Node binary only. */
const smolParse = _smol ? (filename, content) => _smol.parse(filename, content) : void 0;
/* c8 ignore stop */
const parse = smolParse ?? jsParse;

//#endregion
exports.jsParse = jsParse;
exports.parse = parse;