epiphany/node_modules/stylelint-declaration-strict-value/dist/index.js

3 lines
5.5 KiB
JavaScript
Raw Normal View History

2023-12-09 22:48:07 -08:00
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var n=e(require("stylelint")),t=e(require("shortcss")),r=e(require("shortcss/lib/list")),o=e(require("css-values")),s=e(require("path"));const i="scale-unlimited/declaration-strict-value",a=(e,n)=>"object"==typeof e&&Object.hasOwnProperty.call(e,n),l={ignoreVariables:!0,ignoreFunctions:!0,ignoreKeywords:null,ignoreValues:null,expandShorthand:!1,recurseLonghand:!1,severity:"error",message:void 0,disableFix:!1,autoFixFunc:null};function u(e){const n=typeof e;return"string"===n||"number"===n}function c(e){return u(e)||Array.isArray(e)&&e.every(e=>u(e))}function f(e){return!("object"!=typeof e||!e)&&Object.keys(e).every(n=>c(e[n]))}function p(e){return!("object"!=typeof e||!e)&&Object.keys(e).every(n=>"boolean"==typeof e[n])}function g(e){if("object"!=typeof e)return!1;const n=Object.keys(l);return!(!Object.keys(e).every(e=>n.indexOf(e)>-1)||"ignoreVariables"in e&&"boolean"!=typeof e.ignoreVariables&&!p(e.ignoreVariables)&&null!==e.ignoreVariables||"ignoreFunctions"in e&&"boolean"!=typeof e.ignoreFunctions&&!p(e.ignoreFunctions)&&null!==e.ignoreFunctions||"severity"in e&&"string"!=typeof e.severity&&null!==e.severity||"ignoreKeywords"in e&&!c(e.ignoreKeywords)&&!f(e.ignoreKeywords)||"ignoreValues"in e&&!c(e.ignoreValues)&&!f(e.ignoreValues)||"expandShorthand"in e&&"boolean"!=typeof e.expandShorthand&&null!==e.expandShorthand||"recurseLonghand"in e&&"boolean"!=typeof e.recurseLonghand&&null!==e.recurseLonghand||"message"in e&&"string"!=typeof e.message&&null!==e.message||"disableFix"in e&&"boolean"!=typeof e.disableFix&&null!==e.disableFix||"autoFixFunc"in e&&"function"!=typeof e.autoFixFunc&&"string"!=typeof e.autoFixFunc&&null!==e.autoFixFunc)}function y(e){let n;if(Array.isArray(e)){const t=e.pop();n=e.length?`${e.join(", ")} or ${t}`:t}else n=e;return n}function d(e,n){return"boolean"==typeof e?e:"object"==typeof e&&e&&{}.hasOwnProperty.call(e,n)?e[n]:!!e}function x(e,n){if(!e)return null;let t=e;return a(t,n)?t=t[n]:a(t,"")&&(t=t[""]),Array.isArray(t)?t:[t]}function h(e,n){if(!e)return null;let t=e;return a(t,n)?t=t[n]:a(t,"")&&(t=t[""]),Array.isArray(t)?t:[t]}const{utils:b}=n,F=b.ruleMessages(i,{expected:function(e,n,t){return`Expected ${e} for "${n}" of "${t}"`},customExpected:function(e,n,t,r){return r.replace("${types}",e).replace("${value}",n).replace("${property}",t)},failedToFix:function(e,n,t){return e&&("string"==typeof e||e instanceof Error)?"string"==typeof e?e:e.message:`Property "${t}" with value "${n}" can't be autofixed`}}),m=/^(?:@|\$|--).+$/,v=/^-?(?:@.+|(?:(?:[a-zA-Z_-]|[^\x20-\x7F])+(?:[a-zA-Z0-9_-]|[^\x20-\x7F])*\.)?\$.+|var\(\s*--[\s\S]+\))$/,w=/^(?!var\(\s*--)[\s\S]+\([\s\S]*\)$/,$=/^\/(.*)\/([a-zA-Z]*)$/,j=/color/,V=e=>$.test(e),A=e=>{const[n,t]=(e=>e.match($).slice(1))(e);return new RegExp(n,t)},E=e=>V(""+e)?A(""+e):new RegExp(`^${e}$`),O=(e,n,a={})=>(u,f)=>{if(f&&f.stylelint&&f.stylelint.customMessages&&f.stylelint.customMessages[i]&&delete f.stylelint.customMessages[i],!b.validateOptions(f,i,{actual:e,possible:c},{actual:n,possible:g,optional:!0}))return;Array.isArray(e)||(e=[e]);const p={...l,...n},{ignoreVariables:$,ignoreFunctions:O,ignoreKeywords:k,ignoreValues:S,message:q,disableFix:K,autoFixFunc:R,expandShorthand:L,recurseLonghand:N}=p,P=function(e,n,t){if("function"==typeof e)return e;if("string"==typeof e){let n;try{n=require.resolve(e)}catch(t){n=require.resolve(s.join(process.cwd(),e))}return require(n)}return!n&&t&&console.warn(`No \`autoFix\` function provided, consider using \`disableFix\` for "${i}"`),null}(R,K,a.fix),M=k?{}:null,z=S?{}:null;let Z;if($){const e=[];u.walkAtRules("value",n=>{const{params:t}=n,r=t.split(":")[0].trim();e.push(r)}),Z=new RegExp(`^-?(:?${e.join("|")})$`)}e.forEach(e=>{let n=e;function s(n,t,r,s=!1){const{value:l,prop:c}=n,g=r||l;let m=!1,V=!1,A=!1,R=!1;if($&&d($,e)&&(m=v.test(g)||Z.test(g)),O&&!m&&d(O,e)&&(V=w.test(g)),s&&(!$||$&&!m)&&(!O||O&&!V)&&!0!==((e,n)=>j.test(e)&&"transparent"===n||v.test(n)||w.test(n)||o(e,n))(t,r))return!1;if(k&&(!m||!V)){let n=M[e];if(!n){const t=x(k,e);t&&
//# sourceMappingURL=index.js.map