tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
diff --git a/src/server.ts b/src/server.ts
index 5f14ebdd030e6bed65ae25361c2df3a9b0078887..1651cbee9003fdfc0718343923adc92cbf9c0042 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -536,6 +536,7 @@ let userSeperator: string
let userPurge
let userVariants: any
let userMode: any
+ let userPlugins: any
let hook = new Hook(fs.realpathSync(state.configPath), (exports) => {
userSeperator = dlv(exports, sepLocation)
if (typeof userSeperator !== 'string') {
@@ -560,25 +561,33 @@ }
// inject JIT `matchUtilities` function
if (Array.isArray(exports.plugins)) {
- for (let index in exports.plugins) {
- let plugin = exports.plugins[index]
+ userPlugins = exports.plugins
+ exports.plugins = exports.plugins.map((plugin) => {
if (typeof plugin === 'function') {
- exports.plugins[index] = (...args) => {
+ let newPlugin = (...args) => {
if (!args[0].matchUtilities) {
args[0].matchUtilities = () => {}
}
return plugin(...args)
}
- } else if (plugin.handler) {
- let oldHandler = plugin.handler
- plugin.handler = (...args) => {
- if (!args[0].matchUtilities) {
- args[0].matchUtilities = () => {}
- }
- return oldHandler(...args)
+ // @ts-ignore
+ newPlugin.__intellisense_cache_bust = Math.random()
+ return newPlugin
+ }
+ if (plugin.handler) {
+ return {
+ ...plugin,
+ handler: (...args) => {
+ if (!args[0].matchUtilities) {
+ args[0].matchUtilities = () => {}
+ }
+ return plugin.handler(...args)
+ },
+ __intellisense_cache_bust: Math.random(),
}
}
- }
+ return plugin
+ })
}
return exports
@@ -639,6 +648,9 @@ delete config.variants
}
if (typeof userMode !== 'undefined') {
config.mode = userMode
+ }
+ if (typeof userPlugins !== 'undefined') {
+ config.plugins = userPlugins
}
if (state.dependencies) {