@holz/env-filter 0.8.2 → 0.8.3-rc.154

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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@holz/pattern-filter"),c=e=>{if(typeof process<"u"&&"env"in process)return process.env[e]},l=e=>{try{if(typeof localStorage<"u")return localStorage.getItem(e)??void 0}catch{}},s=({processor:e,pattern:t,defaultPattern:r,localStorageKey:n="debug",environmentVariable:o="DEBUG"})=>{const a=()=>l(n)??c(o);return i.createPatternFilter({processor:e,pattern:t??a()??r??"*"})};exports.createEnvironmentFilter=s;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@holz/pattern-filter");var t=e=>{if(typeof process<`u`&&`env`in process)return process.env[e]},n=e=>{try{if(typeof localStorage<`u`)return localStorage.getItem(e)??void 0}catch{}},r=({processor:r,pattern:i,defaultPattern:a,localStorageKey:o=`debug`,environmentVariable:s=`DEBUG`})=>(0,e.createPatternFilter)({processor:r,pattern:i??n(o)??t(s)??a??`*`});exports.createEnvironmentFilter=r;
@@ -1,23 +1,14 @@
1
- import { createPatternFilter as a } from "@holz/pattern-filter";
2
- const c = (e) => {
3
- if (typeof process < "u" && "env" in process)
4
- return process.env[e];
5
- }, i = (e) => {
6
- try {
7
- if (typeof localStorage < "u")
8
- return localStorage.getItem(e) ?? void 0;
9
- } catch {
10
- }
11
- }, m = ({
12
- processor: e,
13
- pattern: t,
14
- defaultPattern: r,
15
- localStorageKey: n = "debug",
16
- environmentVariable: o = "DEBUG"
17
- }) => a({
18
- processor: e,
19
- pattern: t ?? (i(n) ?? c(o)) ?? r ?? "*"
1
+ import { createPatternFilter as e } from "@holz/pattern-filter";
2
+ //#region src/get-env.ts
3
+ var t = (e) => {
4
+ if (typeof process < "u" && "env" in process) return process.env[e];
5
+ }, n = (e) => {
6
+ try {
7
+ if (typeof localStorage < "u") return localStorage.getItem(e) ?? void 0;
8
+ } catch {}
9
+ }, r = ({ processor: r, pattern: i, defaultPattern: a, localStorageKey: o = "debug", environmentVariable: s = "DEBUG" }) => e({
10
+ processor: r,
11
+ pattern: i ?? n(o) ?? t(s) ?? a ?? "*"
20
12
  });
21
- export {
22
- m as createEnvironmentFilter
23
- };
13
+ //#endregion
14
+ export { r as createEnvironmentFilter };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,18 +1,15 @@
1
- import { LogProcessor } from '@holz/core';
2
-
3
- declare interface Config {
4
- /** Replace the detected pattern with something else. */
5
- pattern?: string;
6
- /** The default pattern to use if no pattern is provided. */
7
- defaultPattern?: string;
8
- /** Where to send the logs if they pass the filter. */
9
- processor: LogProcessor;
10
- /** The localStorage key where patterns are saved. Default is `debug`. */
11
- localStorageKey?: string;
12
- /** The environment variable where patterns are saved. Default is `DEBUG`. */
13
- environmentVariable?: string;
14
- }
15
-
16
- export declare const createEnvironmentFilter: ({ processor, pattern, defaultPattern, localStorageKey, environmentVariable, }: Config) => LogProcessor;
17
-
18
- export { }
1
+ import { LogProcessor } from '@holz/core';
2
+ export declare const createEnvironmentFilter: ({ processor, pattern, defaultPattern, localStorageKey, environmentVariable, }: Config) => LogProcessor;
3
+ interface Config {
4
+ /** Replace the detected pattern with something else. */
5
+ pattern?: string;
6
+ /** The default pattern to use if no pattern is provided. */
7
+ defaultPattern?: string;
8
+ /** Where to send the logs if they pass the filter. */
9
+ processor: LogProcessor;
10
+ /** The localStorage key where patterns are saved. Default is `debug`. */
11
+ localStorageKey?: string;
12
+ /** The environment variable where patterns are saved. Default is `DEBUG`. */
13
+ environmentVariable?: string;
14
+ }
15
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const getEnvironmentVariable: (key: string) => undefined | string;
2
+ export declare const getLocalStorageKey: (key: string) => undefined | string;
@@ -0,0 +1 @@
1
+ export { createEnvironmentFilter } from './environment-filter';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holz/env-filter",
3
- "version": "0.8.2",
3
+ "version": "0.8.3-rc.154+3f5148e",
4
4
  "description": "Filter logs based on the current environment.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -33,24 +33,24 @@
33
33
  ],
34
34
  "scripts": {
35
35
  "prepack": "vite build",
36
- "test:unit": "vitest --color --passWithNoTests",
36
+ "test:unit": "vitest run --color --passWithNoTests",
37
37
  "test:types": "tsc"
38
38
  },
39
39
  "dependencies": {
40
- "@holz/pattern-filter": "^0.8.2"
40
+ "@holz/pattern-filter": "^0.8.3-rc.154+3f5148e"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@holz/core": "^0.8.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@holz/core": "^0.8.2",
47
- "@types/node": "^22.0.0",
48
- "@vitest/coverage-v8": "^3.0.8",
49
- "typescript": "^5.8.2",
50
- "vite": "^6.0.0",
51
- "vite-plugin-dts": "^4.5.3",
52
- "vite-tsconfig-paths": "^5.1.4",
53
- "vitest": "^3.0.8"
46
+ "@holz/core": "^0.8.3-rc.154+3f5148e",
47
+ "@types/node": "^24.0.0",
48
+ "@vitest/coverage-v8": "^4.0.0",
49
+ "typescript": "^6.0.0",
50
+ "vite": "^8.0.0",
51
+ "vite-plugin-dts": "^5.0.0",
52
+ "vite-tsconfig-paths": "^6.0.0",
53
+ "vitest": "^4.0.0"
54
54
  },
55
- "gitHead": "f099a09cd01834de9bc1714908183cbb7b828c85"
55
+ "gitHead": "3f5148eb94bb1d7200d4b4993c95ea30db76b0c4"
56
56
  }