fix: update vite-plugin-scope-tailwind patch

This commit is contained in:
Derrick Hammer 2023-10-09 13:24:29 -04:00
parent e51a0a3483
commit dcc1428743
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 115 additions and 0 deletions

View File

@ -1,3 +1,118 @@
diff --git a/node_modules/vite-plugin-scope-tailwind/dist/cjs/index.cjs b/node_modules/vite-plugin-scope-tailwind/dist/cjs/index.cjs
index 0e337b0..495546b 100644
--- a/node_modules/vite-plugin-scope-tailwind/dist/cjs/index.cjs
+++ b/node_modules/vite-plugin-scope-tailwind/dist/cjs/index.cjs
@@ -1,2 +1,109 @@
-"use strict";const p=require("path");function j(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function w(e){if(e.__esModule)return e;var r=e.default;if(typeof r=="function"){var t=function n(){return this instanceof n?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};t.prototype=r.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),t}function h(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var c={exports:{}};const v={},q=Object.freeze(Object.defineProperty({__proto__:null,default:v},Symbol.toStringTag,{value:"Module"})),b=w(q);var m=typeof process<"u"&&process.pid?process.pid.toString(36):"",y="";if(typeof __webpack_require__!="function"&&typeof h<"u"){var f="",d=b;if(d.networkInterfaces)var l=d.networkInterfaces();if(l){e:for(let e in l){const r=l[e],t=r.length;for(var i=0;i<t;i++)if(r[i]!==void 0&&r[i].mac&&r[i].mac!="00:00:00:00:00:00"){f=r[i].mac;break e}}y=f?parseInt(f.replace(/\:|\D+/gi,"")).toString(36):""}}c.exports=c.exports.default=function(e,r){return(e||"")+y+m+u().toString(36)+(r||"")};c.exports.process=function(e,r){return(e||"")+m+u().toString(36)+(r||"")};c.exports.time=function(e,r){return(e||"")+u().toString(36)+(r||"")};function u(){var e=Date.now(),r=u.last||e;return u.last=e>r?e:r+1}var x=c.exports;const P=j(x),O=()=>{try{return require(p.join(process.cwd(),"postcss.config.js"))}catch{}try{return require(p.join(process.cwd(),"postcss.config.cjs"))}catch{}try{return require(p.join(process.cwd(),"postcss.config.json"))}catch{}return{plugins:{tailwindcss:{},autoprefixer:{}}}},R=e=>Object.keys(e.plugins);function E(e,r){return r?(e=e.trim(),r instanceof RegExp?r.exec(e):Array.isArray(r)?r.some(t=>t instanceof RegExp?t.exec(e):e===t):e===r):!1}const S=({prefix:e,ignore:r})=>({postcssPlugin:"prefix-tailwind-classes",Root(t){t.walkRules(n=>{if(!n.selectors)return!1;n.selectors=n.selectors.map(o=>{if(o.indexOf(".")!==0)return o;var a=o.split(".");return a.map(s=>E(s,r)||s.trim().length===0?s:e+s).join(".")})})}}),$=e=>r=>{const t=/className/g;return r.match(t)?r.replace(/className: "/g,`className: "${e} `):r},k=e=>r=>{const t=/class/g;return r.match(t)?r.replace(/class: "/g,`class: "${e} `):r},g=P("d"),D=({react:e=!1,ignore:r=[]}={})=>({name:"vite-plugin-scope-tailwind",config:t=>{var a,s;const n=((s=(a=t.css)==null?void 0:a.postcss)==null?void 0:s.plugins)??[],o=O();return{css:{postcss:{plugins:[...n,...R(o).map(_=>require(p.join(process.cwd(),"node_modules",_))),S({prefix:`${g}.`,ignore:r})]}}}},transform:e?$(g):k(g)});module.exports=D;
+'use strict'
+const p = require('path')
+
+function j (e) {return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, 'default') ? e.default : e}
+
+function w (e) {
+ if (e.__esModule) return e
+ var r = e.default
+ if (typeof r == 'function') {
+ var t = function n () {return this instanceof n ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments)}
+ t.prototype = r.prototype
+ } else t = {}
+ return Object.defineProperty(t, '__esModule', { value: !0 }), Object.keys(e).forEach(function (n) {
+ var o = Object.getOwnPropertyDescriptor(e, n)
+ Object.defineProperty(t, n, o.get ? o : { enumerable: !0, get: function () {return e[n]} })
+ }), t
+}
+
+function h (e) {throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}
+
+var c = { exports: {} }
+const v = {},
+ q = Object.freeze(Object.defineProperty({ __proto__: null, default: v }, Symbol.toStringTag, { value: 'Module' })),
+ b = w(q)
+var m = typeof process < 'u' && process.pid ? process.pid.toString(36) : '', y = ''
+if (typeof __webpack_require__ != 'function' && typeof h < 'u') {
+ var f = '', d = b
+ if (d.networkInterfaces) var l = d.networkInterfaces()
+ if (l) {
+ e:for (let e in l) {
+ const r = l[e], t = r.length
+ for (var i = 0; i < t; i++) if (r[i] !== void 0 && r[i].mac && r[i].mac != '00:00:00:00:00:00') {
+ f = r[i].mac
+ break e
+ }
+ }
+ y = f ? parseInt(f.replace(/\:|\D+/gi, '')).toString(36) : ''
+ }
+}
+c.exports = c.exports.default = function (e, r) {return (e || '') + y + m + u().toString(36) + (r || '')}
+c.exports.process = function (e, r) {return (e || '') + m + u().toString(36) + (r || '')}
+c.exports.time = function (e, r) {return (e || '') + u().toString(36) + (r || '')}
+
+function u () {
+ var e = Date.now(), r = u.last || e
+ return u.last = e > r ? e : r + 1
+}
+
+var x = c.exports
+const P = j(x), O = () => {
+ try {return require(p.join(process.cwd(), 'postcss.config.js'))} catch {}
+ try {return require(p.join(process.cwd(), 'postcss.config.cjs'))} catch {}
+ try {return require(p.join(process.cwd(), 'postcss.config.json'))} catch {}
+ return { plugins: { tailwindcss: {}, autoprefixer: {} } }
+}, R = e => Object.keys(e.plugins)
+
+function E (e, r) {return r ? (e = e.trim(), r instanceof RegExp ? r.exec(e) : Array.isArray(r) ? r.some(t => t instanceof RegExp ? t.exec(e) : e === t) : e === r) : !1}
+
+const S = ({ prefix: e, ignore: r }) => ({
+ postcssPlugin: 'prefix-tailwind-classes',
+ Root (t) {
+ t.walkRules(n => {
+ if (!n.selectors) return !1
+ n.selectors = n.selectors.map(o => {
+ if (o.indexOf('.') !== 0) return o
+ var a = o.split('.')
+ return a.map(s => E(s, r) || s.trim().length === 0 ? s : e + s).join('.')
+ })
+ })
+ }
+}), $ = (e,modifiers) => r => {
+ let modifiedCode = r;
+ const classNameRegex = /className/g;
+ const foundClassName = modifiedCode.match(classNameRegex);
+ if (foundClassName) {
+ modifiedCode = modifiedCode.replace(/className: "/g, `className: "${e} `);
+ }
+ if (modifiers != null) {
+ modifiers.forEach(modifier => {
+ const regex = new RegExp(`className: ${modifier}\\(([^)]*)\\)`, 'g');
+ const replacement = `className: "${e} " + ${modifier}($1)`;
+ const found = modifiedCode.match(regex);
+ if (found) {
+ modifiedCode = modifiedCode.replace(regex, replacement);
+ }
+ });
+ }
+ return modifiedCode;
+}, k = e => r => {
+ const t = /class/g
+ return r.match(t) ? r.replace(/class: "/g, `class: "${e} `) : r
+}, g = P('d'), D = ({ react: e = !1, ignore: r = [], classNameTransformers = [] } = {}) => ({
+ name: 'vite-plugin-scope-tailwind', config: t => {
+ var a, s
+ const n = ((s = (a = t.css) == null ? void 0 : a.postcss) == null ? void 0 : s.plugins) ?? [], o = O()
+ return {
+ css: {
+ postcss: {
+ plugins: [...n, ...R(o).map(_ => require(p.join(process.cwd(), 'node_modules', _))), S({
+ prefix: `${g}.`,
+ ignore: r
+ })]
+ }
+ }
+ }
+ }, transform: e ? $(g, classNameTransformers) : k(g)
+})
+module.exports = D
//# sourceMappingURL=index.cjs.map
diff --git a/node_modules/vite-plugin-scope-tailwind/dist/es/index.mjs b/node_modules/vite-plugin-scope-tailwind/dist/es/index.mjs
index 9594d38..824fafe 100644
--- a/node_modules/vite-plugin-scope-tailwind/dist/es/index.mjs