Add ESModule support
This commit is contained in:
parent
f34800d725
commit
b92caf6468
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,4 +2,4 @@ node_modules/
|
|||||||
logs/
|
logs/
|
||||||
yarn.lock
|
yarn.lock
|
||||||
out/
|
out/
|
||||||
.history/
|
esm/
|
410
package-lock.json
generated
410
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -1,12 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "@hibas123/logging",
|
"name": "@hibas123/logging",
|
||||||
"version": "2.4.5",
|
"version": "2.5.4",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "out/index.js",
|
"main": "out/index.js",
|
||||||
"types": "out/index.d.ts",
|
"types": "out/index.d.ts",
|
||||||
|
"module": "esm/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublish": "tsc",
|
"prepublish": "npm run build",
|
||||||
"build": "tsc",
|
"build": "tsc && tsc -p tsconfig.esm.json",
|
||||||
"dev": "nodemon -e ts --exec ts-node src/test.ts"
|
"dev": "nodemon -e ts --exec ts-node src/test.ts"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@ -18,16 +19,17 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"src/",
|
"src/",
|
||||||
"out/",
|
"out/",
|
||||||
|
"esm/",
|
||||||
"tsconfig.json",
|
"tsconfig.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"concurrently": "^5.1.0",
|
"concurrently": "^5.3.0",
|
||||||
"nodemon": "^2.0.3",
|
"nodemon": "^2.0.4",
|
||||||
"ts-node": "^8.8.2",
|
"ts-node": "^9.0.0",
|
||||||
"typescript": "^3.8.3"
|
"typescript": "^4.0.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hibas123/utils": "^2.2.4"
|
"@hibas123/utils": "^2.2.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Observable, ObservableInterface } from "@hibas123/utils";
|
import { Observable, ObservableInterface } from "@hibas123/utils";
|
||||||
import { ConsoleAdapter } from "./consolewriter";
|
import { ConsoleAdapter } from "./consolewriter.js";
|
||||||
import inspect from "./inspect";
|
import inspect from "./inspect.js";
|
||||||
import {
|
import {
|
||||||
Adapter,
|
Adapter,
|
||||||
LoggingTypes,
|
LoggingTypes,
|
||||||
@ -12,7 +12,7 @@ import {
|
|||||||
Colors,
|
Colors,
|
||||||
FormattedText,
|
FormattedText,
|
||||||
FormattedLine,
|
FormattedLine,
|
||||||
} from "./types";
|
} from "./types.js";
|
||||||
|
|
||||||
const browser = typeof window !== "undefined";
|
const browser = typeof window !== "undefined";
|
||||||
|
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
import { ObservableInterface } from "@hibas123/utils";
|
import { ObservableInterface } from "@hibas123/utils";
|
||||||
import { Colors } from "./index";
|
import { Colors } from "./index.js";
|
||||||
import {
|
import {
|
||||||
Adapter,
|
Adapter,
|
||||||
Message,
|
Message,
|
||||||
FormattedLine,
|
FormattedLine,
|
||||||
TerminalFormats,
|
TerminalFormats,
|
||||||
FormatTypes,
|
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 {
|
export class ConsoleAdapter implements Adapter {
|
||||||
constructor(private colors: boolean = true) {}
|
constructor(private colors: boolean = true) {}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { LoggingBase } from "./base";
|
import { LoggingBase } from "./base.js";
|
||||||
export { ConsoleAdapter } from "./consolewriter";
|
export { ConsoleAdapter } from "./consolewriter.js";
|
||||||
export {
|
export {
|
||||||
LoggingBase,
|
LoggingBase,
|
||||||
LoggingBaseOptions,
|
LoggingBaseOptions,
|
||||||
removeColors,
|
removeColors,
|
||||||
withColor,
|
withColor,
|
||||||
} from "./base";
|
} from "./base.js";
|
||||||
export {
|
export {
|
||||||
Adapter,
|
Adapter,
|
||||||
LoggingTypes,
|
LoggingTypes,
|
||||||
@ -18,7 +18,7 @@ export {
|
|||||||
Format,
|
Format,
|
||||||
FormatTypes,
|
FormatTypes,
|
||||||
TerminalFormats,
|
TerminalFormats,
|
||||||
} from "./types";
|
} from "./types.js";
|
||||||
|
|
||||||
export { ObservableInterface } from "@hibas123/utils";
|
export { ObservableInterface } from "@hibas123/utils";
|
||||||
|
|
||||||
|
@ -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("test");
|
||||||
Logging.log("i", "am", { a: "an" }, 1000);
|
Logging.log("i", "am", { a: "an" }, 1000);
|
||||||
|
11
tsconfig.esm.json
Normal file
11
tsconfig.esm.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "ESNext",
|
||||||
|
"target": "ES2017",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": "esm"
|
||||||
|
},
|
||||||
|
"exclude": ["node_modules"],
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
@ -1,19 +1,13 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es2017",
|
"target": "esnext",
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outDir": "out",
|
"outDir": "out",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"typeRoots": [
|
"typeRoots": ["node_modules/@types"]
|
||||||
"node_modules/@types"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": ["node_modules"],
|
||||||
"node_modules"
|
"include": ["src"]
|
||||||
],
|
|
||||||
"include": [
|
|
||||||
"src"
|
|
||||||
]
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user