@holz/pattern-filter 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.
package/README.md CHANGED
@@ -21,7 +21,7 @@ The `processor` option is where you specify which plugin should process the filt
21
21
 
22
22
  ## Patterns
23
23
 
24
- Patterns are strings that match against `log.origin`, which is a property of each log object. Origins are added when you call `logger.namepspace(...)`. The following syntax is supported:
24
+ Patterns are strings that match against `log.origin`, which is a property of each log object. Origins are added when you call `logger.namespace(...)`. The following syntax is supported:
25
25
 
26
26
  - `*` matches zero or more characters.
27
27
  - `-` at the beginning of a pattern negates it, so that logs with origins matching the pattern are hidden rather than shown.
@@ -0,0 +1,27 @@
1
+ import { LogProcessor } from '@holz/core';
2
+
3
+ declare interface Config {
4
+ /** A set of patterns to test against `log.origin`. */
5
+ pattern: string;
6
+ /** Where to send logs if they pass the filter. */
7
+ processor: LogProcessor;
8
+ }
9
+
10
+ /**
11
+ * Only forwards logs who's origin matches the given pattern. It works the
12
+ * same as the popular `debug` module.
13
+ *
14
+ * Patterns allow wildcards and negation. For example, the pattern `my-app*`
15
+ * will match all logs with the origin `my-app` or `my-app:foo` or
16
+ * `my-app:foo:bar`. The pattern `*, -my-app` will match all logs except those
17
+ * with the origin `my-app`.
18
+ *
19
+ * @example
20
+ * createPatternFilter({
21
+ * pattern: 'my-app*, -spammy:library',
22
+ * processor: backend,
23
+ * })
24
+ */
25
+ export declare function createPatternFilter({ processor, pattern, }: Config): LogProcessor;
26
+
27
+ export { }
package/package.json CHANGED
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "name": "@holz/pattern-filter",
3
- "version": "0.6.0",
3
+ "version": "0.7.0-rc.1",
4
4
  "description": "Only print log messages that match a pattern",
5
5
  "type": "module",
6
- "main": "./dist/holz-pattern-filter.cjs",
7
- "module": "./dist/holz-pattern-filter.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-pattern-filter.d.ts",
16
14
  "require": "./dist/holz-pattern-filter.cjs",
17
15
  "import": "./dist/holz-pattern-filter.js"
18
16
  }
@@ -39,11 +37,17 @@
39
37
  "test:unit": "vitest --color --passWithNoTests",
40
38
  "test:types": "tsc"
41
39
  },
40
+ "peerDependencies": {
41
+ "@holz/core": "0.7.0-rc.1"
42
+ },
42
43
  "devDependencies": {
43
- "@holz/core": "^0.6.0",
44
- "@vitest/coverage-c8": "^0.28.5",
45
- "typescript": "^4.9.5",
46
- "vite": "^4.0.0",
47
- "vitest": "^0.28.5"
48
- }
44
+ "@holz/core": "^0.7.0-rc.1",
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
  }
@@ -21,7 +21,7 @@ describe('PatternFilter', () => {
21
21
  expect(backend).toHaveBeenCalledWith(
22
22
  expect.objectContaining({
23
23
  message: 'not ignored',
24
- })
24
+ }),
25
25
  );
26
26
  });
27
27
 
@@ -19,7 +19,7 @@ export const parse = (input: string): PatternFilters => {
19
19
 
20
20
  return groups;
21
21
  },
22
- { include: [], exclude: [] }
22
+ { include: [], exclude: [] },
23
23
  );
24
24
  };
25
25