refactor(core): use getSnapshotPath() (#2873)
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import * as path from "@std/path";
|
import * as path from "@std/path";
|
||||||
import type { ResolvedFreshConfig } from "./config.ts";
|
import { getSnapshotPath, type ResolvedFreshConfig } from "./config.ts";
|
||||||
import { DENO_DEPLOYMENT_ID, setBuildId } from "./runtime/build_id.ts";
|
import { DENO_DEPLOYMENT_ID, setBuildId } from "./runtime/build_id.ts";
|
||||||
import * as colors from "@std/fmt/colors";
|
import * as colors from "@std/fmt/colors";
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ export interface BuildCache {
|
|||||||
|
|
||||||
export class ProdBuildCache implements BuildCache {
|
export class ProdBuildCache implements BuildCache {
|
||||||
static async fromSnapshot(config: ResolvedFreshConfig, islandCount: number) {
|
static async fromSnapshot(config: ResolvedFreshConfig, islandCount: number) {
|
||||||
const snapshotPath = path.join(config.build.outDir, "snapshot.json");
|
const snapshotPath = getSnapshotPath(config);
|
||||||
|
|
||||||
const staticFiles = new Map<string, FileSnapshot>();
|
const staticFiles = new Map<string, FileSnapshot>();
|
||||||
const islandToChunk = new Map<string, string>();
|
const islandToChunk = new Map<string, string>();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { BuildCache, StaticFile } from "../build_cache.ts";
|
import type { BuildCache, StaticFile } from "../build_cache.ts";
|
||||||
import * as path from "@std/path";
|
import * as path from "@std/path";
|
||||||
import { SEPARATOR as WINDOWS_SEPARATOR } from "@std/path/windows/constants";
|
import { SEPARATOR as WINDOWS_SEPARATOR } from "@std/path/windows/constants";
|
||||||
import type { ResolvedFreshConfig } from "../config.ts";
|
import { getSnapshotPath, type ResolvedFreshConfig } from "../config.ts";
|
||||||
import type { BuildSnapshot } from "../build_cache.ts";
|
import type { BuildSnapshot } from "../build_cache.ts";
|
||||||
import { encodeHex } from "@std/encoding/hex";
|
import { encodeHex } from "@std/encoding/hex";
|
||||||
import { crypto } from "@std/crypto";
|
import { crypto } from "@std/crypto";
|
||||||
@@ -284,7 +284,7 @@ export class DiskBuildCache implements DevBuildCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await Deno.writeTextFile(
|
await Deno.writeTextFile(
|
||||||
path.join(this.config.build.outDir, "snapshot.json"),
|
getSnapshotPath(this.config),
|
||||||
JSON.stringify(snapshot, null, 2),
|
JSON.stringify(snapshot, null, 2),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user