forked from
npmx.dev/npmx.dev
[READ-ONLY]
a fast, modern browser for the npm registry
1import * as dev from '../types/lexicons/dev'
2
3// Duration
4export const CACHE_MAX_AGE_ONE_MINUTE = 60
5export const CACHE_MAX_AGE_FIVE_MINUTES = 60 * 5
6export const CACHE_MAX_AGE_ONE_HOUR = 60 * 60
7export const CACHE_MAX_AGE_ONE_DAY = 60 * 60 * 24
8export const CACHE_MAX_AGE_ONE_YEAR = 60 * 60 * 24 * 365
9
10// API Strings
11export const NPMX_SITE = 'https://npmx.dev'
12export const BLUESKY_API = 'https://public.api.bsky.app'
13export const BLUESKY_COMMENTS_REQUEST = '/api/atproto/bluesky-comments'
14export const NPM_REGISTRY = 'https://registry.npmjs.org'
15export const NPM_API = 'https://api.npmjs.org'
16export const ERROR_PACKAGE_ANALYSIS_FAILED = 'Failed to analyze package.'
17export const ERROR_PACKAGE_VERSION_AND_FILE_FAILED = 'Version and file path are required.'
18export const ERROR_PACKAGE_REQUIREMENTS_FAILED =
19 'Package name, version, and file path are required.'
20export const ERROR_FILE_LIST_FETCH_FAILED = 'Failed to fetch file list.'
21export const ERROR_CALC_INSTALL_SIZE_FAILED = 'Failed to calculate install size.'
22export const NPM_MISSING_README_SENTINEL = 'ERROR: No README data found!'
23export const ERROR_JSR_FETCH_FAILED = 'Failed to fetch package from JSR registry.'
24export const ERROR_NPM_FETCH_FAILED = 'Failed to fetch package from npm registry.'
25export const ERROR_PROVENANCE_FETCH_FAILED = 'Failed to fetch provenance.'
26export const UNSET_NUXT_SESSION_PASSWORD = 'NUXT_SESSION_PASSWORD not set'
27export const ERROR_SUGGESTIONS_FETCH_FAILED = 'Failed to fetch suggestions.'
28export const ERROR_SKILLS_FETCH_FAILED = 'Failed to fetch skills.'
29export const ERROR_SKILL_NOT_FOUND = 'Skill not found.'
30export const ERROR_SKILL_FILE_NOT_FOUND = 'Skill file not found.'
31/** @public */
32export const ERROR_GRAVATAR_FETCH_FAILED = 'Failed to fetch Gravatar profile.'
33/** @public */
34export const ERROR_GRAVATAR_EMAIL_UNAVAILABLE = "User's email not accessible."
35export const ERROR_NEED_REAUTH = 'User needs to reauthenticate'
36
37// microcosm services
38export const CONSTELLATION_HOST = 'constellation.microcosm.blue'
39export const SLINGSHOT_HOST = 'slingshot.microcosm.blue'
40
41// ATProtocol
42// Refrences used to link packages to things that are not inherently atproto
43export const PACKAGE_SUBJECT_REF = (packageName: string) =>
44 `https://npmx.dev/package/${packageName}`
45// OAuth scopes as we add new ones we need to check these on certain actions. If not redirect the user to login again to upgrade the scopes
46export const LIKES_SCOPE = `repo:${dev.npmx.feed.like.$nsid}`
47
48// Theming
49export const ACCENT_COLORS = {
50 light: {
51 coral: 'oklch(0.70 0.19 14.75)',
52 amber: 'oklch(0.8 0.25 84.429)',
53 emerald: 'oklch(0.70 0.17 166.95)',
54 sky: 'oklch(0.70 0.15 230.318)',
55 violet: 'oklch(0.70 0.17 286.067)',
56 magenta: 'oklch(0.75 0.18 330)',
57 },
58 dark: {
59 coral: 'oklch(0.704 0.177 14.75)',
60 amber: 'oklch(0.828 0.165 84.429)',
61 emerald: 'oklch(0.792 0.153 166.95)',
62 sky: 'oklch(0.787 0.128 230.318)',
63 violet: 'oklch(0.78 0.148 286.067)',
64 magenta: 'oklch(0.78 0.15 330)',
65 },
66} as const
67
68export const BACKGROUND_THEMES = {
69 neutral: 'oklch(0.555 0 0)',
70 stone: 'oklch(0.555 0.013 58.123)',
71 zinc: 'oklch(0.555 0.016 285.931)',
72 slate: 'oklch(0.555 0.046 257.407)',
73 black: 'oklch(0.4 0 0)',
74} as const
75
76// Regex
77export const BSKY_POST_AT_URI_REGEX =
78 /^at:\/\/(did:plc:[a-z0-9]+)\/app\.bsky\.feed\.post\/([a-z0-9]+)$/