Skip to content

Commit f48daa3

Browse files
Merge branch 'main' into chromatic-reduce-cache-busting
2 parents 698e82d + 67b1322 commit f48daa3

14 files changed

Lines changed: 552 additions & 126 deletions

File tree

.env.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#secure password, can use openssl rand -hex 32
1+
# secure password, can use `openssl rand -hex 32`
22
NUXT_SESSION_PASSWORD=""
33

4-
#HMAC secret for image-proxy and OG image URL signing, can use openssl rand -hex 32
5-
NUXT_IMAGE_PROXY_SECRET=""
4+
# HMAC secret for image-proxy and OG image URL signing, can use `openssl rand -hex 32`
5+
NUXT_IMAGE_PROXY_SECRET=""

.github/workflows/dependency-diff.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ jobs:
3535
with:
3636
mode: artifact
3737
detect-replacements: 'true'
38-
duplicate-threshold: '4'
38+
# Too noisy. Disabling until this can report on duplicate CHANGES in this PR.
39+
duplicate-threshold: '999'
3940
dependency-threshold: '15'
4041
size-threshold: '200000'
4142

app/composables/npm/useAlgoliaSearch.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ interface AlgoliaHit {
5050
deprecated: boolean | string
5151
isDeprecated: boolean
5252
license: string | null
53+
isSecurityHeld: boolean
5354
}
5455

5556
const ATTRIBUTES_TO_RETRIEVE = [
@@ -67,6 +68,7 @@ const ATTRIBUTES_TO_RETRIEVE = [
6768
'deprecated',
6869
'isDeprecated',
6970
'license',
71+
'isSecurityHeld',
7072
]
7173

7274
const EXISTENCE_CHECK_ATTRS = ['name']
@@ -90,6 +92,7 @@ function hitToSearchResult(hit: AlgoliaHit): NpmSearchResult {
9092
email: owner.email,
9193
}))
9294
: [],
95+
isSecurityHeld: hit.isSecurityHeld,
9396
},
9497
searchScore: 0,
9598
downloads: {

app/pages/package/[[org]]/[name]/versions.vue

Lines changed: 206 additions & 62 deletions
Large diffs are not rendered by default.

app/pages/search.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,17 @@ const { settings } = useSettings()
8686
8787
/**
8888
* Reorder results to put exact package name match at the top,
89-
* and optionally filter out platform-specific packages.
89+
* and optionally filter out platform-specific packages or security holding packages.
9090
*/
9191
const visibleResults = computed(() => {
9292
const raw = rawVisibleResults.value
9393
if (!raw) return raw
9494
9595
let objects = raw.objects
9696
97+
// Filter out "Security holding package" packages taken down by npm registry
98+
objects = objects.filter(r => !r.package.isSecurityHeld)
99+
97100
// Filter out platform-specific packages if setting is enabled
98101
if (settings.value.hidePlatformPackages) {
99102
objects = objects.filter(r => !isPlatformSpecificPackage(r.package.name))

app/pages/settings.vue

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
11
<script setup lang="ts">
2+
import type { LocaleObject } from '@nuxtjs/i18n'
3+
24
const router = useRouter()
35
const { settings } = useSettings()
4-
const { locale: currentLocale, locales, setLocale: setNuxti18nLocale } = useI18n()
6+
const { locale, locales, setLocale: setNuxti18nLocale } = useI18n()
57
const colorMode = useColorMode()
68
const { currentLocaleStatus, isSourceLocale } = useI18nStatus()
79
const keyboardShortcutsEnabled = useKeyboardShortcuts()
810
const { toggleCodeLigatures } = useCodeLigatures()
911
12+
// Create a computed property to handle locale binding properly
13+
const localeCodes = computed<LocaleObject['code'][]>(() =>
14+
locales.value.map(loc => loc.code as LocaleObject['code']),
15+
)
16+
17+
function isLocaleCode(value: string): value is LocaleObject['code'] {
18+
return localeCodes.value.includes(value as LocaleObject['code'])
19+
}
20+
21+
const currentLocale = computed<string>({
22+
get: () => locale.value as string,
23+
set: (newLocale: string) => {
24+
if (!newLocale || !isLocaleCode(newLocale)) return
25+
26+
settings.value.selectedLocale = newLocale
27+
setNuxti18nLocale(newLocale)
28+
},
29+
})
30+
1031
// Escape to go back (but not when focused on form elements or modal is open)
1132
onKeyStroke(
1233
e =>
@@ -29,20 +50,6 @@ useSeoMeta({
2950
ogDescription: () => $t('settings.meta_description'),
3051
twitterDescription: () => $t('settings.meta_description'),
3152
})
32-
33-
defineOgImage(
34-
'Page.takumi',
35-
{
36-
title: () => $t('settings.title'),
37-
description: () => $t('settings.tagline'),
38-
},
39-
{ alt: () => `${$t('settings.title')} — npmx` },
40-
)
41-
42-
const setLocale: typeof setNuxti18nLocale = newLocale => {
43-
settings.value.selectedLocale = newLocale
44-
return setNuxti18nLocale(newLocale)
45-
}
4653
</script>
4754

4855
<template>
@@ -248,7 +255,6 @@ const setLocale: typeof setNuxti18nLocale = newLocale => {
248255
id="language-select"
249256
:items="locales.map(loc => ({ label: loc.name ?? '', value: loc.code }))"
250257
v-model="currentLocale"
251-
@update:modelValue="setLocale($event as typeof currentLocale)"
252258
block
253259
size="sm"
254260
class="max-w-48"

nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export default defineNuxtConfig({
118118
isr: {
119119
expiration: 60 * 60 /* one hour */,
120120
passQuery: true,
121-
allowQuery: ['mode', 'filterOldVersions', 'filterThreshold'],
121+
allowQuery: ['mode', 'filterOldVersions', 'filterThreshold', 'packages'],
122122
},
123123
},
124124
'/api/registry/timeline/**': {

0 commit comments

Comments
 (0)