@nmakarov/cli-toolkit 0.36.0 → 0.37.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/cli-runner.cjs +31 -13
- package/dist/cli-runner.cjs.map +1 -1
- package/dist/cli-runner.js +31 -13
- package/dist/cli-runner.js.map +1 -1
- package/dist/index.cjs +31 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -13
- package/dist/index.js.map +1 -1
- package/dist/init.cjs +31 -13
- package/dist/init.cjs.map +1 -1
- package/dist/init.js +31 -13
- package/dist/init.js.map +1 -1
- package/dist/params.cjs +31 -13
- package/dist/params.cjs.map +1 -1
- package/dist/params.js +31 -13
- package/dist/params.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1810,11 +1810,14 @@ var Params = class _Params {
|
|
|
1810
1810
|
* Attribution rules:
|
|
1811
1811
|
* - entries figured from an explicit input (cli/env/options/…) are left
|
|
1812
1812
|
* untouched — the component merely confirmed them, the origin stands;
|
|
1813
|
-
* -
|
|
1814
|
-
*
|
|
1813
|
+
* - "default" entries (Params had nothing) and earlier reports are
|
|
1814
|
+
* replaced by the report;
|
|
1815
1815
|
* - keys never seen by Params are appended as new entries.
|
|
1816
|
-
*
|
|
1817
|
-
*
|
|
1816
|
+
* The LATEST report wins — a component may resolve the same key several
|
|
1817
|
+
* times with increasing specificity (e.g. a blueprint re-merged for a
|
|
1818
|
+
* concrete resource) and the dump should show what it settled on.
|
|
1819
|
+
* Later params.get() probes that find nothing ("default") never shadow a
|
|
1820
|
+
* reported value — see {@link getFiguredByModule}.
|
|
1818
1821
|
*
|
|
1819
1822
|
* @param {string} key
|
|
1820
1823
|
* @param {*} value - the value the component actually uses
|
|
@@ -1824,17 +1827,20 @@ var Params = class _Params {
|
|
|
1824
1827
|
reportResolved(key, value, source = "discovered", moduleName) {
|
|
1825
1828
|
const mod = moduleName ?? this._currentModule;
|
|
1826
1829
|
const mine = this.trackedParams.filter((e) => e.key === key && e.module === mod);
|
|
1827
|
-
if (mine.some((e) => e.source !== "default")) {
|
|
1830
|
+
if (mine.some((e) => e.source !== "default" && !e.reported)) {
|
|
1828
1831
|
return;
|
|
1829
1832
|
}
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1833
|
+
this.trackedParams = this.trackedParams.filter(
|
|
1834
|
+
(e) => !(e.key === key && e.module === mod)
|
|
1835
|
+
);
|
|
1836
|
+
this.trackedParams.push({
|
|
1837
|
+
key,
|
|
1838
|
+
definition: "reported",
|
|
1839
|
+
value,
|
|
1840
|
+
source,
|
|
1841
|
+
module: mod,
|
|
1842
|
+
reported: true
|
|
1843
|
+
});
|
|
1838
1844
|
}
|
|
1839
1845
|
/**
|
|
1840
1846
|
* Get all tracked parameters (for --stopAfter=init)
|
|
@@ -1860,12 +1866,24 @@ var Params = class _Params {
|
|
|
1860
1866
|
/**
|
|
1861
1867
|
* Get figured parameters grouped by module name.
|
|
1862
1868
|
* Same param can appear in multiple modules (e.g. source, resource).
|
|
1869
|
+
* Last occurrence per key wins, EXCEPT that an empty probe — a
|
|
1870
|
+
* params.get() that found nothing ("default", undefined) — never shadows
|
|
1871
|
+
* a value reported via {@link reportResolved}: components probe for
|
|
1872
|
+
* overrides on every resolution cycle, and those misses say nothing about
|
|
1873
|
+
* the value the component actually uses.
|
|
1863
1874
|
*/
|
|
1864
1875
|
getFiguredByModule() {
|
|
1876
|
+
const reported = /* @__PURE__ */ new Set();
|
|
1877
|
+
for (const param of this.trackedParams) {
|
|
1878
|
+
if (param.reported) reported.add(`${param.module}\0${param.key}`);
|
|
1879
|
+
}
|
|
1865
1880
|
const byModule = {};
|
|
1866
1881
|
for (const param of this.trackedParams) {
|
|
1867
1882
|
const mod = param.module;
|
|
1868
1883
|
if (!byModule[mod]) byModule[mod] = {};
|
|
1884
|
+
if (!param.reported && param.source === "default" && reported.has(`${mod}\0${param.key}`)) {
|
|
1885
|
+
continue;
|
|
1886
|
+
}
|
|
1869
1887
|
byModule[mod][param.key] = { value: param.value, source: param.source };
|
|
1870
1888
|
}
|
|
1871
1889
|
return byModule;
|