fix: ensure file paths in snapshot.json uses / (#2704)
Avoids `\\\\` paths ending up in `snapshot.json` when using `deno task build` on Windows. Backslashes do not which pathnames in URLs, so these assets are not returned. Closes #2703
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { BuildCache, StaticFile } from "../build_cache.ts";
|
||||
import * as path from "@std/path";
|
||||
import { SEPARATOR as WINDOWS_SEPARATOR } from "@std/path/windows/constants";
|
||||
import type { ResolvedFreshConfig } from "../config.ts";
|
||||
import type { BuildSnapshot } from "../build_cache.ts";
|
||||
import { encodeHex } from "@std/encoding/hex";
|
||||
@@ -174,7 +175,7 @@ export class DiskBuildCache implements DevBuildCache {
|
||||
|
||||
addUnprocessedFile(pathname: string): void {
|
||||
this.#unprocessedFiles.set(
|
||||
pathname,
|
||||
pathname.replaceAll(WINDOWS_SEPARATOR, "/"),
|
||||
path.join(this.config.staticDir, pathname),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user