1
0
mirror of https://github.com/dzeiocom/libs.git synced 2025-04-22 10:52:11 +00:00

feat(logger): Add support for ESM

Signed-off-by: Avior <github@avior.me>
This commit is contained in:
Florian Bouillon 2023-06-28 19:42:37 +02:00
parent 0eb2468895
commit ec78032aa1
4 changed files with 2737 additions and 19 deletions

View File

@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [3.1.0] - 2023-06-28
### Added
- Support for ESM
## [2.0.4] - 2021-02-08 ## [2.0.4] - 2021-02-08
### Removed ### Removed

2714
packages/logger/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@dzeio/logger", "name": "@dzeio/logger",
"version": "3.0.0", "version": "3.1.0",
"description": "My Personnal Logger", "description": "My Personnal Logger",
"repository": { "repository": {
"type": "git", "type": "git",
@ -10,7 +10,21 @@
"author": "Aviortheking", "author": "Aviortheking",
"license": "MIT", "license": "MIT",
"main": "./dist/Logger.js", "main": "./dist/Logger.js",
"module": "./dist/Logger.mjs",
"types": "./dist/Logger.d.ts", "types": "./dist/Logger.d.ts",
"browser": "./dist/Logger.global.js",
"exports": {
".": {
"require": {
"types": "./dist/Logger.d.ts",
"default": "./dist/Logger.js"
},
"import": {
"default": "./dist/Logger.mjs",
"types": "./dist/Logger.d.mts"
}
}
},
"dependencies": { "dependencies": {
"ansi-colors": "^4.1.1" "ansi-colors": "^4.1.1"
}, },
@ -18,11 +32,11 @@
"@typescript-eslint/eslint-plugin": "^4.5.0", "@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0", "@typescript-eslint/parser": "^4.5.0",
"eslint": "^7.4.0", "eslint": "^7.4.0",
"parcel": "1.12.3" "tsup": "^7.1.0"
}, },
"scripts": { "scripts": {
"prepublishOnly": "npm run build", "prepublishOnly": "npm run build",
"build": "parcel build src/index.ts --out-file browser.js --experimental-scope-hoisting && tsc", "build": "tsup ./src/Logger.ts --format cjs,esm --dts --clean && tsup ./src/Logger.ts --format iife --global-name Logger --sourcemap",
"test": "ts-node test" "test": "ts-node test"
} }
} }

View File

@ -1,16 +0,0 @@
import Logger from './Logger'
// Browser Import
/**
* Init Logger in global context and add function to replace default console
*/
// @ts-expect-error
window.Logger = Logger
// @ts-expect-error
window.logger = new Logger('Console')
// @ts-expect-error
window.initConsole = function() {
console.log('// @deprecated Now use window.logger to get the correct logger')
}