@real1ty-obsidian-plugins/utils 2.28.0 → 2.30.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 (236) hide show
  1. package/package.json +1 -1
  2. package/src/core/history.ts +45 -0
  3. package/src/core/index.ts +1 -0
  4. package/src/settings/settings-ui-builder.ts +0 -1
  5. package/dist/async/async.d.ts +0 -69
  6. package/dist/async/async.d.ts.map +0 -1
  7. package/dist/async/async.js +0 -108
  8. package/dist/async/async.js.map +0 -1
  9. package/dist/async/batch-operations.d.ts +0 -21
  10. package/dist/async/batch-operations.d.ts.map +0 -1
  11. package/dist/async/batch-operations.js +0 -60
  12. package/dist/async/batch-operations.js.map +0 -1
  13. package/dist/async/change-notifier.d.ts +0 -13
  14. package/dist/async/change-notifier.d.ts.map +0 -1
  15. package/dist/async/change-notifier.js +0 -26
  16. package/dist/async/change-notifier.js.map +0 -1
  17. package/dist/async/debounced-notifier.d.ts +0 -26
  18. package/dist/async/debounced-notifier.d.ts.map +0 -1
  19. package/dist/async/debounced-notifier.js +0 -50
  20. package/dist/async/debounced-notifier.js.map +0 -1
  21. package/dist/async/index.d.ts +0 -5
  22. package/dist/async/index.d.ts.map +0 -1
  23. package/dist/async/index.js +0 -5
  24. package/dist/async/index.js.map +0 -1
  25. package/dist/components/frontmatter-propagation-modal.d.ts +0 -17
  26. package/dist/components/frontmatter-propagation-modal.d.ts.map +0 -1
  27. package/dist/components/frontmatter-propagation-modal.js +0 -85
  28. package/dist/components/frontmatter-propagation-modal.js.map +0 -1
  29. package/dist/components/index.d.ts +0 -5
  30. package/dist/components/index.d.ts.map +0 -1
  31. package/dist/components/index.js +0 -5
  32. package/dist/components/index.js.map +0 -1
  33. package/dist/components/input-managers/base.d.ts +0 -30
  34. package/dist/components/input-managers/base.d.ts.map +0 -1
  35. package/dist/components/input-managers/base.js +0 -115
  36. package/dist/components/input-managers/base.js.map +0 -1
  37. package/dist/components/input-managers/expression.d.ts +0 -12
  38. package/dist/components/input-managers/expression.d.ts.map +0 -1
  39. package/dist/components/input-managers/expression.js +0 -56
  40. package/dist/components/input-managers/expression.js.map +0 -1
  41. package/dist/components/input-managers/index.d.ts +0 -4
  42. package/dist/components/input-managers/index.d.ts.map +0 -1
  43. package/dist/components/input-managers/index.js +0 -4
  44. package/dist/components/input-managers/index.js.map +0 -1
  45. package/dist/components/input-managers/search.d.ts +0 -6
  46. package/dist/components/input-managers/search.d.ts.map +0 -1
  47. package/dist/components/input-managers/search.js +0 -16
  48. package/dist/components/input-managers/search.js.map +0 -1
  49. package/dist/components/registered-events-component.d.ts +0 -30
  50. package/dist/components/registered-events-component.d.ts.map +0 -1
  51. package/dist/components/registered-events-component.js +0 -43
  52. package/dist/components/registered-events-component.js.map +0 -1
  53. package/dist/components/whats-new-modal.d.ts +0 -64
  54. package/dist/components/whats-new-modal.d.ts.map +0 -1
  55. package/dist/components/whats-new-modal.js +0 -139
  56. package/dist/components/whats-new-modal.js.map +0 -1
  57. package/dist/core/color-utils.d.ts +0 -17
  58. package/dist/core/color-utils.d.ts.map +0 -1
  59. package/dist/core/color-utils.js +0 -29
  60. package/dist/core/color-utils.js.map +0 -1
  61. package/dist/core/css-utils.d.ts +0 -39
  62. package/dist/core/css-utils.d.ts.map +0 -1
  63. package/dist/core/css-utils.js +0 -60
  64. package/dist/core/css-utils.js.map +0 -1
  65. package/dist/core/evaluator/base.d.ts +0 -22
  66. package/dist/core/evaluator/base.d.ts.map +0 -1
  67. package/dist/core/evaluator/base.js +0 -67
  68. package/dist/core/evaluator/base.js.map +0 -1
  69. package/dist/core/evaluator/color.d.ts +0 -19
  70. package/dist/core/evaluator/color.d.ts.map +0 -1
  71. package/dist/core/evaluator/color.js +0 -25
  72. package/dist/core/evaluator/color.js.map +0 -1
  73. package/dist/core/evaluator/excluded.d.ts +0 -32
  74. package/dist/core/evaluator/excluded.d.ts.map +0 -1
  75. package/dist/core/evaluator/excluded.js +0 -41
  76. package/dist/core/evaluator/excluded.js.map +0 -1
  77. package/dist/core/evaluator/filter.d.ts +0 -15
  78. package/dist/core/evaluator/filter.d.ts.map +0 -1
  79. package/dist/core/evaluator/filter.js +0 -27
  80. package/dist/core/evaluator/filter.js.map +0 -1
  81. package/dist/core/evaluator/included.d.ts +0 -36
  82. package/dist/core/evaluator/included.d.ts.map +0 -1
  83. package/dist/core/evaluator/included.js +0 -51
  84. package/dist/core/evaluator/included.js.map +0 -1
  85. package/dist/core/evaluator/index.d.ts +0 -6
  86. package/dist/core/evaluator/index.d.ts.map +0 -1
  87. package/dist/core/evaluator/index.js +0 -6
  88. package/dist/core/evaluator/index.js.map +0 -1
  89. package/dist/core/expression-utils.d.ts +0 -17
  90. package/dist/core/expression-utils.d.ts.map +0 -1
  91. package/dist/core/expression-utils.js +0 -40
  92. package/dist/core/expression-utils.js.map +0 -1
  93. package/dist/core/frontmatter-value.d.ts +0 -157
  94. package/dist/core/frontmatter-value.d.ts.map +0 -1
  95. package/dist/core/frontmatter-value.js +0 -417
  96. package/dist/core/frontmatter-value.js.map +0 -1
  97. package/dist/core/generate.d.ts +0 -7
  98. package/dist/core/generate.d.ts.map +0 -1
  99. package/dist/core/generate.js +0 -13
  100. package/dist/core/generate.js.map +0 -1
  101. package/dist/core/index.d.ts +0 -10
  102. package/dist/core/index.d.ts.map +0 -1
  103. package/dist/core/index.js +0 -10
  104. package/dist/core/index.js.map +0 -1
  105. package/dist/core/indexer.d.ts +0 -109
  106. package/dist/core/indexer.d.ts.map +0 -1
  107. package/dist/core/indexer.js +0 -185
  108. package/dist/core/indexer.js.map +0 -1
  109. package/dist/core/property-renderer.d.ts +0 -9
  110. package/dist/core/property-renderer.d.ts.map +0 -1
  111. package/dist/core/property-renderer.js +0 -42
  112. package/dist/core/property-renderer.js.map +0 -1
  113. package/dist/core/validation.d.ts +0 -13
  114. package/dist/core/validation.d.ts.map +0 -1
  115. package/dist/core/validation.js +0 -27
  116. package/dist/core/validation.js.map +0 -1
  117. package/dist/date/date-recurrence.d.ts +0 -30
  118. package/dist/date/date-recurrence.d.ts.map +0 -1
  119. package/dist/date/date-recurrence.js +0 -188
  120. package/dist/date/date-recurrence.js.map +0 -1
  121. package/dist/date/date.d.ts +0 -21
  122. package/dist/date/date.d.ts.map +0 -1
  123. package/dist/date/date.js +0 -105
  124. package/dist/date/date.js.map +0 -1
  125. package/dist/date/index.d.ts +0 -3
  126. package/dist/date/index.d.ts.map +0 -1
  127. package/dist/date/index.js +0 -3
  128. package/dist/date/index.js.map +0 -1
  129. package/dist/file/child-reference.d.ts +0 -9
  130. package/dist/file/child-reference.d.ts.map +0 -1
  131. package/dist/file/child-reference.js +0 -57
  132. package/dist/file/child-reference.js.map +0 -1
  133. package/dist/file/file-operations.d.ts +0 -31
  134. package/dist/file/file-operations.d.ts.map +0 -1
  135. package/dist/file/file-operations.js +0 -160
  136. package/dist/file/file-operations.js.map +0 -1
  137. package/dist/file/file-utils.d.ts +0 -33
  138. package/dist/file/file-utils.d.ts.map +0 -1
  139. package/dist/file/file-utils.js +0 -76
  140. package/dist/file/file-utils.js.map +0 -1
  141. package/dist/file/file.d.ts +0 -332
  142. package/dist/file/file.d.ts.map +0 -1
  143. package/dist/file/file.js +0 -559
  144. package/dist/file/file.js.map +0 -1
  145. package/dist/file/frontmatter-diff.d.ts +0 -38
  146. package/dist/file/frontmatter-diff.d.ts.map +0 -1
  147. package/dist/file/frontmatter-diff.js +0 -162
  148. package/dist/file/frontmatter-diff.js.map +0 -1
  149. package/dist/file/frontmatter-propagation.d.ts +0 -4
  150. package/dist/file/frontmatter-propagation.d.ts.map +0 -1
  151. package/dist/file/frontmatter-propagation.js +0 -28
  152. package/dist/file/frontmatter-propagation.js.map +0 -1
  153. package/dist/file/frontmatter-serialization.d.ts +0 -21
  154. package/dist/file/frontmatter-serialization.d.ts.map +0 -1
  155. package/dist/file/frontmatter-serialization.js +0 -57
  156. package/dist/file/frontmatter-serialization.js.map +0 -1
  157. package/dist/file/frontmatter.d.ts +0 -15
  158. package/dist/file/frontmatter.d.ts.map +0 -1
  159. package/dist/file/frontmatter.js +0 -68
  160. package/dist/file/frontmatter.js.map +0 -1
  161. package/dist/file/index.d.ts +0 -13
  162. package/dist/file/index.d.ts.map +0 -1
  163. package/dist/file/index.js +0 -13
  164. package/dist/file/index.js.map +0 -1
  165. package/dist/file/link-parser.d.ts +0 -63
  166. package/dist/file/link-parser.d.ts.map +0 -1
  167. package/dist/file/link-parser.js +0 -137
  168. package/dist/file/link-parser.js.map +0 -1
  169. package/dist/file/property-utils.d.ts +0 -55
  170. package/dist/file/property-utils.d.ts.map +0 -1
  171. package/dist/file/property-utils.js +0 -90
  172. package/dist/file/property-utils.js.map +0 -1
  173. package/dist/file/templater-service.d.ts +0 -16
  174. package/dist/file/templater-service.d.ts.map +0 -1
  175. package/dist/file/templater-service.js +0 -37
  176. package/dist/file/templater-service.js.map +0 -1
  177. package/dist/file/templater.d.ts +0 -28
  178. package/dist/file/templater.d.ts.map +0 -1
  179. package/dist/file/templater.js +0 -126
  180. package/dist/file/templater.js.map +0 -1
  181. package/dist/index.d.ts +0 -9
  182. package/dist/index.d.ts.map +0 -1
  183. package/dist/index.js +0 -17
  184. package/dist/index.js.map +0 -1
  185. package/dist/inputs/index.d.ts +0 -2
  186. package/dist/inputs/index.d.ts.map +0 -1
  187. package/dist/inputs/index.js +0 -2
  188. package/dist/inputs/index.js.map +0 -1
  189. package/dist/inputs/input-filter-manager.d.ts +0 -72
  190. package/dist/inputs/input-filter-manager.d.ts.map +0 -1
  191. package/dist/inputs/input-filter-manager.js +0 -140
  192. package/dist/inputs/input-filter-manager.js.map +0 -1
  193. package/dist/settings/index.d.ts +0 -3
  194. package/dist/settings/index.d.ts.map +0 -1
  195. package/dist/settings/index.js +0 -3
  196. package/dist/settings/index.js.map +0 -1
  197. package/dist/settings/settings-store.d.ts +0 -20
  198. package/dist/settings/settings-store.d.ts.map +0 -1
  199. package/dist/settings/settings-store.js +0 -82
  200. package/dist/settings/settings-store.js.map +0 -1
  201. package/dist/settings/settings-ui-builder.d.ts +0 -74
  202. package/dist/settings/settings-ui-builder.d.ts.map +0 -1
  203. package/dist/settings/settings-ui-builder.js +0 -437
  204. package/dist/settings/settings-ui-builder.js.map +0 -1
  205. package/dist/string/changelog-parser.d.ts +0 -17
  206. package/dist/string/changelog-parser.d.ts.map +0 -1
  207. package/dist/string/changelog-parser.js +0 -77
  208. package/dist/string/changelog-parser.js.map +0 -1
  209. package/dist/string/filename-utils.d.ts +0 -46
  210. package/dist/string/filename-utils.d.ts.map +0 -1
  211. package/dist/string/filename-utils.js +0 -65
  212. package/dist/string/filename-utils.js.map +0 -1
  213. package/dist/string/index.d.ts +0 -4
  214. package/dist/string/index.d.ts.map +0 -1
  215. package/dist/string/index.js +0 -4
  216. package/dist/string/index.js.map +0 -1
  217. package/dist/string/string.d.ts +0 -5
  218. package/dist/string/string.d.ts.map +0 -1
  219. package/dist/string/string.js +0 -25
  220. package/dist/string/string.js.map +0 -1
  221. package/dist/testing/index.d.ts +0 -5
  222. package/dist/testing/index.d.ts.map +0 -1
  223. package/dist/testing/index.js +0 -6
  224. package/dist/testing/index.js.map +0 -1
  225. package/dist/testing/mocks/obsidian.d.ts +0 -150
  226. package/dist/testing/mocks/obsidian.d.ts.map +0 -1
  227. package/dist/testing/mocks/obsidian.js +0 -226
  228. package/dist/testing/mocks/obsidian.js.map +0 -1
  229. package/dist/testing/mocks/utils.d.ts +0 -14
  230. package/dist/testing/mocks/utils.d.ts.map +0 -1
  231. package/dist/testing/mocks/utils.js +0 -85
  232. package/dist/testing/mocks/utils.js.map +0 -1
  233. package/dist/testing/setup.d.ts +0 -2
  234. package/dist/testing/setup.d.ts.map +0 -1
  235. package/dist/testing/setup.js +0 -18
  236. package/dist/testing/setup.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/testing/mocks/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB;;;;CAI9B,CAAC;AAGF,eAAO,MAAM,cAAc;;CAE1B,CAAC;AAGF,wBAAgB,+BAA+B,SA+C9C;AAGD,wBAAgB,aAAa,SAO5B;AAGD,wBAAgB,uBAAuB,CACtC,QAAQ,EAAE,MAAM,OAAO,kBAAkB,GAAG,MAAM,OAAO,cAAc,EACvE,cAAc,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,QAOvC;AAGD,wBAAgB,oBAAoB,CACnC,QAAQ,EAAE,MAAM,OAAO,kBAAkB,GAAG,MAAM,OAAO,cAAc,EACvE,KAAK,EAAE,GAAG,QAOV;AAGD,wBAAgB,eAAe,CAC9B,QAAQ,EAAE,MAAM,OAAO,kBAAkB,GAAG,MAAM,OAAO,cAAc,EACvE,aAAa,EAAE,GAAG,EAAE,EAAE,QAWtB"}
@@ -1,85 +0,0 @@
1
- import { expect, vi } from "vitest";
2
- // File operations mocks
3
- export const mockFileOperations = {
4
- arraysEqual: vi.fn(),
5
- normalizeArray: vi.fn(),
6
- createFileLink: vi.fn(),
7
- };
8
- // Link parser mocks
9
- export const mockLinkParser = {
10
- extractFilePathFromLink: vi.fn(),
11
- };
12
- // Default mock implementations that match the actual behavior
13
- export function setupDefaultMockImplementations() {
14
- // Set up file operations mocks
15
- mockFileOperations.normalizeArray.mockImplementation((arr) => Array.isArray(arr) ? arr : arr ? [arr] : []);
16
- mockFileOperations.arraysEqual.mockImplementation((a, b) => JSON.stringify(a) === JSON.stringify(b));
17
- mockFileOperations.createFileLink.mockImplementation((file) => {
18
- var _a, _b, _c;
19
- if (!file)
20
- return "[[Unknown File]]";
21
- const basename = file.basename ||
22
- ((_b = (_a = file.path) === null || _a === void 0 ? void 0 : _a.split("/").pop()) === null || _b === void 0 ? void 0 : _b.replace(/\.[^/.]+$/, "")) ||
23
- "";
24
- const parentPath = (_c = file.parent) === null || _c === void 0 ? void 0 : _c.path;
25
- if (!parentPath || parentPath === "/" || parentPath === "") {
26
- return `[[${basename}]]`;
27
- }
28
- return `[[${parentPath}/${basename}|${basename}]]`;
29
- });
30
- // Set up link parser mocks
31
- mockLinkParser.extractFilePathFromLink.mockImplementation((link) => {
32
- if (!link || typeof link !== "string")
33
- return null;
34
- // Handle text that contains a link
35
- const linkMatch = link.match(/\[\[([^\]]+)\]\]/);
36
- if (linkMatch) {
37
- const content = linkMatch[1];
38
- // Remove display name if present
39
- const filePart = content.split("|")[0].trim();
40
- if (!filePart)
41
- return null;
42
- // Add .md extension if not present
43
- return filePart.endsWith(".md") ? filePart : `${filePart}.md`;
44
- }
45
- return null;
46
- });
47
- }
48
- // Reset all mocks
49
- export function resetAllMocks() {
50
- Object.values(mockFileOperations).forEach((mock) => {
51
- mock.mockReset();
52
- });
53
- Object.values(mockLinkParser).forEach((mock) => {
54
- mock.mockReset();
55
- });
56
- }
57
- // Helper to setup mocks with specific implementations
58
- export function setupMockImplementation(mockName, implementation) {
59
- if (mockName in mockFileOperations) {
60
- mockFileOperations[mockName].mockImplementation(implementation);
61
- }
62
- else if (mockName in mockLinkParser) {
63
- mockLinkParser[mockName].mockImplementation(implementation);
64
- }
65
- }
66
- // Helper to setup mock return values
67
- export function setupMockReturnValue(mockName, value) {
68
- if (mockName in mockFileOperations) {
69
- mockFileOperations[mockName].mockReturnValue(value);
70
- }
71
- else if (mockName in mockLinkParser) {
72
- mockLinkParser[mockName].mockReturnValue(value);
73
- }
74
- }
75
- // Helper to verify mock calls
76
- export function verifyMockCalls(mockName, expectedCalls) {
77
- const mock = mockName in mockFileOperations
78
- ? mockFileOperations[mockName]
79
- : mockLinkParser[mockName];
80
- expect(mock).toHaveBeenCalledTimes(expectedCalls.length);
81
- expectedCalls.forEach((args, index) => {
82
- expect(mock).toHaveBeenNthCalledWith(index + 1, ...args);
83
- });
84
- }
85
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/testing/mocks/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,EAA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\tnormalizeArray: vi.fn(),\n\tcreateFileLink: vi.fn(),\n};\n\n// Link parser mocks\nexport const mockLinkParser = {\n\textractFilePathFromLink: vi.fn(),\n};\n\n// Default mock implementations that match the actual behavior\nexport function setupDefaultMockImplementations() {\n\t// Set up file operations mocks\n\tmockFileOperations.normalizeArray.mockImplementation((arr) =>\n\t\tArray.isArray(arr) ? arr : arr ? [arr] : []\n\t);\n\n\tmockFileOperations.arraysEqual.mockImplementation(\n\t\t(a, b) => JSON.stringify(a) === JSON.stringify(b)\n\t);\n\n\tmockFileOperations.createFileLink.mockImplementation((file) => {\n\t\tif (!file) return \"[[Unknown File]]\";\n\n\t\tconst basename =\n\t\t\tfile.basename ||\n\t\t\tfile.path\n\t\t\t\t?.split(\"/\")\n\t\t\t\t.pop()\n\t\t\t\t?.replace(/\\.[^/.]+$/, \"\") ||\n\t\t\t\"\";\n\t\tconst parentPath = file.parent?.path;\n\n\t\tif (!parentPath || parentPath === \"/\" || parentPath === \"\") {\n\t\t\treturn `[[${basename}]]`;\n\t\t}\n\n\t\treturn `[[${parentPath}/${basename}|${basename}]]`;\n\t});\n\n\t// Set up link parser mocks\n\tmockLinkParser.extractFilePathFromLink.mockImplementation((link) => {\n\t\tif (!link || typeof link !== \"string\") return null;\n\n\t\t// Handle text that contains a link\n\t\tconst linkMatch = link.match(/\\[\\[([^\\]]+)\\]\\]/);\n\t\tif (linkMatch) {\n\t\t\tconst content = linkMatch[1];\n\t\t\t// Remove display name if present\n\t\t\tconst filePart = content.split(\"|\")[0].trim();\n\t\t\tif (!filePart) return null;\n\n\t\t\t// Add .md extension if not present\n\t\t\treturn filePart.endsWith(\".md\") ? filePart : `${filePart}.md`;\n\t\t}\n\n\t\treturn null;\n\t});\n}\n\n// Reset all mocks\nexport function resetAllMocks() {\n\tObject.values(mockFileOperations).forEach((mock) => {\n\t\tmock.mockReset();\n\t});\n\tObject.values(mockLinkParser).forEach((mock) => {\n\t\tmock.mockReset();\n\t});\n}\n\n// Helper to setup mocks with specific implementations\nexport function setupMockImplementation(\n\tmockName: keyof typeof mockFileOperations | keyof typeof mockLinkParser,\n\timplementation: (...args: any[]) => any\n) {\n\tif (mockName in mockFileOperations) {\n\t\t(mockFileOperations as any)[mockName].mockImplementation(implementation);\n\t} else if (mockName in mockLinkParser) {\n\t\t(mockLinkParser as any)[mockName].mockImplementation(implementation);\n\t}\n}\n\n// Helper to setup mock return values\nexport function setupMockReturnValue(\n\tmockName: keyof typeof mockFileOperations | keyof typeof mockLinkParser,\n\tvalue: any\n) {\n\tif (mockName in mockFileOperations) {\n\t\t(mockFileOperations as any)[mockName].mockReturnValue(value);\n\t} else if (mockName in mockLinkParser) {\n\t\t(mockLinkParser as any)[mockName].mockReturnValue(value);\n\t}\n}\n\n// Helper to verify mock calls\nexport function verifyMockCalls(\n\tmockName: keyof typeof mockFileOperations | keyof typeof mockLinkParser,\n\texpectedCalls: any[][]\n) {\n\tconst mock =\n\t\tmockName in mockFileOperations\n\t\t\t? (mockFileOperations as any)[mockName]\n\t\t\t: (mockLinkParser as any)[mockName];\n\n\texpect(mock).toHaveBeenCalledTimes(expectedCalls.length);\n\texpectedCalls.forEach((args, index) => {\n\t\texpect(mock).toHaveBeenNthCalledWith(index + 1, ...args);\n\t});\n}\n"]}
@@ -1,2 +0,0 @@
1
- export declare function setupTestEnvironment(): () => void;
2
- //# sourceMappingURL=setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/testing/setup.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,eAcnC"}
@@ -1,18 +0,0 @@
1
- import { vi } from "vitest";
2
- import { mockFileOperations, mockLinkParser } from "./mocks/utils";
3
- // Global test setup that can be imported once per test file
4
- export function setupTestEnvironment() {
5
- // Mock the utils modules
6
- vi.mock("@obsidian-plugins/utils/file-operations", () => mockFileOperations);
7
- vi.mock("@obsidian-plugins/utils/link-parser", () => mockLinkParser);
8
- // Mock any plugin-specific components
9
- vi.mock("../src/components/settings-tab", () => ({
10
- TreePropertiesManagerSettingTab: class MockSettingTab {
11
- },
12
- }));
13
- // Return cleanup function
14
- return () => {
15
- vi.clearAllMocks();
16
- };
17
- }
18
- //# sourceMappingURL=setup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/testing/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnE,4DAA4D;AAC5D,MAAM,UAAU,oBAAoB;IACnC,yBAAyB;IACzB,EAAE,CAAC,IAAI,CAAC,yCAAyC,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,CAAC;IAC7E,EAAE,CAAC,IAAI,CAAC,qCAAqC,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC;IAErE,sCAAsC;IACtC,EAAE,CAAC,IAAI,CAAC,gCAAgC,EAAE,GAAG,EAAE,CAAC,CAAC;QAChD,+BAA+B,EAAE,MAAM,cAAc;SAAG;KACxD,CAAC,CAAC,CAAC;IAEJ,0BAA0B;IAC1B,OAAO,GAAG,EAAE;QACX,EAAE,CAAC,aAAa,EAAE,CAAC;IACpB,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { vi } from \"vitest\";\nimport { mockFileOperations, mockLinkParser } from \"./mocks/utils\";\n\n// Global test setup that can be imported once per test file\nexport function setupTestEnvironment() {\n\t// Mock the utils modules\n\tvi.mock(\"@obsidian-plugins/utils/file-operations\", () => mockFileOperations);\n\tvi.mock(\"@obsidian-plugins/utils/link-parser\", () => mockLinkParser);\n\n\t// Mock any plugin-specific components\n\tvi.mock(\"../src/components/settings-tab\", () => ({\n\t\tTreePropertiesManagerSettingTab: class MockSettingTab {},\n\t}));\n\n\t// Return cleanup function\n\treturn () => {\n\t\tvi.clearAllMocks();\n\t};\n}\n"]}