Skip to content

Commit

Permalink
fix: version resolver deduping
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Apr 28, 2024
1 parent 07928b5 commit 2c57ce4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/providers/jspm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ async function lookupRange(
const version = semverRange.bestMatch(versions, unstable);

if (version) {
return { registry, name, version };
return { registry, name, version: version.toString() };
}
throw new JspmError(
`Unable to resolve ${registry}:${name}@${range} to a valid version${importedFrom(
Expand Down
12 changes: 12 additions & 0 deletions test/api/version.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Generator } from "@jspm/generator";
import assert from "assert";

const generator = new Generator({
mapUrl: import.meta.url,
defaultProvider: "jspm.io",
env: ["production", "browser"],
});

await generator.install({ target: "@pyscript/[email protected]" });
const json = generator.getMap();
assert.ok(json);
32 changes: 16 additions & 16 deletions test/test.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<!-- Generated by @jspm/generator - https://github.com/jspm/generator -->
<script async src="https://ga.jspm.io/npm:es-module-shims@1.8.3/dist/es-module-shims.js" crossorigin="anonymous"></script>
<script async src="https://ga.jspm.io/npm:es-module-shims@1.10.0/dist/es-module-shims.js" crossorigin="anonymous"></script>
<script type="importmap">
{
"imports": {
Expand All @@ -10,32 +10,32 @@
"scopes": {
"../": {
"#fetch": "../dist/fetch-native.js",
"@babel/core": "https://ga.jspm.io/npm:@babel/[email protected].3/lib/index.js",
"@babel/core": "https://ga.jspm.io/npm:@babel/[email protected].4/lib/index.js",
"@babel/plugin-syntax-import-assertions": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/preset-typescript": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@jspm/import-map": "https://ga.jspm.io/npm:@jspm/[email protected]/dist/map.js",
"crypto": "https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/browser/crypto.js",
"es-module-lexer/js": "https://ga.jspm.io/npm:es-module-lexer@1.4.2/dist/lexer.asm.js",
"es-module-lexer/js": "https://ga.jspm.io/npm:es-module-lexer@1.5.2/dist/lexer.asm.js",
"fs": "https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/browser/fs.js",
"process": "https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/browser/process-production.js",
"sver": "https://ga.jspm.io/npm:[email protected]/sver.js",
"sver/convert-range.js": "https://ga.jspm.io/npm:[email protected]/convert-range.js",
"url": "https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/browser/url.js"
},
"https://ga.jspm.io/": {
"#lib/config/files/index.js": "https://ga.jspm.io/npm:@babel/[email protected].3/lib/config/files/index-browser.js",
"#lib/config/resolve-targets.js": "https://ga.jspm.io/npm:@babel/[email protected].3/lib/config/resolve-targets-browser.js",
"#lib/transform-file.js": "https://ga.jspm.io/npm:@babel/[email protected].3/lib/transform-file-browser.js",
"#lib/config/files/index.js": "https://ga.jspm.io/npm:@babel/[email protected].4/lib/config/files/index-browser.js",
"#lib/config/resolve-targets.js": "https://ga.jspm.io/npm:@babel/[email protected].4/lib/config/resolve-targets-browser.js",
"#lib/transform-file.js": "https://ga.jspm.io/npm:@babel/[email protected].4/lib/transform-file-browser.js",
"#node.js": "https://ga.jspm.io/npm:[email protected]/browser.js",
"@ampproject/remapping": "https://ga.jspm.io/npm:@ampproject/[email protected]/dist/remapping.umd.js",
"@babel/code-frame": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/compat-data/native-modules": "https://ga.jspm.io/npm:@babel/[email protected].1/native-modules.js",
"@babel/compat-data/plugins": "https://ga.jspm.io/npm:@babel/[email protected].1/plugins.js",
"@babel/core": "https://ga.jspm.io/npm:@babel/[email protected].3/lib/index.js",
"@babel/generator": "https://ga.jspm.io/npm:@babel/[email protected].1/lib/index.js",
"@babel/compat-data/native-modules": "https://ga.jspm.io/npm:@babel/[email protected].4/native-modules.js",
"@babel/compat-data/plugins": "https://ga.jspm.io/npm:@babel/[email protected].4/plugins.js",
"@babel/core": "https://ga.jspm.io/npm:@babel/[email protected].4/lib/index.js",
"@babel/generator": "https://ga.jspm.io/npm:@babel/[email protected].4/lib/index.js",
"@babel/helper-annotate-as-pure": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/helper-compilation-targets": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/helper-create-class-features-plugin": "https://ga.jspm.io/npm:@babel/[email protected].1/lib/index.js",
"@babel/helper-create-class-features-plugin": "https://ga.jspm.io/npm:@babel/[email protected].4/lib/index.js",
"@babel/helper-environment-visitor": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/helper-function-name": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/helper-hoist-variables": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
Expand All @@ -51,13 +51,13 @@
"@babel/helper-string-parser": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/helper-validator-identifier": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/helper-validator-option": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/helpers": "https://ga.jspm.io/npm:@babel/[email protected].1/lib/index.js",
"@babel/helpers": "https://ga.jspm.io/npm:@babel/[email protected].4/lib/index.js",
"@babel/highlight": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/parser": "https://ga.jspm.io/npm:@babel/[email protected].1/lib/index.js",
"@babel/parser": "https://ga.jspm.io/npm:@babel/[email protected].4/lib/index.js",
"@babel/plugin-syntax-jsx": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/plugin-syntax-typescript": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/plugin-transform-modules-commonjs": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/plugin-transform-typescript": "https://ga.jspm.io/npm:@babel/[email protected].1/lib/index.js",
"@babel/plugin-transform-typescript": "https://ga.jspm.io/npm:@babel/[email protected].4/lib/index.js",
"@babel/template": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/traverse": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
"@babel/types": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
Expand All @@ -69,13 +69,13 @@
"ansi-styles": "https://ga.jspm.io/npm:[email protected]/index.js",
"browserslist": "https://ga.jspm.io/npm:[email protected]/index.js",
"buffer": "https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/browser/buffer.js",
"caniuse-lite/dist/unpacker/agents": "https://ga.jspm.io/npm:[email protected].30001600/dist/unpacker/agents.js",
"caniuse-lite/dist/unpacker/agents": "https://ga.jspm.io/npm:[email protected].30001613/dist/unpacker/agents.js",
"chalk": "https://ga.jspm.io/npm:[email protected]/index.js",
"color-convert": "https://ga.jspm.io/npm:[email protected]/index.js",
"color-name": "https://ga.jspm.io/npm:[email protected]/index.js",
"convert-source-map": "https://ga.jspm.io/npm:[email protected]/index.js",
"debug": "https://ga.jspm.io/npm:[email protected]/src/browser.js",
"electron-to-chromium/versions": "https://ga.jspm.io/npm:[email protected].715/versions.js",
"electron-to-chromium/versions": "https://ga.jspm.io/npm:[email protected].745/versions.js",
"escape-string-regexp": "https://ga.jspm.io/npm:[email protected]/index.js",
"fs": "https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/browser/fs.js",
"gensync": "https://ga.jspm.io/npm:[email protected]/index.js",
Expand Down

0 comments on commit 2c57ce4

Please sign in to comment.