obsidian-dev-utils 80.0.2 → 81.0.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.
- package/CHANGELOG.md +15 -0
- package/dist/dev/main.js +30208 -0
- package/dist/dev/manifest.json +9 -0
- package/dist/lib/cjs/async-events.cjs +9 -1
- package/dist/lib/cjs/async-events.d.cts +8 -0
- package/dist/lib/cjs/async.cjs +89 -34
- package/dist/lib/cjs/async.d.cts +67 -15
- package/dist/lib/cjs/debug.cjs +26 -9
- package/dist/lib/cjs/debug.d.cts +23 -5
- package/dist/lib/cjs/error.cjs +4 -5
- package/dist/lib/cjs/error.d.cts +19 -4
- package/dist/lib/cjs/html-element.cjs +1 -1
- package/dist/lib/cjs/html-element.d.cts +2 -0
- package/dist/lib/cjs/library.cjs +2 -2
- package/dist/lib/cjs/object-utils.cjs +233 -128
- package/dist/lib/cjs/object-utils.d.cts +19 -4
- package/dist/lib/cjs/obsidian/async-with-notice.cjs +9 -6
- package/dist/lib/cjs/obsidian/async-with-notice.d.cts +9 -0
- package/dist/lib/cjs/obsidian/attachment-path.cjs +45 -13
- package/dist/lib/cjs/obsidian/attachment-path.d.cts +38 -8
- package/dist/lib/cjs/obsidian/backlink.cjs +6 -6
- package/dist/lib/cjs/obsidian/command-handlers/abstract-file-command-handler.cjs +53 -16
- package/dist/lib/cjs/obsidian/command-handlers/abstract-file-command-handler.d.cts +81 -9
- package/dist/lib/cjs/obsidian/command-handlers/editor-command-handler.cjs +25 -5
- package/dist/lib/cjs/obsidian/command-handlers/editor-command-handler.d.cts +35 -1
- package/dist/lib/cjs/obsidian/command-handlers/file-command-handler.cjs +33 -19
- package/dist/lib/cjs/obsidian/command-handlers/file-command-handler.d.cts +43 -17
- package/dist/lib/cjs/obsidian/command-handlers/folder-command-handler.cjs +33 -19
- package/dist/lib/cjs/obsidian/command-handlers/folder-command-handler.d.cts +43 -17
- package/dist/lib/cjs/obsidian/components/all-windows-event-component.cjs +17 -9
- package/dist/lib/cjs/obsidian/components/all-windows-event-component.d.cts +48 -8
- package/dist/lib/cjs/obsidian/components/plugin-notice-component.cjs +3 -1
- package/dist/lib/cjs/obsidian/components/plugin-notice-component.d.cts +3 -1
- package/dist/lib/cjs/obsidian/components/plugin-settings-component.cjs +24 -8
- package/dist/lib/cjs/obsidian/components/plugin-settings-component.d.cts +25 -4
- package/dist/lib/cjs/obsidian/components/rename-delete-handler-component.cjs +144 -65
- package/dist/lib/cjs/obsidian/components/rename-delete-handler-component.d.cts +3 -0
- package/dist/lib/cjs/obsidian/dataview-link.cjs +7 -2
- package/dist/lib/cjs/obsidian/dataview-link.d.cts +20 -5
- package/dist/lib/cjs/obsidian/dataview.cjs +27 -10
- package/dist/lib/cjs/obsidian/dataview.d.cts +19 -4
- package/dist/lib/cjs/obsidian/file-change.cjs +103 -27
- package/dist/lib/cjs/obsidian/file-change.d.cts +50 -13
- package/dist/lib/cjs/obsidian/file-manager.cjs +61 -32
- package/dist/lib/cjs/obsidian/file-manager.d.cts +63 -13
- package/dist/lib/cjs/obsidian/file-system.cjs +122 -23
- package/dist/lib/cjs/obsidian/file-system.d.cts +168 -39
- package/dist/lib/cjs/obsidian/frontmatter.cjs +7 -2
- package/dist/lib/cjs/obsidian/link.cjs +266 -122
- package/dist/lib/cjs/obsidian/link.d.cts +84 -20
- package/dist/lib/cjs/obsidian/logger.cjs +48 -22
- package/dist/lib/cjs/obsidian/logger.d.cts +26 -5
- package/dist/lib/cjs/obsidian/loop.cjs +14 -4
- package/dist/lib/cjs/obsidian/loop.d.cts +5 -0
- package/dist/lib/cjs/obsidian/markdown-code-block-processor.cjs +155 -107
- package/dist/lib/cjs/obsidian/markdown.cjs +40 -11
- package/dist/lib/cjs/obsidian/markdown.d.cts +76 -16
- package/dist/lib/cjs/obsidian/metadata-cache.cjs +28 -14
- package/dist/lib/cjs/obsidian/metadata-cache.d.cts +76 -16
- package/dist/lib/cjs/obsidian/path-settings.cjs +5 -2
- package/dist/lib/cjs/obsidian/plugin/plugin-event-source.cjs +5 -1
- package/dist/lib/cjs/obsidian/plugin/plugin-event-source.d.cts +4 -0
- package/dist/lib/cjs/obsidian/plugin/plugin-settings-tab.cjs +15 -7
- package/dist/lib/cjs/obsidian/plugin/plugin-settings-tab.d.cts +39 -8
- package/dist/lib/cjs/obsidian/plugin/plugin.cjs +3 -2
- package/dist/lib/cjs/obsidian/plugin/plugin.d.cts +4 -4
- package/dist/lib/cjs/obsidian/queue.cjs +9 -7
- package/dist/lib/cjs/obsidian/resource-url.cjs +7 -2
- package/dist/lib/cjs/obsidian/resource-url.d.cts +19 -4
- package/dist/lib/cjs/obsidian/status-bar-item-registrar.cjs +4 -2
- package/dist/lib/cjs/obsidian/status-bar-item-registrar.d.cts +6 -2
- package/dist/lib/cjs/obsidian/vault-delete.cjs +19 -15
- package/dist/lib/cjs/obsidian/vault-delete.d.cts +11 -6
- package/dist/lib/cjs/obsidian/vault.cjs +116 -59
- package/dist/lib/cjs/obsidian/vault.d.cts +178 -41
- package/dist/lib/cjs/path.cjs +12 -5
- package/dist/lib/cjs/path.d.cts +15 -3
- package/dist/lib/cjs/reg-exp.cjs +101 -78
- package/dist/lib/cjs/script-utils/build.cjs +9 -5
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/change-extension-plugin.cjs +34 -14
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/copy-to-obsidian-plugins-folder-plugin.cjs +20 -5
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/copy-to-obsidian-plugins-folder-plugin.d.cts +23 -5
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/dependency.cjs +11 -4
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/fix-esm-plugin.cjs +6 -2
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/fix-source-maps-plugin.cjs +31 -12
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/fix-source-maps-plugin.d.cts +19 -4
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/obsidian-plugin-builder.cjs +7 -7
- package/dist/lib/cjs/script-utils/bundlers/esbuild-impl/preprocess-plugin.cjs +12 -3
- package/dist/lib/cjs/script-utils/cli-utils.cjs +6 -2
- package/dist/lib/cjs/script-utils/exec.cjs +47 -12
- package/dist/lib/cjs/script-utils/formatters/dprint.cjs +3 -3
- package/dist/lib/cjs/script-utils/json.cjs +9 -5
- package/dist/lib/cjs/script-utils/json.d.cts +38 -8
- package/dist/lib/cjs/script-utils/linters/eslint-rules/no-unused-params-members.cjs +8 -3
- package/dist/lib/cjs/script-utils/linters/eslint-rules/require-component-suffix.cjs +27 -7
- package/dist/lib/cjs/script-utils/linters/eslint-rules/require-method-template.cjs +7 -3
- package/dist/lib/cjs/script-utils/linters/eslint-rules/require-super-call.cjs +8 -3
- package/dist/lib/cjs/script-utils/linters/eslint.cjs +3 -3
- package/dist/lib/cjs/script-utils/linters/markdownlint.cjs +3 -3
- package/dist/lib/cjs/script-utils/linters/over-exposure.cjs +72 -30
- package/dist/lib/cjs/script-utils/npm-publish.cjs +2 -2
- package/dist/lib/cjs/script-utils/npm.cjs +18 -9
- package/dist/lib/cjs/script-utils/root.cjs +20 -5
- package/dist/lib/cjs/script-utils/root.d.cts +45 -9
- package/dist/lib/cjs/script-utils/validate-declarations.cjs +4 -3
- package/dist/lib/cjs/script-utils/version.cjs +36 -19
- package/dist/lib/cjs/strict-proxy.cjs +10 -1
- package/dist/lib/cjs/string.cjs +63 -22
- package/dist/lib/cjs/string.d.cts +188 -40
- package/dist/lib/esm/async-events.d.mts +8 -0
- package/dist/lib/esm/async-events.mjs +9 -1
- package/dist/lib/esm/async.d.mts +67 -15
- package/dist/lib/esm/async.mjs +89 -34
- package/dist/lib/esm/debug.d.mts +23 -5
- package/dist/lib/esm/debug.mjs +26 -9
- package/dist/lib/esm/error.d.mts +19 -4
- package/dist/lib/esm/error.mjs +4 -5
- package/dist/lib/esm/html-element.d.mts +2 -0
- package/dist/lib/esm/html-element.mjs +1 -1
- package/dist/lib/esm/library.mjs +2 -2
- package/dist/lib/esm/object-utils.d.mts +19 -4
- package/dist/lib/esm/object-utils.mjs +233 -128
- package/dist/lib/esm/obsidian/async-with-notice.d.mts +9 -0
- package/dist/lib/esm/obsidian/async-with-notice.mjs +9 -6
- package/dist/lib/esm/obsidian/attachment-path.d.mts +38 -8
- package/dist/lib/esm/obsidian/attachment-path.mjs +45 -13
- package/dist/lib/esm/obsidian/backlink.mjs +6 -6
- package/dist/lib/esm/obsidian/command-handlers/abstract-file-command-handler.d.mts +81 -9
- package/dist/lib/esm/obsidian/command-handlers/abstract-file-command-handler.mjs +53 -16
- package/dist/lib/esm/obsidian/command-handlers/editor-command-handler.d.mts +35 -1
- package/dist/lib/esm/obsidian/command-handlers/editor-command-handler.mjs +25 -5
- package/dist/lib/esm/obsidian/command-handlers/file-command-handler.d.mts +43 -17
- package/dist/lib/esm/obsidian/command-handlers/file-command-handler.mjs +33 -19
- package/dist/lib/esm/obsidian/command-handlers/folder-command-handler.d.mts +43 -17
- package/dist/lib/esm/obsidian/command-handlers/folder-command-handler.mjs +33 -19
- package/dist/lib/esm/obsidian/components/all-windows-event-component.d.mts +48 -8
- package/dist/lib/esm/obsidian/components/all-windows-event-component.mjs +17 -9
- package/dist/lib/esm/obsidian/components/plugin-notice-component.d.mts +3 -1
- package/dist/lib/esm/obsidian/components/plugin-notice-component.mjs +3 -1
- package/dist/lib/esm/obsidian/components/plugin-settings-component.d.mts +25 -4
- package/dist/lib/esm/obsidian/components/plugin-settings-component.mjs +24 -8
- package/dist/lib/esm/obsidian/components/rename-delete-handler-component.d.mts +3 -0
- package/dist/lib/esm/obsidian/components/rename-delete-handler-component.mjs +145 -69
- package/dist/lib/esm/obsidian/dataview-link.d.mts +20 -5
- package/dist/lib/esm/obsidian/dataview-link.mjs +7 -2
- package/dist/lib/esm/obsidian/dataview.d.mts +19 -4
- package/dist/lib/esm/obsidian/dataview.mjs +27 -10
- package/dist/lib/esm/obsidian/file-change.d.mts +50 -13
- package/dist/lib/esm/obsidian/file-change.mjs +104 -27
- package/dist/lib/esm/obsidian/file-manager.d.mts +63 -13
- package/dist/lib/esm/obsidian/file-manager.mjs +65 -33
- package/dist/lib/esm/obsidian/file-system.d.mts +168 -39
- package/dist/lib/esm/obsidian/file-system.mjs +122 -23
- package/dist/lib/esm/obsidian/frontmatter.mjs +7 -2
- package/dist/lib/esm/obsidian/link.d.mts +84 -20
- package/dist/lib/esm/obsidian/link.mjs +266 -122
- package/dist/lib/esm/obsidian/logger.d.mts +26 -5
- package/dist/lib/esm/obsidian/logger.mjs +48 -22
- package/dist/lib/esm/obsidian/loop.d.mts +5 -0
- package/dist/lib/esm/obsidian/loop.mjs +14 -4
- package/dist/lib/esm/obsidian/markdown-code-block-processor.mjs +155 -107
- package/dist/lib/esm/obsidian/markdown.d.mts +76 -16
- package/dist/lib/esm/obsidian/markdown.mjs +40 -11
- package/dist/lib/esm/obsidian/metadata-cache.d.mts +76 -16
- package/dist/lib/esm/obsidian/metadata-cache.mjs +28 -14
- package/dist/lib/esm/obsidian/path-settings.mjs +5 -2
- package/dist/lib/esm/obsidian/plugin/plugin-event-source.d.mts +4 -0
- package/dist/lib/esm/obsidian/plugin/plugin-event-source.mjs +5 -1
- package/dist/lib/esm/obsidian/plugin/plugin-settings-tab.d.mts +39 -8
- package/dist/lib/esm/obsidian/plugin/plugin-settings-tab.mjs +15 -7
- package/dist/lib/esm/obsidian/plugin/plugin.d.mts +4 -4
- package/dist/lib/esm/obsidian/plugin/plugin.mjs +5 -7
- package/dist/lib/esm/obsidian/queue.mjs +9 -7
- package/dist/lib/esm/obsidian/resource-url.d.mts +19 -4
- package/dist/lib/esm/obsidian/resource-url.mjs +7 -2
- package/dist/lib/esm/obsidian/status-bar-item-registrar.d.mts +6 -2
- package/dist/lib/esm/obsidian/status-bar-item-registrar.mjs +4 -2
- package/dist/lib/esm/obsidian/vault-delete.d.mts +11 -6
- package/dist/lib/esm/obsidian/vault-delete.mjs +19 -15
- package/dist/lib/esm/obsidian/vault.d.mts +178 -41
- package/dist/lib/esm/obsidian/vault.mjs +116 -59
- package/dist/lib/esm/path.d.mts +15 -3
- package/dist/lib/esm/path.mjs +12 -5
- package/dist/lib/esm/reg-exp.mjs +101 -78
- package/dist/lib/esm/script-utils/build.mjs +9 -5
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/change-extension-plugin.mjs +34 -14
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/copy-to-obsidian-plugins-folder-plugin.d.mts +23 -5
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/copy-to-obsidian-plugins-folder-plugin.mjs +20 -5
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/dependency.mjs +11 -4
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/fix-esm-plugin.mjs +6 -2
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/fix-source-maps-plugin.d.mts +19 -4
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/fix-source-maps-plugin.mjs +31 -12
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/obsidian-plugin-builder.mjs +7 -7
- package/dist/lib/esm/script-utils/bundlers/esbuild-impl/preprocess-plugin.mjs +12 -3
- package/dist/lib/esm/script-utils/cli-utils.mjs +6 -2
- package/dist/lib/esm/script-utils/exec.mjs +47 -12
- package/dist/lib/esm/script-utils/formatters/dprint.mjs +3 -3
- package/dist/lib/esm/script-utils/json.d.mts +38 -8
- package/dist/lib/esm/script-utils/json.mjs +9 -5
- package/dist/lib/esm/script-utils/linters/eslint-rules/no-unused-params-members.mjs +8 -3
- package/dist/lib/esm/script-utils/linters/eslint-rules/require-component-suffix.mjs +27 -7
- package/dist/lib/esm/script-utils/linters/eslint-rules/require-method-template.mjs +7 -3
- package/dist/lib/esm/script-utils/linters/eslint-rules/require-super-call.mjs +8 -3
- package/dist/lib/esm/script-utils/linters/eslint.mjs +3 -3
- package/dist/lib/esm/script-utils/linters/markdownlint.mjs +3 -3
- package/dist/lib/esm/script-utils/linters/over-exposure.mjs +72 -30
- package/dist/lib/esm/script-utils/npm-publish.mjs +2 -2
- package/dist/lib/esm/script-utils/npm.mjs +18 -9
- package/dist/lib/esm/script-utils/root.d.mts +45 -9
- package/dist/lib/esm/script-utils/root.mjs +20 -5
- package/dist/lib/esm/script-utils/validate-declarations.mjs +4 -3
- package/dist/lib/esm/script-utils/version.mjs +36 -19
- package/dist/lib/esm/strict-proxy.mjs +10 -1
- package/dist/lib/esm/string.d.mts +188 -40
- package/dist/lib/esm/string.mjs +63 -22
- package/dist/styles.css +5 -1
- package/package.json +9 -9
|
@@ -16,6 +16,127 @@ import { FileSystemType } from './file-system.cjs';
|
|
|
16
16
|
export interface ContentArgs {
|
|
17
17
|
readonly content: string;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Parameters for {@link copySafe}.
|
|
21
|
+
*/
|
|
22
|
+
export interface CopySafeParams {
|
|
23
|
+
/**
|
|
24
|
+
* The application instance.
|
|
25
|
+
*/
|
|
26
|
+
readonly app: App;
|
|
27
|
+
/**
|
|
28
|
+
* The new path to copy the file to.
|
|
29
|
+
*/
|
|
30
|
+
readonly newPath: string;
|
|
31
|
+
/**
|
|
32
|
+
* The old path or file to copy.
|
|
33
|
+
*/
|
|
34
|
+
readonly oldPathOrFile: PathOrFile;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parameters for {@link getAbstractFilePathSafe}.
|
|
38
|
+
*/
|
|
39
|
+
export interface GetAbstractFilePathSafeParams {
|
|
40
|
+
/**
|
|
41
|
+
* The application instance.
|
|
42
|
+
*/
|
|
43
|
+
readonly app: App;
|
|
44
|
+
/**
|
|
45
|
+
* The path of the file or folder to get a safe path for.
|
|
46
|
+
*/
|
|
47
|
+
readonly path: string;
|
|
48
|
+
/**
|
|
49
|
+
* The type of the file system object.
|
|
50
|
+
*/
|
|
51
|
+
readonly type: FileSystemType;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Parameters for {@link getOrCreateAbstractFileSafe}.
|
|
55
|
+
*/
|
|
56
|
+
export interface GetOrCreateAbstractFileSafeParams {
|
|
57
|
+
/**
|
|
58
|
+
* The application instance.
|
|
59
|
+
*/
|
|
60
|
+
readonly app: App;
|
|
61
|
+
/**
|
|
62
|
+
* The path of the abstract file to get or create.
|
|
63
|
+
*/
|
|
64
|
+
readonly path: string;
|
|
65
|
+
/**
|
|
66
|
+
* The type of the abstract file to get or create.
|
|
67
|
+
*/
|
|
68
|
+
readonly type: FileSystemType;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Parameters for {@link getSafeRenamePath}.
|
|
72
|
+
*/
|
|
73
|
+
export interface GetSafeRenamePathParams {
|
|
74
|
+
/**
|
|
75
|
+
* The application instance.
|
|
76
|
+
*/
|
|
77
|
+
readonly app: App;
|
|
78
|
+
/**
|
|
79
|
+
* The new path to rename the abstract file to.
|
|
80
|
+
*/
|
|
81
|
+
readonly newPath: string;
|
|
82
|
+
/**
|
|
83
|
+
* The old path or abstract file to rename.
|
|
84
|
+
*/
|
|
85
|
+
readonly oldPathOrAbstractFile: PathOrAbstractFile;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Parameters for {@link invokeWithFileSystemLock}.
|
|
89
|
+
*/
|
|
90
|
+
export interface InvokeWithFileSystemLockParams {
|
|
91
|
+
/**
|
|
92
|
+
* The application instance.
|
|
93
|
+
*/
|
|
94
|
+
readonly app: App;
|
|
95
|
+
/**
|
|
96
|
+
* The function to execute.
|
|
97
|
+
*
|
|
98
|
+
* @param content - The content of the file.
|
|
99
|
+
*/
|
|
100
|
+
fn(this: void, content: string): void;
|
|
101
|
+
/**
|
|
102
|
+
* The path or file to execute the function with the file system lock of.
|
|
103
|
+
*/
|
|
104
|
+
readonly pathOrFile: PathOrFile;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Parameters for {@link isChildOrSelf}.
|
|
108
|
+
*/
|
|
109
|
+
export interface IsChildOrSelfParams {
|
|
110
|
+
/**
|
|
111
|
+
* The application instance.
|
|
112
|
+
*/
|
|
113
|
+
readonly app: App;
|
|
114
|
+
/**
|
|
115
|
+
* The path or file to check whether it is a child or self.
|
|
116
|
+
*/
|
|
117
|
+
readonly childPathOrFile: PathOrAbstractFile;
|
|
118
|
+
/**
|
|
119
|
+
* The path or file to check whether it is a parent or self.
|
|
120
|
+
*/
|
|
121
|
+
readonly parentPathOrFile: PathOrAbstractFile;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Parameters for {@link isChild}.
|
|
125
|
+
*/
|
|
126
|
+
export interface IsChildParams {
|
|
127
|
+
/**
|
|
128
|
+
* The application instance.
|
|
129
|
+
*/
|
|
130
|
+
readonly app: App;
|
|
131
|
+
/**
|
|
132
|
+
* The path or file to check whether it is a child.
|
|
133
|
+
*/
|
|
134
|
+
readonly childPathOrFile: PathOrAbstractFile;
|
|
135
|
+
/**
|
|
136
|
+
* The path or file to check whether it is a parent.
|
|
137
|
+
*/
|
|
138
|
+
readonly parentPathOrFile: PathOrAbstractFile;
|
|
139
|
+
}
|
|
19
140
|
/**
|
|
20
141
|
* Options for {@link process}.
|
|
21
142
|
*/
|
|
@@ -33,15 +154,49 @@ export interface ProcessOptions extends RetryOptions {
|
|
|
33
154
|
*/
|
|
34
155
|
readonly shouldShowTimeoutNotice?: boolean;
|
|
35
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Parameters for {@link process}.
|
|
159
|
+
*/
|
|
160
|
+
export interface ProcessParams extends ProcessOptions {
|
|
161
|
+
/**
|
|
162
|
+
* The application instance, typically used for accessing the vault.
|
|
163
|
+
*/
|
|
164
|
+
readonly app: App;
|
|
165
|
+
/**
|
|
166
|
+
* A value provider that returns the new content based on the old content of the file.
|
|
167
|
+
* It can be a string or a function that takes the old content as an argument and returns the new content.
|
|
168
|
+
* If function is provided, it should return `null` if the process should be retried.
|
|
169
|
+
*/
|
|
170
|
+
readonly newContentProvider: ValueProvider<null | string, ContentArgs>;
|
|
171
|
+
/**
|
|
172
|
+
* The path or file to be processed. It can be a string representing the path or a file object.
|
|
173
|
+
*/
|
|
174
|
+
readonly pathOrFile: PathOrFile;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Parameters for {@link renameSafe}.
|
|
178
|
+
*/
|
|
179
|
+
export interface RenameSafeParams {
|
|
180
|
+
/**
|
|
181
|
+
* The application instance.
|
|
182
|
+
*/
|
|
183
|
+
readonly app: App;
|
|
184
|
+
/**
|
|
185
|
+
* The new path to rename the file to.
|
|
186
|
+
*/
|
|
187
|
+
readonly newPath: string;
|
|
188
|
+
/**
|
|
189
|
+
* The old path or abstract file to rename.
|
|
190
|
+
*/
|
|
191
|
+
readonly oldPathOrAbstractFile: PathOrAbstractFile;
|
|
192
|
+
}
|
|
36
193
|
/**
|
|
37
194
|
* Copies a file safely in the vault.
|
|
38
195
|
*
|
|
39
|
-
* @param
|
|
40
|
-
* @param oldPathOrFile - The old path or file to copy.
|
|
41
|
-
* @param newPath - The new path to copy the file to.
|
|
196
|
+
* @param params - The parameters for copying the file.
|
|
42
197
|
* @returns A {@link Promise} that resolves to the new path of the copied file.
|
|
43
198
|
*/
|
|
44
|
-
export declare function copySafe(
|
|
199
|
+
export declare function copySafe(params: CopySafeParams): Promise<string>;
|
|
45
200
|
/**
|
|
46
201
|
* Creates a folder safely in the specified path.
|
|
47
202
|
*
|
|
@@ -86,12 +241,10 @@ export declare function deleteEmptyFolderHierarchy(app: App, pathOrFolder: null
|
|
|
86
241
|
/**
|
|
87
242
|
* Gets a safe path for a file or folder.
|
|
88
243
|
*
|
|
89
|
-
* @param
|
|
90
|
-
* @param path - The path of the file or folder to get a safe path for.
|
|
91
|
-
* @param type - The type of the file system object.
|
|
244
|
+
* @param params - The parameters for getting a safe path.
|
|
92
245
|
* @returns The safe path for the file or folder.
|
|
93
246
|
*/
|
|
94
|
-
export declare function getAbstractFilePathSafe(
|
|
247
|
+
export declare function getAbstractFilePathSafe(params: GetAbstractFilePathSafeParams): string;
|
|
95
248
|
/**
|
|
96
249
|
* Gets an available path for a file in the vault.
|
|
97
250
|
*
|
|
@@ -136,12 +289,10 @@ export declare function getNoteFilesSorted(app: App): TFile[];
|
|
|
136
289
|
* If the file already exists, it will be returned.
|
|
137
290
|
* If the file does not exist, it will be created and returned.
|
|
138
291
|
*
|
|
139
|
-
* @param
|
|
140
|
-
* @param path - The path of the abstract file to get or create.
|
|
141
|
-
* @param type - The type of the abstract file to get or create.
|
|
292
|
+
* @param params - The parameters for getting or creating the abstract file.
|
|
142
293
|
* @returns A {@link Promise} that resolves to the abstract file.
|
|
143
294
|
*/
|
|
144
|
-
export declare function getOrCreateAbstractFileSafe(
|
|
295
|
+
export declare function getOrCreateAbstractFileSafe(params: GetOrCreateAbstractFileSafeParams): Promise<TAbstractFile>;
|
|
145
296
|
/**
|
|
146
297
|
* Gets or creates a file safely in the specified path.
|
|
147
298
|
*
|
|
@@ -167,38 +318,31 @@ export declare function getOrCreateFolderSafe(app: App, path: string): Promise<T
|
|
|
167
318
|
/**
|
|
168
319
|
* Gets a safe rename path for a file.
|
|
169
320
|
*
|
|
170
|
-
* @param
|
|
171
|
-
* @param oldPathOrAbstractFile - The old path or abstract file to rename.
|
|
172
|
-
* @param newPath - The new path to rename the abstract file to.
|
|
321
|
+
* @param params - The parameters for getting a safe rename path.
|
|
173
322
|
* @returns The safe rename path for the abstract file.
|
|
174
323
|
*/
|
|
175
|
-
export declare function getSafeRenamePath(
|
|
324
|
+
export declare function getSafeRenamePath(params: GetSafeRenamePathParams): string;
|
|
176
325
|
/**
|
|
177
326
|
* Invokes a function with the file system lock.
|
|
178
327
|
*
|
|
179
|
-
* @param
|
|
180
|
-
* @
|
|
181
|
-
* @param fn - The function to execute.
|
|
328
|
+
* @param params - The parameters for invoking the function with the file system lock.
|
|
329
|
+
* @returns A {@link Promise} that resolves when the function is invoked.
|
|
182
330
|
*/
|
|
183
|
-
export declare function invokeWithFileSystemLock(
|
|
331
|
+
export declare function invokeWithFileSystemLock(params: InvokeWithFileSystemLockParams): Promise<void>;
|
|
184
332
|
/**
|
|
185
333
|
* Checks if a path or file is a child of another path or file.
|
|
186
334
|
*
|
|
187
|
-
* @param
|
|
188
|
-
* @
|
|
189
|
-
* @param b - The second path or file.
|
|
190
|
-
* @returns A boolean indicating whether the first path or file is a child of the second path or file.
|
|
335
|
+
* @param params - The parameters for checking whether the child path or file is a child of the parent path or file.
|
|
336
|
+
* @returns A boolean indicating whether the child path or file is a child of the parent path or file.
|
|
191
337
|
*/
|
|
192
|
-
export declare function isChild(
|
|
338
|
+
export declare function isChild(params: IsChildParams): boolean;
|
|
193
339
|
/**
|
|
194
340
|
* Checks if a path or file is a child or self of another path or file.
|
|
195
341
|
*
|
|
196
|
-
* @param
|
|
197
|
-
* @
|
|
198
|
-
* @param b - The second path or file.
|
|
199
|
-
* @returns A boolean indicating whether the first path or file is a child or self of the second path or file.
|
|
342
|
+
* @param params - The parameters for checking whether the child path or file is a child or self of the parent path or file.
|
|
343
|
+
* @returns A boolean indicating whether the child path or file is a child or self of the parent path or file.
|
|
200
344
|
*/
|
|
201
|
-
export declare function isChildOrSelf(
|
|
345
|
+
export declare function isChildOrSelf(params: IsChildOrSelfParams): boolean;
|
|
202
346
|
/**
|
|
203
347
|
* Checks if a folder is empty.
|
|
204
348
|
*
|
|
@@ -218,18 +362,13 @@ export declare function listSafe(app: App, pathOrFolder: PathOrFolder): Promise<
|
|
|
218
362
|
/**
|
|
219
363
|
* Processes a file with retry logic, updating its content based on a provided value or function.
|
|
220
364
|
*
|
|
221
|
-
* @param
|
|
222
|
-
* @param pathOrFile - The path or file to be processed. It can be a string representing the path or a file object.
|
|
223
|
-
* @param newContentProvider - A value provider that returns the new content based on the old content of the file.
|
|
224
|
-
* It can be a string or a function that takes the old content as an argument and returns the new content.
|
|
225
|
-
* If function is provided, it should return `null` if the process should be retried.
|
|
226
|
-
* @param options - Optional options for processing/retrying the operation.
|
|
365
|
+
* @param params - The parameters for processing the file.
|
|
227
366
|
*
|
|
228
367
|
* @returns A {@link Promise} that resolves once the process is complete.
|
|
229
368
|
*
|
|
230
369
|
* @throws Will throw an error if the process fails after the specified number of retries or timeout.
|
|
231
370
|
*/
|
|
232
|
-
export declare function process(
|
|
371
|
+
export declare function process(params: ProcessParams): Promise<void>;
|
|
233
372
|
/**
|
|
234
373
|
* Reads the content of a file safely from the vault.
|
|
235
374
|
*
|
|
@@ -244,12 +383,10 @@ export declare function readSafe(app: App, pathOrFile: PathOrFile): Promise<null
|
|
|
244
383
|
* Renames a file safely in the vault.
|
|
245
384
|
* If the new path already exists, the file will be renamed to an available path.
|
|
246
385
|
*
|
|
247
|
-
* @param
|
|
248
|
-
* @param oldPathOrAbstractFile - The old path or file to rename.
|
|
249
|
-
* @param newPath - The new path to rename the file to.
|
|
386
|
+
* @param params - The parameters for renaming the file.
|
|
250
387
|
* @returns A {@link Promise} that resolves to the new path of the file.
|
|
251
388
|
*/
|
|
252
|
-
export declare function renameSafe(
|
|
389
|
+
export declare function renameSafe(params: RenameSafeParams): Promise<string>;
|
|
253
390
|
/**
|
|
254
391
|
* Saves the specified note in the Obsidian app.
|
|
255
392
|
*
|
package/dist/lib/cjs/path.cjs
CHANGED
|
@@ -179,14 +179,17 @@ function getFileName(importMetaUrl) {
|
|
|
179
179
|
function getFolderName(importMetaUrl) {
|
|
180
180
|
return dirname(getFileName(importMetaUrl));
|
|
181
181
|
}
|
|
182
|
-
function makeFileName(
|
|
183
|
-
return fileExtension ? `${fileBaseName}.${fileExtension}` : fileBaseName;
|
|
182
|
+
function makeFileName(params) {
|
|
183
|
+
return params.fileExtension ? `${params.fileBaseName}.${params.fileExtension}` : params.fileBaseName;
|
|
184
184
|
}
|
|
185
185
|
function normalizeIfRelative(path) {
|
|
186
186
|
if (path.startsWith("/") || path.includes(":")) {
|
|
187
187
|
return path;
|
|
188
188
|
}
|
|
189
|
-
return (0, import_string.ensureStartsWith)(
|
|
189
|
+
return (0, import_string.ensureStartsWith)({
|
|
190
|
+
prefix: "./",
|
|
191
|
+
str: path
|
|
192
|
+
});
|
|
190
193
|
}
|
|
191
194
|
function resolve(...pathSegments) {
|
|
192
195
|
let path = posix.resolve(...pathSegments);
|
|
@@ -198,7 +201,11 @@ function toPosixBuffer(buffer) {
|
|
|
198
201
|
return Buffer.from(toPosixPath(String(buffer)));
|
|
199
202
|
}
|
|
200
203
|
function toPosixPath(path) {
|
|
201
|
-
return (0, import_string.replaceAll)(
|
|
204
|
+
return (0, import_string.replaceAll)({
|
|
205
|
+
replacer: "/",
|
|
206
|
+
searchValue: "\\",
|
|
207
|
+
str: path
|
|
208
|
+
});
|
|
202
209
|
}
|
|
203
210
|
// Annotate the CommonJS export names for ESM import in node:
|
|
204
211
|
0 && (module.exports = {
|
|
@@ -222,4 +229,4 @@ function toPosixPath(path) {
|
|
|
222
229
|
toPosixBuffer,
|
|
223
230
|
toPosixPath
|
|
224
231
|
});
|
|
225
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
232
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vc3JjL3BhdGgudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKlxuICogQGZpbGVcbiAqXG4gKiBDb250YWlucyB1dGlsaXR5IGZ1bmN0aW9ucyBmb3IgaGFuZGxpbmcgcGF0aHMuXG4gKi9cblxuaW1wb3J0IHBhdGhCcm93c2VyaWZ5IGZyb20gJ3BhdGgtYnJvd3NlcmlmeSc7XG5cbmltcG9ydCB7XG4gIGVuc3VyZVN0YXJ0c1dpdGgsXG4gIHJlcGxhY2VBbGxcbn0gZnJvbSAnLi9zdHJpbmcudHMnO1xuXG5jb25zdCBXSU5ET1dTX1BPU0lYX0xJS0VfUEFUSF9SRUdfRVhQID0gL1thLXpBLVpdOlxcL1teOl0qJC87XG5cbi8qKlxuICogUHJvdmlkZXMgbWV0aG9kcyBmb3IgaGFuZGxpbmcgUE9TSVggc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U8sU0FBUyxXQUFXLGNBQWdDO0FBQ3pELE1BQUksT0FBTyxNQUFNLFFBQVEsR0FBRyxZQUFZO0FBQ3hDLFNBQU8sWUFBWSxJQUFJO0FBQ3ZCLFFBQU0sUUFBUSxnQ0FBZ0MsS0FBSyxJQUFJO0FBQ3ZELFNBQU8sUUFBUSxDQUFDLEtBQUs7QUFDdkI7QUFRTyxTQUFTLGNBQWMsUUFBd0I7QUFDcEQsU0FBTyxPQUFPLEtBQUssWUFBWSxPQUFPLE1BQU0sQ0FBQyxDQUFDO0FBQ2hEO0FBUU8sU0FBUyxZQUFZLE1BQXNCO0FBQ2hELGFBQU8sMEJBQVc7QUFBQSxJQUNoQixVQUFVO0FBQUEsSUFDVixhQUFhO0FBQUEsSUFDYixLQUFLO0FBQUEsRUFDUCxDQUFDO0FBQ0g7IiwKICAibmFtZXMiOiBbInBhdGhCcm93c2VyaWZ5Il0KfQo=
|
package/dist/lib/cjs/path.d.cts
CHANGED
|
@@ -84,6 +84,19 @@ export declare const parse: (this: void, path: string) => pathBrowserify.PathObj
|
|
|
84
84
|
* @returns The relative path from `from` to `to`.
|
|
85
85
|
*/
|
|
86
86
|
export declare const relative: (this: void, from: string, to: string) => string;
|
|
87
|
+
/**
|
|
88
|
+
* Parameters for {@link makeFileName}.
|
|
89
|
+
*/
|
|
90
|
+
export interface MakeFileNameParams {
|
|
91
|
+
/**
|
|
92
|
+
* The file name to append the extension to.
|
|
93
|
+
*/
|
|
94
|
+
readonly fileBaseName: string;
|
|
95
|
+
/**
|
|
96
|
+
* The extension to append to the file name.
|
|
97
|
+
*/
|
|
98
|
+
readonly fileExtension: string;
|
|
99
|
+
}
|
|
87
100
|
/**
|
|
88
101
|
* Gets the file name from the `import(dot)meta(dot)url`, converting it to a POSIX-style path.
|
|
89
102
|
*
|
|
@@ -102,11 +115,10 @@ export declare function getFolderName(importMetaUrl: string): string;
|
|
|
102
115
|
* Makes a file name by appending an extension to a given file name.
|
|
103
116
|
* If the extension is empty, the file name is returned as is.
|
|
104
117
|
*
|
|
105
|
-
* @param
|
|
106
|
-
* @param fileExtension - The extension to append to the file name.
|
|
118
|
+
* @param params - The parameters for making the file name.
|
|
107
119
|
* @returns The file name with the extension appended.
|
|
108
120
|
*/
|
|
109
|
-
export declare function makeFileName(
|
|
121
|
+
export declare function makeFileName(params: MakeFileNameParams): string;
|
|
110
122
|
/**
|
|
111
123
|
* Normalizes a given path by ensuring it is relative, adding "./" if necessary.
|
|
112
124
|
*
|