Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow custom path resolve function (#103)
<!-- Thanks for your interest in the project. I appreciate bugs filed and PRs submitted! Please make sure that you are familiar with and follow the Code of Conduct for this project (found in the CODE_OF_CONDUCT.md file). Also, please make sure you're familiar with and follow the instructions in the contributing guidelines (found in the CONTRIBUTING.md file). If you're new to contributing to open source projects, you might find this free video course helpful: http://kcd.im/pull-request Please fill out the information below to expedite the review and (hopefully) merge of your pull request! --> <!-- What changes are being made? (What feature/bug is being fixed here?) --> **What**: Allows the plugin to accept a custom path resolve function. <!-- Why are these changes necessary? --> **Why**: ASTExplorer doesn't have access to the `fs` module, so it throws an error when attempting to use `resolve.sync`. <!-- How were these changes implemented? --> **How**: A `resolvePath` option is added to `macrosPlugin`, which is a function that receives the `source` path string and the `basedir` directory string. If `resolvePath` is not provided, `resolve.sync` will be used. <!-- feel free to add additional comments --> **Notes:** I didn't see any tests for the existing `require` option for `macrosPlugin`, so it wasn't immediately obvious how I should test this. While not a substitute for a proper test, I did link it to a local clone of ASTExplorer and it worked as expected. Fixes #102
- Loading branch information