Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
simplify built-in plugin finder
Brad Cornes <brad@parall.ax>
4 years ago
2 changed files, 6 additions(+), 13 deletions(-)
M packages/tailwindcss-class-names/src/getPlugins.js -> packages/tailwindcss-class-names/src/getPlugins.js
diff --git a/packages/tailwindcss-class-names/src/getPlugins.js b/packages/tailwindcss-class-names/src/getPlugins.js
index bda9c17c4cae0b761bd88ec8b757951dc17ba1f8..725b4cc1d207400ff9021ce4e129f43166c2a281 100644
--- a/packages/tailwindcss-class-names/src/getPlugins.js
+++ b/packages/tailwindcss-class-names/src/getPlugins.js
@@ -3,21 +3,14 @@ import stackTrace from 'stack-trace'
 import pkgUp from 'pkg-up'
 import { glob } from './glob'
 import { isObject } from './isObject'
+import importFrom from 'import-from'
 
-export async function getBuiltInPlugins(cwd) {
+export async function getBuiltInPlugins({ cwd, resolvedConfig }) {
   try {
-    // TODO: just require('tailwindcss/lib/corePlugins.js') instead of globbing
     // TODO: add v0 support ("generators")
-    return (
-      await glob(path.resolve(cwd, 'node_modules/tailwindcss/lib/plugins/*.js'))
-    )
-      .map((x) => {
-        try {
-          const mod = __non_webpack_require__(x)
-          return mod.default ? mod.default() : mod()
-        } catch (_) {}
-      })
-      .filter(Boolean)
+    return importFrom(cwd, 'tailwindcss/lib/corePlugins.js').default({
+      corePlugins: resolvedConfig.corePlugins,
+    })
   } catch (_) {
     return []
   }
M packages/tailwindcss-class-names/src/getUtilityConfigMap.js -> packages/tailwindcss-class-names/src/getUtilityConfigMap.js
diff --git a/packages/tailwindcss-class-names/src/getUtilityConfigMap.js b/packages/tailwindcss-class-names/src/getUtilityConfigMap.js
index 9362feae7233af8d21f683448bb3c03626af6ac4..26ccac72f7fc948b0145c629f967147ccabe27b6 100644
--- a/packages/tailwindcss-class-names/src/getUtilityConfigMap.js
+++ b/packages/tailwindcss-class-names/src/getUtilityConfigMap.js
@@ -19,7 +19,7 @@   },
 })
 
 export async function getUtilityConfigMap({ cwd, resolvedConfig, postcss }) {
-  const builtInPlugins = await getBuiltInPlugins(cwd)
+  const builtInPlugins = await getBuiltInPlugins({ cwd, resolvedConfig })
   const userPlugins = Array.isArray(resolvedConfig.plugins)
     ? resolvedConfig.plugins
     : []