forked from denoland/fresh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Marcos Candeia <[email protected]>
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; |