chore(deps): update dependency pkg-types to v2 (main) (#31122)

This commit is contained in:
renovate[bot] 2025-03-01 14:46:54 +00:00 committed by GitHub
parent 025b01a041
commit c4fb9ced03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 68 additions and 56 deletions

View File

@ -40,7 +40,7 @@
"mlly": "^1.7.4", "mlly": "^1.7.4",
"ohash": "^2.0.7", "ohash": "^2.0.7",
"pathe": "^2.0.3", "pathe": "^2.0.3",
"pkg-types": "^1.3.1", "pkg-types": "^2.0.1",
"scule": "^1.3.0", "scule": "^1.3.0",
"semver": "^7.7.1", "semver": "^7.7.1",
"std-env": "^3.8.0", "std-env": "^3.8.0",

View File

@ -47,12 +47,17 @@ export async function checkNuxtCompatibility (constraints: NuxtCompatibility, nu
message: `Not compatible with \`${nuxt.options.builder}\`.`, message: `Not compatible with \`${nuxt.options.builder}\`.`,
}) })
} else { } else {
const builderVersion = await readPackageJSON(nuxt.options.builder, { url: nuxt.options.modulesDir }).then(r => r.version).catch(() => undefined) for (const parent of [nuxt.options.rootDir, nuxt.options.workspaceDir, import.meta.url]) {
if (builderVersion && !satisfies(normalizeSemanticVersion(builderVersion), constraint, { includePrerelease: true })) { const builderVersion = await readPackageJSON(nuxt.options.builder, { parent }).then(r => r.version).catch(() => undefined)
issues.push({ if (builderVersion) {
name: 'builder', if (!satisfies(normalizeSemanticVersion(builderVersion), constraint, { includePrerelease: true })) {
message: `Not compatible with \`${builderVersion}\` of \`${currentBuilder}\`. This module requires \`${constraint}\`.`, issues.push({
}) name: 'builder',
message: `Not compatible with \`${builderVersion}\` of \`${currentBuilder}\`. This module requires \`${constraint}\`.`,
})
}
break
}
} }
} }
} }

View File

@ -201,9 +201,21 @@ export async function _generateTypes (nuxt: Nuxt) {
} }
const isV4 = nuxt.options.future?.compatibilityVersion === 4 const isV4 = nuxt.options.future?.compatibilityVersion === 4
const hasTypescriptVersionWithModulePreserve = await readPackageJSON('typescript', { url: nuxt.options.modulesDir }) const nestedModulesDirs: string[] = []
.then(r => r?.version && gte(r.version, '5.4.0')) for (const dir of [...nuxt.options.modulesDir].sort()) {
.catch(() => isV4) const withSlash = withTrailingSlash(dir)
if (nestedModulesDirs.every(d => !d.startsWith(withSlash))) {
nestedModulesDirs.push(withSlash)
}
}
let hasTypescriptVersionWithModulePreserve
for (const parent of nestedModulesDirs) {
hasTypescriptVersionWithModulePreserve ??= await readPackageJSON('typescript', { parent })
.then(r => r?.version && gte(r.version, '5.4.0'))
.catch(() => undefined)
}
hasTypescriptVersionWithModulePreserve ??= isV4
const useDecorators = Boolean(nuxt.options.experimental?.decorators) const useDecorators = Boolean(nuxt.options.experimental?.decorators)
@ -311,8 +323,15 @@ export async function _generateTypes (nuxt: Nuxt) {
await Promise.all([...nuxt.options.modules, ...nuxt.options._modules].map(async (id) => { await Promise.all([...nuxt.options.modules, ...nuxt.options._modules].map(async (id) => {
if (typeof id !== 'string') { return } if (typeof id !== 'string') { return }
const pkg = await readPackageJSON(id, { url: nuxt.options.modulesDir }).catch(() => null) for (const parent of nestedModulesDirs) {
references.push(({ types: pkg?.name || id })) const pkg = await readPackageJSON(id, { parent }).catch(() => null)
if (pkg) {
references.push(({ types: pkg.name ?? id }))
return
}
}
references.push(({ types: id }))
})) }))
const declarations: string[] = [] const declarations: string[] = []

View File

@ -108,7 +108,7 @@
"on-change": "^5.0.1", "on-change": "^5.0.1",
"pathe": "^2.0.3", "pathe": "^2.0.3",
"perfect-debounce": "^1.0.0", "perfect-debounce": "^1.0.0",
"pkg-types": "^1.3.1", "pkg-types": "^2.0.1",
"radix3": "^1.1.2", "radix3": "^1.1.2",
"scule": "^1.3.0", "scule": "^1.3.0",
"semver": "^7.7.1", "semver": "^7.7.1",

View File

@ -13,8 +13,10 @@ interface EnsurePackageInstalledOptions {
} }
async function promptToInstall (name: string, installCommand: () => Promise<void>, options: EnsurePackageInstalledOptions) { async function promptToInstall (name: string, installCommand: () => Promise<void>, options: EnsurePackageInstalledOptions) {
if (await resolvePackageJSON(name, { url: options.searchPaths }).catch(() => null)) { for (const parent of options.searchPaths || []) {
return true if (await resolvePackageJSON(name, { parent }).catch(() => null)) {
return true
}
} }
logger.info(`Package ${name} is missing`) logger.info(`Package ${name} is missing`)

View File

@ -58,7 +58,7 @@
"mini-css-extract-plugin": "2.9.2", "mini-css-extract-plugin": "2.9.2",
"nitro": "npm:nitro-nightly@3.0.0-beta-28969273.f7aa9de6", "nitro": "npm:nitro-nightly@3.0.0-beta-28969273.f7aa9de6",
"ofetch": "1.4.1", "ofetch": "1.4.1",
"pkg-types": "1.3.1", "pkg-types": "2.0.1",
"postcss": "8.5.3", "postcss": "8.5.3",
"rollup-plugin-visualizer": "5.14.0", "rollup-plugin-visualizer": "5.14.0",
"sass-loader": "16.0.5", "sass-loader": "16.0.5",

View File

@ -48,7 +48,7 @@
"magic-string": "^0.30.17", "magic-string": "^0.30.17",
"mlly": "^1.7.4", "mlly": "^1.7.4",
"pathe": "^2.0.3", "pathe": "^2.0.3",
"pkg-types": "^1.3.1", "pkg-types": "^2.0.1",
"postcss": "^8.5.3", "postcss": "^8.5.3",
"rollup-plugin-visualizer": "^5.14.0", "rollup-plugin-visualizer": "^5.14.0",
"std-env": "^3.8.0", "std-env": "^3.8.0",

View File

@ -272,8 +272,8 @@ importers:
specifier: ^2.0.3 specifier: ^2.0.3
version: 2.0.3 version: 2.0.3
pkg-types: pkg-types:
specifier: ^1.3.1 specifier: ^2.0.1
version: 1.3.1 version: 2.0.1
scule: scule:
specifier: ^1.3.0 specifier: ^1.3.0
version: 1.3.0 version: 1.3.0
@ -459,8 +459,8 @@ importers:
specifier: ^1.0.0 specifier: ^1.0.0
version: 1.0.0 version: 1.0.0
pkg-types: pkg-types:
specifier: ^1.3.1 specifier: ^2.0.1
version: 1.3.1 version: 2.0.1
radix3: radix3:
specifier: ^1.1.2 specifier: ^1.1.2
version: 1.1.2 version: 1.1.2
@ -777,8 +777,8 @@ importers:
specifier: 1.4.1 specifier: 1.4.1
version: 1.4.1 version: 1.4.1
pkg-types: pkg-types:
specifier: 1.3.1 specifier: 2.0.1
version: 1.3.1 version: 2.0.1
postcss: postcss:
specifier: 8.5.3 specifier: 8.5.3
version: 8.5.3 version: 8.5.3
@ -924,8 +924,8 @@ importers:
specifier: ^2.0.3 specifier: ^2.0.3
version: 2.0.3 version: 2.0.3
pkg-types: pkg-types:
specifier: ^1.3.1 specifier: ^2.0.1
version: 1.3.1 version: 2.0.1
postcss: postcss:
specifier: 8.5.3 specifier: 8.5.3
version: 8.5.3 version: 8.5.3
@ -3354,10 +3354,6 @@ packages:
resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==}
engines: {node: '>=12'} engines: {node: '>=12'}
ansis@3.15.0:
resolution: {integrity: sha512-zIcWDJ+Kwqxfdnogx66Gxzr0kVmCcRAdat9nlY2IHsshqTN4fBH6tMeRMPA/2w0rpBayIJvjQAaa2/4RDrNqwg==}
engines: {node: '>=14'}
ansis@3.16.0: ansis@3.16.0:
resolution: {integrity: sha512-sU7d/tfZiYrsIAXbdL/CNZld5bCkruzwT5KmqmadCJYxuLxHAOBjidxD5+iLmN/6xEfjcQq1l7OpsiCBlc4LzA==} resolution: {integrity: sha512-sU7d/tfZiYrsIAXbdL/CNZld5bCkruzwT5KmqmadCJYxuLxHAOBjidxD5+iLmN/6xEfjcQq1l7OpsiCBlc4LzA==}
engines: {node: '>=14'} engines: {node: '>=14'}
@ -5353,10 +5349,6 @@ packages:
resolution: {integrity: sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==} resolution: {integrity: sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==}
engines: {node: '>=8.9.0'} engines: {node: '>=8.9.0'}
local-pkg@1.0.0:
resolution: {integrity: sha512-bbgPw/wmroJsil/GgL4qjDzs5YLTBMQ99weRsok1XCDccQeehbHA/I1oRvk2NPtr7KGZgT/Y5tPRnAtMqeG2Kg==}
engines: {node: '>=14'}
local-pkg@1.1.0: local-pkg@1.1.0:
resolution: {integrity: sha512-xbZBuX6gYIWrlLmZG43aAVer4ocntYO09vPy9lxd6Ns8DnR4U7N+IIeDkubinqFOHHzoMlPxTxwo0jhE7oYjAw==} resolution: {integrity: sha512-xbZBuX6gYIWrlLmZG43aAVer4ocntYO09vPy9lxd6Ns8DnR4U7N+IIeDkubinqFOHHzoMlPxTxwo0jhE7oYjAw==}
engines: {node: '>=14'} engines: {node: '>=14'}
@ -6091,8 +6083,8 @@ packages:
pkg-types@1.3.1: pkg-types@1.3.1:
resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==} resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==}
pkg-types@2.0.0: pkg-types@2.0.1:
resolution: {integrity: sha512-W+831FxieJW1CIAh3JMmHaMhK/SiSeyCqbSWqLjjvbjaPDDY0cRkspIfOx4vLkFNgfxnzSxxGFUiMHMm6QpvYA==} resolution: {integrity: sha512-LdDk/hlFeVBoEZqlkJ2bsxwq5fjKQg7i422zu78IC16CSR2XBe7kYxxBx0mkU8kLX6nh50Zp80lZHveKnsHTpQ==}
playwright-core@1.50.1: playwright-core@1.50.1:
resolution: {integrity: sha512-ra9fsNWayuYumt+NiM069M6OkcRb1FZSK8bgi66AtpFoWkg2+y0bJSNmkFrWhMbEBbVKC/EruAHH3g0zmtwGmQ==} resolution: {integrity: sha512-ra9fsNWayuYumt+NiM069M6OkcRb1FZSK8bgi66AtpFoWkg2+y0bJSNmkFrWhMbEBbVKC/EruAHH3g0zmtwGmQ==}
@ -8503,7 +8495,7 @@ snapshots:
debug: 4.4.0(supports-color@9.4.0) debug: 4.4.0(supports-color@9.4.0)
globals: 15.15.0 globals: 15.15.0
kolorist: 1.8.0 kolorist: 1.8.0
local-pkg: 1.0.0 local-pkg: 1.1.0
mlly: 1.7.4 mlly: 1.7.4
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
@ -8717,7 +8709,7 @@ snapshots:
execa: 9.5.2 execa: 9.5.2
magicast: 0.3.5 magicast: 0.3.5
pathe: 2.0.3 pathe: 2.0.3
pkg-types: 2.0.0 pkg-types: 2.0.1
prompts: 2.4.2 prompts: 2.4.2
semver: 7.7.1 semver: 7.7.1
@ -8745,7 +8737,7 @@ snapshots:
ohash: 2.0.7 ohash: 2.0.7
pathe: 2.0.3 pathe: 2.0.3
perfect-debounce: 1.0.0 perfect-debounce: 1.0.0
pkg-types: 2.0.0 pkg-types: 2.0.1
semver: 7.7.1 semver: 7.7.1
simple-git: 3.27.0 simple-git: 3.27.0
sirv: 3.0.1 sirv: 3.0.1
@ -8782,7 +8774,7 @@ snapshots:
eslint-plugin-vue: 9.32.0(eslint@9.21.0(jiti@2.4.2)) eslint-plugin-vue: 9.32.0(eslint@9.21.0(jiti@2.4.2))
eslint-processor-vue-blocks: 2.0.0(@vue/compiler-sfc@3.5.13)(eslint@9.21.0(jiti@2.4.2)) eslint-processor-vue-blocks: 2.0.0(@vue/compiler-sfc@3.5.13)(eslint@9.21.0(jiti@2.4.2))
globals: 15.15.0 globals: 15.15.0
local-pkg: 1.0.0 local-pkg: 1.1.0
pathe: 2.0.3 pathe: 2.0.3
vue-eslint-parser: 9.4.3(eslint@9.21.0(jiti@2.4.2)) vue-eslint-parser: 9.4.3(eslint@9.21.0(jiti@2.4.2))
transitivePeerDependencies: transitivePeerDependencies:
@ -8880,7 +8872,7 @@ snapshots:
fake-indexeddb: 6.0.0 fake-indexeddb: 6.0.0
get-port-please: 3.1.2 get-port-please: 3.1.2
h3: h3-nightly@1.15.1-20250222-111608-d1c00fc h3: h3-nightly@1.15.1-20250222-111608-d1c00fc
local-pkg: 1.0.0 local-pkg: 1.1.0
magic-string: 0.30.17 magic-string: 0.30.17
node-fetch-native: 1.6.6 node-fetch-native: 1.6.6
ofetch: 1.4.1 ofetch: 1.4.1
@ -10026,7 +10018,7 @@ snapshots:
dependencies: dependencies:
'@vue/compiler-sfc': 3.5.13 '@vue/compiler-sfc': 3.5.13
ast-kit: 1.4.0 ast-kit: 1.4.0
local-pkg: 1.0.0 local-pkg: 1.1.0
magic-string-ast: 0.7.0 magic-string-ast: 0.7.0
pathe: 2.0.3 pathe: 2.0.3
picomatch: 4.0.2 picomatch: 4.0.2
@ -10378,8 +10370,6 @@ snapshots:
ansi-styles@6.2.1: {} ansi-styles@6.2.1: {}
ansis@3.15.0: {}
ansis@3.16.0: {} ansis@3.16.0: {}
any-promise@1.3.0: {} any-promise@1.3.0: {}
@ -10564,7 +10554,7 @@ snapshots:
ohash: 2.0.7 ohash: 2.0.7
pathe: 2.0.3 pathe: 2.0.3
perfect-debounce: 1.0.0 perfect-debounce: 1.0.0
pkg-types: 2.0.0 pkg-types: 2.0.1
rc9: 2.1.2 rc9: 2.1.2
optionalDependencies: optionalDependencies:
magicast: 0.3.5 magicast: 0.3.5
@ -10630,7 +10620,7 @@ snapshots:
ofetch: 1.4.1 ofetch: 1.4.1
open: 10.1.0 open: 10.1.0
pathe: 2.0.3 pathe: 2.0.3
pkg-types: 2.0.0 pkg-types: 2.0.1
scule: 1.3.0 scule: 1.3.0
semver: 7.7.1 semver: 7.7.1
std-env: 3.8.0 std-env: 3.8.0
@ -12576,11 +12566,6 @@ snapshots:
emojis-list: 3.0.0 emojis-list: 3.0.0
json5: 2.2.3 json5: 2.2.3
local-pkg@1.0.0:
dependencies:
mlly: 1.7.4
pkg-types: 1.3.1
local-pkg@1.1.0: local-pkg@1.1.0:
dependencies: dependencies:
mlly: 1.7.4 mlly: 1.7.4
@ -13373,7 +13358,7 @@ snapshots:
citty: 0.1.6 citty: 0.1.6
consola: 3.4.0 consola: 3.4.0
pathe: 2.0.3 pathe: 2.0.3
pkg-types: 2.0.0 pkg-types: 2.0.1
tinyexec: 0.3.2 tinyexec: 0.3.2
object-assign@4.1.1: {} object-assign@4.1.1: {}
@ -13610,9 +13595,10 @@ snapshots:
mlly: 1.7.4 mlly: 1.7.4
pathe: 2.0.3 pathe: 2.0.3
pkg-types@2.0.0: pkg-types@2.0.1:
dependencies: dependencies:
confbox: 0.1.8 confbox: 0.1.8
exsolve: 1.0.1
pathe: 2.0.3 pathe: 2.0.3
playwright-core@1.50.1: {} playwright-core@1.50.1: {}
@ -14859,7 +14845,7 @@ snapshots:
mkdist: 2.2.0(typescript@5.8.2)(vue-tsc@2.2.6(typescript@5.8.2))(vue@3.5.13(typescript@5.8.2)) mkdist: 2.2.0(typescript@5.8.2)(vue-tsc@2.2.6(typescript@5.8.2))(vue@3.5.13(typescript@5.8.2))
mlly: 1.7.4 mlly: 1.7.4
pathe: 2.0.3 pathe: 2.0.3
pkg-types: 2.0.0 pkg-types: 2.0.1
pretty-bytes: 6.1.1 pretty-bytes: 6.1.1
rollup: 4.34.9 rollup: 4.34.9
rollup-plugin-dts: 6.1.1(rollup@4.34.9)(typescript@5.8.2) rollup-plugin-dts: 6.1.1(rollup@4.34.9)(typescript@5.8.2)
@ -14928,7 +14914,7 @@ snapshots:
acorn: 8.14.0 acorn: 8.14.0
escape-string-regexp: 5.0.0 escape-string-regexp: 5.0.0
estree-walker: 3.0.3 estree-walker: 3.0.3
local-pkg: 1.0.0 local-pkg: 1.1.0
magic-string: 0.30.17 magic-string: 0.30.17
mlly: 1.7.4 mlly: 1.7.4
pathe: 2.0.3 pathe: 2.0.3
@ -15012,7 +14998,7 @@ snapshots:
chokidar: 3.6.0 chokidar: 3.6.0
fast-glob: 3.3.3 fast-glob: 3.3.3
json5: 2.2.3 json5: 2.2.3
local-pkg: 1.0.0 local-pkg: 1.1.0
magic-string: 0.30.17 magic-string: 0.30.17
mlly: 1.7.4 mlly: 1.7.4
pathe: 2.0.3 pathe: 2.0.3
@ -15521,7 +15507,7 @@ snapshots:
webpackbar@7.0.0(@rspack/core@1.2.6)(webpack@5.98.0): webpackbar@7.0.0(@rspack/core@1.2.6)(webpack@5.98.0):
dependencies: dependencies:
ansis: 3.15.0 ansis: 3.16.0
consola: 3.4.0 consola: 3.4.0
pretty-time: 1.1.0 pretty-time: 1.1.0
std-env: 3.8.0 std-env: 3.8.0