obsidian-dev-utils 77.1.0 → 78.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 (139) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/dev/main.js +588 -239
  3. package/dist/lib/cjs/async.cjs +15 -1
  4. package/dist/lib/cjs/async.d.cts +8 -0
  5. package/dist/lib/cjs/html-element.cjs +16 -3
  6. package/dist/lib/cjs/html-element.d.cts +7 -0
  7. package/dist/lib/cjs/library.cjs +1 -1
  8. package/dist/lib/cjs/obsidian/bases-view-registrar.cjs +155 -0
  9. package/dist/lib/cjs/obsidian/bases-view-registrar.d.cts +52 -0
  10. package/dist/lib/cjs/obsidian/command-handlers/command-handler.cjs +1 -1
  11. package/dist/lib/cjs/obsidian/command-handlers/command-handler.d.cts +3 -3
  12. package/dist/lib/cjs/obsidian/components/rename-delete-handler-component.cjs +64 -53
  13. package/dist/lib/cjs/obsidian/editor-extension-registrar.cjs +155 -0
  14. package/dist/lib/cjs/obsidian/editor-extension-registrar.d.cts +37 -0
  15. package/dist/lib/cjs/obsidian/editor-suggest-registrar.cjs +155 -0
  16. package/dist/lib/cjs/obsidian/editor-suggest-registrar.d.cts +36 -0
  17. package/dist/lib/cjs/obsidian/extensions-registrar.cjs +155 -0
  18. package/dist/lib/cjs/obsidian/extensions-registrar.d.cts +51 -0
  19. package/dist/lib/cjs/obsidian/hover-link-source-registrar.cjs +155 -0
  20. package/dist/lib/cjs/obsidian/hover-link-source-registrar.d.cts +52 -0
  21. package/dist/lib/cjs/obsidian/index.cjs +28 -1
  22. package/dist/lib/cjs/obsidian/index.d.cts +9 -0
  23. package/dist/lib/cjs/obsidian/markdown-code-block-processor-registrar.cjs +5 -6
  24. package/dist/lib/cjs/obsidian/markdown-code-block-processor-registrar.d.cts +25 -9
  25. package/dist/lib/cjs/obsidian/markdown-post-processor-registrar.cjs +156 -0
  26. package/dist/lib/cjs/obsidian/markdown-post-processor-registrar.d.cts +57 -0
  27. package/dist/lib/cjs/obsidian/markdown.cjs +6 -8
  28. package/dist/lib/cjs/obsidian/modals/alert.cjs +11 -5
  29. package/dist/lib/cjs/obsidian/modals/confirm.cjs +11 -5
  30. package/dist/lib/cjs/obsidian/modals/confirm.d.cts +2 -10
  31. package/dist/lib/cjs/obsidian/modals/modal.cjs +16 -14
  32. package/dist/lib/cjs/obsidian/modals/modal.d.cts +22 -11
  33. package/dist/lib/cjs/obsidian/modals/prompt.cjs +11 -5
  34. package/dist/lib/cjs/obsidian/modals/prompt.d.cts +2 -6
  35. package/dist/lib/cjs/obsidian/modals/select-item.cjs +23 -16
  36. package/dist/lib/cjs/obsidian/modals/select-item.d.cts +3 -11
  37. package/dist/lib/cjs/obsidian/obsidian-protocol-handler-registrar.cjs +6 -6
  38. package/dist/lib/cjs/obsidian/obsidian-protocol-handler-registrar.d.cts +24 -10
  39. package/dist/lib/cjs/obsidian/plugin-cli-handler-registrar.cjs +156 -0
  40. package/dist/lib/cjs/obsidian/plugin-cli-handler-registrar.d.cts +64 -0
  41. package/dist/lib/cjs/obsidian/ribbon-icon-registrar.cjs +156 -0
  42. package/dist/lib/cjs/obsidian/ribbon-icon-registrar.d.cts +60 -0
  43. package/dist/lib/cjs/obsidian/setting-components/date-component.cjs +6 -2
  44. package/dist/lib/cjs/obsidian/setting-components/date-time-component.cjs +6 -2
  45. package/dist/lib/cjs/obsidian/setting-components/email-component.cjs +6 -2
  46. package/dist/lib/cjs/obsidian/setting-components/file-component.cjs +6 -2
  47. package/dist/lib/cjs/obsidian/setting-components/month-component.cjs +6 -2
  48. package/dist/lib/cjs/obsidian/setting-components/multiple-email-component.cjs +6 -2
  49. package/dist/lib/cjs/obsidian/setting-components/multiple-file-component.cjs +6 -2
  50. package/dist/lib/cjs/obsidian/setting-components/number-component.cjs +6 -2
  51. package/dist/lib/cjs/obsidian/setting-components/password-component.cjs +8 -4
  52. package/dist/lib/cjs/obsidian/setting-components/password-component.d.cts +2 -2
  53. package/dist/lib/cjs/obsidian/setting-components/telephone-component.cjs +8 -4
  54. package/dist/lib/cjs/obsidian/setting-components/telephone-component.d.cts +2 -2
  55. package/dist/lib/cjs/obsidian/setting-components/time-component.cjs +6 -2
  56. package/dist/lib/cjs/obsidian/setting-components/typed-text-component.cjs +6 -8
  57. package/dist/lib/cjs/obsidian/setting-components/typed-text-component.d.cts +19 -4
  58. package/dist/lib/cjs/obsidian/setting-components/url-component.cjs +6 -2
  59. package/dist/lib/cjs/obsidian/setting-components/week-component.cjs +6 -2
  60. package/dist/lib/cjs/obsidian/status-bar-item-registrar.cjs +153 -0
  61. package/dist/lib/cjs/obsidian/status-bar-item-registrar.d.cts +32 -0
  62. package/dist/lib/cjs/obsidian/view-registrar.cjs +4 -5
  63. package/dist/lib/cjs/obsidian/view-registrar.d.cts +20 -7
  64. package/dist/lib/cjs/script-utils/linters/over-exposure.cjs +241 -68
  65. package/dist/lib/cjs/script-utils/linters/over-exposure.d.cts +59 -6
  66. package/dist/lib/esm/async.d.mts +8 -0
  67. package/dist/lib/esm/async.mjs +14 -1
  68. package/dist/lib/esm/html-element.d.mts +7 -0
  69. package/dist/lib/esm/html-element.mjs +14 -2
  70. package/dist/lib/esm/library.mjs +1 -1
  71. package/dist/lib/esm/obsidian/bases-view-registrar.d.mts +52 -0
  72. package/dist/lib/esm/obsidian/bases-view-registrar.mjs +47 -0
  73. package/dist/lib/esm/obsidian/command-handlers/command-handler.d.mts +3 -3
  74. package/dist/lib/esm/obsidian/command-handlers/command-handler.mjs +1 -1
  75. package/dist/lib/esm/obsidian/components/rename-delete-handler-component.mjs +64 -53
  76. package/dist/lib/esm/obsidian/editor-extension-registrar.d.mts +37 -0
  77. package/dist/lib/esm/obsidian/editor-extension-registrar.mjs +47 -0
  78. package/dist/lib/esm/obsidian/editor-suggest-registrar.d.mts +36 -0
  79. package/dist/lib/esm/obsidian/editor-suggest-registrar.mjs +50 -0
  80. package/dist/lib/esm/obsidian/extensions-registrar.d.mts +51 -0
  81. package/dist/lib/esm/obsidian/extensions-registrar.mjs +47 -0
  82. package/dist/lib/esm/obsidian/hover-link-source-registrar.d.mts +52 -0
  83. package/dist/lib/esm/obsidian/hover-link-source-registrar.mjs +47 -0
  84. package/dist/lib/esm/obsidian/index.d.mts +9 -0
  85. package/dist/lib/esm/obsidian/index.mjs +19 -1
  86. package/dist/lib/esm/obsidian/markdown-code-block-processor-registrar.d.mts +25 -9
  87. package/dist/lib/esm/obsidian/markdown-code-block-processor-registrar.mjs +5 -6
  88. package/dist/lib/esm/obsidian/markdown-post-processor-registrar.d.mts +57 -0
  89. package/dist/lib/esm/obsidian/markdown-post-processor-registrar.mjs +48 -0
  90. package/dist/lib/esm/obsidian/markdown.mjs +10 -9
  91. package/dist/lib/esm/obsidian/modals/alert.mjs +11 -6
  92. package/dist/lib/esm/obsidian/modals/confirm.d.mts +2 -10
  93. package/dist/lib/esm/obsidian/modals/confirm.mjs +11 -6
  94. package/dist/lib/esm/obsidian/modals/modal.d.mts +22 -11
  95. package/dist/lib/esm/obsidian/modals/modal.mjs +16 -13
  96. package/dist/lib/esm/obsidian/modals/prompt.d.mts +2 -6
  97. package/dist/lib/esm/obsidian/modals/prompt.mjs +11 -6
  98. package/dist/lib/esm/obsidian/modals/select-item.d.mts +3 -11
  99. package/dist/lib/esm/obsidian/modals/select-item.mjs +23 -16
  100. package/dist/lib/esm/obsidian/obsidian-protocol-handler-registrar.d.mts +24 -10
  101. package/dist/lib/esm/obsidian/obsidian-protocol-handler-registrar.mjs +6 -6
  102. package/dist/lib/esm/obsidian/plugin-cli-handler-registrar.d.mts +64 -0
  103. package/dist/lib/esm/obsidian/plugin-cli-handler-registrar.mjs +48 -0
  104. package/dist/lib/esm/obsidian/ribbon-icon-registrar.d.mts +60 -0
  105. package/dist/lib/esm/obsidian/ribbon-icon-registrar.mjs +48 -0
  106. package/dist/lib/esm/obsidian/setting-components/date-component.mjs +6 -2
  107. package/dist/lib/esm/obsidian/setting-components/date-time-component.mjs +6 -2
  108. package/dist/lib/esm/obsidian/setting-components/email-component.mjs +6 -2
  109. package/dist/lib/esm/obsidian/setting-components/file-component.mjs +6 -2
  110. package/dist/lib/esm/obsidian/setting-components/month-component.mjs +6 -2
  111. package/dist/lib/esm/obsidian/setting-components/multiple-email-component.mjs +6 -2
  112. package/dist/lib/esm/obsidian/setting-components/multiple-file-component.mjs +6 -2
  113. package/dist/lib/esm/obsidian/setting-components/number-component.mjs +6 -2
  114. package/dist/lib/esm/obsidian/setting-components/password-component.d.mts +2 -2
  115. package/dist/lib/esm/obsidian/setting-components/password-component.mjs +8 -4
  116. package/dist/lib/esm/obsidian/setting-components/telephone-component.d.mts +2 -2
  117. package/dist/lib/esm/obsidian/setting-components/telephone-component.mjs +8 -4
  118. package/dist/lib/esm/obsidian/setting-components/time-component.mjs +6 -2
  119. package/dist/lib/esm/obsidian/setting-components/typed-text-component.d.mts +19 -4
  120. package/dist/lib/esm/obsidian/setting-components/typed-text-component.mjs +6 -8
  121. package/dist/lib/esm/obsidian/setting-components/url-component.mjs +6 -2
  122. package/dist/lib/esm/obsidian/setting-components/week-component.mjs +6 -2
  123. package/dist/lib/esm/obsidian/status-bar-item-registrar.d.mts +32 -0
  124. package/dist/lib/esm/obsidian/status-bar-item-registrar.mjs +45 -0
  125. package/dist/lib/esm/obsidian/view-registrar.d.mts +20 -7
  126. package/dist/lib/esm/obsidian/view-registrar.mjs +4 -5
  127. package/dist/lib/esm/script-utils/linters/over-exposure.d.mts +59 -6
  128. package/dist/lib/esm/script-utils/linters/over-exposure.mjs +242 -68
  129. package/dist/scripts/linters/over-exposure/find-overexposed-fix.ts +12 -0
  130. package/obsidian/bases-view-registrar/package.json +6 -0
  131. package/obsidian/editor-extension-registrar/package.json +6 -0
  132. package/obsidian/editor-suggest-registrar/package.json +6 -0
  133. package/obsidian/extensions-registrar/package.json +6 -0
  134. package/obsidian/hover-link-source-registrar/package.json +6 -0
  135. package/obsidian/markdown-post-processor-registrar/package.json +6 -0
  136. package/obsidian/plugin-cli-handler-registrar/package.json +6 -0
  137. package/obsidian/ribbon-icon-registrar/package.json +6 -0
  138. package/obsidian/status-bar-item-registrar/package.json +6 -0
  139. package/package.json +1 -1
@@ -35,14 +35,13 @@ class PluginViewRegistrar {
35
35
  /**
36
36
  * Registers a view type with a view creator.
37
37
  *
38
- * @param type - The view type to register.
39
- * @param viewCreator - The view creator function that creates a view instance for the given type.
38
+ * @param params - The parameters for the view registration.
40
39
  */
41
- registerView(type, viewCreator) {
42
- this.plugin.registerView(type, viewCreator);
40
+ registerView(params) {
41
+ this.plugin.registerView(params.type, params.viewCreator);
43
42
  }
44
43
  }
45
44
  export {
46
45
  PluginViewRegistrar
47
46
  };
48
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vLi4vLi4vc3JjL29ic2lkaWFuL3ZpZXctcmVnaXN0cmFyLnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIEBmaWxlXG4gKlxuICogVGhpcyBmaWxlIGRlZmluZXMgdGhlIHtAbGluayBWaWV3UmVnaXN0cmFyfSBpbnRlcmZhY2UgYW5kIHRoZSB7QGxpbmsgUGx1Z2luVmlld1JlZ2lzdHJhcn0gY2xhc3MuXG4gKi9cblxuaW1wb3J0IHR5cGUgeyBWaWV3Q3JlYXRvciB9IGZyb20gJ29ic2lkaWFuJztcblxuaW1wb3J0IHsgUGx1Z2luIH0gZnJvbSAnb2JzaWRpYW4nO1xuXG4vKipcbiAqIEEgcmVnaXN0cmFyIGZvciB2aWV3cy5cbiAqL1xuZXhwb3J0IGludGVyZmFjZSBWaWV3UmVnaXN0cmFyIHtcbiAgLyoqXG4gICAqIFJlZ2lzdGVycyBhIHZpZXcgdHlwZSB3aXRoIGEgdmlldyBjcmVhdG9yLlxuICAgKlxuICAgKiBAcGFyYW0gdHlwZSAtIFRoZSB2aWV3IHR5cGUgdG8gcmVnaXN0ZXIuXG4gICAqIEBwYXJhbSB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Qp9Cg==
@@ -23,6 +23,13 @@
23
23
  * A member referenced only from test files is reported with {@link OverExposureFinding.isForcedByTestOnly}
24
24
  * set, surfacing members widened purely for testability — the canonical case for extracting logic
25
25
  * into an independently testable component instead.
26
+ *
27
+ * Beyond reporting, passing `shouldFix` to {@link findOverExposure} / {@link analyzeOverExposure}
28
+ * rewrites the source in place: dropping the `export` keyword, or replacing/inserting a `private`
29
+ * or `protected` modifier. Each finding then carries {@link OverExposureFinding.wasFixed} /
30
+ * {@link OverExposureFinding.skipReason}. Changes that cannot be safely automated — those forced
31
+ * only by test references, decorated members, or an `export` shared with a still-exported sibling —
32
+ * are reported as skipped and left untouched.
26
33
  */
27
34
  import type { CompilerOptions, LanguageService, LanguageServiceHost } from 'typescript';
28
35
  /**
@@ -37,12 +44,26 @@ export interface AnalyzeOverExposureParams {
37
44
  * appearing to hang.
38
45
  */
39
46
  onProgress?(this: void, progress: OverExposureProgress): void;
47
+ /**
48
+ * When `true`, each fixable finding is tightened in place via {@link writeFile} (which must then
49
+ * be provided), and the returned findings carry {@link OverExposureFinding.wasFixed} /
50
+ * {@link OverExposureFinding.skipReason}. When `false` or omitted, the analysis only reports.
51
+ */
52
+ readonly shouldFix?: boolean | undefined;
40
53
  /**
41
54
  * Absolute (canonical) path of the project's `src` folder. Only declarations in non-test files
42
55
  * under this folder are analyzed; declarations elsewhere (test files, dependencies) are ignored
43
56
  * but still counted as reference sites.
44
57
  */
45
58
  readonly srcFolder: string;
59
+ /**
60
+ * Writes the tightened contents of a changed file back to disk. Required when {@link shouldFix}
61
+ * is `true`; ignored otherwise.
62
+ *
63
+ * @param path - Absolute path of the file to write (original casing, as stored in the program).
64
+ * @param content - The full new file contents.
65
+ */
66
+ writeFile?(this: void, path: string, content: string): void;
46
67
  }
47
68
  /**
48
69
  * Parameters for {@link createLanguageServiceHost}.
@@ -77,6 +98,12 @@ export interface FindOverExposureParams {
77
98
  onProgress?(this: void, progress: OverExposureProgress): void;
78
99
  /** Absolute path to the project root (the folder containing `tsconfig.json` and `src`). */
79
100
  readonly projectFolder: string;
101
+ /**
102
+ * When `true`, fixable findings are tightened in place on disk (the `export` keyword is dropped,
103
+ * or a `private` / `protected` modifier is inserted/replaced). When `false` or omitted, the
104
+ * project is only analyzed.
105
+ */
106
+ readonly shouldFix?: boolean | undefined;
80
107
  }
81
108
  /**
82
109
  * Options for {@link formatOverExposureFindings}.
@@ -151,8 +178,15 @@ export interface OverExposureFinding {
151
178
  readonly line: number;
152
179
  /** The declared name. */
153
180
  readonly name: string;
181
+ /**
182
+ * In a fix run, why this finding was left untouched instead of tightened; `null` when it was
183
+ * fixed or when the analysis only reported (`shouldFix` off).
184
+ */
185
+ readonly skipReason: null | OverExposureSkipReason;
154
186
  /** The exposure the declaration could be tightened to. */
155
187
  readonly suggestedExposure: SuggestedExposure;
188
+ /** `true` when a fix run tightened this declaration in place. Always `false` in a report run. */
189
+ readonly wasFixed: boolean;
156
190
  }
157
191
  /**
158
192
  * Progress reported while analyzing a project, one event per analyzed source file.
@@ -165,6 +199,14 @@ export interface OverExposureProgress {
165
199
  /** Total number of source files that will be analyzed. */
166
200
  readonly totalFileCount: number;
167
201
  }
202
+ /**
203
+ * Why a fix run left a finding untouched:
204
+ *
205
+ * - `decorated` — the member carries a decorator, so the modifier insertion point is ambiguous.
206
+ * - `shared-export` — the `export` keyword is shared with a still-exported sibling declarator.
207
+ * - `test-only` — the declaration is exposed purely for tests, so tightening would break the test.
208
+ */
209
+ export type OverExposureSkipReason = 'decorated' | 'shared-export' | 'test-only';
168
210
  /**
169
211
  * The (tighter) exposure level a declaration could be reduced to.
170
212
  */
@@ -176,7 +218,11 @@ export type SuggestedExposure = 'file-local' | 'private' | 'protected';
176
218
  */
177
219
  export declare const LIFECYCLE_ALLOWLIST: ReadonlySet<string>;
178
220
  /**
179
- * Analyzes a project (already loaded into a language service) for over-exposed declarations.
221
+ * Analyzes a project (already loaded into a language service) for over-exposed declarations, and —
222
+ * when {@link AnalyzeOverExposureParams.shouldFix} is set — tightens every fixable finding in place
223
+ * via {@link AnalyzeOverExposureParams.writeFile}. Findings that cannot be safely automated (exposed
224
+ * only for tests, decorated, or sharing an `export` keyword with a still-exported sibling) carry a
225
+ * {@link OverExposureFinding.skipReason} and are left untouched.
180
226
  *
181
227
  * @param params - The {@link AnalyzeOverExposureParams}.
182
228
  * @returns The over-exposed declarations, in discovery order.
@@ -197,17 +243,24 @@ export declare function createLanguageServiceHost(params: CreateLanguageServiceH
197
243
  */
198
244
  export declare function createProjectLanguageService(params: CreateProjectLanguageServiceParams): LanguageService;
199
245
  /**
200
- * Finds over-exposed declarations in a project on disk.
246
+ * Finds over-exposed declarations in a project on disk. When
247
+ * {@link FindOverExposureParams.shouldFix} is set, each fixable finding is also tightened in place
248
+ * (rewriting the affected source files via `typescript`'s `sys.writeFile`).
201
249
  *
202
250
  * @param params - The {@link FindOverExposureParams}.
203
251
  * @returns The over-exposed declarations.
204
252
  */
205
253
  export declare function findOverExposure(params: FindOverExposureParams): OverExposureFinding[];
206
254
  /**
207
- * Formats over-exposure findings as a human-readable report. Findings are grouped by file and sorted
208
- * by line. Each finding spans two lines a `path:line:column` location (which terminals such as VS
209
- * Code render as a clickable link that jumps to the declaration) followed by the suggested change and
210
- * its reason separated from the next finding by a blank line.
255
+ * Formats over-exposure findings as a human-readable report, using the grouped layout of ESLint's
256
+ * `stylish` formatter. Findings are grouped by file and sorted by line: each file is rendered as a
257
+ * `path` header line, followed by one indented ` line:column change -- reason` row per finding (the
258
+ * `line:column` is right-padded so the rows align within a file). Terminals such as VS Code render
259
+ * each indented `line:column` as a clickable link — resolved against the file header above it — that
260
+ * jumps straight to the declaration. File groups are separated by a blank line. In a fix run (findings
261
+ * carrying {@link OverExposureFinding.wasFixed} / {@link OverExposureFinding.skipReason}) each change
262
+ * row is suffixed with `[fixed]` or `[skipped: …]`, and the trailing summary appends the fixed/skipped
263
+ * counts.
211
264
  *
212
265
  * @param findings - The findings to format.
213
266
  * @param options - The {@link FormatOverExposureFindingsOptions}.