文件
mynode/packages/app-mobile/components/plugins/backgroundPage/pluginRunnerBackgroundPage.ts
chen 301194963b
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
feat: Initial clean release of CHM
2026-11-04 11:29:39 +08:00

48 行
1.3 KiB
TypeScript

export { runPlugin, stopPlugin } from './startStopPlugin';
// Old plugins allowed to import legacy APIs
const legacyPluginIds = [
'outline',
'ylc395.noteLinkSystem',
'com.github.joplin.kanban',
];
const pathLibrary = require('path');
const punycode = require('punycode/');
export const requireModule = (moduleName: string, fromPluginId: string) => {
if (moduleName === 'path') {
return pathLibrary;
}
if (legacyPluginIds.includes(fromPluginId)) {
if (moduleName === 'punycode') {
console.warn('Requiring punycode is deprecated. Please transition to a newer API.');
return punycode;
}
if (moduleName === 'fs' || moduleName === 'fs-extra') {
console.warn('The fs library is unavailable to mobile plugins. A non-functional mock will be returned.');
return {
existsSync: () => false,
pathExists: () => false,
readFileSync: () => '',
readFile: () => '',
writeFileSync: () => '',
writeFile: () => '',
appendFile: () => '',
};
}
if (moduleName === 'process') {
return {};
}
if (moduleName === 'url') {
return { parse: (u: string) => new URL(u) };
}
}
throw new Error(`Unable to require module ${moduleName} on mobile.`);
};
export { default as initializePluginBackgroundIframe } from './initializePluginBackgroundIframe';
export { default as initializeDialogWebView } from './initializeDialogWebView';