yumemi/gen/static_source
面へ写す back 側の静的資料。面 package の Gleam 走査とは別の口で読む。
Types
pub type ApiV1 {
ApiV1(text: String, hash: String)
}
Constructors
-
ApiV1(text: String, hash: String)
pub type Error {
Missing(path: String)
Unreadable(path: String, detail: String)
}
Constructors
-
Missing(path: String) -
Unreadable(path: String, detail: String)
pub type Host {
Host(
connector: String,
host: String,
name: String,
information: String,
purpose: String,
side: String,
)
}
Constructors
-
Host( connector: String, host: String, name: String, information: String, purpose: String, side: String, )
load の 2 つの file を、あるものだけ読む(0.13.1、穴 2)。無い file は None で、その写し
(gen/external.gleam・gen/doc/api_v1.gleam)を面に出さない。あっても読めない・形の違う file は
今までどおり止める。両方ある app の生成物は load と同じ。
pub type Present {
Present(
app_name: String,
hosts: option.Option(Hosts),
api_v1: option.Option(ApiV1),
)
}
Constructors
-
Present( app_name: String, hosts: option.Option(Hosts), api_v1: option.Option(ApiV1), )
Values
pub fn external_hosts(
source_text: String,
) -> Result(List(Host), Nil)
JS ファイルから EXTERNAL_HOSTS の6欄だけを読む。shape が違えば Error。
pub fn load(app_dir: String) -> Result(Sources, Error)
<app>/src/external_hosts.mjs と <repo-root>/docs/api-v1.md を読む。
.mjs は専用の狭い字句読みで宣言形を検査し、Markdown は字として保持する。