doc(README): proposed API updates
MODIFY
README.md
README.md
@@ -12,7 +12,7 @@ When an importer is created, it has the following API:
```js
/**
* spec - Module specifier string provided to import
- * url - referrer URL
+ * url - referrer URL TODO: referrer?
*/
function importer({ spec, url }): Promise<ModuleNamespace>;
```
@@ -27,20 +27,35 @@ If you want to write such a package, you can use the following interface:
import makeImporter from '@agoric/make-importer';
const importer = makeImporter({
- resolve, // (specifier: string, referrer: ModuleLocation) => ScopedRef
- locate, // (scopedRef: ScopedRef) => Promise<ModuleLocation>
- retrieve, // (loc: ModuleLocation) => Promise<string>
- rewrite, // (body: ModuleSource, loc: ModuleLocation) => ModuleStaticRecord
+ resolve, // (specifier: string, referrer: AbsoluteSpecifier) => AbsoluteSpecifier
+ locate, // (absSpecifer: AbsoluteSpecifier) => Promise<ModuleLocation>
+ retrieve, // (loc: ModuleLocation) => Promise<ModuleStaticRecord>
rootLinker, // see below:
// {
// link: (lr: ModuleLinkageRecord, recursiveLink, preEndowments) => ModuleInstance
- // instanceCache: new Map(),
+ // instanceCache: Map<LinkageHandle, ModuleInstance>,
// linkerFor?: (loc: ModuleLocation) => Linker,
// }
- // ModuleInstance = { initialize(): void, }
+ // ModuleInstance = { getNamespace(): Promise<Record<string, any>> }
});
```
+## What per what?
+
+One ModuleLocation per ModuleStaticRecord.
+
+Multiple LinkageHandle per ModuleStaticRecord.
+
+One ModuleLinkageRecord per LinkageHandle.
+
+Multiple ModuleLinkageRecords per ModuleStaticRecord.
+
+Multiple Linkers per Evaluator. One Evaluator per Linker.
+
+Multiple Importers per Linker.
+
+A Compartment has one Importer.
+
## Known Issues
* The word `moduleId` in the sources actually should be a `scopedRef` or `moduleLocation`.

doc(README): proposed API updates