Skip to content

Commit

Permalink
refactor: update imports in all pkgs
Browse files Browse the repository at this point in the history
- add .js suffix for all relative imports
  • Loading branch information
postspectacular committed Oct 13, 2021
1 parent f3c3cad commit 5fa2b6f
Show file tree
Hide file tree
Showing 2,620 changed files with 8,021 additions and 7,914 deletions.
2 changes: 1 addition & 1 deletion packages/adjacency/src/bfs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BitField } from "@thi.ng/bitfield/bitfield";
import { DCons } from "@thi.ng/dcons/dcons";
import type { CostFn, IGraph } from "./api";
import type { CostFn, IGraph } from "./api.js";

export class BFS {
graph: IGraph;
Expand Down
4 changes: 2 additions & 2 deletions packages/adjacency/src/binary.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BitMatrix } from "@thi.ng/bitfield/bitmatrix";
import type { DegreeType, Edge, IGraph } from "./api";
import { into, invert, toDot } from "./utils";
import type { DegreeType, Edge, IGraph } from "./api.js";
import { into, invert, toDot } from "./utils.js";

/**
* Adjacency matrix representation for both directed and undirected graphs and
Expand Down
2 changes: 1 addition & 1 deletion packages/adjacency/src/dfs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BitField } from "@thi.ng/bitfield/bitfield";
import { DCons } from "@thi.ng/dcons/dcons";
import type { IGraph } from "./api";
import type { IGraph } from "./api.js";

export class DFS {
graph: IGraph;
Expand Down
16 changes: 8 additions & 8 deletions packages/adjacency/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export * from "./api";
export * from "./binary";
export * from "./disjoint-set";
export * from "./list";
export * from "./sparse";
export * from "./api.js";
export * from "./binary.js";
export * from "./disjoint-set.js";
export * from "./list.js";
export * from "./sparse.js";

export * from "./bfs";
export * from "./dfs";
export * from "./mst";
export * from "./bfs.js";
export * from "./dfs.js";
export * from "./mst.js";
4 changes: 2 additions & 2 deletions packages/adjacency/src/list.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DCons } from "@thi.ng/dcons/dcons";
import type { DegreeType, Edge, IGraph } from "./api";
import { into, invert, toDot } from "./utils";
import type { DegreeType, Edge, IGraph } from "./api.js";
import { into, invert, toDot } from "./utils.js";

export class AdjacencyList implements IGraph<number> {
vertices: DCons<number>[] = [];
Expand Down
2 changes: 1 addition & 1 deletion packages/adjacency/src/mst.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Fn } from "@thi.ng/api";
import { sortByCachedKey } from "@thi.ng/arrays/sort-cached";
import { DisjointSet } from "./disjoint-set";
import { DisjointSet } from "./disjoint-set.js";

/**
* Computes the Minimum Spanning Tree from given weighted `edges`, using
Expand Down
4 changes: 2 additions & 2 deletions packages/adjacency/src/sparse.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ensureIndex2 } from "@thi.ng/errors/out-of-bounds";
import { CSR } from "@thi.ng/sparse/csr";
import type { DegreeType, Edge, IGraph } from "./api";
import { into, invert, toDot } from "./utils";
import type { DegreeType, Edge, IGraph } from "./api.js";
import { into, invert, toDot } from "./utils.js";

export class AdjacencyMatrix extends CSR implements IGraph<number> {
undirected: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/adjacency/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// thing:no-export
import type { Pair } from "@thi.ng/api";
import type { Edge, IGraph } from "./api";
import type { Edge, IGraph } from "./api.js";

/** @internal */
export const toDot = (
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/assoc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Fn } from "./fn";
import type { Fn } from "./fn.js";

/**
* A key-value pair / tuple.
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/compare.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Fn2 } from "./fn";
import type { Fn2 } from "./fn.js";

/**
* Generic 2-element comparator function type alias.
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/deref.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IObjectOf } from "./object";
import type { IObjectOf } from "./object.js";

/**
* Generic interface for reference types (value wrappers).
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/dissoc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IAssoc, IAssocIn } from "./assoc";
import type { IAssoc, IAssocIn } from "./assoc.js";

/**
* Extension of `IAssoc` for types supporting key removals.
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/event.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Fn } from "./fn";
import type { IID } from "./id";
import type { Fn } from "./fn.js";
import type { IID } from "./id.js";

/**
* Event listener.
Expand Down
96 changes: 48 additions & 48 deletions packages/api/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
export * from "./assoc";
export * from "./bind";
export * from "./buffered";
export * from "./clear";
export * from "./compare";
export * from "./contains";
export * from "./copy";
export * from "./deref";
export * from "./dissoc";
export * from "./empty";
export * from "./enable";
export * from "./equiv";
export * from "./event";
export * from "./fn";
export * from "./get";
export * from "./hash";
export * from "./hiccup";
export * from "./id";
export * from "./indexed";
export * from "./into";
export * from "./keyval";
export * from "./length";
export * from "./meta";
export * from "./null";
export * from "./object";
export * from "./path";
export * from "./predicate";
export * from "./prim";
export * from "./range";
export * from "./release";
export * from "./reset";
export * from "./select";
export * from "./seq";
export * from "./set";
export * from "./stack";
export * from "./tuple";
export * from "./typedarray";
export * from "./watch";
export * from "./assoc.js";
export * from "./bind.js";
export * from "./buffered.js";
export * from "./clear.js";
export * from "./compare.js";
export * from "./contains.js";
export * from "./copy.js";
export * from "./deref.js";
export * from "./dissoc.js";
export * from "./empty.js";
export * from "./enable.js";
export * from "./equiv.js";
export * from "./event.js";
export * from "./fn.js";
export * from "./get.js";
export * from "./hash.js";
export * from "./hiccup.js";
export * from "./id.js";
export * from "./indexed.js";
export * from "./into.js";
export * from "./keyval.js";
export * from "./length.js";
export * from "./meta.js";
export * from "./null.js";
export * from "./object.js";
export * from "./path.js";
export * from "./predicate.js";
export * from "./prim.js";
export * from "./range.js";
export * from "./release.js";
export * from "./reset.js";
export * from "./select.js";
export * from "./seq.js";
export * from "./set.js";
export * from "./stack.js";
export * from "./tuple.js";
export * from "./typedarray.js";
export * from "./watch.js";

export * from "./api";
export * from "./mixin";
export * from "./api.js";
export * from "./mixin.js";

export * from "./decorators/configurable";
export * from "./decorators/deprecated";
export * from "./decorators/nomixin";
export * from "./decorators/sealed";
export * from "./decorators/configurable.js";
export * from "./decorators/deprecated.js";
export * from "./decorators/nomixin.js";
export * from "./decorators/sealed.js";

export * from "./mixins/ienable";
export * from "./mixins/inotify";
export * from "./mixins/iterable";
export * from "./mixins/iwatch";
export * from "./mixins/ienable.js";
export * from "./mixins/inotify.js";
export * from "./mixins/iterable.js";
export * from "./mixins/iwatch.js";
16 changes: 6 additions & 10 deletions packages/api/src/keyval.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Head, Tail } from "./tuple";
import type { Head, Tail } from "./tuple.js";

/**
* Extracts from A all keys which have values assignable to type B.
Expand All @@ -11,11 +11,9 @@ export type NumericKeys<T> = TypedKeys<T, number>;

export type StringKeys<T> = TypedKeys<T, string>;

export type DeepPartial<T> = Partial<
{
[k in keyof T]: DeepPartial<T[k]>;
}
>;
export type DeepPartial<T> = Partial<{
[k in keyof T]: DeepPartial<T[k]>;
}>;

/*
* Utilities for extracting key types of nested objects.
Expand Down Expand Up @@ -188,8 +186,7 @@ export type Without<T, A extends Keys<T>> = Omit<T, A>;
export type Without2<T, A extends Keys<T>, B extends Keys1<T, A>> = Without<
T,
A
> &
{ [id in A]: Without<Val1<T, A>, B> };
> & { [id in A]: Without<Val1<T, A>, B> };
export type Without3<
T,
A extends Keys<T>,
Expand Down Expand Up @@ -274,8 +271,7 @@ export type Replace<T, A extends Keys<T>, V> = Without<T, A> & { [id in A]: V };
export type Replace2<T, A extends Keys<T>, B extends Keys1<T, A>, V> = Without<
T,
A
> &
{ [id in A]: Replace<Val1<T, A>, B, V> };
> & { [id in A]: Replace<Val1<T, A>, B, V> };
export type Replace3<
T,
A extends Keys<T>,
Expand Down
8 changes: 4 additions & 4 deletions packages/api/src/mixins/ienable.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EVENT_DISABLE, EVENT_ENABLE } from "../api";
import type { IEnable } from "../enable";
import type { Event } from "../event";
import { mixin } from "../mixin";
import { EVENT_DISABLE, EVENT_ENABLE } from "../api.js";
import type { IEnable } from "../enable.js";
import type { Event } from "../event.js";
import { mixin } from "../mixin.js";

interface _IEnable extends IEnable<any> {
_enabled: boolean;
Expand Down
8 changes: 4 additions & 4 deletions packages/api/src/mixins/inotify.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EVENT_ALL } from "../api";
import type { Event, INotify, Listener } from "../event";
import { mixin } from "../mixin";
import type { IObjectOf } from "../object";
import { EVENT_ALL } from "../api.js";
import type { Event, INotify, Listener } from "../event.js";
import { mixin } from "../mixin.js";
import type { IObjectOf } from "../object.js";

interface _INotify extends INotify {
_listeners: IObjectOf<[Listener, any][]>;
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/mixins/iterable.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mixin } from "../mixin";
import { mixin } from "../mixin.js";

export const iterable = (prop: PropertyKey) =>
mixin({
Expand Down
6 changes: 3 additions & 3 deletions packages/api/src/mixins/iwatch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mixin } from "../mixin";
import type { IObjectOf } from "../object";
import type { IWatch, Watch } from "../watch";
import { mixin } from "../mixin.js";
import type { IObjectOf } from "../object.js";
import type { IWatch, Watch } from "../watch.js";

interface _IWatch extends IWatch<any> {
_watches: IObjectOf<Watch<any>>;
Expand Down
6 changes: 3 additions & 3 deletions packages/api/src/path.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { NumOrString } from "./prim";
import type { NumOrString } from "./prim.js";
import type {
Keys,
Keys1,
Expand All @@ -9,8 +9,8 @@ import type {
Keys6,
Keys7,
ValN,
} from "./keyval";
import type { Head, Tail, IsEmpty } from "./tuple";
} from "./keyval.js";
import type { Head, Tail, IsEmpty } from "./tuple.js";

/**
* Unchecked lookup path for nested data structures.
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/predicate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Fn, Fn0, Fn2 } from "./fn";
import type { Fn, Fn0, Fn2 } from "./fn.js";

/**
* Predicate function mapping given value to true/false.
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/set.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IInto } from "./into";
import type { IInto } from "./into.js";

/**
* Generic interface for set collection types.
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/tuple.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TypedArray } from "./typedarray";
import type { TypedArray } from "./typedarray.js";

/**
* Returns an array's value type. Assumes array is homogeneous (only type of
Expand Down
4 changes: 2 additions & 2 deletions packages/args/src/args.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Fn } from "@thi.ng/api";
import { repeat } from "@thi.ng/strings/repeat";
import type { ArgSpec, KVDict, KVMultiDict, Tuple } from "./api";
import type { ArgSpec, KVDict, KVMultiDict, Tuple } from "./api.js";
import {
coerceFloat,
coerceFloats,
Expand All @@ -12,7 +12,7 @@ import {
coerceKV,
coerceOneOf,
coerceTuple,
} from "./coerce";
} from "./coerce.js";

const $single =
<T = number>(coerce: Fn<string, T>, hint: string) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/args/src/coerce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Fn } from "@thi.ng/api";
import { isHex } from "@thi.ng/checks/is-hex";
import { isNumericFloat, isNumericInt } from "@thi.ng/checks/is-numeric";
import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
import { KVDict, KVMultiDict, Tuple } from "./api";
import { KVDict, KVMultiDict, Tuple } from "./api.js";

export const coerceString = (x: string) => x;

Expand Down
10 changes: 5 additions & 5 deletions packages/args/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from "./api";
export * from "./args";
export * from "./coerce";
export * from "./parse";
export * from "./usage";
export * from "./api.js";
export * from "./args.js";
export * from "./coerce.js";
export * from "./parse.js";
export * from "./usage.js";
4 changes: 2 additions & 2 deletions packages/args/src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { IObjectOf, Nullable } from "@thi.ng/api";
import { isArray } from "@thi.ng/checks/is-array";
import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
import { camel } from "@thi.ng/strings/case";
import type { Args, ArgSpecExt, ParseOpts, ParseResult } from "./api";
import { usage } from "./usage";
import type { Args, ArgSpecExt, ParseOpts, ParseResult } from "./api.js";
import { usage } from "./usage.js";

export const parse = <T extends IObjectOf<any>>(
specs: Args<T>,
Expand Down
8 changes: 7 additions & 1 deletion packages/args/src/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import { padRight } from "@thi.ng/strings/pad-right";
import { repeat } from "@thi.ng/strings/repeat";
import { stringify } from "@thi.ng/strings/stringify";
import { SPLIT_ANSI, wordWrapLines } from "@thi.ng/strings/word-wrap";
import { Args, ArgSpecExt, ColorTheme, DEFAULT_THEME, UsageOpts } from "./api";
import {
Args,
ArgSpecExt,
ColorTheme,
DEFAULT_THEME,
UsageOpts,
} from "./api.js";

export const usage = <T extends IObjectOf<any>>(
specs: Args<T>,
Expand Down
2 changes: 1 addition & 1 deletion packages/arrays/src/ensure-array.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isArray } from "@thi.ng/checks/is-array";
import { isArrayLike } from "@thi.ng/checks/is-arraylike";
import { ensureIterable } from "./ensure-iterable";
import { ensureIterable } from "./ensure-iterable.js";

/**
* Helper function to avoid unnecessary copying if `x` is already an
Expand Down
Loading

0 comments on commit 5fa2b6f

Please sign in to comment.