From 654c7eb74938aeb46d9f7bbf3ed0ca482fb8bdbe Mon Sep 17 00:00:00 2001 From: Alisue Date: Sat, 1 Jun 2024 16:08:31 +0900 Subject: [PATCH 1/8] :+1: Add `interrupted` attribute https://github.com/vim-denops/denops.vim/pull/348 --- denops.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/denops.ts b/denops.ts index 18bfe25..8f65108 100644 --- a/denops.ts +++ b/denops.ts @@ -74,6 +74,11 @@ export interface Denops { */ readonly context: Record; + /** + * AbortSignal instance that is triggered when the user invoke `denops#interrupt()` + */ + readonly interrupted: AbortSignal; + /** * User-defined API name and method map used to dispatch API requests. */ From f56fc400ee8eb630abc61a98eea668e94915619e Mon Sep 17 00:00:00 2001 From: Milly Date: Sun, 7 Jul 2024 14:20:03 +0900 Subject: [PATCH 2/8] :+1: run doc test on test workflow `deno check` does not check examples in jsdoc comments. --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fcd10b9..c035b28 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,6 +32,8 @@ jobs: run: deno fmt --check - name: Type check run: deno task check + - name: Test doc + run: deno task test jsr-publish: runs-on: ubuntu-latest From a0b9aef57889c9a24c2f8bb300f02d9381ee0114 Mon Sep 17 00:00:00 2001 From: Milly Date: Sat, 6 Jul 2024 00:03:25 +0900 Subject: [PATCH 3/8] :+1: add `AsyncDisposable` to the return type of `Entrypoint` --- denops.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/denops.ts b/denops.ts index 8f65108..217df98 100644 --- a/denops.ts +++ b/denops.ts @@ -147,7 +147,7 @@ export interface Denops { /** * Denops's entrypoint definition. * - * Use this type to ensure the `main` function is properly implemented like + * Use this type to ensure the `main` function is properly implemented like: * * ```ts * import type { Entrypoint } from "https://deno.land/x/denops_core@$MODULE_VERSION/mod.ts"; @@ -156,5 +156,23 @@ export interface Denops { * // ... * } * ``` + * + * If an `AsyncDisposable` object is returned, resources can be disposed of + * asynchronously when the plugin is unloaded, like: + * + * ```ts + * import type { Entrypoint } from "https://deno.land/x/denops_core@$MODULE_VERSION/mod.ts"; + * + * export const main: Entrypoint = (denops) => { + * // ... + * return { + * [Symbol.asyncDispose]: async () => { + * // Dispose resources... + * } + * } + * } + * ``` */ -export type Entrypoint = (denops: Denops) => void | Promise; +export type Entrypoint = ( + denops: Denops, +) => void | AsyncDisposable | Promise; From f26eee5134b28dd89b513b9ca3c0e5ac6dfaaa84 Mon Sep 17 00:00:00 2001 From: Alisue Date: Sun, 7 Jul 2024 15:54:15 +0900 Subject: [PATCH 4/8] :coffee: Add `.gitignore` --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fff3a34 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +deno.lock From de1803e8c308ed87eeb57a0fea6b33c4dc647a6f Mon Sep 17 00:00:00 2001 From: Alisue Date: Sun, 7 Jul 2024 15:56:43 +0900 Subject: [PATCH 5/8] :memo: Use JSR instead in JSDoc --- deno.jsonc | 2 +- denops.ts | 4 ++-- mod.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deno.jsonc b/deno.jsonc index ccfcc3f..9054ca8 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -11,6 +11,6 @@ "update:commit": "deno task -q update --commit --pre-commit=fmt,lint" }, "imports": { - "https://deno.land/x/denops_core@$MODULE_VERSION/": "./" + "jsr:@denops/core": "./mod.ts" } } diff --git a/denops.ts b/denops.ts index 217df98..4c8edaa 100644 --- a/denops.ts +++ b/denops.ts @@ -150,7 +150,7 @@ export interface Denops { * Use this type to ensure the `main` function is properly implemented like: * * ```ts - * import type { Entrypoint } from "https://deno.land/x/denops_core@$MODULE_VERSION/mod.ts"; + * import type { Entrypoint } from "jsr:@denops/core"; * * export const main: Entrypoint = (denops) => { * // ... @@ -161,7 +161,7 @@ export interface Denops { * asynchronously when the plugin is unloaded, like: * * ```ts - * import type { Entrypoint } from "https://deno.land/x/denops_core@$MODULE_VERSION/mod.ts"; + * import type { Entrypoint } from "jsr:@denops/core"; * * export const main: Entrypoint = (denops) => { * // ... diff --git a/mod.ts b/mod.ts index 803fdbc..7b036f2 100644 --- a/mod.ts +++ b/mod.ts @@ -6,7 +6,7 @@ * * [deno]: https://deno.land/ * [denops.vim]: https://github.com/vim-denops/denops.vim - * [denops_std]: https://deno.land/x/denops_std + * [denops_std]: https://github.com/vim-denops/deno-denops-std * * @module */ From 2f20f366cac611696b17e5a6e55e016eba6c2932 Mon Sep 17 00:00:00 2001 From: Alisue Date: Sun, 7 Jul 2024 16:02:20 +0900 Subject: [PATCH 6/8] :memo: Remove deno.land badges --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index e9d2ff1..8f8d7a8 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # 🪐 denops_core [![JSR](https://jsr.io/badges/@denops/core)](https://jsr.io/@denops/core) -[![denoland](https://img.shields.io/github/v/release/vim-denops/deno-denops-core?logo=deno&label=denoland)](https://deno.land/x/denops_core) -[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/denops_core/mod.ts) [![test](https://github.com/vim-denops/deno-denops/workflows/test/badge.svg)](https://github.com/vim-denops/deno-denops/actions?query=workflow%3Atest) This module is a fundamental component of [denops.vim], an ecosystem for From cecefc5ae2bec39e4d6a2eb61eeac3657d07c041 Mon Sep 17 00:00:00 2001 From: Alisue Date: Mon, 8 Jul 2024 09:56:51 +0900 Subject: [PATCH 7/8] :bug: Fix `interrupted` property of `Denops` --- denops.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/denops.ts b/denops.ts index 4c8edaa..d0872ed 100644 --- a/denops.ts +++ b/denops.ts @@ -77,7 +77,7 @@ export interface Denops { /** * AbortSignal instance that is triggered when the user invoke `denops#interrupt()` */ - readonly interrupted: AbortSignal; + readonly interrupted?: AbortSignal; /** * User-defined API name and method map used to dispatch API requests. From cbe82ebd3eaf8e894c8aa38b31910a25ca83fede Mon Sep 17 00:00:00 2001 From: Alisue Date: Sat, 20 Jul 2024 12:55:04 +0900 Subject: [PATCH 8/8] :memo: Update docs --- README.md | 29 ++++++++++++++++++++++------- mod.ts | 20 ++++++++++++++++---- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 8f8d7a8..2055127 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,29 @@ [![JSR](https://jsr.io/badges/@denops/core)](https://jsr.io/@denops/core) [![test](https://github.com/vim-denops/deno-denops/workflows/test/badge.svg)](https://github.com/vim-denops/deno-denops/actions?query=workflow%3Atest) -This module is a fundamental component of [denops.vim], an ecosystem for -crafting plugins in [Deno] for Vim/Neovim. +This is a core module of [denops.vim], an ecosystem for creating Vim/Neovim +plugin in [Deno]. -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]. The -current module is structured as a foundational layer within [denops_std], and -utilizing it directly from plugins is **strongly discouraged**. +> [!WARNING] +> +> This module is mainly for internal use. It's **strongly discouraged** to +> utilize this module directly from plugins. Use the [@denops/std] module +> instead. + +```ts +import type { Entrypoint } from "jsr:@denops/core"; + +export const main: Entrypoint = (denops) => { + // ... +}; +``` [deno]: https://deno.land/ [denops.vim]: https://github.com/vim-denops/denops.vim -[denops_std]: https://deno.land/x/denops_std +[@denops/std]: https://jsr.io/@denops/std + +# License + +The code follows the MIT license, as stated in [LICENSE](./LICENSE). +Contributors need to agree that any modifications sent to this repository follow +the license. diff --git a/mod.ts b/mod.ts index 7b036f2..9f1ec4a 100644 --- a/mod.ts +++ b/mod.ts @@ -1,12 +1,24 @@ /** - * This module is a fundamental component of [denops.vim], an ecosystem for crafting plugins in [Deno] for Vim/Neovim. + * This is a core module of [denops.vim], an ecosystem for creating Vim/Neovim + * plugin in [Deno]. * - * 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]. - * The current module is structured as a foundational layer within [denops_std], and utilizing it directly from plugins is **strongly discouraged**. + * > [!WARNING] + * > + * > This module is mainly for internal use. It's **strongly discouraged** to + * > utilize this module directly from plugins. Use the [@denops/std] module + * > instead. + * + * ```ts + * import type { Entrypoint } from "jsr:@denops/core"; + * + * export const main: Entrypoint = (denops) => { + * // ... + * }; + * ``` * * [deno]: https://deno.land/ * [denops.vim]: https://github.com/vim-denops/denops.vim - * [denops_std]: https://github.com/vim-denops/deno-denops-std + * [@denops/std]: https://jsr.io/@denops/std * * @module */