mirror of
https://github.com/laurent22/joplin.git
synced 2026-10-25 02:47:28 +00:00
Chore: Convert most requires to imports in TypeScript files (#15527)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
1a7da853d2
commit
5df182d871
142 files changed
+582
-214
No files matched your search
@@ -1,4 +1,4 @@
|
||||
const open = require('open');
|
||||
import open = require('open');
|
||||
interface LinkStoreEntry {
|
||||
link: string;
|
||||
noteX: number;
|
||||
@@ -137,7 +137,7 @@ class LinkSelector {
|
||||
if (textWidget.noteId !== this.noteId_) return;
|
||||
if (textWidget.renderedText_ !== this.renderedText_) return;
|
||||
if (textWidget.scrollTop_ !== this.scrollTop_) return;
|
||||
open(this.linkStore_[this.currentLinkIndex_].link);
|
||||
void open(this.linkStore_[this.currentLinkIndex_].link);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ import Note from '@joplin/lib/models/Note';
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
import { node } from 'execa';
|
||||
import { splitCommandString } from '@joplin/utils';
|
||||
const nodeSqlite = require('sqlite3');
|
||||
const { loadKeychainServiceAndSettings } = require('@joplin/lib/services/SettingUtils');
|
||||
const { default: shimInitCli } = require('./utils/shimInitCli');
|
||||
import * as nodeSqlite from 'sqlite3';
|
||||
import { loadKeychainServiceAndSettings } from '@joplin/lib/services/SettingUtils';
|
||||
import shimInitCli from './utils/shimInitCli';
|
||||
|
||||
const baseDir = `${dirname(__dirname)}/tests/cli-integration`;
|
||||
const joplinAppPath = `${__dirname}/main.js`;
|
||||
|
||||
shimInitCli({ nodeSqlite, appVersion: () => require('../package.json').version, keytar: null });
|
||||
shimInitCli({ nodeSqlite, appVersion: () => require('../package.json').version, keytar: null, sharp: null, React: null, electronBridge: null, pdfJs: null });
|
||||
require('@joplin/lib/testing/test-utils');
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import BaseCommand from './base-command';
|
||||
import BaseItem from '@joplin/lib/models/BaseItem';
|
||||
import BaseModel from '@joplin/lib/BaseModel';
|
||||
const { toTitleCase } = require('@joplin/lib/string-utils.js');
|
||||
import { toTitleCase } from '@joplin/lib/string-utils';
|
||||
import { reg } from '@joplin/lib/registry.js';
|
||||
import markdownUtils, { MarkdownTableRow } from '@joplin/lib/markdownUtils';
|
||||
import Database from '@joplin/lib/database';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const BaseCommand = require('./base-command').default;
|
||||
import BaseCommand from './base-command';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import EncryptionService from '@joplin/lib/services/e2ee/EncryptionService';
|
||||
import DecryptionWorker from '@joplin/lib/services/DecryptionWorker';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const BaseCommand = require('./base-command').default;
|
||||
import BaseCommand from './base-command';
|
||||
import app from './app';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import { ModelType } from '@joplin/lib/BaseModel';
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import Setting, { AppType, SettingStorage } from '@joplin/lib/models/Setting';
|
||||
import { SettingItemType } from '@joplin/lib/services/plugins/api/types';
|
||||
import shim from '@joplin/lib/shim';
|
||||
|
||||
const BaseCommand = require('./base-command').default;
|
||||
import BaseCommand from './base-command';
|
||||
|
||||
function settingTypeToSchemaType(type: SettingItemType): string {
|
||||
const map: Record<SettingItemType, string> = {
|
||||
|
||||
@@ -6,7 +6,7 @@ import ResourceFetcher from '@joplin/lib/services/ResourceFetcher';
|
||||
import Synchronizer from '@joplin/lib/Synchronizer';
|
||||
import { masterKeysWithoutPassword } from '@joplin/lib/services/e2ee/utils';
|
||||
import { appTypeToLockType } from '@joplin/lib/services/synchronizer/LockHandler';
|
||||
const BaseCommand = require('./base-command').default;
|
||||
import BaseCommand from './base-command';
|
||||
import app from './app';
|
||||
const { OneDriveApiNodeUtils } = require('@joplin/lib/onedrive-api-node-utils.js');
|
||||
import { reg } from '@joplin/lib/registry';
|
||||
@@ -61,8 +61,8 @@ class Command extends BaseCommand {
|
||||
// OneDrive
|
||||
this.oneDriveApiUtils_ = new OneDriveApiNodeUtils(syncTarget.api());
|
||||
const auth = await this.oneDriveApiUtils_.oauthDance({
|
||||
log: (...s: string[]) => {
|
||||
return this.stdout(...s);
|
||||
log: (s: string) => {
|
||||
return this.stdout(s);
|
||||
},
|
||||
});
|
||||
this.oneDriveApiUtils_ = null;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const BaseCommand = require('./base-command').default;
|
||||
import BaseCommand from './base-command';
|
||||
import { reg } from '@joplin/lib/registry';
|
||||
import Note from '@joplin/lib/models/Note';
|
||||
import uuid from '@joplin/lib/uuid';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import BaseCommand from './base-command';
|
||||
const { _ } = require('@joplin/lib/locale');
|
||||
const versionInfo = require('@joplin/lib/versionInfo').default;
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import versionInfo from '@joplin/lib/versionInfo';
|
||||
|
||||
class Command extends BaseCommand {
|
||||
public override usage() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import chalk = require('chalk');
|
||||
import stripAnsi = require('strip-ansi');
|
||||
const BaseWidget = require('tkwidgets/BaseWidget.js');
|
||||
const chalk = require('chalk');
|
||||
const termutils = require('tkwidgets/framework/termutils.js');
|
||||
const stripAnsi = require('strip-ansi');
|
||||
const { handleAutocompletion } = require('../autocompletion.js');
|
||||
|
||||
export default class StatusBarWidget extends BaseWidget {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import shim from '@joplin/lib/shim';
|
||||
const os = require('os');
|
||||
import * as os from 'os';
|
||||
import { readFile } from 'fs/promises';
|
||||
const { filename } = require('@joplin/lib/path-utils');
|
||||
import { filename } from '@joplin/lib/path-utils';
|
||||
import HtmlToMd, { ParseOptions } from '@joplin/lib/HtmlToMd';
|
||||
|
||||
describe('HtmlToMd', () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import MdToHtml, { LinkRenderingType, Options as MdToHtmlConstructorOptions } from '@joplin/renderer/MdToHtml';
|
||||
const { filename } = require('@joplin/lib/path-utils');
|
||||
import { filename } from '@joplin/lib/path-utils';
|
||||
import { setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/test-utils';
|
||||
import shim from '@joplin/lib/shim';
|
||||
import { RenderOptions } from '@joplin/renderer/types';
|
||||
import { isResourceUrl, resourceUrlToId } from '@joplin/lib/models/utils/resourceUtils';
|
||||
const { themeStyle } = require('@joplin/lib/theme');
|
||||
import { themeStyle } from '@joplin/lib/theme';
|
||||
|
||||
function newTestMdToHtml(options: Partial<MdToHtmlConstructorOptions> = null) {
|
||||
const merged: MdToHtmlConstructorOptions = {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { BrowserWindow, BrowserWindowConstructorOptions, Tray, WebContents, scre
|
||||
import bridge from './bridge';
|
||||
import * as url from 'url';
|
||||
const path = require('path');
|
||||
const { dirname } = require('@joplin/lib/path-utils');
|
||||
import { dirname } from '@joplin/lib/path-utils';
|
||||
const fs = require('fs-extra');
|
||||
|
||||
import { dialog, ipcMain } from 'electron';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { PluginStates } from '@joplin/lib/services/plugins/reducer';
|
||||
import bridge from './services/bridge';
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
import Note from '@joplin/lib/models/Note';
|
||||
const { friendlySafeFilename } = require('@joplin/lib/path-utils');
|
||||
import { friendlySafeFilename } from '@joplin/lib/path-utils';
|
||||
import time from '@joplin/lib/time';
|
||||
import { BrowserWindow, BrowserWindowConstructorOptions } from 'electron';
|
||||
const md5 = require('md5');
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { CommandRuntime, CommandDeclaration } from '@joplin/lib/services/CommandService';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import shim, { MessageBoxType } from '@joplin/lib/shim';
|
||||
const app = require('@electron/remote').app;
|
||||
const { clipboard } = require('electron');
|
||||
import { app } from '@electron/remote';
|
||||
import { clipboard } from 'electron';
|
||||
|
||||
export const declaration: CommandDeclaration = {
|
||||
name: 'copyDevCommand',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const React = require('react');
|
||||
import { CSSProperties } from 'react';
|
||||
const { connect } = require('react-redux');
|
||||
const { clipboard } = require('electron');
|
||||
import { clipboard } from 'electron';
|
||||
import ExtensionBadge from './ExtensionBadge';
|
||||
import { themeStyle } from '@joplin/lib/theme';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
|
||||
@@ -7,7 +7,7 @@ import BannerContent from './NoteEditor/WarningBanner/BannerContent';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
const packageInfo: PackageInfo = require('../packageInfo.js');
|
||||
const ipcRenderer = require('electron').ipcRenderer;
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
const logger = Logger.create('ErrorBoundary');
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ import Logger from '@joplin/utils/Logger';
|
||||
|
||||
const logger = Logger.create('MainScreen');
|
||||
|
||||
const ipcRenderer = require('electron').ipcRenderer;
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
interface Props {
|
||||
plugins: PluginStates;
|
||||
|
||||
@@ -34,7 +34,7 @@ import { FileSystemItem } from '@joplin/lib/services/interop/types';
|
||||
const logger = Logger.create('MenuBar');
|
||||
|
||||
const packageInfo: PackageInfo = require('../packageInfo.js');
|
||||
const { clipboard } = require('electron');
|
||||
import { clipboard } from 'electron';
|
||||
const Menu = bridge().Menu;
|
||||
|
||||
const menuUtils = new MenuUtils(CommandService.instance());
|
||||
|
||||
@@ -24,7 +24,7 @@ import { themeStyle } from '@joplin/lib/theme';
|
||||
import { ThemeAppearance } from '@joplin/lib/themes/type';
|
||||
import dialogs from '../../../../dialogs';
|
||||
import { MarkupToHtml } from '@joplin/renderer';
|
||||
const { clipboard } = require('electron');
|
||||
import { clipboard } from 'electron';
|
||||
|
||||
import { reg } from '@joplin/lib/registry';
|
||||
import ErrorBoundary from '../../../../ErrorBoundary';
|
||||
|
||||
@@ -35,7 +35,7 @@ import useWebViewApi from './utils/useWebViewApi';
|
||||
import useLinkTooltips from './utils/useLinkTooltips';
|
||||
import { focus } from '@joplin/lib/utils/focusHandler';
|
||||
const md5 = require('md5');
|
||||
const { clipboard } = require('electron');
|
||||
import { clipboard } from 'electron';
|
||||
const supportedLocales = require('./supportedLocales');
|
||||
import { hasProtocol } from '@joplin/utils/url';
|
||||
import useTabIndenter from './utils/useTabIndenter';
|
||||
|
||||
@@ -29,7 +29,7 @@ import stateToWhenClauseContext from '../../services/commands/stateToWhenClauseC
|
||||
import ExternalEditWatcher from '@joplin/lib/services/ExternalEditWatcher';
|
||||
import { itemIsReadOnly } from '@joplin/lib/models/utils/readOnly';
|
||||
const { themeStyle } = require('@joplin/lib/theme');
|
||||
const { substrWithEllipsis } = require('@joplin/lib/string-utils');
|
||||
import { substrWithEllipsis } from '@joplin/lib/string-utils';
|
||||
import NoteSearchBar from '../NoteSearchBar';
|
||||
import Note from '@joplin/lib/models/Note';
|
||||
import Folder from '@joplin/lib/models/Folder';
|
||||
|
||||
@@ -4,7 +4,7 @@ import HtmlToMd from '@joplin/lib/HtmlToMd';
|
||||
import { processImagesInPastedHtml } from '../utils/resourceHandling';
|
||||
import { WindowCommandDependencies } from '../utils/types';
|
||||
|
||||
const { clipboard } = require('electron');
|
||||
import { clipboard } from 'electron';
|
||||
|
||||
export const declaration: CommandDeclaration = {
|
||||
name: 'pasteAsMarkdown',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import HtmlToMd from '@joplin/lib/HtmlToMd';
|
||||
import HtmlUtils from '@joplin/lib/htmlUtils';
|
||||
const { clipboard } = require('electron');
|
||||
import { clipboard } from 'electron';
|
||||
|
||||
interface ClipboardData {
|
||||
text: string;
|
||||
|
||||
@@ -17,9 +17,9 @@ import { openFileWithExternalEditor } from '@joplin/lib/services/ExternalEditWat
|
||||
import CommandService from '@joplin/lib/services/CommandService';
|
||||
import SyncTargetRegistry from '@joplin/lib/SyncTargetRegistry';
|
||||
const fs = require('fs-extra');
|
||||
const { writeFile } = require('fs-extra');
|
||||
const { clipboard } = require('electron');
|
||||
const { toSystemSlashes } = require('@joplin/lib/path-utils');
|
||||
import { writeFile } from 'fs-extra';
|
||||
import { clipboard } from 'electron';
|
||||
import { toSystemSlashes } from '@joplin/lib/path-utils';
|
||||
|
||||
function handleCopyToClipboard(options: ContextMenuOptions) {
|
||||
if (options.textToCopy) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { FormNote } from './types';
|
||||
import HtmlToMd, { ParseOptions } from '@joplin/lib/HtmlToMd';
|
||||
import Note from '@joplin/lib/models/Note';
|
||||
import { NoteEntity } from '@joplin/lib/services/database/types';
|
||||
const { MarkupToHtml } = require('@joplin/renderer');
|
||||
import { MarkupToHtml } from '@joplin/renderer';
|
||||
|
||||
export async function htmlToMarkdown(markupLanguage: number, html: string, originalCss: string, parseOptions: ParseOptions = null): Promise<string> {
|
||||
let newBody = '';
|
||||
|
||||
@@ -14,7 +14,7 @@ import markupRenderOptions from './markupRenderOptions';
|
||||
import { fileExtension, filename, safeFileExtension, safeFilename } from '@joplin/utils/path';
|
||||
const joplinRendererUtils = require('@joplin/renderer').utils;
|
||||
import type { NativeImage } from 'electron';
|
||||
const { clipboard } = require('electron');
|
||||
import { clipboard } from 'electron';
|
||||
import * as mimeUtils from '@joplin/lib/mime-utils';
|
||||
import bridge from '../../../services/bridge';
|
||||
import { getCollator, getCollatorLocale } from '@joplin/lib/models/utils/getCollator';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useState, useCallback, MutableRefObject, useEffect } from 'react';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
import { SearchMarkers } from './useSearchMarkers';
|
||||
import { focus } from '@joplin/lib/utils/focusHandler';
|
||||
const CommandService = require('@joplin/lib/services/CommandService').default;
|
||||
import CommandService from '@joplin/lib/services/CommandService';
|
||||
|
||||
const logger = Logger.create('useNoteSearchBar');
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { htmlentities } from '@joplin/utils/html';
|
||||
const Mark = require('mark.js/dist/mark.min.js');
|
||||
const markJsUtils = require('@joplin/lib/markJsUtils');
|
||||
const { replaceRegexDiacritics, pregQuote } = require('@joplin/lib/string-utils');
|
||||
import { replaceRegexDiacritics, pregQuote } from '@joplin/lib/string-utils';
|
||||
|
||||
const getNoteTitleHtml = (highlightedWords: string[], displayTitle: string) => {
|
||||
if (highlightedWords.length) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { NoteEntity } from '@joplin/lib/services/database/types';
|
||||
import { focus } from '@joplin/lib/utils/focusHandler';
|
||||
import Dialog from '@joplin/lib/components/Dialog';
|
||||
import { formatDateTimeLocalToMs, formatMsToDateTimeLocal, formatMsToLocal } from '@joplin/utils/time';
|
||||
const { clipboard } = require('electron');
|
||||
import { clipboard } from 'electron';
|
||||
const formatcoords = require('formatcoords');
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -12,7 +12,7 @@ import time from '@joplin/lib/time';
|
||||
import bridge from '../services/bridge';
|
||||
import { NoteEntity, RevisionEntity } from '@joplin/lib/services/database/types';
|
||||
import { AppState } from '../app.reducer';
|
||||
const urlUtils = require('@joplin/lib/urlUtils');
|
||||
import * as urlUtils from '@joplin/lib/urlUtils';
|
||||
const ReactTooltip = require('react-tooltip');
|
||||
const { connect } = require('react-redux');
|
||||
import shared from '@joplin/lib/components/shared/note-screen-shared';
|
||||
|
||||
@@ -5,7 +5,7 @@ import { _ } from '@joplin/lib/locale';
|
||||
const { connect } = require('react-redux');
|
||||
const { themeStyle } = require('@joplin/lib/theme');
|
||||
import bridge from '../services/bridge';
|
||||
const prettyBytes = require('pretty-bytes');
|
||||
import prettyBytes = require('pretty-bytes');
|
||||
import Resource from '@joplin/lib/models/Resource';
|
||||
import { LoadOptions } from '@joplin/lib/models/utils/types';
|
||||
import { AppState } from '../app.reducer';
|
||||
|
||||
@@ -10,7 +10,7 @@ import ErrorBoundary from './ErrorBoundary';
|
||||
import { themeStyle } from '@joplin/lib/theme';
|
||||
import MenuBar from './MenuBar';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
const { createRoot } = require('react-dom/client');
|
||||
import { createRoot } from 'react-dom/client';
|
||||
const { connect, Provider } = require('react-redux');
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
import ClipperServer from '@joplin/lib/ClipperServer';
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useEffect } from 'react';
|
||||
import useSyncTargetUpgrade, { SyncTargetUpgradeResult } from '@joplin/lib/services/synchronizer/gui/useSyncTargetUpgrade';
|
||||
|
||||
import { createRoot } from 'react-dom/client';
|
||||
const ipcRenderer = require('electron').ipcRenderer;
|
||||
import { ipcRenderer } from 'electron';
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
import restart from '../services/restart';
|
||||
import shim from '@joplin/lib/shim';
|
||||
|
||||
@@ -17,7 +17,7 @@ import onUnshareNoteClick from '@joplin/lib/components/shared/ShareNoteDialog/on
|
||||
import useShareStatusMessage from '@joplin/lib/components/shared/ShareNoteDialog/useShareStatusMessage';
|
||||
import useEncryptionWarningMessage from '@joplin/lib/components/shared/ShareNoteDialog/useEncryptionWarningMessage';
|
||||
import { SharingStatus } from '@joplin/lib/components/shared/ShareNoteDialog/types';
|
||||
const { clipboard } = require('electron');
|
||||
import { clipboard } from 'electron';
|
||||
|
||||
interface Props {
|
||||
themeId: number;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { _ } from '@joplin/lib/locale';
|
||||
import bridge from '../../../services/bridge';
|
||||
import Folder from '@joplin/lib/models/Folder';
|
||||
import { getTrashFolderId } from '@joplin/lib/services/trash';
|
||||
const { substrWithEllipsis } = require('@joplin/lib/string-utils');
|
||||
import { substrWithEllipsis } from '@joplin/lib/string-utils';
|
||||
|
||||
export const declaration: CommandDeclaration = {
|
||||
name: 'deleteFolder',
|
||||
|
||||
@@ -10,7 +10,7 @@ import bridge from '../../services/bridge';
|
||||
import BaseModel from '@joplin/lib/BaseModel';
|
||||
import Note from '@joplin/lib/models/Note';
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
const { clipboard } = require('electron');
|
||||
import { clipboard } from 'electron';
|
||||
import { Dispatch } from 'redux';
|
||||
import { NoteEntity } from '@joplin/lib/services/database/types';
|
||||
import { MarkupLanguage } from '@joplin/renderer';
|
||||
|
||||
@@ -32,8 +32,8 @@ import * as React from 'react';
|
||||
import nodeSqlite = require('sqlite3');
|
||||
import initLib from '@joplin/lib/initLib';
|
||||
import PerformanceLogger from '@joplin/lib/PerformanceLogger';
|
||||
const pdfJs = require('pdfjs-dist');
|
||||
const { isAppleSilicon } = require('is-apple-silicon');
|
||||
import * as pdfJs from 'pdfjs-dist';
|
||||
import { isAppleSilicon } from 'is-apple-silicon';
|
||||
require('@sentry/electron/renderer');
|
||||
|
||||
// Allows components to use React as a global
|
||||
|
||||
@@ -9,7 +9,7 @@ import { join } from 'path';
|
||||
import uuid, { uuidgen } from '@joplin/lib/uuid';
|
||||
import { hasProtocol } from '@joplin/utils/url';
|
||||
import { fileExtension } from '@joplin/utils/path';
|
||||
const { clipboard, nativeImage } = require('electron');
|
||||
import { clipboard, nativeImage } from 'electron';
|
||||
const packageInfo = require('../../packageInfo');
|
||||
|
||||
interface Components {
|
||||
|
||||
@@ -10,7 +10,7 @@ import Logger from '@joplin/utils/Logger';
|
||||
import getPathToExecutable7Zip from '../../utils/7zip/getPathToExecutable7Zip';
|
||||
import getAssetPath from '../../utils/getAssetPath';
|
||||
// import BackOffHandler from './BackOffHandler';
|
||||
const ipcRenderer = require('electron').ipcRenderer;
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
const logger = Logger.create('PluginRunner');
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
||||
import { themeStyle } from '@joplin/lib/theme';
|
||||
import shim from '@joplin/lib/shim';
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
const { camelCaseToDash, formatCssSize } = require('@joplin/lib/string-utils');
|
||||
import { camelCaseToDash, formatCssSize } from '@joplin/lib/string-utils';
|
||||
|
||||
interface HookDependencies {
|
||||
pluginId: string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import shim from '@joplin/lib/shim';
|
||||
const { dirname } = require('@joplin/lib/path-utils');
|
||||
import { dirname } from '@joplin/lib/path-utils';
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
const pluginAssets = require('./pluginAssets/index');
|
||||
import KvStore from '@joplin/lib/services/KvStore';
|
||||
|
||||
@@ -2,7 +2,7 @@ import Resource from '@joplin/lib/models/Resource';
|
||||
import { ResourceEntity } from '@joplin/lib/services/database/types';
|
||||
import shim from '@joplin/lib/shim';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
const FileViewer = require('react-native-file-viewer').default;
|
||||
import FileViewer from 'react-native-file-viewer';
|
||||
|
||||
|
||||
const logger = Logger.create('showResource');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useContext } from 'react';
|
||||
|
||||
const { _ } = require('@joplin/lib/locale.js');
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import Resource from '@joplin/lib/models/Resource';
|
||||
import { copyToCache } from '../../../utils/ShareUtils';
|
||||
import isEditableResource from '../../NoteEditor/ImageEditor/isEditableResource';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { AppState } from '../utils/types';
|
||||
import getEmptyFolderMessage from '@joplin/lib/components/shared/NoteList/getEmptyFolderMessage';
|
||||
import Folder from '@joplin/lib/models/Folder';
|
||||
|
||||
const { _ } = require('@joplin/lib/locale');
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import NoteItem from './NoteItem';
|
||||
import { themeStyle } from './global-style';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import time from '@joplin/lib/time';
|
||||
import { Platform } from 'react-native';
|
||||
import Modal from './Modal';
|
||||
import { formatMsToLocal } from '@joplin/utils/time';
|
||||
const DateTimePickerModal = require('react-native-modal-datetime-picker').default;
|
||||
import DateTimePickerModal from 'react-native-modal-datetime-picker';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
centeredView: {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { View, Text, StyleSheet, Linking, Animated, Easing } from 'react-native';
|
||||
const { connect } = require('react-redux');
|
||||
const { _ } = require('@joplin/lib/locale');
|
||||
import { connect } from 'react-redux';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
const { themeStyle } = require('../global-style.js');
|
||||
import { AppState } from '../../utils/types';
|
||||
import { generateApplicationConfirmUrl, reducer, checkIfLoginWasSuccessful, saveApplicationAuthId, defaultState } from '@joplin/lib/services/joplinCloudUtils';
|
||||
|
||||
@@ -14,7 +14,7 @@ import Note from '@joplin/lib/models/Note';
|
||||
import BaseItem from '@joplin/lib/models/BaseItem';
|
||||
import Resource from '@joplin/lib/models/Resource';
|
||||
import Folder from '@joplin/lib/models/Folder';
|
||||
const Clipboard = require('@react-native-clipboard/clipboard').default;
|
||||
import Clipboard from '@react-native-clipboard/clipboard';
|
||||
const md5 = require('md5');
|
||||
import BackButtonService from '../../../services/BackButtonService';
|
||||
import NavService, { OnNavigateCallback as OnNavigateCallback } from '@joplin/lib/services/NavService';
|
||||
|
||||
@@ -3,7 +3,7 @@ import useSyncTargetUpgrade from '@joplin/lib/services/synchronizer/gui/useSyncT
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import { View, Text, ScrollView, TextStyle } from 'react-native';
|
||||
|
||||
const { connect } = require('react-redux');
|
||||
import { connect } from 'react-redux';
|
||||
import { themeStyle } from '../global-style';
|
||||
import ScreenHeader from '../ScreenHeader';
|
||||
import { AppState } from '../../utils/types';
|
||||
|
||||
@@ -2,19 +2,32 @@ import * as React from 'react';
|
||||
|
||||
import { View, Button, Text, TextInput, TouchableOpacity, StyleSheet, ScrollView } from 'react-native';
|
||||
import { AppState } from '../../utils/types';
|
||||
const { connect } = require('react-redux');
|
||||
import { connect } from 'react-redux';
|
||||
import { ScreenHeader } from '../ScreenHeader';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
const { BaseScreenComponent } = require('../base-screen');
|
||||
import { BaseScreenComponent } from '../base-screen';
|
||||
const Shared = require('@joplin/lib/components/shared/dropbox-login-shared');
|
||||
import shim, { MessageBoxType } from '@joplin/lib/shim';
|
||||
import { themeStyle } from '../global-style';
|
||||
|
||||
class DropboxLoginScreenComponent extends BaseScreenComponent {
|
||||
public constructor() {
|
||||
super();
|
||||
interface Props {
|
||||
themeId: number;
|
||||
}
|
||||
|
||||
this.styles_ = {};
|
||||
interface State {
|
||||
loginUrl: string;
|
||||
authCode: string;
|
||||
checkingAuthToken: boolean;
|
||||
}
|
||||
|
||||
class DropboxLoginScreenComponent extends BaseScreenComponent<Props, State> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Migrated from JS; per-theme StyleSheet cache
|
||||
private styles_: Record<number, any> = {};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Shared comes from an untyped JS module
|
||||
private shared_: any;
|
||||
|
||||
public constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
this.shared_ = new Shared(
|
||||
this,
|
||||
|
||||
@@ -27,7 +27,7 @@ import useOnLongPressProps from '../utils/hooks/useOnLongPressProps';
|
||||
import { TouchableRipple } from 'react-native-paper';
|
||||
import shim from '@joplin/lib/shim';
|
||||
import getConflictFolderId from '@joplin/lib/models/utils/getConflictFolderId';
|
||||
const { substrWithEllipsis } = require('@joplin/lib/string-utils');
|
||||
import { substrWithEllipsis } from '@joplin/lib/string-utils';
|
||||
|
||||
interface Props {
|
||||
syncStarted: boolean;
|
||||
|
||||
@@ -33,7 +33,7 @@ interface DropdownAlertData {
|
||||
resolve?: (_value: DropdownAlertData)=> void;
|
||||
}
|
||||
import SafeAreaView from './components/SafeAreaView';
|
||||
const { connect, Provider } = require('react-redux');
|
||||
import { connect, Provider } from 'react-redux';
|
||||
import { Provider as PaperProvider, MD3DarkTheme, MD3LightTheme } from 'react-native-paper';
|
||||
import BackButtonService, { BackButtonHandler } from './services/BackButtonService';
|
||||
import NavService from '@joplin/lib/services/NavService';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Notification } from '@joplin/lib/models/Alarm';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
import type { PushNotification, PushNotificationPermissions, ScheduleLocalNotificationDetails } from '@react-native-community/push-notification-ios';
|
||||
const PushNotificationIOS = require('@react-native-community/push-notification-ios').default;
|
||||
import PushNotificationIOS, { PushNotification, PushNotificationPermissions, ScheduleLocalNotificationDetails } from '@react-native-community/push-notification-ios';
|
||||
|
||||
export default class AlarmServiceDriver {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { Platform, NativeModules } = require('react-native');
|
||||
import { Platform, NativeModules } from 'react-native';
|
||||
|
||||
export default async function setIgnoreTlsErrors(ignore: boolean): Promise<boolean> {
|
||||
if (Platform.OS === 'android') {
|
||||
|
||||
@@ -16,7 +16,7 @@ import SyncTargetJoplinCloud from '@joplin/lib/SyncTargetJoplinCloud';
|
||||
import { completePendingAuthentication } from '@joplin/lib/services/joplinCloudUtils';
|
||||
import SyncTargetOneDrive from '@joplin/lib/SyncTargetOneDrive';
|
||||
import initProfile from '@joplin/lib/services/profileConfig/initProfile';
|
||||
const VersionInfo = require('react-native-version-info').default;
|
||||
import VersionInfo from 'react-native-version-info';
|
||||
const AlarmServiceDriver = require('../services/AlarmServiceDriver').default;
|
||||
import NavService from '@joplin/lib/services/NavService';
|
||||
import { Dispatch, Store } from 'redux';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import FsDriverBase, { ReadDirStatsOptions } from '@joplin/lib/fs-driver-base';
|
||||
const RNFetchBlob = require('rn-fetch-blob').default;
|
||||
import RNFetchBlob from 'rn-fetch-blob';
|
||||
import * as RNFS from '@dr.pogodin/react-native-fs';
|
||||
import RNSAF, { DocumentFileDetail, openDocumentTree } from '@joplin/react-native-saf-x';
|
||||
import type { StatResultT, ReadDirResItemT } from '@dr.pogodin/react-native-fs';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Dispatch } from 'redux';
|
||||
|
||||
const { NativeEventEmitter, NativeModules, Platform } = require('react-native');
|
||||
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
||||
|
||||
interface NotificationData {
|
||||
joplinNotificationId: string;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import buildAll from './commands/buildAll';
|
||||
import editPatch from './commands/editPatch';
|
||||
import * as yargs from 'yargs';
|
||||
import { Argv, ArgumentsCamelCase } from 'yargs';
|
||||
const yargs = require('yargs');
|
||||
|
||||
|
||||
const build = () => {
|
||||
// eslint-disable-next-line no-unused-expressions -- Old code before rule was applied
|
||||
// eslint-disable-next-line no-unused-expressions, @typescript-eslint/no-floating-promises -- Old code before rule was applied
|
||||
yargs
|
||||
.usage('$0 <cmd> [args]')
|
||||
.command('build <outputDir>', 'build all', (yargs: Argv) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as fs from 'fs-extra';
|
||||
const Datauri = require('datauri/sync');
|
||||
import Datauri = require('datauri/sync');
|
||||
import { dirname } from 'path';
|
||||
import packToWriter, { type FileApiChunkCallback } from './packToWriter';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const Entities = require('html-entities').AllHtmlEntities;
|
||||
import { AllHtmlEntities as Entities } from 'html-entities';
|
||||
import { CssTypes, parse as cssParse, stringify as cssStringify } from '@adobe/css-tools';
|
||||
import { dirname, basename } from 'path';
|
||||
import parseHtmlAsync, { HtmlAttrs } from './utils/parseHtmlAsync';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const htmlparser2 = require('@joplin/fork-htmlparser2');
|
||||
import * as htmlparser2 from '@joplin/fork-htmlparser2';
|
||||
|
||||
export type HtmlAttrs = Record<string, string>;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { LoadOptions, SaveOptions } from './models/utils/types';
|
||||
import ActionLogger, { ItemActionType as ItemActionType } from './utils/ActionLogger';
|
||||
import { BaseItemEntity, SqlQuery } from './services/database/types';
|
||||
import uuid from './uuid';
|
||||
const Mutex = require('async-mutex').Mutex;
|
||||
import { Mutex } from 'async-mutex';
|
||||
|
||||
// New code should make use of this enum
|
||||
export enum ModelType {
|
||||
|
||||
@@ -2,7 +2,7 @@ import Setting from './models/Setting';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
import Api, { RequestFile } from './services/rest/Api';
|
||||
import ApiResponse from './services/rest/ApiResponse';
|
||||
const urlParser = require('url');
|
||||
import * as urlParser from 'url';
|
||||
const { randomClipperPort, startPort } = require('./randomClipperPort');
|
||||
const enableServerDestroy = require('server-destroy');
|
||||
const multiparty = require('multiparty');
|
||||
|
||||
@@ -7,7 +7,7 @@ import Logger from '@joplin/utils/Logger';
|
||||
import personalizedUserContentBaseUrl from './services/joplinServer/personalizedUserContentBaseUrl';
|
||||
import { getHttpStatusMessage } from './net-utils';
|
||||
import { getApplicationInformation } from './services/joplinCloudUtils';
|
||||
const { stringify } = require('query-string');
|
||||
import { stringify } from 'query-string';
|
||||
|
||||
const logger = Logger.create('JoplinServerApi');
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import shim, { MobilePlatform } from './shim';
|
||||
import uuid from './uuid';
|
||||
import { fileExtension, basename } from './path-utils';
|
||||
import { _ } from './locale';
|
||||
const { pregQuote } = require('./string-utils');
|
||||
import { pregQuote } from './string-utils';
|
||||
import { FolderIconType } from './services/database/types';
|
||||
|
||||
export enum WelcomeAssetPlatform {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Setting, { AppType, SettingMetadataSection, SettingSectionSource, type SettingsRecord } from '../../../models/Setting';
|
||||
import SyncTargetRegistry from '../../../SyncTargetRegistry';
|
||||
const { _ } = require('../../../locale');
|
||||
import { _ } from '../../../locale';
|
||||
import { createSelector } from 'reselect';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import time from './time';
|
||||
import shim from './shim';
|
||||
import { SqlParams, SqlQuery, StringOrSqlQuery } from './services/database/types';
|
||||
|
||||
const Mutex = require('async-mutex').Mutex;
|
||||
import { Mutex } from 'async-mutex';
|
||||
|
||||
// Row values come back as SQLite primitives (string|number|null|Buffer for BLOBs)
|
||||
// but per-table column shapes vary, and callers across the codebase index without
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const fastDeepEqual = require('fast-deep-equal');
|
||||
import * as fastDeepEqual from 'fast-deep-equal';
|
||||
import { EventEmitter } from 'events';
|
||||
import type { State as AppState } from './reducer';
|
||||
import { ModelType } from './BaseModel';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import time from './time';
|
||||
const fs = require('fs-extra');
|
||||
import * as fs from 'fs-extra';
|
||||
import { basicDelta, DeltaOptions, GetOptions, MultiPutItem, PutOptions } from './file-api';
|
||||
|
||||
interface MemoryItem {
|
||||
|
||||
@@ -3,14 +3,14 @@ import shim from './shim';
|
||||
import BaseItem, { RemoteItemMetadata } from './models/BaseItem';
|
||||
import time from './time';
|
||||
|
||||
const { isHidden } = require('./path-utils');
|
||||
import { isHidden } from './path-utils';
|
||||
import JoplinError from './JoplinError';
|
||||
import { Lock, LockClientType, LockType } from './services/synchronizer/LockHandler';
|
||||
import * as ArrayUtils from './ArrayUtils';
|
||||
import Setting from './models/Setting';
|
||||
import SyncTargetRegistry from './SyncTargetRegistry';
|
||||
const { sprintf } = require('sprintf-js');
|
||||
const Mutex = require('async-mutex').Mutex;
|
||||
import { Mutex } from 'async-mutex';
|
||||
|
||||
const logger = Logger.create('FileApi');
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import AdmZip = require('adm-zip');
|
||||
import FsDriverBase, { Stat, ZipEntry, ArchiveExtractOptions, TarOptions } from './fs-driver-base';
|
||||
import time from './time';
|
||||
const md5File = require('md5-file');
|
||||
const fs = require('fs-extra');
|
||||
import * as fs from 'fs-extra';
|
||||
|
||||
interface FsError extends Error {
|
||||
code?: string;
|
||||
@@ -28,7 +28,7 @@ export default class FsDriverNode extends FsDriverBase {
|
||||
|
||||
public async appendFile(path: string, string: string, encoding = 'base64') {
|
||||
try {
|
||||
return await fs.appendFile(path, string, { encoding: encoding });
|
||||
return await fs.appendFile(path, string, { encoding: encoding as BufferEncoding });
|
||||
} catch (error) {
|
||||
throw this.fsErrorToJsError_(error, path);
|
||||
}
|
||||
@@ -39,7 +39,7 @@ export default class FsDriverNode extends FsDriverBase {
|
||||
if (encoding === 'buffer') {
|
||||
return await fs.writeFile(path, string);
|
||||
} else {
|
||||
return await fs.writeFile(path, string, { encoding: encoding });
|
||||
return await fs.writeFile(path, string, { encoding: encoding as BufferEncoding });
|
||||
}
|
||||
} catch (error) {
|
||||
throw this.fsErrorToJsError_(error, path);
|
||||
@@ -155,7 +155,7 @@ export default class FsDriverNode extends FsDriverBase {
|
||||
public async readFile(path: string, encoding = 'utf8') {
|
||||
try {
|
||||
if (encoding === 'Buffer') return await fs.readFile(path); // Returns the raw buffer
|
||||
return await fs.readFile(path, encoding);
|
||||
return await fs.readFile(path, encoding as BufferEncoding);
|
||||
} catch (error) {
|
||||
throw this.fsErrorToJsError_(error, path);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const urlUtils = require('./urlUtils.js');
|
||||
const Entities = require('html-entities').AllHtmlEntities;
|
||||
import { AllHtmlEntities as Entities } from 'html-entities';
|
||||
const htmlentities = new Entities().encode;
|
||||
const { escapeHtml } = require('./string-utils.js');
|
||||
import { escapeHtml } from './string-utils';
|
||||
|
||||
// [\s\S] instead of . for multiline matching
|
||||
// https://stackoverflow.com/a/16119722/561309
|
||||
|
||||
@@ -2,8 +2,8 @@ import { NoteEntity, ResourceEntity, TagEntity } from './services/database/types
|
||||
import shim from './shim';
|
||||
|
||||
import { readFile, stat } from 'fs/promises';
|
||||
const os = require('os');
|
||||
const { filename } = require('./path-utils');
|
||||
import * as os from 'os';
|
||||
import { filename } from './path-utils';
|
||||
import { setupDatabaseAndSynchronizer, switchClient, expectNotThrow, supportDir, expectThrow } from './testing/test-utils';
|
||||
const { enexXmlToMd } = require('./import-enex-md-gen.js');
|
||||
import importEnex, { ImportOptions } from './import-enex';
|
||||
|
||||
@@ -10,8 +10,8 @@ import { MarkupToHtml } from '@joplin/renderer';
|
||||
import { fileExtension, friendlySafeFilename, safeFileExtension } from './path-utils';
|
||||
import { extractUrls as extractUrlsFromHtml } from '@joplin/utils/html';
|
||||
import { extractUrls as extractUrlsFromMarkdown } from '@joplin/utils/markdown';
|
||||
const moment = require('moment');
|
||||
const { wrapError } = require('./errorUtils');
|
||||
import * as moment from 'moment';
|
||||
import { wrapError } from './errorUtils';
|
||||
const { enexXmlToHtml } = require('./import-enex-html-gen.js');
|
||||
const md5 = require('md5');
|
||||
const { Base64Decode } = require('base64-stream');
|
||||
|
||||
@@ -2,7 +2,7 @@ import { validateLinks } from '@joplin/renderer';
|
||||
const stringPadding = require('string-padding');
|
||||
const urlUtils = require('./urlUtils');
|
||||
import type * as MarkdownItType from 'markdown-it';
|
||||
const MarkdownIt = require('markdown-it');
|
||||
import * as MarkdownIt from 'markdown-it';
|
||||
|
||||
// Taken from codemirror/addon/edit/continuelist.js
|
||||
const listRegex = /^(\s*)([*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]\s))(\s*)/;
|
||||
|
||||
@@ -17,7 +17,7 @@ import { checkIfItemCanBeAddedToFolder, checkIfItemCanBeChanged, checkIfItemsCan
|
||||
import { checkObjectHasProperties } from '@joplin/utils/object';
|
||||
|
||||
const { sprintf } = require('sprintf-js');
|
||||
const moment = require('moment');
|
||||
import * as moment from 'moment';
|
||||
|
||||
export interface ItemsThatNeedDecryptionResult {
|
||||
hasMore: boolean;
|
||||
|
||||
@@ -21,7 +21,7 @@ import { getCollator } from './utils/getCollator';
|
||||
import Setting from './Setting';
|
||||
import { itemIsReadOnlySync, ItemSlice } from './utils/readOnly';
|
||||
import ItemChange from './ItemChange';
|
||||
const { substrWithEllipsis } = require('../string-utils.js');
|
||||
import { substrWithEllipsis } from '../string-utils';
|
||||
|
||||
const logger = Logger.create('models/Folder');
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ import Tag from './Tag';
|
||||
const { sprintf } = require('sprintf-js');
|
||||
import syncDebugLog from '../services/synchronizer/syncDebugLog';
|
||||
import { toFileProtocolPath, toForwardSlashes } from '../path-utils';
|
||||
const { pregQuote, substrWithEllipsis } = require('../string-utils.js');
|
||||
const { _, _n } = require('../locale');
|
||||
import { pregQuote, substrWithEllipsis } from '../string-utils';
|
||||
import { _, _n } from '../locale';
|
||||
import { pull, removeElement, unique } from '../ArrayUtils';
|
||||
import { LoadOptions, SaveOptions } from './utils/types';
|
||||
import ActionLogger from '../utils/ActionLogger';
|
||||
@@ -24,7 +24,7 @@ const urlUtils = require('../urlUtils.js');
|
||||
import { hasWhiteboardFence, parseWhiteboard } from '../services/whiteboard/parse';
|
||||
import { resolveFileRef, RefKind } from '../services/whiteboard/resolveRef';
|
||||
const { isImageMimeType } = require('../resourceUtils');
|
||||
const { MarkupToHtml } = require('@joplin/renderer');
|
||||
import { MarkupToHtml } from '@joplin/renderer';
|
||||
const { ALL_NOTES_FILTER_ID } = require('../reserved-ids');
|
||||
|
||||
export interface PreviewsOrder {
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { PluginSettings } from '../../services/plugins/PluginService';
|
||||
import type { PublicPrivateKeyPair } from '../../services/e2ee/ppk/ppk';
|
||||
import { EmptyObject } from '@joplin/utils/types';
|
||||
const ObjectUtils = require('../../ObjectUtils');
|
||||
const { toTitleCase } = require('../../string-utils.js');
|
||||
import { toTitleCase } from '../../string-utils';
|
||||
|
||||
const customCssFilePath = (Setting: typeof SettingType, filename: string): string => {
|
||||
return `${Setting.value('rootProfileDir')}/${filename}`;
|
||||
|
||||
@@ -3,7 +3,7 @@ import time from './time';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
import { _ } from './locale';
|
||||
|
||||
const { stringify } = require('query-string');
|
||||
import { stringify } from 'query-string';
|
||||
const urlUtils = require('./urlUtils.js');
|
||||
const Buffer = require('buffer').Buffer;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import Logger from '@joplin/utils/Logger';
|
||||
import { SettingsRecord } from './models/settings/types';
|
||||
import { Toast, ToastType } from './services/plugins/api/types';
|
||||
import { unique } from './array';
|
||||
const fastDeepEqual = require('fast-deep-equal');
|
||||
import * as fastDeepEqual from 'fast-deep-equal';
|
||||
const { ALL_NOTES_FILTER_ID } = require('./reserved-ids');
|
||||
const { createSelectorCreator, defaultMemoize } = require('reselect');
|
||||
const { createCachedSelector } = require('re-reselect');
|
||||
|
||||
@@ -10,7 +10,7 @@ import EncryptionService from './e2ee/EncryptionService';
|
||||
import PerformanceLogger from '../PerformanceLogger';
|
||||
import AsyncActionQueue from '../AsyncActionQueue';
|
||||
|
||||
const EventEmitter = require('events');
|
||||
import * as EventEmitter from 'events';
|
||||
const perfLogger = PerformanceLogger.create();
|
||||
|
||||
interface DecryptionResult {
|
||||
|
||||
@@ -8,7 +8,7 @@ import Note from '../models/Note';
|
||||
import { openFileWithExternalEditor } from './ExternalEditWatcher/utils';
|
||||
import AsyncActionQueue from '../AsyncActionQueue';
|
||||
import { EventEmitter } from 'events';
|
||||
const chokidar = require('chokidar');
|
||||
import * as chokidar from 'chokidar';
|
||||
const { ErrorNotFound } = require('./rest/utils/errors');
|
||||
|
||||
interface ChangeEventContext {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { MutexInterface } from 'async-mutex';
|
||||
import JoplinDatabase from '../JoplinDatabase';
|
||||
import BaseService from './BaseService';
|
||||
const Mutex = require('async-mutex').Mutex;
|
||||
import { Mutex } from 'async-mutex';
|
||||
|
||||
enum ValueType {
|
||||
Int = 1,
|
||||
|
||||
@@ -8,7 +8,7 @@ import DecryptionWorker from './DecryptionWorker';
|
||||
import ResourceFetcher from './ResourceFetcher';
|
||||
import Resource from '../models/Resource';
|
||||
import { _, _n } from '../locale';
|
||||
const { toTitleCase } = require('../string-utils.js');
|
||||
import { toTitleCase } from '../string-utils';
|
||||
|
||||
enum CanRetryType {
|
||||
E2EE = 'e2ee',
|
||||
|
||||
@@ -7,7 +7,7 @@ import Setting from '../../models/Setting';
|
||||
import Resource from '../../models/Resource';
|
||||
import { ResourceEntity } from '../database/types';
|
||||
import { EventEmitter } from 'events';
|
||||
const chokidar = require('chokidar');
|
||||
import * as chokidar from 'chokidar';
|
||||
|
||||
type WindowId = string;
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ import { _ } from '../locale';
|
||||
import { ItemChangeEntity, NoteEntity, RevisionEntity } from './database/types';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
import { MarkupLanguage } from '../../renderer';
|
||||
const { substrWithEllipsis } = require('../string-utils');
|
||||
import { substrWithEllipsis } from '../string-utils';
|
||||
const { sprintf } = require('sprintf-js');
|
||||
const { wrapError } = require('../errorUtils');
|
||||
import { wrapError } from '../errorUtils';
|
||||
|
||||
const logger = Logger.create('RevisionService');
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import BaseItem from '../../models/BaseItem';
|
||||
import JoplinError from '../../JoplinError';
|
||||
import { getActiveMasterKeyId, setActiveMasterKeyId } from '../synchronizer/syncInfoUtils';
|
||||
import PerformanceLogger from '../../PerformanceLogger';
|
||||
const { padLeft } = require('../../string-utils.js');
|
||||
import { padLeft } from '../../string-utils';
|
||||
|
||||
const logger = Logger.create('EncryptionService');
|
||||
const perfLogger = PerformanceLogger.create();
|
||||
|
||||
@@ -24,7 +24,7 @@ import InteropService_Importer_EnexToHtml from './InteropService_Importer_EnexTo
|
||||
import InteropService_Importer_EnexToMd from './InteropService_Importer_EnexToMd';
|
||||
import InteropService_Importer_OneNote from './InteropService_Importer_OneNote';
|
||||
const { sprintf } = require('sprintf-js');
|
||||
const { fileExtension } = require('../../path-utils');
|
||||
import { fileExtension } from '../../path-utils';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
export default class InteropService {
|
||||
|
||||
@@ -13,7 +13,7 @@ import { ThemeStyle } from '../../theme';
|
||||
import { basename, friendlySafeFilename, rtrimSlashes, dirname } from '../../path-utils';
|
||||
import packToWriter from '@joplin/htmlpack/packToWriter';
|
||||
const { themeStyle } = require('../../theme');
|
||||
const { escapeHtml } = require('../../string-utils.js');
|
||||
import { escapeHtml } from '../../string-utils';
|
||||
import { assetsToHeaders } from '@joplin/renderer';
|
||||
import getPluginSettingValue from '../plugins/utils/getPluginSettingValue';
|
||||
import { LinkRenderingType } from '@joplin/renderer/MdToHtml';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import InteropService_Exporter_Base from './InteropService_Exporter_Base';
|
||||
import BaseItem from '../../models/BaseItem';
|
||||
const { basename } = require('../../path-utils');
|
||||
import { basename } from '../../path-utils';
|
||||
import shim from '../../shim';
|
||||
import { BaseItemEntity, ResourceEntity } from '../database/types';
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import Folder from '../../models/Folder';
|
||||
import { FolderEntity } from '../database/types';
|
||||
import { fileExtension, rtrimSlashes } from '../../path-utils';
|
||||
import shim from '../../shim';
|
||||
const { filename } = require('../../path-utils');
|
||||
import { filename } from '../../path-utils';
|
||||
|
||||
const doImportEnex = async (destFolder: FolderEntity, sourcePath: string, options: ImportOptions) => {
|
||||
if (!destFolder) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ImportExportResult } from './types';
|
||||
|
||||
import InteropService_Importer_Base from './InteropService_Importer_Base';
|
||||
import InteropService_Importer_Raw from './InteropService_Importer_Raw';
|
||||
const { filename } = require('../../path-utils');
|
||||
import { filename } from '../../path-utils';
|
||||
import shim from '../../shim';
|
||||
|
||||
export default class InteropService_Importer_Jex extends InteropService_Importer_Base {
|
||||
|
||||
@@ -12,7 +12,7 @@ const { sprintf } = require('sprintf-js');
|
||||
import shim from '../../shim';
|
||||
import { Stat } from '../../fs-driver-base';
|
||||
import { ResourceEntity } from '../database/types';
|
||||
const { fileExtension } = require('../../path-utils');
|
||||
import { fileExtension } from '../../path-utils';
|
||||
import uuid from '../../uuid';
|
||||
|
||||
export default class InteropService_Importer_Raw extends InteropService_Importer_Base {
|
||||
|
||||
@@ -4,7 +4,7 @@ import shim from '../../shim';
|
||||
import { ViewHandle } from './utils/createViewHandle';
|
||||
import { ContentScriptType } from './api/types';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
const EventEmitter = require('events');
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
const logger = Logger.create('Plugin');
|
||||
|
||||
@@ -33,7 +33,7 @@ export default class Plugin {
|
||||
private viewControllers_: ViewControllers = {};
|
||||
private contentScripts_: ContentScripts = {};
|
||||
private dispatch_: PluginDispatchCallback;
|
||||
private eventEmitter_: InstanceType<typeof EventEmitter>;
|
||||
private eventEmitter_: EventEmitter;
|
||||
private devMode_ = false;
|
||||
private builtIn_ = false;
|
||||
private messageListener_: MessageListenerCallback = null;
|
||||
@@ -120,13 +120,11 @@ export default class Plugin {
|
||||
this.hasErrors_ = hasErrors;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
|
||||
public on(eventName: string, callback: Function) {
|
||||
public on(eventName: string, callback: (...args: unknown[])=> void) {
|
||||
return this.eventEmitter_.on(eventName, callback);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
|
||||
public off(eventName: string, callback: Function) {
|
||||
public off(eventName: string, callback: (...args: unknown[])=> void) {
|
||||
return this.eventEmitter_.removeListener(eventName, callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import ViewController, { EmitMessageEvent, PluginStore } from './ViewController'
|
||||
import { MessageListenerCallback } from './Plugin';
|
||||
import shim from '../../shim';
|
||||
import { ButtonSpec, DialogResult, ViewHandle } from './api/types';
|
||||
const { toSystemSlashes } = require('../../path-utils');
|
||||
import { toSystemSlashes } from '../../path-utils';
|
||||
import PostMessageService, { MessageParticipant } from '../PostMessageService';
|
||||
import { PluginEditorViewState, PluginViewState } from './reducer';
|
||||
import { defaultWindowId } from '../../reducer';
|
||||
|
||||
@@ -10,7 +10,7 @@ import Tag from '../../models/Tag';
|
||||
import NoteTag from '../../models/NoteTag';
|
||||
import ResourceService from '../../services/ResourceService';
|
||||
import SearchEngine from '../search/SearchEngine';
|
||||
const { MarkupToHtml } = require('@joplin/renderer');
|
||||
import { MarkupToHtml } from '@joplin/renderer';
|
||||
import { NoteEntity, ResourceEntity } from '../database/types';
|
||||
import { toFileProtocolPath } from '@joplin/utils/path';
|
||||
import { join } from 'path';
|
||||
|
||||
@@ -12,7 +12,7 @@ import route_auth from './routes/auth';
|
||||
import route_events from './routes/events';
|
||||
import route_revisions from './routes/revisions';
|
||||
|
||||
const { ltrimSlashes } = require('../../path-utils');
|
||||
import { ltrimSlashes } from '../../path-utils';
|
||||
const md5 = require('md5');
|
||||
|
||||
export enum RequestMethod {
|
||||
|
||||
@@ -23,8 +23,8 @@ const urlUtils = require('../../../urlUtils.js');
|
||||
import * as ArrayUtils from '../../../ArrayUtils';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
const { mimeTypeFromHeaders } = require('../../../net-utils');
|
||||
const { fileExtension, safeFileExtension, safeFilename, filename } = require('../../../path-utils');
|
||||
const { MarkupToHtml } = require('@joplin/renderer');
|
||||
import { fileExtension, safeFileExtension, safeFilename, filename } from '../../../path-utils';
|
||||
import { MarkupToHtml } from '@joplin/renderer';
|
||||
const { ErrorNotFound } = require('../utils/errors');
|
||||
import { fileUriToPath } from '@joplin/utils/url';
|
||||
import { NoteEntity, ResourceEntity } from '../../database/types';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Theme } from '../../themes/type';
|
||||
const { camelCaseToDash, formatCssSize } = require('../../string-utils');
|
||||
import { camelCaseToDash, formatCssSize } from '../../string-utils';
|
||||
|
||||
const isColor = (v: unknown): v is { color: unknown; model: unknown; valpha: unknown } => {
|
||||
return !!v && typeof v === 'object' && ('color' in v) && ('model' in v) && ('valpha' in v);
|
||||
|
||||
Loaded 100 of 142 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user