Skip to content

Commit f86e0e0

Browse files
authored
Merge pull request #122 from vim-denops/update-deps
Update deps
2 parents aaeac55 + be10725 commit f86e0e0

File tree

13 files changed

+92
-57
lines changed

13 files changed

+92
-57
lines changed

.github/workflows/udd.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ jobs:
1515
deno-version: "1.x"
1616
- name: Update dependencies
1717
run: |
18-
make tools
19-
make update > ../output.txt
18+
make deps > ../output.txt
2019
env:
2120
NO_COLOR: 1
2221
- name: Read ../output.txt

Makefile

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
TOOLS := ${CURDIR}/.tools
1+
TARGETS := $$(find . \( -name '*.ts' -or -name '*.md' \) -not -path './.deno/*')
22

33
.DEFAULT_GOAL := help
44

@@ -7,32 +7,28 @@ help:
77
perl -ne 'print if /^\w+.*##/;' | \
88
perl -pe 's/(.*):.*##\s*/sprintf("%-20s",$$1)/eg;'
99

10-
tools: FORCE ## Install development tools
11-
@mkdir -p ${TOOLS}
12-
@deno install -A -f -n udd --root ${TOOLS} https://deno.land/x/udd@0.7.2/main.ts
13-
1410
fmt: FORCE ## Format code
15-
@deno fmt --ignore=.deno
11+
@deno fmt --config deno.jsonc
1612

1713
fmt-check: FORCE ## Format check
18-
@deno fmt --check --ignore=.deno
14+
@deno fmt --check --config deno.jsonc
1915

2016
lint: FORCE ## Lint code
21-
@deno lint --ignore=.deno
17+
@deno lint --config deno.jsonc
2218

2319
type-check: FORCE ## Type check
24-
@deno test --unstable --no-run $$(find . -name '*.ts' -not -name '.deno')
20+
@deno test --unstable --no-run ${TARGETS}
2521

2622
test: FORCE ## Test
27-
@deno test --unstable -A
23+
@deno test --unstable -A --no-check --jobs
2824

2925
gen: FORCE ## Generate codes
3026
@deno run --unstable -A ./scripts/gen-function/gen-function.ts
3127
@deno run --unstable -A ./scripts/gen-option/gen-option.ts
3228
@make fmt
3329

34-
update: FORCE ## Update dependencies
35-
@${TOOLS}/bin/udd $$(find ./denops_std -name '*.ts' -not -name '.deno')
30+
deps: FORCE ## Update dependencies
31+
@deno run -A https://deno.land/x/udd@0.7.2/main.ts ${TARGETS}
3632
@make fmt
3733

3834
FORCE:

deno.jsonc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"lint": {
3+
"files": {
4+
"exclude": [".deno"]
5+
}
6+
},
7+
"fmt": {
8+
"files": {
9+
"exclude": [".deno"]
10+
}
11+
}
12+
}

denops_std/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ import * as fn from "https://deno.land/x/denops_std/function/mod.ts";
1717
import * as vars from "https://deno.land/x/denops_std/variable/mod.ts";
1818
import * as helper from "https://deno.land/x/denops_std/helper/mod.ts";
1919

20-
import { ensureString } from "https://deno.land/x/unknownutil/mod.ts";
20+
import { assertString } from "https://deno.land/x/unknownutil/mod.ts";
2121

2222
export async function main(denops: Denops): Promise<void> {
2323
denops.dispatcher = {
2424
async say(where: unknown): Promise<void> {
2525
// Ensure that `where` is `string` here
26-
ensureString(where);
26+
assertString(where);
2727
const name = await fn.input(denops, "Your name: ");
2828
const progname = await vars.v.get(denops, "progname");
2929
const messages = [

denops_std/deps.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
export * as fs from "https://deno.land/std@0.126.0/fs/mod.ts";
2-
export * as hash from "https://deno.land/std@0.126.0/hash/mod.ts";
3-
export * as path from "https://deno.land/std@0.126.0/path/mod.ts";
4-
export { deferred } from "https://deno.land/std@0.126.0/async/mod.ts";
1+
export * as fs from "https://deno.land/std@0.127.0/fs/mod.ts";
2+
export * as hash from "https://deno.land/std@0.127.0/hash/mod.ts";
3+
export * as path from "https://deno.land/std@0.127.0/path/mod.ts";
4+
export { deferred } from "https://deno.land/std@0.127.0/async/mod.ts";
55

66
export * from "https://deno.land/x/denops_core@v3.0.0/mod.ts#^";
77

8-
export * from "https://deno.land/x/unknownutil@v1.1.4/mod.ts#^";
8+
export * from "https://deno.land/x/unknownutil@v2.0.0/mod.ts#^";

denops_std/deps_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export * from "https://deno.land/std@0.126.0/testing/asserts.ts";
1+
export * from "https://deno.land/std@0.127.0/testing/asserts.ts";
22

33
export * from "https://deno.land/x/denops_core@v3.0.0/test/mod.ts#^";

denops_std/function/cursor_test.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as cursor from "./cursor.ts";
22
import { assertEquals } from "../deps_test.ts";
3-
import { ensureNumber } from "../deps.ts";
4-
import { ensurePosition, ensureScreenPos, isScreenPos } from "./types.ts";
3+
import { assertNumber } from "../deps.ts";
4+
import { assertPosition, assertScreenPos, isScreenPos } from "./types.ts";
55
import { test } from "../deps_test.ts";
66

77
test({
@@ -11,7 +11,7 @@ test({
1111
await denops.call("setline", 1, "abcdef");
1212
await denops.cmd("norm gg4|mx6|mY2|");
1313

14-
ensureNumber(await cursor.col(denops, "."));
14+
assertNumber(await cursor.col(denops, "."));
1515
assertEquals(await cursor.col(denops, "."), 2);
1616
assertEquals(await cursor.col(denops, [1, 2]), 2);
1717
assertEquals(await cursor.col(denops, [1, "$"]), 7);
@@ -24,7 +24,7 @@ test({
2424
fn: async (denops) => {
2525
await denops.call("setline", 1, "\tab");
2626

27-
ensureNumber(await cursor.virtcol(denops, "."));
27+
assertNumber(await cursor.virtcol(denops, "."));
2828
assertEquals(await cursor.virtcol(denops, "."), 8);
2929
assertEquals(await cursor.virtcol(denops, [1, 1]), 8);
3030
assertEquals(await cursor.virtcol(denops, [1, "$"]), 11);
@@ -39,7 +39,7 @@ test({
3939
name: "line()",
4040
fn: async (denops) => {
4141
await denops.call("setline", 1, ["a", "b", "c"]);
42-
ensureNumber(await cursor.line(denops, "."));
42+
assertNumber(await cursor.line(denops, "."));
4343
assertEquals(await cursor.line(denops, "."), 1);
4444
assertEquals(await cursor.line(denops, "$"), 3);
4545
},
@@ -49,34 +49,34 @@ test({
4949
mode: "all",
5050
name: "wincol()",
5151
fn: async (denops) => {
52-
ensureNumber(await cursor.wincol(denops));
52+
assertNumber(await cursor.wincol(denops));
5353
},
5454
});
5555

5656
test({
5757
mode: "all",
5858
name: "winline()",
5959
fn: async (denops) => {
60-
ensureNumber(await cursor.winline(denops));
60+
assertNumber(await cursor.winline(denops));
6161
},
6262
});
6363

6464
test({
6565
mode: "all",
6666
name: "cursor()",
6767
fn: async (denops) => {
68-
ensureNumber(await cursor.cursor(denops, 1, 2));
69-
ensureNumber(await cursor.cursor(denops, 1, 2, 3));
70-
ensureNumber(await cursor.cursor(denops, [1, 2, 3]));
71-
ensureNumber(await cursor.cursor(denops, [1, 2, 3, 4]));
68+
assertNumber(await cursor.cursor(denops, 1, 2));
69+
assertNumber(await cursor.cursor(denops, 1, 2, 3));
70+
assertNumber(await cursor.cursor(denops, [1, 2, 3]));
71+
assertNumber(await cursor.cursor(denops, [1, 2, 3, 4]));
7272
},
7373
});
7474

7575
test({
7676
mode: "all",
7777
name: "screenpos()",
7878
fn: async (denops) => {
79-
ensureScreenPos(await cursor.screenpos(denops, "%", 1, 1));
79+
assertScreenPos(await cursor.screenpos(denops, "%", 1, 1));
8080
// screenpos() returns `{}` if failed
8181
assertEquals(
8282
isScreenPos(await cursor.screenpos(denops, 9999, 1, 1)),
@@ -89,26 +89,26 @@ test({
8989
mode: "all",
9090
name: "getcurpos",
9191
fn: async (denops) => {
92-
ensurePosition(await cursor.getcurpos(denops));
92+
assertPosition(await cursor.getcurpos(denops));
9393
},
9494
});
9595

9696
test({
9797
mode: "all",
9898
name: "getpos",
9999
fn: async (denops) => {
100-
ensurePosition(await cursor.getpos(denops, "'a"));
100+
assertPosition(await cursor.getpos(denops, "'a"));
101101
},
102102
});
103103

104104
test({
105105
mode: "all",
106106
name: "setpos",
107107
fn: async (denops) => {
108-
ensureNumber(
108+
assertNumber(
109109
await cursor.setpos(denops, "'b", await cursor.getpos(denops, "'a")),
110110
);
111-
ensureNumber(
111+
assertNumber(
112112
await cursor.setpos(denops, "'b", await cursor.getcurpos(denops)),
113113
);
114114
},
@@ -118,23 +118,23 @@ test({
118118
mode: "all",
119119
name: "byte2line",
120120
fn: async (denops) => {
121-
ensureNumber(await cursor.byte2line(denops, 1));
121+
assertNumber(await cursor.byte2line(denops, 1));
122122
},
123123
});
124124

125125
test({
126126
mode: "all",
127127
name: "line2byte",
128128
fn: async (denops) => {
129-
ensureNumber(await cursor.line2byte(denops, 1));
129+
assertNumber(await cursor.line2byte(denops, 1));
130130
},
131131
});
132132

133133
test({
134134
mode: "all",
135135
name: "diff_filler()",
136136
fn: async (denops) => {
137-
ensureNumber(await cursor.diff_filler(denops, 1));
138-
ensureNumber(await cursor.diff_filler(denops, "."));
137+
assertNumber(await cursor.diff_filler(denops, 1));
138+
assertNumber(await cursor.diff_filler(denops, "."));
139139
},
140140
});

denops_std/function/types.ts

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ensure, isLike } from "../deps.ts";
1+
import { AssertError, isLike } from "../deps.ts";
22

33
/**
44
* Type of `screenpos()` result.
@@ -28,10 +28,24 @@ export function isScreenPos(x: unknown): x is ScreenPos {
2828
}
2929

3030
/**
31-
* Ensure if `x` is ScreenPos by raising an `EnsureError` when it's not.
31+
* Assert if `x` is ScreenPos by raising an `AssertError` when it's not.
32+
*/
33+
export function assertScreenPos(x: unknown): asserts x is ScreenPos {
34+
if (!isScreenPos(x)) {
35+
throw new AssertError("The value must be ScreenPos");
36+
}
37+
}
38+
39+
/**
40+
* Ensure if `x` is ScreenPos by raising an `AssertError` when it's not.
41+
*
42+
* @deprecated
3243
*/
3344
export function ensureScreenPos(x: unknown): asserts x is ScreenPos {
34-
return ensure(x, isScreenPos, "The value must be ScreenPos");
45+
console.warn(
46+
"The 'ensureScreenPos' is deprecated. Use 'assertScreenPos' instead.",
47+
);
48+
assertScreenPos(x);
3549
}
3650

3751
/**
@@ -54,10 +68,24 @@ export function isPosition(x: unknown): x is Position {
5468
}
5569

5670
/**
57-
* Ensure if `x` is Position by raising an `EnsureError` when it's not.
71+
* Assert if `x` is Position by raising an `AssertError` when it's not.
72+
*/
73+
export function assertPosition(x: unknown): asserts x is Position {
74+
if (!isPosition(x)) {
75+
throw new AssertError("The value must be Position");
76+
}
77+
}
78+
79+
/**
80+
* Ensure if `x` is Position by raising an `AssertError` when it's not.
81+
*
82+
* @deprecated
5883
*/
5984
export function ensurePosition(x: unknown): asserts x is Position {
60-
return ensure(x, isPosition, "The value must be Position");
85+
console.warn(
86+
"The 'ensurePosition' is deprecated. Use 'assertPosition' instead.",
87+
);
88+
assertPosition(x);
6189
}
6290

6391
const validBuiltinCompletions = [

denops_std/helper/input.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Denops, ensureNumber, ensureString } from "../deps.ts";
1+
import { assertNumber, assertString, Denops } from "../deps.ts";
22
import * as fn from "../function/mod.ts";
33
import * as anonymous from "../anonymous/mod.ts";
44
import * as helper from "../helper/mod.ts";
@@ -38,9 +38,9 @@ export async function input(
3838
const completion = options.completion ?? null;
3939
if (completion && typeof completion !== "string") {
4040
const [id] = anonymous.add(denops, async (arglead, cmdline, cursorpos) => {
41-
ensureString(arglead);
42-
ensureString(cmdline);
43-
ensureNumber(cursorpos);
41+
assertString(arglead);
42+
assertString(cmdline);
43+
assertNumber(cursorpos);
4444
return await completion(arglead, cmdline, cursorpos);
4545
});
4646
try {

scripts/gen-function/gen-function.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {
22
difference,
33
intersection,
4-
} from "https://deno.land/x/set_operations@v1.0.0/mod.ts";
5-
import * as path from "https://deno.land/std@0.104.0/path/mod.ts";
4+
} from "https://deno.land/x/set_operations@v1.0.3/mod.ts";
5+
import * as path from "https://deno.land/std@0.127.0/path/mod.ts";
66
import * as commonManual from "../../denops_std/function/_manual.ts";
77
import * as vimManual from "../../denops_std/function/vim/_manual.ts";
88
import * as nvimManual from "../../denops_std/function/nvim/_manual.ts";

scripts/gen-function/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as io from "https://deno.land/std@0.104.0/io/mod.ts";
1+
import * as io from "https://deno.land/std@0.127.0/io/mod.ts";
22

33
export async function downloadString(url: string): Promise<string> {
44
const textDecoder = new TextDecoder();

scripts/gen-option/gen-option.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {
22
difference,
33
intersection,
4-
} from "https://deno.land/x/set_operations@v1.0.0/mod.ts";
5-
import * as path from "https://deno.land/std@0.104.0/path/mod.ts";
4+
} from "https://deno.land/x/set_operations@v1.0.3/mod.ts";
5+
import * as path from "https://deno.land/std@0.127.0/path/mod.ts";
66
import * as commonManual from "../../denops_std/option/_manual.ts";
77
import * as vimManual from "../../denops_std/option/vim/_manual.ts";
88
import * as nvimManual from "../../denops_std/option/nvim/_manual.ts";

scripts/gen-option/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as io from "https://deno.land/std@0.104.0/io/mod.ts";
1+
import * as io from "https://deno.land/std@0.127.0/io/mod.ts";
22

33
export async function downloadString(url: string): Promise<string> {
44
const textDecoder = new TextDecoder();

0 commit comments

Comments
 (0)