From 2d4a93fa01d4298f4ab91c2babd6d0b1698b3efa Mon Sep 17 00:00:00 2001 From: hasundue Date: Fri, 1 Mar 2024 10:36:30 +0900 Subject: [PATCH] refactor(lib/update): simplify `map` property --- lib/update.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/update.ts b/lib/update.ts index 63989bd6..4923e48c 100644 --- a/lib/update.ts +++ b/lib/update.ts @@ -8,7 +8,11 @@ import { type ModuleJson, } from "./x/deno_graph.ts"; import { findFileUp, toPath, toUrl } from "./path.ts"; -import { ImportMap, tryReadFromJson } from "./import_map.ts"; +import { + ImportMap, + ImportMapResolveResult, + tryReadFromJson, +} from "./import_map.ts"; import { type Dependency, parse, @@ -43,11 +47,7 @@ export interface DependencyUpdate { /** The full path to the import map used to resolve the dependency. * @example "/path/to/import_map.json" */ source: string; - /** The string in the dependency specifier being replaced */ - key?: string; - /** The fully resolved specifier (URL) of the dependency. */ - resolved: string; - }; + } & ImportMapResolveResult; } class DenoGraph { @@ -233,8 +233,7 @@ async function create( map: mapped ? { source: options!.importMap!.path, - key: mapped.key, - resolved: mapped.resolved, + ...mapped, } : undefined, };