"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_primordials_string = require('../../primordials/string.js');
const require_primordials_object = require('../../primordials/object.js');
const require_smol_manifest = require('../../smol/manifest.js');
const require_eco_cargo_lockfile_format = require('../cargo/lockfile-format.js');
const require_eco_cargo_manifest_format = require('../cargo/manifest-format.js');
const require_eco_npm_manifest_format = require('../npm/manifest-format.js');
const require_eco_npm_npm_lockfile_format = require('../npm/npm/lockfile-format.js');
const require_eco_npm_pnpm_lockfile_format = require('../npm/pnpm/lockfile-format.js');
const require_eco_npm_yarnpkg_yarn_lockfile_format = require('../npm/yarnpkg/yarn/lockfile-format.js');

//#region src/eco/manifest/detect-format.ts
/**
* @file `detectFormat(filename)` — maps a filename (or path) to its
*   `FormatDescriptor` (ecosystem + manifest/lockfile + lockfile format), or
*   returns `undefined` if nothing matched. On socket-btm's smol Node binary
*   this routes to `node:smol-manifest`'s native `detectFormat`; on stock Node
*   it does a basename switch over the format descriptors exported by each
*   PM-specific dir under `src/eco/<eco>/<pm>/`. The two paths return
*   byte-equivalent shapes so the swap is invisible. `supportedFiles` is
*   exported alongside for callers that want to enumerate the recognized
*   filenames (e.g. for file-globbing).
*/
const COMPOSER_JSON_FORMAT = require_primordials_object.ObjectFreeze({
	__proto__: null,
	ecosystem: "composer",
	type: "manifest"
});
const COMPOSER_LOCK_FORMAT = require_primordials_object.ObjectFreeze({
	__proto__: null,
	ecosystem: "composer",
	format: "composer",
	type: "lockfile"
});
const _jsSupportedFiles = require_primordials_object.ObjectFreeze({
	__proto__: null,
	manifests: require_primordials_object.ObjectFreeze([
		require_eco_npm_manifest_format.PACKAGE_JSON_FILENAME,
		require_eco_cargo_manifest_format.CARGO_TOML_FILENAME,
		"composer.json"
	]),
	lockfiles: require_primordials_object.ObjectFreeze([
		...require_eco_npm_npm_lockfile_format.PACKAGE_LOCK_FILENAMES,
		require_eco_npm_yarnpkg_yarn_lockfile_format.YARN_LOCK_FILENAME,
		require_eco_npm_pnpm_lockfile_format.PNPM_LOCK_FILENAME,
		require_eco_cargo_lockfile_format.CARGO_LOCK_FILENAME,
		"composer.lock"
	])
});
function jsDetectFormat(filename) {
	const lastSlash = require_primordials_string.StringPrototypeLastIndexOf(filename, "/");
	switch (lastSlash === -1 ? filename : require_primordials_string.StringPrototypeSlice(filename, lastSlash + 1)) {
		case require_eco_npm_manifest_format.PACKAGE_JSON_FILENAME: return require_eco_npm_manifest_format.PACKAGE_JSON_FORMAT;
		case require_eco_cargo_manifest_format.CARGO_TOML_FILENAME: return require_eco_cargo_manifest_format.CARGO_TOML_FORMAT;
		case "composer.json": return COMPOSER_JSON_FORMAT;
		case "package-lock.json":
		case "npm-shrinkwrap.json": return require_eco_npm_npm_lockfile_format.PACKAGE_LOCK_FORMAT;
		case require_eco_npm_yarnpkg_yarn_lockfile_format.YARN_LOCK_FILENAME: return require_eco_npm_yarnpkg_yarn_lockfile_format.YARN_LOCK_FORMAT;
		case require_eco_npm_pnpm_lockfile_format.PNPM_LOCK_FILENAME: return require_eco_npm_pnpm_lockfile_format.PNPM_LOCK_FORMAT;
		case require_eco_cargo_lockfile_format.CARGO_LOCK_FILENAME: return require_eco_cargo_lockfile_format.CARGO_LOCK_FORMAT;
		case "composer.lock": return COMPOSER_LOCK_FORMAT;
		default: return;
	}
}
const _smol = /* @__PURE__ */ require_smol_manifest.getSmolManifest();
const detectFormat = _smol?.detectFormat ?? jsDetectFormat;
const supportedFiles = _smol?.supportedFiles ?? _jsSupportedFiles;

//#endregion
exports.detectFormat = detectFormat;
exports.jsDetectFormat = jsDetectFormat;
exports.supportedFiles = supportedFiles;