@@ -157,7 +157,8 @@ const packageManagers = [
157157 { id: ' pnpm' , label: ' pnpm' , action: ' add' },
158158 { id: ' yarn' , label: ' yarn' , action: ' add' },
159159 { id: ' bun' , label: ' bun' , action: ' add' },
160- { id: ' deno' , label: ' deno' , action: ' add npm:' },
160+ { id: ' deno' , label: ' deno' , action: ' add' },
161+ { id: ' jsr' , label: ' jsr' , action: ' add' },
161162] as const
162163
163164type PackageManagerId = (typeof packageManagers )[number ][' id' ]
@@ -182,18 +183,35 @@ const currentPM = computed(
182183const selectedPMLabel = computed (() => currentPM .value .label )
183184const selectedPMAction = computed (() => currentPM .value .action )
184185
185- const installCommand = computed (() => {
186+ // Get the package specifier for the current package manager
187+ const packageSpecifier = computed (() => {
186188 if (! pkg .value ) return ' '
187189 const pm = currentPM .value
188- let command = ` ${pm .label } ${pm .action } ${pkg .value .name } `
189- // deno uses "add npm:package" format
190+
190191 if (pm .id === ' deno' ) {
191- command = ` ${pm .label } ${pm .action }${pkg .value .name } `
192+ // deno add npm:package
193+ return ` npm:${pkg .value .name } `
192194 }
193- if (requestedVersion .value ) {
194- command += ` @${requestedVersion .value } `
195+
196+ if (pm .id === ' jsr' ) {
197+ if (jsrInfo .value ?.exists && jsrInfo .value .scope && jsrInfo .value .name ) {
198+ // Native JSR package: @scope/name
199+ return ` @${jsrInfo .value .scope }/${jsrInfo .value .name } `
200+ }
201+ // npm compatibility: npm:package
202+ return ` npm:${pkg .value .name } `
195203 }
196- return command
204+
205+ // Standard package managers
206+ return pkg .value .name
207+ })
208+
209+ const installCommand = computed (() => {
210+ if (! pkg .value ) return ' '
211+ const pm = currentPM .value
212+ const spec = packageSpecifier .value
213+ const version = requestedVersion .value ? ` @${requestedVersion .value } ` : ' '
214+ return ` ${pm .label } ${pm .action } ${spec }${version } `
197215})
198216
199217// Copy install command
@@ -539,9 +557,7 @@ defineOgImageComponent('Package', {
539557 ><ClientOnly
540558 ><span class =" text-fg" >{{ selectedPMLabel }}</span
541559 >  ; <span class =" text-fg-muted" >{{ selectedPMAction }}</span
542- ><span v-if =" selectedPM !== 'deno'" class =" text-fg-muted"
543- >  ; {{ pkg.name }}</span
544- ><span v-else class =" text-fg-muted" >{{ pkg.name }}</span
560+ >  ; <span class =" text-fg-muted" >{{ packageSpecifier }}</span
545561 ><span v-if =" requestedVersion" class =" text-fg-muted" >@{{ requestedVersion }}</span
546562 ><template #fallback
547563 ><span class =" text-fg" >npm</span >  ; <span class =" text-fg-muted"
0 commit comments