@alwatr/env 5.5.28 → 5.5.29
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/CHANGELOG.md +10 -0
- package/dist/main.cjs +1 -2
- package/dist/main.cjs.map +1 -1
- package/dist/main.mjs +1 -2
- package/dist/main.mjs.map +1 -1
- package/package.json +17 -17
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [5.5.29](https://github.com/Alwatr/nanolib/compare/@alwatr/env@5.5.28...@alwatr/env@5.5.29) (2026-03-16)
|
|
7
|
+
|
|
8
|
+
### 🔨 Code Refactoring
|
|
9
|
+
|
|
10
|
+
* migrate build scripts from yarn to bun across multiple packages ([d90e962](https://github.com/Alwatr/nanolib/commit/d90e962f15e5c951e191d5f02341279b6472abc3))
|
|
11
|
+
|
|
12
|
+
### 🔗 Dependencies update
|
|
13
|
+
|
|
14
|
+
* bump the npm-dependencies group with 10 updates ([c48d9ba](https://github.com/Alwatr/nanolib/commit/c48d9baa1cd7c2dc144b3e01e0fda60bf87c074c))
|
|
15
|
+
|
|
6
16
|
## [5.5.28](https://github.com/Alwatr/nanolib/compare/@alwatr/env@5.5.27...@alwatr/env@5.5.28) (2026-02-18)
|
|
7
17
|
|
|
8
18
|
### 🔗 Dependencies update
|
package/dist/main.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** 📦 @alwatr/env v5.5.
|
|
2
|
-
__dev_mode__: console.debug("📦 @alwatr/env v5.5.28");
|
|
1
|
+
/** 📦 @alwatr/env v5.5.29 */
|
|
3
2
|
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var main_exports={};__export(main_exports,{getEnv:()=>getEnv});module.exports=__toCommonJS(main_exports);var import_platform_info=require("@alwatr/platform-info");function getEnv(option){let value=process.env[option.name];if(value==="")value=void 0;if(import_platform_info.platformInfo.development===true){value??=option.developmentValue??option.defaultValue}else{value??=option.defaultValue}if(value===void 0){throw new Error(`Environment variable "${option.name}" is required.`)}return value}0&&(module.exports={getEnv});
|
|
4
3
|
//# sourceMappingURL=main.cjs.map
|
package/dist/main.cjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
4
|
"sourcesContent": ["import {platformInfo} from '@alwatr/platform-info';\n\n/**\n * Parameters for retrieving an environment variable value.\n */\nexport type GetEnvOption = {\n /**\n * The name of the environment variable.\n */\n name: string;\n\n /**\n * The default value to use if the environment variable is not set.\n * If not provided, the environment variable is required and an error will be thrown if it is not set.\n * Except in development mode, where the development value will be used instead if provided.\n */\n defaultValue?: string;\n\n /**\n * The value to use in a development environment.\n * It will be overwrite the default value in development mode and completely ignored in production mode.\n */\n developmentValue?: string;\n};\n\nexport function getEnv(option: GetEnvOption): string {\n let value = process.env[option.name];\n if (value === '') value = undefined; // empty string is considered as undefined in environment variables\n\n if (platformInfo.development === true) {\n value ??= option.developmentValue ?? option.defaultValue;\n }\n else {\n value ??= option.defaultValue;\n }\n\n if (value === undefined) {\n throw new Error(`Environment variable \"${option.name}\" is required.`);\n }\n\n return value;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";qqBAAA,kIAA2B,iCAyBpB,SAAS,OAAO,OAA8B,CACnD,IAAI,MAAQ,QAAQ,IAAI,OAAO,IAAI,EACnC,GAAI,QAAU,GAAI,MAAQ,OAE1B,GAAI,kCAAa,cAAgB,KAAM,CACrC,QAAU,OAAO,kBAAoB,OAAO,YAC9C,KACK,CACH,QAAU,OAAO,YACnB,CAEA,GAAI,QAAU,OAAW,CACvB,MAAM,IAAI,MAAM,yBAAyB,OAAO,IAAI,gBAAgB,CACtE,CAEA,OAAO,KACT",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/main.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** 📦 @alwatr/env v5.5.
|
|
2
|
-
__dev_mode__: console.debug("📦 @alwatr/env v5.5.28");
|
|
1
|
+
/** 📦 @alwatr/env v5.5.29 */
|
|
3
2
|
import{platformInfo}from"@alwatr/platform-info";function getEnv(option){let value=process.env[option.name];if(value==="")value=void 0;if(platformInfo.development===true){value??=option.developmentValue??option.defaultValue}else{value??=option.defaultValue}if(value===void 0){throw new Error(`Environment variable "${option.name}" is required.`)}return value}export{getEnv};
|
|
4
3
|
//# sourceMappingURL=main.mjs.map
|
package/dist/main.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
4
|
"sourcesContent": ["import {platformInfo} from '@alwatr/platform-info';\n\n/**\n * Parameters for retrieving an environment variable value.\n */\nexport type GetEnvOption = {\n /**\n * The name of the environment variable.\n */\n name: string;\n\n /**\n * The default value to use if the environment variable is not set.\n * If not provided, the environment variable is required and an error will be thrown if it is not set.\n * Except in development mode, where the development value will be used instead if provided.\n */\n defaultValue?: string;\n\n /**\n * The value to use in a development environment.\n * It will be overwrite the default value in development mode and completely ignored in production mode.\n */\n developmentValue?: string;\n};\n\nexport function getEnv(option: GetEnvOption): string {\n let value = process.env[option.name];\n if (value === '') value = undefined; // empty string is considered as undefined in environment variables\n\n if (platformInfo.development === true) {\n value ??= option.developmentValue ?? option.defaultValue;\n }\n else {\n value ??= option.defaultValue;\n }\n\n if (value === undefined) {\n throw new Error(`Environment variable \"${option.name}\" is required.`);\n }\n\n return value;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA,OAAQ,iBAAmB,wBAyBpB,SAAS,OAAO,OAA8B,CACnD,IAAI,MAAQ,QAAQ,IAAI,OAAO,IAAI,EACnC,GAAI,QAAU,GAAI,MAAQ,OAE1B,GAAI,aAAa,cAAgB,KAAM,CACrC,QAAU,OAAO,kBAAoB,OAAO,YAC9C,KACK,CACH,QAAU,OAAO,YACnB,CAEA,GAAI,QAAU,OAAW,CACvB,MAAM,IAAI,MAAM,yBAAyB,OAAO,IAAI,gBAAgB,CACtE,CAEA,OAAO,KACT",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/env",
|
|
3
3
|
"description": "A tiny and tree-shakable TypeScript library to get environment variables with type-safe and fallback value for development and production.",
|
|
4
|
-
"version": "5.5.
|
|
4
|
+
"version": "5.5.29",
|
|
5
5
|
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
|
|
6
6
|
"bugs": "https://github.com/Alwatr/nanolib/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@alwatr/platform-info": "5.5.
|
|
8
|
+
"@alwatr/platform-info": "5.5.29"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"@alwatr/nano-build": "6.4.
|
|
11
|
+
"@alwatr/nano-build": "6.4.2",
|
|
12
12
|
"@alwatr/prettier-config": "6.0.2",
|
|
13
13
|
"@alwatr/tsconfig-base": "6.0.4",
|
|
14
|
-
"@alwatr/type-helper": "7.0.
|
|
15
|
-
"@types/node": "^24.
|
|
14
|
+
"@alwatr/type-helper": "7.0.2",
|
|
15
|
+
"@types/node": "^24.12.0",
|
|
16
16
|
"typescript": "^5.9.3"
|
|
17
17
|
},
|
|
18
18
|
"exports": {
|
|
@@ -59,23 +59,23 @@
|
|
|
59
59
|
"directory": "packages/env"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
|
-
"b": "
|
|
63
|
-
"build": "
|
|
62
|
+
"b": "bun run build",
|
|
63
|
+
"build": "bun run build:ts && bun run build:es",
|
|
64
64
|
"build:es": "nano-build --preset=module",
|
|
65
65
|
"build:ts": "tsc --build",
|
|
66
|
-
"c": "
|
|
67
|
-
"cb": "
|
|
66
|
+
"c": "bun run clean",
|
|
67
|
+
"cb": "bun run clean && bun run build",
|
|
68
68
|
"clean": "rm -rfv dist *.tsbuildinfo",
|
|
69
|
-
"d": "
|
|
70
|
-
"t": "
|
|
71
|
-
"test": "
|
|
72
|
-
"w": "
|
|
73
|
-
"watch": "
|
|
74
|
-
"watch:es": "
|
|
75
|
-
"watch:ts": "
|
|
69
|
+
"d": "bun run build:es && bun --enable-source-maps --trace-warnings",
|
|
70
|
+
"t": "bun run test",
|
|
71
|
+
"test": "echo test-skipped",
|
|
72
|
+
"w": "bun run watch",
|
|
73
|
+
"watch": "bun run watch:ts & bun run watch:es",
|
|
74
|
+
"watch:es": "bun run build:es --watch",
|
|
75
|
+
"watch:ts": "bun run build:ts --watch --preserveWatchOutput"
|
|
76
76
|
},
|
|
77
77
|
"sideEffects": false,
|
|
78
78
|
"type": "module",
|
|
79
79
|
"types": "./dist/main.d.ts",
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "c3889e3756b0a0f9b935a1b702a1373ac52cb379"
|
|
81
81
|
}
|