import{isAbsolute as e}from"node:path";import"../../postcss/lib/postcss.mjs";import s from"./descriptionlessDisables.mjs";import t from"./getConfigForFile.mjs";import o from"./getPostcssResult.mjs";import i from"./invalidScopeDisables.mjs";import r from"./isPathIgnored.mjs";import a from"./utils/isPathNotFoundError.mjs";import n from"./lintPostcssResult.mjs";import l from"./needlessDisables.mjs";import m from"./reportDisables.mjs";import c from"./unscopedDisables.mjs";import f from"../../../_virtual/postcss2.mjs";async function u(f,u={}){if(!u.filePath&&void 0===u.code&&!u.existingPostcssResult)return Promise.reject(new Error("You must provide filePath, code, or existingPostcssResult"));const p=void 0!==u.code,h=p?u.codeFilename:u.filePath;if(void 0!==h&&!e(h))return p?Promise.reject(new Error("codeFilename must be an absolute path")):Promise.reject(new Error("filePath must be an absolute path"));if(await r(f,h).catch(e=>{if(p&&a(e))return!1;throw e}))return d(h,u.existingPostcssResult);const g=await t({stylelint:f,searchPath:h,filePath:h});if(!g)return Promise.reject(new Error("Config file not found"));const P=g.config,j=u.existingPostcssResult;if(u.cache&&(f._fileCache.calcHashOfConfig(P),u.filePath&&!f._fileCache.hasFileChanged(u.filePath)))return d(h,j);const b=j||await o(f,{code:u.code,codeFilename:u.codeFilename,filePath:h,customSyntax:P.customSyntax}),w=Object.assign(b,{stylelint:{ruleSeverities:{},customMessages:{},customUrls:{},ruleMetadata:{},fixersData:{},rangesOfComputedEditInfos:[],disabledRanges:{}}});return await n(f._options,w,P),m(w),l(w),i(w),s(w),c(w),w}function d(e,s){return Object.assign(s??f().process("",{from:e}).sync(),{stylelint:{ruleSeverities:{},customMessages:{},customUrls:{},ruleMetadata:{},fixersData:{},rangesOfComputedEditInfos:[],disabledRanges:{},ignored:!0,stylelintError:!1,stylelintWarning:!1}})}export{u as default};