Created
February 18, 2022 06:09
-
-
Save erights/fb27c01cea57674439a027a6c701b200 to your computer and use it in GitHub Desktop.
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
const ModuleLanguagesSet = makeConstSet([ | |
'cjs', | |
'mjs', | |
'json', | |
'pre-mjs-json', | |
'pre-cjs-json', | |
]); | |
// TODO M.elementOf doesn't yet exist. We should add it. | |
const ModuleLanguageShape = M.elementOf(ModuleLanguagesSet), | |
const CompartmentModuleShape = harden({ | |
compartment: M.string(), | |
module: M.string(), | |
}); | |
const FileModuleShape = harden({ | |
location: M.string(), | |
parser: ModuleLanguageShape, | |
sha512: M.string(), | |
}); | |
const ExitModuleShape = harden({ | |
exit: M.string(), | |
}); | |
const ModuleShape = M.or( | |
CompartmentModuleShape, | |
FileModuleShape, | |
ExitModuleShape, | |
); | |
const ScopeShape = harden({ | |
compartment: M.string(), | |
}); | |
const CompartmentShape = harden({ | |
location: M.string(), | |
name: M.string(), | |
label: M.string(), | |
parsers: M.recordOf(M.string(), ModuleLanguageShape), | |
types: M.recordOf(M.string(), ModuleLanguageShape), | |
scopes: M.recordOf(M.string(), ScopeShape), | |
modules: M.recordOf(M.string(), ModuleShape), | |
}); | |
const EntryShape = harden({ | |
compartment: M.string(), | |
module: M.string(), | |
}); | |
const CompartmentMapShape = harden({ | |
tags: M.arrayOf(M.string()), | |
entry: EntryShape, | |
compartments: M.recordOf(M.string(), CompartmentShape), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment