From 41f5384ff566207a2860c2892753b8ec0622232c Mon Sep 17 00:00:00 2001 From: Nemo Date: Tue, 27 Feb 2024 16:25:01 +0900 Subject: [PATCH 1/2] refactor: extract `ts_morph` --- deps/ts_morph_common.ts | 1 + graph/fs.ts | 2 +- utils/project.ts | 2 +- utils/resolution_host.ts | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 deps/ts_morph_common.ts diff --git a/deps/ts_morph_common.ts b/deps/ts_morph_common.ts new file mode 100644 index 0000000..a0b12d9 --- /dev/null +++ b/deps/ts_morph_common.ts @@ -0,0 +1 @@ +export * from "https://deno.land/x/ts_morph@21.0.1/common/mod.ts" diff --git a/graph/fs.ts b/graph/fs.ts index 3b1bce2..14d97d7 100644 --- a/graph/fs.ts +++ b/graph/fs.ts @@ -1,4 +1,4 @@ -import { RealFileSystemHost } from "https://deno.land/x/ts_morph@21.0.1/common/mod.ts" +import { RealFileSystemHost } from "../deps/ts_morph_common.ts" /** * Intercepts and skips file & directory lookup to speed up the process diff --git a/utils/project.ts b/utils/project.ts index 3c4350c..c1b3fac 100644 --- a/utils/project.ts +++ b/utils/project.ts @@ -2,7 +2,7 @@ import { type CompilerOptions, type ProjectOptions, ts, -} from "https://deno.land/x/ts_morph@21.0.1/mod.ts" +} from "../deps/ts_morph.ts" import { FilteredFSHost } from "../graph/fs.ts" const ignore = /http|npm:|node_modules|\.jsx?|\.d\.ts/ diff --git a/utils/resolution_host.ts b/utils/resolution_host.ts index 61b3dd2..a7dc3c7 100644 --- a/utils/resolution_host.ts +++ b/utils/resolution_host.ts @@ -1,7 +1,7 @@ import { ResolutionHostFactory, ts, -} from "https://deno.land/x/ts_morph@21.0.1/mod.ts" +} from "../deps/ts_morph.ts" export const deno: ResolutionHostFactory = ( moduleResolutionHost, From 9a6ef148c4a3fa15d0b663a2a42dc03cc53780a8 Mon Sep 17 00:00:00 2001 From: Nemo Date: Tue, 27 Feb 2024 16:30:27 +0900 Subject: [PATCH 2/2] refactor: import deps from `rimbu.ts` --- deps/rimbu.ts | 4 ++++ doc/components.page.ts | 2 +- doc/components.ts | 2 +- doc/main.ts | 4 +--- graph/_example_project.ts | 2 +- graph/_format.ts | 2 +- graph/_project.ts | 2 +- graph/decl_deps.ts | 2 +- graph/decl_deps_bench.ts | 2 +- graph/decl_deps_test.ts | 2 +- graph/decls.ts | 5 +---- graph/graph.ts | 4 +--- graph/graph_descendants.ts | 4 +--- graph/graph_descendants_test.ts | 2 +- graph/graph_test.ts | 2 +- graph/top_decl_deps_test.ts | 2 +- graph/vscode_uri_test.ts | 2 +- render/data.ts | 10 ++++++---- utils/resolution_host.ts | 5 +---- 19 files changed, 27 insertions(+), 33 deletions(-) create mode 100644 deps/rimbu.ts diff --git a/deps/rimbu.ts b/deps/rimbu.ts new file mode 100644 index 0000000..28791a6 --- /dev/null +++ b/deps/rimbu.ts @@ -0,0 +1,4 @@ +export * from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +export * from "https://deno.land/x/rimbu@1.2.0/graph/mod.ts" +export * from "https://deno.land/x/rimbu@1.2.0/hashed/mod.ts" +export type * from "https://deno.land/x/rimbu@1.2.0/graph/custom/common/link.ts" diff --git a/doc/components.page.ts b/doc/components.page.ts index 2055e28..1fb3562 100644 --- a/doc/components.page.ts +++ b/doc/components.page.ts @@ -1,4 +1,4 @@ -import { Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { Stream } from "../deps/rimbu.ts" import { escapeHtml } from "https://deno.land/x/escape@1.4.2/mod.ts" import { exampleSrc } from "../graph/_example_project.ts" import outdent from "https://deno.land/x/outdent@v0.8.0/mod.ts" diff --git a/doc/components.ts b/doc/components.ts index 730f4d7..3073a34 100644 --- a/doc/components.ts +++ b/doc/components.ts @@ -3,7 +3,7 @@ import type { SourceFile, } from "https://deno.land/x/ts_morph@21.0.1/mod.ts" -import { Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { Stream } from "../deps/rimbu.ts" import { getAllDecls, getGraph, diff --git a/doc/main.ts b/doc/main.ts index f195ec0..d1f8fb8 100644 --- a/doc/main.ts +++ b/doc/main.ts @@ -1,8 +1,6 @@ import { relative } from "https://deno.land/std@0.216.0/path/relative.ts" import { dirname } from "https://deno.land/std@0.216.0/path/dirname.ts" -import { Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" -import { HashSet } from "https://deno.land/x/rimbu@1.2.0/hashed/mod.ts" - +import { HashSet, Stream } from "../deps/rimbu.ts" import { Project } from "../deps/ts_morph.ts" import { colors, hashRGB } from "../render/colors.ts" diff --git a/graph/_example_project.ts b/graph/_example_project.ts index b53d523..ee1d3e7 100644 --- a/graph/_example_project.ts +++ b/graph/_example_project.ts @@ -1,4 +1,4 @@ -import { Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { Stream } from "../deps/rimbu.ts" import { inMemoryProject } from "./_project.ts" import outdent from "https://deno.land/x/outdent@v0.8.0/mod.ts" diff --git a/graph/_format.ts b/graph/_format.ts index 52b653f..1999340 100644 --- a/graph/_format.ts +++ b/graph/_format.ts @@ -1,4 +1,4 @@ -import { Reducer, Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { Reducer, Stream } from "../deps/rimbu.ts" import { encodeVSCodeURI, prettyPrintURI } from "./vscode_uri.ts" import type { Declaration, DeclDeps } from "./decl_deps.ts" diff --git a/graph/_project.ts b/graph/_project.ts index 15fb72c..c60863b 100644 --- a/graph/_project.ts +++ b/graph/_project.ts @@ -1,4 +1,4 @@ -import { Reducer, Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { Reducer, Stream } from "../deps/rimbu.ts" import { Project, SourceFile } from "../deps/ts_morph.ts" import { denoCompilerOptions } from "../utils/project.ts" diff --git a/graph/decl_deps.ts b/graph/decl_deps.ts index 70a6cd5..a66a6e3 100644 --- a/graph/decl_deps.ts +++ b/graph/decl_deps.ts @@ -1,4 +1,4 @@ -import { Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { Stream } from "../deps/rimbu.ts" import { type ClassDeclaration, type FunctionDeclaration, diff --git a/graph/decl_deps_bench.ts b/graph/decl_deps_bench.ts index 9596e3e..f040dde 100644 --- a/graph/decl_deps_bench.ts +++ b/graph/decl_deps_bench.ts @@ -8,7 +8,7 @@ import { getDeclDeps, getTopDecl, } from "./decl_deps.ts" -import { Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { Stream } from "../deps/rimbu.ts" import { getAllDecls } from "./decls.ts" /** diff --git a/graph/decl_deps_test.ts b/graph/decl_deps_test.ts index 84929d3..068ccb3 100644 --- a/graph/decl_deps_test.ts +++ b/graph/decl_deps_test.ts @@ -1,7 +1,7 @@ import { inMemoryProject, withSrc } from "./_project.ts" import { exampleSrc } from "./_example_project.ts" import { assertEquals, assertSnapshot } from "../test_deps.ts" -import { Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { Stream } from "../deps/rimbu.ts" import { getAllDecls } from "./decls.ts" import { asRecord, declDepsSerializer, serializeNoColor } from "./_format.ts" import { snapshotTest } from "./_snapshot.ts" diff --git a/graph/decls.ts b/graph/decls.ts index 1568348..2a0292a 100644 --- a/graph/decls.ts +++ b/graph/decls.ts @@ -1,7 +1,4 @@ -import { - Stream, - StreamSource, -} from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { Stream, StreamSource } from "../deps/rimbu.ts" import { SourceFile } from "../deps/ts_morph.ts" import { Declaration } from "./decl_deps.ts" diff --git a/graph/graph.ts b/graph/graph.ts index bdfde67..edc40fb 100644 --- a/graph/graph.ts +++ b/graph/graph.ts @@ -1,6 +1,4 @@ -import type { GraphElement } from "https://deno.land/x/rimbu@1.2.0/graph/custom/common/link.ts" -import { ArrowGraphHashed } from "https://deno.land/x/rimbu@1.2.0/graph/mod.ts" -import { Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { ArrowGraphHashed, type GraphElement, Stream } from "../deps/rimbu.ts" import { type Declaration, type DeclDeps, getDeclDeps } from "./decl_deps.ts" import { encodeVSCodeURI, type VSCodeURI } from "./vscode_uri.ts" diff --git a/graph/graph_descendants.ts b/graph/graph_descendants.ts index 5303c13..1725548 100644 --- a/graph/graph_descendants.ts +++ b/graph/graph_descendants.ts @@ -1,6 +1,4 @@ -import type { ArrowGraph } from "https://deno.land/x/rimbu@1.2.0/graph/mod.ts" -import { HashMap, HashSet } from "https://deno.land/x/rimbu@1.2.0/hashed/mod.ts" -import { Reducer } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { type ArrowGraph, HashMap, HashSet, Reducer } from "../deps/rimbu.ts" export const getConnectionsTo = (graph: ArrowGraph, node: T) => graph.getConnectionStreamTo(node).map(([src]) => src) diff --git a/graph/graph_descendants_test.ts b/graph/graph_descendants_test.ts index 57ae87d..39ad33a 100644 --- a/graph/graph_descendants_test.ts +++ b/graph/graph_descendants_test.ts @@ -1,4 +1,4 @@ -import { ArrowGraphHashed } from "https://deno.land/x/rimbu@1.2.0/graph/mod.ts" +import { ArrowGraphHashed } from "../deps/rimbu.ts" import { assertEquals } from "../test_deps.ts" import { graphDescendants } from "./graph_descendants.ts" diff --git a/graph/graph_test.ts b/graph/graph_test.ts index 2479e48..cdbcf46 100644 --- a/graph/graph_test.ts +++ b/graph/graph_test.ts @@ -1,4 +1,4 @@ -import { Reducer, Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { Reducer, Stream } from "../deps/rimbu.ts" import { exampleSrc } from "./_example_project.ts" import { inMemoryProject, withSrc } from "./_project.ts" import { declDepsToGraph, Graph } from "./graph.ts" diff --git a/graph/top_decl_deps_test.ts b/graph/top_decl_deps_test.ts index a05404f..863f0c5 100644 --- a/graph/top_decl_deps_test.ts +++ b/graph/top_decl_deps_test.ts @@ -1,4 +1,4 @@ -import { Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { Stream } from "../deps/rimbu.ts" import { assertSnapshot } from "../test_deps.ts" import { exampleSrc } from "./_example_project.ts" import { inMemoryProject, withSrc } from "./_project.ts" diff --git a/graph/vscode_uri_test.ts b/graph/vscode_uri_test.ts index a95dbea..3af8939 100644 --- a/graph/vscode_uri_test.ts +++ b/graph/vscode_uri_test.ts @@ -1,4 +1,4 @@ -import { Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" +import { Stream } from "../deps/rimbu.ts" import { assertEquals } from "../test_deps.ts" import { declExampleText, exampleSrc } from "./_example_project.ts" import { inMemoryProject, withSrc } from "./_project.ts" diff --git a/render/data.ts b/render/data.ts index f38d75f..1fbefb5 100644 --- a/render/data.ts +++ b/render/data.ts @@ -1,10 +1,12 @@ -import type { GraphElement } from "https://deno.land/x/rimbu@1.2.0/graph/custom/common/link.ts" import type { GraphData } from "https://esm.sh/force-graph@1.43.4" import type { Opaque } from "https://raw.githubusercontent.com/sindresorhus/type-fest/main/source/opaque.d.ts" -import { ArrowGraphHashed } from "https://deno.land/x/rimbu@1.2.0/graph/mod.ts" -import { Stream } from "https://deno.land/x/rimbu@1.2.0/stream/mod.ts" -import { HashSet } from "https://deno.land/x/rimbu@1.2.0/hashed/mod.ts" +import { + ArrowGraphHashed, + type GraphElement, + HashSet, + Stream, +} from "../deps/rimbu.ts" import { colors, hashRGB } from "./colors.ts" import { type LabelOption, mkToLabel } from "./label.ts" diff --git a/utils/resolution_host.ts b/utils/resolution_host.ts index a7dc3c7..ce5b498 100644 --- a/utils/resolution_host.ts +++ b/utils/resolution_host.ts @@ -1,7 +1,4 @@ -import { - ResolutionHostFactory, - ts, -} from "../deps/ts_morph.ts" +import { ResolutionHostFactory, ts } from "../deps/ts_morph.ts" export const deno: ResolutionHostFactory = ( moduleResolutionHost,