Skip to content

Commit

Permalink
Remove ts_morph dep (#19)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Candeia <[email protected]>
  • Loading branch information
mcandeia authored Oct 20, 2023
1 parent 7f3b88e commit ce4523d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/build/kv.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toSnapshotJSON } from "../dev/build.ts";
import { toSnapshotJSON } from "../dev/snapshot.ts";
import { getFile, housekeep, isSupported, saveFile } from "./kvfs.ts";
import { BuildSnapshot, BuildSnapshotJson } from "./mod.ts";

Expand Down
21 changes: 21 additions & 0 deletions src/dev/snapshot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* This file was intentionally duplicated to remove the dev/deps.ts dependency to avoid including `ts_morph` dep.
* This is necessary because we do build the islands and save them on KV instead of in memory and those dependencies are used for ahead-of-time build.
*/
import { BuildSnapshot, BuildSnapshotJson } from "../build/mod.ts";
import { BUILD_ID } from "../server/build_id.ts";

export const toSnapshotJSON = async (snapshot: BuildSnapshot) => {
// Write dependency snapshot file to disk
const jsonSnapshot: BuildSnapshotJson = {
build_id: BUILD_ID,
files: {},
};

for (const filePath of await snapshot.paths) {
const dependencies = await snapshot.dependencies(filePath);
jsonSnapshot.files[filePath] = dependencies;
}

return jsonSnapshot;
};

0 comments on commit ce4523d

Please sign in to comment.