Skip to content

Commit

Permalink
fix: version resolver deduping (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford authored Apr 28, 2024
1 parent 07928b5 commit 4c25cf6
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/core@0.4.21" });
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/core@7.24.3/lib/index.js",
"@babel/core": "https://ga.jspm.io/npm:@babel/core@7.24.4/lib/index.js",
"@babel/plugin-syntax-import-assertions": "https://ga.jspm.io/npm:@babel/plugin-syntax-import-assertions@7.24.1/lib/index.js",
"@babel/preset-typescript": "https://ga.jspm.io/npm:@babel/preset-typescript@7.24.1/lib/index.js",
"@jspm/import-map": "https://ga.jspm.io/npm:@jspm/import-map@1.0.8/dist/map.js",
"crypto": "https://ga.jspm.io/npm:@jspm/core@2.0.1/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/core@2.0.1/nodelibs/browser/fs.js",
"process": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/process-production.js",
"sver": "https://ga.jspm.io/npm:sver@1.8.4/sver.js",
"sver/convert-range.js": "https://ga.jspm.io/npm:sver@1.8.4/convert-range.js",
"url": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/url.js"
},
"https://ga.jspm.io/": {
"#lib/config/files/index.js": "https://ga.jspm.io/npm:@babel/core@7.24.3/lib/config/files/index-browser.js",
"#lib/config/resolve-targets.js": "https://ga.jspm.io/npm:@babel/core@7.24.3/lib/config/resolve-targets-browser.js",
"#lib/transform-file.js": "https://ga.jspm.io/npm:@babel/core@7.24.3/lib/transform-file-browser.js",
"#lib/config/files/index.js": "https://ga.jspm.io/npm:@babel/core@7.24.4/lib/config/files/index-browser.js",
"#lib/config/resolve-targets.js": "https://ga.jspm.io/npm:@babel/core@7.24.4/lib/config/resolve-targets-browser.js",
"#lib/transform-file.js": "https://ga.jspm.io/npm:@babel/core@7.24.4/lib/transform-file-browser.js",
"#node.js": "https://ga.jspm.io/npm:browserslist@4.23.0/browser.js",
"@ampproject/remapping": "https://ga.jspm.io/npm:@ampproject/remapping@2.3.0/dist/remapping.umd.js",
"@babel/code-frame": "https://ga.jspm.io/npm:@babel/code-frame@7.24.2/lib/index.js",
"@babel/compat-data/native-modules": "https://ga.jspm.io/npm:@babel/compat-data@7.24.1/native-modules.js",
"@babel/compat-data/plugins": "https://ga.jspm.io/npm:@babel/compat-data@7.24.1/plugins.js",
"@babel/core": "https://ga.jspm.io/npm:@babel/core@7.24.3/lib/index.js",
"@babel/generator": "https://ga.jspm.io/npm:@babel/generator@7.24.1/lib/index.js",
"@babel/compat-data/native-modules": "https://ga.jspm.io/npm:@babel/compat-data@7.24.4/native-modules.js",
"@babel/compat-data/plugins": "https://ga.jspm.io/npm:@babel/compat-data@7.24.4/plugins.js",
"@babel/core": "https://ga.jspm.io/npm:@babel/core@7.24.4/lib/index.js",
"@babel/generator": "https://ga.jspm.io/npm:@babel/generator@7.24.4/lib/index.js",
"@babel/helper-annotate-as-pure": "https://ga.jspm.io/npm:@babel/helper-annotate-as-pure@7.22.5/lib/index.js",
"@babel/helper-compilation-targets": "https://ga.jspm.io/npm:@babel/helper-compilation-targets@7.23.6/lib/index.js",
"@babel/helper-create-class-features-plugin": "https://ga.jspm.io/npm:@babel/helper-create-class-features-plugin@7.24.1/lib/index.js",
"@babel/helper-create-class-features-plugin": "https://ga.jspm.io/npm:@babel/helper-create-class-features-plugin@7.24.4/lib/index.js",
"@babel/helper-environment-visitor": "https://ga.jspm.io/npm:@babel/helper-environment-visitor@7.22.20/lib/index.js",
"@babel/helper-function-name": "https://ga.jspm.io/npm:@babel/helper-function-name@7.23.0/lib/index.js",
"@babel/helper-hoist-variables": "https://ga.jspm.io/npm:@babel/helper-hoist-variables@7.22.5/lib/index.js",
Expand All @@ -51,13 +51,13 @@
"@babel/helper-string-parser": "https://ga.jspm.io/npm:@babel/helper-string-parser@7.24.1/lib/index.js",
"@babel/helper-validator-identifier": "https://ga.jspm.io/npm:@babel/helper-validator-identifier@7.22.20/lib/index.js",
"@babel/helper-validator-option": "https://ga.jspm.io/npm:@babel/helper-validator-option@7.23.5/lib/index.js",
"@babel/helpers": "https://ga.jspm.io/npm:@babel/helpers@7.24.1/lib/index.js",
"@babel/helpers": "https://ga.jspm.io/npm:@babel/helpers@7.24.4/lib/index.js",
"@babel/highlight": "https://ga.jspm.io/npm:@babel/highlight@7.24.2/lib/index.js",
"@babel/parser": "https://ga.jspm.io/npm:@babel/parser@7.24.1/lib/index.js",
"@babel/parser": "https://ga.jspm.io/npm:@babel/parser@7.24.4/lib/index.js",
"@babel/plugin-syntax-jsx": "https://ga.jspm.io/npm:@babel/plugin-syntax-jsx@7.24.1/lib/index.js",
"@babel/plugin-syntax-typescript": "https://ga.jspm.io/npm:@babel/plugin-syntax-typescript@7.24.1/lib/index.js",
"@babel/plugin-transform-modules-commonjs": "https://ga.jspm.io/npm:@babel/plugin-transform-modules-commonjs@7.24.1/lib/index.js",
"@babel/plugin-transform-typescript": "https://ga.jspm.io/npm:@babel/plugin-transform-typescript@7.24.1/lib/index.js",
"@babel/plugin-transform-typescript": "https://ga.jspm.io/npm:@babel/plugin-transform-typescript@7.24.4/lib/index.js",
"@babel/template": "https://ga.jspm.io/npm:@babel/template@7.24.0/lib/index.js",
"@babel/traverse": "https://ga.jspm.io/npm:@babel/traverse@7.24.1/lib/index.js",
"@babel/types": "https://ga.jspm.io/npm:@babel/types@7.24.0/lib/index.js",
Expand All @@ -69,13 +69,13 @@
"ansi-styles": "https://ga.jspm.io/npm:ansi-styles@3.2.1/index.js",
"browserslist": "https://ga.jspm.io/npm:browserslist@4.23.0/index.js",
"buffer": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/buffer.js",
"caniuse-lite/dist/unpacker/agents": "https://ga.jspm.io/npm:caniuse-lite@1.0.30001600/dist/unpacker/agents.js",
"caniuse-lite/dist/unpacker/agents": "https://ga.jspm.io/npm:caniuse-lite@1.0.30001613/dist/unpacker/agents.js",
"chalk": "https://ga.jspm.io/npm:chalk@2.4.2/index.js",
"color-convert": "https://ga.jspm.io/npm:color-convert@1.9.3/index.js",
"color-name": "https://ga.jspm.io/npm:color-name@1.1.3/index.js",
"convert-source-map": "https://ga.jspm.io/npm:convert-source-map@2.0.0/index.js",
"debug": "https://ga.jspm.io/npm:debug@4.3.4/src/browser.js",
"electron-to-chromium/versions": "https://ga.jspm.io/npm:electron-to-chromium@1.4.715/versions.js",
"electron-to-chromium/versions": "https://ga.jspm.io/npm:electron-to-chromium@1.4.745/versions.js",
"escape-string-regexp": "https://ga.jspm.io/npm:escape-string-regexp@1.0.5/index.js",
"fs": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/fs.js",
"gensync": "https://ga.jspm.io/npm:gensync@1.0.0-beta.2/index.js",
Expand Down

0 comments on commit 4c25cf6

Please sign in to comment.