Skip to content

Commit

Permalink
Merge pull request #8 from vim-denops/v7-pre
Browse files Browse the repository at this point in the history
🎉 For Denops v7
  • Loading branch information
lambdalisue authored Jul 20, 2024
2 parents dae4ca5 + cbe82eb commit c4b41ce
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deno.lock
31 changes: 22 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
# 🪐 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
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.
2 changes: 1 addition & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
29 changes: 26 additions & 3 deletions denops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ export interface Denops {
*/
readonly context: Record<PropertyKey, unknown>;

/**
* 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.
*/
Expand Down Expand Up @@ -142,14 +147,32 @@ 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 "jsr:@denops/core";
*
* export const main: Entrypoint = (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";
* import type { Entrypoint } from "jsr:@denops/core";
*
* export const main: Entrypoint = (denops) => {
* // ...
* return {
* [Symbol.asyncDispose]: async () => {
* // Dispose resources...
* }
* }
* }
* ```
*/
export type Entrypoint = (denops: Denops) => void | Promise<void>;
export type Entrypoint = (
denops: Denops,
) => void | AsyncDisposable | Promise<void | AsyncDisposable>;
20 changes: 16 additions & 4 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -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://deno.land/x/denops_std
* [@denops/std]: https://jsr.io/@denops/std
*
* @module
*/
Expand Down

0 comments on commit c4b41ce

Please sign in to comment.