refactor(compartment-mapper): Rename application execute to import
This change better aligns "applications" (compartments comprised of a
graph of linked peer compartments) with the Compartment type itself.
MODIFY
packages/compartment-mapper/README.md
packages/compartment-mapper/README.md
@@ -57,7 +57,7 @@ The `importLocation` function uses `loadLocation`.
Using `loadLocation` directly allows for deferred execution or multiple runs
with different endowments or modules in the same process.
Calling `loadLocation` returns an `Application` object with an
-`execute(endowments?, modules?)` method.
+`import(endowments?, modules?)` method.
Use `writeArchive` to capture an application in an archival format.
Archives are `zip` files with a `compartment-map.json` manifest file.
@@ -110,7 +110,7 @@ Use `loadArchive` to defer execution or run multiple times with varying
endowments.
Use `parseArchive` to construct a runner from the bytes of an archive.
The `loadArchive` and `parseArchive` functions return an `Application`
-object with an `execute(endowments?, modules?)` method.
+object with an `import(endowments?, modules?)` method.
# Package Descriptors

MODIFY
packages/compartment-mapper/src/import-archive.js
packages/compartment-mapper/src/import-archive.js
@@ -52,7 +52,7 @@ export const parseArchive = async (archiveBytes, archiveLocation) => {
return compartment.import(moduleSpecifier);
};
- return { execute };
+ return { import: execute };
};
export const loadArchive = async (read, archiveLocation) => {
@@ -67,5 +67,5 @@ export const importArchive = async (
modules
) => {
const archive = await loadArchive(read, archiveLocation);
- return archive.execute(endowments, modules);
+ return archive.import(endowments, modules);
};

MODIFY
packages/compartment-mapper/src/import.js
packages/compartment-mapper/src/import.js
@@ -35,7 +35,7 @@ export const loadLocation = async (read, moduleLocation) => {
return compartment.import(moduleSpecifier);
};
- return { execute };
+ return { import: execute };
};
export const importLocation = async (
@@ -45,5 +45,5 @@ export const importLocation = async (
modules
) => {
const application = await loadLocation(read, moduleLocation);
- return application.execute(endowments, modules);
+ return application.import(endowments, modules);
};

MODIFY
packages/compartment-mapper/test/main.test.js
packages/compartment-mapper/test/main.test.js
@@ -77,7 +77,7 @@ let modules;
test("create builtin", async t => {
const utility = await loadLocation(read, builtinLocation);
- const { namespace } = await utility.execute(endowments);
+ const { namespace } = await utility.import(endowments);
// We pass the builtin module into the module map.
modules = {
builtin: namespace
@@ -89,7 +89,7 @@ test("loadLocation", async t => {
t.plan(fixtureAssertionCount);
const application = await loadLocation(read, fixture);
- const { namespace } = await application.execute(endowments, modules);
+ const { namespace } = await application.import(endowments, modules);
assertFixture(t, namespace);
});
@@ -110,7 +110,7 @@ test("makeArchive / parseArchive", async t => {
const archive = await makeArchive(read, fixture);
const application = await parseArchive(archive);
- const { namespace } = await application.execute(endowments, modules);
+ const { namespace } = await application.import(endowments, modules);
assertFixture(t, namespace);
});
@@ -130,7 +130,7 @@ test("writeArchive / loadArchive", async t => {
await writeArchive(fakeWrite, read, "app.agar", fixture);
const application = await loadArchive(fakeRead, "app.agar");
- const { namespace } = await application.execute(endowments, modules);
+ const { namespace } = await application.import(endowments, modules);
assertFixture(t, namespace);
});

refactor(compartment-mapper): Rename application execute to import (#459)

This change better aligns "applications" (compartments comprised of a
graph of linked peer compartments) with the Compartment type itself.