Skip to content

Commit c4b41ce

Browse files
authored
Merge pull request #8 from vim-denops/v7-pre
🎉 For Denops v7
2 parents dae4ca5 + cbe82eb commit c4b41ce

File tree

6 files changed

+68
-17
lines changed

6 files changed

+68
-17
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
run: deno fmt --check
3333
- name: Type check
3434
run: deno task check
35+
- name: Test doc
36+
run: deno task test
3537

3638
jsr-publish:
3739
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
deno.lock

README.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
11
# 🪐 denops_core
22

33
[![JSR](https://jsr.io/badges/@denops/core)](https://jsr.io/@denops/core)
4-
[![denoland](https://img.shields.io/github/v/release/vim-denops/deno-denops-core?logo=deno&label=denoland)](https://deno.land/x/denops_core)
5-
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/denops_core/mod.ts)
64
[![test](https://github.com/vim-denops/deno-denops/workflows/test/badge.svg)](https://github.com/vim-denops/deno-denops/actions?query=workflow%3Atest)
75

8-
This module is a fundamental component of [denops.vim], an ecosystem for
9-
crafting plugins in [Deno] for Vim/Neovim.
6+
This is a core module of [denops.vim], an ecosystem for creating Vim/Neovim
7+
plugin in [Deno].
108

11-
It's essential to highlight that the recommended practice for most users is to
12-
utilize the [denops_std] module when developing plugins for [denops.vim]. The
13-
current module is structured as a foundational layer within [denops_std], and
14-
utilizing it directly from plugins is **strongly discouraged**.
9+
> [!WARNING]
10+
>
11+
> This module is mainly for internal use. It's **strongly discouraged** to
12+
> utilize this module directly from plugins. Use the [@denops/std] module
13+
> instead.
14+
15+
```ts
16+
import type { Entrypoint } from "jsr:@denops/core";
17+
18+
export const main: Entrypoint = (denops) => {
19+
// ...
20+
};
21+
```
1522

1623
[deno]: https://deno.land/
1724
[denops.vim]: https://github.com/vim-denops/denops.vim
18-
[denops_std]: https://deno.land/x/denops_std
25+
[@denops/std]: https://jsr.io/@denops/std
26+
27+
# License
28+
29+
The code follows the MIT license, as stated in [LICENSE](./LICENSE).
30+
Contributors need to agree that any modifications sent to this repository follow
31+
the license.

deno.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"update:commit": "deno task -q update --commit --pre-commit=fmt,lint"
1212
},
1313
"imports": {
14-
"https://deno.land/x/denops_core@$MODULE_VERSION/": "./"
14+
"jsr:@denops/core": "./mod.ts"
1515
}
1616
}

denops.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ export interface Denops {
7474
*/
7575
readonly context: Record<PropertyKey, unknown>;
7676

77+
/**
78+
* AbortSignal instance that is triggered when the user invoke `denops#interrupt()`
79+
*/
80+
readonly interrupted?: AbortSignal;
81+
7782
/**
7883
* User-defined API name and method map used to dispatch API requests.
7984
*/
@@ -142,14 +147,32 @@ export interface Denops {
142147
/**
143148
* Denops's entrypoint definition.
144149
*
145-
* Use this type to ensure the `main` function is properly implemented like
150+
* Use this type to ensure the `main` function is properly implemented like:
151+
*
152+
* ```ts
153+
* import type { Entrypoint } from "jsr:@denops/core";
154+
*
155+
* export const main: Entrypoint = (denops) => {
156+
* // ...
157+
* }
158+
* ```
159+
*
160+
* If an `AsyncDisposable` object is returned, resources can be disposed of
161+
* asynchronously when the plugin is unloaded, like:
146162
*
147163
* ```ts
148-
* import type { Entrypoint } from "https://deno.land/x/denops_core@$MODULE_VERSION/mod.ts";
164+
* import type { Entrypoint } from "jsr:@denops/core";
149165
*
150166
* export const main: Entrypoint = (denops) => {
151167
* // ...
168+
* return {
169+
* [Symbol.asyncDispose]: async () => {
170+
* // Dispose resources...
171+
* }
172+
* }
152173
* }
153174
* ```
154175
*/
155-
export type Entrypoint = (denops: Denops) => void | Promise<void>;
176+
export type Entrypoint = (
177+
denops: Denops,
178+
) => void | AsyncDisposable | Promise<void | AsyncDisposable>;

mod.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
/**
2-
* This module is a fundamental component of [denops.vim], an ecosystem for crafting plugins in [Deno] for Vim/Neovim.
2+
* This is a core module of [denops.vim], an ecosystem for creating Vim/Neovim
3+
* plugin in [Deno].
34
*
4-
* It's essential to highlight that the recommended practice for most users is to utilize the [denops_std] module when developing plugins for [denops.vim].
5-
* The current module is structured as a foundational layer within [denops_std], and utilizing it directly from plugins is **strongly discouraged**.
5+
* > [!WARNING]
6+
* >
7+
* > This module is mainly for internal use. It's **strongly discouraged** to
8+
* > utilize this module directly from plugins. Use the [@denops/std] module
9+
* > instead.
10+
*
11+
* ```ts
12+
* import type { Entrypoint } from "jsr:@denops/core";
13+
*
14+
* export const main: Entrypoint = (denops) => {
15+
* // ...
16+
* };
17+
* ```
618
*
719
* [deno]: https://deno.land/
820
* [denops.vim]: https://github.com/vim-denops/denops.vim
9-
* [denops_std]: https://deno.land/x/denops_std
21+
* [@denops/std]: https://jsr.io/@denops/std
1022
*
1123
* @module
1224
*/

0 commit comments

Comments
 (0)