Split out serve function in @syndicate-lang/fs
This commit is contained in:
parent
8052ee00b5
commit
148868da83
|
@ -8,23 +8,26 @@ import fs from 'fs';
|
||||||
|
|
||||||
export function main(_argv: string[]) {
|
export function main(_argv: string[]) {
|
||||||
service(args => {
|
service(args => {
|
||||||
const config = asConfig(args);
|
serve(asConfig(args));
|
||||||
at config.dataspace {
|
});
|
||||||
during Observe({
|
}
|
||||||
"pattern": :pattern File({
|
|
||||||
"label": config.label,
|
export function serve(config: Config<Ref>) {
|
||||||
"path": \Q.lit($relativePath: string),
|
at config.dataspace {
|
||||||
"encoding": \Q.lit($encoding0),
|
during Observe({
|
||||||
"contents": \_,
|
"pattern": :pattern File({
|
||||||
}),
|
"label": config.label,
|
||||||
}) => {
|
"path": \Q.lit($relativePath: string),
|
||||||
const encoding = toEncoding(encoding0);
|
"encoding": \Q.lit($encoding0),
|
||||||
if (encoding !== void 0 && !path.isAbsolute(relativePath)) {
|
"contents": \_,
|
||||||
trackFile(config, relativePath, encoding);
|
}),
|
||||||
}
|
}) => {
|
||||||
|
const encoding = toEncoding(encoding0);
|
||||||
|
if (encoding !== void 0 && !path.isAbsolute(relativePath)) {
|
||||||
|
trackFile(config, relativePath, encoding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function trackFile(config: Config<Ref>, relativePath: string, encoding: Encoding) {
|
function trackFile(config: Config<Ref>, relativePath: string, encoding: Encoding) {
|
||||||
|
|
Loading…
Reference in New Issue