Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(endomoat): just add a patch for now
- Loading branch information
Showing
1 changed file
with
105 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
diff --git a/node_modules/@endo/compartment-mapper/index.js b/node_modules/@endo/compartment-mapper/index.js | ||
index acccf2c..8b0333e 100644 | ||
--- a/node_modules/@endo/compartment-mapper/index.js | ||
+++ b/node_modules/@endo/compartment-mapper/index.js | ||
@@ -6,6 +6,8 @@ export { | ||
writeArchive, | ||
mapLocation, | ||
hashLocation, | ||
+ loadCompartmentForArchive, | ||
+ makeArchiveCompartmentMap, | ||
} from './src/archive.js'; | ||
export { | ||
parseArchive, | ||
diff --git a/node_modules/@endo/compartment-mapper/src/archive.js b/node_modules/@endo/compartment-mapper/src/archive.js | ||
index 17f10f7..686fc95 100644 | ||
--- a/node_modules/@endo/compartment-mapper/src/archive.js | ||
+++ b/node_modules/@endo/compartment-mapper/src/archive.js | ||
@@ -289,15 +289,18 @@ export const makeArchiveCompartmentMap = (compartmentMap, sources) => { | ||
* @param {ReadFn | ReadPowers} powers | ||
* @param {string} moduleLocation | ||
* @param {ArchiveOptions} [options] | ||
- * @returns {Promise<{sources: Sources, compartmentMapBytes: Uint8Array, sha512?: string}>} | ||
+ * @returns {Promise<import('./types.js').LoadCompartmentForArchiveResult>} | ||
*/ | ||
-const digestLocation = async (powers, moduleLocation, options) => { | ||
+export const loadCompartmentForArchive = async ( | ||
+ powers, | ||
+ moduleLocation, | ||
+ options, | ||
+) => { | ||
const { | ||
moduleTransforms, | ||
modules: exitModules = {}, | ||
dev = false, | ||
tags = new Set(), | ||
- captureSourceLocation = undefined, | ||
searchSuffixes = undefined, | ||
commonDependencies = undefined, | ||
importHook: exitModuleImportHook = undefined, | ||
@@ -334,6 +337,8 @@ const digestLocation = async (powers, moduleLocation, options) => { | ||
entry: { module: entryModuleSpecifier, compartment: entryCompartmentName }, | ||
} = compartmentMap; | ||
|
||
+ // compartment map contains no source code | ||
+ | ||
/** @type {Sources} */ | ||
const sources = Object.create(null); | ||
|
||
@@ -361,7 +366,25 @@ const digestLocation = async (powers, moduleLocation, options) => { | ||
parserForLanguage, | ||
archiveOnly: true, | ||
}); | ||
+ | ||
await compartment.load(entryModuleSpecifier); | ||
+ | ||
+ return { attenuatorsCompartment, compartmentMap, sources, computeSha512 }; | ||
+}; | ||
+ | ||
+/** | ||
+ * @param {ReadFn | ReadPowers} powers | ||
+ * @param {string} moduleLocation | ||
+ * @param {ArchiveOptions} [options] | ||
+ * @returns {Promise<{sources: Sources, compartmentMapBytes: Uint8Array, sha512?: string}>} | ||
+ */ | ||
+const digestLocation = async (powers, moduleLocation, options) => { | ||
+ const { captureSourceLocation = undefined, policy = undefined } = | ||
+ options || {}; | ||
+ | ||
+ const { attenuatorsCompartment, compartmentMap, sources, computeSha512 } = | ||
+ await loadCompartmentForArchive(powers, moduleLocation, options); | ||
+ | ||
if (policy) { | ||
// retain all attenuators. | ||
await Promise.all( | ||
diff --git a/node_modules/@endo/compartment-mapper/src/types.js b/node_modules/@endo/compartment-mapper/src/types.js | ||
index 9e8f605..f760124 100644 | ||
--- a/node_modules/@endo/compartment-mapper/src/types.js | ||
+++ b/node_modules/@endo/compartment-mapper/src/types.js | ||
@@ -504,3 +504,13 @@ export {}; | ||
* Any object. All objects. Not `null`, though. | ||
* @typedef {Record<PropertyKey, any>} SomeObject | ||
*/ | ||
+ | ||
+/** | ||
+ * Return value of `loadCompartmentForArchive`. | ||
+ * | ||
+ * @typedef LoadCompartmentForArchiveResult | ||
+ * @property {CompartmentMapDescriptor} compartmentMap | ||
+ * @property {Sources} sources | ||
+ * @property {Compartment} attenuatorsCompartment | ||
+ * @property {(bytes: Uint8Array) => string} [computeSha512] | ||
+ */ | ||
diff --git a/node_modules/@endo/compartment-mapper/types.d.ts b/node_modules/@endo/compartment-mapper/types.d.ts | ||
index e480609..9b011ae 100644 | ||
--- a/node_modules/@endo/compartment-mapper/types.d.ts | ||
+++ b/node_modules/@endo/compartment-mapper/types.d.ts | ||
@@ -5,6 +5,8 @@ export { | ||
writeArchive, | ||
mapLocation, | ||
hashLocation, | ||
+ loadCompartmentForArchive, | ||
+ makeArchiveCompartmentMap, | ||
} from './src/archive.js'; | ||
export { | ||
parseArchive, |