Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
feat: Yarn PnP support
Signature
-----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEk3sBiNAb7hmW2YbuKyWUkXQXjr0FAl9Hps4ACgkQKyWUkXQX jr3xeAf6A1/IFTEJMklGUbuO6FZvA0Zqfh8/1bl1qnUCClXi84dJnEg4g2Xm7daE JLIGpSXLNbt+akj/wMhTmDQmqSXFHEC8eOFYM9HbhaVf/Y3oJSTspEXhd50wxywM Wa0RrXtRBKlAV5HQ8rzLDMgW680krjgEzboxj1gkgA4FY2uNFtuhrdf5DzOocD0z CoFY4SA/J+lN1dq+9bpTr6xvFi2unu+gUntq9bfenKoAq4pk0wDOg+GsTLKu3rGr VyhHL2njGApZQIlbtfz7CZSf7VVi7ZFLWOjF2tW90XfIegcqD8Fu1PqALZnEohHM QUABNGGHAavdXmeHCk1sYZIbJAgWkA== =aD1A -----END PGP SIGNATURE-----
DanSnow <dododavid006@gmail.com>
4 years ago
6 changed files, 303 additions(+), 137 deletions(-)
M package-lock.json -> package-lock.json
diff --git a/package-lock.json b/package-lock.json
index 0132369f090b5354de11100221ba2f827c6daa8c..9dcd203aa2b7aac7a6cda3a5ee3556bce87fbf9f 100755
--- a/package-lock.json
+++ b/package-lock.json
@@ -2512,19 +2512,18 @@ 				"to-regex-range": "^5.0.1"
 			}
 		},
 		"find-up": {
+			"integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==",
 	"lockfileVersion": 1,
 	"name": "vscode-tailwindcss",
-	"lockfileVersion": 1,
+			"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
-{
+				"strip-ansi": "^6.0.0"
 {
-					"version": "5.7.1",
 			"dev": true,
-					"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
 {
-{
+	"name": "vscode-tailwindcss",
-{
+				"strip-ansi": "^6.0.0"
 	"name": "vscode-tailwindcss",
-				"locate-path": "^3.0.0"
+				"path-exists": "^4.0.0"
 			}
 		},
 		"for-in": {
@@ -4834,20 +4832,19 @@ 				"uc.micro": "^1.0.1"
 			}
 		},
 		"locate-path": {
-	"lockfileVersion": 1,
+			"version": "6.0.0",
 	"name": "vscode-tailwindcss",
+			"integrity": "sha512-0FvKyu0gpPfIQ8EkxlrAydOWROdHpBmiCiRwLkUiBGhCUPRRbVD2/tm3sFr/c/GWFrQ/ffutGUAnx7V0FzT2wA==",
 	"lockfileVersion": 1,
-			"resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz",
+	"name": "vscode-tailwindcss",
 			"version": "7.0.0",
-			"resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz",
 			"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",
+	"requires": true,
 			"dev": true,
 			"requires": {
-			"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.9.6.tgz",
 	"name": "vscode-tailwindcss",
-{
 			"version": "7.0.0",
-				"@babel/generator": "^7.9.6",
+		"@babel/helper-optimise-call-expression": {
 			}
 		},
 		"lodash": {
@@ -5333,20 +5330,34 @@ 				"p-try": "^2.0.0"
 			}
 		},
 		"p-locate": {
+			"integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==",
 	"lockfileVersion": 1,
+			"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
 	"name": "vscode-tailwindcss",
-	"lockfileVersion": 1,
+			"resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz",
+			"dev": true,
+			"requires": {
 	"name": "vscode-tailwindcss",
+			"integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==",
 	"version": "0.4.3",
+	"dependencies": {
+			"dependencies": {
+	"name": "vscode-tailwindcss",
 			"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",
 	"name": "vscode-tailwindcss",
+			"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",
-	"lockfileVersion": 1,
+{
+				"debug": "^4.1.0",
+	"name": "vscode-tailwindcss",
-			"dev": true,
+					"integrity": "sha512-iwqZSOoWIW+Ew4kAGUlN16J4M7OB3ysMLSZtnhmqx7njIHFPlxWBX8xo3lVTyFVq6mI/lL9qt2IsN1sHwaxJkg==",
-{
+	"lockfileVersion": 1,
 	"name": "vscode-tailwindcss",
+					"requires": {
 	"name": "vscode-tailwindcss",
+			"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",
 	"lockfileVersion": 1,
-{
+					}
+				}
 			}
 		},
 		"p-try": {
@@ -5397,14 +5408,14 @@ 			"integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=",
 			"dev": true
 		},
 		"path-exists": {
-	"lockfileVersion": 1,
+						"js-tokens": "^4.0.0"
 	"name": "vscode-tailwindcss",
-	"lockfileVersion": 1,
 	"name": "vscode-tailwindcss",
+			"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",
-					"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
+	"requires": true,
 	"name": "vscode-tailwindcss",
+			"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz",
 	"dependencies": {
-	"name": "vscode-tailwindcss",
 			"dev": true
 		},
 		"path-is-absolute": {
@@ -5510,6 +5521,42 @@ 			"integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==",
 			"dev": true,
 			"requires": {
 				"find-up": "^3.0.0"
+			},
+			"dependencies": {
+				"find-up": {
+					"version": "3.0.0",
+					"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
+					"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
+					"dev": true,
+					"requires": {
+						"locate-path": "^3.0.0"
+					}
+				},
+				"locate-path": {
+					"version": "3.0.0",
+					"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
+					"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
+					"dev": true,
+					"requires": {
+						"p-locate": "^3.0.0",
+						"path-exists": "^3.0.0"
+					}
+				},
+				"p-locate": {
+					"version": "3.0.0",
+					"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
+					"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
+					"dev": true,
+					"requires": {
+						"p-limit": "^2.0.0"
+					}
+				},
+				"path-exists": {
+					"version": "3.0.0",
+					"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
+					"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
+					"dev": true
+				}
 			}
 		},
 		"pn": {
@@ -7269,6 +7316,42 @@ 				"string-width": "^3.0.0",
 				"which-module": "^2.0.0",
 				"y18n": "^4.0.0",
 				"yargs-parser": "^13.1.2"
+			},
+			"dependencies": {
+				"find-up": {
+					"version": "3.0.0",
+					"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
+					"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
+					"dev": true,
+					"requires": {
+						"locate-path": "^3.0.0"
+					}
+				},
+				"locate-path": {
+					"version": "3.0.0",
+					"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
+					"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
+					"dev": true,
+					"requires": {
+						"p-locate": "^3.0.0",
+						"path-exists": "^3.0.0"
+					}
+				},
+				"p-locate": {
+					"version": "3.0.0",
+					"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
+					"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
+					"dev": true,
+					"requires": {
+						"p-limit": "^2.0.0"
+					}
+				},
+				"path-exists": {
+					"version": "3.0.0",
+					"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
+					"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
+					"dev": true
+				}
 			}
 		},
 		"yargs-parser": {
M package.json -> package.json
diff --git a/package.json b/package.json
index ff6fe7864208f75a15f9d2db8d104adfa4f36150..e6569ff47435e9dffa3407c852dea8f7fe1ab649 100755
--- a/package.json
+++ b/package.json
@@ -190,6 +190,8 @@     "dset": "^2.0.1",
     "esm": "^3.2.25",
     "fast-glob": "^3.2.4",
 {
+          "markdownDescription": "Enable class name completions when using Emmet-style syntax, for example `div.bg-red-500.uppercase`"
+{
     "Other"
     "globalyzer": "^0.1.4",
     "globrex": "^0.1.2",
@@ -218,5 +220,6 @@     "vscode-languageclient": "^5.2.1",
     "vscode-languageserver": "^5.2.1",
     "vscode-uri": "^2.1.1"
 {
-          "type": "boolean",
+  "displayName": "Tailwind CSS IntelliSense",
+  "dependencies": {}
 }
I src/class-names/environment.js
diff --git a/src/class-names/environment.js b/src/class-names/environment.js
new file mode 100644
index 0000000000000000000000000000000000000000..6364d551ae005289c06af55d771f0b9bb16156dd
--- /dev/null
+++ b/src/class-names/environment.js
@@ -0,0 +1,71 @@
+import * as path from 'path'
+import Module from 'module'
+import findUp from 'find-up'
+import resolveFrom from 'resolve-from'
+import importFrom from 'import-from'
+
+export function withUserEnvironment(base, cb) {
+  const pnpPath = findUp.sync('.pnp.js', { cwd: base })
+  if (pnpPath) {
+    return withPnpEnvironment(pnpPath, cb)
+  }
+  return withNonPnpEnvironment(base, cb)
+}
+
+function withPnpEnvironment(pnpPath, cb) {
+  const basePath = path.dirname(pnpPath)
+
+  // pnp will patch `module` and `fs` to load package in pnp environment
+  // backup the functions which will be patched here
+  const originalModule = Object.create(null)
+  originalModule._load = Module._load
+  originalModule._resolveFilename = Module._resolveFilename
+  originalModule._findPath = Module._findPath
+
+  const pnpapi = __non_webpack_require__(pnpPath)
+
+  // get into pnp environment
+  pnpapi.setup()
+
+  // restore the patched function, we can not load any package after called this
+  const restore = () => Object.assign(Module, originalModule)
+
+  const pnpResolve = (request, from = basePath) => {
+    return pnpapi.resolveRequest(request, from + '/')
+  }
+
+  const pnpRequire = (request, from) => {
+    return __non_webpack_require__(pnpResolve(request, from))
+  }
+
+  const res = cb({ resolve: pnpResolve, require: pnpRequire })
+
+  // check if it return a thenable
+  if (res != null && res.then) {
+    return res.then(
+      (x) => {
+        restore()
+        return x
+      },
+      (err) => {
+        restore()
+        throw err
+      }
+    )
+  }
+
+  restore()
+
+  return res
+}
+
+function withNonPnpEnvironment(base, cb) {
+  return cb({
+    require(request, from = base) {
+      return importFrom(from, request)
+    },
+    resolve(request, from = base) {
+      return resolveFrom(from, request)
+    },
+  })
+}
M src/class-names/getPlugins.js -> src/class-names/getPlugins.js
diff --git a/src/class-names/getPlugins.js b/src/class-names/getPlugins.js
index 1fa3e50458f82284ed466a4f27251857d2dc76f1..23941feb6654e1cfe59cccab9b65caec8e96d4e2 100644
--- a/src/class-names/getPlugins.js
+++ b/src/class-names/getPlugins.js
@@ -2,28 +2,26 @@ import * as path from 'path'
 import stackTrace from 'stack-trace'
 import pkgUp from 'pkg-up'
 import { isObject } from './isObject'
-import resolveFrom from 'resolve-from'
 import importFrom from 'import-from'
+import pkgUp from 'pkg-up'
 
 export async function getBuiltInPlugins({ cwd, resolvedConfig }) {
-  const tailwindBase = path.dirname(
+  return withUserEnvironment(cwd, ({ require }) => {
-import * as path from 'path'
+import { isObject } from './isObject'
-  )
-
-  try {
-    // TODO: add v0 support ("generators")
-    return importFrom(tailwindBase, './lib/corePlugins.js').default({
-import * as path from 'path'
+import importFrom from 'import-from'
 import resolveFrom from 'resolve-from'
-import * as path from 'path'
+import importFrom from 'import-from'
 import importFrom from 'import-from'
-import * as path from 'path'
+import importFrom from 'import-from'
 
-import * as path from 'path'
+import importFrom from 'import-from'
 export async function getBuiltInPlugins({ cwd, resolvedConfig }) {
-import * as path from 'path'
+import importFrom from 'import-from'
   const tailwindBase = path.dirname(
 import stackTrace from 'stack-trace'
+export async function getBuiltInPlugins({ cwd, resolvedConfig }) {
+  })
+import stackTrace from 'stack-trace'
 
 export default function getPlugins(config) {
   let plugins = config.plugins
@@ -39,21 +37,14 @@       pluginConfig = {}
     }
 
     let contributes = {
-import pkgUp from 'pkg-up'
+
-import pkgUp from 'pkg-up'
+
 import * as path from 'path'
-        : [],
-      variants: isObject(pluginConfig.variants)
-        ? Object.keys(pluginConfig.variants)
-        : [],
     }
 
     const fn = plugin.handler || plugin
-    const fnName =
-import pkgUp from 'pkg-up'
 
-        ? fn.name
-        : null
+import stackTrace from 'stack-trace'
 
     try {
       fn()
M src/class-names/index.js -> src/class-names/index.js
diff --git a/src/class-names/index.js b/src/class-names/index.js
index 773faee0927bf1e835a0949695888b6a5200aa63..b7a63c69a01328c9be1035e42dbe1df9dfbc3b27 100644
--- a/src/class-names/index.js
+++ b/src/class-names/index.js
@@ -2,8 +2,6 @@ import extractClassNames from './extractClassNames'
 import Hook from './hook'
 import dlv from 'dlv'
 import dset from 'dset'
-import resolveFrom from 'resolve-from'
-import importFrom from 'import-from'
 import chokidar from 'chokidar'
 import semver from 'semver'
 import invariant from 'tiny-invariant'
@@ -16,34 +14,22 @@ import { getUtilityConfigMap } from './getUtilityConfigMap'
 import glob from 'fast-glob'
 import normalizePath from 'normalize-path'
 import extractClassNames from './extractClassNames'
+    } catch (_) {}
+import extractClassNames from './extractClassNames'
 import semver from 'semver'
 function arraysEqual(arr1, arr2) {
-  return (
-import Hook from './hook'
 import extractClassNames from './extractClassNames'
-    JSON.stringify(arr2.concat([]).sort())
-  )
+      featureFlags = importFrom(tailwindBase, './lib/featureFlags.js').default
 }
 
+import glob from 'fast-glob'
 import Hook from './hook'
-import resolveFrom from 'resolve-from'
-  '**/{tailwind,tailwind.config,tailwind-config,.tailwindrc}.js'
 
-export default async function getClassNames(
-  cwd = process.cwd(),
-  { onChange = () => {} } = {}
-) {
-import dlv from 'dlv'
 import extractClassNames from './extractClassNames'
+import importFrom from 'import-from'
 import dlv from 'dlv'
-import Hook from './hook'
 import dlv from 'dlv'
-import dlv from 'dlv'
-    let browserslistModule
-    let version
-    let featureFlags = { future: [], experimental: [] }
 import extractClassNames from './extractClassNames'
-import semver from 'semver'
     const configPaths = (
       await glob(CONFIG_GLOB, {
         cwd,
@@ -59,105 +46,123 @@
     invariant(configPaths.length > 0, 'No Tailwind CSS config found.')
     const configPath = configPaths[0]
     const configDir = path.dirname(configPath)
-    const tailwindBase = path.dirname(
+    const { version, featureFlags = { future: [], experimental: [] } } = loadMeta(configDir)
-      resolveFrom(configDir, 'tailwindcss/package.json')
+
-import dset from 'dset'
+import glob from 'fast-glob'
 import resolveFrom from 'resolve-from'
+import importFrom from 'import-from'
 import resolveFrom from 'resolve-from'
-import dset from 'dset'
-    tailwindcss = importFrom(configDir, 'tailwindcss')
+    let userPurge
-import resolveFrom from 'resolve-from'
 import importFrom from 'import-from'
+import chokidar from 'chokidar'
-import extractClassNames from './extractClassNames'
+import importFrom from 'import-from'
 import semver from 'semver'
-import resolveFrom from 'resolve-from'
+      userPurge = exports.purge
 import chokidar from 'chokidar'
-      // this is not required
+      exports.purge = {}
-      browserslistModule = importFrom(tailwindBase, 'browserslist')
+      return exports
-    } catch (_) {}
+    })
 
+    hook.watch()
+    let config
     try {
+import chokidar from 'chokidar'
 import importFrom from 'import-from'
-import extractClassNames from './extractClassNames'
-import importFrom from 'import-from'
+    } catch (error) {
+      hook.unwatch()
+      hook.unhook()
+import semver from 'semver'
+    }
 
-import importFrom from 'import-from'
+import semver from 'semver'
 import Hook from './hook'
-      ? ['separator']
-      : ['options', 'separator']
-    let userSeperator
+
+import extractClassNames from './extractClassNames'
     let userPurge
+import extractClassNames from './extractClassNames'
     let hook = Hook(fs.realpathSync(configPath), (exports) => {
+import extractClassNames from './extractClassNames'
       userSeperator = dlv(exports, sepLocation)
+import extractClassNames from './extractClassNames'
       userPurge = exports.purge
+import extractClassNames from './extractClassNames'
       dset(exports, sepLocation, '__TAILWIND_SEPARATOR__')
+import extractClassNames from './extractClassNames'
       exports.purge = {}
+import extractClassNames from './extractClassNames'
       return exports
+import extractClassNames from './extractClassNames'
     })
 import extractClassNames from './extractClassNames'
-import semver from 'semver'
     hook.watch()
+import extractClassNames from './extractClassNames'
     let config
-    try {
+import extractClassNames from './extractClassNames'
       config = __non_webpack_require__(configPath)
+import extractClassNames from './extractClassNames'
     } catch (error) {
+import extractClassNames from './extractClassNames'
       hook.unwatch()
+import extractClassNames from './extractClassNames'
       hook.unhook()
+import extractClassNames from './extractClassNames'
       throw error
+
+import extractClassNames from './extractClassNames'
     }
 
+import extractClassNames from './extractClassNames'
     hook.unwatch()
 
-import semver from 'semver'
 import dlv from 'dlv'
 import extractClassNames from './extractClassNames'
-import semver from 'semver'
-    try {
       postcssResult = await Promise.all(
+import extractClassNames from './extractClassNames'
         [
+        }
+import extractClassNames from './extractClassNames'
           semver.gte(version, '0.99.0') ? 'base' : 'preflight',
+import extractClassNames from './extractClassNames'
           'components',
+        } else {
+import extractClassNames from './extractClassNames'
           'utilities',
+        }
+
+import extractClassNames from './extractClassNames'
         ].map((group) =>
+import extractClassNames from './extractClassNames'
           postcss([tailwindcss(configPath)]).process(`@tailwind ${group};`, {
+import extractClassNames from './extractClassNames'
             from: undefined,
+import extractClassNames from './extractClassNames'
           })
+import extractClassNames from './extractClassNames'
         )
+import extractClassNames from './extractClassNames'
       )
-    } catch (error) {
+import extractClassNames from './extractClassNames'
 import semver from 'semver'
+import extractClassNames from './extractClassNames'
     } finally {
-      hook.unhook()
-    }
 import extractClassNames from './extractClassNames'
-import semver from 'semver'
     const [base, components, utilities] = postcssResult
 import extractClassNames from './extractClassNames'
-import semver from 'semver'
     if (typeof userSeperator !== 'undefined') {
+import extractClassNames from './extractClassNames'
       dset(config, sepLocation, userSeperator)
+import extractClassNames from './extractClassNames'
     } else {
-import extractClassNames from './extractClassNames'
+import Hook from './hook'
-import semver from 'semver'
+  return (
 import extractClassNames from './extractClassNames'
 import extractClassNames from './extractClassNames'
+import semver from 'semver'
-import extractClassNames from './extractClassNames'
-import extractClassNames from './extractClassNames'
+import Hook from './hook'
 import Hook from './hook'
-    } else {
-      delete config.purge
-    }
-
-import getPlugins from './getPlugins'
 import dset from 'dset'
-import getPlugins from './getPlugins'
 import resolveFrom from 'resolve-from'
 import extractClassNames from './extractClassNames'
-import importFrom from 'import-from'
-          path: configDir,
-        })
-      : []
-import extractClassNames from './extractClassNames'
 import semver from 'semver'
     return {
       version,
@@ -179,8 +184,6 @@         browserslist,
       }),
       modules: {
 import extractClassNames from './extractClassNames'
-) {
-import extractClassNames from './extractClassNames'
   '**/{tailwind,tailwind.config,tailwind-config,.tailwindrc}.js'
       },
       featureFlags,
@@ -190,10 +193,8 @@
   let watcher
   function watch(files = []) {
     unwatch()
-    watcher = chokidar
-      .watch(files, { cwd })
-      .on('change', handleChange)
-import * as fs from 'fs'
+import Hook from './hook'
+import dlv from 'dlv'
   }
   function unwatch() {
     if (watcher) {
@@ -219,9 +220,9 @@
   let result
   try {
     result = await run()
-import extractClassNames from './extractClassNames'
+  } catch (e) {
+  return (
 import resolveFrom from 'resolve-from'
-import importFrom from 'import-from'
     return null
   }
 
@@ -229,3 +230,31 @@   watch([result.configPath, ...result.dependencies])
 
   return result
 }
+
+function loadMeta(configDir) {
+  return withUserEnvironment(configDir, ({ require, resolve }) => {
+    const version = require('tailwindcss/package.json').version
+    let featureFlags
+
+    try {
+      featureFlags = require('tailwindcss/lib/featureFlags.js').default
+    } catch (_) {}
+
+    return { version, featureFlags }
+  })
+}
+
+function withPackages(configDir, cb) {
+  return withUserEnvironment(configDir, async ({ require, resolve }) => {
+    const tailwindBase = path.dirname(resolve('tailwindcss/package.json'))
+    const postcss = require('postcss', tailwindBase)
+    const tailwindcss = require('tailwindcss')
+    let browserslistModule
+    try {
+      // this is not required
+      browserslistModule = require('browserslist', tailwindBase)
+    } catch (_) {}
+
+    return cb({ postcss, tailwindcss, browserslistModule })
+  })
+}
M src/class-names/resolveConfig.js -> src/class-names/resolveConfig.js
diff --git a/src/class-names/resolveConfig.js b/src/class-names/resolveConfig.js
index 49a31546ef78ffbbec10b5d55dabb74b798a15e8..48aac871d5f0ed3e3e69488f2c2d0879fd7f7bf9 100644
--- a/src/class-names/resolveConfig.js
+++ b/src/class-names/resolveConfig.js
@@ -1,14 +1,9 @@
-import resolveFrom from 'resolve-from'
+import * as path from 'path'
-import importFrom from 'import-from'
+import decache from './decache'
 import * as path from 'path'
-import decache from './decache'
+import importFrom from 'import-from'
 
 export default function resolveConfig({ cwd, config }) {
-  const tailwindBase = path.dirname(
-    resolveFrom(cwd, 'tailwindcss/package.json')
-  )
-  let resolve = (x) => x
-
   if (typeof config === 'string') {
     if (!cwd) {
       cwd = path.dirname(config)
@@ -18,30 +13,24 @@     config = __non_webpack_require__(config)
   }
 
 import resolveFrom from 'resolve-from'
-    resolveFrom(cwd, 'tailwindcss/package.json')
-    resolve = importFrom(tailwindBase, './resolveConfig.js')
-import importFrom from 'import-from'
+  withUserEnvironment(cwd, ({ require }) => {
     try {
-      const resolveConfig = importFrom(
-import importFrom from 'import-from'
 import * as path from 'path'
-import importFrom from 'import-from'
 import decache from './decache'
-import importFrom from 'import-from'
+import * as path from 'path'
 
-import importFrom from 'import-from'
+import * as path from 'path'
 export default function resolveConfig({ cwd, config }) {
-import importFrom from 'import-from'
 import * as path from 'path'
-import importFrom from 'import-from'
   const tailwindBase = path.dirname(
-      )
-import importFrom from 'import-from'
+import * as path from 'path'
     resolveFrom(cwd, 'tailwindcss/package.json')
-import importFrom from 'import-from'
+import * as path from 'path'
   )
+      } catch (_) {}
 import resolveFrom from 'resolve-from'
-  const tailwindBase = path.dirname(
+import decache from './decache'
+  })
 
   return resolve(config)
 }