diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 4e54129b99..a05f1113e0 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -35,7 +35,7 @@ jobs: sfw: true - name: 🧪 Run Chromatic Visual and Accessibility Tests - uses: chromaui/action@14cfaef73576e69f95f47f60058063f46ca38719 # v18.1.0 + uses: chromaui/action@0a7067e5ffc663a631b14db505d8a94b26e1bf2f # v18.15.3 with: buildCommand: vp run build-storybook outputDir: storybook-static diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fac7f2efd6..e3ef249608 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,9 @@ jobs: - name: 🔠 Lint project run: vp run lint + - name: 🧷 Check vite+ pins + run: vp run check:vite-plus + types: name: 💪 Type check runs-on: ubuntu-26.04-arm @@ -79,7 +82,7 @@ jobs: - name: ⬆︎ Upload test results to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: disable_search: true files: test-report.junit.xml @@ -90,7 +93,7 @@ jobs: - name: ⬆︎ Upload coverage reports to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: disable_search: true files: coverage/clover.xml @@ -121,7 +124,7 @@ jobs: - name: ⬆︎ Upload test results to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: disable_search: true files: test-report.junit.xml @@ -132,7 +135,7 @@ jobs: - name: ⬆︎ Upload coverage reports to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: disable_search: true files: coverage/clover.xml @@ -144,7 +147,7 @@ jobs: name: 🖥️ Browser tests runs-on: ubuntu-26.04-arm container: - image: mcr.microsoft.com/playwright:v1.64.1-noble@sha256:47b510dd9230bf0b9bfc9b20102241e577ea7a99334ab4c3ca19f19770e9b8ea + image: mcr.microsoft.com/playwright:v1.65.1-noble@sha256:1507cbfc550a63a6b7396791ca4f00df17beb56342d2447b3f106c306f525579 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -177,7 +180,7 @@ jobs: - name: ⬆︎ Upload test results to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: disable_search: true files: test-report.junit.xml @@ -187,6 +190,27 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # TODO(serhalp): Upload browser *coverage* report once we've instrumented the prebuilt bundle + vercel: + name: ▲ Vercel output tests + runs-on: ubuntu-26.04-arm + + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - uses: voidzero-dev/setup-vp@cab1ab9eaff52d4857875f4f2c016e36af8f2c76 # v1.22.0 + with: + node-version-file: .node-version + cache: true + sfw: true + + - name: 🏗️ Build project (Vercel preset) + run: vp run build:test:vercel + + - name: ▲ Test Vercel output + run: vp run test:vercel:prebuilt + a11y: name: ♿ Accessibility audit runs-on: ubuntu-latest # See https://github.com/GoogleChrome/lighthouse/discussions/16834 diff --git a/.github/workflows/dependency-diff-comment.yml b/.github/workflows/dependency-diff-comment.yml index 164a55468a..33683256d9 100644 --- a/.github/workflows/dependency-diff-comment.yml +++ b/.github/workflows/dependency-diff-comment.yml @@ -23,7 +23,7 @@ jobs: steps: - name: 📥 Download artifact - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: e18e-diff-result run-id: ${{ github.event.workflow_run.id }} diff --git a/.github/workflows/dependency-diff.yml b/.github/workflows/dependency-diff.yml index 4c6c11e92d..e5538ac96a 100644 --- a/.github/workflows/dependency-diff.yml +++ b/.github/workflows/dependency-diff.yml @@ -43,7 +43,7 @@ jobs: - name: 📤 Upload artifact if: steps.analyze.outputs.artifact-path - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: e18e-diff-result path: ${{ steps.analyze.outputs.artifact-path }} diff --git a/.github/workflows/deploy-canary.yml b/.github/workflows/deploy-canary.yml index 363730cb2e..a1aaad9d7b 100644 --- a/.github/workflows/deploy-canary.yml +++ b/.github/workflows/deploy-canary.yml @@ -31,7 +31,7 @@ jobs: with: mode: firewall-free # Version of the underlying sfw to use (no `v` prefix): https://github.com/SocketDev/sfw-free/releases - firewall-version: 1.12.0 + firewall-version: 1.15.4 # Lunaria needs the full git history, but `vercel deploy` uploads the source without `.git`, # so generate `dist/lunaria/status.json` here and upload it with the source instead. diff --git a/.github/workflows/lunaria.yml b/.github/workflows/lunaria.yml index 3d6253d84b..cc1cd3cc64 100644 --- a/.github/workflows/lunaria.yml +++ b/.github/workflows/lunaria.yml @@ -37,4 +37,4 @@ jobs: sfw: true - name: Generate Lunaria Overview - uses: lunariajs/action@e5ab09c3c8353fa80786d8c2149873ba3978a3a7 # v0.2.0 + uses: lunariajs/action@fb6be638db02f58f6e5e5ec125f5505e208adde2 # v0.4.0 diff --git a/.github/workflows/semantic-pull-requests.yml b/.github/workflows/semantic-pull-requests.yml index c1718123bf..360fb881b8 100644 --- a/.github/workflows/semantic-pull-requests.yml +++ b/.github/workflows/semantic-pull-requests.yml @@ -24,7 +24,7 @@ jobs: name: 🏷️ Validate PR title steps: - name: Validate PR title - uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1 + uses: amannn/action-semantic-pull-request@66e72920af32222769c386d81f89656ebcb6d6d5 # v6.1.4 with: scopes: | a11y diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml index 40f36255a7..9ddedacca7 100644 --- a/.github/workflows/zizmor.yml +++ b/.github/workflows/zizmor.yml @@ -30,7 +30,7 @@ jobs: with: persist-credentials: false - - uses: zizmorcore/zizmor-action@3dc1ecc9bcb9e94e9b2c709687979e1298497054 # v0.6.2 + - uses: zizmorcore/zizmor-action@1b4550e929643b8b26a62303c6bd64814271a4f1 # v0.9.2 with: persona: pedantic # Use annotations instead of SARIF as this doesn't need special permissions diff --git a/.node-version b/.node-version index cabf43b5dd..978b4e8e51 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -24 \ No newline at end of file +26 \ No newline at end of file diff --git a/app/components/AuthorAvatar.vue b/app/components/AuthorAvatar.vue index 0e68ae41a3..6fd628a547 100644 --- a/app/components/AuthorAvatar.vue +++ b/app/components/AuthorAvatar.vue @@ -6,16 +6,13 @@ const props = defineProps<{ size?: 'sm' | 'md' | 'lg' }>() -const sizeClasses = computed(() => { - switch (props.size ?? 'md') { - case 'sm': - return 'w-8 h-8 text-sm' - case 'lg': - return 'w-12 h-12 text-xl' - default: - return 'w-10 h-10 text-lg' - } -}) +const SIZES = { + sm: { px: 32, classes: 'w-8 h-8 text-sm' }, + md: { px: 40, classes: 'w-10 h-10 text-lg' }, + lg: { px: 48, classes: 'w-12 h-12 text-xl' }, +} as const + +const sizeConfig = computed(() => SIZES[props.size ?? 'md']) const initials = computed(() => props.author.name @@ -30,12 +27,14 @@ const initials = computed(() => diff --git a/app/components/Code/MobileTreeDrawer.vue b/app/components/Code/MobileTreeDrawer.vue index dd524bf635..07cb9c96d7 100644 --- a/app/components/Code/MobileTreeDrawer.vue +++ b/app/components/Code/MobileTreeDrawer.vue @@ -6,6 +6,11 @@ defineProps<{ currentPath: string baseUrl: string baseRoute: Pick + loadingDirs?: ReadonlySet +}>() + +const emit = defineEmits<{ + expandDir: [path: string] }>() const isOpen = shallowRef(false) @@ -74,6 +79,8 @@ defineExpose({ :current-path="currentPath" :base-url="baseUrl" :base-route="baseRoute" + :loading-dirs="loadingDirs" + @expand-dir="emit('expandDir', $event)" /> diff --git a/app/components/Compare/PackageSelector.vue b/app/components/Compare/PackageSelector.vue index 2cad026112..d333674000 100644 --- a/app/components/Compare/PackageSelector.vue +++ b/app/components/Compare/PackageSelector.vue @@ -8,20 +8,7 @@ const props = defineProps<{ const maxPackages = computed(() => props.max ?? MAX_PACKAGE_SELECTION) -// Input state const inputValue = shallowRef('') -const isInputFocused = shallowRef(false) - -// Keyboard navigation state -const highlightedIndex = shallowRef(-1) -const listRef = useTemplateRef('listRef') -const PAGE_JUMP = 5 - -// Use the shared search composable (supports both npm and Algolia providers) -const { searchProvider } = useSearchProvider() -const { data: searchData, status } = useSearch(inputValue, searchProvider, { size: 15 }) - -const isSearching = computed(() => status.value === 'pending') // Trigger strings for "What Would James Do?" typeahead Easter egg // Intentionally not localized @@ -46,37 +33,17 @@ const showNoDependencyOption = computed(() => { return EASTER_EGG_TRIGGERS.has(input) }) -// Filter out already selected packages -const selectedBaseNames = computed(() => new Set(packages.value.map(p => parsePackageSpec(p).name))) - -const filteredResults = computed(() => { - if (!searchData.value?.objects) return [] - return searchData.value.objects - .map(o => ({ - name: o.package.name, - description: o.package.description, - })) - .filter(r => !selectedBaseNames.value.has(r.name)) -}) - -// Unified list of navigable items for keyboard navigation -const navigableItems = computed(() => { - const items: { type: 'no-dependency' | 'package'; name: string }[] = [] - if (showNoDependencyOption.value) { - items.push({ type: 'no-dependency', name: NO_DEPENDENCY_ID }) - } - for (const r of filteredResults.value) { - items.push({ type: 'package', name: r.name }) - } - return items -}) +const leadingOptions = computed(() => + showNoDependencyOption.value + ? [{ value: NO_DEPENDENCY_ID, label: $t('compare.no_dependency.add_column') }] + : [], +) -const resultIndexOffset = computed(() => (showNoDependencyOption.value ? 1 : 0)) +// Filter out already selected packages +const selectedBaseNames = computed(() => packages.value.map(p => parsePackageSpec(p).name)) const numberFormatter = useNumberFormatter() -const keyboardShortcuts = useKeyboardShortcuts() - function addPackage(spec: string) { if (packages.value.length >= maxPackages.value) return const trimmedSpec = spec.trim() @@ -94,111 +61,21 @@ function addPackage(spec: string) { packages.value = [...packages.value, trimmedSpec] } inputValue.value = '' - highlightedIndex.value = -1 } function removePackage(name: string) { packages.value = packages.value.filter(p => p !== name) } -function handleKeydown(e: KeyboardEvent) { - if (!keyboardShortcuts.value) { +// Fallback: easter egg, exact match, or manual version spec entry (e.g. lodash@3.10.1) +function handleSubmit(query: string, exactMatch: boolean) { + if (showNoDependencyOption.value) { + addPackage(NO_DEPENDENCY_ID) return } - - const items = navigableItems.value - const count = items.length - - switch (e.key) { - case 'ArrowDown': - e.preventDefault() - if (count === 0) return - if (highlightedIndex.value < count - 1) { - highlightedIndex.value++ - } else { - highlightedIndex.value = 0 - } - break - - case 'ArrowUp': - e.preventDefault() - if (count === 0) return - if (highlightedIndex.value > 0) { - highlightedIndex.value-- - } else { - highlightedIndex.value = count - 1 - } - break - - case 'PageDown': - e.preventDefault() - if (count === 0) return - if (highlightedIndex.value === -1) { - highlightedIndex.value = Math.min(PAGE_JUMP - 1, count - 1) - } else { - highlightedIndex.value = Math.min(highlightedIndex.value + PAGE_JUMP, count - 1) - } - break - - case 'PageUp': - e.preventDefault() - if (count === 0) return - highlightedIndex.value = Math.max(highlightedIndex.value - PAGE_JUMP, 0) - break - - case 'Enter': { - const inputValueTrim = inputValue.value.trim() - if (!inputValueTrim) return - - e.preventDefault() - - // If an item is highlighted, select it - if (highlightedIndex.value >= 0 && highlightedIndex.value < count) { - addPackage(items[highlightedIndex.value]!.name) - return - } - - // Fallback: exact match, easter egg, or manual version spec entry (e.g. lodash@3.10.1) - if (showNoDependencyOption.value) { - addPackage(NO_DEPENDENCY_ID) - } else { - const parsed = parsePackageSpec(inputValueTrim) - const hasMatch = filteredResults.value.find(r => r.name === parsed.name) - if (hasMatch || parsed.version) { - addPackage(inputValueTrim) - } - } - break - } - - case 'Escape': - inputValue.value = '' - highlightedIndex.value = -1 - break - } + if (exactMatch || parsePackageSpec(query).version) addPackage(query) } -// Reset highlight when user types -watch(inputValue, () => { - highlightedIndex.value = -1 -}) - -// Scroll highlighted item into view -watch(highlightedIndex, index => { - if (index >= 0 && listRef.value) { - const items = listRef.value.querySelectorAll('[data-navigable]') - const item = items[index] as HTMLElement | undefined - item?.scrollIntoView({ block: 'nearest' }) - } -}) - -const containerRef = useTemplateRef('containerRef') - -onClickOutside(containerRef, () => { - isInputFocused.value = false - highlightedIndex.value = -1 -}) - const versionHintId = useId() @@ -235,93 +112,33 @@ const versionHintId = useId() -
-
- - - / + + + + ({ >