A code generator that adds Native, JNI, and JSI modules to an existing Supernote plugin.
It creates a local module package and connects it to your plugin. You write the Kotlin, Java, C, or C++ function; the generator creates the bridge, build configuration, TypeScript declarations, and React Native linking.
You need a working Supernote plugin that already builds successfully. Creating, packaging, installing, and debugging that plugin are outside this project's scope; use the official Supernote documentation for that workflow.
Run this generator when the existing plugin needs native functionality.
Python 3.9 or newer is required:
python3 -m pip install supernote-module-generatorRun it from the root of the existing plugin:
supernote-moduleTo check requirements first, run supernote-module doctor --type native,
supernote-module doctor --type jni, or supernote-module doctor --type jsi.
For example, choose Add module, Native Module, and package name
local-math. Accept the derived JavaScript name Math and Android namespace
com.example.math.
Then edit the generated implementation file:
local_modules/local-math/android/src/main/java/com/example/math/Example.kt
package com.example.math
import com.example.math.nativemodule.annotation.SupernoteExport
class Example {
@SupernoteExport
fun add(left: Double, right: Double): Double = left + right
}Call it from the existing plugin:
import Math from 'local-math';
const answer = await Math.add(20, 22);For building, installing, and debugging the plugin itself, continue with the official Supernote documentation.
| Type | Write | Call model | Use it for |
|---|---|---|---|
native |
Kotlin or Java | Promise for returned values | Android APIs and Kotlin/Java libraries |
jni |
C or C++ behind JNI | Promise for returned values | C/C++ work that can be asynchronous |
jsi |
C or C++ through JSI | Synchronous | Short JavaScript-thread work on a tested PluginHost |
JSI is a supported generator backend. Runtime execution still depends on the target PluginHost, firmware, linker namespace, and SELinux policy.
The Wiki documents only the native-module generator:
- Add a Module
- Choose a Module
- Export Functions
- Manage Generated Modules
- Troubleshoot Generated Modules
For exact options in the installed version:
supernote-module help addSee CONTRIBUTING.md when changing the generator itself.
MIT. See LICENSE.