Skip to content

Commit e58e576

Browse files
kixelatedclaude
andauthored
docs: prefer esm.sh over jsDelivr for no-build CDN usage (#1584)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 867b61c commit e58e576

5 files changed

Lines changed: 50 additions & 45 deletions

File tree

doc/lib/js/@moq/publish.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ npm add @moq/publish
2121
### No-build CDN usage
2222

2323
For quick demos or single-page embeds where a bundler is overkill, load the
24-
package straight from jsDelivr with the `+esm` endpoint. jsDelivr transforms
25-
the published file and rewrites bare imports (like `@moq/hang`, `@moq/net`)
26-
to other `+esm` URLs, so it loads in the browser with no import map or local
27-
build step:
24+
package straight from [esm.sh](https://esm.sh). esm.sh serves the package as a
25+
browser-ready ESM module and rewrites bare imports (like `@moq/hang`,
26+
`@moq/net`) to other esm.sh URLs, so it loads in the browser with no import map
27+
or local build step:
2828

2929
```html
3030
<script type="module">
31-
import "https://cdn.jsdelivr.net/npm/@moq/publish/element.js/+esm";
32-
import "https://cdn.jsdelivr.net/npm/@moq/publish/ui/index.js/+esm";
31+
import "https://esm.sh/@moq/publish/element";
32+
import "https://esm.sh/@moq/publish/ui";
3333
</script>
3434

3535
<moq-publish-ui>
@@ -39,9 +39,10 @@ build step:
3939
</moq-publish-ui>
4040
```
4141

42-
Pin a version range in the URL for production — e.g.
43-
`https://cdn.jsdelivr.net/npm/@moq/publish@0.2/element.js/+esm`. [esm.sh](https://esm.sh)
44-
(`https://esm.sh/@moq/publish/element`) works the same way if you prefer it.
42+
Pin a version range in the URL for production, e.g.
43+
`https://esm.sh/@moq/publish@0.2/element`. jsDelivr's `+esm` endpoint
44+
(`https://cdn.jsdelivr.net/npm/@moq/publish/element.js/+esm`) works the same way
45+
if you prefer it.
4546

4647
For anything beyond embedding on a static page, install the package and use
4748
a real bundler (the examples below).

doc/lib/js/@moq/watch.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ npm add @moq/watch
2121
### No-build CDN usage
2222

2323
For quick demos or single-page embeds where a bundler is overkill, load the
24-
package straight from jsDelivr with the `+esm` endpoint. jsDelivr transforms
25-
the published file and rewrites bare imports (like `@moq/hang`, `@moq/net`)
26-
to other `+esm` URLs, so it loads in the browser with no import map or local
27-
build step:
24+
package straight from [esm.sh](https://esm.sh). esm.sh serves the package as a
25+
browser-ready ESM module and rewrites bare imports (like `@moq/hang`,
26+
`@moq/net`) to other esm.sh URLs, so it loads in the browser with no import map
27+
or local build step:
2828

2929
```html
3030
<script type="module">
31-
import "https://cdn.jsdelivr.net/npm/@moq/watch/element.js/+esm";
32-
import "https://cdn.jsdelivr.net/npm/@moq/watch/ui/index.js/+esm";
31+
import "https://esm.sh/@moq/watch/element";
32+
import "https://esm.sh/@moq/watch/ui";
3333
</script>
3434

3535
<moq-watch-ui>
@@ -40,8 +40,9 @@ build step:
4040
```
4141

4242
Pin a version range in the URL for production, e.g.
43-
`https://cdn.jsdelivr.net/npm/@moq/watch@0.2/element.js/+esm`. [esm.sh](https://esm.sh)
44-
(`https://esm.sh/@moq/watch/element`) works the same way if you prefer it.
43+
`https://esm.sh/@moq/watch@0.2/element`. jsDelivr's `+esm` endpoint
44+
(`https://cdn.jsdelivr.net/npm/@moq/watch/element.js/+esm`) works the same way
45+
if you prefer it.
4546

4647
For anything beyond embedding on a static page, install the package and use
4748
a real bundler (the examples below).

doc/lib/js/env/web.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,30 @@ description: Web Components API reference
1717
## Loading From a CDN (No Bundler)
1818

1919
For quick demos or embeds on a static page, both `@moq/watch` and
20-
`@moq/publish` can be loaded straight from jsDelivr with no build step.
21-
Appending `/+esm` to the URL tells jsDelivr to transform the file and
22-
rewrite bare imports (like `@moq/hang`, `@moq/net`) to other `+esm`
23-
URLs, so it loads in the browser without an import map:
20+
`@moq/publish` can be loaded straight from [esm.sh](https://esm.sh) with no
21+
build step. esm.sh serves each package as a browser-ready ESM module and
22+
rewrites bare imports (like `@moq/hang`, `@moq/net`) to other esm.sh URLs, so
23+
it loads in the browser without an import map:
2424

2525
```html
2626
<script type="module">
27-
import "https://cdn.jsdelivr.net/npm/@moq/watch/element.js/+esm";
28-
import "https://cdn.jsdelivr.net/npm/@moq/publish/element.js/+esm";
27+
import "https://esm.sh/@moq/watch/element";
28+
import "https://esm.sh/@moq/publish/element";
2929
</script>
3030

3131
<moq-watch url="https://relay.example.com/anon" name="room/alice.hang">
3232
<canvas></canvas>
3333
</moq-watch>
3434
```
3535

36-
Pin a version range in the URL for production — e.g.
37-
`https://cdn.jsdelivr.net/npm/@moq/watch@0.2/element.js/+esm`. [esm.sh](https://esm.sh)
38-
(`https://esm.sh/@moq/watch/element`) works the same way if you prefer it.
36+
Pin a version range in the URL for production, e.g.
37+
`https://esm.sh/@moq/watch@0.2/element`. jsDelivr's `+esm` endpoint
38+
(`https://cdn.jsdelivr.net/npm/@moq/watch/element.js/+esm`) works the same way
39+
if you prefer it.
3940

4041
This is the fastest way to try MoQ in a blog post or demo page, but for
4142
real apps you should [install the packages](#available-components) and
42-
use a bundler — you'll get tree-shaking, offline dev, and no dependency
43+
use a bundler. You'll get tree-shaking, offline dev, and no dependency
4344
on a third-party CDN's availability.
4445

4546
## Available Components

js/publish/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ npm add @moq/publish
1919

2020
### No-build CDN usage
2121

22-
For quick demos or embeds where a bundler is overkill, jsDelivr's `+esm`
23-
endpoint will transform the published npm package into a browser-ready ESM
24-
module — bare imports like `@moq/hang` are automatically rewritten to
25-
other `+esm` URLs. No build step or import map required:
22+
For quick demos or embeds where a bundler is overkill, esm.sh serves the
23+
published npm package as a browser-ready ESM module. Bare imports like
24+
`@moq/hang` are automatically rewritten to other esm.sh URLs. No build step or
25+
import map required:
2626

2727
```html
2828
<script type="module">
29-
import "https://cdn.jsdelivr.net/npm/@moq/publish/element.js/+esm";
30-
import "https://cdn.jsdelivr.net/npm/@moq/publish/ui/element.js/+esm";
29+
import "https://esm.sh/@moq/publish/element";
30+
import "https://esm.sh/@moq/publish/ui";
3131
</script>
3232

3333
<moq-publish-ui>
@@ -37,9 +37,10 @@ other `+esm` URLs. No build step or import map required:
3737
</moq-publish-ui>
3838
```
3939

40-
Pin a version range in the URL for production — e.g.
41-
`https://cdn.jsdelivr.net/npm/@moq/publish@0.2/element.js/+esm`. esm.sh
42-
(`https://esm.sh/@moq/publish/element`) works the same way if you prefer it.
40+
Pin a version range in the URL for production, e.g.
41+
`https://esm.sh/@moq/publish@0.2/element`. jsDelivr's `+esm` endpoint
42+
(`https://cdn.jsdelivr.net/npm/@moq/publish/element.js/+esm`) works the same way
43+
if you prefer it.
4344

4445
For anything beyond embedding on a static page you should install the
4546
package and use a real bundler (the examples below).

js/watch/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ npm add @moq/watch
1919

2020
### No-build CDN usage
2121

22-
For quick demos or embeds where a bundler is overkill, jsDelivr's `+esm`
23-
endpoint will transform the published npm package into a browser-ready ESM
24-
module — bare imports like `@moq/hang` are automatically rewritten to
25-
other `+esm` URLs. No build step or import map required:
22+
For quick demos or embeds where a bundler is overkill, esm.sh serves the
23+
published npm package as a browser-ready ESM module. Bare imports like
24+
`@moq/hang` are automatically rewritten to other esm.sh URLs. No build step or
25+
import map required:
2626

2727
```html
2828
<script type="module">
29-
import "https://cdn.jsdelivr.net/npm/@moq/watch/element.js/+esm";
30-
import "https://cdn.jsdelivr.net/npm/@moq/watch/ui/element.js/+esm";
29+
import "https://esm.sh/@moq/watch/element";
30+
import "https://esm.sh/@moq/watch/ui";
3131
</script>
3232

3333
<moq-watch-ui>
@@ -37,9 +37,10 @@ other `+esm` URLs. No build step or import map required:
3737
</moq-watch-ui>
3838
```
3939

40-
Pin a version range in the URL for production — e.g.
41-
`https://cdn.jsdelivr.net/npm/@moq/watch@0.2/element.js/+esm`. esm.sh
42-
(`https://esm.sh/@moq/watch/element`) works the same way if you prefer it.
40+
Pin a version range in the URL for production, e.g.
41+
`https://esm.sh/@moq/watch@0.2/element`. jsDelivr's `+esm` endpoint
42+
(`https://cdn.jsdelivr.net/npm/@moq/watch/element.js/+esm`) works the same way
43+
if you prefer it.
4344

4445
For anything beyond embedding on a static page you should install the
4546
package and use a real bundler (the examples below).

0 commit comments

Comments
 (0)