8000 fix: resolve libraries from cwd and nuxt rootDir · romhml/compodium@2de1db2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2de1db2

Browse files
committed
fix: resolve libraries from cwd and nuxt rootDir
1 parent 6e7c15c commit 2de1db2

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎meta/lib/base.cts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { TypeScriptProjectHost } from '@volar/typescript'
22
import { createLanguageServiceHost, resolveFileLanguageId } from '@volar/typescript'
33
import * as vue from '@vue/language-core'
4-
import path from 'node:path'
4+
import path from 'pathe'
55
import type ts from 'typescript'
66
import { code as typeHelpersCode } from 'vue-component-type-helpers'
77
import { code as vue2TypeHelpersCode } from 'vue-component-type-helpers/vue2'

‎src/runtime/libs/index.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { existsSync, readFileSync } from 'node:fs'
33
import type { NuxtOptions } from '@nuxt/schema'
44
import type { Resolver } from '@nuxt/kit'
55
import { satisfies } from 'semver'
6+
import { resolve } from 'pathe'
67

78
export const buildLibraryCollections = (options: NuxtOptions) => [
89
{
@@ -29,7 +30,8 @@ export async function getLibraryCollections(options: NuxtOptions, appResolver: R
2930
if (process.env.COMPODIUM_TEST === 'true') return supportedCollections
3031

3132
for (const collection of supportedCollections) {
32-
const packagePath = appResolver.resolve(`node_modules/${collection.path}/package.json`)
33+
const appPath = appResolver.resolve(`node_modules/${collection.path}/package.json`)
34+
const packagePath = existsSync(appPath) ? appPath : resolve(`node_modules/${collection.path}/package.json`)
3335
if (existsSync(packagePath)) {
3436
const pkg = JSON.parse(readFileSync(packagePath).toString())
3537

0 commit comments

Comments
 (0)
0