@jsnw/srv-utils 1.1.0 → 1.1.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.
@@ -145,17 +145,21 @@ class ConfigLoader {
145
145
  }
146
146
  //region Utils
147
147
  resolveFilePath(path) {
148
- if (PKG_ROOT_REGEX.test(path))
149
- path = path.replace(PKG_ROOT_REGEX, (0, getRootPackageDirname_1.getRootPackageDirnameSync)() + node_path_1.sep);
150
- if (ENV_VAR_REGEX.test(path)) {
148
+ const initialPath = path;
149
+ while (ENV_VAR_REGEX.test(path)) {
151
150
  const m = path.match(ENV_VAR_REGEX);
152
151
  if (m.groups?.['var_name']) {
153
152
  if (process.env?.[m.groups['var_name']]) {
154
153
  path = path.replace(ENV_VAR_REGEX, process.env[m.groups['var_name']].replace(/[\/\\]+$/, '') + node_path_1.sep);
155
154
  }
155
+ else {
156
+ throw new Error(`Failed to resolve path: "${initialPath}"`);
157
+ }
156
158
  }
157
159
  }
158
- return (0, node_path_1.resolve)(path);
160
+ if (PKG_ROOT_REGEX.test(path))
161
+ path = path.replace(PKG_ROOT_REGEX, (0, getRootPackageDirname_1.getRootPackageDirnameSync)() + node_path_1.sep);
162
+ return (0, node_path_1.resolve)(process.cwd(), path);
159
163
  }
160
164
  /**
161
165
  * @param {string} fromDirname
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsnw/srv-utils",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Server-side utilities for Node.js/TypeScript: tsconfig paths, Nest helpers, and config loading.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/types/index.d.ts",