//#region src/vite/start-compiler-plugin/module-specifier.ts
function createViteDevServerFnModuleSpecifierEncoder(root) {
	const rootWithTrailingSlash = root.endsWith("/") ? root : `${root}/`;
	return ({ extractedFilename }) => {
		let file = extractedFilename;
		if (file.startsWith(rootWithTrailingSlash)) file = file.slice(rootWithTrailingSlash.length);
		return `/@id/${file}`;
	};
}
function decodeViteDevServerModuleSpecifier(moduleSpecifier) {
	let sourceFile = moduleSpecifier;
	if (sourceFile.startsWith("/@id/")) sourceFile = sourceFile.slice(5);
	const queryIndex = sourceFile.indexOf("?");
	return queryIndex === -1 ? sourceFile : sourceFile.slice(0, queryIndex);
}
//#endregion
export { createViteDevServerFnModuleSpecifierEncoder, decodeViteDevServerModuleSpecifier };

//# sourceMappingURL=module-specifier.js.map