@jsnw/srv-utils 1.1.4 → 1.1.5

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.
@@ -17,9 +17,13 @@ function useTsconfigPaths({ basePath, tsconfigPath }) {
17
17
  const tsconfig = require((0, node_path_1.resolve)(tsconfigPath)), tsconfigDirPathname = (0, node_path_1.dirname)(tsconfigPath), paths = {};
18
18
  if (!basePath && !tsconfig?.compilerOptions?.baseUrl)
19
19
  throw new TypeError('Either basePath option should be provided or tsconfig.json should contain compilerOptions.baseUrl property');
20
- const baseUrl = tsconfig?.compilerOptions?.baseUrl
21
- ? (0, node_path_1.resolve)(tsconfig.compilerOptions.baseUrl)
22
- : (0, node_path_1.resolve)(basePath);
20
+ const baseUrl = basePath
21
+ ? (0, node_path_1.resolve)(basePath)
22
+ : tsconfig?.compilerOptions?.baseUrl
23
+ ? (0, node_path_1.resolve)(tsconfig.compilerOptions.baseUrl)
24
+ : undefined;
25
+ if (baseUrl === undefined)
26
+ throw new Error('Unable to resolve base path for tsconfig paths');
23
27
  Object.entries((tsconfig?.compilerOptions?.paths ?? {}))
24
28
  .forEach(([moduleName, pathArray]) => {
25
29
  if (pathArray.length === 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsnw/srv-utils",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
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",