sdk/patches/vite-plugin-scope-tailwind+...

157 lines
9.3 KiB
Diff
Raw Normal View History

diff --git a/node_modules/vite-plugin-scope-tailwind/dist/cjs/index.cjs b/node_modules/vite-plugin-scope-tailwind/dist/cjs/index.cjs
2023-10-10 10:40:39 +00:00
index 0e337b0..530cd41 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
2023-10-10 10:40:39 +00:00
+}, g = P('d'), D = ({ react: e = !1, ignore: r = [], prefix, 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({
2023-10-10 10:40:39 +00:00
+ prefix: `${prefix || g}.`,
+ ignore: r
+ })]
+ }
+ }
+ }
2023-10-10 10:40:39 +00:00
+ }, transform: e ? $(prefix || g, classNameTransformers) : k(prefix || 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
2023-10-10 10:40:39 +00:00
index 9594d38..14bbb10 100644
--- a/node_modules/vite-plugin-scope-tailwind/dist/es/index.mjs
+++ b/node_modules/vite-plugin-scope-tailwind/dist/es/index.mjs
2023-10-10 10:40:39 +00:00
@@ -111,6 +111,8 @@ const S = ({
return r.match(t) ? r.replace(/class: "/g, `class: "${e} `) : r;
}, g = P("d"), M = ({
react: e = !1,
+ classNameTransformers = [],
2023-10-10 10:40:39 +00:00
+ prefix,
ignore: r = []
} = {}) => ({
name: "vite-plugin-scope-tailwind",
2023-10-10 10:40:39 +00:00
@@ -125,13 +127,13 @@ const S = ({
...R(o).map(
(_) => require(p.join(process.cwd(), "node_modules", _))
),
- S({ prefix: `${g}.`, ignore: r })
+ S({ prefix: `${prefix || g}.`, ignore: r })
]
}
}
};
},
- transform: e ? $(g) : k(g)
2023-10-10 10:40:39 +00:00
+ transform: e ? $(prefix || g, classNameTransformers) : k(prefix || g )
});
export {
M as default
2023-10-10 10:40:39 +00:00
diff --git a/node_modules/vite-plugin-scope-tailwind/dist/main.d.ts b/node_modules/vite-plugin-scope-tailwind/dist/main.d.ts
index 2b63f48..9396191 100644
--- a/node_modules/vite-plugin-scope-tailwind/dist/main.d.ts
+++ b/node_modules/vite-plugin-scope-tailwind/dist/main.d.ts
@@ -2,5 +2,7 @@ import { Plugin } from "vite";
declare const plugin: ({ react, ignore, }?: {
react?: boolean | undefined;
ignore?: RegExp | RegExp[] | undefined;
+ classNameTransformers?: string[],
+ prefix?: string
}) => Plugin;
export default plugin;