Add ESModule support

This commit is contained in:
Fabian Stamm
2020-08-26 11:55:57 +02:00
parent f34800d725
commit b92caf6468
9 changed files with 251 additions and 236 deletions

View File

@ -1,6 +1,6 @@
import { Observable, ObservableInterface } from "@hibas123/utils";
import { ConsoleAdapter } from "./consolewriter";
import inspect from "./inspect";
import { ConsoleAdapter } from "./consolewriter.js";
import inspect from "./inspect.js";
import {
Adapter,
LoggingTypes,
@ -12,7 +12,7 @@ import {
Colors,
FormattedText,
FormattedLine,
} from "./types";
} from "./types.js";
const browser = typeof window !== "undefined";

View File

@ -1,14 +1,16 @@
import { ObservableInterface } from "@hibas123/utils";
import { Colors } from "./index";
import { Colors } from "./index.js";
import {
Adapter,
Message,
FormattedLine,
TerminalFormats,
FormatTypes,
} from "./types";
} from "./types.js";
const browser = typeof window !== "undefined";
declare const Deno: any;
const browser = typeof window !== "undefined" && typeof Deno === "undefined";
export class ConsoleAdapter implements Adapter {
constructor(private colors: boolean = true) {}

View File

@ -1,11 +1,11 @@
import { LoggingBase } from "./base";
export { ConsoleAdapter } from "./consolewriter";
import { LoggingBase } from "./base.js";
export { ConsoleAdapter } from "./consolewriter.js";
export {
LoggingBase,
LoggingBaseOptions,
removeColors,
withColor,
} from "./base";
} from "./base.js";
export {
Adapter,
LoggingTypes,
@ -18,7 +18,7 @@ export {
Format,
FormatTypes,
TerminalFormats,
} from "./types";
} from "./types.js";
export { ObservableInterface } from "@hibas123/utils";

View File

@ -1,4 +1,10 @@
import { Logging, LoggingBase, LoggingTypes, Colors, withColor } from ".";
import {
Logging,
LoggingBase,
LoggingTypes,
Colors,
withColor,
} from "./index.js";
Logging.log("test");
Logging.log("i", "am", { a: "an" }, 1000);