@rsbuild/core 2.2.3 → 2.2.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.
@@ -43,24 +43,45 @@ type LoadConfigOptions<Params extends unknown[] = []> = {
43
43
  */
44
44
  fresh?: boolean;
45
45
  };
46
+ type ConfigFileMeta = {
47
+ /**
48
+ * Absolute path of the actual configuration file.
49
+ * Use `null` when no underlying configuration file was found.
50
+ */
51
+ filePath: string | null;
52
+ /**
53
+ * Absolute paths of additional configuration dependencies.
54
+ * These are merged with the adapter file and its collected dependencies.
55
+ */
56
+ dependencies?: readonly string[];
57
+ };
46
58
  type LoadConfigResult<Config = unknown> = {
47
59
  /**
48
60
  * The loaded configuration object.
49
61
  */
50
62
  content: Config;
51
63
  /**
52
- * The path to the loaded configuration file.
53
- * Return `null` if the configuration file is not found.
64
+ * The path to the loaded configuration file, or the source set by `withConfigMeta`.
65
+ * Returns `null` if no configuration file was found, including an explicit
66
+ * `null` source set by `withConfigMeta`.
54
67
  */
55
68
  filePath: string | null;
56
69
  /**
57
- * Absolute file paths of statically imported (relative) dependencies of the
58
- * config file.
70
+ * Absolute paths of collected configuration dependencies. When `withConfigMeta`
71
+ * is used, also includes explicit dependencies and the loaded adapter file,
72
+ * with duplicates removed.
59
73
  */
60
74
  dependencies: string[];
61
75
  };
62
76
 
77
+ /**
78
+ * Attach file metadata in place and return the original configuration object.
79
+ * Repeated calls replace the metadata. Requires an extensible, unfrozen object.
80
+ * Call this after merging the config: object spread does not preserve metadata.
81
+ */
82
+ declare function withConfigMeta<Config extends object>(config: Config, meta: ConfigFileMeta): Config;
83
+
63
84
  declare function loadConfig<Config = unknown, Params extends unknown[] = []>({ cwd, path, configFileNames, loader, exportName, configParams, fresh, }?: LoadConfigOptions<Params>): Promise<LoadConfigResult<Config>>;
64
85
 
65
- export { loadConfig };
66
- export type { ConfigDefinition, ConfigLoader, LoadConfigOptions, LoadConfigResult };
86
+ export { loadConfig, withConfigMeta };
87
+ export type { ConfigDefinition, ConfigFileMeta, ConfigLoader, LoadConfigOptions, LoadConfigResult };
@@ -1 +1 @@
1
- {"name":"@rstackjs/load-config","version":"0.1.2","license":"MIT","types":"index.d.ts","type":"module"}
1
+ {"name":"@rstackjs/load-config","version":"1.0.0","license":"MIT","types":"index.d.ts","type":"module"}