@cardenelabs/cdl 0.41.0 → 0.41.1
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/CHANGELOG.md +30 -1
- package/dist/index.cjs +19 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -21
- package/dist/index.js.map +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/visual-validate.ts +76 -23
package/dist/index.js
CHANGED
|
@@ -17705,6 +17705,24 @@ function visualValidateAll(diagrams, opts) {
|
|
|
17705
17705
|
metaViolations
|
|
17706
17706
|
};
|
|
17707
17707
|
}
|
|
17708
|
+
var PERF_BUDGET_TOTAL_MS = 5e3;
|
|
17709
|
+
var PERF_SLOWEST_SAMPLE = 5;
|
|
17710
|
+
function perfBudgetViolations(durations, diagrams = []) {
|
|
17711
|
+
const total = durations.reduce((s, d) => s + d, 0);
|
|
17712
|
+
if (total <= PERF_BUDGET_TOTAL_MS) return [];
|
|
17713
|
+
const \u91CD\u3044\u9806 = durations.map((ms, i) => ({ id: diagrams[i]?.id ?? "?", ms })).sort((a, b) => b.ms - a.ms);
|
|
17714
|
+
const \u629C\u7C8B = \u91CD\u3044\u9806.slice(0, PERF_SLOWEST_SAMPLE);
|
|
17715
|
+
const \u6B8B\u308A = \u91CD\u3044\u9806.length - \u629C\u7C8B.length;
|
|
17716
|
+
const \u5185\u8A33 = \u629C\u7C8B.map((d) => `"${d.id}" ${d.ms}ms`).join(" / ") + (\u6B8B\u308A > 0 ? `\u3001 \u6B8B\u308A ${\u6B8B\u308A} \u56F3\u306F\u51FA\u3057\u3066\u3044\u306A\u3044` : "");
|
|
17717
|
+
return [
|
|
17718
|
+
{
|
|
17719
|
+
axis: "validate-performance-budget",
|
|
17720
|
+
diagramId: "__meta__",
|
|
17721
|
+
detail: `visualValidateAll \u5168 ${durations.length} \u56F3\u306E\u7D2F\u8A08 ${total}ms > ${PERF_BUDGET_TOTAL_MS}ms budget (\u91CD\u3044\u9806 ${\u5185\u8A33})`,
|
|
17722
|
+
severity: "warn"
|
|
17723
|
+
}
|
|
17724
|
+
];
|
|
17725
|
+
}
|
|
17708
17726
|
function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports = []) {
|
|
17709
17727
|
const out = [];
|
|
17710
17728
|
const totalErrors = reports.reduce(
|
|
@@ -17720,27 +17738,7 @@ function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports =
|
|
|
17720
17738
|
severity: "warn"
|
|
17721
17739
|
});
|
|
17722
17740
|
}
|
|
17723
|
-
|
|
17724
|
-
const PERF_BUDGET_TOTAL_MS = 5e3;
|
|
17725
|
-
const overBudgetIdx = durations.findIndex((d) => d > PERF_BUDGET_PER_DIAGRAM_MS);
|
|
17726
|
-
if (overBudgetIdx >= 0) {
|
|
17727
|
-
const did = diagrams[overBudgetIdx]?.id ?? "?";
|
|
17728
|
-
out.push({
|
|
17729
|
-
axis: "validate-performance-budget",
|
|
17730
|
-
diagramId: did,
|
|
17731
|
-
detail: `diagram "${did}" validate ${durations[overBudgetIdx]}ms > ${PERF_BUDGET_PER_DIAGRAM_MS}ms budget`,
|
|
17732
|
-
severity: "warn"
|
|
17733
|
-
});
|
|
17734
|
-
}
|
|
17735
|
-
const totalDur = durations.reduce((s, d) => s + d, 0);
|
|
17736
|
-
if (totalDur > PERF_BUDGET_TOTAL_MS) {
|
|
17737
|
-
out.push({
|
|
17738
|
-
axis: "validate-performance-budget",
|
|
17739
|
-
diagramId: "__meta__",
|
|
17740
|
-
detail: `visualValidateAll \u5168 diagram \u7D2F\u8A08 ${totalDur}ms > ${PERF_BUDGET_TOTAL_MS}ms budget`,
|
|
17741
|
-
severity: "warn"
|
|
17742
|
-
});
|
|
17743
|
-
}
|
|
17741
|
+
out.push(...perfBudgetViolations(durations, diagrams));
|
|
17744
17742
|
const DEAD_ALLOWLIST = [
|
|
17745
17743
|
// catalog で自然発火なしを許容する security / migration / performance / meta / dev-quality axis 群。
|
|
17746
17744
|
// 実 diagram に該当データ (XSS / migration list / oversized / broken doc) が混入するのが稀なため。
|