From 3a2555d6438117860793fe6966cbdaac6ca59846 Mon Sep 17 00:00:00 2001 From: _Kerman Date: Tue, 25 Jun 2024 16:16:47 +0800 Subject: [PATCH] deps: replace resolve with mlly (#775) --- package.json | 3 +-- pnpm-lock.yaml | 43 ++++++++++++++++++++++++-------------- src/core/resolvers/veui.ts | 5 +++-- src/core/utils.ts | 7 ------- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index 88717700..60f8f837 100644 --- a/package.json +++ b/package.json @@ -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": { @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 172ba71f..113c6741 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,9 +32,9 @@ importers: minimatch: specifier: ^9.0.4 version: 9.0.4 - resolve: - specifier: ^1.22.8 - version: 1.22.8 + mlly: + specifier: ^1.7.1 + version: 1.7.1 unplugin: specifier: ^1.10.1 version: 1.10.1 @@ -60,9 +60,6 @@ importers: '@types/node': specifier: ^20.12.7 version: 20.12.7 - '@types/resolve': - specifier: ^1.20.6 - version: 1.20.6 bumpp: specifier: ^9.4.1 version: 9.4.1 @@ -1533,9 +1530,6 @@ packages: '@types/range-parser@1.2.4': resolution: {integrity: sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==} - '@types/resolve@1.20.6': - resolution: {integrity: sha512-A4STmOXPhMUtHH+S6ymgE2GiBSMqf4oTvcQZMcHzokuTLVYzXTB8ttjcgxOVaAp2lGwEdzZ0J+cRbbeevQj1UQ==} - '@types/retry@0.12.1': resolution: {integrity: sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==} @@ -4102,6 +4096,9 @@ packages: mlly@1.6.1: resolution: {integrity: sha512-vLgaHvaeunuOXHSmEbZ9izxPx3USsk8KCQ8iC+aTlp5sKRSoZvwhHh5L9VbKSaVC6sJDqbyohIS76E2VmHIPAA==} + mlly@1.7.1: + resolution: {integrity: sha512-rrVRZRELyQzrIUAVMHxP97kv+G786pHmOKzuFII8zDYahFBS7qnHh2AlYSl1GAHhaMPCz6/oHjVMcfFYgFYHgA==} + module-alias@2.2.2: resolution: {integrity: sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==} @@ -4432,6 +4429,9 @@ packages: pkg-types@1.0.3: resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} + pkg-types@1.1.1: + resolution: {integrity: sha512-ko14TjmDuQJ14zsotODv7dBlwxKhUKQEhuhmbqo1uCi9BB0Z2alo/wAXg6q1dTR5TyuqYyWhjtfe/Tsh+X28jQ==} + pluralize@8.0.0: resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} engines: {node: '>=4'} @@ -6898,7 +6898,7 @@ snapshots: ignore: 5.3.1 jiti: 1.21.0 knitwork: 1.1.0 - mlly: 1.6.1 + mlly: 1.7.1 pathe: 1.1.2 pkg-types: 1.0.3 scule: 1.3.0 @@ -7160,8 +7160,6 @@ snapshots: '@types/range-parser@1.2.4': {} - '@types/resolve@1.20.6': {} - '@types/retry@0.12.1': {} '@types/semver@7.5.8': {} @@ -8277,7 +8275,7 @@ snapshots: dotenv: 16.4.5 giget: 1.2.3 jiti: 1.21.0 - mlly: 1.6.1 + mlly: 1.7.1 ohash: 1.1.3 pathe: 1.1.2 perfect-debounce: 1.0.0 @@ -9929,7 +9927,7 @@ snapshots: local-pkg@0.5.0: dependencies: - mlly: 1.6.1 + mlly: 1.7.1 pkg-types: 1.0.3 locate-path@5.0.0: @@ -10134,6 +10132,13 @@ snapshots: pkg-types: 1.0.3 ufo: 1.5.3 + mlly@1.7.1: + dependencies: + acorn: 8.11.3 + pathe: 1.1.2 + pkg-types: 1.1.1 + ufo: 1.5.3 + module-alias@2.2.2: {} mri@1.2.0: {} @@ -10431,7 +10436,13 @@ snapshots: pkg-types@1.0.3: dependencies: jsonc-parser: 3.2.0 - mlly: 1.6.1 + mlly: 1.7.1 + pathe: 1.1.2 + + pkg-types@1.1.1: + dependencies: + confbox: 0.1.7 + mlly: 1.7.1 pathe: 1.1.2 pluralize@8.0.0: {} @@ -11378,7 +11389,7 @@ snapshots: fast-glob: 3.3.2 local-pkg: 0.5.0 magic-string: 0.30.10 - mlly: 1.6.1 + mlly: 1.7.1 pathe: 1.1.2 pkg-types: 1.0.3 scule: 1.3.0 diff --git a/src/core/resolvers/veui.ts b/src/core/resolvers/veui.ts index 4241fb4e..197f0d88 100644 --- a/src/core/resolvers/veui.ts +++ b/src/core/resolvers/veui.ts @@ -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 { /** @@ -109,7 +110,7 @@ const peerPaths = new Map() function assertPeerPath(peerPath: string) { if (!peerPaths.has(peerPath)) { try { - resolveImportPath(peerPath) + resolvePathSync(peerPath) peerPaths.set(peerPath, true) } catch (e) { diff --git a/src/core/utils.ts b/src/core/utils.ts index cc60914d..307b7514 100644 --- a/src/core/utils.ts +++ b/src/core/utils.ts @@ -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, @@ -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, - }) -}