@@ -91,42 +91,42 @@ easily call.
9191In the Getting Started, we wrote the following code in the ` main.ts ` file:
9292
9393``` typescript
94- import type { Denops } from " https://deno.land/x/denops_std@v6.0 .0/mod.ts" ;
94+ import type { Entrypoint } from " https://deno.land/x/denops_std@v6.5 .0/mod.ts" ;
9595
96- export function main( denops : Denops ) : void {
96+ export const main: Entrypoint = ( denops ) => {
9797 denops .dispatcher = {
9898 async hello() {
9999 await denops .cmd (` echo "Hello, Denops!" ` );
100100 },
101101 };
102- }
102+ };
103103```
104104
105105Let's break down this code step by step.
106106
107107### About Imports
108108
109109``` typescript
110- import type { Denops } from " https://deno.land/x/denops_std@v6.0 .0/mod.ts" ;
110+ import type { Entrypoint } from " https://deno.land/x/denops_std@v6.5 .0/mod.ts" ;
111111```
112112
113- The first line imports the ` Denops ` type from the [ denops_std] standard library.
114- You can find detailed information about the library by checking the URL:
115- ` https://deno.land/x/denops_std@v6.0 .0 ` (remove ` /mod.ts ` ). We fixed the version
116- in the import URL, so it's recommended to check for details and update to the
117- latest version URL.
113+ The first line imports the ` Entrypoint ` type from the [ denops_std] standard
114+ library. You can find detailed information about the library by checking the
115+ URL: ` https://deno.land/x/denops_std@v6.5 .0 ` (remove ` /mod.ts ` ). We fixed the
116+ version in the import URL, so it's recommended to check for details and update
117+ to the latest version URL.
118118
119119Note that we use ` import type ` syntax, which is part of TypeScript's
120120[ Type-Only Imports and Export] ( https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html ) .
121- This syntax can be written as ` import { type Denops } ` with the same meaning.
122- Using ` import { Denops } ` for a type-only import is also valid.
121+ This syntax can be written as ` import { type Entrypoint } ` with the same
122+ meaning. Using ` import { Entrypoint } ` for a type-only import is also valid.
123123
124124> [ !NOTE]
125125>
126126> Denops plugins are dynamically imported, so there might be differences in
127127> Denops versions between development and usage. Therefore, to minimize
128- > differences between Denops versions, only the ` Denops ` type information is
129- > exposed. The implementation can be found in
128+ > differences between Denops versions, only type information is exposed. The
129+ > implementation can be found in
130130> [ ` denops/@denops-private/denops.ts ` ] ( https://github.com/vim-denops/denops.vim/blob/main/denops/%40denops-private/denops.ts ) ,
131131> but it is not publicly exposed for the reasons mentioned above.
132132>
@@ -135,12 +135,29 @@ Using `import { Denops }` for a type-only import is also valid.
135135> intended to be referenced only by [ denops.vim] and [ denops_std] , so Denops
136136> plugin developers don't need to use it directly.
137137
138+ > [ !NOTE]
139+ >
140+ > Prior to denops-std v6.5.0, the ` Entrypoint ` type was not defined thus
141+ > developers must define the ` main ` function as like
142+ >
143+ > ``` typescript
144+ > import type { Denops } from " https://deno.land/x/[email protected] /mod.ts" ;145+ >
146+ > export function main(denops : Denops ): void {
147+ > denops .dispatcher = {
148+ > async hello() {
149+ > await denops .cmd (` echo "Hello, Denops!" ` );
150+ > },
151+ > };
152+ > }
153+ > ` ` `
154+
138155### About Entry Point
139156
140157` ` ` typescript
141- export function main( denops : Denops ) : void {
158+ export const main: Entrypoint = ( denops ) => {
142159 // Omitted...
143- }
160+ };
144161```
145162
146163The above code exports the ` main ` function. The ` main ` function is called by
@@ -211,11 +228,11 @@ recommended to use [denops_std] to call Vim's features in actual plugin
211228development.
212229
213230For example, use
214- [ ` function ` module] ( https://deno.land/x/denops_std@v6.0 .0/function/mod.ts ) to
231+ [ ` function ` module] ( https://deno.land/x/denops_std@v6.5 .0/function/mod.ts ) to
215232call Vim's function instead of ` denops.call ` like:
216233
217234``` typescript
218- import * as fn from " https://deno.land/x/denops_std@v6.0 .0/function/mod.ts" ;
235+ import * as fn from " https://deno.land/x/denops_std@v6.5 .0/function/mod.ts" ;
219236
220237// Bad (result1 is `unknown`)
221238const result1 = await denops .call (" expand" , " %" );
0 commit comments