Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
Support `require.extensions` mutations (#583)
Signature
-----BEGIN PGP SIGNATURE----- wsBcBAABCAAQBQJi3ra2CRBK7hj4Ov3rIwAAFwcIAIFG+0OUsvtB7BOEf2/m3kKx NItSaKTHly6Z39RX9K/y2MFmXqYs71pGlIam7hipvxdwW6d5wSr8BXAXspe/9R6T XGrbYtrRFMpTmRvMUBYXNY42iP7QtnilTW6MZFQr+tMhOsFQZcr//+r+5FdU3Uae KkaZbMsFTlrgmlbqyoOfsufiIcrxuXmMS4SebZgRjlEKye9eFcQT4OSUSRurwS9B zgznuyMm0eOyqsjMox/BGSDYxlbnskPA0S92TKSSKEGVHBpkVd+1TZ+qL3XbEHbR SzgPEZwRzg7kWIS250CJ4UuoFRtt4FAD6aGs58yMWSDqU4E7pPfxcigeDyQ+LsI= =oOKA -----END PGP SIGNATURE-----
Brad Cornes <hello@bradley.dev>
2 years ago
1 changed files, 16 additions(+), 2 deletions(-)
M packages/tailwindcss-language-server/src/util/resolveFrom.ts -> packages/tailwindcss-language-server/src/util/resolveFrom.ts
diff --git a/packages/tailwindcss-language-server/src/util/resolveFrom.ts b/packages/tailwindcss-language-server/src/util/resolveFrom.ts
index 5c139951a22b5a7e6af15fd01cf7c2aba4d84d80..b390fd43919b28463b764e1df8060ba7b4d80a83 100644
--- a/packages/tailwindcss-language-server/src/util/resolveFrom.ts
+++ b/packages/tailwindcss-language-server/src/util/resolveFrom.ts
@@ -1,5 +1,9 @@
 import * as fs from 'fs'
 import { CachedInputFileSystem, ResolverFactory, Resolver, ResolveOptions } from 'enhanced-resolve'
+import { equal } from 'tailwindcss-language-service/src/util/array'
+
+let pnpApi: any
+let extensions = Object.keys(require.extensions)
 
 function createResolver(options: Partial<ResolveOptions> = {}): Resolver {
   return ResolverFactory.createResolver({
@@ -7,18 +11,28 @@     fileSystem: new CachedInputFileSystem(fs, 4000),
     useSyncFileSystemCalls: true,
     // cachePredicate: () => false,
     conditionNames: ['node', 'require'],
+    extensions,
+    pnpApi,
     ...options,
   })
 }
 
 let resolver = createResolver()
 
-export function setPnpApi(pnpApi: any): void {
+export function setPnpApi(newPnpApi: any): void {
+  pnpApi = newPnpApi
-  resolver = createResolver({ pnpApi })
+  resolver = createResolver()
 }
 
 export default function resolveFrom(from?: string, id?: string): string {
   if (id.startsWith('\\\\')) return id
+
+  let newExtensions = Object.keys(require.extensions)
+  if (!equal(newExtensions, extensions)) {
+    extensions = newExtensions
+    resolver = createResolver()
+  }
+
   let result = resolver.resolveSync({}, from, id)
   if (result === false) throw Error()
   // https://github.com/webpack/enhanced-resolve/issues/282