🌐 AI搜索 & 代理 主页
Skip to content

Commit 658b8b7

Browse files
authored
Merge pull request #18319 from jsdelivr/readme-update
Readme update
2 parents a6bc336 + ad671bd commit 658b8b7

File tree

1 file changed

+99
-33
lines changed

1 file changed

+99
-33
lines changed

README.md

Lines changed: 99 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ Related projects:
77

88
**We are looking for contributors.** Please check open issues in the above repos if you think you could help, or open a new one if you have an idea you'd like to discuss.
99

10-
### Note: Our backend changed. [Learn how to use the new jsDelivr](#usage)
11-
1210
jsDelivr is a free CDN for open source files. We are tightly integrated with Github and npm allowing us to automatically provide a reliable CDN service to almost every open source project out there.
1311

1412
We offer a stable CDN that can be used in production on popular websites with huge amounts of traffic.
1513
There are no bandwidth limits or premium features and its completely free to use by anybody.
1614

15+
1716
### [How does it work - A simple infographic](https://www.jsdelivr.com/network/infographic)
1817

1918

@@ -35,15 +34,15 @@ On top of that we also do version-fallback. This means that if a file used in ve
3534
Multi-CDN
3635
---------
3736

38-
Unlike the competition, jsDelivr uses multiple CDN providers, resulting in the best possible uptime and performance. We currently use [Stackpath][7], [CloudFlare][8], and [Fastly][14]. In mainland China we use [Quantil](https://www.quantil.com/).
37+
Unlike the competition, jsDelivr uses multiple CDN providers, resulting in the best possible uptime and performance. We currently use [CloudFlare][8], and [Fastly][14]. In mainland China we use [Quantil](https://www.quantil.com/).
3938

4039
If a CDN goes down, websites that use jsDelivr won't have any issues because all traffic will be instantly redirected to remaining operational providers.
4140

4241

4342
Smart Load Balancing
4443
--------------------
4544

46-
jsDelivr uses real user performance data (also known as RUM) to make its routing decisions. These metrics are gathered from hundreds of websites and are used in our load balancing algorithm to make accurate decisions for serving content. Part of the logic is hosted close to users for optimal performance thanks to [edge hosting by appfleet](https://appfleet.com/)
45+
jsDelivr uses real user performance data (also known as RUM) to make its routing decisions. These metrics are gathered from hundreds of websites and are used in our load balancing algorithm to make accurate decisions for serving content.
4746

4847
All providers (CDNs and custom servers) are tested millions times per day by real users from all over the world. Based on this information, jsDelivr knows what provider is the fastest for each user. Each user gets a unique response based on his or her location, ISP, and the providers' uptime in real time.
4948

@@ -66,12 +65,6 @@ Our origin consits of multiple servers in different data-centers. If a server go
6665
In total we have one of the most resilient systems out there, ready to be used in production by even the biggest companies.
6766

6867

69-
HTTP2
70-
-----------------
71-
72-
All of our POPs support HTTP2 offering better performance to all users.
73-
74-
7568
China
7669
----------------
7770

@@ -82,62 +75,86 @@ jsDelivr works perfectly inside China!
8275

8376
# Usage
8477

85-
jsDelivr can instantly serve any file from any npm package in the public registry.
78+
jsDelivr provides mirrors for npm, GitHub, WordPress plugins, and custom endpoints for several other projects with special requirements. If our regular endpoints don't work for your use case, [let us know](mailto:dak@prospectone.io) and we'll figure something out!
8679

87-
New versions pushed to npm are instantly available via our CDN as well. No maintenance is required.
80+
If you are a package author, check our [tips for package authors](#Publishing-packages) to make using your package as easy as possible.
8881

89-
If a package, version or file gets removed from npm then jsDelivr will continue to serve that file from our permanent storage without breaking any websites using it.
82+
#### Root endpoint is always `https://cdn.jsdelivr.net`
9083

9184
npm
9285
---
86+
jsDelivr can instantly serve any file from any npm package in the public registry.
87+
New versions pushed to npm are instantly available via our CDN as well. No maintenance is required.
88+
89+
If a package, version or file gets removed from npm then jsDelivr will continue to serve that file from our permanent storage without breaking any websites using it.
90+
91+
We use a permanent S3 storage to ensure all files remain available even if npm goes down, or a package is deleted by its author. Files are fetched directly from npm only the first time, or when S3 goes down.
92+
9393

94-
Load any project hosted on npm:
94+
##### Load any project hosted on npm:
9595

9696
```
9797
/npm/package@version/file
9898
```
9999

100-
Load exact version:
100+
##### Load exact version:
101101

102102
```
103103
/npm/jquery@3.1.0/dist/jquery.min.js
104104
```
105105

106-
Use a version range instead of an exact version:
106+
##### Use a version range instead of an exact version:
107107

108108
```
109109
/npm/jquery@3/dist/jquery.min.js
110110
/npm/jquery@3.1/dist/jquery.min.js
111111
```
112+
---
113+
**NOTE**
114+
115+
If you use this feature and a file you requested is not available in the newest version of the package, the link will keep working thanks to our version-fallback feature. We'll continue to serve the file from older version of the package instead of failing with a 404 error.
116+
117+
---
112118

113-
Load by tag: (Not recommended for production usage)
119+
120+
##### Load by tag (Not recommended for production usage):
114121

115122
```
116123
/npm/jquery@beta/dist/jquery.min.js
117124
```
118125

119-
Omit the version completely or use "latest" to load the latest one: (Dev environment only)
126+
##### Omit the version completely or use "latest" to load the latest one (not recommended for production usage):
120127

121128
```
122129
/npm/jquery@latest/dist/jquery.min.js
123130
/npm/jquery/dist/jquery.min.js
124131
```
132+
---
133+
**NOTE**
134+
Requesting the latest version (as opposed to "latest major" or "latest minor") is dangerous because major versions usually come with breaking changes. Only do this if you really know what you are doing.
125135

126-
Add ".min" to any JS/CSS file to get a minified version - if one doesn't exist, we'll generate it for you. All generated files come with source maps and can be easily used during development:
136+
---
137+
138+
##### Add ".min" to any JS/CSS file to get a minified version - if one doesn't exist, we'll generate it for you. All generated files come with source maps and can be easily used during development:
127139

128140
```
129141
/npm/github-markdown-css@2.4.1/github-markdown.min.css
130142
```
143+
---
144+
**NOTE**
145+
Minifying a large file can take several seconds. However, we store all generated files in our permanent storage, so this delay only applies to the first few requests.
146+
147+
---
131148

132-
Omit the file path to get the [default file](#configuring-a-default-file-in-packagejson). This file is always minified:
149+
##### Omit the file path to get the [default file](#configuring-a-default-file-in-packagejson). This file is always minified:
133150

134151
```
135152
/npm/jquery@3.1.0
136153
/npm/jquery@3
137154
/npm/jquery
138155
```
139156

140-
Get a directory listing:
157+
##### Get a directory listing:
141158

142159
```
143160
/npm/jquery@3.1.0/
@@ -146,41 +163,60 @@ Get a directory listing:
146163

147164
GitHub
148165
------
166+
We recommend using npm for projects that support it for better UX - npm packages are searchable on our website, and package pages show additional useful information, such as description and link to homepage.
167+
168+
We use a permanent S3 storage to ensure all files remain available even if GitHub goes down, or a repository or a release is deleted by its author. Files are fetched directly from GitHub only the first time, or when S3 goes down.
149169

150-
Load any GitHub release, commit, or branch:
170+
##### Load any GitHub release, commit, or branch:
151171

152172
```
153173
/gh/user/repo@version/file
154174
```
155175

156-
Load exact version:
176+
##### Load exact version:
157177

158178
```
159179
/gh/jquery/jquery@3.1.0/dist/jquery.min.js
160180
/gh/jquery/jquery@32b00373b3f42e5cdcb709df53f3b08b7184a944/dist/jquery.min.js
161181
```
162182

163-
Use a version range instead of an exact version (only works with valid semver versions):
183+
##### Use a version range instead of an exact version (only works with valid semver versions):
164184

165185
```
166186
/gh/jquery/jquery@3/dist/jquery.min.js
167187
/gh/jquery/jquery@3.1/dist/jquery.min.js
168188
```
189+
---
190+
**NOTE**
191+
If you use this feature and a file you requested is not available in the newest release, the link will keep working thanks to our version-fallback feature. We'll continue to serve the file from older release instead of failing with a 404 error.
169192

170-
Omit the version completely or use "latest" to load the latest one (only works with valid semver versions): (Dev environment only)
193+
---
194+
195+
##### Omit the version completely or use "latest" to load the latest one (only works with valid semver versions): (Dev environment only)
171196

172197
```
173198
/gh/jquery/jquery@latest/dist/jquery.min.js
174199
/gh/jquery/jquery/dist/jquery.min.js
175200
```
201+
---
202+
**NOTE**
203+
Requesting the latest version (as opposed to "latest major" or "latest minor") is dangerous because major versions usually come with breaking changes. Only do this if you really know what you are doing.
176204

177-
Add ".min" to any JS/CSS file to get a minified version - if one doesn't exist, we'll generate it for you. All generated files come with source maps and can be easily used during development:
205+
---
206+
207+
208+
##### Add ".min" to any JS/CSS file to get a minified version - if one doesn't exist, we'll generate it for you. All generated files come with source maps and can be easily used during development:
178209

179210
```
180-
/gh/sindresorhus/github-markdown-css@v2.4.1/github-markdown.min.css
211+
/gh/jquery/jquery@3.2.1/src/core.min.js
181212
```
213+
---
214+
**NOTE**
215+
Minifying a large file can take several seconds. However, we store all generated files in our permanent storage, so this delay only applies to the first few requests.
182216

183-
Get a directory listing:
217+
---
218+
219+
##### Get a directory listing:
184220

185221
```
186222
/gh/jquery/jquery@3.1.0/
@@ -190,7 +226,7 @@ Get a directory listing:
190226
Combine multiple files
191227
----------------------
192228

193-
Our combine endpoint has the following format:
229+
Our combine endpoint allows you to load several files from npm and GitHub endpoints in one request:
194230

195231
```
196232
/combine/url1,url2,url3
@@ -204,6 +240,11 @@ Examples:
204240
/combine/gh/jquery/jquery@3.1/dist/jquery.min.js,gh/twbs/bootstrap@3.3/dist/js/bootstrap.min.js
205241
/combine/npm/bootstrap@3.3/dist/css/bootstrap.min.css,npm/bootstrap@3.3/dist/css/bootstrap-theme.min.css
206242
```
243+
---
244+
**NOTE**
245+
Combining large/many files can take several seconds. However, we store all generated files in our permanent storage, so this delay only applies to the first few requests.
246+
247+
---
207248

208249
Publishing packages
209250
-------------------
@@ -224,6 +265,12 @@ All packages hosted on npm and tagged releases on GitHub are automatically avail
224265
3. `main`
225266

226267
We will first attempt to locate a minified version of the file provided here (by removing the extension, and looking for the same file `.min.js`). If we can't find one we will minify ourselves.
268+
269+
Be advised that you must include file extension in the values, for example:
270+
```
271+
"main": "./index" // this will NOT work
272+
"main": "./index.js" // this is the correct way
273+
```
227274

228275
Restrictions
229276
-------------------
@@ -233,24 +280,42 @@ Restrictions
233280
WordPress
234281
---------
235282

236-
Our WordPress endpoint works for plugins hosted in the [WordPress.org plugin directory](https://WordPress.org/plugins), and mirrors [the WordPress.org plugins SVN repo](https://plugins.svn.wordpress.org/) has the following format:
283+
Our WordPress endpoint works for plugins and themes hosted in the [WordPress.org plugin directory](https://WordPress.org/plugins) and [Wordpress.org theme directory](https://wordpress.org/themes/), and mirrors [the WordPress.org plugins SVN repo](https://plugins.svn.wordpress.org/).
237284

285+
##### Load any plugin from the WordPress.org plugins SVN repo:
238286
```
239287
/wp/project/tags/version/file
240288
```
241289

242-
Load exact version:
290+
##### Load exact version:
243291

244292
```
245293
/wp/wp-slimstat/tags/4.6.5/wp-slimstat.js
246294
```
247295

248-
Load latest version: (Dev environment only)
296+
##### Load latest version (not recommended for production usage):
249297

250298
```
251299
/wp/wp-slimstat/trunk/wp-slimstat.js
252300
```
253301

302+
##### Load any theme from the WordPress.org themes SVN repo:
303+
```
304+
https://cdn.jsdelivr.net/wp/themes/project/version/file
305+
```
306+
307+
##### Load an exact version of a file:
308+
309+
```
310+
https://cdn.jsdelivr.net/wp/themes/twenty-eightteen/1.7/assets/js/html5.js
311+
```
312+
313+
##### Add ".min" to any JS/CSS file to get a minified version - if one doesn't exist, we'll generate it for you. All generated files come with source maps and can be easily used during development:
314+
315+
```
316+
https://cdn.jsdelivr.net/wp/themes/twenty-eightteen/1.7/assets/js/html5.min.js
317+
```
318+
254319
Purge cache
255320
---
256321

@@ -276,6 +341,8 @@ Current OSS projects using custom configs:
276341

277342
* [webjars](http://www.webjars.org/)
278343
* webpack [webpackbin](https://www.webpackbin.com/) and [codesandbox](https://codesandbox.io/)
344+
* [emojione.com](https://www.emojione.com/)
345+
* [hex.pm](https://hex.pm/)
279346

280347

281348
Privacy Policy
@@ -289,7 +356,6 @@ jsDelivr does not store any user data and does not track any users in any way.
289356

290357
Here are the relevant policies of our CDN providers:
291358
* [Cloudflare](https://www.cloudflare.com/security-policy/)
292-
* [Stackpath](https://www.stackpath.com/legal/privacy-statement/)
293359
* [Fastly](https://www.fastly.com/privacy/)
294360
* Only in China [Quantil](https://www.quantil.com/privacy-and-security-policy/)
295361

0 commit comments

Comments
 (0)