Skip to content

Commit

Permalink
fix: reuse initialized packages
Browse files Browse the repository at this point in the history
  • Loading branch information
just-paja committed Feb 6, 2023
1 parent 60c3149 commit 4d04d18
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/isolate/IsolatedPackage.mjs
Expand Up @@ -95,6 +95,7 @@ export class IsolatedPackage extends Package {
const manifest = await this.readManifest()
this.cfg = resolveFlags(manifest)
}
return this
}

async configurePackage() {
Expand Down
15 changes: 11 additions & 4 deletions packages/isolate/IsolatedProject.mjs
Expand Up @@ -9,6 +9,7 @@ export class IsolatedProject extends Project {
constructor(root, { reporter } = {}) {
super(root)
this.isolated = {}
this.mappedPackages = null
this.onProgress = null
this.products = []
this.reporter = reporter
Expand All @@ -17,10 +18,16 @@ export class IsolatedProject extends Project {
}

async getPackages() {
const bare = await super.getPackages()
return bare.map(pkg =>
IsolatedPackage.from(pkg, { project: this, reporter: this.reporter })
)
if (!this.mappedPackages) {
const bare = await super.getPackages()
const mapped = bare.map(pkg =>
IsolatedPackage.from(pkg, { project: this, reporter: this.reporter })
)
this.mappedPackages = await Promise.all(
mapped.map(pkg => pkg.initialize())
)
}
return this.mappedPackages
}

async getPackageNames() {
Expand Down

0 comments on commit 4d04d18

Please sign in to comment.