From 705237f2030aaeeaa21f1527b857f031c8cdb018 Mon Sep 17 00:00:00 2001 From: Dirk Holtwick Date: Fri, 25 Aug 2023 11:42:53 +0200 Subject: [PATCH 1/9] Future of dispose --- .vscode/settings.json | 3 ++- package.json | 2 +- src/common/dispose-defer.spec.ts | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index d7f7b2c0..a1f260a7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,5 +12,6 @@ "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**" - ] + ], + "typescript.tsdk": "node_modules/typescript/lib" } diff --git a/package.json b/package.json index 05f1bb24..985fcc52 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,6 @@ "tsup": "^7.2.0", "typescript": "^5.2.2", "vite": "^4.4.9", - "vitest": "^0.34.2" + "vitest": "^0.34.3" } } diff --git a/src/common/dispose-defer.spec.ts b/src/common/dispose-defer.spec.ts index f116fa37..9f5444ea 100644 --- a/src/common/dispose-defer.spec.ts +++ b/src/common/dispose-defer.spec.ts @@ -123,4 +123,26 @@ describe('dispose', () => { // expect(stack).toEqual(['b', 'a']) }) + // TODO future + // it("should use using", async () => { + // class TempFile implements Disposable { + + // constructor(path: string) { + // console.log('constructor') + // } + + // [Symbol.dispose]() { + // console.log('dispose') + // } + // } + + // function fn() { + // using f = new TempFile('abc') + // console.log('fn return') + // } + + // console.log('fn before') + // fn() + // console.log('fn after') + // }) }) From 401485af1263903203ae279dea780c95cc01a04b Mon Sep 17 00:00:00 2001 From: Dirk Holtwick Date: Wed, 30 Aug 2023 11:26:05 +0200 Subject: [PATCH 2/9] Requires node 18 --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 985fcc52..cd7e1395 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "dist" ], "engines": { - "node": ">=14.13.1" + "node": ">=18" }, "scripts": { "build": "nr clean && nr build:tsup", @@ -68,11 +68,11 @@ "devDependencies": { "@antfu/eslint-config": "^0.41.0", "@antfu/ni": "^0.21.6", - "@types/node": "^20.5.6", + "@types/node": "<20", "c8": "^8.0.1", "cross-fetch": "^4.0.0", "esbuild": "^0.19.2", - "eslint": "^8.47.0", + "eslint": "^8.48.0", "tsup": "^7.2.0", "typescript": "^5.2.2", "vite": "^4.4.9", From 8ef6f141685ea25650c4ca14d8e6555d028a9d6f Mon Sep 17 00:00:00 2001 From: Dirk Holtwick Date: Wed, 30 Aug 2023 11:27:36 +0200 Subject: [PATCH 3/9] 0.12.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cd7e1395..01ea0a8e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "zeed", "type": "module", - "version": "0.11.5", + "version": "0.12.0", "description": "🌱 Simple foundation library", "author": { "name": "Dirk Holtwick", From e1e7c18c686846dcd1717693e3a6b662ad6d280d Mon Sep 17 00:00:00 2001 From: Dirk Holtwick Date: Tue, 5 Sep 2023 20:54:36 +0200 Subject: [PATCH 4/9] useIntervalPause --- package.json | 2 +- src/common/dispose-utils.ts | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 01ea0a8e..b01588a4 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ }, "devDependencies": { "@antfu/eslint-config": "^0.41.0", - "@antfu/ni": "^0.21.6", + "@antfu/ni": "^0.21.8", "@types/node": "<20", "c8": "^8.0.1", "cross-fetch": "^4.0.0", diff --git a/src/common/dispose-utils.ts b/src/common/dispose-utils.ts index 462d2380..488aed15 100644 --- a/src/common/dispose-utils.ts +++ b/src/common/dispose-utils.ts @@ -1,4 +1,5 @@ import type { DisposerFunction } from './dispose-types' +import { promisify } from './exec' export function useTimeout( fn: DisposerFunction, @@ -23,6 +24,29 @@ export function useInterval(fn: DisposerFunction, interval: number): DisposerFun } } +/** The interval starts only, when the function is finished. */ +export function useIntervalPause(fn: DisposerFunction, interval: number, immediately = false): DisposerFunction { + let intervalHandle: any + let stop = false + + async function loop(exec = false) { + if (exec) + await promisify(fn()) + if (!stop) + intervalHandle = setTimeout(() => loop(true), interval) + } + + void loop(immediately) + + return () => { + if (intervalHandle) { + stop = true + clearInterval(intervalHandle) + intervalHandle = undefined + } + } +} + export function useEventListener( emitter: any, eventName: string, From 0ed137e946bd47ed7395464e9530333858598832 Mon Sep 17 00:00:00 2001 From: Dirk Holtwick Date: Tue, 5 Sep 2023 21:05:23 +0200 Subject: [PATCH 5/9] Reduce cycles --- package.json | 1 + src/common/dispose-defer.ts | 9 ++- src/common/dispose-types.ts | 6 -- src/common/log-base.ts | 129 --------------------------------- src/common/log-context.ts | 132 ++++++++++++++++++++++++++++++++++ src/common/log-memory.spec.ts | 2 +- src/common/log.spec.ts | 3 +- src/common/log.ts | 2 +- src/common/msg/emitter.ts | 6 +- 9 files changed, 143 insertions(+), 147 deletions(-) create mode 100644 src/common/log-context.ts diff --git a/package.json b/package.json index b01588a4..beab429e 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "test": "vitest", "test:publish": "vitest --run", "watch": "nr build:tsup -- --watch", + "circles": "nlx madge --circular --extensions ts src", "release": "na version patch && na publish" }, "devDependencies": { diff --git a/src/common/dispose-defer.ts b/src/common/dispose-defer.ts index 3931bed2..9b096f57 100644 --- a/src/common/dispose-defer.ts +++ b/src/common/dispose-defer.ts @@ -1,10 +1,9 @@ -import type { Disposer, DisposerFunction } from './dispose-types' import { isString } from './data' import { arrayFilterInPlace } from './data/array' +import type { Disposer, DisposerFunction } from './dispose-types' import { isPromise } from './exec/promise' import { DefaultLogger } from './log' import type { LoggerInterface } from './log-base' -import { useEventListener, useInterval, useTimeout } from './dispose-utils' /** Different kinds of implementations have grown, this should unify them */ function callDisposer(disposable: Disposer): Promise | void { @@ -111,9 +110,9 @@ export function useDispose(config?: string | UseDisposeConfig | LoggerInterface) }, // Utils - timeout: (fn: DisposerFunction, timeout = 0) => track(useTimeout(fn, timeout)), - interval: (fn: DisposerFunction, interval = 0) => track(useInterval(fn, interval)), - on: (emitter: any, eventName: string, fn: (ev?: any) => void, ...args: any[]) => track(useEventListener(emitter, eventName, fn, ...args)), + // timeout: (fn: DisposerFunction, timeout = 0) => track(useTimeout(fn, timeout)), + // interval: (fn: DisposerFunction, interval = 0) => track(useInterval(fn, interval)), + // on: (emitter: any, eventName: string, fn: (ev?: any) => void, ...args: any[]) => track(useEventListener(emitter, eventName, fn, ...args)), }) } diff --git a/src/common/dispose-types.ts b/src/common/dispose-types.ts index 6767c75c..e90e0d0e 100644 --- a/src/common/dispose-types.ts +++ b/src/common/dispose-types.ts @@ -1,5 +1,3 @@ -import type { UseDispose } from './dispose-defer' - // https://blog.hediet.de/post/the_disposable_pattern_in_typescript // todo adopt for `using` https://www.totaltypescript.com/typescript-5-2-new-keyword-using @@ -10,7 +8,3 @@ export type Disposer = DisposerFunction | dispose?: DisposerFunction | Promise cleanup?: DisposerFunction | Promise // deprecated, but used often in my old code } - -export interface Disposable { - dispose: UseDispose -} diff --git a/src/common/log-base.ts b/src/common/log-base.ts index cef3f573..ea4cb62b 100644 --- a/src/common/log-base.ts +++ b/src/common/log-base.ts @@ -1,8 +1,5 @@ // (C)opyright 2021-07-15 Dirk Holtwick, holtwick.it. All rights reserved. -import { LoggerConsoleHandler } from './log-console' -import { parseLogLevel, useNamespaceFilter } from './log-filter' - export type LogLevel = number export const LogLevelAll = -1 @@ -130,129 +127,3 @@ export interface LogHandlerOptions { time?: boolean pretty?: boolean } - -export function LoggerContext(_prefix = ''): LoggerContextInterface { - let logHandlers: LogHandler[] = [LoggerConsoleHandler()] - let logCheckNamespace = (_name: string) => true - let logLock = false - let logFactory = LoggerBaseFactory - let logDebug = false - - function LoggerBaseFactory( - name = '', - level?: LogLevelAliasType, - ): LoggerInterface { - const logLevel = parseLogLevel(level ?? LogLevelAll) - - function defineForLogLevel(fnLevel: LogLevel, fn: any) { - if (logLevel <= fnLevel) - return fn - return () => {} - } - - const log = defineForLogLevel(LogLevelDebug, (...messages: any[]) => { - // eslint-disable-next-line @typescript-eslint/no-use-before-define - emit({ - name, - messages, - level: LogLevelDebug, - }) - }) - - log.label = name - // log.active = true - - log.extend = function (prefix: string): LoggerInterface { - return logFactory(name ? `${name}:${prefix}` : prefix) - } - - const emit = (msg: LogMessage) => { - // if (log.active === true) { - // if (msg.level >= Logger.level && msg.level >= log.level) { - if (logCheckNamespace(name)) { - for (const handler of logHandlers) { - if (handler) - handler(msg) - } - } - // } - // } - } - - log.debug = defineForLogLevel(LogLevelDebug, (...messages: any[]) => { - emit({ name, messages, level: LogLevelDebug }) - }) - - log.info = defineForLogLevel(LogLevelInfo, (...messages: any[]) => { - emit({ name, messages, level: LogLevelInfo }) - }) - - log.warn = defineForLogLevel(LogLevelWarn, (...messages: any[]) => { - emit({ name, messages, level: LogLevelWarn }) - }) - - log.error = defineForLogLevel(LogLevelError, (...messages: any[]) => { - emit({ name, messages, level: LogLevelError }) - }) - - log.fatal = defineForLogLevel(LogLevelFatal, (...messages: any[]) => { - emit({ name, messages, level: LogLevelFatal }) - throw new Error(`${messages.map(String).join(' ')}`) - }) - - log.assert = defineForLogLevel(LogLevelFatal, (condition: unknown, ...args: any) => { - if (condition == null || (typeof condition === 'number' && Number.isNaN(condition)) || !condition) - log.fatal(...args) - }) - - return log - } - - function Logger(name = '', level?: LogLevelAliasType): LoggerInterface { - const log = logFactory(name, level) - if (logDebug) - log.debug(`+++ init of logger "${name}" on level "${log.level}".`) - return log - } - - Logger.registerHandler = function (handler: LogHandler) { - logHandlers.push(handler) - } - - /** @deprecated */ - Logger.setFilter = function (namespaces: string) { - logCheckNamespace = useNamespaceFilter(namespaces) - } - - Logger.setLock = (lock = true) => (logLock = lock) - - Logger.setDebug = (debug = true) => (logDebug = debug) - - Logger.setHandlers = function (handlers: LogHandler[] = []) { - if (logFactory !== LoggerBaseFactory) - logFactory = LoggerBaseFactory - - if (logLock) - return - logHandlers = [...handlers].filter(h => typeof h === 'function') - } - - Logger.level = LogLevelAll - - /** @deprecated */ - Logger.setLogLevel = function (level: LogLevel = LogLevelAll) { - if (logLock) - return - Logger.level = level - } - - Logger.setFactory = function ( - factory: (name?: string) => LoggerInterface, - ): void { - if (logLock) - return - logFactory = factory - } - - return Logger -} diff --git a/src/common/log-context.ts b/src/common/log-context.ts new file mode 100644 index 00000000..d3b85d47 --- /dev/null +++ b/src/common/log-context.ts @@ -0,0 +1,132 @@ +// (C)opyright 2021-07-15 Dirk Holtwick, holtwick.it. All rights reserved. + +import type { LogHandler, LogLevel, LogLevelAliasType, LogMessage, LoggerContextInterface, LoggerInterface } from './log-base' +import { LogLevelAll, LogLevelDebug, LogLevelError, LogLevelFatal, LogLevelInfo, LogLevelWarn } from './log-base' +import { LoggerConsoleHandler } from './log-console' +import { parseLogLevel, useNamespaceFilter } from './log-filter' + +export function LoggerContext(_prefix = ''): LoggerContextInterface { + let logHandlers: LogHandler[] = [LoggerConsoleHandler()] + let logCheckNamespace = (_name: string) => true + let logLock = false + let logFactory = LoggerBaseFactory + let logDebug = false + + function LoggerBaseFactory( + name = '', + level?: LogLevelAliasType, + ): LoggerInterface { + const logLevel = parseLogLevel(level ?? LogLevelAll) + + function defineForLogLevel(fnLevel: LogLevel, fn: any) { + if (logLevel <= fnLevel) + return fn + return () => {} + } + + const log = defineForLogLevel(LogLevelDebug, (...messages: any[]) => { + // eslint-disable-next-line @typescript-eslint/no-use-before-define + emit({ + name, + messages, + level: LogLevelDebug, + }) + }) + + log.label = name + // log.active = true + + log.extend = function (prefix: string): LoggerInterface { + return logFactory(name ? `${name}:${prefix}` : prefix) + } + + const emit = (msg: LogMessage) => { + // if (log.active === true) { + // if (msg.level >= Logger.level && msg.level >= log.level) { + if (logCheckNamespace(name)) { + for (const handler of logHandlers) { + if (handler) + handler(msg) + } + } + // } + // } + } + + log.debug = defineForLogLevel(LogLevelDebug, (...messages: any[]) => { + emit({ name, messages, level: LogLevelDebug }) + }) + + log.info = defineForLogLevel(LogLevelInfo, (...messages: any[]) => { + emit({ name, messages, level: LogLevelInfo }) + }) + + log.warn = defineForLogLevel(LogLevelWarn, (...messages: any[]) => { + emit({ name, messages, level: LogLevelWarn }) + }) + + log.error = defineForLogLevel(LogLevelError, (...messages: any[]) => { + emit({ name, messages, level: LogLevelError }) + }) + + log.fatal = defineForLogLevel(LogLevelFatal, (...messages: any[]) => { + emit({ name, messages, level: LogLevelFatal }) + throw new Error(`${messages.map(String).join(' ')}`) + }) + + log.assert = defineForLogLevel(LogLevelFatal, (condition: unknown, ...args: any) => { + if (condition == null || (typeof condition === 'number' && Number.isNaN(condition)) || !condition) + log.fatal(...args) + }) + + return log + } + + function Logger(name = '', level?: LogLevelAliasType): LoggerInterface { + const log = logFactory(name, level) + if (logDebug) + log.debug(`+++ init of logger "${name}" on level "${log.level}".`) + return log + } + + Logger.registerHandler = function (handler: LogHandler) { + logHandlers.push(handler) + } + + /** @deprecated */ + Logger.setFilter = function (namespaces: string) { + logCheckNamespace = useNamespaceFilter(namespaces) + } + + Logger.setLock = (lock = true) => (logLock = lock) + + Logger.setDebug = (debug = true) => (logDebug = debug) + + Logger.setHandlers = function (handlers: LogHandler[] = []) { + if (logFactory !== LoggerBaseFactory) + logFactory = LoggerBaseFactory + + if (logLock) + return + logHandlers = [...handlers].filter(h => typeof h === 'function') + } + + Logger.level = LogLevelAll + + /** @deprecated */ + Logger.setLogLevel = function (level: LogLevel = LogLevelAll) { + if (logLock) + return + Logger.level = level + } + + Logger.setFactory = function ( + factory: (name?: string) => LoggerInterface, + ): void { + if (logLock) + return + logFactory = factory + } + + return Logger +} diff --git a/src/common/log-memory.spec.ts b/src/common/log-memory.spec.ts index c4208856..7077d951 100644 --- a/src/common/log-memory.spec.ts +++ b/src/common/log-memory.spec.ts @@ -1,5 +1,5 @@ import { LoggerInterface, LogLevelAll, LogMessage } from './log-base' -import { LoggerContext } from './log-base' +import { LoggerContext } from './log-context' import { LoggerMemoryHandler } from './log-memory' describe('log-memory', () => { diff --git a/src/common/log.spec.ts b/src/common/log.spec.ts index cc974a16..38fdf4b8 100644 --- a/src/common/log.spec.ts +++ b/src/common/log.spec.ts @@ -1,8 +1,7 @@ // (C)opyright 2021-07-15 Dirk Holtwick, holtwick.it. All rights reserved. import type { LoggerInterface, LogMessage } from './log-base' -import { LogLevel, LoggerContext } from './log-base' -import { DefaultLogger } from './log' +import { LoggerContext } from './log-context' describe('Logger', () => { test('should log different levels', () => { diff --git a/src/common/log.ts b/src/common/log.ts index 1be6a0e3..7b2fbd61 100644 --- a/src/common/log.ts +++ b/src/common/log.ts @@ -2,7 +2,7 @@ import { getGlobalContext } from './global' import type { LogLevelAliasType, LoggerContextInterface, LoggerInterface } from './log-base' -import { LoggerContext } from './log-base' +import { LoggerContext } from './log-context' import { LoggerConsoleHandler } from './log-console' // Global logger to guarantee all submodules use the same logger instance diff --git a/src/common/msg/emitter.ts b/src/common/msg/emitter.ts index abca6830..39f69bc7 100644 --- a/src/common/msg/emitter.ts +++ b/src/common/msg/emitter.ts @@ -1,10 +1,10 @@ // (C)opyright 2021-07-15 Dirk Holtwick, holtwick.it. All rights reserved. import { getSecureRandomIfPossible } from '../data/math' -import type { Disposable, DisposerFunction } from '../dispose-types' import { useDispose } from '../dispose-defer' -import { getGlobalContext } from '../global' +import type { DisposerFunction } from '../dispose-types' import { promisify } from '../exec/promise' +import { getGlobalContext } from '../global' import { DefaultLogger } from '../log' export type EmitterHandler = (...objs: any[]) => void @@ -28,7 +28,7 @@ export declare interface DefaultListener { export class Emitter< RemoteListener extends ListenerSignature = DefaultListener, LocalListener extends ListenerSignature = RemoteListener, -> implements Disposable { +> { subscribers: any = {} subscribersOnAny: any[] = [] From 214c12e0202d86b71190ff7669e33ae7d3a9dff1 Mon Sep 17 00:00:00 2001 From: Dirk Holtwick Date: Tue, 5 Sep 2023 21:09:24 +0200 Subject: [PATCH 6/9] Last cycle --- src/common/bin/lib0/buffer.ts | 14 -------------- src/common/bin/lib0/create.ts | 19 +++++++++++++++++++ src/common/bin/lib0/decoding.ts | 2 +- src/common/bin/lib0/encoding.ts | 2 +- 4 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 src/common/bin/lib0/create.ts diff --git a/src/common/bin/lib0/buffer.ts b/src/common/bin/lib0/buffer.ts index 782ec716..bcc5522d 100644 --- a/src/common/bin/lib0/buffer.ts +++ b/src/common/bin/lib0/buffer.ts @@ -11,20 +11,6 @@ export function createUint8ArrayFromLen(len: number) { return new Uint8Array(len) } -/** - * Create Uint8Array with initial content from buffer - */ -export function createUint8ArrayViewFromArrayBuffer(buffer: ArrayBuffer, byteOffset: number, length: number) { - return new Uint8Array(buffer, byteOffset, length) -} - -/** - * Create Uint8Array with initial content from buffer - */ -export function createUint8ArrayFromArrayBuffer(buffer: ArrayBuffer) { - return new Uint8Array(buffer) -} - /** * Copy the content of an Uint8Array view to a new ArrayBuffer. */ diff --git a/src/common/bin/lib0/create.ts b/src/common/bin/lib0/create.ts new file mode 100644 index 00000000..6e7ca6d4 --- /dev/null +++ b/src/common/bin/lib0/create.ts @@ -0,0 +1,19 @@ +/** + * Original at https://github.com/dmonad/lib0 + * + * Utility functions to work with buffers (Uint8Array). + */ + +/** + * Create Uint8Array with initial content from buffer + */ +export function createUint8ArrayViewFromArrayBuffer(buffer: ArrayBuffer, byteOffset: number, length: number) { + return new Uint8Array(buffer, byteOffset, length) +} + +/** + * Create Uint8Array with initial content from buffer + */ +export function createUint8ArrayFromArrayBuffer(buffer: ArrayBuffer) { + return new Uint8Array(buffer) +} diff --git a/src/common/bin/lib0/decoding.ts b/src/common/bin/lib0/decoding.ts index c67416df..54ed3ae7 100644 --- a/src/common/bin/lib0/decoding.ts +++ b/src/common/bin/lib0/decoding.ts @@ -27,7 +27,7 @@ */ import { BIT7, BIT8, BITS6, BITS7 } from './binary' -import { createUint8ArrayViewFromArrayBuffer } from './buffer' +import { createUint8ArrayViewFromArrayBuffer } from './create' import { getUtf8TextDecoder } from './string' const errorUnexpectedEndOfArray = 'Unexpected end of array' diff --git a/src/common/bin/lib0/encoding.ts b/src/common/bin/lib0/encoding.ts index 8bc27059..ee7fc47d 100644 --- a/src/common/bin/lib0/encoding.ts +++ b/src/common/bin/lib0/encoding.ts @@ -27,7 +27,7 @@ */ import { BIT7, BIT8, BITS31, BITS6, BITS7, BITS8 } from './binary' -import { createUint8ArrayViewFromArrayBuffer } from './buffer' +import { createUint8ArrayViewFromArrayBuffer } from './create' import { encodeUtf8, getUtf8TextEncoder } from './string' /** From d3da982b9e9c8c966f819c058935db3c1b285c14 Mon Sep 17 00:00:00 2001 From: Dirk Holtwick Date: Tue, 5 Sep 2023 21:16:06 +0200 Subject: [PATCH 7/9] Make check part of the pre publish step --- package.json | 53 +++++++++++++++++++++++---------------------- src/common/index.ts | 1 + 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index beab429e..981530f6 100644 --- a/package.json +++ b/package.json @@ -1,26 +1,7 @@ { "name": "zeed", - "type": "module", "version": "0.12.0", "description": "🌱 Simple foundation library", - "author": { - "name": "Dirk Holtwick", - "email": "dirk.holtwick@gmail.com", - "url": "https://holtwick.de" - }, - "license": "MIT", - "funding": { - "type": "GitHub Sponsors ❤", - "url": "https://github.com/sponsors/holtwick" - }, - "homepage": "https://github.com/holtwick/zeed", - "repository": { - "type": "git", - "url": "https://github.com/holtwick/zeed.git" - }, - "bugs": { - "url": "https://github.com/holtwick/zeed/issues" - }, "keywords": [ "foundation", "typescript", @@ -31,7 +12,26 @@ "utils", "zeed" ], + "homepage": "https://github.com/holtwick/zeed", + "bugs": { + "url": "https://github.com/holtwick/zeed/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/holtwick/zeed.git" + }, + "funding": { + "type": "GitHub Sponsors ❤", + "url": "https://github.com/sponsors/holtwick" + }, + "license": "MIT", + "author": { + "name": "Dirk Holtwick", + "email": "dirk.holtwick@gmail.com", + "url": "https://holtwick.de" + }, "sideEffects": false, + "type": "module", "exports": { ".": { "types": "./dist/index.all.d.ts", @@ -47,24 +47,21 @@ "files": [ "dist" ], - "engines": { - "node": ">=18" - }, "scripts": { "build": "nr clean && nr build:tsup", "build:tsup": "tsup src/index.all.ts --dts-only && tsup src/index.browser.ts src/index.node.ts", "check": "tsc --noEmit -p tsconfig.json", + "circles": "madge --circular --summary --orphans --leaves --warning --extensions ts src", "clean": "rm -rf dist", "coverage": "vitest --run --coverage", "lint": "eslint .", "lint:fix": "eslint . --fix", - "prepublishOnly": "nr build && nr test:publish", + "prepublishOnly": "nr build && nr circles && nr lint && nr test:publish", + "release": "na version patch && na publish", "start": "nr watch", "test": "vitest", "test:publish": "vitest --run", - "watch": "nr build:tsup -- --watch", - "circles": "nlx madge --circular --extensions ts src", - "release": "na version patch && na publish" + "watch": "nr build:tsup -- --watch" }, "devDependencies": { "@antfu/eslint-config": "^0.41.0", @@ -74,9 +71,13 @@ "cross-fetch": "^4.0.0", "esbuild": "^0.19.2", "eslint": "^8.48.0", + "madge": "^6.1.0", "tsup": "^7.2.0", "typescript": "^5.2.2", "vite": "^4.4.9", "vitest": "^0.34.3" + }, + "engines": { + "node": ">=18" } } diff --git a/src/common/index.ts b/src/common/index.ts index aaeba3a9..ad75cc09 100644 --- a/src/common/index.ts +++ b/src/common/index.ts @@ -15,6 +15,7 @@ export * from './log' export * from './log-base' export * from './log-colors' export * from './log-console' +export * from './log-context' export * from './log-filter' export * from './log-memory' export * from './msg' From e575c0fcb60d7fba0a08bf395aed91b105c40338 Mon Sep 17 00:00:00 2001 From: Dirk Holtwick Date: Tue, 5 Sep 2023 21:16:24 +0200 Subject: [PATCH 8/9] 0.13.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 981530f6..b56d31a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zeed", - "version": "0.12.0", + "version": "0.13.0", "description": "🌱 Simple foundation library", "keywords": [ "foundation", From ead81ce1449e964ee8150ab3b34f280e57e990b9 Mon Sep 17 00:00:00 2001 From: Dirk Holtwick Date: Tue, 5 Sep 2023 21:16:26 +0200 Subject: [PATCH 9/9] 0.13.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b56d31a4..07c24015 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zeed", - "version": "0.13.0", + "version": "0.13.1", "description": "🌱 Simple foundation library", "keywords": [ "foundation",