import unpublished modules from pkg.pr.new#868
Conversation
✅ Deploy Preview for livecodes ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughAdded documentation and tests to support two new module specifier prefixes ( Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Developer
participant Resolver as ModuleResolver
participant CDN as esm.sh
Dev->>Resolver: import "jsr:pkg@version"
activate Resolver
Note right of Resolver #D6EAF8: Detect prefix: jsr:
Resolver->>CDN: GET /jsr/pkg@version
CDN-->>Resolver: 200 OK (module)
Resolver-->>Dev: Resolved URL
deactivate Resolver
Dev->>Resolver: import "pr:pkg@version"
activate Resolver
Note right of Resolver #FDEBD0: Detect prefix: pr:
Resolver->>CDN: GET /pr/pkg@version
CDN-->>Resolver: 200 OK (module)
Resolver-->>Dev: Resolved URL
deactivate Resolver
Dev->>Resolver: import "pkg.pr.new:pkg@version"
activate Resolver
Note right of Resolver #E8F8F5: Detect prefix: pkg.pr.new:
Resolver->>CDN: GET /pkg.pr.new/pkg@version
CDN-->>Resolver: 200 OK (module)
Resolver-->>Dev: Resolved URL
deactivate Resolver
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Size Change: +1.43 kB (+0.15%) Total Size: 949 kB ℹ️ View Unchanged
|
Deploying livecodes with
|
| Latest commit: |
eee9b67
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0f5ab3b9.livecodes.pages.dev |
| Branch Preview URL: | https://import-from-pkg-pr-new.livecodes.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/livecodes/services/__tests__/modulesService.spec.ts (1)
43-46: Add negative and query-param cases to harden tests.
- Add a negative test to ensure similar-looking prefixes don’t match:
+ // should NOT match pkg.pr.new template + expect(url('pkgXprYnew:uuid@10')).toEqual('https://esm.sh/pkgXprYnew:uuid@10');
- Verify
externalquery propagation works with esm.sh-backed aliases:+ expect(url('pr:uuid@10', { external: 'react' })).toEqual('https://esm.sh/pr/uuid@10?external=react'); + expect(url('pkg.pr.new:uuid@10', { external: 'react' })).toEqual('https://esm.sh/pkg.pr.new/uuid@10?external=react');docs/docs/features/module-resolution.mdx (2)
138-151: Show apkg.pr.new:example and clarify it resolves via esm.sh.Add a concrete example and one-line clarification for where these resolve.
-Use the prefix `pr:` or `pkg.pr.new:`. +Use the prefix `pr:` or `pkg.pr.new:`. Both resolve via esm.sh. @@ ```js import { Bench } from 'pr:tinybench@a832a55'; // or // import { Bench } from 'pr:tinylibs/tinybench/tinybench@a832a55'; +// or using pkg.pr.new: +// import { Bench } from 'pkg.pr.new:tinybench@a832a55';--- `182-185`: **Consider grouping alias-like prefixes separately from true CDNs.** `pr:` and `pkg.pr.new:` (like `jsr:`) are aliases routed through esm.sh, not independent CDNs. A short “Aliases” subsection or note would reduce confusion and avoid duplication with the new section above. </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 8d99d68700db0c8b7b47803a0a1ba9fdbc15f9ea and 2cd50eab069acb1eff5e1505a7afbb1233dc7aee. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `docs/docs/features/module-resolution.mdx` (2 hunks) * `src/livecodes/services/__tests__/modulesService.spec.ts` (1 hunks) * `src/livecodes/services/modules.ts` (1 hunks) </details> <details> <summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)</summary> * GitHub Check: Codacy Static Code Analysis * GitHub Check: Redirect rules - livecodes * GitHub Check: Header rules - livecodes * GitHub Check: Pages changed - livecodes * GitHub Check: build * GitHub Check: build (18.x) * GitHub Check: tests (18.x, 2) * GitHub Check: tests (18.x, 1) * GitHub Check: tests (18.x, 5) * GitHub Check: tests (18.x, 4) * GitHub Check: tests (18.x, 3) * GitHub Check: type-check (18.x) * GitHub Check: build (18.x) * GitHub Check: type-check (18.x) </details> <details> <summary>🔇 Additional comments (2)</summary><blockquote> <details> <summary>src/livecodes/services/modules.ts (1)</summary><blockquote> `123-124`: **Good addition: `pr:` prefix mapped via esm.sh.** Regex and replacement look consistent with existing patterns and integrate with `external` param logic. </blockquote></details> <details> <summary>src/livecodes/services/__tests__/modulesService.spec.ts (1)</summary><blockquote> `41-42`: **Coverage for `jsr:` looks good.** Expectation matches the template behavior. </blockquote></details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
|



Summary by CodeRabbit
New Features
Documentation
Tests