@@ -10,6 +10,8 @@ INTERFACE |denops-interface|
10
10
VARIABLE | denops-variable |
11
11
FUNCTION | denops-function |
12
12
AUTOCMD | denops-autocmd |
13
+ DEVELOPMENT | denops-development |
14
+ IMPORT MAPS | denops-import-maps |
13
15
14
16
15
17
=============================================================================
@@ -528,5 +530,130 @@ DenopsProcessStopped:{exitcode} *DenopsProcessStopped*
528
530
Fired when the Denops local server process is stopped.
529
531
It is never fired in shared server mode.
530
532
533
+
534
+ =============================================================================
535
+ DEVELOPMENT *denops-development*
536
+
537
+ This section provides information for denops plugin developers.
538
+
539
+ For comprehensive development guides, visit:
540
+ - Denops Document: https://vim-denops.github.io/denops-documentation/
541
+ - Wiki: https://github.com/vim-denops/denops.vim/wiki
542
+ - API Reference: https://jsr.io/@denops/std
543
+
544
+ -----------------------------------------------------------------------------
545
+ IMPORT MAPS *denops-import-maps*
546
+
547
+ Denops supports import maps to help plugin developers manage dependencies
548
+ more effectively. Import maps allow you to define module specifiers and their
549
+ corresponding URLs, making dependency management and version control easier.
550
+
551
+ When loading a denops plugin, the system automatically searches for import
552
+ map files in the plugin directory. If found, the import map is used to
553
+ resolve module specifiers during plugin import.
554
+
555
+ Workspace Configuration ~
556
+
557
+ For projects with a `deno.json` or `deno.jsonc` file in the root directory,
558
+ you can use the "workspace" field to enable Deno development tools to work
559
+ across plugin directories while maintaining separate dependency configurations:
560
+ >json
561
+ {
562
+ "workspace": [
563
+ "./denops/my-plugin"
564
+ ]
565
+ }
566
+ <
567
+
568
+ This prevents configuration conflicts between multiple plugins while allowing
569
+ unified development tooling (`deno fmt`, `deno lint`, `deno test`) to run
570
+ from the project root.
571
+
572
+ Supported Files ~
573
+
574
+ The import map feature searches for the following files in order:
575
+
576
+ 1. `deno.json`
577
+ 2. `deno.jsonc` (JSONC with comments support)
578
+ 3. `import_map.json`
579
+ 4. `import_map.jsonc` (JSONC with comments support)
580
+
581
+ The first file found will be used as the import map for the plugin.
582
+
583
+ File Format ~
584
+
585
+ Import map files should contain an "imports" field that maps module
586
+ specifiers to their corresponding URLs:
587
+ >json
588
+ {
589
+ "imports": {
590
+ "@std/path": "jsr:@std/path@^1.0.2",
591
+ "@std/async": "jsr:@std/async@^1.0.1",
592
+ "@test/": "../",
593
+ "@test/helper": "./helper.ts"
594
+ }
595
+ }
596
+ <
597
+
598
+ JSONC format supports comments for better documentation:
599
+ >jsonc
600
+ {
601
+ // Import map configuration for MyPlugin
602
+ "imports": {
603
+ // Standard library dependencies
604
+ "@std/path": "jsr:@std/path@^1.0.2",
605
+ "@std/async": "jsr:@std/async@^1.0.1",
606
+
607
+ // Local utilities
608
+ "@test/": "../",
609
+ "@test/helper": "./helper.ts"
610
+ }
611
+ }
612
+ <
613
+
614
+ Usage in Plugins ~
615
+
616
+ Once an import map is configured, you can use the mapped specifiers in your
617
+ plugin code:
618
+ >typescript
619
+ import type { Denops } from "@denops/core";
620
+ import { join } from "@std/path";
621
+ import { delay } from "@std/async";
622
+ import { helper } from "@test/helper";
623
+
624
+ export async function main(denops: Denops): Promise<void> {
625
+ const configPath = join(
626
+ await denops.call("stdpath", "config"),
627
+ "plugin.json"
628
+ );
629
+ await delay(100);
630
+ helper.doSomething();
631
+ }
632
+ <
633
+
634
+ Limitations ~
635
+
636
+ - Import map files must be located in the same directory as the plugin's
637
+ main file.
638
+
639
+ Example Plugin Structure ~
640
+ >
641
+ my-vim-plugin/
642
+ ├── deno.json
643
+ └── denops/
644
+ └── my-plugin/
645
+ ├── main.ts
646
+ ├── lib/
647
+ │ └── utils.ts
648
+ └── deno.json
649
+ <
650
+
651
+ Implementation Details ~
652
+
653
+ - The feature uses the `@l ambdalisue/import - map -importer ` library internally
654
+ - Import maps are loaded automatically when the plugin is imported
655
+ - JSONC parsing is handled using Deno's standard library
656
+
657
+
531
658
=============================================================================
532
659
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl
0 commit comments