@nmakarov/cli-toolkit 0.33.0 → 0.36.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/init.js CHANGED
@@ -1841,6 +1841,43 @@ var Params = class _Params {
1841
1841
  module: moduleName ?? this._currentModule
1842
1842
  });
1843
1843
  }
1844
+ /**
1845
+ * Report a param value that a component RESOLVED ON ITS OWN — outside
1846
+ * Params.get() — e.g. discovered by combining its config files (the way
1847
+ * blueprints merge defaults/aggregator/feed data). Without this, every
1848
+ * key such a component probed for an override shows up in the
1849
+ * --showUsedParams dump as "undefined (default)"; reporting upgrades the
1850
+ * entry to the value the component actually works with.
1851
+ *
1852
+ * Attribution rules:
1853
+ * - entries figured from an explicit input (cli/env/options/…) are left
1854
+ * untouched — the component merely confirmed them, the origin stands;
1855
+ * - entries whose source is "default" (Params had nothing) are upgraded
1856
+ * in place to the reported value and source;
1857
+ * - keys never seen by Params are appended as new entries.
1858
+ * First report wins: once upgraded, later reports for the same key/module
1859
+ * are ignored (the source is no longer "default").
1860
+ *
1861
+ * @param {string} key
1862
+ * @param {*} value - the value the component actually uses
1863
+ * @param {string} [source="discovered"] - short origin label, e.g. "blueprint"
1864
+ * @param {string} [moduleName] - dump section; defaults to the current module
1865
+ */
1866
+ reportResolved(key, value, source = "discovered", moduleName) {
1867
+ const mod = moduleName ?? this._currentModule;
1868
+ const mine = this.trackedParams.filter((e) => e.key === key && e.module === mod);
1869
+ if (mine.some((e) => e.source !== "default")) {
1870
+ return;
1871
+ }
1872
+ if (mine.length === 0) {
1873
+ this.trackParam(key, "reported", value, source, mod);
1874
+ return;
1875
+ }
1876
+ for (const entry of mine) {
1877
+ entry.value = value;
1878
+ entry.source = source;
1879
+ }
1880
+ }
1844
1881
  /**
1845
1882
  * Get all tracked parameters (for --stopAfter=init)
1846
1883
  */