Skip to content

Commit af0977a

Browse files
committed
fix: fs
1 parent eb48066 commit af0977a

11 files changed

Lines changed: 321 additions & 379 deletions

File tree

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"@wdio/globals": "^9.29.1",
2222
"@wdio/local-runner": "^9.30.0",
2323
"@wdio/mocha-framework": "^9.30.0",
24-
"dotenv": "^17.4.2",
2524
"esbuild": "^0.25",
2625
"eslint": "^9",
2726
"eslint-plugin-obsidianmd": "^0.4",

src/git/backends/VaultFsAdapter.ts

Lines changed: 0 additions & 211 deletions
This file was deleted.

src/process/ProcessRunner.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Platform } from "obsidian";
2+
import { getModule } from "src/utils/external-fs";
23
import {
34
ALLOWED_BINARIES,
45
type ProcessConfig,
@@ -60,16 +61,6 @@ let errorTimestamps: number[] = [];
6061
const ERROR_WINDOW_MS = 60_000;
6162
const ERROR_THRESHOLD = 3;
6263

63-
function getModule<T>(name: string): T {
64-
const requireFn = (
65-
window as Window & { require?: (module: string) => unknown }
66-
).require;
67-
if (!requireFn) {
68-
throw new Error("Node modules unavailable");
69-
}
70-
return requireFn(name) as T;
71-
}
72-
7364
function getChildProcess(): ChildProcessModule {
7465
if (!childProcessCache) {
7566
childProcessCache = getModule<ChildProcessModule>("child_process");

src/publisher/Publisher.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { App, TFile } from "obsidian";
1+
import type { App } from "obsidian";
22
import type QuartzSyncer from "src/main";
33
import type { GitBackend, FileChange } from "src/git/types";
44
import { PathMapper } from "src/git/PathMapper";
@@ -31,10 +31,7 @@ export class Publisher {
3131

3232
async getPublishStatus(): Promise<PublishStatus> {
3333
const settings = this.plugin.settings;
34-
const vault = this.app.vault as typeof this.app.vault & {
35-
getFiles?: () => TFile[];
36-
};
37-
const vaultFiles = vault.getFiles?.() ?? vault.getMarkdownFiles();
34+
const vaultFiles = this.app.vault.getFiles();
3835
const publishFiles: PublishFile[] = [];
3936

4037
for (const file of vaultFiles) {

src/services/BackgroundEngine.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { debounce, TFile, type App, type EventRef } from "obsidian";
1+
import { debounce, Events, TFile, type App, type EventRef } from "obsidian";
22
import type QuartzSyncer from "src/main";
33
import { CompilationQueue } from "src/services/CompilationQueue";
44
import { SyncerPageCompiler } from "src/compiler/SyncerPageCompiler";
@@ -269,25 +269,19 @@ export class BackgroundEngine {
269269
);
270270
};
271271

272-
const metadataCacheExt = this.app
273-
.metadataCache as typeof this.app.metadataCache & {
274-
on(name: string, callback: (...args: unknown[]) => void): EventRef;
275-
};
272+
const cacheEvents = this.app.metadataCache as Events;
276273

277274
const initHandler = () => {
278275
this.metadataCacheEventRefs.push(
279-
metadataCacheExt.on(
280-
"dataview:metadata-change",
281-
onMetadataChange,
282-
),
276+
cacheEvents.on("dataview:metadata-change", onMetadataChange),
283277
);
284278
};
285279

286280
if (dvApi.index?.initialized) {
287281
initHandler();
288282
} else {
289283
this.metadataCacheEventRefs.push(
290-
metadataCacheExt.on("dataview:index-ready", initHandler),
284+
cacheEvents.on("dataview:index-ready", initHandler),
291285
);
292286
}
293287
}

0 commit comments

Comments
 (0)