@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/init.cjs
CHANGED
|
@@ -1877,11 +1877,14 @@ var Params = class _Params {
|
|
|
1877
1877
|
* Attribution rules:
|
|
1878
1878
|
* - entries figured from an explicit input (cli/env/options/…) are left
|
|
1879
1879
|
* untouched — the component merely confirmed them, the origin stands;
|
|
1880
|
-
* -
|
|
1881
|
-
*
|
|
1880
|
+
* - "default" entries (Params had nothing) and earlier reports are
|
|
1881
|
+
* replaced by the report;
|
|
1882
1882
|
* - keys never seen by Params are appended as new entries.
|
|
1883
|
-
*
|
|
1884
|
-
*
|
|
1883
|
+
* The LATEST report wins — a component may resolve the same key several
|
|
1884
|
+
* times with increasing specificity (e.g. a blueprint re-merged for a
|
|
1885
|
+
* concrete resource) and the dump should show what it settled on.
|
|
1886
|
+
* Later params.get() probes that find nothing ("default") never shadow a
|
|
1887
|
+
* reported value — see {@link getFiguredByModule}.
|
|
1885
1888
|
*
|
|
1886
1889
|
* @param {string} key
|
|
1887
1890
|
* @param {*} value - the value the component actually uses
|
|
@@ -1891,17 +1894,20 @@ var Params = class _Params {
|
|
|
1891
1894
|
reportResolved(key, value, source = "discovered", moduleName) {
|
|
1892
1895
|
const mod = moduleName ?? this._currentModule;
|
|
1893
1896
|
const mine = this.trackedParams.filter((e) => e.key === key && e.module === mod);
|
|
1894
|
-
if (mine.some((e) => e.source !== "default")) {
|
|
1897
|
+
if (mine.some((e) => e.source !== "default" && !e.reported)) {
|
|
1895
1898
|
return;
|
|
1896
1899
|
}
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1900
|
+
this.trackedParams = this.trackedParams.filter(
|
|
1901
|
+
(e) => !(e.key === key && e.module === mod)
|
|
1902
|
+
);
|
|
1903
|
+
this.trackedParams.push({
|
|
1904
|
+
key,
|
|
1905
|
+
definition: "reported",
|
|
1906
|
+
value,
|
|
1907
|
+
source,
|
|
1908
|
+
module: mod,
|
|
1909
|
+
reported: true
|
|
1910
|
+
});
|
|
1905
1911
|
}
|
|
1906
1912
|
/**
|
|
1907
1913
|
* Get all tracked parameters (for --stopAfter=init)
|
|
@@ -1927,12 +1933,24 @@ var Params = class _Params {
|
|
|
1927
1933
|
/**
|
|
1928
1934
|
* Get figured parameters grouped by module name.
|
|
1929
1935
|
* Same param can appear in multiple modules (e.g. source, resource).
|
|
1936
|
+
* Last occurrence per key wins, EXCEPT that an empty probe — a
|
|
1937
|
+
* params.get() that found nothing ("default", undefined) — never shadows
|
|
1938
|
+
* a value reported via {@link reportResolved}: components probe for
|
|
1939
|
+
* overrides on every resolution cycle, and those misses say nothing about
|
|
1940
|
+
* the value the component actually uses.
|
|
1930
1941
|
*/
|
|
1931
1942
|
getFiguredByModule() {
|
|
1943
|
+
const reported = /* @__PURE__ */ new Set();
|
|
1944
|
+
for (const param of this.trackedParams) {
|
|
1945
|
+
if (param.reported) reported.add(`${param.module}\0${param.key}`);
|
|
1946
|
+
}
|
|
1932
1947
|
const byModule = {};
|
|
1933
1948
|
for (const param of this.trackedParams) {
|
|
1934
1949
|
const mod = param.module;
|
|
1935
1950
|
if (!byModule[mod]) byModule[mod] = {};
|
|
1951
|
+
if (!param.reported && param.source === "default" && reported.has(`${mod}\0${param.key}`)) {
|
|
1952
|
+
continue;
|
|
1953
|
+
}
|
|
1936
1954
|
byModule[mod][param.key] = { value: param.value, source: param.source };
|
|
1937
1955
|
}
|
|
1938
1956
|
return byModule;
|