// src/index.ts import joplin from 'api'; const legacy = require('./legacy/index.js'); // Many bundled plugins export either a default function or a plain function. // This wrapper tries the common shapes safely. const entry = legacy?.default ?? legacy; if (typeof entry === 'function') { entry(joplin); } else { // If the bundle registers itself on import, that's okay too. // But if it doesn't export a function, we should fail loudly. throw new Error( 'Legacy plugin entry is not a function. Expected module.exports = function(joplin) {} or export default function.' ); }