-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: bug when tracing/uninstalling the base package. (#206)
- Loading branch information
1 parent
5026be5
commit 4e9dbcf
Showing
10 changed files
with
112 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import * as _ from './a.js'; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Generator } from "@jspm/generator"; | ||
import assert from "assert"; | ||
|
||
// Mimic calling the generator from the ./local/pkg package: | ||
const mapUrl = new URL("./local/pkg/importmap.json", import.meta.url).href; | ||
const pkgNames = ["localpkg", "localpkg/custom", "localpkg/conditional"]; | ||
|
||
for (const pkgName of pkgNames) { | ||
let generator = new Generator({ | ||
mapUrl, | ||
env: ["production"], | ||
}); | ||
|
||
// Installing the package from within itself should resolve locally, since the | ||
// package.json has a local export for ".": | ||
await generator.traceInstall(pkgName); | ||
let json = generator.getMap(); | ||
assert.ok(json.imports[pkgName]); | ||
|
||
// Uninstalling using the same generator instance should remove the install | ||
// entirely and return an empty map: | ||
await generator.uninstall(pkgName); | ||
assert.ok(!generator.getMap().imports); | ||
|
||
// Uninstalling using a new generator instance should _also_ remove the install | ||
// from the import map, i.e. the generator should be able to reconstruct the | ||
// context given just an input map: | ||
generator = new Generator({ | ||
mapUrl, | ||
inputMap: json, | ||
env: ["production"], | ||
}); | ||
|
||
// Uninstalling the package should get rid of it: | ||
await generator.uninstall(pkgName); | ||
json = generator.getMap(); | ||
assert.ok(!json.imports); | ||
} |
This file contains 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