Skip to content

Commit 66f88be

Browse files
committed
怒涛の依存書き換え
1 parent 1e0ad69 commit 66f88be

File tree

7 files changed

+35
-30
lines changed

7 files changed

+35
-30
lines changed

conf/plug/deno.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
repo = 'https://github.com/denoland/deno_std'
33

44
[[plugins]]
5-
repo = 'https://github.com/lambdalisue/deno-unknownutil'
5+
repo = 'https://github.com/jsr-core/unknownutil'
66

77
[[plugins]]
88
repo = 'https://github.com/uga-rosa/deno-denops-lsputil'

denops/@deps/unknownutil.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export * as u from "/data/vim/repos/github.com/lambdalisue/deno-unknownutil/mod.ts";
2-
export { is } from "/data/vim/repos/github.com/lambdalisue/deno-unknownutil/mod.ts";
2+
export * from "/data/vim/repos/github.com/jsr-core/unknownutil/mod.ts";

script/build/build.ts

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { Denops, lambda } from "../../denops/@deps/denops_std.ts";
2-
import { is, u } from "../../denops/@deps/unknownutil.ts";
2+
import {
3+
as,
4+
ensure,
5+
is,
6+
PredicateType,
7+
} from "../../denops/@deps/unknownutil.ts";
38
import { generateDenopsCall } from "../../denops/@vimrc/lib/denops.ts";
49
import { encodeBase64 } from "/data/vim/deps/deno_std/encoding/base64.ts";
510
import * as stdpath from "/data/vim/deps/deno_std/path/mod.ts";
@@ -12,15 +17,15 @@ const vimdir = String(Deno.env.get("VIMDIR"));
1217

1318
const isDefinitions = is.RecordOf(is.ObjectOf({
1419
script: is.String,
15-
deps: is.OptionalOf(is.ArrayOf(is.String)),
20+
deps: as.Optional(is.ArrayOf(is.String)),
1621
}));
1722

18-
type Definitions = u.PredicateType<typeof isDefinitions>;
23+
type Definitions = PredicateType<typeof isDefinitions>;
1924

2025
async function load(
2126
path: string,
2227
): Promise<Definitions> {
23-
return u.ensure(
28+
return ensure(
2429
TOML.parse(await Deno.readTextFile(path)),
2530
isDefinitions,
2631
);
@@ -31,13 +36,13 @@ const isPlugin = is.ObjectOf({
3136
path: is.String,
3237
});
3338

34-
type Plugin = u.PredicateType<typeof isPlugin>;
39+
type Plugin = PredicateType<typeof isPlugin>;
3540
type Plugins = Record<string, Plugin>;
3641

3742
const isStringArray = is.ArrayOf(is.String);
3843

3944
async function glob(denops: Denops, path: string): Promise<string[]> {
40-
return u.ensure(
45+
return ensure(
4146
await denops.call("glob", path, 1, 1),
4247
isStringArray,
4348
);
@@ -92,7 +97,7 @@ async function executermNvim(
9297
}
9398

9499
await denops.cmd("autocmd TermOpen * normal! G");
95-
const code = u.ensure(
100+
const code = ensure(
96101
await new Promise((resolve) => {
97102
const id = lambda.register(denops, resolve, { once: true });
98103
const notify = generateDenopsCall(denops, id, "[code]", {
@@ -149,7 +154,7 @@ async function executermVim(
149154
continue;
150155
}
151156

152-
const code = u.ensure(
157+
const code = ensure(
153158
await new Promise(async (resolve) => {
154159
const id = lambda.register(denops, resolve, { once: true });
155160
const notify = generateDenopsCall(denops, id, "[code]", {
@@ -186,7 +191,7 @@ async function executermVim(
186191
export function main(denops: Denops) {
187192
denops.dispatcher = {
188193
async build() {
189-
const plugins = u.ensure(
194+
const plugins = ensure(
190195
await denops.eval("g:dpp#_plugins"),
191196
is.RecordOf(isPlugin),
192197
);

script/gitupdate/denops_view.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { autocmd, Denops } from "../../denops/@deps/denops_std.ts";
2-
import { is, u } from "../../denops/@deps/unknownutil.ts";
2+
import { assert, is } from "../../denops/@deps/unknownutil.ts";
33
import {
44
isDoneMessage,
55
isEndMessage,
@@ -132,7 +132,7 @@ class Buffer {
132132
}
133133

134134
export async function run(denops: Denops, args: unknown[]) {
135-
u.assert(
135+
assert(
136136
args,
137137
is.TupleOf(
138138
[

script/gitupdate/dpp_dump.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Denops } from "../../denops/@deps/denops_std.ts";
2-
import { is, u } from "../../denops/@deps/unknownutil.ts";
2+
import { as, ensure, is } from "../../denops/@deps/unknownutil.ts";
33
import { Task } from "./run.ts";
44

55
// sort keys for JSON.stringify
@@ -20,7 +20,7 @@ function isRemoteRepo(repo: unknown): repo is string {
2020
}
2121

2222
export async function main(denops: Denops) {
23-
const recordPlugins = u.ensure(
23+
const recordPlugins = ensure(
2424
await denops.eval("g:dpp#_plugins"),
2525
is.Record,
2626
);
@@ -29,9 +29,9 @@ export async function main(denops: Denops) {
2929
name: is.String,
3030
path: is.String,
3131
repo: isRemoteRepo,
32-
rev: is.OptionalOf(is.String),
32+
rev: as.Optional(is.String),
3333
// trueとかにするとマッチしなくなるので弾ける
34-
gitupdate_ignore: is.OptionalOf(is.LiteralOf(false)),
34+
gitupdate_ignore: as.Optional(is.LiteralOf(false)),
3535
}))
3636
.map((plugin) => ({
3737
repo: plugin.repo,

script/gitupdate/run.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { is, u } from "../../denops/@deps/unknownutil.ts";
1+
import { as, assert, is, Predicate } from "../../denops/@deps/unknownutil.ts";
22
import { TextLineStream } from "/data/vim/deps/deno_std/streams/text_line_stream.ts";
33

44
export type Task = {
@@ -8,11 +8,11 @@ export type Task = {
88
rev?: string;
99
};
1010

11-
export const isTask: u.Predicate<Task> = is.ObjectOf({
11+
export const isTask: Predicate<Task> = is.ObjectOf({
1212
repo: is.String,
1313
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),
1616
});
1717

1818
export type InitializeMessage = {
@@ -21,7 +21,7 @@ export type InitializeMessage = {
2121
maxJobs: number;
2222
};
2323

24-
export const isInitializeMessage: u.Predicate<InitializeMessage> = is.ObjectOf({
24+
export const isInitializeMessage: Predicate<InitializeMessage> = is.ObjectOf({
2525
type: is.LiteralOf("initialize"),
2626
jobs: is.Number,
2727
maxJobs: is.Number,
@@ -31,7 +31,7 @@ export type DoneMessage = {
3131
type: "done";
3232
};
3333

34-
export const isDoneMessage: u.Predicate<DoneMessage> = is.ObjectOf({
34+
export const isDoneMessage: Predicate<DoneMessage> = is.ObjectOf({
3535
type: is.LiteralOf("done"),
3636
});
3737

@@ -42,7 +42,7 @@ export type StartMessage = {
4242
hash: string;
4343
};
4444

45-
export const isStartMessage: u.Predicate<StartMessage> = is.ObjectOf({
45+
export const isStartMessage: Predicate<StartMessage> = is.ObjectOf({
4646
type: is.LiteralOf("start"),
4747
jobnr: is.Number,
4848
label: is.String,
@@ -56,7 +56,7 @@ export type EndMessage = {
5656
success: boolean;
5757
};
5858

59-
export const isEndMessage: u.Predicate<EndMessage> = is.ObjectOf({
59+
export const isEndMessage: Predicate<EndMessage> = is.ObjectOf({
6060
type: is.LiteralOf("end"),
6161
jobnr: is.Number,
6262
hash: is.String,
@@ -69,8 +69,8 @@ export type TextMessage = {
6969
text: string;
7070
};
7171

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([
7474
is.LiteralOf("stdout"),
7575
is.LiteralOf("stderr"),
7676
]),
@@ -190,7 +190,7 @@ export function newTaskRunner(tasks: Task[], script: string, maxJobs = 8) {
190190

191191
if (import.meta.main) {
192192
const tasks: unknown = await (new Response(Deno.stdin.readable).json());
193-
u.assert(tasks, is.ArrayOf(isTask));
193+
assert(tasks, is.ArrayOf(isTask));
194194
const taskRunner = newTaskRunner(tasks, Deno.args[0]);
195195
for await (const output of taskRunner) {
196196
console.log(output);

script/gitupdate/snap/dps_shot.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Denops } from "../../../denops/@deps/denops_std.ts";
2-
import { is, u } from "../../../denops/@deps/unknownutil.ts";
2+
import { assert, is } from "../../../denops/@deps/unknownutil.ts";
33
import { loadTasks } from "../util.ts";
44
import { getSnapshot } from "./libsnapshot.ts";
55

66
export async function run(args: unknown) {
7-
u.assert(
7+
assert(
88
args,
99
is.TupleOf(
1010
[

0 commit comments

Comments
 (0)