Skip to content

Commit db6c951

Browse files
authored
Merge pull request #2 from Shougo/import-map
Add import map support
2 parents 033973f + a2437a1 commit db6c951

File tree

20 files changed

+219
-102
lines changed

20 files changed

+219
-102
lines changed

.github/workflows/deno.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: deno
22

33
env:
4-
DENO_VERSION: 1.x
4+
DENO_VERSION: 2.x
55
DENOPS_PATH: "./"
66

77
on:
@@ -43,3 +43,14 @@ jobs:
4343
- name: Test
4444
run: deno task test
4545
timeout-minutes: 5
46+
47+
deno-test-publish:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: denoland/setup-deno@main
52+
with:
53+
deno-version: ${{ env.DENO_VERSION }}
54+
55+
- name: Test Publish
56+
run: deno task test:publish

.github/workflows/jsr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: jsr
22

33
env:
4-
DENO_VERSION: 1.x
4+
DENO_VERSION: 2.x
55

66
on:
77
push:
@@ -19,9 +19,9 @@ jobs:
1919
- uses: actions/checkout@v4
2020
with:
2121
fetch-depth: 0
22-
- uses: denoland/setup-deno@v1
22+
- uses: denoland/setup-deno@v2
2323
with:
2424
deno-version: ${{ env.DENO_VERSION }}
2525
- name: Publish
2626
run: |
27-
deno run -A jsr:@david/publish-on-tag@0.1.3
27+
deno run -A jsr:@david/publish-on-tag@0.2.0

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ see "FAQ" section in [help](doc/ddt.txt).
2828

2929
## Install
3030

31-
**Note:** ddt.vim requires Vim 9.1.0448 or Neovim 0.10.0+. See
31+
**NOTE:** It requires Vim 9.1.0448+ or Neovim 0.10.0+. See
3232
[requirements](#requirements) if you aren't sure whether you have this.
3333

3434
### Requirements
3535

36-
Please install both Deno 1.45+ and "denops.vim" v7.0+.
36+
Please install both Deno 2.3.0+ and "denops.vim" v8.0+.
3737

3838
- <https://deno.land/>
3939
- <https://github.com/vim-denops/denops.vim>

autoload/ddt/custom.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function ddt#custom#load_config(path) abort
2020
return
2121
endif
2222

23-
return s:notify('loadConfig', [a:path])
23+
return ddt#denops#_request('loadConfig', [a:path])
2424
endfunction
2525

2626
function s:normalize_key_or_dict(key_or_dict, value) abort

autoload/ddt/denops.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function ddt#denops#_request(method, args) abort
1212
if denops#server#status() !=# 'running'
1313
" Lazy call request
1414
execute printf('autocmd User DenopsPluginPost:ddt call '
15-
\ .. 's:notify("%s", %s)', a:method, a:args->string())
15+
\ .. 'denops#request("ddt", "%s", %s)', a:method, a:args->string())
1616
return {}
1717
endif
1818

@@ -41,8 +41,8 @@ function s:init() abort
4141
return
4242
endif
4343

44-
if !has('patch-9.1.0448') && !has('nvim-0.10')
45-
call ddt#util#_error('ddt.vim requires Vim 9.1.0448+ or Neovim 0.10+.')
44+
if !has('patch-9.1.1646') && !has('nvim-0.11')
45+
call ddt#util#_error('ddt.vim requires Vim 9.1.1646+ or Neovim 0.11+.')
4646
return 1
4747
endif
4848

@@ -80,7 +80,7 @@ function s:notify(method, args) abort
8080
endif
8181
endfunction
8282

83-
const s:root_dir = '<sfile>:h:h:h'->expand()
83+
const s:root_dir = '<script>:h:h:h'->expand()
8484
const s:sep = has('win32') ? '\' : '/'
8585
function s:register() abort
8686
call denops#plugin#load(

deno.jsonc

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
{
2-
"name": "@shougo/ddt-vim",
3-
"version": "0.0.0",
4-
"exports": {
5-
"./config": "./denops/ddt/base/config.ts",
6-
"./types": "./denops/ddt/types.ts",
7-
"./ui": "./denops/ddt/base/ui.ts",
8-
"./utils": "./denops/ddt/utils.ts"
9-
},
10-
"publish": {
11-
"include": [
12-
"denops/ddt/**/*.ts"
13-
]
14-
},
15-
"imports": {
16-
},
172
"lock": false,
183
"tasks": {
4+
"cache": "deno install --reload",
195
"check": "deno check denops/**/*.ts",
6+
"fmt": "deno fmt denops",
207
"lint": "deno lint denops",
218
"lint-fix": "deno lint --fix denops",
22-
"fmt": "deno fmt denops",
239
"test": "deno test -A --doc --parallel --shuffle denops/**/*.ts",
24-
"upgrade": "deno run -A jsr:@molt/cli **/*.ts --write"
25-
}
10+
"test:publish": "deno publish --dry-run --allow-dirty --set-version 0.0.0",
11+
"update": "deno outdated --recursive",
12+
"upgrade": "deno outdated --recursive --update"
13+
},
14+
"workspace": [
15+
"./denops/ddt"
16+
]
2617
}

denops/@ddu-kinds/ddt_tab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
import { BaseKind } from "jsr:@shougo/ddu-vim@~10.3.0/kind";
77
import { printError, safeStat } from "jsr:@shougo/ddu-vim@~10.3.0/utils";
88

9-
import type { Denops } from "jsr:@denops/core@~7.0.0";
9+
import type { Denops } from "jsr:@denops/std@~7.6.0";
1010
import * as fn from "jsr:@denops/std@~7.6.0/function";
1111
import * as vars from "jsr:@denops/std@~7.6.0/variable";
1212

denops/@ddu-sources/ddt_shell_history.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import { BaseSource } from "jsr:@shougo/ddu-vim@~10.3.0/source";
88
import { safeStat } from "../ddt/utils.ts";
99

10-
import type { Denops } from "jsr:@denops/core@~7.0.0";
10+
import type { Denops } from "jsr:@denops/std@~7.6.0";
1111
import * as fn from "jsr:@denops/std@~7.6.0/function";
1212

1313
type Params = {

denops/@ddu-sources/ddt_tab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Item } from "jsr:@shougo/ddu-vim@~10.3.0/types";
22
import { BaseSource } from "jsr:@shougo/ddu-vim@~10.3.0/source";
33
import type { ActionData } from "../@ddu-kinds/ddt_tab.ts";
44

5-
import type { Denops } from "jsr:@denops/core@~7.0.0";
5+
import type { Denops } from "jsr:@denops/std@~7.6.0";
66
import * as fn from "jsr:@denops/std@~7.6.0/function";
77

88
type Params = Record<string, never>;

denops/ddt/app.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ import type {
77
import { ContextBuilderImpl } from "./context.ts";
88
import { Ddt } from "./ddt.ts";
99
import { Loader } from "./loader.ts";
10-
import { isDenoCacheIssueError } from "./utils.ts";
10+
import { importPlugin, isDenoCacheIssueError } from "./utils.ts";
1111
import type { BaseUi } from "./base/ui.ts";
1212

13-
import type { Denops, Entrypoint } from "jsr:@denops/std@~7.6.0";
13+
import type { Denops, Entrypoint } from "@denops/std";
1414

15-
import { toFileUrl } from "jsr:@std/path@~1.1.0/to-file-url";
16-
import { is } from "jsr:@core/unknownutil@~4.3.0/is";
17-
import { ensure } from "jsr:@core/unknownutil@~4.3.0/ensure";
18-
import { Lock } from "jsr:@core/asyncutil@~1.2.0/lock";
15+
import { is } from "@core/unknownutil/is";
16+
import { ensure } from "@core/unknownutil/ensure";
17+
import { Lock } from "@core/asyncutil/lock";
1918

2019
export const main: Entrypoint = (denops: Denops) => {
2120
const loaders: Record<string, Loader> = {};
@@ -104,12 +103,9 @@ export const main: Entrypoint = (denops: Denops) => {
104103
const path = ensure(arg1, is.String) as string;
105104

106105
try {
107-
// NOTE: Import module with fragment so that reload works properly.
108-
// https://github.com/vim-denops/denops.vim/issues/227
109-
const mod = await import(
110-
`${toFileUrl(path).href}#${performance.now()}`
111-
);
112-
const obj = new mod.Config();
106+
const mod = await importPlugin(path);
107+
// deno-lint-ignore no-explicit-any
108+
const obj = new (mod as any).Config();
113109
await obj.config({ denops, contextBuilder });
114110
} catch (e) {
115111
if (isDenoCacheIssueError(e)) {

0 commit comments

Comments
 (0)