From 20a1636eb9aa8b8ff3131a3f44218bd6761db940 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 7 Sep 2024 12:45:46 +0900 Subject: [PATCH 01/11] Remove deps/std/path.ts --- denops/skkeleton/deps/std/path.ts | 1 - denops/skkeleton/dictionary.ts | 3 ++- denops/skkeleton/dictionary_test.ts | 5 ++++- denops/skkeleton/testutil.ts | 8 +++++--- denops/skkeleton/util.ts | 4 +++- 5 files changed, 14 insertions(+), 7 deletions(-) delete mode 100644 denops/skkeleton/deps/std/path.ts diff --git a/denops/skkeleton/deps/std/path.ts b/denops/skkeleton/deps/std/path.ts deleted file mode 100644 index 83bee8ec..00000000 --- a/denops/skkeleton/deps/std/path.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "jsr:@std/path@~1.0.3"; diff --git a/denops/skkeleton/dictionary.ts b/denops/skkeleton/dictionary.ts index 7472ba2f..347192fc 100644 --- a/denops/skkeleton/dictionary.ts +++ b/denops/skkeleton/dictionary.ts @@ -1,10 +1,11 @@ import { config } from "./config.ts"; -import { toFileUrl } from "./deps/std/path.ts"; import { JpNum } from "./deps/japanese_numeral.ts"; import { RomanNum } from "./deps/roman.ts"; import { zip } from "./deps/std/collections.ts"; import type { CompletionData, RankData } from "./types.ts"; +import { toFileUrl } from "jsr:@std/path@~1.0.3/to-file-url"; + export const okuriAriMarker = ";; okuri-ari entries."; export const okuriNasiMarker = ";; okuri-nasi entries."; diff --git a/denops/skkeleton/dictionary_test.ts b/denops/skkeleton/dictionary_test.ts index 0d89f6b7..0bea3721 100644 --- a/denops/skkeleton/dictionary_test.ts +++ b/denops/skkeleton/dictionary_test.ts @@ -1,10 +1,13 @@ -import { dirname, fromFileUrl, join } from "./deps/std/path.ts"; import { assertEquals } from "./deps/std/assert.ts"; import { Dictionary, Library, wrapDictionary } from "./dictionary.ts"; import { Dictionary as SkkDictionary } from "./sources/skk_dictionary.ts"; import { Dictionary as DenoKvDictionary } from "./sources/deno_kv.ts"; import { Dictionary as UserDictionary } from "./sources/user_dictionary.ts"; +import { dirname } from "jsr:@std/path@~1.0.3/dirname"; +import { fromFileUrl } from "jsr:@std/path@~1.0.3/from-file-url"; +import { join } from "jsr:@std/path@~1.0.3/join"; + const newJisyoJson = join( dirname(fromFileUrl(import.meta.url)), "testdata", diff --git a/denops/skkeleton/testutil.ts b/denops/skkeleton/testutil.ts index dbb85906..5f88925d 100644 --- a/denops/skkeleton/testutil.ts +++ b/denops/skkeleton/testutil.ts @@ -1,11 +1,13 @@ import { autocmd, Denops } from "./deps.ts"; import * as DenopsTest from "./deps/denops_test.ts"; -import * as path from "./deps/std/path.ts"; import { main } from "./main.ts"; import { currentContext } from "./store.ts"; -const runtimepath = path.resolve( - path.fromFileUrl(new URL("../..", import.meta.url)), +import { fromFileUrl } from "jsr:@std/path@~1.0.3/from-file-url"; +import { resolve } from "jsr:@std/path@~1.0.3/resolve"; + +const runtimepath = resolve( + fromFileUrl(new URL("../..", import.meta.url)), ); // It is inspired from https://github.com/lambdalisue/gin.vim/blob/e737a4b59a9d391c49aaa07f7c4d91e4a29ae09c/denops/gin/util/testutil.ts diff --git a/denops/skkeleton/util.ts b/denops/skkeleton/util.ts index 463d9cda..18d24a0e 100644 --- a/denops/skkeleton/util.ts +++ b/denops/skkeleton/util.ts @@ -1,7 +1,9 @@ import { Denops, fn, op } from "./deps.ts"; -import { basename, parse } from "./deps/std/path.ts"; import { encoding } from "./deps/encoding_japanese.ts"; +import { basename } from "jsr:@std/path@~1.0.3/basename"; +import { parse } from "jsr:@std/path@~1.0.3/parse"; + export class Cell { initialized = false; initializer: () => T; From f3a890d4f26c806322868f336a11ec030a985b62 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 7 Sep 2024 12:46:38 +0900 Subject: [PATCH 02/11] Remove denops/skkeleton/deps/std/streams.ts --- denops/skkeleton/deps/std/streams.ts | 1 - denops/skkeleton/sources/skk_server.ts | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 denops/skkeleton/deps/std/streams.ts diff --git a/denops/skkeleton/deps/std/streams.ts b/denops/skkeleton/deps/std/streams.ts deleted file mode 100644 index 9fb58b9a..00000000 --- a/denops/skkeleton/deps/std/streams.ts +++ /dev/null @@ -1 +0,0 @@ -export { TextLineStream } from "jsr:@std/streams@~1.0.3/text-line-stream"; diff --git a/denops/skkeleton/sources/skk_server.ts b/denops/skkeleton/sources/skk_server.ts index 8288153a..9146e9c0 100644 --- a/denops/skkeleton/sources/skk_server.ts +++ b/denops/skkeleton/sources/skk_server.ts @@ -2,7 +2,6 @@ import { config } from "../config.ts"; import { encoding } from "../deps/encoding_japanese.ts"; import { Encode } from "../types.ts"; import { getKanaTable } from "../kana.ts"; -import { TextLineStream } from "../deps/std/streams.ts"; import { Dictionary as BaseDictionary, HenkanType, @@ -10,6 +9,8 @@ import { } from "../dictionary.ts"; import type { CompletionData, Encoding, SkkServerOptions } from "../types.ts"; +import { TextLineStream } from "jsr:@std/streams@~1.0.3/text-line-stream"; + type Server = { conn: Deno.Conn; readCallback: (result: string) => void; From 6c8c1fec6da48c97fcd1d8b822c7df10af466a87 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 7 Sep 2024 12:48:59 +0900 Subject: [PATCH 03/11] Remove denops/skkeleton/deps/std/collections.ts --- denops/skkeleton/deps/std/collections.ts | 1 - denops/skkeleton/dictionary.ts | 2 +- denops/skkeleton/kana.ts | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 denops/skkeleton/deps/std/collections.ts diff --git a/denops/skkeleton/deps/std/collections.ts b/denops/skkeleton/deps/std/collections.ts deleted file mode 100644 index 43c2dab1..00000000 --- a/denops/skkeleton/deps/std/collections.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "jsr:@std/collections@~1.0.5"; diff --git a/denops/skkeleton/dictionary.ts b/denops/skkeleton/dictionary.ts index 347192fc..778ddbad 100644 --- a/denops/skkeleton/dictionary.ts +++ b/denops/skkeleton/dictionary.ts @@ -1,10 +1,10 @@ import { config } from "./config.ts"; import { JpNum } from "./deps/japanese_numeral.ts"; import { RomanNum } from "./deps/roman.ts"; -import { zip } from "./deps/std/collections.ts"; import type { CompletionData, RankData } from "./types.ts"; import { toFileUrl } from "jsr:@std/path@~1.0.3/to-file-url"; +import { zip } from "jsr:@std/collections@~1.0.5/zip"; export const okuriAriMarker = ";; okuri-ari entries."; export const okuriNasiMarker = ";; okuri-nasi entries."; diff --git a/denops/skkeleton/kana.ts b/denops/skkeleton/kana.ts index a88c8fab..6ba41b75 100644 --- a/denops/skkeleton/kana.ts +++ b/denops/skkeleton/kana.ts @@ -1,5 +1,4 @@ import { config } from "./config.ts"; -import { distinctBy } from "./deps/std/collections.ts"; import { is, u } from "./deps/unknownutil.ts"; import { functions } from "./function.ts"; import { romToHira } from "./kana/rom_hira.ts"; @@ -7,6 +6,8 @@ import { romToZen } from "./kana/rom_zen.ts"; import type { KanaResult, KanaTable } from "./kana/type.ts"; import { Cell, readFileWithEncoding } from "./util.ts"; +import { distinctBy } from "jsr:@std/collections@~1.0.5/distinct-by"; + type PartialKanaTable = [string, KanaResult | null][]; const tables: Cell> = new Cell(() => ({ From 08552bc7884111b078bd132931115b15a7f50d28 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 7 Sep 2024 12:50:43 +0900 Subject: [PATCH 04/11] Remove denops/skkeleton/deps/std/async.ts --- denops/skkeleton/deps/std/async.ts | 1 - denops/skkeleton/sources/google_japanese_input.ts | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 denops/skkeleton/deps/std/async.ts diff --git a/denops/skkeleton/deps/std/async.ts b/denops/skkeleton/deps/std/async.ts deleted file mode 100644 index 903d9a33..00000000 --- a/denops/skkeleton/deps/std/async.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "jsr:@std/async@~1.0.4"; diff --git a/denops/skkeleton/sources/google_japanese_input.ts b/denops/skkeleton/sources/google_japanese_input.ts index 63358f8e..1027cd8c 100644 --- a/denops/skkeleton/sources/google_japanese_input.ts +++ b/denops/skkeleton/sources/google_japanese_input.ts @@ -5,7 +5,8 @@ import { Source as BaseSource, } from "../dictionary.ts"; import type { CompletionData } from "../types.ts"; -import { deadline } from "../deps/std/async.ts"; + +import { deadline } from "jsr:@std/async@~1.0.4/deadline"; export class Source implements BaseSource { getDictionaries(): Promise { From d73c609213aee98a8dc4f4d90286ea2df3167594 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 7 Sep 2024 12:52:00 +0900 Subject: [PATCH 05/11] Export assertEquals only --- denops/skkeleton/deps/std/assert.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/denops/skkeleton/deps/std/assert.ts b/denops/skkeleton/deps/std/assert.ts index 60f46a73..49ad0912 100644 --- a/denops/skkeleton/deps/std/assert.ts +++ b/denops/skkeleton/deps/std/assert.ts @@ -1 +1 @@ -export * from "jsr:@std/assert@~1.0.3"; +export { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; From 111b2c4bf8f39746cd6891cfb9765b6b8c0a49bb Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 7 Sep 2024 12:59:35 +0900 Subject: [PATCH 06/11] Remove denops/skkeleton/deps/unknownutil.ts --- denops/skkeleton/config.ts | 48 +++++++++++---------- denops/skkeleton/deps/unknownutil.ts | 2 - denops/skkeleton/kana.ts | 5 ++- denops/skkeleton/main.ts | 24 ++++++----- denops/skkeleton/notation.ts | 8 ++-- denops/skkeleton/sources/user_dictionary.ts | 6 ++- 6 files changed, 50 insertions(+), 43 deletions(-) delete mode 100644 denops/skkeleton/deps/unknownutil.ts diff --git a/denops/skkeleton/config.ts b/denops/skkeleton/config.ts index e3ff4cdd..6d59059a 100644 --- a/denops/skkeleton/config.ts +++ b/denops/skkeleton/config.ts @@ -1,9 +1,11 @@ import { Denops } from "./deps.ts"; -import { is, u } from "./deps/unknownutil.ts"; import { getKanaTable, loadKanaTableFiles } from "./kana.ts"; import { ConfigOptions, Encode, Encoding } from "./types.ts"; import { homeExpand } from "./util.ts"; +import { is } from "jsr:@core/unknownutil@~4.3.0/is"; +import { ensure } from "jsr:@core/unknownutil@~4.3.0/ensure"; + export const config: Omit & { globalDictionaries: [string, string][]; } = { @@ -47,11 +49,11 @@ function ensureEncoding(x: unknown): Encoding { } const validators: Validators = { - acceptIllegalResult: (x) => u.ensure(x, is.Boolean), - completionRankFile: (x) => u.ensure(x, is.String), - databasePath: (x) => u.ensure(x, is.String), - debug: (x) => u.ensure(x, is.Boolean), - eggLikeNewline: (x) => u.ensure(x, is.Boolean), + acceptIllegalResult: (x) => ensure(x, is.Boolean), + completionRankFile: (x) => ensure(x, is.String), + databasePath: (x) => ensure(x, is.String), + debug: (x) => ensure(x, is.Boolean), + eggLikeNewline: (x) => ensure(x, is.Boolean), globalDictionaries: (x): (string | [string, string])[] => { if ( !is.ArrayOf( @@ -78,11 +80,11 @@ const validators: Validators = { } return x; }, - immediatelyCancel: (x) => u.ensure(x, is.Boolean), - immediatelyDictionaryRW: (x) => u.ensure(x, is.Boolean), - immediatelyOkuriConvert: (x) => u.ensure(x, is.Boolean), + immediatelyCancel: (x) => ensure(x, is.Boolean), + immediatelyDictionaryRW: (x) => ensure(x, is.Boolean), + immediatelyOkuriConvert: (x) => ensure(x, is.Boolean), kanaTable: (x): string => { - const name = u.ensure(x, is.String); + const name = ensure(x, is.String); try { getKanaTable(name); } catch { @@ -90,33 +92,33 @@ const validators: Validators = { } return name; }, - keepMode: (x) => u.ensure(x, is.Boolean), - keepState: (x) => u.ensure(x, is.Boolean), - markerHenkan: (x) => u.ensure(x, is.String), - markerHenkanSelect: (x) => u.ensure(x, is.String), - registerConvertResult: (x) => u.ensure(x, is.Boolean), + keepMode: (x) => ensure(x, is.Boolean), + keepState: (x) => ensure(x, is.Boolean), + markerHenkan: (x) => ensure(x, is.String), + markerHenkanSelect: (x) => ensure(x, is.String), + registerConvertResult: (x) => ensure(x, is.Boolean), selectCandidateKeys: (x) => { - const keys = u.ensure(x, is.String); + const keys = ensure(x, is.String); if (keys.length !== 7) { throw TypeError("selectCandidateKeys.length !== 7"); } return keys; }, - setUndoPoint: (x) => u.ensure(x, is.Boolean), - showCandidatesCount: (x) => u.ensure(x, is.Number), - skkServerHost: (x) => u.ensure(x, is.String), - skkServerPort: (x) => u.ensure(x, is.Number), + setUndoPoint: (x) => ensure(x, is.Boolean), + showCandidatesCount: (x) => ensure(x, is.Number), + skkServerHost: (x) => ensure(x, is.String), + skkServerPort: (x) => ensure(x, is.Number), skkServerReqEnc: ensureEncoding, skkServerResEnc: ensureEncoding, - sources: (x) => u.ensure(x, is.ArrayOf(is.String)), + sources: (x) => ensure(x, is.ArrayOf(is.String)), useGoogleJapaneseInput: () => { throw '`useGoogleJapaneseInput` is removed. Please use `sources` with "google_japanese_input"'; }, - usePopup: (x) => u.ensure(x, is.Boolean), + usePopup: (x) => ensure(x, is.Boolean), useSkkServer: () => { throw '`useSkkServer` is removed. Please use `sources` with "skk_server"'; }, - userDictionary: (x) => u.ensure(x, is.String), + userDictionary: (x) => ensure(x, is.String), }; async function normalize( diff --git a/denops/skkeleton/deps/unknownutil.ts b/denops/skkeleton/deps/unknownutil.ts deleted file mode 100644 index 0c64f172..00000000 --- a/denops/skkeleton/deps/unknownutil.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * as u from "jsr:@core/unknownutil@~4.3.0"; -export { is } from "jsr:@core/unknownutil@~4.3.0/is"; diff --git a/denops/skkeleton/kana.ts b/denops/skkeleton/kana.ts index 6ba41b75..12185e5a 100644 --- a/denops/skkeleton/kana.ts +++ b/denops/skkeleton/kana.ts @@ -1,5 +1,4 @@ import { config } from "./config.ts"; -import { is, u } from "./deps/unknownutil.ts"; import { functions } from "./function.ts"; import { romToHira } from "./kana/rom_hira.ts"; import { romToZen } from "./kana/rom_zen.ts"; @@ -7,6 +6,8 @@ import type { KanaResult, KanaTable } from "./kana/type.ts"; import { Cell, readFileWithEncoding } from "./util.ts"; import { distinctBy } from "jsr:@std/collections@~1.0.5/distinct-by"; +import { is } from "jsr:@core/unknownutil@~4.3.0/is"; +import { assert } from "jsr:@core/unknownutil@~4.3.0/assert"; type PartialKanaTable = [string, KanaResult | null][]; @@ -53,7 +54,7 @@ export function registerKanaTable( console.log("skkeleton: new kana table"); console.log(`name: ${name}, table: ${Deno.inspect(rawTable)}`); } - u.assert(rawTable, is.Record); + assert(rawTable, is.Record); const table: PartialKanaTable = Object.entries(rawTable) .map(([kana, result]) => { return [kana, asKanaResult(result)]; diff --git a/denops/skkeleton/main.ts b/denops/skkeleton/main.ts index 9d5ba237..cb586b05 100644 --- a/denops/skkeleton/main.ts +++ b/denops/skkeleton/main.ts @@ -1,6 +1,5 @@ import { config, setConfig } from "./config.ts"; import { autocmd, Denops, Entrypoint, fn, vars } from "./deps.ts"; -import { is, u } from "./deps/unknownutil.ts"; import { functions, modeFunctions } from "./function.ts"; import { disable as disableFunc } from "./function/disable.ts"; import { load as loadDictionary } from "./dictionary.ts"; @@ -13,6 +12,9 @@ import { currentContext, currentLibrary, variables } from "./store.ts"; import { globpath } from "./util.ts"; import type { CompletionData, RankData } from "./types.ts"; +import { is } from "jsr:@core/unknownutil@~4.3.0/is"; +import { assert, AssertError } from "jsr:@core/unknownutil@~4.3.0/assert"; + type Opts = { key: string | string[]; function?: string; @@ -45,7 +47,7 @@ function isOpts(x: any): x is Opts { function assertOpts(x: unknown): asserts x is Opts { if (!isOpts(x)) { - throw new u.AssertError("value must be Opts"); + throw new AssertError("value must be Opts"); } } @@ -257,18 +259,18 @@ export const main: Entrypoint = async (denops) => { } denops.dispatcher = { async config(config: unknown) { - u.assert(config, is.Record); + assert(config, is.Record); await setConfig(config, denops); return; }, async registerKeyMap(state: unknown, key: unknown, funcName: unknown) { - u.assert(state, is.String); - u.assert(key, is.String); + assert(state, is.String); + assert(key, is.String); await receiveNotation(denops); registerKeyMap(state, key, funcName); }, registerKanaTable(tableName: unknown, table: unknown, create: unknown) { - u.assert(tableName, is.String); + assert(tableName, is.String); registerKanaTable(tableName, table, !!create); return Promise.resolve(); }, @@ -334,8 +336,8 @@ export const main: Entrypoint = async (denops) => { await denops.dispatcher.completeCallback(kana, word); }, async completeCallback(kana: unknown, word: unknown) { - u.assert(kana, is.String); - u.assert(word, is.String); + assert(kana, is.String); + assert(word, is.String); const lib = await currentLibrary.get(); await lib.registerHenkanResult("okurinasi", kana, word); const context = currentContext.get(); @@ -359,9 +361,9 @@ export const main: Entrypoint = async (denops) => { await currentLibrary.get(); }, async updateDatabase(path: unknown, encoding: unknown, force: unknown) { - u.assert(path, is.String); - u.assert(encoding, is.String); - u.assert(force, is.Boolean); + assert(path, is.String); + assert(encoding, is.String); + assert(force, is.Boolean); await DenoKvDictionary.create(path, encoding) .then((dict) => dict.load(force)); await denops.cmd(`echomsg 'updated database: "${path}"'`); diff --git a/denops/skkeleton/notation.ts b/denops/skkeleton/notation.ts index 3d9d28b5..2c7d3e63 100644 --- a/denops/skkeleton/notation.ts +++ b/denops/skkeleton/notation.ts @@ -1,5 +1,7 @@ import type { Denops } from "./deps.ts"; -import { is, u } from "./deps/unknownutil.ts"; + +import { is } from "jsr:@core/unknownutil@~4.3.0/is"; +import { assert } from "jsr:@core/unknownutil@~4.3.0/assert"; let received = false; export let notationToKey: Record = {}; @@ -10,10 +12,10 @@ export async function receiveNotation(denops: Denops) { return; } const n2k = await denops.eval("g:skkeleton#notation#notation_to_key"); - u.assert(n2k, is.RecordOf(is.String)); + assert(n2k, is.RecordOf(is.String)); notationToKey = n2k; const k2n = await denops.eval("g:skkeleton#notation#key_to_notation"); - u.assert(k2n, is.RecordOf(is.String)); + assert(k2n, is.RecordOf(is.String)); keyToNotation = k2n; received = true; } diff --git a/denops/skkeleton/sources/user_dictionary.ts b/denops/skkeleton/sources/user_dictionary.ts index 9d841f8e..5943af2a 100644 --- a/denops/skkeleton/sources/user_dictionary.ts +++ b/denops/skkeleton/sources/user_dictionary.ts @@ -11,7 +11,9 @@ import { UserDictionaryPath, } from "../dictionary.ts"; import { wrap } from "../deps/iterator_helpers.ts"; -import { is, u } from "../deps/unknownutil.ts"; + +import { is } from "jsr:@core/unknownutil@~4.3.0/is"; +import { assert } from "jsr:@core/unknownutil@~4.3.0/assert"; export class Source implements BaseSource { async getDictionaries(): Promise { @@ -166,7 +168,7 @@ export class Dictionary implements UserDictionary { return; } const rankData = JSON.parse(await Deno.readTextFile(rankPath)); - u.assert(rankData, is.ArrayOf(is.String)); + assert(rankData, is.ArrayOf(is.String)); this.#rank = new Map(rankData.map((c, i) => [c, i])); } From a9bbc82579659d10bd9500fc2d2bf185679a29cf Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 7 Sep 2024 12:59:55 +0900 Subject: [PATCH 07/11] Update yaml --- denops/skkeleton/deps/dictionary.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/denops/skkeleton/deps/dictionary.ts b/denops/skkeleton/deps/dictionary.ts index d8ed0da2..50bcb22a 100644 --- a/denops/skkeleton/deps/dictionary.ts +++ b/denops/skkeleton/deps/dictionary.ts @@ -1,4 +1,4 @@ -export * as yaml from "jsr:@std/yaml@1.0.4"; +export * as yaml from "jsr:@std/yaml@1.0.5"; export * as msgpack from "https://esm.sh/@msgpack/msgpack@3.0.0-beta2"; export { default as jsonschema } from "https://esm.sh/jsonschema@1.4.1"; export { default as jisyoschema } from "https://cdn.jsdelivr.net/gh/skk-dict/jisyo/schema/jisyo.schema.v0.0.0.json" with { type: "json" }; From 22ae56144bb10791e3836bcd894ba1832a7f3568 Mon Sep 17 00:00:00 2001 From: Shougo Date: Sat, 7 Sep 2024 13:21:49 +0900 Subject: [PATCH 08/11] Update denops/skkeleton/deps/dictionary.ts Co-authored-by: Hibiki <4513echo@gmail.com> --- denops/skkeleton/deps/dictionary.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/denops/skkeleton/deps/dictionary.ts b/denops/skkeleton/deps/dictionary.ts index 50bcb22a..301bdc01 100644 --- a/denops/skkeleton/deps/dictionary.ts +++ b/denops/skkeleton/deps/dictionary.ts @@ -1,4 +1,4 @@ -export * as yaml from "jsr:@std/yaml@1.0.5"; +export * as yaml from "jsr:@std/yaml@~1.0.5"; export * as msgpack from "https://esm.sh/@msgpack/msgpack@3.0.0-beta2"; export { default as jsonschema } from "https://esm.sh/jsonschema@1.4.1"; export { default as jisyoschema } from "https://cdn.jsdelivr.net/gh/skk-dict/jisyo/schema/jisyo.schema.v0.0.0.json" with { type: "json" }; From 1e18c8ec68416e1824d57ff25a33eab1562efaf9 Mon Sep 17 00:00:00 2001 From: Shougo Date: Sat, 7 Sep 2024 13:22:17 +0900 Subject: [PATCH 09/11] Update denops/skkeleton/deps/dictionary.ts Co-authored-by: Hibiki <4513echo@gmail.com> --- denops/skkeleton/deps/dictionary.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/denops/skkeleton/deps/dictionary.ts b/denops/skkeleton/deps/dictionary.ts index 301bdc01..66007c90 100644 --- a/denops/skkeleton/deps/dictionary.ts +++ b/denops/skkeleton/deps/dictionary.ts @@ -1,4 +1,4 @@ export * as yaml from "jsr:@std/yaml@~1.0.5"; -export * as msgpack from "https://esm.sh/@msgpack/msgpack@3.0.0-beta2"; -export { default as jsonschema } from "https://esm.sh/jsonschema@1.4.1"; +export * as msgpack from "npm:@msgpack/msgpack@3.0.0-beta2"; +export { default as jsonschema } from "npm:jsonschema@1.4.1"; export { default as jisyoschema } from "https://cdn.jsdelivr.net/gh/skk-dict/jisyo/schema/jisyo.schema.v0.0.0.json" with { type: "json" }; From 5371eab8d3aedf7b8b15f8fda8c262f55334dc51 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 7 Sep 2024 13:27:15 +0900 Subject: [PATCH 10/11] Remove denops/skkeleton/deps/std/assert.ts --- denops/skkeleton/config_test.ts | 3 ++- denops/skkeleton/deps/std/assert.ts | 1 - denops/skkeleton/dictionary_test.ts | 2 +- denops/skkeleton/function/common_test.ts | 3 ++- denops/skkeleton/function/dictionary_test.ts | 3 ++- denops/skkeleton/function/disable_test.ts | 3 ++- denops/skkeleton/function/henkan_test.ts | 3 ++- denops/skkeleton/function/input_test.ts | 3 ++- denops/skkeleton/function/mode_test.ts | 3 ++- denops/skkeleton/kana_test.ts | 6 ++++-- denops/skkeleton/keymap_test.ts | 6 ++++-- denops/skkeleton/preedit_test.ts | 3 ++- denops/skkeleton/util_test.ts | 3 ++- 13 files changed, 27 insertions(+), 15 deletions(-) delete mode 100644 denops/skkeleton/deps/std/assert.ts diff --git a/denops/skkeleton/config_test.ts b/denops/skkeleton/config_test.ts index 156a15e0..6bdc63df 100644 --- a/denops/skkeleton/config_test.ts +++ b/denops/skkeleton/config_test.ts @@ -1,13 +1,14 @@ import { config } from "./config.ts"; import { Context } from "./context.ts"; import { Denops } from "./deps.ts"; -import { assertEquals } from "./deps/std/assert.ts"; import { disable } from "./function/disable.ts"; import { katakana } from "./function/mode.ts"; import { dispatch } from "./function/testutil.ts"; import { currentContext, currentLibrary, variables } from "./store.ts"; import { test } from "./testutil.ts"; +import { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; + const defaultConfig = { ...config }; const lib = await currentLibrary.get(); diff --git a/denops/skkeleton/deps/std/assert.ts b/denops/skkeleton/deps/std/assert.ts deleted file mode 100644 index 49ad0912..00000000 --- a/denops/skkeleton/deps/std/assert.ts +++ /dev/null @@ -1 +0,0 @@ -export { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; diff --git a/denops/skkeleton/dictionary_test.ts b/denops/skkeleton/dictionary_test.ts index 0bea3721..82735e0a 100644 --- a/denops/skkeleton/dictionary_test.ts +++ b/denops/skkeleton/dictionary_test.ts @@ -1,9 +1,9 @@ -import { assertEquals } from "./deps/std/assert.ts"; import { Dictionary, Library, wrapDictionary } from "./dictionary.ts"; import { Dictionary as SkkDictionary } from "./sources/skk_dictionary.ts"; import { Dictionary as DenoKvDictionary } from "./sources/deno_kv.ts"; import { Dictionary as UserDictionary } from "./sources/user_dictionary.ts"; +import { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; import { dirname } from "jsr:@std/path@~1.0.3/dirname"; import { fromFileUrl } from "jsr:@std/path@~1.0.3/from-file-url"; import { join } from "jsr:@std/path@~1.0.3/join"; diff --git a/denops/skkeleton/function/common_test.ts b/denops/skkeleton/function/common_test.ts index 3dacd6ec..d582f06b 100644 --- a/denops/skkeleton/function/common_test.ts +++ b/denops/skkeleton/function/common_test.ts @@ -1,11 +1,12 @@ import { config } from "../config.ts"; import { Context } from "../context.ts"; -import { assertEquals } from "../deps/std/assert.ts"; import { currentLibrary } from "../store.ts"; import { cancel, kakutei, kakuteiKey } from "./common.ts"; import { katakana } from "./mode.ts"; import { dispatch } from "./testutil.ts"; +import { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; + const lib = await currentLibrary.get(); await lib.registerHenkanResult("okurinasi", "あ", "い"); diff --git a/denops/skkeleton/function/dictionary_test.ts b/denops/skkeleton/function/dictionary_test.ts index 785a2067..f4f7efb5 100644 --- a/denops/skkeleton/function/dictionary_test.ts +++ b/denops/skkeleton/function/dictionary_test.ts @@ -1,11 +1,12 @@ import { Denops } from "../deps.ts"; -import { assertEquals } from "../deps/std/assert.ts"; import { currentKanaTable, getKanaTable } from "../kana.ts"; import { HenkanState } from "../state.ts"; import { currentContext } from "../store.ts"; import { test } from "../testutil.ts"; import { registerWord } from "./dictionary.ts"; +import { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; + test({ mode: "all", name: "Don't put string when register dictionary was cancelled", diff --git a/denops/skkeleton/function/disable_test.ts b/denops/skkeleton/function/disable_test.ts index 0239fa1b..1168f24f 100644 --- a/denops/skkeleton/function/disable_test.ts +++ b/denops/skkeleton/function/disable_test.ts @@ -1,9 +1,10 @@ import { Denops } from "../deps.ts"; -import { assertEquals } from "../deps/std/assert.ts"; import { currentContext } from "../store.ts"; import { test } from "../testutil.ts"; import { dispatch } from "./testutil.ts"; +import { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; + // deno-lint-ignore no-explicit-any async function getResult(x: Promise): Promise { return (await x)?.result; diff --git a/denops/skkeleton/function/henkan_test.ts b/denops/skkeleton/function/henkan_test.ts index 4fbaaeac..2e27e05c 100644 --- a/denops/skkeleton/function/henkan_test.ts +++ b/denops/skkeleton/function/henkan_test.ts @@ -1,8 +1,9 @@ import { Context } from "../context.ts"; -import { assertEquals } from "../deps/std/assert.ts"; import { currentLibrary } from "../store.ts"; import { dispatch } from "./testutil.ts"; +import { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; + const l = await currentLibrary.get(); await l.registerHenkanResult("okurinasi", "へんかん", "返還"); await l.registerHenkanResult("okurinasi", "へんかん", "変換"); diff --git a/denops/skkeleton/function/input_test.ts b/denops/skkeleton/function/input_test.ts index 3e6c377e..5e79b8f4 100644 --- a/denops/skkeleton/function/input_test.ts +++ b/denops/skkeleton/function/input_test.ts @@ -1,13 +1,14 @@ import { config } from "../config.ts"; import { Context } from "../context.ts"; import { Denops, op } from "../deps.ts"; -import { assertEquals } from "../deps/std/assert.ts"; import { test } from "../testutil.ts"; import { kakutei } from "./common.ts"; import { deleteChar, henkanPoint } from "./input.ts"; import { hankatakana, katakana } from "./mode.ts"; import { dispatch } from "./testutil.ts"; +import { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; + Deno.test({ name: "kana input", async fn() { diff --git a/denops/skkeleton/function/mode_test.ts b/denops/skkeleton/function/mode_test.ts index 23a8920d..385a42ea 100644 --- a/denops/skkeleton/function/mode_test.ts +++ b/denops/skkeleton/function/mode_test.ts @@ -1,5 +1,4 @@ import { autocmd, Denops, vars } from "../deps.ts"; -import { assertEquals } from "../deps/std/assert.ts"; import { currentKanaTable } from "../kana.ts"; import { currentLibrary } from "../store.ts"; import { currentContext } from "../store.ts"; @@ -9,6 +8,8 @@ import { deleteChar, kanaInput } from "./input.ts"; import { abbrev, hankatakana, katakana, zenkaku } from "./mode.ts"; import { dispatch } from "./testutil.ts"; +import { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; + test({ mode: "all", name: "Can get skkeleton mode", diff --git a/denops/skkeleton/kana_test.ts b/denops/skkeleton/kana_test.ts index de0e2fc9..c13fd030 100644 --- a/denops/skkeleton/kana_test.ts +++ b/denops/skkeleton/kana_test.ts @@ -1,11 +1,13 @@ +import { Denops } from "./deps.ts"; import { config } from "./config.ts"; import { Context } from "./context.ts"; -import { assertEquals } from "./deps/std/assert.ts"; import { dispatch } from "./function/testutil.ts"; import { registerKanaTable } from "./kana.ts"; import { currentContext } from "./store.ts"; import { test } from "./testutil.ts"; +import { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; + Deno.test({ name: "customize kanatable", async fn() { @@ -34,7 +36,7 @@ Deno.test({ test({ mode: "all", name: "create kanatable", - async fn(denops) { + async fn(denops: Denops) { registerKanaTable("test", { a: ["hoge", ""], }, true); diff --git a/denops/skkeleton/keymap_test.ts b/denops/skkeleton/keymap_test.ts index 928f1a84..c3b2c922 100644 --- a/denops/skkeleton/keymap_test.ts +++ b/denops/skkeleton/keymap_test.ts @@ -1,12 +1,14 @@ +import { Denops } from "./deps.ts"; import { test } from "./testutil.ts"; -import { assertEquals } from "./deps/std/assert.ts"; import { currentLibrary } from "./store.ts"; import { currentContext } from "./store.ts"; +import { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; + test({ mode: "nvim", // can input mode test only in nvim name: "registerKeyMap", - async fn(denops) { + async fn(denops: Denops) { const lib = await currentLibrary.get(); lib.registerHenkanResult("okurinasi", "あ", "亜"); await denops.cmd('call skkeleton#register_keymap("henkan", "x", "")'); diff --git a/denops/skkeleton/preedit_test.ts b/denops/skkeleton/preedit_test.ts index d72f7054..b23b9662 100644 --- a/denops/skkeleton/preedit_test.ts +++ b/denops/skkeleton/preedit_test.ts @@ -1,6 +1,7 @@ -import { assertEquals } from "./deps/std/assert.ts"; import { PreEdit } from "./preedit.ts"; +import { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; + Deno.test({ name: "preedit test", fn() { diff --git a/denops/skkeleton/util_test.ts b/denops/skkeleton/util_test.ts index da764ea3..2a9d9ea5 100644 --- a/denops/skkeleton/util_test.ts +++ b/denops/skkeleton/util_test.ts @@ -1,6 +1,7 @@ -import { assertEquals } from "./deps/std/assert.ts"; import { LazyCell } from "./util.ts"; +import { assertEquals } from "jsr:@std/assert@~1.0.3/equals"; + Deno.test({ name: "LazyCell", async fn(t) { From f8c0d309897c8586ac1b53517d6a9f952f33aaee Mon Sep 17 00:00:00 2001 From: kuuote Date: Tue, 10 Sep 2024 11:44:04 +0900 Subject: [PATCH 11/11] Remove esm.sh dependencies --- denops/skkeleton/deps/encoding_japanese.ts | 1 - denops/skkeleton/deps/japanese_numeral.ts | 1 - denops/skkeleton/deps/roman.ts | 1 - denops/skkeleton/dictionary.ts | 8 ++++---- denops/skkeleton/sources/skk_server.ts | 6 +++--- denops/skkeleton/util.ts | 2 +- 6 files changed, 8 insertions(+), 11 deletions(-) delete mode 100644 denops/skkeleton/deps/encoding_japanese.ts delete mode 100644 denops/skkeleton/deps/japanese_numeral.ts delete mode 100644 denops/skkeleton/deps/roman.ts diff --git a/denops/skkeleton/deps/encoding_japanese.ts b/denops/skkeleton/deps/encoding_japanese.ts deleted file mode 100644 index 34719122..00000000 --- a/denops/skkeleton/deps/encoding_japanese.ts +++ /dev/null @@ -1 +0,0 @@ -export * as encoding from "https://esm.sh/encoding-japanese@2.2.0/"; diff --git a/denops/skkeleton/deps/japanese_numeral.ts b/denops/skkeleton/deps/japanese_numeral.ts deleted file mode 100644 index ce8ba401..00000000 --- a/denops/skkeleton/deps/japanese_numeral.ts +++ /dev/null @@ -1 +0,0 @@ -export * as JpNum from "https://esm.sh/@geolonia/japanese-numeral@1.0.2"; diff --git a/denops/skkeleton/deps/roman.ts b/denops/skkeleton/deps/roman.ts deleted file mode 100644 index ddb673bd..00000000 --- a/denops/skkeleton/deps/roman.ts +++ /dev/null @@ -1 +0,0 @@ -export * as RomanNum from "https://esm.sh/cr-numeral@1.1.3"; diff --git a/denops/skkeleton/dictionary.ts b/denops/skkeleton/dictionary.ts index 778ddbad..ed9e77f2 100644 --- a/denops/skkeleton/dictionary.ts +++ b/denops/skkeleton/dictionary.ts @@ -1,7 +1,7 @@ import { config } from "./config.ts"; -import { JpNum } from "./deps/japanese_numeral.ts"; -import { RomanNum } from "./deps/roman.ts"; import type { CompletionData, RankData } from "./types.ts"; +import { number2kanji } from "npm:@geolonia/japanese-numeral@1.0.2"; +import { convertNumberToRoman } from "npm:cr-numeral@1.1.3"; import { toFileUrl } from "jsr:@std/path@~1.0.3/to-file-url"; import { zip } from "jsr:@std/collections@~1.0.5/zip"; @@ -55,8 +55,8 @@ function toKanjiModern(n: number): string { return kanjiNumbers[parseInt(c)]; }); } -const toRoman: (n: number) => string = RomanNum.convertNumberToRoman; -const toKanjiClassic: (n: number) => string = JpNum.number2kanji; +const toRoman: (n: number) => string = convertNumberToRoman; +const toKanjiClassic: (n: number) => string = number2kanji; function toDaiji(n: number): string { return toKanjiClassic(n) diff --git a/denops/skkeleton/sources/skk_server.ts b/denops/skkeleton/sources/skk_server.ts index 9146e9c0..f5cff6fe 100644 --- a/denops/skkeleton/sources/skk_server.ts +++ b/denops/skkeleton/sources/skk_server.ts @@ -1,13 +1,13 @@ import { config } from "../config.ts"; -import { encoding } from "../deps/encoding_japanese.ts"; -import { Encode } from "../types.ts"; -import { getKanaTable } from "../kana.ts"; import { Dictionary as BaseDictionary, HenkanType, Source as BaseSource, } from "../dictionary.ts"; +import { getKanaTable } from "../kana.ts"; +import { Encode } from "../types.ts"; import type { CompletionData, Encoding, SkkServerOptions } from "../types.ts"; +import * as encoding from "npm:encoding-japanese@2.2.0"; import { TextLineStream } from "jsr:@std/streams@~1.0.3/text-line-stream"; diff --git a/denops/skkeleton/util.ts b/denops/skkeleton/util.ts index 18d24a0e..2a304646 100644 --- a/denops/skkeleton/util.ts +++ b/denops/skkeleton/util.ts @@ -1,5 +1,5 @@ import { Denops, fn, op } from "./deps.ts"; -import { encoding } from "./deps/encoding_japanese.ts"; +import * as encoding from "npm:encoding-japanese@2.2.0"; import { basename } from "jsr:@std/path@~1.0.3/basename"; import { parse } from "jsr:@std/path@~1.0.3/parse";