rsf-zero 0.1.8 → 0.2.0

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/options.d.ts CHANGED
@@ -1,8 +1,4 @@
1
1
  import { RsfZeroOptions } from "./export-types.ts";
2
- /**
3
- * Locate rsf0-config.js in the current project root (process.cwd()).
4
- */
5
- export declare function findOptionsFile(cwd?: string): string | null;
6
2
  /**
7
3
  * Load RSF options from rsf0-config.js at project root.
8
4
  * Returns an empty object if no file is found or on safe failure.
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMnD;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAG1E;AAUD;;;GAGG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,cAAc,CAAC,CAiB3D"}
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAenD;;;GAGG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,cAAc,CAAC,CAoB3D"}
package/dist/options.js CHANGED
@@ -13,13 +13,6 @@ import { debug } from "./debug.js";
13
13
  const defaultOptions = {
14
14
  startStatic: {},
15
15
  };
16
- /**
17
- * Locate rsf0-config.js in the current project root (process.cwd()).
18
- */
19
- export function findOptionsFile(cwd = process.cwd()) {
20
- const jsPath = path.join(cwd, 'rsf0-config.js');
21
- return fs.existsSync(jsPath) ? jsPath : null;
22
- }
23
16
  /**
24
17
  * Dynamically import a JS module by absolute file path.
25
18
  */
@@ -32,21 +25,22 @@ async function importJsModule(absPath) {
32
25
  * Returns an empty object if no file is found or on safe failure.
33
26
  */
34
27
  export async function loadOptions() {
35
- const configPath = findOptionsFile();
36
- if (!configPath)
37
- return {};
28
+ const configPath = path.join(process.cwd(), 'rsf0-config.js');
29
+ if (!fs.existsSync(configPath)) {
30
+ debug('No config file found at: ' + configPath);
31
+ return defaultOptions;
32
+ }
38
33
  try {
39
34
  const mod = await importJsModule(configPath);
40
- const options = (mod && (mod.default ?? mod.options ?? mod.rsf ?? mod.config ?? mod));
35
+ const options = (mod && mod.default);
41
36
  if (options && typeof options === 'object') {
42
- debug('Options loaded: ' + configPath);
37
+ debug('Config loaded: ' + configPath);
43
38
  return options;
44
39
  }
45
- return {};
40
+ throw new Error('Invalid');
46
41
  }
47
42
  catch (err) {
48
- // Fail soft: log a friendly message and continue with defaults
49
- debug('No options file found at: ' + configPath);
50
- return defaultOptions;
43
+ console.log('Rsf Zero Error: Invalid config file at: ' + configPath);
44
+ throw err;
51
45
  }
52
46
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A minimal micro-framework with React Server Functions support",
4
4
  "author": "Igor Nadj",
5
5
  "type": "module",
6
- "version": "0.1.8",
6
+ "version": "0.2.0",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/IgorNadj/rsf-zero.git",