-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(compartment-mapper): Export all parsers
- Loading branch information
Showing
4 changed files
with
57 additions
and
1 deletion.
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
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 @@ | ||
export { defaultParserForLanguage } from './src/import-archive-all-parsers.js'; |
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
29 changes: 29 additions & 0 deletions
29
packages/compartment-mapper/src/import-archive-all-parsers.js
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,29 @@ | ||
/* Provides a set of default language behaviors (parsers) suitable for | ||
* evaluating archives (zip files with a `compartment-map.json` and a file for | ||
* each module) with pre-compiled _or_ original ESM and CommonJS. | ||
* | ||
* This module does not entrain a dependency on Babel on XS, but does on other | ||
* platforms like Node.js. | ||
*/ | ||
/** @import {ParserForLanguage} from './types.js' */ | ||
|
||
import parserPreCjs from './parse-pre-cjs.js'; | ||
import parserJson from './parse-json.js'; | ||
import parserText from './parse-text.js'; | ||
import parserBytes from './parse-bytes.js'; | ||
import parserPreMjs from './parse-pre-mjs.js'; | ||
import parserMjs from './parse-mjs.js'; | ||
import parserCjs from './parse-cjs.js'; | ||
|
||
/** @satisfies {Readonly<ParserForLanguage>} */ | ||
export const defaultParserForLanguage = Object.freeze( | ||
/** @type {const} */ ({ | ||
'pre-cjs-json': parserPreCjs, | ||
'pre-mjs-json': parserPreMjs, | ||
cjs: parserCjs, | ||
mjs: parserMjs, | ||
json: parserJson, | ||
text: parserText, | ||
bytes: parserBytes, | ||
}), | ||
); |