Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions packages/vite/src/app/components/packages/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { PackageInfo, SessionContext } from '~~/shared/types'
import { useRoute } from '#app/composables/router'
import { useCycleList } from '@vueuse/core'
import { Menu as VMenu } from 'floating-vue'
import { Tooltip, Menu as VMenu } from 'floating-vue'
import { settings } from '~~/app/state/settings'

withDefaults(defineProps<{
Expand Down Expand Up @@ -69,9 +69,23 @@ function toggleSizeSortType() {
:class="[index === packages.length - 1 ? 'border-b-0' : '']"
:to="{ path: route.path, query: { package: `${item.name}@${item.version}` } }"
>
<div v-if="!groupView" role="cell" font-mono flex-none min-w80 py1.5 px2 ws-nowrap text-sm>
<DisplayHighlightedPackageName :name="item.name" />
</div>
<Tooltip
:triggers="['hover']"
:delay="1200"
:disabled="item.name.length < 30"
>
<div
v-if="!groupView" role="cell" font-mono flex-none w80 py1.5 px2 ws-nowrap text-sm overflow-hidden
Comment thread
Gianthard-cyh marked this conversation as resolved.
truncate
>
<DisplayHighlightedPackageName :name="item.name" />
</div>
<template #popper>
<span font-mono text-sm>
{{ item.name }}
</span>
</template>
</Tooltip>
<div role="cell" flex="~ items-center" text-left flex-none font-mono py1.5 px2 text-sm min-w40 op80 :class="{ 'text-primary': item.duplicated }">
{{ item.version }}
</div>
Expand Down
33 changes: 28 additions & 5 deletions packages/vite/src/node/rpc/functions/rolldown-get-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,21 @@ export async function getPackagesManifest(reader: RolldownEventsReader) {
}
})
await Promise.all(packages.map(async (p) => {
const manifest = await readProjectManifestOnly(p.dir)
const packageKey = `${manifest.name!}@${manifest.version!}`
let packageKey = ''
let manifest = null

try {
manifest = await readProjectManifestOnly(p.dir)
packageKey = `${manifest.name!}@${manifest.version!}`
}
catch (err: any) {
if (err?.code === 'ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND') {
Comment thread
Gianthard-cyh marked this conversation as resolved.
packageKey = `${p.dir}`
}
else {
throw err
}
}
const packageInfo = packagesManifest.get(packageKey)
const importers = getImporters(p.path, p.dir).map(i => ({ path: i, version: '' }))
if (packageInfo) {
Expand All @@ -59,8 +72,8 @@ export async function getPackagesManifest(reader: RolldownEventsReader) {
}
else {
packagesManifest.set(packageKey, {
name: manifest.name!,
version: manifest.version!,
name: manifest?.name || p.dir,
version: manifest?.version || '(unknown)',
dir: p.dir,
files: [{
path: p.path,
Expand Down Expand Up @@ -101,7 +114,17 @@ export const rolldownGetPackages = defineRpcFunction({
if (duplicated) {
files = await Promise.all(files.map(async (f) => {
const importers = await Promise.all(f.importers.map(async (i) => {
const manifest = isNodeModulePath(i.path) ? await readProjectManifestOnly(getPackageDirPath(i.path)) : null
let manifest = null
try {
if (isNodeModulePath(i.path)) {
manifest = await readProjectManifestOnly(getPackageDirPath(i.path))
}
}
catch (err: any) {
if (err?.code !== 'ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND') {
throw err
}
}
return { ...i, version: manifest?.version ?? '' }
}))
return { ...f, importers }
Expand Down