You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(cdn): add JSPM-locked import map and loader. - #110
Generate release-specific maps from a tracked dependency lock.
Add stable loader and host-owned import-map APIs.
Validate candidate graphs in Chromium.
❌ Patch coverage is 98.80952% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.50%. Comparing base (f8ac733) to head (30160ab).
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Unresolved import-map validation gaps allow host mappings to override locked entries or create different React instances, undermining the loader’s locked-graph and shared-instance guarantees.
Normalize URL-like import-map keys before conflict checks
src/cdn-stable.ts:348
A host key such as //ga.jspm.io/npm:@knighted/jsx@2.0.0-alpha.1/dist/index.js is normalized by the browser to the locked absolute URL, but the conflict lookup misses it. The loader can therefore import the host's replacement instead of the locked entry. Normalize URL-like keys in both global and scoped mappings before checking conflicts, while preserving bare specifiers.
Check peer resolution against the application's importing module
src/cdn-stable.ts:412
With a page at /index.html and a host /app/ scope mapping react elsewhere, /app/main.js can load successfully but receive a different React instance from the locked helpers. Checking only document.baseURI misses this visible conflict and breaks the documented shared-instance behavior. Validate peer resolution for the application's importing module through an explicit referrer URL, or conservatively check visible host scopes.
Allow isolated package scopes to override inherited host mappings
src/cdn-stable.ts:429
A host's global magic-string mapping to another version makes the loader fail, although the generated JSX package scope could isolate its locked version without changing the host mapping. Distinguish inherited fallbacks from conflicting mappings at the same or more-specific scope. Update createMissingImportMap as well so a differing inherited target does not suppress the required scoped mapping.
Revalidate host import maps after cached installation
src/cdn-stable.ts:478
A successful installation bypasses conflict checking on every later call. After loading core, the host can add a more-specific JSX React scope pointing react elsewhere; a subsequent React-entry load returns this cached promise and loads against that conflicting scope, producing a different React instance. Keep installation idempotent, but revalidate visible host maps after awaiting the cached installation.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Unresolved import-map resolution and validation defects can load unintended dependency versions, omit required global imports, and reject compatible host mappings.
Normalize URL-like import-map keys before conflict checks
src/cdn-stable.ts:356
Browser import maps normalize URL-like keys before matching, but this lookup compares the original JSON keys verbatim. For example, a host key ending in /dist/./index.js is equivalent to the locked /dist/index.js URL in the browser, yet the conflict check misses it and allows the entry to load from a replacement URL. Normalize URL-like keys against the map's base URL before using them for conflict detection and missing-mapping calculation.
Merge host maps using browser first-mapping-wins semantics
src/cdn-stable.ts:396
If one host script globally maps oxc-parser to another version and a second supplies the canonical parser in the JSX package scope, the browser uses the scoped mapping, but this loop rejects the first script's global fallback. This prevents compatible dependency versions from coexisting when mappings are split across scripts. Merge normalized host maps using the browser's first-mapping-wins rules, then use that effective map for validation and missing-mapping calculation.
Validate entry remappings against the helper's actual referrer
src/cdn-stable.ts:413
With the documented jsDelivr bootstrap, a host scope covering cdn-stable.js can remap the absolute core entry URL without matching the document URL or any generated JSPM scope. The checks then pass, but import(url) loads the replacement because its referrer is import.meta.url, not document.baseURI. Check entry URL remappings against the helper's actual referrer before installing the map.
Allow unrelated global versions when scoped mappings preserve the locked graph
src/cdn-stable.ts:429
A host application that globally maps magic-string to 0.30.20 is rejected here, even though the generated JSX scope could safely resolve its own imports to 0.30.21 while preserving the application's version. The check compares against the host's global fallback before adding the generated scope, and createMissingImportMap also treats that fallback as an existing scoped mapping. Determine conflicts after composing the missing scoped mappings, rejecting mappings that would still override the locked graph rather than unrelated global dependency versions.
Don't treat document-scoped imports as global mappings
src/cdn-stable.ts:450
A mapping inside a document-specific scope does not supply a global import. For example, a host map with react only in the scope https://app.example/index.html causes this check to omit imports.react, so an external https://app.example/app.js module cannot import react after setup. Determine missing top-level mappings from the host maps' imports tables only, rather than their effective resolution at the document URL.
Revalidate host maps before importing additional entries
src/cdn-stable.ts:479
Caching installation also skips conflict validation on every later load. After loading only core, the host can append a more-specific JSX React scope pointing to a different React URL; requesting react afterward bypasses the checks and loads reactJsx with a different React instance from the installed ReactDOM graph. Keep map insertion idempotent, but revalidate the current host maps before importing additional entries.
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generate release-specific maps from a tracked dependency lock.
Add stable loader and host-owned import-map APIs.
Validate candidate graphs in Chromium.