Skip to content

Commit

Permalink
Add setting "Expose internal modules"
Browse files Browse the repository at this point in the history
Signed-off-by: William So <polyipseity@gmail.com>
  • Loading branch information
polyipseity committed Aug 12, 2023
1 parent fd1f08c commit 26155df
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/heavy-ears-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"obsidian-modules": minor
---

Add setting "Expose internal modules". Cherry-picked from `d22f7bf6182272e3e0058c328ed42ec3039de184`, which is from `obsidian-terminal`.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ Contributions are welcome!

The todos here, ordered alphabetically, are things planned for the plugin. There are no guarantees that they will be completed. However, we are likely to accept contributions for them.

- Configure whether to resolve internal modules.
- Configure `require` global name.
- Configure preloaded files.
- Configure accepted code block languages.
Expand Down
2 changes: 2 additions & 0 deletions sources/require/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ export class InternalModulesResolve
protected readonly identities: Record<string, object | undefined> = {}

public override resolve(id: string, _1: Context): Resolved | null {
const { context: { settings } } = this
if (!settings.value.exposeInternalModules) { return null }
let value = null
try {
value = dynamicRequireSync({}, id)
Expand Down

0 comments on commit 26155df

Please sign in to comment.