Fix Require Modules

by mnaoumov
5
4
3
2
1
Score: 69/100

Description

Category: Coding & Technical Tools

The Fix Require Modules plugin for Obsidian enhances the experience of working with JavaScript and TypeScript by fixing limitations related to module imports within Obsidian. It allows users to seamlessly work with custom JavaScript/TypeScript scripts, including those used in Dataview, Templater, and other plugins. The plugin introduces advanced functions like require() and requireAsync() for both desktop and mobile, making it possible to import modules and work with files from relative paths, system paths, and even URLs. Additionally, the plugin offers improved support for ECMAScript and TypeScript modules, making it easier to integrate and develop scripts in a modern development environment.

Reviews

No reviews yet.

Stats

144
stars
17,801
downloads
9
forks
904
days
5
days
5
days
5
total PRs
0
open PRs
3
closed PRs
2
merged PRs
43
total issues
1
open issues
42
closed issues
509
commits

Latest Version

5 days ago

Changelog

  • docs(demo-vault): use NATO placeholders instead of foo, bar and baz

Full Changelog: https://github.com/mnaoumov/obsidian-codescript-toolkit/compare/13.6.6...13.6.7

README file from

Github

CodeScript Toolkit

formerly known as Fix Require Modules, see Rebranding section for more details

Buy Me a Coffee GitHub release GitHub downloads Coverage: 100%

An Obsidian plugin that lets you write and run modern JavaScript and TypeScript inside Obsidian — in a note, as a command, on a hotkey, at startup — with a rich module system, bringing you the best practices from the modern development ecosystem.

Demo vault

The documentation is an interactive demo vault. Every feature has a note that explains what it does and why you would want it, followed by a button that runs it for real — so you can read the explanation and execute the example in the same place.

Start reading here — it works as plain markdown on GitHub, no installation needed.

A copy of the vault ships with every release. You can access it via any of the following:

  1. Running the CodeScript Toolkit: Open demo vault command.
  2. Downloading fix-require-modules-demo-vault-<version>.zip (<version> is the release version) from the Releases.
  3. Browsing its source in demo-vault/ in this repository.

If you are not sure where to start, three notes cover most of it: Core functions (which of require() / requireAsync() / requireAsyncWrapper() to use), Code buttons (runnable snippets inside a note), and Invocable scripts (turning a script into an Obsidian command).

What it does

  • Loads CJS/ES modules, TypeScript, JSON, npm packages, Node built-ins, WebAssembly, ASAR archives and URLs with require() — or await requireAsync(), which also works on mobile.
  • Runs your scripts from a note, an Obsidian command, a hotkey, a startup script, or an obsidian:// URL.
  • Lets you prototype a plugin, and explore the Obsidian API — public and internal — at runtime.
  • Enriches scripting capabilities of DevTools console.
  • Enriches the scripting plugins you already use:

Installation

The plugin is available in the official Community Plugins repository.

Beta versions

To install the latest beta release of this plugin (regardless if it is available in the official Community Plugins repository or not), follow these steps:

  1. Ensure you have the BRAT plugin installed and enabled.
  2. Click Install via BRAT.
  3. An Obsidian pop-up window should appear. In the window, click the Add plugin button once and wait a few seconds for the plugin to install.

Debugging

By default, debug messages for this plugin are hidden.

To show them, run the following command:

window.DEBUG.enable('fix-require-modules');

For more details, refer to the Obsidian Dev Utils debugging guide.

Rebranding

This plugin was formerly known as Fix Require Modules.

The plugin quickly overgrew its original purpose and got way more features than just fixing require() calls. That's why it got a new name.

However, for the backward compatibility, the previous id fix-require-modules is still used internally and you might find it

  • in plugin folder name;
  • in plugin URL;
  • in Debugging section;

Changelog

All notable changes to this project will be documented in the CHANGELOG.

Contributing

Contributions are welcome — see CONTRIBUTING to get set up.

Support

My other Obsidian resources

See my other Obsidian resources.

License

© Michael Naumov

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.