Skip to content

Commit 809de34

Browse files
authored
Merge branch 'main' into feat/add-versions-modal-permalink
2 parents 65b3d76 + c9e9821 commit 809de34

17 files changed

Lines changed: 239 additions & 143 deletions

File tree

CONTRIBUTING.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -289,18 +289,6 @@ import { hasProtocol } from 'ufo'
289289
| Constants | SCREAMING_SNAKE_CASE | `NPM_REGISTRY`, `ALLOWED_TAGS` |
290290
| Types/Interfaces | PascalCase | `NpmSearchResponse` |
291291

292-
> [!TIP]
293-
> Exports in `app/composables/`, `app/utils/`, and `server/utils/` are auto-imported by Nuxt. To prevent [knip](https://knip.dev/) from flagging them as unused, add a `@public` JSDoc annotation:
294-
>
295-
> ```typescript
296-
> /**
297-
> * @public
298-
> */
299-
> export function myAutoImportedFunction() {
300-
> // ...
301-
> }
302-
> ```
303-
304292
### Vue components
305293

306294
- Use Composition API with `<script setup lang="ts">`

app/composables/useActiveTocItem.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type { Ref } from 'vue'
77
*
88
* @param toc - Reactive array of TOC items
99
* @returns Object containing activeId
10-
* @public
1110
*/
1211
export function useActiveTocItem(toc: Ref<TocItem[]>) {
1312
const activeId = shallowRef<string | null>(null)

app/composables/useMarkdown.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ interface UseMarkdownOptions {
88
packageName?: string
99
}
1010

11-
/** @public */
1211
export function useMarkdown(options: MaybeRefOrGetter<UseMarkdownOptions>) {
1312
return computed(() => parseMarkdown(toValue(options)))
1413
}

modules/runtime/server/cache.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,44 @@ function getMockForUrl(url: string): MockResult | null {
195195
return { data: null }
196196
}
197197

198+
// npm attestations API - return empty attestations (provenance not needed in tests)
199+
if (host === 'registry.npmjs.org' && pathname.startsWith('/-/npm/v1/attestations/')) {
200+
return { data: { attestations: [] } }
201+
}
202+
203+
// Constellation API - return empty results for link queries
204+
if (host === 'constellation.microcosm.blue') {
205+
if (pathname === '/links/distinct-dids') {
206+
return { data: { total: 0, linking_dids: [], cursor: undefined } }
207+
}
208+
if (pathname === '/links/all') {
209+
return { data: { links: {} } }
210+
}
211+
if (pathname === '/xrpc/blue.microcosm.links.getBacklinks') {
212+
return { data: { total: 0, records: [], cursor: undefined } }
213+
}
214+
return { data: null }
215+
}
216+
217+
// UNGH (GitHub proxy) - return mock repo metadata
218+
if (host === 'ungh.cc') {
219+
const repoMatch = pathname.match(/^\/repos\/([^/]+)\/([^/]+)$/)
220+
if (repoMatch?.[1] && repoMatch?.[2]) {
221+
return {
222+
data: {
223+
repo: {
224+
description: `${repoMatch[1]}/${repoMatch[2]} - mock repo description`,
225+
stars: 1000,
226+
forks: 100,
227+
watchers: 50,
228+
defaultBranch: 'main',
229+
},
230+
},
231+
}
232+
}
233+
return { data: null }
234+
}
235+
198236
// GitHub API - handled via fixtures, return null to use fixture system
199237
// Note: The actual fixture loading is handled in fetchFromFixtures via special case
200238
if (host === 'api.github.com') {
@@ -426,6 +464,19 @@ async function handleGitHubApi(
426464
return { data: [] }
427465
}
428466

467+
// Commits endpoint: /repos/{owner}/{repo}/commits
468+
const commitsMatch = pathname.match(/^\/repos\/([^/]+)\/([^/]+)\/commits$/)
469+
if (commitsMatch) {
470+
// Return a single-item array; fetchPageCount will use body.length when no Link header
471+
return { data: [{ sha: 'mock-commit' }] }
472+
}
473+
474+
// Search endpoint: /search/issues, /search/commits, etc.
475+
const searchMatch = pathname.match(/^\/search\/(.+)$/)
476+
if (searchMatch) {
477+
return { data: { total_count: 0, incomplete_results: false, items: [] } }
478+
}
479+
429480
// Other GitHub API endpoints can be added here as needed
430481
return null
431482
}

nuxt.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import process from 'node:process'
22
import { currentLocales } from './config/i18n'
3-
import { isCI, provider } from 'std-env'
3+
import { isCI, isTest, provider } from 'std-env'
44

55
export default defineNuxtConfig({
66
modules: [
@@ -216,6 +216,9 @@ export default defineNuxtConfig({
216216
include: ['../test/unit/server/**/*.ts'],
217217
},
218218
},
219+
replace: {
220+
'import.meta.test': isTest,
221+
},
219222
},
220223

221224
fonts: {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"knip": "5.83.0",
133133
"lint-staged": "16.2.7",
134134
"oxfmt": "0.27.0",
135-
"oxlint": "1.49.0",
135+
"oxlint": "1.50.0",
136136
"schema-dts": "1.1.5",
137137
"simple-git-hooks": "2.13.1",
138138
"typescript": "5.9.3",

pnpm-lock.yaml

Lines changed: 108 additions & 108 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/utils/atproto/oauth.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,18 @@ export const handleResolver = new AtprotoDohHandleResolver({
1919
})
2020

2121
export function getOauthClientMetadata() {
22-
const dev = import.meta.dev
22+
const redirect_uri = `${clientUri}/api/auth/atproto`
2323

24-
const client_uri = clientUri
25-
const redirect_uri = `${client_uri}/api/auth/atproto`
26-
27-
const client_id = dev
28-
? `http://localhost?redirect_uri=${encodeURIComponent(redirect_uri)}&scope=${encodeURIComponent(scope)}`
29-
: `${client_uri}/oauth-client-metadata.json`
24+
const client_id =
25+
import.meta.dev || import.meta.test
26+
? `http://localhost?redirect_uri=${encodeURIComponent(redirect_uri)}&scope=${encodeURIComponent(scope)}`
27+
: `${clientUri}/oauth-client-metadata.json`
3028

3129
// If anything changes here, please make sure to also update /shared/schemas/oauth.ts to match
3230
return parse(OAuthMetadataSchema, {
3331
client_name: 'npmx.dev',
3432
client_id,
35-
client_uri,
33+
client_uri: clientUri,
3634
scope,
3735
redirect_uris: [redirect_uri] as [string, ...string[]],
3836
grant_types: ['authorization_code', 'refresh_token'],

server/utils/provenance.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ function repoUrlToBlobUrl(repository: string, path: string, ref = 'main'): strin
9090
/**
9191
* Parse npm attestations API response into ProvenanceDetails.
9292
* Prefers SLSA provenance v1; falls back to v0.2 for provider label and ledger only (no source commit/build file from v0.2).
93-
* @public
9493
*/
9594
export function parseAttestationToProvenanceDetails(response: unknown): ProvenanceDetails | null {
9695
const body = response as NpmAttestationsResponse

server/utils/skills.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ export interface SkillDirInfo {
7373
/**
7474
* Find skill directories in a package file tree.
7575
* Returns skill names and their children for file counting.
76-
* @public
7776
*/
7877
export function findSkillDirs(tree: PackageFileTree[]): SkillDirInfo[] {
7978
const skillsDir = tree.find(node => node.type === 'directory' && node.name === 'skills')
@@ -176,7 +175,6 @@ export function validateSkill(frontmatter: SkillFrontmatter): SkillWarning[] {
176175

177176
/**
178177
* Fetch skill list with frontmatter for discovery endpoint.
179-
* @public
180178
*/
181179
export async function fetchSkillsList(
182180
packageName: string,
@@ -215,7 +213,6 @@ export interface WellKnownSkillItem {
215213

216214
/**
217215
* Fetch skill list for well-known index.json format (CLI compatibility).
218-
* @public
219216
*/
220217
export async function fetchSkillsListForWellKnown(
221218
packageName: string,

0 commit comments

Comments
 (0)