@allurereport/web-commons 3.0.0-beta.8 → 3.0.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/attachments.d.ts +21 -0
- package/dist/attachments.js +162 -0
- package/dist/charts/accessors/coverageDiffTreeMapAccessor.d.ts +16 -0
- package/dist/charts/accessors/coverageDiffTreeMapAccessor.js +183 -0
- package/dist/charts/accessors/problemsDistributionHeatMap.d.ts +2 -0
- package/dist/charts/accessors/problemsDistributionHeatMap.js +65 -0
- package/dist/charts/accessors/severityTrendAccessor.d.ts +3 -0
- package/dist/charts/accessors/severityTrendAccessor.js +21 -0
- package/dist/charts/accessors/statusTrendAccessor.d.ts +3 -0
- package/dist/charts/accessors/statusTrendAccessor.js +19 -0
- package/dist/charts/accessors/successRateDistributionTreeMapAccessor.d.ts +14 -0
- package/dist/charts/accessors/successRateDistributionTreeMapAccessor.js +110 -0
- package/dist/charts/accessors/utils/behavior.d.ts +5 -0
- package/dist/charts/accessors/utils/behavior.js +4 -0
- package/dist/charts/chart-utils.d.ts +8 -0
- package/dist/charts/chart-utils.js +22 -0
- package/dist/charts/colors.d.ts +3 -0
- package/dist/charts/colors.js +18 -0
- package/dist/charts/d3pie.d.ts +3 -0
- package/dist/charts/d3pie.js +52 -0
- package/dist/charts/generateCurrentStatusChart.d.ts +3 -0
- package/dist/charts/generateCurrentStatusChart.js +10 -0
- package/dist/charts/generateDurationDynamicsChart.d.ts +5 -0
- package/dist/charts/generateDurationDynamicsChart.js +83 -0
- package/dist/charts/generateDurationsChart.d.ts +5 -0
- package/dist/charts/generateDurationsChart.js +81 -0
- package/dist/charts/generateFBSUAgePyramid.d.ts +5 -0
- package/dist/charts/generateFBSUAgePyramid.js +77 -0
- package/dist/charts/generateStabilityDistributionChart.d.ts +5 -0
- package/dist/charts/generateStabilityDistributionChart.js +64 -0
- package/dist/charts/generateStatusDynamicsChart.d.ts +6 -0
- package/dist/charts/generateStatusDynamicsChart.js +44 -0
- package/dist/charts/generateStatusTransitionsChart.d.ts +5 -0
- package/dist/charts/generateStatusTransitionsChart.js +91 -0
- package/dist/charts/generateTestBaseGrowthDynamicsChart.d.ts +5 -0
- package/dist/charts/generateTestBaseGrowthDynamicsChart.js +79 -0
- package/dist/charts/generateTestingPyramidChart.d.ts +2 -0
- package/dist/charts/generateTestingPyramidChart.js +52 -0
- package/dist/charts/generateTrSeveritiesChart.d.ts +5 -0
- package/dist/charts/generateTrSeveritiesChart.js +53 -0
- package/dist/charts/generators.d.ts +10 -0
- package/dist/charts/generators.js +97 -0
- package/dist/charts/heatMap.d.ts +3 -0
- package/dist/charts/heatMap.js +9 -0
- package/dist/charts/index.d.ts +9 -0
- package/dist/charts/index.js +8 -0
- package/dist/charts/line.d.ts +8 -0
- package/dist/charts/line.js +140 -0
- package/dist/charts/treeMap.d.ts +6 -0
- package/dist/charts/treeMap.js +87 -0
- package/dist/charts/types.d.ts +76 -0
- package/dist/charts/types.js +1 -0
- package/dist/charts/utils.d.ts +21 -0
- package/dist/charts/utils.js +188 -0
- package/dist/data.d.ts +7 -7
- package/dist/data.js +9 -35
- package/dist/i18n.d.ts +8 -0
- package/dist/i18n.js +119 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/sanitize.d.ts +1 -0
- package/dist/sanitize.js +2 -0
- package/dist/strings.d.ts +12 -0
- package/dist/strings.js +7 -0
- package/package.json +17 -6
- package/dist/static.d.ts +0 -8
- package/dist/static.js +0 -25
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { ChartType } from "@allurereport/charts-api";
|
|
2
|
+
import { interpolateRgb } from "d3-interpolate";
|
|
3
|
+
import { scaleLinear } from "d3-scale";
|
|
4
|
+
import { nanoid } from "nanoid";
|
|
5
|
+
import { resolveCSSVarColor, statusColors } from "./colors.js";
|
|
6
|
+
export const createTreeMapChartDataGeneric = (getChart, colors, formatLegend, legendDomain, tooltipRows) => {
|
|
7
|
+
const chart = getChart();
|
|
8
|
+
if (!chart) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
...chart,
|
|
13
|
+
colors,
|
|
14
|
+
formatLegend,
|
|
15
|
+
legendDomain,
|
|
16
|
+
tooltipRows,
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export const createHeatMapChartDataGeneric = (getChart, colors) => {
|
|
20
|
+
const chart = getChart();
|
|
21
|
+
if (!chart) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
...chart,
|
|
26
|
+
colors,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export const createSuccessRateDistributionTreeMapChartData = (chartId, res) => {
|
|
30
|
+
const chartColorDomain = [0, 1];
|
|
31
|
+
return createTreeMapChartDataGeneric(() => res[chartId], (value, domain = chartColorDomain) => {
|
|
32
|
+
const scaledRgb = scaleLinear()
|
|
33
|
+
.domain(domain)
|
|
34
|
+
.range([resolveCSSVarColor(statusColors.failed), resolveCSSVarColor(statusColors.passed)])
|
|
35
|
+
.interpolate(interpolateRgb)
|
|
36
|
+
.clamp(true);
|
|
37
|
+
return scaledRgb(value);
|
|
38
|
+
}, (value) => {
|
|
39
|
+
if (value === 1) {
|
|
40
|
+
return "passed";
|
|
41
|
+
}
|
|
42
|
+
return "failed";
|
|
43
|
+
}, chartColorDomain, (node) => {
|
|
44
|
+
return [`passed: ${node.data.passedTests}`, `failed: ${node.data.failedTests}`, `other: ${node.data.otherTests}`];
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
export const createCoverageDiffTreeMapChartData = (chartId, res) => {
|
|
48
|
+
const chartColorDomain = [0, 0.5, 1];
|
|
49
|
+
return createTreeMapChartDataGeneric(() => res[chartId], (value, domain = chartColorDomain) => {
|
|
50
|
+
const scaledRgb = scaleLinear()
|
|
51
|
+
.domain(domain)
|
|
52
|
+
.range([resolveCSSVarColor(statusColors.failed), "#fff", resolveCSSVarColor(statusColors.passed)])
|
|
53
|
+
.interpolate(interpolateRgb)
|
|
54
|
+
.clamp(true);
|
|
55
|
+
return scaledRgb(value);
|
|
56
|
+
}, (value) => {
|
|
57
|
+
if (value === 1) {
|
|
58
|
+
return "new";
|
|
59
|
+
}
|
|
60
|
+
return "removed";
|
|
61
|
+
}, chartColorDomain, (node) => {
|
|
62
|
+
const newTotal = node.data.newCount + node.data.enabledCount;
|
|
63
|
+
const deletedTotal = node.data.deletedCount + node.data.disabledCount;
|
|
64
|
+
const unchangedTotal = node.value - newTotal - deletedTotal;
|
|
65
|
+
return [`new: ${newTotal}`, `deleted: ${deletedTotal}`, `unchanged: ${unchangedTotal}`];
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
export const createProblemsDistributionHeatMapChartData = (chartId, res) => {
|
|
69
|
+
const chartColorDomain = [0, 1];
|
|
70
|
+
return createHeatMapChartDataGeneric(() => res[chartId], (value, domain = chartColorDomain) => {
|
|
71
|
+
const scaledRgb = scaleLinear()
|
|
72
|
+
.domain(domain)
|
|
73
|
+
.range([resolveCSSVarColor(statusColors.passed), resolveCSSVarColor(statusColors.failed)])
|
|
74
|
+
.interpolate(interpolateRgb)
|
|
75
|
+
.clamp(true);
|
|
76
|
+
return scaledRgb(value);
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
export const createTreeMapChartData = (chartId, chartData, res) => {
|
|
80
|
+
if (chartData.type === ChartType.SuccessRateDistribution) {
|
|
81
|
+
return createSuccessRateDistributionTreeMapChartData(chartId, res);
|
|
82
|
+
}
|
|
83
|
+
else if (chartData.type === ChartType.CoverageDiff) {
|
|
84
|
+
return createCoverageDiffTreeMapChartData(chartId, res);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
export const createHeatMapChartData = (chartId, res) => {
|
|
88
|
+
return createProblemsDistributionHeatMapChartData(chartId, res);
|
|
89
|
+
};
|
|
90
|
+
export const createCharts = (res) => {
|
|
91
|
+
return Object.entries(res).reduce((acc, [chartId, chart]) => {
|
|
92
|
+
if (chart.type === ChartType.CurrentStatus) {
|
|
93
|
+
acc[chartId] = res[chartId];
|
|
94
|
+
}
|
|
95
|
+
else if (chart.type === ChartType.StatusDynamics) {
|
|
96
|
+
acc[chartId] = res[chartId];
|
|
97
|
+
}
|
|
98
|
+
else if (chart.type === ChartType.StatusTransitions) {
|
|
99
|
+
acc[chartId] = res[chartId];
|
|
100
|
+
}
|
|
101
|
+
else if (chart.type === ChartType.Durations) {
|
|
102
|
+
acc[chartId] = res[chartId];
|
|
103
|
+
}
|
|
104
|
+
else if (chart.type === ChartType.StabilityDistribution) {
|
|
105
|
+
acc[chartId] = res[chartId];
|
|
106
|
+
}
|
|
107
|
+
else if (chart.type === ChartType.TestBaseGrowthDynamics) {
|
|
108
|
+
acc[chartId] = res[chartId];
|
|
109
|
+
}
|
|
110
|
+
else if (chart.type === ChartType.FBSUAgePyramid) {
|
|
111
|
+
acc[chartId] = res[chartId];
|
|
112
|
+
}
|
|
113
|
+
else if (chart.type === ChartType.TrSeverities) {
|
|
114
|
+
acc[chartId] = res[chartId];
|
|
115
|
+
}
|
|
116
|
+
else if (chart.type === ChartType.DurationDynamics) {
|
|
117
|
+
acc[chartId] = res[chartId];
|
|
118
|
+
}
|
|
119
|
+
else if (chart.type === ChartType.CoverageDiff || chart.type === ChartType.SuccessRateDistribution) {
|
|
120
|
+
const chartData = createTreeMapChartData(chartId, chart, res);
|
|
121
|
+
if (chartData) {
|
|
122
|
+
acc[chartId] = chartData;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else if (chart.type === ChartType.ProblemsDistribution) {
|
|
126
|
+
const chartData = createHeatMapChartData(chartId, res);
|
|
127
|
+
if (chartData) {
|
|
128
|
+
acc[chartId] = chartData;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else if (chart.type === ChartType.TestingPyramid) {
|
|
132
|
+
acc[chartId] = res[chartId];
|
|
133
|
+
}
|
|
134
|
+
return acc;
|
|
135
|
+
}, {});
|
|
136
|
+
};
|
|
137
|
+
export const createChartsWithEnvs = (res) => {
|
|
138
|
+
if (!("general" in res) && !("byEnv" in res)) {
|
|
139
|
+
return { general: createCharts(res), byEnv: {} };
|
|
140
|
+
}
|
|
141
|
+
const result = {
|
|
142
|
+
general: createCharts(res.general),
|
|
143
|
+
byEnv: {},
|
|
144
|
+
};
|
|
145
|
+
for (const [env, chartData] of Object.entries(res.byEnv)) {
|
|
146
|
+
result.byEnv[env] = createCharts(chartData);
|
|
147
|
+
}
|
|
148
|
+
return result;
|
|
149
|
+
};
|
|
150
|
+
export const createHashStorage = () => {
|
|
151
|
+
const hashes = new Map();
|
|
152
|
+
return {
|
|
153
|
+
get: (key) => {
|
|
154
|
+
if (!hashes.has(key)) {
|
|
155
|
+
hashes.set(key, nanoid());
|
|
156
|
+
}
|
|
157
|
+
return hashes.get(key);
|
|
158
|
+
},
|
|
159
|
+
set: (key, value) => hashes.set(key, value),
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
export const createMapWithDefault = (defaultValue) => {
|
|
163
|
+
const map = new Map();
|
|
164
|
+
const createDefaultValue = () => {
|
|
165
|
+
if (Array.isArray(defaultValue)) {
|
|
166
|
+
return [...defaultValue];
|
|
167
|
+
}
|
|
168
|
+
if (typeof defaultValue === "object") {
|
|
169
|
+
return { ...defaultValue };
|
|
170
|
+
}
|
|
171
|
+
return defaultValue;
|
|
172
|
+
};
|
|
173
|
+
return {
|
|
174
|
+
set: (key, value) => map.set(key, value),
|
|
175
|
+
get: (key) => {
|
|
176
|
+
if (!map.has(key)) {
|
|
177
|
+
map.set(key, createDefaultValue());
|
|
178
|
+
}
|
|
179
|
+
return map.get(key);
|
|
180
|
+
},
|
|
181
|
+
get values() {
|
|
182
|
+
return Array.from(map.values());
|
|
183
|
+
},
|
|
184
|
+
get entries() {
|
|
185
|
+
return Array.from(map.entries());
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
};
|
package/dist/data.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export declare const ALLURE_LIVE_RELOAD_HASH_STORAGE_KEY = "__allure_report_live_reload_hash__";
|
|
2
|
-
export declare const createReportDataScript: (reportFiles?: {
|
|
3
|
-
name: string;
|
|
4
|
-
value: string;
|
|
5
|
-
}[]) => string;
|
|
6
2
|
export declare const ensureReportDataReady: () => Promise<unknown>;
|
|
7
3
|
export declare const loadReportData: (name: string) => Promise<string>;
|
|
8
|
-
export declare const reportDataUrl: (path: string, contentType?: string
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export declare const reportDataUrl: (path: string, contentType?: string, params?: {
|
|
5
|
+
bustCache: boolean;
|
|
6
|
+
}) => Promise<string>;
|
|
7
|
+
export declare const fetchReportJsonData: <T>(path: string, params?: {
|
|
8
|
+
bustCache: boolean;
|
|
9
|
+
}) => Promise<T>;
|
|
10
|
+
export declare const fetchReportAttachment: (path: string, contentType?: string) => Promise<Response>;
|
|
11
11
|
export declare const getReportOptions: <T>() => T;
|
package/dist/data.js
CHANGED
|
@@ -1,34 +1,4 @@
|
|
|
1
1
|
export const ALLURE_LIVE_RELOAD_HASH_STORAGE_KEY = "__allure_report_live_reload_hash__";
|
|
2
|
-
export const createReportDataScript = (reportFiles = []) => {
|
|
3
|
-
if (reportFiles.length === 0) {
|
|
4
|
-
return `
|
|
5
|
-
<script async>
|
|
6
|
-
window.allureReportDataReady = true;
|
|
7
|
-
</script>
|
|
8
|
-
`;
|
|
9
|
-
}
|
|
10
|
-
const reportFilesDeclaration = reportFiles.map(({ name, value }) => `d('${name}','${value}')`).join(",");
|
|
11
|
-
return `
|
|
12
|
-
<script async>
|
|
13
|
-
window.allureReportDataReady = false;
|
|
14
|
-
window.allureReportData = window.allureReportData || {};
|
|
15
|
-
|
|
16
|
-
function d(name, value){
|
|
17
|
-
return new Promise(function (resolve) {
|
|
18
|
-
window.allureReportData[name] = value;
|
|
19
|
-
|
|
20
|
-
return resolve(true);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
</script>
|
|
24
|
-
<script defer>
|
|
25
|
-
Promise.allSettled([${reportFilesDeclaration}])
|
|
26
|
-
.then(function(){
|
|
27
|
-
window.allureReportDataReady = true;
|
|
28
|
-
})
|
|
29
|
-
</script>
|
|
30
|
-
`;
|
|
31
|
-
};
|
|
32
2
|
export const ensureReportDataReady = () => new Promise((resolve) => {
|
|
33
3
|
const waitForReady = () => {
|
|
34
4
|
if (globalThis.allureReportDataReady) {
|
|
@@ -49,22 +19,26 @@ export const loadReportData = async (name) => {
|
|
|
49
19
|
}
|
|
50
20
|
});
|
|
51
21
|
};
|
|
52
|
-
export const reportDataUrl = async (path, contentType = "application/octet-stream") => {
|
|
22
|
+
export const reportDataUrl = async (path, contentType = "application/octet-stream", params) => {
|
|
53
23
|
if (globalThis.allureReportData) {
|
|
54
|
-
const dataKey = path.
|
|
24
|
+
const [dataKey] = path.split("?");
|
|
55
25
|
const value = await loadReportData(dataKey);
|
|
56
26
|
return `data:${contentType};base64,${value}`;
|
|
57
27
|
}
|
|
58
28
|
const baseEl = globalThis.document.head.querySelector("base")?.href ?? "https://localhost";
|
|
59
29
|
const url = new URL(path, baseEl);
|
|
60
30
|
const liveReloadHash = globalThis.localStorage.getItem(ALLURE_LIVE_RELOAD_HASH_STORAGE_KEY);
|
|
31
|
+
const cacheKey = globalThis.allureReportOptions?.cacheKey;
|
|
61
32
|
if (liveReloadHash) {
|
|
62
33
|
url.searchParams.set("live_reload_hash", liveReloadHash);
|
|
63
34
|
}
|
|
64
|
-
|
|
35
|
+
if (params?.bustCache && cacheKey) {
|
|
36
|
+
url.searchParams.set("v", cacheKey);
|
|
37
|
+
}
|
|
38
|
+
return url.toString();
|
|
65
39
|
};
|
|
66
|
-
export const fetchReportJsonData = async (path) => {
|
|
67
|
-
const url = await reportDataUrl(path);
|
|
40
|
+
export const fetchReportJsonData = async (path, params) => {
|
|
41
|
+
const url = await reportDataUrl(path, undefined, params);
|
|
68
42
|
const res = await globalThis.fetch(url);
|
|
69
43
|
if (!res.ok) {
|
|
70
44
|
throw new Error(`Failed to fetch ${url}, response status: ${res.status}`);
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const AVAILABLE_LOCALES: readonly ["en", "ru", "ua", "pl", "es", "pt", "de", "hy", "az", "fr", "it", "ja", "he", "ka", "kr", "nl", "sv", "tr", "zh"];
|
|
2
|
+
export declare const DEFAULT_LOCALE = "en";
|
|
3
|
+
export type LangLocale = (typeof AVAILABLE_LOCALES)[number];
|
|
4
|
+
export declare const LANG_LOCALE: Record<LangLocale, {
|
|
5
|
+
short: string;
|
|
6
|
+
full: string;
|
|
7
|
+
iso: string;
|
|
8
|
+
}>;
|
package/dist/i18n.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export const AVAILABLE_LOCALES = [
|
|
2
|
+
"en",
|
|
3
|
+
"ru",
|
|
4
|
+
"ua",
|
|
5
|
+
"pl",
|
|
6
|
+
"es",
|
|
7
|
+
"pt",
|
|
8
|
+
"de",
|
|
9
|
+
"hy",
|
|
10
|
+
"az",
|
|
11
|
+
"fr",
|
|
12
|
+
"it",
|
|
13
|
+
"ja",
|
|
14
|
+
"he",
|
|
15
|
+
"ka",
|
|
16
|
+
"kr",
|
|
17
|
+
"nl",
|
|
18
|
+
"sv",
|
|
19
|
+
"tr",
|
|
20
|
+
"zh",
|
|
21
|
+
];
|
|
22
|
+
export const DEFAULT_LOCALE = "en";
|
|
23
|
+
export const LANG_LOCALE = {
|
|
24
|
+
en: {
|
|
25
|
+
short: "Eng",
|
|
26
|
+
full: "English",
|
|
27
|
+
iso: "en-US",
|
|
28
|
+
},
|
|
29
|
+
ru: {
|
|
30
|
+
short: "Ру",
|
|
31
|
+
full: "Русский",
|
|
32
|
+
iso: "ru-RU",
|
|
33
|
+
},
|
|
34
|
+
ua: {
|
|
35
|
+
short: "Ук",
|
|
36
|
+
full: "Українська",
|
|
37
|
+
iso: "uk-UA",
|
|
38
|
+
},
|
|
39
|
+
pl: {
|
|
40
|
+
short: "Pl",
|
|
41
|
+
full: "Polski",
|
|
42
|
+
iso: "pl-PL",
|
|
43
|
+
},
|
|
44
|
+
es: {
|
|
45
|
+
short: "Es",
|
|
46
|
+
full: "Español",
|
|
47
|
+
iso: "es-ES",
|
|
48
|
+
},
|
|
49
|
+
pt: {
|
|
50
|
+
short: "Pt",
|
|
51
|
+
full: "Português",
|
|
52
|
+
iso: "pt-PT",
|
|
53
|
+
},
|
|
54
|
+
de: {
|
|
55
|
+
short: "De",
|
|
56
|
+
full: "Deutsch",
|
|
57
|
+
iso: "de-DE",
|
|
58
|
+
},
|
|
59
|
+
hy: {
|
|
60
|
+
short: "Hy",
|
|
61
|
+
full: "Հայերեն",
|
|
62
|
+
iso: "hy-AM",
|
|
63
|
+
},
|
|
64
|
+
az: {
|
|
65
|
+
short: "Az",
|
|
66
|
+
full: "Azərbaycan",
|
|
67
|
+
iso: "az-AZ",
|
|
68
|
+
},
|
|
69
|
+
fr: {
|
|
70
|
+
short: "Fr",
|
|
71
|
+
full: "Français",
|
|
72
|
+
iso: "fr-FR",
|
|
73
|
+
},
|
|
74
|
+
it: {
|
|
75
|
+
short: "It",
|
|
76
|
+
full: "Italiano",
|
|
77
|
+
iso: "it-IT",
|
|
78
|
+
},
|
|
79
|
+
ja: {
|
|
80
|
+
short: "Ja",
|
|
81
|
+
full: "日本語",
|
|
82
|
+
iso: "ja-JP",
|
|
83
|
+
},
|
|
84
|
+
he: {
|
|
85
|
+
short: "He",
|
|
86
|
+
full: "עברית",
|
|
87
|
+
iso: "he-IL",
|
|
88
|
+
},
|
|
89
|
+
ka: {
|
|
90
|
+
short: "Ka",
|
|
91
|
+
full: "ქართული",
|
|
92
|
+
iso: "ka-GE",
|
|
93
|
+
},
|
|
94
|
+
kr: {
|
|
95
|
+
short: "Kr",
|
|
96
|
+
full: "한국어",
|
|
97
|
+
iso: "kr-KR",
|
|
98
|
+
},
|
|
99
|
+
nl: {
|
|
100
|
+
short: "Nl",
|
|
101
|
+
full: "Nederlands",
|
|
102
|
+
iso: "nl-NL",
|
|
103
|
+
},
|
|
104
|
+
sv: {
|
|
105
|
+
short: "Sv",
|
|
106
|
+
full: "Svenska",
|
|
107
|
+
iso: "sv-SE",
|
|
108
|
+
},
|
|
109
|
+
tr: {
|
|
110
|
+
short: "Tr",
|
|
111
|
+
full: "Türkçe",
|
|
112
|
+
iso: "tr-TR",
|
|
113
|
+
},
|
|
114
|
+
zh: {
|
|
115
|
+
short: "Zh",
|
|
116
|
+
full: "中文",
|
|
117
|
+
iso: "zh-CN",
|
|
118
|
+
},
|
|
119
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sanitize: (html: string, config?: Record<string, any>) => string;
|
package/dist/sanitize.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface AnsiToHtmlConfig {
|
|
2
|
+
fg?: string;
|
|
3
|
+
bg?: string;
|
|
4
|
+
newline?: boolean;
|
|
5
|
+
escapeXML?: boolean;
|
|
6
|
+
stream?: boolean;
|
|
7
|
+
colors?: string[] | {
|
|
8
|
+
[code: number]: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare const isAnsi: (text?: string) => boolean;
|
|
12
|
+
export declare const ansiToHTML: (text: string, config?: AnsiToHtmlConfig) => string;
|
package/dist/strings.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import AnsiToHtml from "ansi-to-html";
|
|
2
|
+
const ansiRegex = /\x1B\[[0-9;?]*[ -/]*[@-~]/g;
|
|
3
|
+
export const isAnsi = (text) => typeof text === "string" && new RegExp(ansiRegex).test(text);
|
|
4
|
+
export const ansiToHTML = (text, config) => new AnsiToHtml({
|
|
5
|
+
escapeXML: true,
|
|
6
|
+
...config,
|
|
7
|
+
}).toHtml(text);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allurereport/web-commons",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Collection of utilities used across the web Allure reports",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"allure",
|
|
@@ -23,16 +23,27 @@
|
|
|
23
23
|
"clean": "rimraf ./dist"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@allurereport/
|
|
26
|
+
"@allurereport/charts-api": "3.0.0",
|
|
27
|
+
"@allurereport/core-api": "3.0.0",
|
|
28
|
+
"@allurereport/plugin-api": "3.0.0",
|
|
29
|
+
"ansi-to-html": "^0.7.2",
|
|
30
|
+
"d3-interpolate": "^3.0.1",
|
|
31
|
+
"d3-scale": "^4.0.2",
|
|
32
|
+
"d3-shape": "^3.2.0",
|
|
33
|
+
"dompurify": "^3.2.6",
|
|
34
|
+
"nanoid": "^5.1.6"
|
|
27
35
|
},
|
|
28
36
|
"devDependencies": {
|
|
29
37
|
"@stylistic/eslint-plugin": "^2.6.1",
|
|
38
|
+
"@types/d3-interpolate": "^3.0.4",
|
|
39
|
+
"@types/d3-scale": "^4.0.9",
|
|
40
|
+
"@types/d3-shape": "^3.1.6",
|
|
30
41
|
"@types/eslint": "^8.56.11",
|
|
31
42
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
32
43
|
"@typescript-eslint/parser": "^8.0.0",
|
|
33
|
-
"@vitest/runner": "^2.1.
|
|
34
|
-
"allure-js-commons": "^3.0
|
|
35
|
-
"allure-vitest": "^3.0
|
|
44
|
+
"@vitest/runner": "^2.1.9",
|
|
45
|
+
"allure-js-commons": "^3.3.0",
|
|
46
|
+
"allure-vitest": "^3.3.0",
|
|
36
47
|
"eslint": "^8.57.0",
|
|
37
48
|
"eslint-config-prettier": "^9.1.0",
|
|
38
49
|
"eslint-plugin-import": "^2.29.1",
|
|
@@ -43,6 +54,6 @@
|
|
|
43
54
|
"rimraf": "^6.0.1",
|
|
44
55
|
"tslib": "^2.7.0",
|
|
45
56
|
"typescript": "^5.6.3",
|
|
46
|
-
"vitest": "^2.1.
|
|
57
|
+
"vitest": "^2.1.9"
|
|
47
58
|
}
|
|
48
59
|
}
|
package/dist/static.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const createScriptTag: (src: string, options?: {
|
|
2
|
-
async?: false;
|
|
3
|
-
defer?: false;
|
|
4
|
-
}) => string;
|
|
5
|
-
export declare const createStylesLinkTag: (src: string) => string;
|
|
6
|
-
export declare const createFontLinkTag: (src: string) => string;
|
|
7
|
-
export declare const createFaviconLinkTag: (src: string) => string;
|
|
8
|
-
export declare const createBaseUrlScript: () => string;
|
package/dist/static.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export const createScriptTag = (src, options) => {
|
|
2
|
-
return `<script ${options?.async ? "async" : ""} ${options?.defer ? "defer" : ""} src="${src}"></script>`;
|
|
3
|
-
};
|
|
4
|
-
export const createStylesLinkTag = (src) => {
|
|
5
|
-
return `<link rel="stylesheet" type="text/css" href="${src}">`;
|
|
6
|
-
};
|
|
7
|
-
export const createFontLinkTag = (src) => {
|
|
8
|
-
return `<link rel="preload" href="${src}" as="font" type="font/woff" crossorigin /> `;
|
|
9
|
-
};
|
|
10
|
-
export const createFaviconLinkTag = (src) => {
|
|
11
|
-
return `<link rel="icon" href="${src}">`;
|
|
12
|
-
};
|
|
13
|
-
export const createBaseUrlScript = () => {
|
|
14
|
-
return `
|
|
15
|
-
<script>
|
|
16
|
-
const { origin, pathname } = window.location;
|
|
17
|
-
const url = new URL(pathname, origin);
|
|
18
|
-
const baseEl = document.createElement("base");
|
|
19
|
-
|
|
20
|
-
baseEl.href = url.toString();
|
|
21
|
-
|
|
22
|
-
window.document.head.appendChild(baseEl);
|
|
23
|
-
</script>
|
|
24
|
-
`;
|
|
25
|
-
};
|