1
- import { is , u } from "../../denops/@deps/unknownutil.ts" ;
1
+ import { as , assert , is , Predicate } from "../../denops/@deps/unknownutil.ts" ;
2
2
import { TextLineStream } from "/data/vim/deps/deno_std/streams/text_line_stream.ts" ;
3
3
4
4
export type Task = {
@@ -8,11 +8,11 @@ export type Task = {
8
8
rev ?: string ;
9
9
} ;
10
10
11
- export const isTask : u . Predicate < Task > = is . ObjectOf ( {
11
+ export const isTask : Predicate < Task > = is . ObjectOf ( {
12
12
repo : is . String ,
13
13
path : is . String ,
14
- label : is . OptionalOf ( is . String ) ,
15
- rev : is . OptionalOf ( is . String ) ,
14
+ label : as . Optional ( is . String ) ,
15
+ rev : as . Optional ( is . String ) ,
16
16
} ) ;
17
17
18
18
export type InitializeMessage = {
@@ -21,7 +21,7 @@ export type InitializeMessage = {
21
21
maxJobs : number ;
22
22
} ;
23
23
24
- export const isInitializeMessage : u . Predicate < InitializeMessage > = is . ObjectOf ( {
24
+ export const isInitializeMessage : Predicate < InitializeMessage > = is . ObjectOf ( {
25
25
type : is . LiteralOf ( "initialize" ) ,
26
26
jobs : is . Number ,
27
27
maxJobs : is . Number ,
@@ -31,7 +31,7 @@ export type DoneMessage = {
31
31
type : "done" ;
32
32
} ;
33
33
34
- export const isDoneMessage : u . Predicate < DoneMessage > = is . ObjectOf ( {
34
+ export const isDoneMessage : Predicate < DoneMessage > = is . ObjectOf ( {
35
35
type : is . LiteralOf ( "done" ) ,
36
36
} ) ;
37
37
@@ -42,7 +42,7 @@ export type StartMessage = {
42
42
hash : string ;
43
43
} ;
44
44
45
- export const isStartMessage : u . Predicate < StartMessage > = is . ObjectOf ( {
45
+ export const isStartMessage : Predicate < StartMessage > = is . ObjectOf ( {
46
46
type : is . LiteralOf ( "start" ) ,
47
47
jobnr : is . Number ,
48
48
label : is . String ,
@@ -56,7 +56,7 @@ export type EndMessage = {
56
56
success : boolean ;
57
57
} ;
58
58
59
- export const isEndMessage : u . Predicate < EndMessage > = is . ObjectOf ( {
59
+ export const isEndMessage : Predicate < EndMessage > = is . ObjectOf ( {
60
60
type : is . LiteralOf ( "end" ) ,
61
61
jobnr : is . Number ,
62
62
hash : is . String ,
@@ -69,8 +69,8 @@ export type TextMessage = {
69
69
text : string ;
70
70
} ;
71
71
72
- export const isTextMessage : u . Predicate < TextMessage > = is . ObjectOf ( {
73
- type : is . OneOf ( [
72
+ export const isTextMessage : Predicate < TextMessage > = is . ObjectOf ( {
73
+ type : is . UnionOf ( [
74
74
is . LiteralOf ( "stdout" ) ,
75
75
is . LiteralOf ( "stderr" ) ,
76
76
] ) ,
@@ -190,7 +190,7 @@ export function newTaskRunner(tasks: Task[], script: string, maxJobs = 8) {
190
190
191
191
if ( import . meta. main ) {
192
192
const tasks : unknown = await ( new Response ( Deno . stdin . readable ) . json ( ) ) ;
193
- u . assert ( tasks , is . ArrayOf ( isTask ) ) ;
193
+ assert ( tasks , is . ArrayOf ( isTask ) ) ;
194
194
const taskRunner = newTaskRunner ( tasks , Deno . args [ 0 ] ) ;
195
195
for await ( const output of taskRunner ) {
196
196
console . log ( output ) ;
0 commit comments