import { toRelative } from './path.js';
export const fromBinary = (input) => input.specifier;
export const toBinary = (specifier, options = {}) => ({
    type: 'binary',
    specifier,
    ...options,
});
export const isBinary = (input) => input.type === 'binary';
export const toEntry = (specifier) => ({ type: 'entry', specifier });
export const isEntry = (input) => input.type === 'entry' && !input.production;
export const toProductionEntry = (specifier, options = {}) => ({
    type: 'entry',
    specifier,
    production: true,
    ...options,
});
export const isProductionEntry = (input) => input.type === 'entry' && input.production === true;
export const toConfig = (pluginName, specifier, containingFilePath) => ({
    type: 'config',
    specifier,
    pluginName,
    containingFilePath,
});
export const isConfigPattern = (input) => input.type === 'config';
export const toDependency = (specifier, options = {}) => ({
    type: 'dependency',
    specifier,
    ...options,
});
export const isDependency = (input) => input.type === 'dependency';
export const toProductionDependency = (specifier) => ({
    type: 'dependency',
    specifier,
    production: true,
});
export const toDevDependency = (specifier) => ({ type: 'dependency', specifier });
export const toDeferResolve = (specifier) => ({ type: 'deferResolve', specifier });
export const toDeferResolveEntry = (specifier) => ({ type: 'deferResolveEntry', specifier });
export const isDeferResolveEntry = (input) => input.type === 'deferResolveEntry';
export const toDebugString = (input) => `${input.type}:${input.specifier}${input.containingFilePath ? ` (${toRelative(input.containingFilePath)})` : ''}`;
