Skip to content

Commit 264033e

Browse files
authored
Merge branch 'develop' into ripple
2 parents a57b44a + e14dcce commit 264033e

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

docs/docs/features/module-resolution.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,20 @@ If you want to bundle (and transpile) any import URL, prefix it with `bundle:` (
135135

136136
:::
137137

138+
## pkg.pr.new
139+
140+
Unpublished npm packages can be imported while still under development using the [pkg.pr.new](https://pkg.pr.new/) service.
141+
142+
Use the prefix `pr:` or `pkg.pr.new:`.
143+
144+
Example:
145+
146+
```js
147+
import { Bench } from 'pr:tinybench@a832a55';
148+
// or
149+
// import { Bench } from 'pr:tinylibs/tinybench/tinybench@a832a55';
150+
```
151+
138152
## CDN Providers
139153

140154
By default, npm modules are imported from [esm.sh](https://esm.sh/). You may choose another provider by using a CDN prefix. These are examples of importing the library `uuid`:
@@ -165,6 +179,10 @@ By default, npm modules are imported from [esm.sh](https://esm.sh/). You may cho
165179

166180
`jsr:@std/uuid`https://esm.sh/jsr/@std/uuid ([info](https://esm.sh))
167181

182+
`pr:tinybench@a832a55`https://esm.sh/pr/tinybench@a832a55 ([info](https://esm.sh))
183+
184+
`pkg.pr.new:tinybench@a832a55`https://esm.sh/pkg.pr.new/tinybench@a832a55 ([info](https://esm.sh))
185+
168186
`jspm:uuid`https://jspm.dev/uuid ([info](https://jspm.org) - [DEPRECATED](https://jspm.org/jspm-dev-deprecation))
169187

170188
Example:

src/livecodes/services/__tests__/modulesService.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ describe('modulesService', () => {
3838

3939
expect(url('esm.sh:uuid')).toEqual('https://esm.sh/uuid');
4040

41+
expect(url('jsr:uuid')).toEqual('https://esm.sh/jsr/uuid');
42+
43+
expect(url('pr:uuid@10')).toEqual('https://esm.sh/pr/uuid@10');
44+
45+
expect(url('pkg.pr.new:uuid@10')).toEqual('https://esm.sh/pkg.pr.new/uuid@10');
46+
4147
expect(url('unpkg:uuid')).toEqual('https://unpkg.com/uuid?module');
4248

4349
expect(url('bundlejs:uuid')).toEqual('https://deno.bundlejs.com/?file&q=uuid');

src/livecodes/services/modules.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ const TEMPLATES: Array<[RegExp, string]> = [
120120

121121
[/^(jsr:)(.+)/i, 'https://esm.sh/jsr/$2'],
122122

123+
[/^(pr:)(.+)/i, 'https://esm.sh/pr/$2'],
124+
125+
[/^(pkg\.pr\.new:)(.+)/i, 'https://esm.sh/pkg.pr.new/$2'],
126+
123127
[/^(skypack:)(.+)/i, 'https://cdn.skypack.dev/$2'],
124128

125129
[/^(jsdelivr:)(.+)/i, 'https://cdn.jsdelivr.net/npm/$2'],

0 commit comments

Comments
 (0)