File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 66 "@core/unknownutil" : " jsr:@core/unknownutil@^4.0.0" ,
77 "@denops/core" : " jsr:@denops/core@^7.0.0" ,
88 "@denops/vim-channel-command" : " jsr:@denops/vim-channel-command@^4.0.2" ,
9- "@lambdalisue/import-map-importer" : " jsr:@lambdalisue/import-map-importer@^0.4 .0" ,
9+ "@lambdalisue/import-map-importer" : " jsr:@lambdalisue/import-map-importer@^0.5 .0" ,
1010 "@lambdalisue/messagepack" : " jsr:@lambdalisue/messagepack@^1.0.1" ,
1111 "@lambdalisue/messagepack-rpc" : " jsr:@lambdalisue/messagepack-rpc@^2.4.1" ,
1212 "@lambdalisue/workerio" : " jsr:@lambdalisue/workerio@^4.0.1" ,
1313 "@milly/async-signal" : " jsr:@milly/async-signal@^1.0.0" ,
1414 "@nick/dispose" : " jsr:@nick/dispose@^1.1.0" ,
1515 "@std/async" : " jsr:@std/async@^1.0.1" ,
1616 "@std/cli" : " jsr:@std/cli@^1.0.1" ,
17+ "@std/jsonc" : " jsr:@std/jsonc@^1.0.2" ,
1718 "@std/path" : " jsr:@std/path@^1.0.2" ,
1819 "@std/semver" : " jsr:@std/semver@^1.0.1"
1920 }
Original file line number Diff line number Diff line change @@ -2,12 +2,15 @@ import type { Denops, Entrypoint } from "@denops/core";
22import {
33 type ImportMap ,
44 ImportMapImporter ,
5+ isImportMap ,
56 loadImportMap ,
67} from "@lambdalisue/import-map-importer" ;
8+ import { ensure } from "@core/unknownutil" ;
79import { toFileUrl } from "@std/path/to-file-url" ;
810import { fromFileUrl } from "@std/path/from-file-url" ;
911import { join } from "@std/path/join" ;
1012import { dirname } from "@std/path/dirname" ;
13+ import { parse as parseJsonc } from "@std/jsonc" ;
1114
1215type PluginModule = {
1316 main : Entrypoint ;
@@ -165,7 +168,12 @@ async function tryLoadImportMap(
165168 for ( const pattern of PATTERNS ) {
166169 const importMapPath = join ( parentDir , pattern ) ;
167170 try {
168- return await loadImportMap ( importMapPath ) ;
171+ return await loadImportMap ( importMapPath , {
172+ loader : ( path : string ) => {
173+ const content = Deno . readTextFileSync ( path ) ;
174+ return ensure ( parseJsonc ( content ) , isImportMap ) ;
175+ } ,
176+ } ) ;
169177 } catch ( err : unknown ) {
170178 if ( err instanceof Deno . errors . NotFound ) {
171179 // Ignore NotFound errors and try the next pattern
You can’t perform that action at this time.
0 commit comments