@holz/console-backend 0.6.0 → 0.7.0-rc.1

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.
@@ -0,0 +1,19 @@
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 function 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
+ declare type MinimalConsole = Pick<Console, 'debug' | 'info' | 'warn' | 'error'>;
14
+
15
+ declare interface Options {
16
+ console?: MinimalConsole;
17
+ }
18
+
19
+ export { }
@@ -6,7 +6,7 @@ function l(s = {}) {
6
6
  const r = s.console ?? console;
7
7
  let e;
8
8
  return (t) => {
9
- const n = new Date(), c = [
9
+ const n = /* @__PURE__ */ new Date(), c = [
10
10
  {
11
11
  include: !0,
12
12
  format: "%s",
package/package.json CHANGED
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "name": "@holz/console-backend",
3
- "version": "0.6.0",
3
+ "version": "0.7.0-rc.1",
4
4
  "description": "A console backend for Holz",
5
5
  "type": "module",
6
- "main": "./dist/holz-console-backend.cjs",
7
- "module": "./dist/holz-console-backend.js",
8
- "types": "./src/index.ts",
9
6
  "repository": {
10
7
  "type": "git",
11
8
  "url": "https://github.com/PsychoLlama/holz",
@@ -13,6 +10,7 @@
13
10
  },
14
11
  "exports": {
15
12
  ".": {
13
+ "types": "./dist/holz-console-backend.d.ts",
16
14
  "require": "./dist/holz-console-backend.cjs",
17
15
  "import": "./dist/holz-console-backend.js"
18
16
  }
@@ -38,12 +36,18 @@
38
36
  "test:unit": "vitest --color --passWithNoTests",
39
37
  "test:types": "tsc"
40
38
  },
39
+ "peerDependencies": {
40
+ "@holz/core": "0.7.0-rc.1"
41
+ },
41
42
  "devDependencies": {
42
- "@holz/core": "^0.6.0",
43
- "@types/node": "^18.14.0",
44
- "@vitest/coverage-c8": "^0.28.5",
45
- "typescript": "^4.9.5",
46
- "vite": "^4.0.0",
47
- "vitest": "^0.28.5"
48
- }
43
+ "@holz/core": "^0.7.0-rc.1",
44
+ "@types/node": "^22.0.0",
45
+ "@vitest/coverage-v8": "^3.0.8",
46
+ "typescript": "^5.0.0",
47
+ "vite": "^6.0.0",
48
+ "vite-plugin-dts": "^4.5.3",
49
+ "vite-tsconfig-paths": "^5.1.4",
50
+ "vitest": "^3.0.8"
51
+ },
52
+ "stableVersion": "0.6.1"
49
53
  }
@@ -1,4 +1,4 @@
1
- // Vitest Snapshot v1
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
3
  exports[`Console backend > avoids changing debug messages 1`] = `
4
4
  [
@@ -36,7 +36,7 @@ describe('Console backend', () => {
36
36
  logger.info('hello world');
37
37
 
38
38
  expect(output.print).toHaveBeenCalledWith(
39
- expect.stringContaining('hello world')
39
+ expect.stringContaining('hello world'),
40
40
  );
41
41
  });
42
42
 
@@ -50,7 +50,7 @@ describe('Console backend', () => {
50
50
  logger.debug('initialized');
51
51
 
52
52
  expect(output.print).toHaveBeenCalledWith(
53
- expect.stringContaining('my-lib:MyClass')
53
+ expect.stringContaining('my-lib:MyClass'),
54
54
  );
55
55
  });
56
56
 
@@ -63,7 +63,7 @@ describe('Console backend', () => {
63
63
 
64
64
  // Hard to test without replicating the implementation.
65
65
  expect(output.print).toHaveBeenCalledWith(
66
- expect.stringContaining('sessionId')
66
+ expect.stringContaining('sessionId'),
67
67
  );
68
68
 
69
69
  expect(output.print).toHaveBeenCalledWith(expect.stringContaining('3109'));
@@ -111,7 +111,7 @@ describe('Console backend', () => {
111
111
  const backend = createConsoleBackend({ console: output });
112
112
  const logger = namespace.reduce(
113
113
  (logger, ns) => logger.namespace(ns),
114
- createLogger(backend)
114
+ createLogger(backend),
115
115
  );
116
116
 
117
117
  logger[method](message, { id: 1234 });