Skip to content

Commit

Permalink
restore somthing
Browse files Browse the repository at this point in the history
  • Loading branch information
dmail committed Nov 24, 2024
1 parent 0f2f928 commit a4c2b2b
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@

import {
comparePathnames,
readEntryStatSync,
removeDirectorySync,
removeFileSync,
writeFileSync,
} from "@jsenv/filesystem";
import { URL_META } from "@jsenv/url-meta";
import { ensurePathnameTrailingSlash, yieldAncestorUrls } from "@jsenv/urls";
import { readdirSync, readFileSync } from "node:fs";
import {
ensurePathnameTrailingSlash,
urlToFileSystemPath,
yieldAncestorUrls,
} from "@jsenv/urls";
import { readdirSync, readFileSync, statSync } from "node:fs";
import { pathToFileURL } from "node:url";
import {
disableHooksWhileCalling,
Expand Down Expand Up @@ -178,7 +181,9 @@ export const spyFilesystemCalls = (
if (!stateBefore.found && recursive) {
const ancestorNotFoundArray = [];
for (const ancestorUrl of yieldAncestorUrls(directoryUrl)) {
const ancestorState = getDirectoryState(new URL(ancestorUrl));
const ancestorState = getDirectoryState(
urlToFileSystemPath(new URL(ancestorUrl)),
);
if (ancestorState.found) {
break;
}
Expand Down Expand Up @@ -349,7 +354,7 @@ const getFileState = (filePath) => {
const fileUrl = pathToFileURL(filePath);
try {
const fileBuffer = readFileSync(fileUrl);
const { mtimeMs } = readEntryStatSync(fileUrl);
const { mtimeMs } = statSync(filePath);
return {
url: String(fileUrl),
found: true,
Expand All @@ -369,7 +374,7 @@ const getFileState = (filePath) => {

const getDirectoryState = (directory) => {
try {
readEntryStatSync(directory);
statSync(directory);
return {
found: true,
};
Expand Down

0 comments on commit a4c2b2b

Please sign in to comment.