-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
ssg.ts
27 lines (25 loc) · 846 Bytes
/
ssg.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { toSSG as baseToSSG } from '../../helper/ssg/index.ts'
import type { FileSystemModule, ToSSGAdaptorInterface } from '../../helper/ssg/index.ts'
/**
* @experimental
* `denoFileSystemModule` is an experimental feature.
* The API might be changed.
*/
export const denoFileSystemModule: FileSystemModule = {
writeFile: async (path, data) => {
const uint8Data =
typeof data === 'string' ? new TextEncoder().encode(data) : new Uint8Array(data)
await Deno.writeFile(path, uint8Data)
},
mkdir: async (path, options) => {
return Deno.mkdir(path, { recursive: options?.recursive ?? false })
},
}
/**
* @experimental
* `toSSG` is an experimental feature.
* The API might be changed.
*/
export const toSSG: ToSSGAdaptorInterface = async (app, options) => {
return baseToSSG(app, denoFileSystemModule, options)
}