obsidian-dev-utils 19.0.0 → 19.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +0 -3
  3. package/dist/lib/@types/debug.d.mts +1 -16
  4. package/dist/lib/Async.d.mts +1 -153
  5. package/dist/lib/Blob.d.mts +1 -40
  6. package/dist/lib/CssClass.d.mts +1 -97
  7. package/dist/lib/Debug.d.mts +1 -41
  8. package/dist/lib/DebugController.d.mts +1 -85
  9. package/dist/lib/Enum.d.mts +1 -20
  10. package/dist/lib/Error.d.mts +1 -45
  11. package/dist/lib/Function.d.mts +1 -28
  12. package/dist/lib/HTMLElement.d.mts +1 -49
  13. package/dist/lib/Library.cjs +1 -1
  14. package/dist/lib/Library.d.mts +1 -16
  15. package/dist/lib/Library.mjs +1 -1
  16. package/dist/lib/Object.d.mts +1 -211
  17. package/dist/lib/Path.d.mts +1 -133
  18. package/dist/lib/RegExp.d.mts +1 -18
  19. package/dist/lib/ScriptUtils/CliUtils.d.mts +1 -70
  20. package/dist/lib/ScriptUtils/CodeGenerator.d.mts +1 -12
  21. package/dist/lib/ScriptUtils/ESLint/@types/@guardian__eslint-plugin-tsdoc-required.d.mts +1 -13
  22. package/dist/lib/ScriptUtils/ESLint/@types/eslint-plugin-modules-newlines.d.mts +1 -13
  23. package/dist/lib/ScriptUtils/ESLint/@types/eslint-plugin-verify-tsdoc.d.mts +1 -13
  24. package/dist/lib/ScriptUtils/ESLint/ESLint.d.mts +1 -13
  25. package/dist/lib/ScriptUtils/ESLint/eslint.config.d.mts +1 -16
  26. package/dist/lib/ScriptUtils/ESLint/index.d.mts +1 -2
  27. package/dist/lib/ScriptUtils/Exec.d.mts +1 -83
  28. package/dist/lib/ScriptUtils/Fs.d.mts +1 -72
  29. package/dist/lib/ScriptUtils/JSON.d.mts +1 -64
  30. package/dist/lib/ScriptUtils/NodeModules.d.mts +1 -14
  31. package/dist/lib/ScriptUtils/Npm.d.mts +1 -151
  32. package/dist/lib/ScriptUtils/NpmPublish.d.mts +1 -9
  33. package/dist/lib/ScriptUtils/ObsidianDevUtilsRepoPaths.d.mts +1 -88
  34. package/dist/lib/ScriptUtils/Root.d.mts +1 -67
  35. package/dist/lib/ScriptUtils/build.d.mts +1 -41
  36. package/dist/lib/ScriptUtils/cli.d.mts +1 -14
  37. package/dist/lib/ScriptUtils/esbuild/Dependency.d.mts +1 -18
  38. package/dist/lib/ScriptUtils/esbuild/ObsidianPluginBuilder.d.mts +1 -53
  39. package/dist/lib/ScriptUtils/esbuild/changeExtensionPlugin.d.mts +1 -12
  40. package/dist/lib/ScriptUtils/esbuild/copyToObsidianPluginsFolderPlugin.d.mts +1 -18
  41. package/dist/lib/ScriptUtils/esbuild/fixEsmPlugin.d.mts +1 -11
  42. package/dist/lib/ScriptUtils/esbuild/fixSourceMapsPlugin.d.mts +1 -17
  43. package/dist/lib/ScriptUtils/esbuild/index.d.mts +1 -9
  44. package/dist/lib/ScriptUtils/esbuild/preprocessPlugin.d.mts +1 -23
  45. package/dist/lib/ScriptUtils/esbuild/renameCssPlugin.d.mts +1 -8
  46. package/dist/lib/ScriptUtils/esbuild/svelteWrapperPlugin.d.mts +1 -8
  47. package/dist/lib/ScriptUtils/format.d.mts +1 -10
  48. package/dist/lib/ScriptUtils/index.d.mts +1 -17
  49. package/dist/lib/ScriptUtils/spellcheck.d.mts +1 -14
  50. package/dist/lib/ScriptUtils/version.d.mts +1 -171
  51. package/dist/lib/String.d.mts +1 -138
  52. package/dist/lib/Transformers/DateTransformer.d.mts +1 -35
  53. package/dist/lib/Transformers/DurationTransformer.d.mts +1 -34
  54. package/dist/lib/Transformers/GroupTransformer.d.mts +1 -65
  55. package/dist/lib/Transformers/SkipPrivatePropertyTransformer.d.mts +1 -32
  56. package/dist/lib/Transformers/Transformer.d.mts +1 -67
  57. package/dist/lib/Transformers/TypedTransformer.d.mts +1 -37
  58. package/dist/lib/Transformers/index.d.mts +1 -6
  59. package/dist/lib/ValueProvider.d.mts +1 -22
  60. package/dist/lib/codemirror/StateFieldSpec.d.mts +1 -68
  61. package/dist/lib/codemirror/index.d.mts +1 -1
  62. package/dist/lib/index.d.mts +1 -20
  63. package/dist/lib/obsidian/@types/Dataview/api/data-array.d.mts +1 -136
  64. package/dist/lib/obsidian/@types/Dataview/api/extensions.d.mts +1 -15
  65. package/dist/lib/obsidian/@types/Dataview/api/inline-api.d.mts +1 -186
  66. package/dist/lib/obsidian/@types/Dataview/api/plugin-api.d.mts +1 -209
  67. package/dist/lib/obsidian/@types/Dataview/api/result.d.mts +1 -38
  68. package/dist/lib/obsidian/@types/Dataview/data-import/common.d.mts +1 -3
  69. package/dist/lib/obsidian/@types/Dataview/data-import/csv.d.mts +1 -3
  70. package/dist/lib/obsidian/@types/Dataview/data-import/inline-field.d.mts +1 -42
  71. package/dist/lib/obsidian/@types/Dataview/data-import/markdown-file.d.mts +1 -52
  72. package/dist/lib/obsidian/@types/Dataview/data-import/persister.d.mts +1 -32
  73. package/dist/lib/obsidian/@types/Dataview/data-import/web-worker/import-entry.d.mts +1 -1
  74. package/dist/lib/obsidian/@types/Dataview/data-import/web-worker/import-impl.d.mts +1 -6
  75. package/dist/lib/obsidian/@types/Dataview/data-import/web-worker/import-manager.d.mts +1 -37
  76. package/dist/lib/obsidian/@types/Dataview/data-index/index.d.mts +1 -186
  77. package/dist/lib/obsidian/@types/Dataview/data-index/resolver.d.mts +1 -23
  78. package/dist/lib/obsidian/@types/Dataview/data-index/source.d.mts +1 -71
  79. package/dist/lib/obsidian/@types/Dataview/data-model/markdown.d.mts +1 -115
  80. package/dist/lib/obsidian/@types/Dataview/data-model/serialized/markdown.d.mts +1 -106
  81. package/dist/lib/obsidian/@types/Dataview/data-model/transferable.d.mts +1 -7
  82. package/dist/lib/obsidian/@types/Dataview/data-model/value.d.mts +1 -175
  83. package/dist/lib/obsidian/@types/Dataview/expression/binaryop.d.mts +1 -43
  84. package/dist/lib/obsidian/@types/Dataview/expression/context.d.mts +1 -49
  85. package/dist/lib/obsidian/@types/Dataview/expression/field.d.mts +1 -82
  86. package/dist/lib/obsidian/@types/Dataview/expression/functions.d.mts +1 -149
  87. package/dist/lib/obsidian/@types/Dataview/expression/parse.d.mts +1 -163
  88. package/dist/lib/obsidian/@types/Dataview/index.d.mts +1 -55
  89. package/dist/lib/obsidian/@types/Dataview/main.d.mts +1 -52
  90. package/dist/lib/obsidian/@types/Dataview/query/engine.d.mts +1 -103
  91. package/dist/lib/obsidian/@types/Dataview/query/parse.d.mts +1 -44
  92. package/dist/lib/obsidian/@types/Dataview/query/query.d.mts +1 -95
  93. package/dist/lib/obsidian/@types/Dataview/settings.d.mts +1 -60
  94. package/dist/lib/obsidian/@types/Dataview/typings/obsidian-ex.d.mts +1 -28
  95. package/dist/lib/obsidian/@types/Dataview/typings/workers.d.mts +1 -4
  96. package/dist/lib/obsidian/@types/Dataview/ui/export/markdown.d.mts +1 -15
  97. package/dist/lib/obsidian/@types/Dataview/ui/lp-render.d.mts +1 -37
  98. package/dist/lib/obsidian/@types/Dataview/ui/markdown.d.mts +1 -86
  99. package/dist/lib/obsidian/@types/Dataview/ui/refreshable-view.d.mts +1 -18
  100. package/dist/lib/obsidian/@types/Dataview/ui/render.d.mts +1 -33
  101. package/dist/lib/obsidian/@types/Dataview/ui/views/calendar-view.d.mts +1 -17
  102. package/dist/lib/obsidian/@types/Dataview/ui/views/inline-field-live-preview.d.mts +1 -42
  103. package/dist/lib/obsidian/@types/Dataview/ui/views/inline-view.d.mts +1 -28
  104. package/dist/lib/obsidian/@types/Dataview/ui/views/js-view.d.mts +1 -23
  105. package/dist/lib/obsidian/@types/Dataview/ui/views/list-view.d.mts +1 -25
  106. package/dist/lib/obsidian/@types/Dataview/ui/views/table-view.d.mts +1 -28
  107. package/dist/lib/obsidian/@types/Dataview/ui/views/task-view.d.mts +1 -51
  108. package/dist/lib/obsidian/@types/Dataview/util/hash.d.mts +1 -1
  109. package/dist/lib/obsidian/@types/Dataview/util/locale.d.mts +1 -2
  110. package/dist/lib/obsidian/@types/Dataview/util/media.d.mts +1 -6
  111. package/dist/lib/obsidian/@types/Dataview/util/normalize.d.mts +1 -44
  112. package/dist/lib/obsidian/App.d.mts +1 -30
  113. package/dist/lib/obsidian/AttachmentPath.d.mts +1 -54
  114. package/dist/lib/obsidian/Backlink.d.mts +1 -60
  115. package/dist/lib/obsidian/Callout.d.mts +1 -55
  116. package/dist/lib/obsidian/Components/DateComponent.d.mts +1 -36
  117. package/dist/lib/obsidian/Components/DateTimeComponent.d.mts +1 -36
  118. package/dist/lib/obsidian/Components/EmailComponent.d.mts +1 -29
  119. package/dist/lib/obsidian/Components/FileComponent.d.mts +1 -41
  120. package/dist/lib/obsidian/Components/MonthComponent.d.mts +1 -49
  121. package/dist/lib/obsidian/Components/MultipleDropdownComponent.d.mts +1 -73
  122. package/dist/lib/obsidian/Components/MultipleEmailComponent.d.mts +1 -36
  123. package/dist/lib/obsidian/Components/MultipleFileComponent.d.mts +1 -41
  124. package/dist/lib/obsidian/Components/MultipleTextComponent.d.mts +1 -67
  125. package/dist/lib/obsidian/Components/NumberComponent.d.mts +1 -29
  126. package/dist/lib/obsidian/Components/TimeComponent.d.mts +1 -37
  127. package/dist/lib/obsidian/Components/TypedRangeTextComponent.d.mts +1 -31
  128. package/dist/lib/obsidian/Components/TypedTextComponent.d.mts +1 -84
  129. package/dist/lib/obsidian/Components/UrlComponent.d.mts +1 -29
  130. package/dist/lib/obsidian/Components/ValidatorComponent.d.mts +1 -22
  131. package/dist/lib/obsidian/Components/ValueComponentWithChangeTracking.d.mts +1 -17
  132. package/dist/lib/obsidian/Components/WeekComponent.d.mts +1 -49
  133. package/dist/lib/obsidian/Components/index.d.mts +1 -17
  134. package/dist/lib/obsidian/Dataview.d.mts +1 -215
  135. package/dist/lib/obsidian/DataviewLink.d.mts +1 -23
  136. package/dist/lib/obsidian/FileChange.d.mts +1 -68
  137. package/dist/lib/obsidian/FileManager.d.mts +1 -38
  138. package/dist/lib/obsidian/FileSystem.d.mts +1 -185
  139. package/dist/lib/obsidian/Frontmatter.d.mts +1 -69
  140. package/dist/lib/obsidian/Link.d.mts +1 -366
  141. package/dist/lib/obsidian/Logger.d.mts +1 -13
  142. package/dist/lib/obsidian/Loop.d.mts +1 -36
  143. package/dist/lib/obsidian/Markdown.d.mts +1 -24
  144. package/dist/lib/obsidian/MarkdownCodeBlockProcessor.d.mts +1 -23
  145. package/dist/lib/obsidian/MarkdownView.d.mts +1 -12
  146. package/dist/lib/obsidian/MetadataCache.d.mts +1 -87
  147. package/dist/lib/obsidian/Modals/Alert.d.mts +1 -39
  148. package/dist/lib/obsidian/Modals/Confirm.d.mts +1 -43
  149. package/dist/lib/obsidian/Modals/ModalBase.d.mts +1 -35
  150. package/dist/lib/obsidian/Modals/Prompt.d.mts +1 -50
  151. package/dist/lib/obsidian/Modals/SelectItem.d.mts +1 -41
  152. package/dist/lib/obsidian/Modals/index.d.mts +1 -5
  153. package/dist/lib/obsidian/ObsidianSettings.d.mts +1 -17
  154. package/dist/lib/obsidian/Pdf.d.mts +1 -24
  155. package/dist/lib/obsidian/Plugin/EmptySettings.d.mts +1 -14
  156. package/dist/lib/obsidian/Plugin/ObsidianPluginRepoPaths.d.mts +1 -55
  157. package/dist/lib/obsidian/Plugin/Plugin.d.mts +1 -21
  158. package/dist/lib/obsidian/Plugin/PluginBase.d.mts +1 -108
  159. package/dist/lib/obsidian/Plugin/PluginContext.d.mts +1 -12
  160. package/dist/lib/obsidian/Plugin/PluginId.d.mts +1 -20
  161. package/dist/lib/obsidian/Plugin/PluginSettingsBase.d.mts +1 -31
  162. package/dist/lib/obsidian/Plugin/PluginSettingsTabBase.d.mts +1 -99
  163. package/dist/lib/obsidian/Plugin/index.d.mts +1 -8
  164. package/dist/lib/obsidian/Queue.d.mts +1 -30
  165. package/dist/lib/obsidian/Reference.d.mts +1 -21
  166. package/dist/lib/obsidian/RenameDeleteHandler.d.mts +1 -49
  167. package/dist/lib/obsidian/ResourceUrl.d.mts +1 -14
  168. package/dist/lib/obsidian/SettingEx.d.mts +1 -124
  169. package/dist/lib/obsidian/Vault.d.mts +1 -130
  170. package/dist/lib/obsidian/VaultEx.d.mts +1 -27
  171. package/dist/lib/obsidian/index.d.mts +1 -29
  172. package/dist/lib/url.d.mts +1 -11
  173. package/package.json +11 -11
@@ -1,185 +1 @@
1
- /**
2
- * @packageDocumentation FileSystem
3
- * This module provides utility functions for working with TAbstractFile, TFile, and TFolder instances in Obsidian.
4
- */
5
- import { App, TAbstractFile, TFile, TFolder } from 'obsidian';
6
- /**
7
- * The file extension for Markdown files.
8
- */
9
- export declare const MARKDOWN_FILE_EXTENSION = "md";
10
- /**
11
- * Represents the file extension for canvas files.
12
- */
13
- export declare const CANVAS_FILE_EXTENSION = "canvas";
14
- /**
15
- * Represents a path or an instance of TAbstractFile.
16
- */
17
- export type PathOrAbstractFile = string | TAbstractFile;
18
- /**
19
- * Represents a path or a file.
20
- */
21
- export type PathOrFile = string | TFile;
22
- /**
23
- * Represents a path or an instance of TFolder.
24
- */
25
- export type PathOrFolder = string | TFolder;
26
- /**
27
- * Checks if the given path or file has the specified extension.
28
- *
29
- * @param app - The Obsidian App instance.
30
- * @param pathOrFile - The path or abstract file to check.
31
- * @param extension - The extension to compare against.
32
- * @returns Returns `true` if the path or file has the specified extension, `false` otherwise.
33
- */
34
- export declare function checkExtension(app: App, pathOrFile: null | PathOrAbstractFile, extension: string): boolean;
35
- /**
36
- * Retrieves the TAbstractFile object for the given path or abstract file.
37
- *
38
- * @param app - The App instance.
39
- * @param pathOrFile - The path or abstract file to retrieve the TAbstractFile for.
40
- * @param isCaseInsensitive - Specifies whether to perform a case-insensitive search. Default is `false`.
41
- * @returns The TAbstractFile object.
42
- * @throws Error if the abstract file is not found.
43
- */
44
- export declare function getAbstractFile(app: App, pathOrFile: PathOrAbstractFile, isCaseInsensitive?: boolean): TAbstractFile;
45
- /**
46
- * Retrieves an instance of TAbstractFile or null based on the provided path or abstract file.
47
- *
48
- * @param app - The application instance.
49
- * @param pathOrFile - The path or abstract file to retrieve.
50
- * @param isCaseInsensitive - Specifies whether to perform a case-insensitive search. Default is `false`.
51
- * @returns The instance of TAbstractFile if found, otherwise null.
52
- */
53
- export declare function getAbstractFileOrNull(app: App, pathOrFile: null | PathOrAbstractFile, isCaseInsensitive?: boolean): null | TAbstractFile;
54
- /**
55
- * Retrieves a TFile object based on the provided path or file.
56
- *
57
- * @param app - The Obsidian App instance.
58
- * @param pathOrFile - The path or file to retrieve the TFile object for.
59
- * @param shouldIncludeNonExisting - Whether to include a non-existing file.
60
- * If `true`, a new TFile object is created for the provided path.
61
- * If `false`, an error is thrown if the file is not found.
62
- * @param isCaseInsensitive - Specifies whether to perform a case-insensitive search. Default is `false`.
63
- * @returns The TFile object corresponding to the provided path or file.
64
- * @throws Error if the file is not found.
65
- */
66
- export declare function getFile(app: App, pathOrFile: PathOrFile, shouldIncludeNonExisting?: boolean, isCaseInsensitive?: boolean): TFile;
67
- /**
68
- * Retrieves a TFile object based on the provided path or file.
69
- * If the provided argument is already a TFile object, it is returned as is.
70
- * Otherwise, the function uses the app's vault to retrieve the TFile object by its path.
71
- * @param app - The Obsidian App instance.
72
- * @param pathOrFile - The path or TFile object.
73
- * @param isCaseInsensitive - Specifies whether to perform a case-insensitive search. Default is `false`.
74
- * @returns The TFile object if found, otherwise null.
75
- */
76
- export declare function getFileOrNull(app: App, pathOrFile: null | PathOrFile, isCaseInsensitive?: boolean): null | TFile;
77
- /**
78
- * Retrieves a TFolder object based on the provided app and pathOrFolder.
79
- *
80
- * @param app - The Obsidian app instance.
81
- * @param pathOrFolder - The path or folder identifier.
82
- * @param shouldIncludeNonExisting - Whether to allow the folder to not exist.
83
- * If `true`, a new TFolder object is created for the provided path.
84
- * If `false`, an error is thrown if the folder is not found.
85
- * @param isCaseInsensitive - Specifies whether to perform a case-insensitive search. Default is `false`.
86
- * @returns The retrieved TFolder object.
87
- * @throws If the folder is not found.
88
- */
89
- export declare function getFolder(app: App, pathOrFolder: PathOrFolder, shouldIncludeNonExisting?: boolean, isCaseInsensitive?: boolean): TFolder;
90
- /**
91
- * Retrieves a TFolder object or null based on the provided path or folder.
92
- *
93
- * @param app - The Obsidian application instance.
94
- * @param pathOrFolder - The path or folder to retrieve the TFolder from.
95
- * @param isCaseInsensitive - Specifies whether to perform a case-insensitive search. Default is `false`.
96
- * @returns The TFolder object if found, otherwise null.
97
- */
98
- export declare function getFolderOrNull(app: App, pathOrFolder: null | PathOrFolder, isCaseInsensitive?: boolean): null | TFolder;
99
- /**
100
- * Retrieves an array of TFile objects representing the markdown files within a specified folder or path.
101
- *
102
- * @param app - The Obsidian App instance.
103
- * @param pathOrFolder - The path or folder to retrieve the markdown files from.
104
- * @param isRecursive - Optional. Specifies whether to recursively search for markdown files within subfolders. Default is false.
105
- * @returns An array of TFile objects representing the markdown files.
106
- */
107
- export declare function getMarkdownFiles(app: App, pathOrFolder: PathOrFolder, isRecursive?: boolean): TFile[];
108
- /**
109
- * Retrieves the TFile object for the given path or creates a new one if it does not exist.
110
- *
111
- * @param app - The Obsidian App instance.
112
- * @param path - The path of the file to retrieve or create.
113
- * @returns The TFile object representing the file
114
- */
115
- export declare function getOrCreateFile(app: App, path: string): Promise<TFile>;
116
- /**
117
- * Retrieves the TFolder object for the given path or creates a new one if it does not exist.
118
- *
119
- * @param app - The Obsidian App instance.
120
- * @param path - The path of the folder to retrieve or create.
121
- * @returns The TFolder object representing the folder.
122
- */
123
- export declare function getOrCreateFolder(app: App, path: string): Promise<TFolder>;
124
- /**
125
- * Returns the path of the given `pathOrFile`.
126
- *
127
- * @param app - The Obsidian App instance.
128
- * @param pathOrFile - The path or abstract file.
129
- * @returns The path of the `pathOrFile`.
130
- */
131
- export declare function getPath(app: App, pathOrFile: PathOrAbstractFile): string;
132
- /**
133
- * Checks if the given file is an instance of TAbstractFile.
134
- *
135
- * @param file - The file to check.
136
- * @returns A boolean indicating whether the file is an instance of TAbstractFile.
137
- */
138
- export declare function isAbstractFile(file: unknown): file is TAbstractFile;
139
- /**
140
- * Checks if the given file is a canvas file.
141
- *
142
- * @param app - The Obsidian App instance.
143
- * @param pathOrFile - The path or file to check.
144
- * @returns A boolean indicating whether the file is a canvas file or not.
145
- */
146
- export declare function isCanvasFile(app: App, pathOrFile: null | PathOrAbstractFile): boolean;
147
- /**
148
- * Checks if the given file is an instance of TFile.
149
- *
150
- * @param file - The file to check.
151
- * @returns A boolean indicating whether the file is an instance of TFile.
152
- */
153
- export declare function isFile(file: unknown): file is TFile;
154
- /**
155
- * Checks if the given file is a folder.
156
- *
157
- * @param file - The file to check.
158
- * @returns `true` if the file is a folder, `false` otherwise.
159
- */
160
- export declare function isFolder(file: unknown): file is TFolder;
161
- /**
162
- * Checks if the given file is a Markdown file.
163
- *
164
- * @param app - The Obsidian App instance.
165
- * @param pathOrFile - The path or file to check.
166
- * @returns A boolean indicating whether the file is a Markdown file.
167
- */
168
- export declare function isMarkdownFile(app: App, pathOrFile: null | PathOrAbstractFile): boolean;
169
- /**
170
- * Checks if the given file is a note.
171
- *
172
- * @param app - The Obsidian App instance.
173
- * @param pathOrFile - The path or file to check.
174
- * @returns A boolean indicating whether the file is a note.
175
- */
176
- export declare function isNote(app: App, pathOrFile: null | PathOrAbstractFile): boolean;
177
- /**
178
- * Trims the markdown extension from the file path if the file is a markdown file.
179
- * If the file is not a markdown file, the original file path is returned.
180
- *
181
- * @param app - The Obsidian App instance.
182
- * @param file - The file to trim the markdown extension from.
183
- * @returns The file path with the markdown extension trimmed.
184
- */
185
- export declare function trimMarkdownExtension(app: App, file: TAbstractFile): string;
1
+ export * from './FileSystem.cjs';
@@ -1,69 +1 @@
1
- /**
2
- * @packageDocumentation Frontmatter
3
- * This module provides utility functions for processing and managing YAML front matter in Obsidian notes.
4
- */
5
- /**
6
- * Represents the combined front matter of a document.
7
- * It is a union of custom front matter, Obsidian front matter, and additional properties.
8
- * @typeParam CustomFrontmatter - The type of custom front matter.
9
- */
10
- export type CombinedFrontmatter<CustomFrontmatter> = CustomFrontmatter & ObsidianFrontmatter & Record<string, unknown>;
11
- /**
12
- * Represents the front matter of an Obsidian file.
13
- * @see {@link https://help.obsidian.md/Editing+and+formatting/Properties#Default+properties}
14
- */
15
- export interface ObsidianFrontmatter {
16
- /**
17
- * An array of aliases for the note.
18
- */
19
- aliases?: string[];
20
- /**
21
- * An array of CSS classes to apply to the note.
22
- */
23
- cssclasses?: string[];
24
- /**
25
- * An array of tags for the note.
26
- */
27
- tags?: string[];
28
- }
29
- /**
30
- * Represents the front matter for publishing in Obsidian.
31
- * @see {@link https://help.obsidian.md/Editing+and+formatting/Properties#Properties+for+Obsidian+Publish}
32
- */
33
- export interface ObsidianPublishFrontmatter {
34
- /**
35
- * The cover image for the note.
36
- */
37
- cover?: string;
38
- /**
39
- * The description for the note.
40
- */
41
- description?: string;
42
- /**
43
- * The image for the note.
44
- */
45
- image?: string;
46
- /**
47
- * The permanent link for the note.
48
- */
49
- permalink?: string;
50
- /**
51
- * Whether the note is published.
52
- */
53
- publish?: boolean;
54
- }
55
- /**
56
- * Parses the front matter of a given content string.
57
- *
58
- * @param content - The content string to parse.
59
- * @returns The parsed front matter.
60
- */
61
- export declare function parseFrontmatter<CustomFrontmatter = unknown>(content: string): CombinedFrontmatter<CustomFrontmatter>;
62
- /**
63
- * Sets the front matter of a given content string.
64
- *
65
- * @param content - The content string to set the front matter in.
66
- * @param newFrontmatter - The new front matter to set.
67
- * @returns The new content string with the front matter set.
68
- */
69
- export declare function setFrontmatter(content: string, newFrontmatter: object): string;
1
+ export * from './Frontmatter.cjs';
@@ -1,366 +1 @@
1
- /**
2
- * @packageDocumentation Link
3
- * This module provides utilities for handling and updating links within Obsidian vaults. It includes
4
- * functions to split paths, update links in files, and generate markdown links with various options.
5
- * The functions integrate with Obsidian's API to ensure that links are managed correctly within the vault.
6
- */
7
- import type { App, Reference, TFile } from 'obsidian';
8
- import type { MaybePromise } from '../Async.mjs';
9
- import type { PathOrFile } from './FileSystem.mjs';
10
- import type { ProcessOptions } from './Vault.mjs';
11
- /**
12
- * Options for converting a link.
13
- */
14
- export interface ConvertLinkOptions {
15
- /**
16
- * The Obsidian app instance.
17
- */
18
- app: App;
19
- /**
20
- * The reference for the link.
21
- */
22
- link: Reference;
23
- /**
24
- * The source file containing the link.
25
- */
26
- newSourcePathOrFile: PathOrFile;
27
- /**
28
- * The old path of the link.
29
- */
30
- oldSourcePathOrFile?: PathOrFile;
31
- /**
32
- * Whether to force markdown links.
33
- */
34
- shouldForceMarkdownLinks?: boolean;
35
- /**
36
- * Whether to update filename alias. Defaults to `true`.
37
- */
38
- shouldUpdateFilenameAlias?: boolean;
39
- }
40
- /**
41
- * Wrapper for default options for generating markdown links.
42
- */
43
- export interface GenerateMarkdownLinkDefaultOptionsWrapper {
44
- /**
45
- * The default options for generating markdown links.
46
- */
47
- defaultOptionsFn: () => Partial<GenerateMarkdownLinkOptions>;
48
- }
49
- /**
50
- * Options for generating a markdown link.
51
- */
52
- export interface GenerateMarkdownLinkOptions {
53
- /**
54
- * The alias for the link.
55
- */
56
- alias?: string;
57
- /**
58
- * The Obsidian app instance.
59
- */
60
- app: App;
61
- /**
62
- * Indicates if the link should be embedded. If not provided, it will be inferred based on the file type.
63
- */
64
- isEmbed?: boolean;
65
- /**
66
- * Whether to allow an empty alias for embeds. Defaults to `true`.
67
- */
68
- isEmptyEmbedAliasAllowed?: boolean;
69
- /**
70
- * Whether to allow non-existing files. If `false` and `pathOrFile` is a non-existing file, an error will be thrown. Defaults to `false`.
71
- */
72
- isNonExistingFileAllowed?: boolean;
73
- /**
74
- * Indicates if the link should be a wikilink. If not provided, it will be inferred based on the Obsidian settings.
75
- */
76
- isWikilink?: boolean;
77
- /**
78
- * The original link text. If provided, it will be used to infer the values of `isEmbed`, `isWikilink`, `useLeadingDot`, and `useAngleBrackets`.
79
- * These inferred values will be overridden by corresponding settings if specified.
80
- */
81
- originalLink?: string;
82
- /**
83
- * Indicates if the link should be relative. If not provided or `false`, it will be inferred based on the Obsidian settings.
84
- */
85
- shouldForceRelativePath?: boolean;
86
- /**
87
- * Whether to include the attachment extension in the embed alias. Has no effect if `allowEmptyEmbedAlias` is `true`. Defaults to `false`.
88
- */
89
- shouldIncludeAttachmentExtensionToEmbedAlias?: boolean;
90
- /**
91
- * Indicates if the link should use angle brackets. Defaults to `false`. Has no effect if `isWikilink` is `true`
92
- */
93
- shouldUseAngleBrackets?: boolean;
94
- /**
95
- * Indicates if the link should use a leading dot. Defaults to `false`. Has no effect if `isWikilink` is `true` or `isRelative` is `false`.
96
- */
97
- shouldUseLeadingDot?: boolean;
98
- /**
99
- * The source path of the link.
100
- */
101
- sourcePathOrFile: PathOrFile;
102
- /**
103
- * The subpath of the link.
104
- */
105
- subpath?: string;
106
- /**
107
- * The target path or file.
108
- */
109
- targetPathOrFile: PathOrFile;
110
- }
111
- /**
112
- * The result of parsing a link.
113
- */
114
- export interface ParseLinkResult {
115
- /**
116
- * The alias of the link.
117
- */
118
- alias?: string;
119
- /**
120
- * Indicates if the link has angle brackets.
121
- */
122
- hasAngleBrackets?: boolean;
123
- /**
124
- * Indicates if the link is an embed link.
125
- */
126
- isEmbed: boolean;
127
- /**
128
- * Indicates if the link is external.
129
- */
130
- isExternal?: boolean;
131
- /**
132
- * Indicates if the link is a wikilink.
133
- */
134
- isWikilink: boolean;
135
- /**
136
- * The title of the link.
137
- */
138
- title?: string;
139
- /**
140
- * The URL of the link.
141
- */
142
- url: string;
143
- }
144
- /**
145
- * Options for determining if the alias of a link should be reset.
146
- */
147
- export interface ShouldResetAliasOptions {
148
- /**
149
- * The Obsidian app instance.
150
- */
151
- app: App;
152
- /**
153
- * The display text of the link.
154
- */
155
- displayText: string | undefined;
156
- /**
157
- * Indicates if the link is a wikilink.
158
- */
159
- isWikilink?: boolean;
160
- /**
161
- * The source path of the link.
162
- */
163
- newSourcePathOrFile: PathOrFile;
164
- /**
165
- * The old source file containing the link.
166
- */
167
- oldSourcePathOrFile?: PathOrFile;
168
- /**
169
- * The old target path of the link.
170
- */
171
- oldTargetPath: PathOrFile;
172
- /**
173
- * The target path or file.
174
- */
175
- targetPathOrFile: PathOrFile;
176
- }
177
- /**
178
- * Splits a link into its link path and subpath.
179
- */
180
- export interface SplitSubpathResult {
181
- /**
182
- * The link path.
183
- */
184
- linkPath: string;
185
- /**
186
- * The subpath.
187
- */
188
- subpath: string;
189
- }
190
- /**
191
- * Options for updating a link.
192
- */
193
- export interface UpdateLinkOptions {
194
- /**
195
- * The Obsidian app instance.
196
- */
197
- app: App;
198
- /**
199
- * The reference for the link.
200
- */
201
- link: Reference;
202
- /**
203
- * The source file containing the link.
204
- */
205
- newSourcePathOrFile: PathOrFile;
206
- /**
207
- * The file associated with the link.
208
- */
209
- newTargetPathOrFile: PathOrFile;
210
- /**
211
- * The old source file containing the link.
212
- */
213
- oldSourcePathOrFile?: PathOrFile;
214
- /**
215
- * The old path of the file.
216
- */
217
- oldTargetPathOrFile?: PathOrFile;
218
- /**
219
- * Whether to force markdown links.
220
- */
221
- shouldForceMarkdownLinks?: boolean;
222
- /**
223
- * Whether to update filename alias. Defaults to `true`.
224
- */
225
- shouldUpdateFilenameAlias?: boolean;
226
- }
227
- /**
228
- * Options for updating links in a file.
229
- */
230
- export interface UpdateLinksInFileOptions extends ProcessOptions {
231
- /**
232
- * The obsidian app instance.
233
- */
234
- app: App;
235
- /**
236
- * The file to update the links in.
237
- */
238
- newSourcePathOrFile: PathOrFile;
239
- /**
240
- * The old path of the file.
241
- */
242
- oldSourcePathOrFile?: PathOrFile;
243
- /**
244
- * Whether to force the links to be in Markdown format.
245
- */
246
- shouldForceMarkdownLinks?: boolean;
247
- /**
248
- * Whether to update only embedded links.
249
- */
250
- shouldUpdateEmbedOnlyLinks?: boolean;
251
- /**
252
- * Whether to update filename alias. Defaults to `true`.
253
- */
254
- shouldUpdateFilenameAlias?: boolean;
255
- }
256
- /**
257
- * Converts a link to a new path.
258
- *
259
- * @param options - The options for converting the link.
260
- * @returns The converted link.
261
- */
262
- export declare function convertLink(options: ConvertLinkOptions): string;
263
- /**
264
- * Edits the backlinks for a file or path.
265
- *
266
- * @param app - The Obsidian application instance.
267
- * @param pathOrFile - The path or file to edit the backlinks for.
268
- * @param linkConverter - The function that converts each link.
269
- * @param processOptions - Optional options for retrying the operation.
270
- * @returns A promise that resolves when the backlinks have been edited.
271
- */
272
- export declare function editBacklinks(app: App, pathOrFile: PathOrFile, linkConverter: (link: Reference) => MaybePromise<string | void>, processOptions?: ProcessOptions): Promise<void>;
273
- /**
274
- * Edits the backlinks for a file or path.
275
- *
276
- * @param app - The Obsidian application instance.
277
- * @param pathOrFile - The path or file to edit the backlinks for.
278
- * @param linkConverter - The function that converts each link.
279
- * @param processOptions - Optional options for retrying the operation.
280
- * @returns A promise that resolves when the backlinks have been edited.
281
- */
282
- export declare function editLinks(app: App, pathOrFile: PathOrFile, linkConverter: (link: Reference) => MaybePromise<string | void>, processOptions?: ProcessOptions): Promise<void>;
283
- /**
284
- * Extracts the file associated with a link.
285
- *
286
- * @param app - The Obsidian application instance.
287
- * @param link - The reference cache for the link.
288
- * @param sourcePathOrFile - The source path or file.
289
- * @returns The file associated with the link, or null if not found.
290
- */
291
- export declare function extractLinkFile(app: App, link: Reference, sourcePathOrFile: PathOrFile): null | TFile;
292
- /**
293
- * Generates a markdown link based on the provided parameters.
294
- *
295
- * @param options - The options for generating the markdown link.
296
- * @returns The generated markdown link.
297
- */
298
- export declare function generateMarkdownLink(options: GenerateMarkdownLinkOptions): string;
299
- /**
300
- * Parses a link into its components.
301
- *
302
- * @param str - The link to parse.
303
- * @returns The parsed link.
304
- */
305
- export declare function parseLink(str: string): null | ParseLinkResult;
306
- /**
307
- * Determines if the alias of a link should be reset.
308
- *
309
- * @param options - The options for determining if the alias should be reset.
310
- * @returns Whether the alias should be reset.
311
- */
312
- export declare function shouldResetAlias(options: ShouldResetAliasOptions): boolean;
313
- /**
314
- * Splits a link into its link path and subpath.
315
- *
316
- * @param link - The link to split.
317
- * @returns An object containing the link path and subpath.
318
- */
319
- export declare function splitSubpath(link: string): SplitSubpathResult;
320
- /**
321
- * Tests whether a link uses angle brackets, possibly embed:
322
- * `[title](<link>)`, `![title](<link>)`.
323
- *
324
- * @param link - Link to test
325
- * @returns Whether the link uses angle brackets
326
- */
327
- export declare function testAngleBrackets(link: string): boolean;
328
- /**
329
- * Tests whether a link is an embed link:
330
- * `![[link]]`, `![title](link)`.
331
- *
332
- * @param link - Link to test
333
- * @returns Whether the link is an embed link
334
- */
335
- export declare function testEmbed(link: string): boolean;
336
- /**
337
- * Tests whether a link has a leading dot, possibly embed:
338
- * `[[./link]]`, `[title](./link)`, `[title](<./link>)`,
339
- * `![[./link]]`, `![title](./link)`, `![title](<./link>)`.
340
- *
341
- * @param link - Link to test
342
- * @returns Whether the link has a leading dot
343
- */
344
- export declare function testLeadingDot(link: string): boolean;
345
- /**
346
- * Tests whether a link is a wikilink, possibly embed:
347
- * `[[link]]`, `![[link]]`.
348
- *
349
- * @param link - Link to test
350
- * @returns Whether the link is a wikilink
351
- */
352
- export declare function testWikilink(link: string): boolean;
353
- /**
354
- * Updates a link based on the provided parameters.
355
- *
356
- * @param options - The options for updating the link.
357
- * @returns The updated link.
358
- */
359
- export declare function updateLink(options: UpdateLinkOptions): string;
360
- /**
361
- * Updates the links in a file based on the provided parameters.
362
- *
363
- * @param options - The options for updating the links.
364
- * @returns A promise that resolves when the links are updated.
365
- */
366
- export declare function updateLinksInFile(options: UpdateLinksInFileOptions): Promise<void>;
1
+ export * from './Link.cjs';
@@ -1,13 +1 @@
1
- /**
2
- * @packageDocumentation Logger
3
- * Contains utility functions for logging in Obsidian.
4
- */
5
- import type { MaybePromise } from '../Async.mjs';
6
- /**
7
- * Invokes a function and logs the start, end, and duration of the invocation.
8
- *
9
- * @param title - The title of the log.
10
- * @param fn - The function to invoke.
11
- * @param stackTrace - Optional stack trace.
12
- */
13
- export declare function invokeAsyncAndLog(title: string, fn: () => MaybePromise<void>, stackTrace?: string): Promise<void>;
1
+ export * from './Logger.cjs';
@@ -1,36 +1 @@
1
- /**
2
- * @packageDocumentation Loop
3
- * Contains utility functions for looping in Obsidian.
4
- */
5
- import type { MaybePromise } from '../Async.mjs';
6
- /**
7
- * Options for the loop function.
8
- */
9
- export interface LoopOptions<T> {
10
- /**
11
- * An optional abort signal to cancel the loop.
12
- */
13
- abortSignal?: AbortSignal;
14
- /**
15
- * The function to build the notice message for each item.
16
- */
17
- buildNoticeMessage(item: T, iterationStr: string): string;
18
- /**
19
- * The items to loop over.
20
- */
21
- items: T[];
22
- /**
23
- * The function to process each item.
24
- */
25
- processItem(item: T): MaybePromise<void>;
26
- /**
27
- * Whether to continue the loop on error.
28
- */
29
- shouldContinueOnError?: boolean;
30
- }
31
- /**
32
- * Loops over a list of items and processes each item.
33
- *
34
- * @param options - The options for the loop.
35
- */
36
- export declare function loop<T>(options: LoopOptions<T>): Promise<void>;
1
+ export * from './Loop.cjs';
@@ -1,24 +1 @@
1
- /**
2
- * @packageDocumentation Markdown
3
- * This module provides utility functions for processing Markdown content in Obsidian.
4
- */
5
- import { App, Component } from 'obsidian';
6
- /**
7
- * Render the markdown and embeds.
8
- *
9
- * @param app - The Obsidian app instance.
10
- * @param markdown - The Markdown string to render.
11
- * @param el - The HTMLElement to render to.
12
- * @param sourcePath - The source path to resolve relative links.
13
- * @param component - The Component instance.
14
- */
15
- export declare function fullRender(app: App, markdown: string, el: HTMLElement, sourcePath: string, component: Component): Promise<void>;
16
- /**
17
- * Converts Markdown to HTML.
18
- *
19
- * @param app - The Obsidian app instance.
20
- * @param markdown - The Markdown string to convert.
21
- * @param sourcePath - (optional) The source path to resolve relative links.
22
- * @returns The HTML string.
23
- */
24
- export declare function markdownToHtml(app: App, markdown: string, sourcePath?: string): Promise<string>;
1
+ export * from './Markdown.cjs';