Skip to content

Commit

Permalink
deps: replace resolve with mlly (#775)
Browse files Browse the repository at this point in the history
  • Loading branch information
KermanX committed Jun 25, 2024
1 parent 3e2c889 commit 3a2555d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 27 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"local-pkg": "^0.5.0",
"magic-string": "^0.30.10",
"minimatch": "^9.0.4",
"resolve": "^1.22.8",
"mlly": "^1.7.1",
"unplugin": "^1.10.1"
},
"devDependencies": {
Expand All @@ -112,7 +112,6 @@
"@types/debug": "^4.1.12",
"@types/minimatch": "^5.1.2",
"@types/node": "^20.12.7",
"@types/resolve": "^1.20.6",
"bumpp": "^9.4.1",
"compare-versions": "^6.1.0",
"element-plus": "^2.7.2",
Expand Down
43 changes: 27 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/core/resolvers/veui.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { join, normalize } from 'node:path'
import { resolvePathSync } from 'mlly'
import type { ComponentResolver, SideEffectsInfo } from '../../types'
import { camelCase, kebabCase, pascalCase, resolveImportPath } from '../utils'
import { camelCase, kebabCase, pascalCase } from '../utils'

interface VeuiPeerConfig {
/**
Expand Down Expand Up @@ -109,7 +110,7 @@ const peerPaths = new Map<string, boolean>()
function assertPeerPath(peerPath: string) {
if (!peerPaths.has(peerPath)) {
try {
resolveImportPath(peerPath)
resolvePathSync(peerPath)
peerPaths.set(peerPath, true)
}
catch (e) {
Expand Down
7 changes: 0 additions & 7 deletions src/core/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { parse } from 'node:path'
import process from 'node:process'
import { minimatch } from 'minimatch'
import resolve from 'resolve'
import { slash, toArray } from '@antfu/utils'
import {
getPackageInfo,
Expand Down Expand Up @@ -221,9 +220,3 @@ export function shouldTransform(code: string) {
return false
return true
}

export function resolveImportPath(importName: string): string | undefined {
return resolve.sync(importName, {
preserveSymlinks: false,
})
}

0 comments on commit 3a2555d

Please sign in to comment.