Skip to content

Commit

Permalink
chore(compartment-mapper): Fix typo of internal function (merge #1994)
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal authored Jan 23, 2024
2 parents bb2833f + ef80984 commit 004eff5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/compartment-mapper/src/import-archive.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,20 +208,25 @@ const makeArchiveImportHookMaker = (
return makeImportHook;
};

const makeFeauxModuleExportsNamespace = Compartment => {
// @ts-ignore Unclear at time of writing why Compartment type is not
// constructible.
/**
* Creates a fake module namespace object that passes a brand check.
*
* @param {typeof Compartment} Compartment
* @returns {import('ses').ModuleExportsNamespace}
*/
const makeFauxModuleExportsNamespace = Compartment => {
const compartment = new Compartment(
{},
{},
{
resolveHook() {
return '.';
},
importHook() {
async importHook() {
return {
imports: [],
execute() {},
exports: [],
};
},
},
Expand Down Expand Up @@ -336,7 +341,7 @@ export const parseArchive = async (
parserForLanguage,
modules: Object.fromEntries(
Object.keys(modules || {}).map(specifier => {
return [specifier, makeFeauxModuleExportsNamespace(Compartment)];
return [specifier, makeFauxModuleExportsNamespace(Compartment)];
}),
),
Compartment,
Expand Down

0 comments on commit 004eff5

Please sign in to comment.