Skip to content

Commit 99d84ca

Browse files
authored
Merge pull request #139 from Shougo/import-map
Add import map support
2 parents c91678f + af1333e commit 99d84ca

File tree

20 files changed

+383
-156
lines changed

20 files changed

+383
-156
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
@@ -47,12 +47,12 @@ Please see: https://github.com/Shougo/ddu.vim/issues/10
4747

4848
## Install
4949

50-
**NOTE:** Ddu.vim requires Vim 9.0.1276+ or Neovim 0.10.0+. See
50+
**NOTE:** It requires Vim 9.1.0448+ or Neovim 0.10.0+. See
5151
[requirements](#requirements) if you aren't sure whether you have this.
5252

5353
### Requirements
5454

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

5757
- <https://deno.land/>
5858
- <https://github.com/vim-denops/denops.vim>

autoload/ddu/denops.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function ddu#denops#_notify(method, args) abort
3636
return s:notify(a:method, a:args)
3737
endfunction
3838

39-
const s:root_dir = '<sfile>:h:h:h'->expand()
39+
const s:root_dir = '<script>:h:h:h'->expand()
4040
const s:sep = has('win32') ? '\' : '/'
4141
function ddu#denops#_mods() abort
4242
return [s:root_dir, 'denops', 'ddu', '_mods.js']->join(s:sep)
@@ -73,9 +73,9 @@ function s:init() abort
7373
return
7474
endif
7575

76-
if !has('patch-9.1.0448') && !has('nvim-0.10')
76+
if !has('patch-9.1.1646') && !has('nvim-0.11')
7777
call ddu#util#print_error(
78-
\ 'ddu requires Vim 9.1.0448+ or neovim 0.10.0+.')
78+
\ 'ddu requires Vim 9.1.1646+ or neovim 0.11.0+.')
7979
return 1
8080
endif
8181

deno.jsonc

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,17 @@
11
{
2-
"name": "@shougo/ddu-vim",
3-
"version": "0.0.0",
4-
"exports": {
5-
"./action": "./denops/ddu/base/action.ts",
6-
"./column": "./denops/ddu/base/column.ts",
7-
"./config": "./denops/ddu/base/config.ts",
8-
"./filter": "./denops/ddu/base/filter.ts",
9-
"./kind": "./denops/ddu/base/kind.ts",
10-
"./source": "./denops/ddu/base/source.ts",
11-
"./state": "./denops/ddu/state.ts",
12-
"./types": "./denops/ddu/types.ts",
13-
"./ui": "./denops/ddu/base/ui.ts",
14-
"./utils": "./denops/ddu/utils.ts"
15-
},
16-
"publish": {
17-
"include": [
18-
"denops/ddu/**/*.ts",
19-
"denops/ddu/**/*.js"
20-
]
21-
},
22-
"imports": {
23-
},
242
"lock": false,
253
"tasks": {
4+
"cache": "deno install --reload",
265
"check": "deno check denops/**/*.ts",
6+
"fmt": "deno fmt denops",
277
"lint": "deno lint denops",
288
"lint-fix": "deno lint --fix denops",
29-
"fmt": "deno fmt denops",
309
"test": "deno test -A --doc --parallel --shuffle denops/**/*.ts",
31-
"upgrade": "deno run -A jsr:@molt/cli **/*.ts --write"
32-
}
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/ddu"
16+
]
3317
}

denops/ddu/app.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,19 @@ import {
2727
getItemActions,
2828
uiSearchItem,
2929
} from "./ext.ts";
30-
import { isDenoCacheIssueError } from "./utils.ts";
30+
import { importPlugin, isDenoCacheIssueError } from "./utils.ts";
3131
import { type BaseUi, defaultUiOptions } from "./base/ui.ts";
3232
import { type BaseSource, defaultSourceOptions } from "./base/source.ts";
3333
import { type BaseFilter, defaultFilterOptions } from "./base/filter.ts";
3434
import { type BaseKind, defaultKindOptions } from "./base/kind.ts";
3535
import { type BaseColumn, defaultColumnOptions } from "./base/column.ts";
3636
import { defaultActionOptions } from "./base/action.ts";
3737

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

40-
import { toFileUrl } from "jsr:@std/path@~1.1.0/to-file-url";
41-
import { Lock } from "jsr:@core/asyncutil@~1.2.0/lock";
42-
import { is } from "jsr:@core/unknownutil@~4.3.0/is";
43-
import { ensure } from "jsr:@core/unknownutil@~4.3.0/ensure";
40+
import { Lock } from "@core/asyncutil/lock";
41+
import { is } from "@core/unknownutil/is";
42+
import { ensure } from "@core/unknownutil/ensure";
4443

4544
export const main: Entrypoint = (denops: Denops) => {
4645
type RedrawTreeMode = "collapse" | "expand";
@@ -280,12 +279,9 @@ export const main: Entrypoint = (denops: Denops) => {
280279
const path = ensure(arg1, is.String) as string;
281280

282281
try {
283-
// NOTE: Import module with fragment so that reload works properly.
284-
// https://github.com/vim-denops/denops.vim/issues/227
285-
const mod = await import(
286-
`${toFileUrl(path).href}#${performance.now()}`
287-
);
288-
const obj = new mod.Config();
282+
const mod = await importPlugin(path);
283+
// deno-lint-ignore no-explicit-any
284+
const obj = new (mod as any).Config();
289285
await obj.config({ denops, contextBuilder, setAlias });
290286
} catch (e) {
291287
if (isDenoCacheIssueError(e)) {

denops/ddu/base/column.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type {
77
ItemHighlight,
88
} from "../types.ts";
99

10-
import type { Denops } from "jsr:@denops/std@~7.6.0";
10+
import type { Denops } from "@denops/std";
1111

1212
export type OnInitArguments<Params extends BaseParams> = {
1313
denops: Denops;

denops/ddu/base/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ContextBuilder, DduAliasType } from "../types.ts";
2-
import type { Denops } from "jsr:@denops/std@~7.6.0";
2+
import type { Denops } from "@denops/std";
33

44
export type ConfigArguments = {
55
denops: Denops;

denops/ddu/base/filter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
SourceOptions,
99
} from "../types.ts";
1010

11-
import type { Denops } from "jsr:@denops/std@~7.6.0";
11+
import type { Denops } from "@denops/std";
1212

1313
export type OnInitArguments<Params extends BaseParams> = {
1414
denops: Denops;

denops/ddu/base/kind.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {
99
Previewer,
1010
} from "../types.ts";
1111

12-
import type { Denops } from "jsr:@denops/std@~7.6.0";
12+
import type { Denops } from "@denops/std";
1313

1414
export type GetPreviewerArguments = {
1515
denops: Denops;

0 commit comments

Comments
 (0)