Feat v0.8.5 extension composability (#72)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-go-pg (push) Successful in 2m44s
CI/CD / test-sqlite (push) Successful in 2m54s
CI/CD / build-and-deploy (push) Successful in 52s
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-go-pg (push) Successful in 2m44s
CI/CD / test-sqlite (push) Successful in 2m54s
CI/CD / build-and-deploy (push) Successful in 52s
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #72.
This commit is contained in:
@@ -79,19 +79,21 @@ func BuildLibModule(ctx context.Context, r *Runner, consumerPkgID string, rc *Ru
|
||||
return nil, fmt.Errorf("lib.require: package %q does not declare dependency on %q", consumerPkgID, libraryID)
|
||||
}
|
||||
|
||||
// 4. Load library's PackageRegistration
|
||||
// 4. Load target PackageRegistration
|
||||
libPkg, err := r.stores.Packages.Get(ctx, libraryID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("lib.require: library %q not found: %w", libraryID, err)
|
||||
return nil, fmt.Errorf("lib.require: package %q not found: %w", libraryID, err)
|
||||
}
|
||||
if libPkg.Type != "library" {
|
||||
return nil, fmt.Errorf("lib.require: package %q is type %q, not library", libraryID, libPkg.Type)
|
||||
// Any package with exports is callable — not just type "library"
|
||||
exports := extractExports(libPkg.Manifest)
|
||||
if len(exports) == 0 {
|
||||
return nil, fmt.Errorf("lib.require: package %q declares no exports", libraryID)
|
||||
}
|
||||
if libPkg.Status != models.PackageStatusActive {
|
||||
return nil, fmt.Errorf("lib.require: library %q is %s, not active", libraryID, libPkg.Status)
|
||||
return nil, fmt.Errorf("lib.require: package %q is %s, not active", libraryID, libPkg.Status)
|
||||
}
|
||||
if libPkg.Tier != models.ExtTierStarlark {
|
||||
return nil, fmt.Errorf("lib.require: library %q is tier %s, not starlark", libraryID, libPkg.Tier)
|
||||
return nil, fmt.Errorf("lib.require: package %q is tier %s, not starlark", libraryID, libPkg.Tier)
|
||||
}
|
||||
|
||||
// 5. Build library's module set (library's own permissions)
|
||||
@@ -113,12 +115,7 @@ func BuildLibModule(ctx context.Context, r *Runner, consumerPkgID string, rc *Ru
|
||||
return nil, fmt.Errorf("lib.require: error executing library %q: %w", libraryID, err)
|
||||
}
|
||||
|
||||
// 8. Extract exports from manifest
|
||||
exports := extractExports(libPkg.Manifest)
|
||||
if len(exports) == 0 {
|
||||
return nil, fmt.Errorf("lib.require: library %q declares no exports", libraryID)
|
||||
}
|
||||
|
||||
// 8. Build exported members (exports already extracted above)
|
||||
members := make(starlark.StringDict, len(exports))
|
||||
for _, name := range exports {
|
||||
val, ok := result.Globals[name]
|
||||
|
||||
Reference in New Issue
Block a user