@allurereport/summary 3.16.0 → 3.17.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.
@@ -1,8 +1,7 @@
1
- import { readFile } from "node:fs/promises";
2
- import { createRequire } from "node:module";
3
1
  import { createBaseUrlScript, createScriptTag, stringifyForInlineScript } from "@allurereport/core-api";
2
+ import { getReportStaticAsset, readReportStaticAssets } from "@allurereport/plugin-api/static-assets";
4
3
  import Handlebars from "handlebars";
5
- const require = createRequire(import.meta.url);
4
+ const reportStaticArchive = new URL("../dist/static/report.tar", import.meta.url);
6
5
  const template = `<!DOCTYPE html>
7
6
  <html dir="ltr" lang="en">
8
7
  <head>
@@ -25,17 +24,16 @@ const template = `<!DOCTYPE html>
25
24
  </html>
26
25
  `;
27
26
  export const readTemplateManifest = async () => {
28
- const templateManifestSource = require.resolve("@allurereport/web-summary/dist/manifest.json");
29
- const templateManifest = await readFile(templateManifestSource, { encoding: "utf-8" });
30
- return JSON.parse(templateManifest);
27
+ const { manifest } = await readReportStaticAssets(reportStaticArchive);
28
+ return manifest;
31
29
  };
32
30
  export const generateSummaryStaticFiles = async (payload) => {
33
31
  const compile = Handlebars.compile(template);
34
- const manifest = await readTemplateManifest();
32
+ const staticAssets = await readReportStaticAssets(reportStaticArchive);
33
+ const { manifest } = staticAssets;
35
34
  const bodyTags = [];
36
35
  const mainJs = manifest["main.js"];
37
- const mainJsSource = require.resolve(`@allurereport/web-summary/dist/${mainJs}`);
38
- const mainJsContentBuffer = await readFile(mainJsSource);
36
+ const mainJsContentBuffer = getReportStaticAsset(staticAssets, mainJs);
39
37
  bodyTags.push(createScriptTag(`data:text/javascript;base64,${mainJsContentBuffer.toString("base64")}`));
40
38
  return compile({
41
39
  bodyTags: bodyTags.join("\n"),
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/summary",
3
- "version": "3.16.0",
3
+ "version": "3.17.0",
4
4
  "description": "Allure Summary Plugin – dashboard page generator with charts for Allure Report",
5
5
  "keywords": [
6
6
  "allure",
@@ -23,19 +23,19 @@
23
23
  ".": "./dist/index.js"
24
24
  },
25
25
  "scripts": {
26
- "build": "run clean && tsc --project ./tsconfig.json",
26
+ "build": "run clean && tsc --project ./tsconfig.json && node ../../scripts/pack-report-static.mjs ../web-summary/dist/multi ./dist/static/report.tar",
27
27
  "clean": "rimraf ./dist",
28
28
  "test": "rimraf ./out && vitest run",
29
29
  "lint": "oxlint --import-plugin src test features stories",
30
30
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
31
31
  },
32
32
  "dependencies": {
33
- "@allurereport/core-api": "3.16.0",
34
- "@allurereport/plugin-api": "3.16.0",
35
- "@allurereport/web-summary": "3.16.0",
33
+ "@allurereport/core-api": "3.17.0",
34
+ "@allurereport/plugin-api": "3.17.0",
36
35
  "handlebars": "^4.7.9"
37
36
  },
38
37
  "devDependencies": {
38
+ "@allurereport/web-summary": "3.17.0",
39
39
  "@types/node": "^20",
40
40
  "@vitest/runner": "^2",
41
41
  "allure-js-commons": "^3",