@holz/env-filter 0.8.2 → 0.8.3-rc.152
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/dist/holz-env-filter.cjs +1 -1
- package/dist/holz-env-filter.js +13 -22
- package/dist/src/__tests__/environment-filter.test.d.ts +1 -0
- package/dist/src/__tests__/get-env.test.d.ts +1 -0
- package/dist/{holz-env-filter.d.ts → src/environment-filter.d.ts} +15 -18
- package/dist/src/get-env.d.ts +2 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +12 -12
package/dist/holz-env-filter.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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;
|
package/dist/holz-env-filter.js
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
import { createPatternFilter as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
},
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
22
|
-
|
|
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
|
-
|
|
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 @@
|
|
|
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.
|
|
3
|
+
"version": "0.8.3-rc.152+a4ea736",
|
|
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.
|
|
40
|
+
"@holz/pattern-filter": "^0.8.3-rc.152+a4ea736"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@holz/core": "^0.8.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@holz/core": "^0.8.
|
|
47
|
-
"@types/node": "^
|
|
48
|
-
"@vitest/coverage-v8": "^
|
|
49
|
-
"typescript": "^
|
|
50
|
-
"vite": "^
|
|
51
|
-
"vite-plugin-dts": "^
|
|
52
|
-
"vite-tsconfig-paths": "^
|
|
53
|
-
"vitest": "^
|
|
46
|
+
"@holz/core": "^0.8.3-rc.152+a4ea736",
|
|
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": "
|
|
55
|
+
"gitHead": "a4ea7361cad7340841a12ca7c7366ffbd25eaa35"
|
|
56
56
|
}
|