@holz/console-backend 0.9.2-rc.9.sha-de3724b → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,18 @@
1
- import { LogProcessor } from '@holz/core';
2
-
3
- /**
4
- * A backend that pretty-prints logs to a browser console, or any
5
- * remote-attached console.
6
- */
7
- export declare const createConsoleBackend: (options?: Options) => LogProcessor;
8
-
9
- /**
10
- * A subset of the Console interface. Must support printf-style interpolation.
11
- * @see https://console.spec.whatwg.org/#formatting-specifiers
12
- *
13
- * Note that `fatal` has no corresponding equivalent. It will be downgraded to
14
- * `error` when printed.
15
- */
16
- declare type MinimalConsole = Pick<Console, 'trace' | 'debug' | 'info' | 'warn' | 'error'>;
17
-
18
- declare interface Options {
19
- console?: MinimalConsole;
20
- }
21
-
22
- export { }
1
+ import { LogProcessor } from "@holz/core";
2
+ /**
3
+ * A backend that pretty-prints logs to a browser console, or any
4
+ * remote-attached console.
5
+ */
6
+ export declare const createConsoleBackend: (options?: Options) => LogProcessor;
7
+ interface Options {
8
+ console?: MinimalConsole;
9
+ }
10
+ /**
11
+ * A subset of the Console interface. Must support printf-style interpolation.
12
+ * @see https://console.spec.whatwg.org/#formatting-specifiers
13
+ *
14
+ * Note that `fatal` has no corresponding equivalent. It will be downgraded to
15
+ * `error` when printed.
16
+ */
17
+ type MinimalConsole = Pick<Console, "trace" | "debug" | "info" | "warn" | "error">;
18
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { level as e } from "@holz/core";
2
- //#region src/time-delta.ts
2
+ // src/time-delta.ts
3
3
  var t = 1e3, n = 60 * t, r = 60 * n, i = 24 * r, a = (e, a = e) => {
4
4
  let o = e.getTime() - a.getTime(), s = Math.abs(o), c = o < 0 ? "" : "+";
5
5
  return s >= i ? `${c}${Math.round(o / i)}d` : s >= r ? `${c}${Math.round(o / r)}h` : s >= n ? `${c}${Math.round(o / n)}m` : s >= t ? `${c}${Math.round(o / t)}s` : `${c}${o}ms`;
@@ -43,5 +43,4 @@ var t = 1e3, n = 60 * t, r = 60 * n, i = 24 * r, a = (e, a = e) => {
43
43
  [e.error]: "error",
44
44
  [e.fatal]: "error"
45
45
  };
46
- //#endregion
47
46
  export { o as createConsoleBackend };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holz/console-backend",
3
- "version": "0.9.2-rc.9.sha-de3724b",
3
+ "version": "0.10.0",
4
4
  "description": "A console backend for Holz",
5
5
  "type": "module",
6
6
  "repository": {
@@ -12,12 +12,12 @@
12
12
  ".": {
13
13
  "source": "./src/index.ts",
14
14
  "types": "./dist/holz-console-backend.d.ts",
15
- "require": "./dist/holz-console-backend.cjs",
16
- "import": "./dist/holz-console-backend.js"
15
+ "default": "./dist/holz-console-backend.js"
17
16
  }
18
17
  },
19
18
  "publishConfig": {
20
- "access": "public"
19
+ "access": "public",
20
+ "timeout": 60000
21
21
  },
22
22
  "author": "Jesse Gibson",
23
23
  "license": "MIT",
@@ -40,18 +40,16 @@
40
40
  "test:types": "tsc"
41
41
  },
42
42
  "peerDependencies": {
43
- "@holz/core": "^0.8.0 || ^0.9.0"
43
+ "@holz/core": "^0.8.0 || ^0.9.0 || ^0.10.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@holz/core": "^0.9.2-rc.9.sha-de3724b",
47
- "@microsoft/api-extractor": "^7.58.8",
48
- "@types/node": "^24.0.0",
46
+ "@holz/core": "^0.10.0",
47
+ "@types/node": "^26.0.0",
49
48
  "@vitest/coverage-v8": "^5.0.0",
49
+ "rolldown-plugin-dts": "^0.28.8",
50
50
  "typescript": "^6.0.0",
51
51
  "vite": "^8.0.0",
52
- "vite-plugin-dts": "^5.0.0",
53
- "vite-tsconfig-paths": "^6.0.0",
54
52
  "vitest": "^5.0.0"
55
53
  },
56
- "gitHead": "de3724b406e0bd8c31e18d6df61d424a1513463b"
54
+ "gitHead": "929ed730c793ac0e8e6d0d8bb1fa9bc5dfd2a7ae"
57
55
  }
@@ -1,4 +1,5 @@
1
- import { level, type LogLevel, type Log, type LogProcessor } from '@holz/core';
1
+ import { level } from '@holz/core';
2
+ import type { LogLevel, Log, LogProcessor } from '@holz/core';
2
3
  import { timeDelta } from './time-delta';
3
4
 
4
5
  /**
package/src/time-delta.ts CHANGED
@@ -8,7 +8,7 @@ const day = 24 * hour;
8
8
  *
9
9
  * Inspired by the `ms` package. Thanks TJ.
10
10
  */
11
- export const timeDelta = (now: Date, then: Date = now) => {
11
+ export const timeDelta = (now: Date, then: Date = now): string => {
12
12
  const offset = now.getTime() - then.getTime();
13
13
  const distance = Math.abs(offset);
14
14
  const sign = offset < 0 ? '' : '+';
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@holz/core");var t=1e3,n=60*t,r=60*n,i=24*r,a=(e,a=e)=>{let o=e.getTime()-a.getTime(),s=Math.abs(o),c=o<0?``:`+`;return s>=i?`${c}${Math.round(o/i)}d`:s>=r?`${c}${Math.round(o/r)}h`:s>=n?`${c}${Math.round(o/n)}m`:s>=t?`${c}${Math.round(o/t)}s`:`${c}${o}ms`},o=(e={})=>{let t=e.console??console,n;return e=>{let r=new Date(e.timestamp),{error:i,...o}=e.context,c=[{include:!0,format:`%s`,values:[e.message]},{include:Object.keys(o).length>0,format:`%o`,values:[o]},{include:!0,format:`%c%s`,values:[`color: gray`,a(r,n)]},{include:e.origin.length>0,format:`%c%s`,values:[`color: rgba(128, 128, 128, 0.6); font-style: italic`,e.origin.join(`:`)]},{include:i,format:`%o`,values:[i]}].filter(e=>e.include),l=c.map(e=>e.format).join(` `),u=c.flatMap(e=>e.values);t[s[e.level]](l,...u),n=r}},s={[e.level.trace]:`trace`,[e.level.debug]:`debug`,[e.level.info]:`info`,[e.level.warn]:`warn`,[e.level.error]:`error`,[e.level.fatal]:`error`};exports.createConsoleBackend=o;