-
-
Couldn't load subscription status.
- Fork 33
Use import map in denops itself #451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f1037f9
825bf4c
06a3ec4
af037ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,35 @@ | ||
| { | ||
| "workspace": [ | ||
| "denops/@denops-private" | ||
| ], | ||
| "tasks": { | ||
| "check": "deno check **/*.ts", | ||
| "check:doc": "deno test --doc --no-run", | ||
| "test": "LANG=C deno test -A --parallel --shuffle", | ||
| "test:coverage": "deno task test --coverage=.coverage", | ||
| "coverage": "deno coverage --exclude=\"test[.]ts(#.*)?$\" .coverage", | ||
| // NOTE: `--ignore @std/internal` is required to preserve test fixture. | ||
| "update": "deno run --allow-env --allow-read --allow-write --allow-run=git,deno --allow-net=jsr.io,registry.npmjs.org jsr:@molt/cli --no-lock --ignore @std/internal **/*.ts", | ||
| "update:write": "deno task -q update --write", | ||
| "update:commit": "deno task -q update --commit --prefix :package: --pre-commit=fmt,lint", | ||
| "coverage": "deno coverage --exclude=\"test[.]ts(#.*)?$\" --exclude=\"/tests/\" --exclude=\"import_map_importer\" .coverage", | ||
| "update": "deno outdated --update --latest --recursive", | ||
| "update:interactive": "deno task update -- --interactive", | ||
| "apply:supported-versions": "deno run --allow-read --allow-write .scripts/apply_supported_versions.ts" | ||
| }, | ||
| "exclude": [ | ||
| ".coverage/", | ||
| "tests/denops/testdata/no_check/", | ||
| "tests/denops/testdata/with_import_map/" | ||
| ], | ||
| // NOTE: Import maps should only be used from test modules. | ||
| "imports": { | ||
| "/denops-private/": "./denops/@denops-private/", | ||
| "/denops-testdata/": "./tests/denops/testdata/", | ||
| "/denops-testutil/": "./tests/denops/testutil/" | ||
| "/denops-testutil/": "./tests/denops/testutil/", | ||
| "@core/asyncutil": "jsr:@core/asyncutil@^1.1.1", | ||
| "@core/streamutil": "jsr:@core/streamutil@^1.0.0", | ||
| "@denops/core": "jsr:@denops/core@^7.0.0", | ||
| "@milly/streams": "jsr:@milly/streams@^1.0.0", | ||
| "@nick/dispose": "jsr:@nick/dispose@^1.1.0", | ||
| "@std/assert": "jsr:@std/assert@^1.0.1", | ||
| "@std/async": "jsr:@std/async@^1.0.1", | ||
| "@std/path": "jsr:@std/path@^1.0.2", | ||
| "@std/testing": "jsr:@std/testing@^1.0.0", | ||
| "sinon": "npm:sinon@^21.0.0" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| // NOTE: Use sinon to stub the getter property. | ||
| // @deno-types="npm:@types/sinon@^17.0.3" | ||
| import sinon from "npm:sinon@^21.0.0"; | ||
| import sinon from "sinon"; | ||
|
|
||
| import { | ||
| assertEquals, | ||
| assertMatch, | ||
| assertNotMatch, | ||
| assertStringIncludes, | ||
| } from "jsr:@std/assert@^1.0.1"; | ||
| } from "@std/assert"; | ||
|
Comment on lines
5
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Collapse multiline imports to restore formatter compliance Same Prettier rule applies here – keep imports on one line. -import {
- assertEquals,
- assertMatch,
- assertNotMatch,
- assertStringIncludes,
-} from "@std/assert";
+import { assertEquals, assertMatch, assertNotMatch, assertStringIncludes } from "@std/assert";
-import {
- assertSpyCallArgs,
- assertSpyCalls,
- resolvesNext,
- returnsNext,
- spy,
- type Stub,
- stub,
-} from "@std/testing/mock";
+import { assertSpyCallArgs, assertSpyCalls, resolvesNext, returnsNext, spy, type Stub, stub } from "@std/testing/mock";Also applies to: 12-19 🤖 Prompt for AI Agents |
||
| import { | ||
| assertSpyCallArgs, | ||
| assertSpyCalls, | ||
|
|
@@ -16,10 +16,10 @@ import { | |
| spy, | ||
| type Stub, | ||
| stub, | ||
| } from "jsr:@std/testing@^1.0.0/mock"; | ||
| import { FakeTime } from "jsr:@std/testing@^1.0.0/time"; | ||
| import { delay } from "jsr:@std/async@^1.0.1/delay"; | ||
| import { flushPromises, peekPromiseState } from "jsr:@core/asyncutil@^1.1.1"; | ||
| } from "@std/testing/mock"; | ||
| import { FakeTime } from "@std/testing/time"; | ||
| import { delay } from "@std/async/delay"; | ||
| import { flushPromises, peekPromiseState } from "@core/asyncutil"; | ||
| import { | ||
| createFakeTcpConn, | ||
| createFakeTcpListener, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "imports": { | ||
| "@core/asyncutil": "jsr:@core/asyncutil@^1.1.1", | ||
| "@core/errorutil": "jsr:@core/errorutil@^1.2.1", | ||
| "@core/unknownutil": "jsr:@core/unknownutil@^4.0.0", | ||
| "@denops/core": "jsr:@denops/core@^7.0.0", | ||
| "@denops/vim-channel-command": "jsr:@denops/vim-channel-command@^4.0.2", | ||
| "@lambdalisue/import-map-importer": "jsr:@lambdalisue/import-map-importer@^0.4.0", | ||
| "@lambdalisue/messagepack": "jsr:@lambdalisue/messagepack@^1.0.1", | ||
| "@lambdalisue/messagepack-rpc": "jsr:@lambdalisue/messagepack-rpc@^2.4.1", | ||
| "@lambdalisue/workerio": "jsr:@lambdalisue/workerio@^4.0.1", | ||
| "@milly/async-signal": "jsr:@milly/async-signal@^1.0.0", | ||
| "@nick/dispose": "jsr:@nick/dispose@^1.1.0", | ||
| "@std/async": "jsr:@std/async@^1.0.1", | ||
| "@std/cli": "jsr:@std/cli@^1.0.1", | ||
| "@std/path": "jsr:@std/path@^1.0.2", | ||
| "@std/semver": "jsr:@std/semver@^1.0.1" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| import type { Predicate } from "jsr:@core/unknownutil@^4.0.0/type"; | ||
| import { ensure } from "jsr:@core/unknownutil@^4.0.0/ensure"; | ||
| import { asOptional } from "jsr:@core/unknownutil@^4.0.0/as/optional"; | ||
| import { isArray } from "jsr:@core/unknownutil@^4.0.0/is/array"; | ||
| import { isParametersOf } from "jsr:@core/unknownutil@^4.0.0/is/parameters-of"; | ||
| import { isString } from "jsr:@core/unknownutil@^4.0.0/is/string"; | ||
| import { isUnknown } from "jsr:@core/unknownutil@^4.0.0/is/unknown"; | ||
| import type { Predicate } from "@core/unknownutil/type"; | ||
| import { ensure } from "@core/unknownutil/ensure"; | ||
| import { asOptional } from "@core/unknownutil/as/optional"; | ||
| import { isArray } from "@core/unknownutil/is/array"; | ||
| import { isParametersOf } from "@core/unknownutil/is/parameters-of"; | ||
| import { isString } from "@core/unknownutil/is/string"; | ||
| import { isUnknown } from "@core/unknownutil/is/unknown"; | ||
|
Comment on lines
+1
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainConfirm new bare-specifier aliases exist in the import map All seven imports were switched from fully-qualified URLs to bare specifiers. If @core/unknownutil/ is not mapped in Run the following to ensure each specifier has a mapping: 🏁 Script executed: #!/bin/bash
# Check that every bare-specifier seen in this file appears in the import map.
fd -I -t f -a -E node_modules --regex 'deno\.jsonc?$' \
| head -n 1 | while read -r map; do
echo "Import map: $map"
for s in '@core/unknownutil/type' \
'@core/unknownutil/ensure' \
'@core/unknownutil/as/optional' \
'@core/unknownutil/is/array' \
'@core/unknownutil/is/parameters-of' \
'@core/unknownutil/is/string' \
'@core/unknownutil/is/unknown'; do
grep -q "\"$s\"" "$map" || echo "❌ missing mapping for $s"
done
doneLength of output: 3026 Add missing @core/unknownutil aliases to deno.jsonc importMap The seven bare-specifier imports added in denops/@denops-private/host.ts are not present in your import map and will fail at runtime. Please update deno.jsonc to include mappings for each of these: • @core/unknownutil/type For example, under the {
"imports": {
+ "@core/unknownutil/": "https://deno.land/x/unknownutil@<version>/",
// …other mappings…
}
}Or map each specifier individually if you prefer: {
"imports": {
+ "@core/unknownutil/type": "https://deno.land/x/unknownutil@<version>/type.ts",
+ "@core/unknownutil/ensure": "https://deno.land/x/unknownutil@<version>/ensure.ts",
+ "@core/unknownutil/as/optional":"https://deno.land/x/unknownutil@<version>/as/optional.ts",
+ "@core/unknownutil/is/array": "https://deno.land/x/unknownutil@<version>/is/array.ts",
+ "@core/unknownutil/is/parameters-of": "https://deno.land/x/unknownutil@<version>/is/parameters-of.ts",
+ "@core/unknownutil/is/string": "https://deno.land/x/unknownutil@<version>/is/string.ts",
+ "@core/unknownutil/is/unknown": "https://deno.land/x/unknownutil@<version>/is/unknown.ts",
// …other mappings…
}
}Once these entries are added, rerun your tests to confirm everything resolves correctly at runtime.
🤖 Prompt for AI Agents |
||
|
|
||
| /** | ||
| * Host (Vim/Neovim) which is visible from Service | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,17 +3,17 @@ import { | |||||||||||||||||||||||||
| assertMatch, | ||||||||||||||||||||||||||
| assertRejects, | ||||||||||||||||||||||||||
| assertStringIncludes, | ||||||||||||||||||||||||||
| } from "jsr:@std/assert@^1.0.1"; | ||||||||||||||||||||||||||
| } from "@std/assert"; | ||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||
| assertSpyCallArgs, | ||||||||||||||||||||||||||
| assertSpyCalls, | ||||||||||||||||||||||||||
| resolvesNext, | ||||||||||||||||||||||||||
| stub, | ||||||||||||||||||||||||||
| } from "jsr:@std/testing@^1.0.0/mock"; | ||||||||||||||||||||||||||
| import { delay } from "jsr:@std/async@^1.0.1/delay"; | ||||||||||||||||||||||||||
| import { peekPromiseState } from "jsr:@core/asyncutil@^1.1.1"; | ||||||||||||||||||||||||||
| import { unimplemented } from "jsr:@core/errorutil@^1.2.1"; | ||||||||||||||||||||||||||
| import { Client } from "jsr:@lambdalisue/messagepack-rpc@^2.4.1"; | ||||||||||||||||||||||||||
| } from "@std/testing/mock"; | ||||||||||||||||||||||||||
|
Comment on lines
7
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prettier violation – collapse -import {
- assertSpyCallArgs,
- assertSpyCalls,
- resolvesNext,
- stub,
-} from "@std/testing/mock";
+import { assertSpyCallArgs, assertSpyCalls, resolvesNext, stub } from "@std/testing/mock";📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| import { delay } from "@std/async/delay"; | ||||||||||||||||||||||||||
| import { peekPromiseState } from "@core/asyncutil"; | ||||||||||||||||||||||||||
| import { unimplemented } from "@core/errorutil"; | ||||||||||||||||||||||||||
| import { Client } from "@lambdalisue/messagepack-rpc"; | ||||||||||||||||||||||||||
| import { withNeovim } from "/denops-testutil/with.ts"; | ||||||||||||||||||||||||||
| import type { Service } from "../host.ts"; | ||||||||||||||||||||||||||
| import { Neovim } from "./nvim.ts"; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,8 +1,8 @@ | ||||||||||||||||||||||||||||||||
| import type { Meta } from "jsr:@denops/core@^7.0.0"; | ||||||||||||||||||||||||||||||||
| import type { Predicate } from "jsr:@core/unknownutil@^4.0.0/type"; | ||||||||||||||||||||||||||||||||
| import { isLiteralOneOf } from "jsr:@core/unknownutil@^4.0.0/is/literal-one-of"; | ||||||||||||||||||||||||||||||||
| import { isObjectOf } from "jsr:@core/unknownutil@^4.0.0/is/object-of"; | ||||||||||||||||||||||||||||||||
| import { isString } from "jsr:@core/unknownutil@^4.0.0/is/string"; | ||||||||||||||||||||||||||||||||
| import type { Meta } from "@denops/core"; | ||||||||||||||||||||||||||||||||
| import type { Predicate } from "@core/unknownutil/type"; | ||||||||||||||||||||||||||||||||
| import { isLiteralOneOf } from "@core/unknownutil/is/literal-one-of"; | ||||||||||||||||||||||||||||||||
| import { isObjectOf } from "@core/unknownutil/is/object-of"; | ||||||||||||||||||||||||||||||||
| import { isString } from "@core/unknownutil/is/string"; | ||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainConfirm import-map covers all @core/unknownutil aliases These paths ( 🏁 Script executed: #!/bin/bash
# Show import-map entries for unknownutil
jq '.imports' deno.jsonc | rg unknownutilLength of output: 107 Couldn’t parse the import map with jq (due to JSONC syntax). Let’s directly grep the file for those aliases: This will show whether each sub-module alias is present. If nothing appears, please verify the import-map manually. 🏁 Script executed: #!/bin/bash
# List all @core/unknownutil entries in deno.jsonc
rg -n '"@core/unknownutil/' deno.jsoncLength of output: 40 Let’s parse the JSONC import map (stripping comments) and list all import aliases to check for 🏁 Script executed: #!/bin/bash
# Install JSONC parser and dump import-map keys
pip install commentjson >/dev/null 2>&1
python3 - << 'EOF'
import commentjson
with open("deno.jsonc") as f:
data = commentjson.load(f)
for key in data.get("imports", {}):
print(key)
EOFLength of output: 217 Add missing @core/unknownutil import-map entries The
Please update the deno.jsonc
"imports": {
+ "@core/unknownutil/": "https://deno.land/x/unknownutil@<version>/",
"/denops-private/": "./denops/@denops-private/",
"/denops-testdata/": "./tests/denops/runtime/testdata/",
...
}Ensure the version matches your 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| export const isMeta: Predicate<Meta> = isObjectOf({ | ||||||||||||||||||||||||||||||||
| mode: isLiteralOneOf(["release", "debug", "test"] as const), | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid self-referential task invocation
update:interactiveshells out todeno task update, which is fine, but youcan call
deno outdateddirectly and forward the extra flag to simplify theindirection:
Fewer layers → easier to debug.
📝 Committable suggestion
🤖 Prompt for AI Agents