@allurereport/plugin-dashboard 3.21.0 → 3.22.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.
@@ -1,8 +1,7 @@
1
1
  import type { TestResult } from "@allurereport/core-api";
2
2
  import { type AllureStore, type PluginContext, type ReportFiles } from "@allurereport/plugin-api";
3
- import type { DashboardOptions, DashboardPluginOptions, TemplateManifest } from "./model.js";
3
+ import type { DashboardOptions, DashboardPluginOptions } from "./model.js";
4
4
  import type { DashboardDataWriter, ReportFile } from "./writer.js";
5
- export declare const readTemplateManifest: (_singleFileMode?: boolean) => Promise<TemplateManifest>;
6
5
  export declare const generateAllCharts: (writer: DashboardDataWriter, store: AllureStore, options: DashboardPluginOptions, context: PluginContext, filter?: (testResult: TestResult) => boolean) => Promise<void>;
7
6
  export declare const generateEnvirontmentsList: (writer: DashboardDataWriter, store: AllureStore) => Promise<void>;
8
7
  export declare const generateStaticFiles: (payload: DashboardOptions & {
@@ -1,7 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { defaultChartsConfig } from "@allurereport/charts-api";
3
3
  import { createBaseUrlScript, createFontLinkTag, injectReportDataScript, reportDataScriptPlaceholder, stringifyForInlineScript, createScriptTag, createStylesLinkTag, } from "@allurereport/core-api";
4
- import { copyReportStaticAssets, getReportStaticAsset, readReportStaticAssets, } from "@allurereport/plugin-api/static-assets";
4
+ import { createSingleFileScripts, copyReportStaticAssets, getReportStaticAsset, readReportStaticAssets, } from "@allurereport/plugin-api/static-assets";
5
5
  import { generateCharts } from "@allurereport/web-commons";
6
6
  import Handlebars from "handlebars";
7
7
  const reportStaticArchive = new URL("../dist/static/report.tar", import.meta.url);
@@ -41,10 +41,6 @@ const template = `<!DOCTYPE html>
41
41
  </body>
42
42
  </html>
43
43
  `;
44
- export const readTemplateManifest = async (_singleFileMode) => {
45
- const { manifest } = await readReportStaticAssets(reportStaticArchive);
46
- return manifest;
47
- };
48
44
  export const generateAllCharts = async (writer, store, options, context, filter) => {
49
45
  const { layout = defaultChartsConfig } = options;
50
46
  const generatedChartsData = await generateCharts(layout, store, context.reportName, randomUUID, filter);
@@ -85,8 +81,7 @@ export const generateStaticFiles = async (payload) => {
85
81
  const mainCssContent = getReportStaticAsset(staticAssets, mainCss);
86
82
  headTags.push(createStylesLinkTag(`data:text/css;base64,${mainCssContent.toString("base64")}`));
87
83
  }
88
- const mainJsContentBuffer = getReportStaticAsset(staticAssets, mainJs);
89
- bodyTags.push(createScriptTag(`data:text/javascript;base64,${mainJsContentBuffer.toString("base64")}`));
84
+ bodyTags.push(createSingleFileScripts(staticAssets.files, mainJs, { compress: false }));
90
85
  }
91
86
  const reportOptions = {
92
87
  reportName,
package/dist/model.d.ts CHANGED
@@ -10,4 +10,3 @@ export type DashboardOptions = {
10
10
  filter?: (testResult: TestResult) => boolean;
11
11
  };
12
12
  export type DashboardPluginOptions = DashboardOptions;
13
- export type TemplateManifest = Record<string, string>;
package/dist/plugin.js CHANGED
@@ -11,6 +11,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
11
11
  };
12
12
  var _DashboardPlugin_writer, _DashboardPlugin_generateAfterStart, _DashboardPlugin_generate;
13
13
  import { createPluginSummary, } from "@allurereport/plugin-api";
14
+ import { validateChartsOptions } from "@allurereport/web-commons";
14
15
  import { generateAllCharts, generateEnvirontmentsList, generateStaticFiles } from "./generators.js";
15
16
  import { InMemoryDashboardDataWriter, ReportFileDashboardDataWriter } from "./writer.js";
16
17
  export class DashboardPlugin {
@@ -51,6 +52,7 @@ export class DashboardPlugin {
51
52
  this.done = async (context, store) => {
52
53
  await __classPrivateFieldGet(this, _DashboardPlugin_generateAfterStart, "f").call(this, context, store);
53
54
  };
55
+ validateChartsOptions(options.layout ?? []);
54
56
  }
55
57
  async info(context, store) {
56
58
  return createPluginSummary({
Binary file
package/dist/writer.d.ts CHANGED
@@ -6,11 +6,6 @@ export type ReportFile = {
6
6
  export interface DashboardDataWriter {
7
7
  writeWidget<T>(fileName: string, data: T): Promise<void>;
8
8
  }
9
- export declare class FileSystemReportDataWriter implements DashboardDataWriter {
10
- private readonly output;
11
- constructor(output: string);
12
- writeWidget<T>(fileName: string, data: T): Promise<void>;
13
- }
14
9
  export declare class InMemoryDashboardDataWriter implements DashboardDataWriter {
15
10
  #private;
16
11
  writeWidget<T>(fileName: string, data: T): Promise<void>;
package/dist/writer.js CHANGED
@@ -4,19 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _InMemoryDashboardDataWriter_data;
7
- import { mkdir, writeFile } from "node:fs/promises";
8
- import { resolve } from "node:path";
9
7
  import { join as joinPosix } from "node:path/posix";
10
- export class FileSystemReportDataWriter {
11
- constructor(output) {
12
- this.output = output;
13
- }
14
- async writeWidget(fileName, data) {
15
- const distFolder = resolve(this.output, "widgets");
16
- await mkdir(distFolder, { recursive: true });
17
- await writeFile(resolve(distFolder, fileName), JSON.stringify(data), { encoding: "utf-8" });
18
- }
19
- }
20
8
  export class InMemoryDashboardDataWriter {
21
9
  constructor() {
22
10
  _InMemoryDashboardDataWriter_data.set(this, {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-dashboard",
3
- "version": "3.21.0",
3
+ "version": "3.22.1",
4
4
  "description": "Allure Dashboard Plugin – plugin for generating dashboard with a mix of charts",
5
5
  "keywords": [
6
6
  "allure",
@@ -25,32 +25,34 @@
25
25
  ".": "./dist/index.js"
26
26
  },
27
27
  "scripts": {
28
- "build": "run clean && tsc --project ./tsconfig.json && node ../../scripts/pack-report-static.mjs ../web-dashboard/dist/multi ./dist/static/report.tar",
28
+ "build": "run clean && tsc --project ./tsconfig.json && node ../../scripts/pack-report-static.mjs ../web-dashboard/dist/multi ./dist/static/report.tar --allow-chunks",
29
29
  "clean": "rimraf ./dist",
30
- "test": "rimraf ./out && vitest run",
30
+ "test": "rimraf out && vp test run",
31
31
  "test:unit": "yarn test",
32
- "lint": "oxlint --import-plugin src test features stories",
33
- "lint:fix": "oxlint --import-plugin --fix src test features stories"
32
+ "lint": "vp lint --import-plugin src test features stories",
33
+ "lint:fix": "vp lint --import-plugin --fix src test features stories"
34
34
  },
35
35
  "dependencies": {
36
- "@allurereport/charts-api": "3.21.0",
37
- "@allurereport/core-api": "3.21.0",
38
- "@allurereport/plugin-api": "3.21.0",
39
- "@allurereport/web-commons": "3.21.0",
36
+ "@allurereport/charts-api": "3.22.1",
37
+ "@allurereport/core-api": "3.22.1",
38
+ "@allurereport/plugin-api": "3.22.1",
39
+ "@allurereport/web-commons": "3.22.1",
40
40
  "d3-shape": "^3.2.0",
41
41
  "handlebars": "4.7.10"
42
42
  },
43
43
  "devDependencies": {
44
- "@allurereport/test-config": "3.21.0",
45
- "@allurereport/web-dashboard": "3.21.0",
44
+ "@allurereport/common-config": "3.22.1",
45
+ "@allurereport/web-dashboard": "3.22.1",
46
46
  "@types/d3-shape": "^3.1.8",
47
47
  "@types/node": "^20",
48
- "@vitest/coverage-istanbul": "^4.1.0",
48
+ "@vitest/coverage-istanbul": "5.0.4",
49
49
  "@vitest/runner": "^2",
50
50
  "allure-js-commons": "^3",
51
51
  "allure-vitest": "^3",
52
52
  "rimraf": "^6",
53
53
  "typescript": "^5",
54
- "vitest": "^4.1.0"
54
+ "vite": "@voidzero-dev/vite-plus-core@1.2.0",
55
+ "vite-plus": "1.2.0",
56
+ "vitest": "5.0.4"
55
57
  }
56
58
  }