mikodin_obsidian-scribe/scripts/checkMobileSafe.mjs
Mike A a2f5b392b4
Refactor provider settings and remove legacy AI model settings (#108)
- Updated ProviderSettingsTab to integrate new transcription and summarization provider sections.
- Removed AiModelSettings component as it is no longer needed.
- Introduced ProviderPrivacyCard to display privacy information for selected providers.
- Created ProviderSettingsSections to handle provider-specific settings for transcription and summarization.
- Added new hooks and utility functions for managing OpenRouter model IDs and custom fetch implementation.
- Migrated legacy settings to new structure, consolidating API keys and platform settings.
- Updated styles for the new privacy card component.
- Removed unused openAiUtils module to streamline codebase.
2026-07-11 19:16:47 -04:00

26 lines
966 B
JavaScript

/**
* Guard against the PR #101 mobile crash class: Obsidian mobile runs in a
* WebView with no Node runtime, so any dependency that bundles
* `node:async_hooks` / `AsyncLocalStorage` throws at plugin load.
* Fails the production build if the bundle contains either marker.
*/
import fs from 'node:fs';
const BUNDLE_PATH = 'build/main.js';
const FORBIDDEN = [/async_hooks/, /AsyncLocalStorage/];
const bundle = fs.readFileSync(BUNDLE_PATH, 'utf8');
const offenders = FORBIDDEN.filter((pattern) => pattern.test(bundle));
if (offenders.length > 0) {
console.error(
`✖ Mobile-safety check failed: ${BUNDLE_PATH} contains ${offenders
.map(String)
.join(', ')}.\n` +
'This will crash the plugin on Obsidian mobile (no Node runtime). ' +
'A dependency is pulling in node:async_hooks — see PR #102 for history.',
);
process.exit(1);
}
console.log('✔ Mobile-safety check passed: no async_hooks/AsyncLocalStorage in bundle');