@holz/env-filter 0.6.1 → 0.7.0-rc.2
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.d.ts +18 -0
- package/dist/holz-env-filter.js +1 -1
- package/package.json +13 -12
- package/src/__tests__/get-env.test.ts +1 -1
- package/src/get-env.ts +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
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 { }
|
package/dist/holz-env-filter.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holz/env-filter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-rc.2",
|
|
4
4
|
"description": "Filter logs based on the current environment.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/holz-env-filter.cjs",
|
|
7
|
-
"module": "./dist/holz-env-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-env-filter.d.ts",
|
|
16
14
|
"require": "./dist/holz-env-filter.cjs",
|
|
17
15
|
"import": "./dist/holz-env-filter.js"
|
|
18
16
|
}
|
|
@@ -40,16 +38,19 @@
|
|
|
40
38
|
"test:types": "tsc"
|
|
41
39
|
},
|
|
42
40
|
"dependencies": {
|
|
43
|
-
"@holz/pattern-filter": "^0.
|
|
41
|
+
"@holz/pattern-filter": "^0.7.0-rc.2"
|
|
44
42
|
},
|
|
45
43
|
"peerDependencies": {
|
|
46
|
-
"@holz/core": "0.
|
|
44
|
+
"@holz/core": "0.7.0-rc.2"
|
|
47
45
|
},
|
|
48
46
|
"devDependencies": {
|
|
49
|
-
"@holz/core": "^0.
|
|
50
|
-
"@types/node": "^
|
|
51
|
-
"@vitest/coverage-v8": "^0.
|
|
52
|
-
"vite": "^
|
|
53
|
-
"
|
|
54
|
-
|
|
47
|
+
"@holz/core": "^0.7.0-rc.2",
|
|
48
|
+
"@types/node": "^22.0.0",
|
|
49
|
+
"@vitest/coverage-v8": "^3.0.8",
|
|
50
|
+
"vite": "^6.0.0",
|
|
51
|
+
"vite-plugin-dts": "^4.5.3",
|
|
52
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
53
|
+
"vitest": "^3.0.8"
|
|
54
|
+
},
|
|
55
|
+
"stableVersion": "0.6.1"
|
|
55
56
|
}
|
package/src/get-env.ts
CHANGED
|
@@ -9,7 +9,7 @@ export const getLocalStorageKey = (key: string): undefined | string => {
|
|
|
9
9
|
if (typeof localStorage !== 'undefined') {
|
|
10
10
|
return localStorage.getItem(key) ?? undefined;
|
|
11
11
|
}
|
|
12
|
-
} catch
|
|
12
|
+
} catch {
|
|
13
13
|
// Sometimes localStorage fails (e.g. in Safari private mode). That's
|
|
14
14
|
// okay. We'll just use a fallback pattern.
|
|
15
15
|
}
|