Home

tailwind-ctp-intellisense @6aabc3d9a5cdf46d7347c1d7e9228fa26a00bc1e - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tailwind-ctp-intellisense / src / util / resolveFrom.ts
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import * as fs from 'fs'
import { CachedInputFileSystem, ResolverFactory, Resolver, ResolveOptions } from 'enhanced-resolve'

function createResolver(options: Partial<ResolveOptions> = {}): Resolver {
  return ResolverFactory.createResolver({
    fileSystem: new CachedInputFileSystem(fs, 4000),
    useSyncFileSystemCalls: true,
    // cachePredicate: () => false,
    exportsFields: [],
    conditionNames: ['node'],
    extensions: ['.js', '.json', '.node'],
    ...options,
  })
}

let resolver = createResolver()

export function setPnpApi(pnpApi: any): void {
  resolver = createResolver({ pnpApi })
}

export default function resolveFrom(from?: string, id?: string): string {
  let result = resolver.resolveSync({}, from, id)
  if (result === false) throw Error()
  return result
}