@barefootjs/cli 0.11.0 → 0.12.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/index.js +24 -13
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __bfCreateRequire } from 'node:module';
|
|
3
|
+
const require = __bfCreateRequire(import.meta.url);
|
|
2
4
|
var __create = Object.create;
|
|
3
5
|
var __defProp = Object.defineProperty;
|
|
4
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20100,8 +20102,8 @@ function buildStaticBudget(source, filePath, componentName, options2 = {}) {
|
|
|
20100
20102
|
0
|
|
20101
20103
|
);
|
|
20102
20104
|
const fanOut = graph.signals.map((s) => {
|
|
20103
|
-
const
|
|
20104
|
-
return { signal: s.name, subscribers, hot:
|
|
20105
|
+
const { direct, total } = subscriberCounts(graph, s.name);
|
|
20106
|
+
return { signal: s.name, subscribers: total, direct, hot: direct >= threshold, loc: s.loc };
|
|
20105
20107
|
}).sort((a, b) => b.subscribers - a.subscribers);
|
|
20106
20108
|
const { depth, chain } = longestMemoChain(graph);
|
|
20107
20109
|
const hasReactiveState = graph.signals.length > 0 || graph.memos.length > 0;
|
|
@@ -20129,18 +20131,25 @@ function isEventHandlerConsumer(consumer) {
|
|
|
20129
20131
|
const i = consumer.indexOf(":");
|
|
20130
20132
|
return i > 0 && isEventHandlerEntry(consumer.slice(0, i), consumer.slice(i + 1));
|
|
20131
20133
|
}
|
|
20132
|
-
function
|
|
20134
|
+
function subscriberCounts(graph, name2) {
|
|
20133
20135
|
const path25 = traceUpdatePath(graph, name2);
|
|
20134
|
-
if (!path25) return 0;
|
|
20136
|
+
if (!path25) return { direct: 0, total: 0 };
|
|
20135
20137
|
const seen = /* @__PURE__ */ new Set();
|
|
20136
|
-
const
|
|
20138
|
+
const directSeen = /* @__PURE__ */ new Set();
|
|
20139
|
+
const walk = (entries2, depth) => {
|
|
20137
20140
|
for (const e of entries2) {
|
|
20138
|
-
if (!isEventHandlerEntry(e.kind, e.name))
|
|
20139
|
-
|
|
20141
|
+
if (!isEventHandlerEntry(e.kind, e.name)) {
|
|
20142
|
+
seen.add(`${e.kind}:${e.name}`);
|
|
20143
|
+
if (depth === 0) directSeen.add(`${e.kind}:${e.name}`);
|
|
20144
|
+
}
|
|
20145
|
+
walk(e.children, depth + 1);
|
|
20140
20146
|
}
|
|
20141
20147
|
};
|
|
20142
|
-
walk(path25.dependents);
|
|
20143
|
-
return seen.size;
|
|
20148
|
+
walk(path25.dependents, 0);
|
|
20149
|
+
return { direct: directSeen.size, total: seen.size };
|
|
20150
|
+
}
|
|
20151
|
+
function transitiveSubscriberCount(graph, name2) {
|
|
20152
|
+
return subscriberCounts(graph, name2).total;
|
|
20144
20153
|
}
|
|
20145
20154
|
function longestMemoChain(graph) {
|
|
20146
20155
|
const memoChainFrom = (entry) => {
|
|
@@ -20177,7 +20186,9 @@ function formatStaticBudget(b) {
|
|
|
20177
20186
|
if (shown.length > 0) {
|
|
20178
20187
|
lines.push(" fan-out (top):");
|
|
20179
20188
|
for (const f of shown) {
|
|
20180
|
-
|
|
20189
|
+
const indirect = f.subscribers - f.direct;
|
|
20190
|
+
const detail2 = indirect > 0 ? ` (${f.direct} direct \xB7 ${indirect} via memo)` : "";
|
|
20191
|
+
lines.push(` ${f.signal.padEnd(12)} \u2192 ${f.subscribers} subscribers${detail2}${f.hot ? " \u26A0 high" : ""}`);
|
|
20181
20192
|
}
|
|
20182
20193
|
}
|
|
20183
20194
|
if (b.crossComponentOnly) {
|
|
@@ -20191,8 +20202,8 @@ function formatStaticBudget(b) {
|
|
|
20191
20202
|
return lines.join("\n");
|
|
20192
20203
|
}
|
|
20193
20204
|
function diffStaticBudget(base, head) {
|
|
20194
|
-
const baseFan = new Map(base.fanOut.map((f) => [f.signal, f.
|
|
20195
|
-
const headFan = new Map(head.fanOut.map((f) => [f.signal, f.
|
|
20205
|
+
const baseFan = new Map(base.fanOut.map((f) => [f.signal, f.direct]));
|
|
20206
|
+
const headFan = new Map(head.fanOut.map((f) => [f.signal, f.direct]));
|
|
20196
20207
|
const signals = /* @__PURE__ */ new Set([...baseFan.keys(), ...headFan.keys()]);
|
|
20197
20208
|
const fanOut = [];
|
|
20198
20209
|
for (const sig of signals) {
|
|
@@ -20230,7 +20241,7 @@ function formatBudgetDiff(d) {
|
|
|
20230
20241
|
lines.push(` memo chain ${d.memoChainDepth > 0 ? "deepened" : "shortened"} by ${Math.abs(d.memoChainDepth)}`);
|
|
20231
20242
|
}
|
|
20232
20243
|
for (const f of d.fanOut) {
|
|
20233
|
-
lines.push(` signal \`${f.signal}\` fan-out ${f.before}\u2192${f.after}`);
|
|
20244
|
+
lines.push(` signal \`${f.signal}\` direct fan-out ${f.before}\u2192${f.after}`);
|
|
20234
20245
|
}
|
|
20235
20246
|
if (lines.length === 1) lines.push(" no structural reactivity change");
|
|
20236
20247
|
else lines.push(d.regressed ? " \u26A0 reactivity regressed" : " \u2713 no regression");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "CLI for agent-driven UI component discovery and scaffolding",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"esbuild": "^0.25.0",
|
|
31
31
|
"typescript": "^5.0.0",
|
|
32
|
-
"@barefootjs/client": "0.
|
|
33
|
-
"@barefootjs/shared": "0.
|
|
32
|
+
"@barefootjs/client": "0.12.0",
|
|
33
|
+
"@barefootjs/shared": "0.12.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@barefootjs/jsx": "0.
|
|
36
|
+
"@barefootjs/jsx": "0.12.0",
|
|
37
37
|
"@types/node": "^22.0.0",
|
|
38
38
|
"@happy-dom/global-registrator": "^20.0.11",
|
|
39
39
|
"happy-dom": "^20.0.11"
|