Skip to content

Commit

Permalink
Merge pull request #120 from Shougo/jsr
Browse files Browse the repository at this point in the history
Migrate to JSR
  • Loading branch information
Shougo authored Jul 28, 2024
2 parents 487b451 + 1829c7f commit c4d951f
Show file tree
Hide file tree
Showing 20 changed files with 121 additions and 141 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/jsr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: jsr

env:
DENO_VERSION: 1.x

on:
push:
tags:
- "v*"

permissions:
contents: read
id-token: write

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: denoland/setup-deno@v1
with:
deno-version: ${{ env.DENO_VERSION }}
- name: Publish
run: |
deno run -A jsr:@david/[email protected]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ sure whether you have this.

### Requirements

Ddu.vim requires both Deno 1.42+ and denops.vim.
Please install both Deno 1.45+ and "denops.vim" v7.0+.

- <https://deno.land/>
- <https://github.com/vim-denops/denops.vim>
Expand Down
22 changes: 22 additions & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
{
"name": "@shougo/ddu-vim",
"version": "0.0.0",
"exports": {
"./action": "./denops/ddu/base/action.ts",
"./column": "./denops/ddu/base/column.ts",
"./config": "./denops/ddu/base/config.ts",
"./filter": "./denops/ddu/base/filter.ts",
"./kind": "./denops/ddu/base/kind.ts",
"./source": "./denops/ddu/base/source.ts",
"./types": "./denops/ddu/types.ts",
"./ui": "./denops/ddu/base/ui.ts",
"./utils": "./denops/ddu/utils.ts"
},
"publish": {
"include": [
"denops/ddu/**/*.ts",
"denops/ddu/**/*.js"
],
},
"imports": {
},
"lock": false,
"tasks": {
"check": "deno check denops/**/*.ts",
"lint": "deno lint denops",
"lint-fix": "deno lint --fix denops",
"fmt": "deno fmt denops",
"test": "deno test -A --doc --parallel --shuffle denops/**/*.ts",
"upgrade": "deno run -A jsr:@molt/cli **/*.ts --no-resolve --write"
Expand Down
6 changes: 4 additions & 2 deletions denops/ddu/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Denops, ensure, Entrypoint, is, Lock, toFileUrl } from "./deps.ts";
import {
import type { Denops, Entrypoint } from "./deps.ts";
import { Lock } from "./deps.ts";
import { ensure, is, toFileUrl } from "./deps.ts";
import type {
Action,
ActionHistory,
BaseActionParams,
Expand Down
2 changes: 1 addition & 1 deletion denops/ddu/base/action.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActionOptions } from "../types.ts";
import type { ActionOptions } from "../types.ts";

export function defaultActionOptions(): ActionOptions {
return {
Expand Down
4 changes: 2 additions & 2 deletions denops/ddu/base/column.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
import type {
ColumnOptions,
Context,
DduItem,
DduOptions,
ItemHighlight,
} from "../types.ts";
import { Denops } from "../deps.ts";
import type { Denops } from "../deps.ts";

export type BaseColumnParams = Record<string, unknown>;

Expand Down
6 changes: 3 additions & 3 deletions denops/ddu/base/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ContextBuilder } from "../context.ts";
import { DduAliasType } from "../types.ts";
import { Denops } from "../deps.ts";
import type { ContextBuilder } from "../context.ts";
import type { DduAliasType } from "../types.ts";
import type { Denops } from "../deps.ts";

export type ConfigArguments = {
denops: Denops;
Expand Down
4 changes: 2 additions & 2 deletions denops/ddu/base/filter.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
import type {
Context,
DduFilterItems,
DduItem,
DduOptions,
FilterOptions,
SourceOptions,
} from "../types.ts";
import { Denops } from "../deps.ts";
import type { Denops } from "../deps.ts";

export type BaseFilterParams = Record<string, unknown>;

Expand Down
6 changes: 3 additions & 3 deletions denops/ddu/base/kind.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
ActionOptions,
Actions,
DduItem,
Expand All @@ -7,7 +7,7 @@ import {
PreviewContext,
Previewer,
} from "../types.ts";
import { Denops } from "../deps.ts";
import type { Denops } from "../deps.ts";

export type BaseKindParams = Record<string, unknown>;

Expand All @@ -28,7 +28,7 @@ export abstract class BaseKind<
path = "";
isInitialized = false;

actions: Actions<Params> = {};
abstract actions: Actions<Params>;

abstract params(): Params;

Expand Down
8 changes: 4 additions & 4 deletions denops/ddu/base/source.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
Actions,
Context,
DduEvent,
Expand All @@ -7,8 +7,8 @@ import {
Item,
SourceOptions,
} from "../types.ts";
import { Denops } from "../deps.ts";
import { Loader } from "../loader.ts";
import type { Denops } from "../deps.ts";
import type { Loader } from "../loader.ts";

export type BaseSourceParams = Record<string, unknown>;

Expand Down Expand Up @@ -56,7 +56,7 @@ export abstract class BaseSource<
isInitialized = false;

kind = "base";
prevMtime = new Date();
prevMtime: Date = new Date();
actions: Actions<Params> = {};

onInit(_args: OnInitArguments<Params>): void | Promise<void> {}
Expand Down
6 changes: 3 additions & 3 deletions denops/ddu/base/ui.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
BaseActionParams,
Context,
Ddu,
Expand All @@ -10,7 +10,7 @@ import {
UiActionCallback,
UiOptions,
} from "../types.ts";
import { Denops } from "../deps.ts";
import type { Denops } from "../deps.ts";

export type BaseUiParams = Record<string, unknown>;

Expand Down Expand Up @@ -177,7 +177,7 @@ export abstract class BaseUi<

updateCursor(_args: UpdateCursorArguments<Params>): void | Promise<void> {}

actions: UiActions<Params> = {};
abstract actions: UiActions<Params>;

abstract params(): Params;
}
Expand Down
5 changes: 3 additions & 2 deletions denops/ddu/context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { assertEquals, Denops, fn } from "./deps.ts";
import {
import type { Denops } from "./deps.ts";
import { assertEquals, fn } from "./deps.ts";
import type {
ActionOptions,
BaseActionParams,
BaseColumnParams,
Expand Down
36 changes: 13 additions & 23 deletions denops/ddu/ddu.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import {
assertEquals,
basename,
Denops,
equal,
fn,
Lock,
pathsep,
} from "./deps.ts";
import {
ActionFlags,
import type { Denops } from "./deps.ts";
import { assertEquals, basename, equal, fn, Lock, pathsep } from "./deps.ts";
import type {
ActionHistory,
BaseActionParams,
BaseSource,
Expand All @@ -27,21 +19,19 @@ import {
UserOptions,
UserSource,
} from "./types.ts";
import { ActionFlags } from "./types.ts";
import {
defaultContext,
defaultDduOptions,
foldMerge,
mergeDduOptions,
} from "./context.ts";
import { defaultSourceOptions } from "./base/source.ts";
import { Loader } from "./loader.ts";
import type { Loader } from "./loader.ts";
import { convertUserString, printError, treePath2Filename } from "./utils.ts";
import {
AvailableSourceInfo,
GatherState,
GatherStateAbortable,
isRefreshTarget,
} from "./state.ts";
import type { AvailableSourceInfo, GatherStateAbortable } from "./state.ts";
import { GatherState } from "./state.ts";
import { isRefreshTarget } from "./state.ts";
import {
callColumns,
callFilters,
Expand Down Expand Up @@ -1607,15 +1597,15 @@ export class Ddu {
this.#context.input = input;
}

getContext() {
getContext(): Context {
return this.#context;
}

getOptions() {
getOptions(): DduOptions {
return this.#options;
}

getUserOptions() {
getUserOptions(): UserOptions {
return this.#userOptions;
}

Expand Down Expand Up @@ -1701,7 +1691,7 @@ export class Ddu {
return ret;
}

getSourceArgs() {
getSourceArgs(): [SourceOptions, BaseSourceParams][] {
return this.#options.sources.map((userSource) =>
sourceArgs(
this.#loader.getSource(
Expand All @@ -1714,7 +1704,7 @@ export class Ddu {
);
}

getItems() {
getItems(): DduItem[] {
return this.#items;
}

Expand Down
26 changes: 8 additions & 18 deletions denops/ddu/deps.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
export type {
Denops,
Entrypoint,
} from "https://deno.land/x/[email protected]/mod.ts";
export {
echo,
execute,
} from "https://deno.land/x/[email protected]/helper/mod.ts";
export {
batch,
collect,
} from "https://deno.land/x/[email protected]/batch/mod.ts";
export * as op from "https://deno.land/x/[email protected]/option/mod.ts";
export * as fn from "https://deno.land/x/[email protected]/function/mod.ts";
export * as vars from "https://deno.land/x/[email protected]/variable/mod.ts";
export * as autocmd from "https://deno.land/x/[email protected]/autocmd/mod.ts";
export type { Denops, Entrypoint } from "jsr:@denops/[email protected]";
export { echo, execute } from "jsr:@denops/[email protected]/helper";
export { batch, collect } from "jsr:@denops/[email protected]/batch";
export * as op from "jsr:@denops/[email protected]/option";
export * as fn from "jsr:@denops/[email protected]/function";
export * as vars from "jsr:@denops/[email protected]/variable";
export * as autocmd from "jsr:@denops/[email protected]/autocmd";

export { assertEquals, equal } from "jsr:@std/[email protected]";
export {
Expand All @@ -22,8 +13,7 @@ export {
parse,
SEPARATOR as pathsep,
toFileUrl,
} from "jsr:@std/[email protected]";
export { deadline, DeadlineError } from "jsr:@std/[email protected]";
} from "jsr:@std/[email protected]";

export { ensure, is, maybe } from "jsr:@core/[email protected]";
export { Lock } from "jsr:@lambdalisue/[email protected]";
Loading

0 comments on commit c4d951f

Please sign in to comment.