Commit 40f9a1e
[hub] Export HUB_URL constant for consumers (#1489)
This PR exports the `HUB_URL` constant from the hub package so that
consumers can directly access it in their applications.
## Changes
- Added `export { HUB_URL } from "./consts";` to
`packages/hub/src/index.ts`
- Added a "Constants" section to the README.md explaining the exported
HUB_URL constant and how to use it
## Usage Example
```ts
import { HUB_URL } from "@huggingface/hub";
console.log(HUB_URL); // https://huggingface.co
// Can be useful when constructing URLs or checking against the default URL
const customHubUrl = process.env.CUSTOM_HUB_URL || HUB_URL;
```
This is useful for applications that need to reference the default hub
URL or construct hub-related URLs in their code, without having to
define the constant themselves.
Fixes #1336.
> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `hg.mozilla.org`
> - Triggering command: `node ./dist/install.js ` (dns block)
> - `hub-ci.huggingface.co`
> - Triggering command: `node
/home/REDACTED/work/huggingface.js/huggingface.js/node_modules/.bin/../vitest/vitest.mjs
run ` (dns block)
> - `huggingface.co`
> - Triggering command: `node
/home/REDACTED/work/huggingface.js/huggingface.js/node_modules/.bin/../vitest/vitest.mjs
run ` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to my [firewall allow
list](https://gh.io/copilot/firewall-config)
>
> </details>
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: julien-c <[email protected]>1 parent 7cd79cd commit 40f9a1e
1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
0 commit comments