@hardkas/config 0.9.2-alpha → 0.9.4-alpha

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/index.d.ts CHANGED
@@ -64,6 +64,7 @@ interface LoadHardkasConfigOptions {
64
64
  cwd?: string;
65
65
  configPath?: string;
66
66
  ambientWorkspace?: boolean;
67
+ workspaceRoot?: string;
67
68
  }
68
69
  declare function loadHardkasConfig(options?: LoadHardkasConfigOptions): Promise<LoadedHardkasConfig>;
69
70
 
package/dist/index.js CHANGED
@@ -60,15 +60,16 @@ async function loadHardkasConfig(options = {}) {
60
60
  "hardkas.config.js",
61
61
  "hardkas.config.mjs"
62
62
  ];
63
- let current = cwd;
64
- const root = path.parse(current).root;
65
- while (current !== root) {
63
+ let current = options.workspaceRoot ?? cwd;
64
+ const stopAt = options.workspaceRoot ? path.resolve(options.workspaceRoot) : path.parse(current).root;
65
+ while (true) {
66
66
  for (const indicator of indicators) {
67
67
  const p = path.join(current, indicator);
68
68
  if (fs.existsSync(p)) {
69
69
  return loadConfigFile(p, current);
70
70
  }
71
71
  }
72
+ if (current === stopAt) break;
72
73
  const parent = path.dirname(current);
73
74
  if (parent === current) break;
74
75
  current = parent;
@@ -99,7 +100,7 @@ async function loadConfigFile(filePath, cwd) {
99
100
  }
100
101
  } catch (e) {
101
102
  }
102
- const jiti = createJiti(import.meta.url, jitiOptions);
103
+ const jiti = createJiti(filePath, jitiOptions);
103
104
  const module = await jiti.import(filePath);
104
105
  const userConfig = module.default || module.config || module;
105
106
  const mergedConfig = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardkas/config",
3
- "version": "0.9.2-alpha",
3
+ "version": "0.9.4-alpha",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "jiti": "^2.4.2",
21
- "@hardkas/core": "0.9.2-alpha"
21
+ "@hardkas/core": "0.9.4-alpha"
22
22
  },
23
23
  "devDependencies": {
24
24
  "tsup": "^8.3.5",