diff --git a/cli.ts b/cli.ts index a0a25215..365ad6d3 100644 --- a/cli.ts +++ b/cli.ts @@ -4,8 +4,9 @@ import { parse as parseJsonc } from "./lib/std/jsonc.ts"; import { dirname, extname, join } from "./lib/std/path.ts"; import { colors, Command, List, Select } from "./lib/x/cliffy.ts"; import { URI } from "./lib/uri.ts"; -import { DependencyUpdate, FileUpdate } from "./mod.ts"; -import { commitAll } from "./git.ts"; +import { DependencyUpdate } from "./lib/update.ts"; +import { FileUpdate } from "./lib/file.ts"; +import { commitAll } from "./lib/git.ts"; const { gray, yellow, bold } = colors; diff --git a/git.ts b/git.ts index e1f21cf9..40cad92f 100644 --- a/git.ts +++ b/git.ts @@ -23,4 +23,4 @@ * @module */ -export * from "./src/git.ts"; +export * from "./lib/git.ts"; diff --git a/src/dependency.ts b/lib/dependency.ts similarity index 94% rename from src/dependency.ts rename to lib/dependency.ts index 3cec507c..54af8f87 100644 --- a/src/dependency.ts +++ b/lib/dependency.ts @@ -1,8 +1,7 @@ -import type { Maybe } from "../lib/types.ts"; -import { Mutex } from "../lib/x/async.ts"; -import type { Path, SemVerString } from "./types.ts"; +import { assertExists } from "./std/assert.ts"; +import { Mutex } from "./x/async.ts"; +import type { Maybe, Path, SemVerString } from "./types.ts"; import { parseSemVer } from "./semver.ts"; -import { assertExists } from "../lib/std/assert.ts"; export interface Dependency { name: string; diff --git a/src/dependency_test.ts b/lib/dependency_test.ts similarity index 90% rename from src/dependency_test.ts rename to lib/dependency_test.ts index dae9897f..56a1a1b8 100644 --- a/src/dependency_test.ts +++ b/lib/dependency_test.ts @@ -1,5 +1,5 @@ -import { describe, it } from "../lib/std/testing.ts"; -import { assertEquals } from "../lib/std/assert.ts"; +import { describe, it } from "./std/testing.ts"; +import { assertEquals } from "./std/assert.ts"; import { Dependency } from "./dependency.ts"; describe("parseProps()", () => { diff --git a/src/file.ts b/lib/file.ts similarity index 97% rename from src/file.ts rename to lib/file.ts index b4a8a6f6..c0ba3250 100644 --- a/src/file.ts +++ b/lib/file.ts @@ -1,5 +1,5 @@ import { DependencyUpdate } from "./update.ts"; -import { URI } from "../lib/uri.ts"; +import { URI } from "./uri.ts"; export interface FileUpdate { /** The specifier of the updated dependency (a remote module.) */ diff --git a/src/file_test.ts b/lib/file_test.ts similarity index 96% rename from src/file_test.ts rename to lib/file_test.ts index 6077e91f..f865f751 100644 --- a/src/file_test.ts +++ b/lib/file_test.ts @@ -5,15 +5,15 @@ import { it, type Stub, stub, -} from "../lib/std/testing.ts"; +} from "./std/testing.ts"; import { assertArrayIncludes, assertEquals, assertExists, -} from "../lib/std/assert.ts"; +} from "./std/assert.ts"; import { DependencyUpdate } from "./update.ts"; import { FileUpdate } from "./file.ts"; -import { URI } from "../lib/uri.ts"; +import { URI } from "./uri.ts"; describe("collect", () => { it("direct import", async () => { diff --git a/src/git.ts b/lib/git.ts similarity index 98% rename from src/git.ts rename to lib/git.ts index 55714b8c..8c8f7244 100644 --- a/src/git.ts +++ b/lib/git.ts @@ -1,7 +1,7 @@ import { DependencyUpdate } from "./update.ts"; import { FileUpdate } from "./file.ts"; import { createVersionProp, type VersionProp } from "./versions.ts"; -import { URI } from "../lib/uri.ts"; +import { URI } from "./uri.ts"; export interface CommitProps { /** The name of the module group */ diff --git a/src/git_test.ts b/lib/git_test.ts similarity index 96% rename from src/git_test.ts rename to lib/git_test.ts index 74cae21f..55903224 100644 --- a/src/git_test.ts +++ b/lib/git_test.ts @@ -1,5 +1,4 @@ // deno-lint-ignore-file no-explicit-any - import { afterAll, afterEach, @@ -9,9 +8,9 @@ import { it, type Stub, stub, -} from "../lib/std/testing.ts"; -import { assertArrayIncludes, assertEquals } from "../lib/std/assert.ts"; -import { URI } from "../lib/uri.ts"; +} from "./std/testing.ts"; +import { assertArrayIncludes, assertEquals } from "./std/assert.ts"; +import { URI } from "./uri.ts"; import { DependencyUpdate } from "./update.ts"; import { commitAll } from "./git.ts"; diff --git a/src/import_map.ts b/lib/import_map.ts similarity index 87% rename from src/import_map.ts rename to lib/import_map.ts index 54697f2a..70e30bd2 100644 --- a/src/import_map.ts +++ b/lib/import_map.ts @@ -1,9 +1,9 @@ -import { maxBy } from "../lib/std/collections.ts"; -import { parse as parseJsonc } from "../lib/std/jsonc.ts"; -import { type ImportMapJson, parseFromJson } from "../lib/x/import_map.ts"; -import { is } from "../lib/x/unknownutil.ts"; -import type { Maybe } from "../lib/types.ts"; -import { URI } from "../lib/uri.ts"; +import { maxBy } from "./std/collections.ts"; +import { parse as parseJsonc } from "./std/jsonc.ts"; +import { type ImportMapJson, parseFromJson } from "./x/import_map.ts"; +import { is } from "./x/unknownutil.ts"; +import type { Maybe } from "./types.ts"; +import { URI } from "./uri.ts"; import { URIScheme } from "./types.ts"; export type { ImportMapJson }; diff --git a/src/import_map_test.ts b/lib/import_map_test.ts similarity index 95% rename from src/import_map_test.ts rename to lib/import_map_test.ts index 57bbed7f..b711c555 100644 --- a/src/import_map_test.ts +++ b/lib/import_map_test.ts @@ -1,6 +1,6 @@ -import { beforeAll, describe, it } from "../lib/std/testing.ts"; -import { assertEquals, assertExists } from "../lib/std/assert.ts"; -import { URI } from "../lib/uri.ts"; +import { beforeAll, describe, it } from "./std/testing.ts"; +import { assertEquals, assertExists } from "./std/assert.ts"; +import { URI } from "./uri.ts"; import { ImportMap } from "./import_map.ts"; describe("readFromJson()", () => { diff --git a/src/loader.ts b/lib/loader.ts similarity index 94% rename from src/loader.ts rename to lib/loader.ts index 26968c46..27005e87 100644 --- a/src/loader.ts +++ b/lib/loader.ts @@ -1,7 +1,7 @@ import { type CreateGraphOptions, load as defaultLoad, -} from "../lib/x/deno_graph.ts"; +} from "./x/deno_graph.ts"; export const load: NonNullable = async ( specifier, diff --git a/src/semver.ts b/lib/semver.ts similarity index 87% rename from src/semver.ts rename to lib/semver.ts index 83a4b367..5d32f9cc 100644 --- a/src/semver.ts +++ b/lib/semver.ts @@ -1,5 +1,4 @@ -import type { Maybe } from "../lib/types.ts"; -import type { SemVerString } from "./types.ts"; +import type { Maybe, SemVerString } from "./types.ts"; // Ref: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string const SEMVER_REGEXP = diff --git a/src/semver_test.ts b/lib/semver_test.ts similarity index 76% rename from src/semver_test.ts rename to lib/semver_test.ts index c1e9b88b..609c8b27 100644 --- a/src/semver_test.ts +++ b/lib/semver_test.ts @@ -1,5 +1,5 @@ -import { describe, it } from "../lib/std/testing.ts"; -import { assertEquals } from "../lib/std/assert.ts"; +import { describe, it } from "./std/testing.ts"; +import { assertEquals } from "./std/assert.ts"; import { parseSemVer } from "./semver.ts"; describe("parseSemVer", () => { diff --git a/lib/types.ts b/lib/types.ts index d3d5f6c2..ef4dfbb8 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -1,2 +1,14 @@ export type Maybe = T | undefined; export type Brand = T & { __brand: B }; + +/** A string that represents a path segment (e.g. `src/lib.ts`.) */ +export type Path = Brand; + +/** A string that represents a semver (e.g. `v1.0.0`.) */ +export type SemVerString = Brand; + +const URI_SCHEMES = ["http", "https", "file", "npm", "node"] as const; +export type URIScheme = typeof URI_SCHEMES[number]; +export const URIScheme = { + values: URI_SCHEMES, +}; diff --git a/src/update.ts b/lib/update.ts similarity index 98% rename from src/update.ts rename to lib/update.ts index 7780f0a0..b26d774d 100644 --- a/src/update.ts +++ b/lib/update.ts @@ -2,8 +2,8 @@ import { createGraph, init as initDenoGraph, type ModuleJson, -} from "../lib/x/deno_graph.ts"; -import { RelativePath, URI } from "../lib/uri.ts"; +} from "./x/deno_graph.ts"; +import { RelativePath, URI } from "./uri.ts"; import type { SemVerString } from "./types.ts"; import { ImportMap, ImportMapJson } from "./import_map.ts"; import { Dependency } from "./dependency.ts"; diff --git a/src/update_test.ts b/lib/update_test.ts similarity index 97% rename from src/update_test.ts rename to lib/update_test.ts index 09cbf842..eaf42e18 100644 --- a/src/update_test.ts +++ b/lib/update_test.ts @@ -1,11 +1,11 @@ -import { beforeAll, describe, it } from "../lib/std/testing.ts"; +import { beforeAll, describe, it } from "./std/testing.ts"; import { assertEquals, assertExists, assertNotEquals, assertObjectMatch, -} from "../lib/std/assert.ts"; -import { URI } from "../lib/uri.ts"; +} from "./std/assert.ts"; +import { URI } from "./uri.ts"; import { _create, DependencyUpdate } from "./update.ts"; import { ImportMap } from "./import_map.ts"; diff --git a/src/versions.ts b/lib/versions.ts similarity index 83% rename from src/versions.ts rename to lib/versions.ts index 5d0a7429..cc31f0ab 100644 --- a/src/versions.ts +++ b/lib/versions.ts @@ -1,8 +1,8 @@ // Copyright 2023 Shun Ueda. All rights reserved. MIT license. -import type { Maybe } from "../lib/types.ts"; -import { distinct } from "../lib/std/collections.ts"; -import { DependencyUpdate } from "../mod.ts"; +import type { Maybe } from "./types.ts"; +import { distinct } from "./std/collections.ts"; +import { DependencyUpdate } from "./update.ts"; export type VersionProp = { from?: string; diff --git a/src/versions_test.ts b/lib/versions_test.ts similarity index 91% rename from src/versions_test.ts rename to lib/versions_test.ts index 5ffdd83a..03061cc3 100644 --- a/src/versions_test.ts +++ b/lib/versions_test.ts @@ -1,8 +1,8 @@ // deno-lint-ignore-file no-explicit-any -import { describe, it } from "../lib/std/testing.ts"; -import { assertEquals, assertThrows } from "../lib/std/assert.ts"; -import { createVersionProp } from "../src/versions.ts"; +import { describe, it } from "./std/testing.ts"; +import { assertEquals, assertThrows } from "./std/assert.ts"; +import { createVersionProp } from "./versions.ts"; describe("createVersionProps()", () => { it("single version", () => { diff --git a/src/types.ts b/src/types.ts deleted file mode 100644 index c68cb913..00000000 --- a/src/types.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Brand } from "../lib/types.ts"; - -/** A string that represents a path segment (e.g. `src/lib.ts`.) */ -export type Path = Brand; - -/** A string that represents a semver (e.g. `v1.0.0`.) */ -export type SemVerString = Brand; - -const URI_SCHEMES = ["http", "https", "file", "npm", "node"] as const; -export type URIScheme = typeof URI_SCHEMES[number]; -export const URIScheme = { - values: URI_SCHEMES, -};