New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(compartment-mapper): expose extraParsers option #2190
base: boneskull/load-compartment-for-archive
Are you sure you want to change the base?
feat(compartment-mapper): expose extraParsers option #2190
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @boneskull and the rest of your teammates on Graphite |
5fe0f92
to
8f632a2
Compare
39a6889
to
a4d6b59
Compare
I think my choice of |
a4d6b59
to
dc733f2
Compare
8f632a2
to
7dfbd98
Compare
dc733f2
to
cd03184
Compare
The `fallbackLanguageForExtension` option is an optional mapping of file extension to parser name. Consumers can use it to associate a file extension with a specific parser, e.g., `{"node": "bytes"}` or override the default mappings. The specific use-case is enabling creation of compartment map descriptors for Node.js native modules (e.g., `index.node`) _without_ needing a `parsers: {node: 'bytes'}` property in the `package.json` of the package containing the native module.
cd03184
to
41af691
Compare
7dfbd98
to
7834bec
Compare
Description
The
extraParsers
option is an optional mapping of file extension (without leading.
) to parser name. Consumers can use it to associate a file extension with a specific parser, e.g.,{"node": "bytes"}
or override the default mappings.The specific use-case is enabling creation of compartment map descriptors for Node.js native modules (e.g.,
index.node
) without needing aparsers: {node: 'bytes'}
property in thepackage.json
of the package containing the native module.Because we are unlikely to be the maintainers of any given package exposing a native module, we do not have control over its
package.json
; to add the neededparsers
field would require forking or usingpatch-package
or something else. With this change, the consumer can addextraParsers: {node: 'bytes'}
to any supported API call.The API calls supporting the new option should be any that end up calling
link()
inlink.js
; this is where the mapping is concatenated with the default set of parsers.Upgrade Considerations
This is a backwards-compatible change.