3 lines
5.6 KiB
JavaScript
3 lines
5.6 KiB
JavaScript
|
import e from"stylelint";import n from"shortcss";import t from"shortcss/lib/list";import r from"css-values";import o from"path";function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}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 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]}function b(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:x}=e,m=x.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`}}),v=/^(?:@|\$|--).+$/,F=/^-?(?:@.+|(?:(?:[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/,O=e=>$.test(e),V=e=>{const[n,t]=(e=>e.match($).slice(1))(e);return new RegExp(n,t)},A=e=>O(""+e)?V(""+e):new RegExp(`^${e}$`),E=(e,a,u={})=>(f,p)=>{if(p&&p.stylelint&&p.stylelint.customMessages&&p.stylelint.customMessages[i]&&delete p.stylelint.customMessages[i],!x.validateOptions(p,i,{actual:e,possible:c},{actual:a,possible:g,optional:!0}))return;Array.isArray(e)||(e=[e]);const $=s({},l,a),{ignoreVariables:E,ignoreFunctions:k,ignoreKeywords:S,ignoreValues:K,message:R,disableFix:P,autoFixFunc:L,expandShorthand:M,recurseLonghand:N}=$,q=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(o.join(process.cwd(),e))}return require(n)}return!n&&t&&console.warn(`No \`autoFix\` function provided, consider using \`disableFix\` for "${i}"`),null}(L,P,u.fix),z=S?{}:null,Z=K?{}:null;let T;if(E){const e=[];f.walkAtRules("value",n=>{const{params:t}=n,r=t.split(":")[0].trim();e.push(r)}),T=new RegExp(`^-?(:?${e.join("|")})$`)}e.forEach(e=>{let o=e;function s(n,t,o,s=!1){const{value:a,prop:l}=n,c=o||a;let g=!1,v=!1,O=!1,V=!1;if(E&&d(E,e)&&(g=F.test(c)||T.test(c)),k&&!g&&d(k,e)&&(v=w.test(c)),s&&(!E||E&&!g)&&(!k||k
|
||
|
//# sourceMappingURL=index.modern.js.map
|