@perfectest/server 0.0.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,34 @@
1
+ /**
2
+ * Environment utilities for server-side code.
3
+ */
4
+ /**
5
+ * Gets an environment variable, throwing if not defined.
6
+ */
7
+ function getEnvOrThrow(name) {
8
+ const value = process.env[name];
9
+ if (value === undefined) {
10
+ throw new Error(`Environment variable ${name} is not defined`);
11
+ }
12
+ return value;
13
+ }
14
+ /**
15
+ * Gets an environment variable with a fallback default.
16
+ */
17
+ function getEnv(name, defaultValue) {
18
+ return process.env[name] ?? defaultValue;
19
+ }
20
+ /**
21
+ * Checks if running in production mode.
22
+ */
23
+ function isProduction() {
24
+ return process.env.NODE_ENV === "production";
25
+ }
26
+ /**
27
+ * Checks if running in development mode.
28
+ */
29
+ function isDevelopment() {
30
+ return process.env.NODE_ENV === "development";
31
+ }
32
+
33
+ export { getEnv, getEnvOrThrow, isDevelopment, isProduction };
34
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sources":["../../../src/env.ts"],"sourcesContent":["/**\n * Environment utilities for server-side code.\n */\n\n/**\n * Gets an environment variable, throwing if not defined.\n */\nexport function getEnvOrThrow(name: string): string {\n const value = process.env[name];\n if (value === undefined) {\n throw new Error(`Environment variable ${name} is not defined`);\n }\n return value;\n}\n\n/**\n * Gets an environment variable with a fallback default.\n */\nexport function getEnv(name: string, defaultValue: string): string {\n return process.env[name] ?? defaultValue;\n}\n\n/**\n * Checks if running in production mode.\n */\nexport function isProduction(): boolean {\n return process.env.NODE_ENV === \"production\";\n}\n\n/**\n * Checks if running in development mode.\n */\nexport function isDevelopment(): boolean {\n return process.env.NODE_ENV === \"development\";\n}\n\n"],"names":[],"mappings":"AAAA;;AAEG;AAEH;;AAEG;AACG,SAAU,aAAa,CAAC,IAAY,EAAA;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;AAC/B,IAAA,IAAI,KAAK,KAAK,SAAS,EAAE;AACvB,QAAA,MAAM,IAAI,KAAK,CAAC,wBAAwB,IAAI,CAAA,eAAA,CAAiB,CAAC;IAChE;AACA,IAAA,OAAO,KAAK;AACd;AAEA;;AAEG;AACG,SAAU,MAAM,CAAC,IAAY,EAAE,YAAoB,EAAA;IACvD,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,YAAY;AAC1C;AAEA;;AAEG;SACa,YAAY,GAAA;AAC1B,IAAA,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;AAC9C;AAEA;;AAEG;SACa,aAAa,GAAA;AAC3B,IAAA,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;AAC/C;;;;"}
@@ -0,0 +1,3 @@
1
+ export * from '@perfectest/shared';
2
+ export { getEnv, getEnvOrThrow, isDevelopment, isProduction } from './env.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Environment utilities for server-side code.
3
+ */
4
+ /**
5
+ * Gets an environment variable, throwing if not defined.
6
+ */
7
+ export declare function getEnvOrThrow(name: string): string;
8
+ /**
9
+ * Gets an environment variable with a fallback default.
10
+ */
11
+ export declare function getEnv(name: string, defaultValue: string): string;
12
+ /**
13
+ * Checks if running in production mode.
14
+ */
15
+ export declare function isProduction(): boolean;
16
+ /**
17
+ * Checks if running in development mode.
18
+ */
19
+ export declare function isDevelopment(): boolean;
20
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/env.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @perfectest/server
3
+ * Node.js server-side utilities and helpers.
4
+ */
5
+ export * from "@perfectest/shared";
6
+ export * from "./env.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,oBAAoB,CAAC;AAGnC,cAAc,UAAU,CAAC"}
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@perfectest/server",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/types/index.d.ts",
9
+ "import": "./dist/esm/index.js"
10
+ },
11
+ "./*": {
12
+ "types": "./dist/types/*.d.ts",
13
+ "import": "./dist/esm/*.js"
14
+ }
15
+ },
16
+ "main": "./dist/esm/index.js",
17
+ "types": "./dist/types/index.d.ts",
18
+ "files": [
19
+ "dist",
20
+ "src"
21
+ ],
22
+ "dependencies": {
23
+ "@perfectest/shared": "0.0.1"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "22.19.3",
27
+ "eslint": "9.39.1",
28
+ "typescript": "5.9.3"
29
+ },
30
+ "scripts": {
31
+ "build": "rollup -c && tsc -p tsconfig.build.json",
32
+ "dev": "rollup -c -w",
33
+ "lint": "eslint . --max-warnings 0",
34
+ "check-types": "tsc --noEmit"
35
+ }
36
+ }
package/src/env.ts ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Environment utilities for server-side code.
3
+ */
4
+
5
+ /**
6
+ * Gets an environment variable, throwing if not defined.
7
+ */
8
+ export function getEnvOrThrow(name: string): string {
9
+ const value = process.env[name];
10
+ if (value === undefined) {
11
+ throw new Error(`Environment variable ${name} is not defined`);
12
+ }
13
+ return value;
14
+ }
15
+
16
+ /**
17
+ * Gets an environment variable with a fallback default.
18
+ */
19
+ export function getEnv(name: string, defaultValue: string): string {
20
+ return process.env[name] ?? defaultValue;
21
+ }
22
+
23
+ /**
24
+ * Checks if running in production mode.
25
+ */
26
+ export function isProduction(): boolean {
27
+ return process.env.NODE_ENV === "production";
28
+ }
29
+
30
+ /**
31
+ * Checks if running in development mode.
32
+ */
33
+ export function isDevelopment(): boolean {
34
+ return process.env.NODE_ENV === "development";
35
+ }
36
+
package/src/index.ts ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @perfectest/server
3
+ * Node.js server-side utilities and helpers.
4
+ */
5
+
6
+ // Re-export shared utilities for convenience
7
+ export * from "@perfectest/shared";
8
+
9
+ // Server-specific exports
10
+ export * from "./env.js";
11
+