From 734a153fe4b8a355f7aca2dfa159cc5d460d9756 Mon Sep 17 00:00:00 2001 From: meld-cp <18450687+meld-cp@users.noreply.github.com> Date: Sat, 28 Jun 2025 23:36:02 +1200 Subject: [PATCH] standardize imports --- package-lock.json | 4 ++-- src/PluginPasswordModal.ts | 4 ++-- src/features/IMeldEncryptPluginFeature.ts | 4 ++-- .../FeatureConvertNote.ts | 19 +++++++-------- .../FeatureInplaceEncrypt.ts | 24 +++++++++---------- .../feature-inplace-encrypt/PasswordModal.ts | 2 +- .../featureInplaceTextAnalysis.ts | 4 ++-- .../EncryptedMarkdownView.ts | 8 +++---- .../FeatureWholeNoteEncrypt.ts | 14 +++++------ src/main.ts | 14 +++++------ src/services/CryptoHelper2304.ts | 2 +- src/services/CryptoHelperFactory.ts | 12 +++++----- src/services/FileDataHelper.ts | 2 +- src/services/SessionPasswordService.ts | 4 ++-- src/settings/MeldEncryptPluginSettings.ts | 4 ++-- src/settings/MeldEncryptSettingsTab.ts | 8 +++---- src/tools/mdenc.ts | 15 ++++++------ src/tools/offline-decrypt.ts | 8 +++---- tsconfig.json | 2 ++ 19 files changed, 78 insertions(+), 76 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3ea20b3..4c707d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "meld-encrypt", - "version": "2.4.2", + "version": "2.4.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "meld-encrypt", - "version": "2.4.2", + "version": "2.4.3", "license": "MIT", "devDependencies": { "@types/node": "24.0.4", diff --git a/src/PluginPasswordModal.ts b/src/PluginPasswordModal.ts index f2986a5..46b1d24 100644 --- a/src/PluginPasswordModal.ts +++ b/src/PluginPasswordModal.ts @@ -1,6 +1,6 @@ import { App, Modal, Setting, TextComponent } from 'obsidian'; -import { UiHelper } from 'src/services/UiHelper'; -import { PasswordAndHint } from './services/SessionPasswordService'; +import { UiHelper } from './services/UiHelper.ts'; +import { PasswordAndHint } from './services/SessionPasswordService.ts'; export default class PluginPasswordModal extends Modal { diff --git a/src/features/IMeldEncryptPluginFeature.ts b/src/features/IMeldEncryptPluginFeature.ts index e3e6516..744ecbc 100644 --- a/src/features/IMeldEncryptPluginFeature.ts +++ b/src/features/IMeldEncryptPluginFeature.ts @@ -1,5 +1,5 @@ -import MeldEncrypt from "../main"; -import { IMeldEncryptPluginSettings } from "../settings/MeldEncryptPluginSettings"; +import MeldEncrypt from "../main.ts"; +import { IMeldEncryptPluginSettings } from "../settings/MeldEncryptPluginSettings.ts"; export interface IMeldEncryptPluginFeature { onload(plugin: MeldEncrypt, settings: IMeldEncryptPluginSettings): Promise; diff --git a/src/features/feature-convert-note/FeatureConvertNote.ts b/src/features/feature-convert-note/FeatureConvertNote.ts index 36d47a2..72e71eb 100644 --- a/src/features/feature-convert-note/FeatureConvertNote.ts +++ b/src/features/feature-convert-note/FeatureConvertNote.ts @@ -1,14 +1,13 @@ -import MeldEncrypt from "src/main"; -import { IMeldEncryptPluginSettings } from "src/settings/MeldEncryptPluginSettings"; -import { IMeldEncryptPluginFeature } from "../IMeldEncryptPluginFeature"; +import MeldEncrypt from "../../main.ts"; +import { IMeldEncryptPluginSettings } from "../../settings/MeldEncryptPluginSettings.ts"; +import { IMeldEncryptPluginFeature } from "../IMeldEncryptPluginFeature.ts"; import { Notice, TFile, TextFileView } from "obsidian"; -import PluginPasswordModal from "src/PluginPasswordModal"; -import { PasswordAndHint, SessionPasswordService } from "src/services/SessionPasswordService"; -import { FileDataHelper, JsonFileEncoding } from "src/services/FileDataHelper"; -import { Utils } from "src/services/Utils"; -import "src/services/Constants"; -import { ENCRYPTED_FILE_EXTENSIONS, ENCRYPTED_FILE_EXTENSION_DEFAULT } from "src/services/Constants"; -import { EncryptedMarkdownView } from "../feature-whole-note-encrypt/EncryptedMarkdownView"; +import PluginPasswordModal from "../../PluginPasswordModal.ts"; +import { PasswordAndHint, SessionPasswordService } from "../../services/SessionPasswordService.ts"; +import { FileDataHelper, JsonFileEncoding } from "../../services/FileDataHelper.ts"; +import { Utils } from "../../services/Utils.ts"; +import { ENCRYPTED_FILE_EXTENSIONS, ENCRYPTED_FILE_EXTENSION_DEFAULT } from "../../services/Constants.ts"; +import { EncryptedMarkdownView } from "../feature-whole-note-encrypt/EncryptedMarkdownView.ts"; export default class FeatureConvertNote implements IMeldEncryptPluginFeature { diff --git a/src/features/feature-inplace-encrypt/FeatureInplaceEncrypt.ts b/src/features/feature-inplace-encrypt/FeatureInplaceEncrypt.ts index e334f22..a9a8329 100644 --- a/src/features/feature-inplace-encrypt/FeatureInplaceEncrypt.ts +++ b/src/features/feature-inplace-encrypt/FeatureInplaceEncrypt.ts @@ -1,16 +1,16 @@ import { Editor, EditorPosition, Notice, Setting, MarkdownPostProcessorContext, MarkdownView } from "obsidian"; -import DecryptModal from "./DecryptModal"; -import { IMeldEncryptPluginFeature } from "../IMeldEncryptPluginFeature"; -import MeldEncrypt from "../../main"; -import { IMeldEncryptPluginSettings } from "../../settings/MeldEncryptPluginSettings"; -import { IFeatureInplaceEncryptSettings } from "./IFeatureInplaceEncryptSettings"; -import PasswordModal from "./PasswordModal"; -import { UiHelper } from "../../services/UiHelper"; -import { SessionPasswordService } from "src/services/SessionPasswordService"; -import { CryptoHelperFactory } from "src/services/CryptoHelperFactory"; -import { Decryptable } from "./Decryptable"; -import { FeatureInplaceTextAnalysis } from "./featureInplaceTextAnalysis"; -import { _HINT, _PREFIXES, _PREFIX_ENCODE_DEFAULT, _PREFIX_ENCODE_DEFAULT_VISIBLE, _SUFFIXES, _SUFFIX_NO_COMMENT, _SUFFIX_WITH_COMMENT } from "./FeatureInplaceConstants"; +import DecryptModal from "./DecryptModal.ts"; +import { IMeldEncryptPluginFeature } from "../IMeldEncryptPluginFeature.ts"; +import MeldEncrypt from "../../main.ts"; +import { IMeldEncryptPluginSettings } from "../../settings/MeldEncryptPluginSettings.ts"; +import { IFeatureInplaceEncryptSettings } from "./IFeatureInplaceEncryptSettings.ts"; +import PasswordModal from "./PasswordModal.ts"; +import { UiHelper } from "../../services/UiHelper.ts"; +import { SessionPasswordService } from "../../services/SessionPasswordService.ts"; +import { CryptoHelperFactory } from "../../services/CryptoHelperFactory.ts"; +import { Decryptable } from "./Decryptable.ts"; +import { FeatureInplaceTextAnalysis } from "./featureInplaceTextAnalysis.ts"; +import { _HINT, _PREFIXES, _PREFIX_ENCODE_DEFAULT, _PREFIX_ENCODE_DEFAULT_VISIBLE, _SUFFIXES, _SUFFIX_NO_COMMENT, _SUFFIX_WITH_COMMENT } from "./FeatureInplaceConstants.ts"; export default class FeatureInplaceEncrypt implements IMeldEncryptPluginFeature{ plugin:MeldEncrypt; diff --git a/src/features/feature-inplace-encrypt/PasswordModal.ts b/src/features/feature-inplace-encrypt/PasswordModal.ts index 34418e8..f730184 100644 --- a/src/features/feature-inplace-encrypt/PasswordModal.ts +++ b/src/features/feature-inplace-encrypt/PasswordModal.ts @@ -1,5 +1,5 @@ import { App, Modal, Setting, TextComponent } from 'obsidian'; -import { UiHelper } from 'src/services/UiHelper'; +import { UiHelper } from '../../services/UiHelper.ts'; export default class PasswordModal extends Modal { diff --git a/src/features/feature-inplace-encrypt/featureInplaceTextAnalysis.ts b/src/features/feature-inplace-encrypt/featureInplaceTextAnalysis.ts index 1d576ff..9803989 100644 --- a/src/features/feature-inplace-encrypt/featureInplaceTextAnalysis.ts +++ b/src/features/feature-inplace-encrypt/featureInplaceTextAnalysis.ts @@ -1,5 +1,5 @@ -import { Decryptable } from "./Decryptable"; -import { _HINT, _PREFIXES, _PREFIX_A, _PREFIX_A_VISIBLE, _PREFIX_B, _PREFIX_B_VISIBLE, _PREFIX_OBSOLETE, _PREFIX_OBSOLETE_VISIBLE, _SUFFIXES } from "./FeatureInplaceConstants"; +import { Decryptable } from "./Decryptable.ts"; +import { _HINT, _PREFIXES, _PREFIX_A, _PREFIX_A_VISIBLE, _PREFIX_B, _PREFIX_B_VISIBLE, _PREFIX_OBSOLETE, _PREFIX_OBSOLETE_VISIBLE, _SUFFIXES } from "./FeatureInplaceConstants.ts"; export class FeatureInplaceTextAnalysis{ processedText:string; diff --git a/src/features/feature-whole-note-encrypt/EncryptedMarkdownView.ts b/src/features/feature-whole-note-encrypt/EncryptedMarkdownView.ts index 9c93ff2..f206277 100644 --- a/src/features/feature-whole-note-encrypt/EncryptedMarkdownView.ts +++ b/src/features/feature-whole-note-encrypt/EncryptedMarkdownView.ts @@ -1,8 +1,8 @@ import { MarkdownView, Notice, TFile, ViewStateResult } from "obsidian"; -import { FileData, FileDataHelper, JsonFileEncoding } from "../../services/FileDataHelper"; -import { PasswordAndHint, SessionPasswordService } from "../../services/SessionPasswordService"; -import PluginPasswordModal from "../../PluginPasswordModal"; -import { ENCRYPTED_FILE_EXTENSIONS } from "src/services/Constants"; +import { FileData, FileDataHelper, JsonFileEncoding } from "../../services/FileDataHelper.ts"; +import { PasswordAndHint, SessionPasswordService } from "../../services/SessionPasswordService.ts"; +import PluginPasswordModal from "../../PluginPasswordModal.ts"; +import { ENCRYPTED_FILE_EXTENSIONS } from "../../services/Constants.ts"; export class EncryptedMarkdownView extends MarkdownView { diff --git a/src/features/feature-whole-note-encrypt/FeatureWholeNoteEncrypt.ts b/src/features/feature-whole-note-encrypt/FeatureWholeNoteEncrypt.ts index ee5aeae..db3a8d8 100644 --- a/src/features/feature-whole-note-encrypt/FeatureWholeNoteEncrypt.ts +++ b/src/features/feature-whole-note-encrypt/FeatureWholeNoteEncrypt.ts @@ -1,11 +1,11 @@ -import MeldEncrypt from "src/main"; -import { IMeldEncryptPluginFeature } from "../IMeldEncryptPluginFeature"; -import { EncryptedMarkdownView } from "./EncryptedMarkdownView"; +import MeldEncrypt from "../../main.ts"; +import { IMeldEncryptPluginFeature } from "../IMeldEncryptPluginFeature.ts"; +import { EncryptedMarkdownView } from "./EncryptedMarkdownView.ts"; import { MarkdownView, TFolder, normalizePath, moment, TFile } from "obsidian"; -import PluginPasswordModal from "src/PluginPasswordModal"; -import { PasswordAndHint, SessionPasswordService } from "src/services/SessionPasswordService"; -import { FileDataHelper, JsonFileEncoding } from "src/services/FileDataHelper"; -import { ENCRYPTED_FILE_EXTENSIONS, ENCRYPTED_FILE_EXTENSION_DEFAULT } from "src/services/Constants"; +import PluginPasswordModal from "../../PluginPasswordModal.ts"; +import { PasswordAndHint, SessionPasswordService } from "../../services/SessionPasswordService.ts"; +import { FileDataHelper, JsonFileEncoding } from "../../services/FileDataHelper.ts"; +import { ENCRYPTED_FILE_EXTENSIONS, ENCRYPTED_FILE_EXTENSION_DEFAULT } from "../../services/Constants.ts"; export default class FeatureWholeNoteEncryptV2 implements IMeldEncryptPluginFeature { diff --git a/src/main.ts b/src/main.ts index 08d4d77..da3185f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,11 +1,11 @@ import { Notice, Plugin } from 'obsidian'; -import MeldEncryptSettingsTab from './settings/MeldEncryptSettingsTab'; -import { IMeldEncryptPluginSettings } from './settings/MeldEncryptPluginSettings'; -import { IMeldEncryptPluginFeature } from './features/IMeldEncryptPluginFeature'; -import { SessionPasswordService } from './services/SessionPasswordService'; -import FeatureInplaceEncrypt from './features/feature-inplace-encrypt/FeatureInplaceEncrypt'; -import FeatureConvertNote from './features/feature-convert-note/FeatureConvertNote'; -import FeatureWholeNoteEncryptV2 from './features/feature-whole-note-encrypt/FeatureWholeNoteEncrypt'; +import MeldEncryptSettingsTab from './settings/MeldEncryptSettingsTab.ts'; +import { IMeldEncryptPluginSettings } from './settings/MeldEncryptPluginSettings.ts'; +import { IMeldEncryptPluginFeature } from './features/IMeldEncryptPluginFeature.ts'; +import { SessionPasswordService } from './services/SessionPasswordService.ts'; +import FeatureInplaceEncrypt from './features/feature-inplace-encrypt/FeatureInplaceEncrypt.ts'; +import FeatureConvertNote from './features/feature-convert-note/FeatureConvertNote.ts'; +import FeatureWholeNoteEncryptV2 from './features/feature-whole-note-encrypt/FeatureWholeNoteEncrypt.ts'; export default class MeldEncrypt extends Plugin { diff --git a/src/services/CryptoHelper2304.ts b/src/services/CryptoHelper2304.ts index bfb7a53..e582576 100644 --- a/src/services/CryptoHelper2304.ts +++ b/src/services/CryptoHelper2304.ts @@ -1,4 +1,4 @@ -import { ICryptoHelper } from "./ICryptoHelper"; +import { ICryptoHelper } from "./ICryptoHelper.ts"; export class CryptoHelper2304 implements ICryptoHelper { public vectorSize: number; diff --git a/src/services/CryptoHelperFactory.ts b/src/services/CryptoHelperFactory.ts index 9b88998..cdb4444 100644 --- a/src/services/CryptoHelperFactory.ts +++ b/src/services/CryptoHelperFactory.ts @@ -1,9 +1,9 @@ -import { FileData } from "./FileDataHelper"; -import { Decryptable } from "src/features/feature-inplace-encrypt/Decryptable"; -import { CryptoHelper } from "./CryptoHelper"; -import { ICryptoHelper } from "./ICryptoHelper"; -import { CryptoHelper2304 } from "./CryptoHelper2304"; -import { CryptoHelperObsolete } from "./CryptoHelperObsolete"; +import { FileData } from "./FileDataHelper.ts"; +import { Decryptable } from "../features/feature-inplace-encrypt/Decryptable.ts"; +import { CryptoHelper } from "./CryptoHelper.ts"; +import { ICryptoHelper } from "./ICryptoHelper.ts"; +import { CryptoHelper2304 } from "./CryptoHelper2304.ts"; +import { CryptoHelperObsolete } from "./CryptoHelperObsolete.ts"; export class CryptoHelperFactory{ diff --git a/src/services/FileDataHelper.ts b/src/services/FileDataHelper.ts index 36e4e46..de1f45e 100644 --- a/src/services/FileDataHelper.ts +++ b/src/services/FileDataHelper.ts @@ -1,4 +1,4 @@ -import { CryptoHelperFactory } from "./CryptoHelperFactory"; +import { CryptoHelperFactory } from "./CryptoHelperFactory.ts"; export class FileData { diff --git a/src/services/SessionPasswordService.ts b/src/services/SessionPasswordService.ts index dbf2c4c..9676963 100644 --- a/src/services/SessionPasswordService.ts +++ b/src/services/SessionPasswordService.ts @@ -1,6 +1,6 @@ import { DataAdapter, Notice, TFile } from "obsidian"; -import { MemoryCache } from "./MemoryCache"; -import { Utils } from "./Utils"; +import { MemoryCache } from "./MemoryCache.ts"; +import { Utils } from "./Utils.ts"; export type PasswordAndHint = { password: string; diff --git a/src/settings/MeldEncryptPluginSettings.ts b/src/settings/MeldEncryptPluginSettings.ts index c73686c..4e4a8c9 100644 --- a/src/settings/MeldEncryptPluginSettings.ts +++ b/src/settings/MeldEncryptPluginSettings.ts @@ -1,5 +1,5 @@ -import { IFeatureInplaceEncryptSettings } from "src/features/feature-inplace-encrypt/IFeatureInplaceEncryptSettings"; -import { IFeatureWholeNoteEncryptSettings } from "src/features/feature-whole-note-encrypt/IFeatureWholeNoteEncryptSettings"; +import { IFeatureInplaceEncryptSettings } from "../features/feature-inplace-encrypt/IFeatureInplaceEncryptSettings.ts"; +import { IFeatureWholeNoteEncryptSettings } from "../features/feature-whole-note-encrypt/IFeatureWholeNoteEncryptSettings.ts"; export interface IMeldEncryptPluginSettings { confirmPassword: boolean; diff --git a/src/settings/MeldEncryptSettingsTab.ts b/src/settings/MeldEncryptSettingsTab.ts index f1ae9de..471403e 100644 --- a/src/settings/MeldEncryptSettingsTab.ts +++ b/src/settings/MeldEncryptSettingsTab.ts @@ -1,8 +1,8 @@ import { App, Notice, PluginSettingTab, Setting } from "obsidian"; -import { IMeldEncryptPluginFeature } from "src/features/IMeldEncryptPluginFeature"; -import { SessionPasswordService } from "src/services/SessionPasswordService"; -import MeldEncrypt from "../main"; -import { IMeldEncryptPluginSettings } from "./MeldEncryptPluginSettings"; +import { IMeldEncryptPluginFeature } from "../features/IMeldEncryptPluginFeature.ts"; +import { SessionPasswordService } from "../services/SessionPasswordService.ts"; +import MeldEncrypt from "../main.ts"; +import { IMeldEncryptPluginSettings } from "./MeldEncryptPluginSettings.ts"; export default class MeldEncryptSettingsTab extends PluginSettingTab { plugin: MeldEncrypt; diff --git a/src/tools/mdenc.ts b/src/tools/mdenc.ts index d3e37f9..e9f15ed 100644 --- a/src/tools/mdenc.ts +++ b/src/tools/mdenc.ts @@ -1,12 +1,12 @@ import * as yargs from 'yargs' import { hideBin } from 'yargs/helpers' -import * as fs from 'fs'; -import * as path from 'path'; -import { CryptoHelperFactory } from 'src/services/CryptoHelperFactory'; -import { JsonFileEncoding } from "src/services/FileDataHelper"; -import * as Constants from 'src/services/Constants'; -import * as InPlaceConstants from 'src/features/feature-inplace-encrypt/FeatureInplaceConstants'; -import { FeatureInplaceTextAnalysis } from 'src/features/feature-inplace-encrypt/featureInplaceTextAnalysis'; +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import { CryptoHelperFactory } from '../services/CryptoHelperFactory.ts'; +import { JsonFileEncoding } from "../services/FileDataHelper.ts"; +import * as Constants from '../services/Constants.ts'; +import * as InPlaceConstants from '../features/feature-inplace-encrypt/FeatureInplaceConstants.ts'; +import { FeatureInplaceTextAnalysis } from '../features/feature-inplace-encrypt/featureInplaceTextAnalysis.ts'; interface Listing { featureType: 'InPlace' | 'WholeNote'; @@ -518,6 +518,7 @@ const optListingFormat : yargs.Options = { yargs.default(hideBin(process.argv)) + .scriptName('mdenc') .usage( 'Usage: $0 [command] [options]' ) .command( 'list', 'list all encrypted artifacts within the current directory', (yargs) => yargs.option( { diff --git a/src/tools/offline-decrypt.ts b/src/tools/offline-decrypt.ts index 4b52b00..b8cb8a4 100644 --- a/src/tools/offline-decrypt.ts +++ b/src/tools/offline-decrypt.ts @@ -1,7 +1,7 @@ -import { Decryptable } from "src/features/feature-inplace-encrypt/Decryptable"; -import { FeatureInplaceTextAnalysis } from "src/features/feature-inplace-encrypt/featureInplaceTextAnalysis"; -import { CryptoHelperFactory } from "src/services/CryptoHelperFactory"; -import { JsonFileEncoding } from "src/services/FileDataHelper"; +import { Decryptable } from "../features/feature-inplace-encrypt/Decryptable.ts"; +import { FeatureInplaceTextAnalysis } from "../features/feature-inplace-encrypt/featureInplaceTextAnalysis.ts"; +import { CryptoHelperFactory } from "../services/CryptoHelperFactory.ts"; +import { JsonFileEncoding } from "../services/FileDataHelper.ts"; export class OfflineDecrypt { diff --git a/tsconfig.json b/tsconfig.json index 09c9112..deca819 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,7 @@ { "compilerOptions": { + "allowImportingTsExtensions": true, + "noEmit": true, // Required when using allowImportingTsExtensions "baseUrl": ".", "inlineSourceMap": true, "inlineSources": true,