@trackunit/iris-app-webpack-plugin 1.9.22 → 1.10.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/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 1.10.0 (2026-01-12)
2
+
3
+ ### 🚀 Features
4
+
5
+ - enhance module loading and HTML generation for remote entries ([b1084798ae0](https://github.com/Trackunit/manager/commit/b1084798ae0))
6
+ - enhance module federation support and loading mechanism ([75c9d14690f](https://github.com/Trackunit/manager/commit/75c9d14690f))
7
+ - add extensionType variable to HTML generation and improve TypeScript config loading ([add881c7ef7](https://github.com/Trackunit/manager/commit/add881c7ef7))
8
+
9
+ ### 🧱 Updated Dependencies
10
+
11
+ - Updated iris-app-build-utilities to 1.10.0
12
+ - Updated iris-app-api to 1.13.0
13
+
14
+ ### ❤️ Thank You
15
+
16
+ - Mikkel Thorbjørn Andersen
17
+
1
18
  ## 1.9.22 (2026-01-09)
2
19
 
3
20
  ### 🧱 Updated Dependencies
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-webpack-plugin",
3
- "version": "1.9.22",
3
+ "version": "1.10.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "repository": "https://github.com/Trackunit/manager",
6
6
  "engines": {
7
7
  "node": ">=24.x"
8
8
  },
9
9
  "dependencies": {
10
- "csp-header": "^5.2.1",
10
+ "@trackunit/iris-app-build-utilities": "1.10.0",
11
11
  "webpack": "5.101.3",
12
- "@trackunit/iris-app-api": "1.12.22",
12
+ "@trackunit/iris-app-api": "1.13.0",
13
13
  "tslib": "^2.6.2"
14
14
  },
15
15
  "types": "./src/index.d.ts",
@@ -6,14 +6,16 @@ interface TrackunitIrisAppWebpackPluginOptions {
6
6
  manifest?: IrisAppManifest;
7
7
  }
8
8
  /**
9
- * Webpack plugin that generates a manifest.json file
9
+ * Webpack plugin for generating a manifest.json file and index.html file for Iris Apps.
10
10
  */
11
11
  export declare class TrackunitIrisAppWebpackPlugin {
12
12
  private options;
13
13
  /**
14
- * @param options - Plugin options
15
- * @param {string} options.appDir - Directory path where the app resides
16
- * @param {object} options.manifest - Object containing the app's manifest
14
+ * Constructor for the TrackunitIrisAppWebpackPlugin.
15
+ *
16
+ * @param options - The options for the TrackunitIrisAppWebpackPlugin.
17
+ * @param {string} options.appDir - The directory path where the app resides.
18
+ * @param {IrisAppManifest} options.manifest - The manifest for the app.
17
19
  */
18
20
  constructor(options: TrackunitIrisAppWebpackPluginOptions);
19
21
  /**
@@ -2,20 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TrackunitIrisAppWebpackPlugin = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const iris_app_build_utilities_1 = require("@trackunit/iris-app-build-utilities");
5
6
  const fs = tslib_1.__importStar(require("fs"));
6
7
  const path = tslib_1.__importStar(require("path"));
7
- const consoleUtils_1 = require("./consoleUtils");
8
- const customFieldUtil_1 = require("./customFieldUtil");
9
- const extensionUtil_1 = require("./extensionUtil");
10
- const indexHtmlUtil_1 = require("./indexHtmlUtil");
11
8
  /**
12
- * Webpack plugin that generates a manifest.json file
9
+ * Webpack plugin for generating a manifest.json file and index.html file for Iris Apps.
13
10
  */
14
11
  class TrackunitIrisAppWebpackPlugin {
15
12
  /**
16
- * @param options - Plugin options
17
- * @param {string} options.appDir - Directory path where the app resides
18
- * @param {object} options.manifest - Object containing the app's manifest
13
+ * Constructor for the TrackunitIrisAppWebpackPlugin.
14
+ *
15
+ * @param options - The options for the TrackunitIrisAppWebpackPlugin.
16
+ * @param {string} options.appDir - The directory path where the app resides.
17
+ * @param {IrisAppManifest} options.manifest - The manifest for the app.
19
18
  */
20
19
  constructor(options) {
21
20
  this.options = options;
@@ -37,7 +36,7 @@ class TrackunitIrisAppWebpackPlugin {
37
36
  compiler.hooks.done.tap("AfterBuildPlugin", stats => {
38
37
  if (!stats.hasErrors()) {
39
38
  setTimeout(() => {
40
- (0, consoleUtils_1.logInfo)("\n✨ Iris App is now started, check it out ✨\nhttps://new.manager.trackunit.com/goto/iris-app-dev\n");
39
+ (0, iris_app_build_utilities_1.logInfo)("\n✨ Iris App is now started, check it out ✨\nhttps://new.manager.trackunit.com/goto/iris-app-dev\n");
41
40
  }, 0);
42
41
  }
43
42
  });
@@ -51,7 +50,7 @@ class TrackunitIrisAppWebpackPlugin {
51
50
  // Using one of the later asset processing stages to ensure
52
51
  // that all assets were already added to the compilation by other plugins.
53
52
  stage: Compilation.PROCESS_ASSETS_STAGE_DERIVED,
54
- }, async (assets) => {
53
+ }, async (_) => {
55
54
  // "assets" is an object that contains all assets
56
55
  // in the compilation, the keys of the object are pathnames of the assets
57
56
  // and the values are file sources.
@@ -62,12 +61,17 @@ class TrackunitIrisAppWebpackPlugin {
62
61
  }
63
62
  const manifestJson = this.options.manifest;
64
63
  const appSrc = path.join(this.options.appDir, "src");
65
- manifestJson.customFieldDefinitions = (0, customFieldUtil_1.updateCustomFields)(this.options.manifest.customFieldDefinitions, appSrc);
66
- manifestJson.extensions = (0, extensionUtil_1.updateExtensions)(this.options.manifest.extensions);
64
+ manifestJson.customFieldDefinitions = (0, iris_app_build_utilities_1.updateCustomFields)(this.options.manifest.customFieldDefinitions, appSrc);
65
+ manifestJson.extensions = (0, iris_app_build_utilities_1.updateExtensions)(this.options.manifest.extensions);
67
66
  compilation.emitAsset("manifest.json", new RawSource(JSON.stringify(manifestJson, null, 2)));
68
67
  const packageJson = fs.readFileSync(`${this.options.appDir}/package.json`, "utf8");
69
68
  compilation.emitAsset("package.json", new RawSource(packageJson));
70
- const html = (0, indexHtmlUtil_1.updateIndexHtml)(fs.readFileSync(path.join(__dirname, "index.html"), "utf8"), manifestJson, packageJson);
69
+ const devtools = `<script nonce="{{nonce}}" src="http://localhost:8097"></script>`;
70
+ const html = (0, iris_app_build_utilities_1.updateIndexHtml)({
71
+ manifest: manifestJson,
72
+ packageJson,
73
+ devtools,
74
+ });
71
75
  // Adding new asset to the compilation, so it would be automatically
72
76
  // generated by the webpack in the output directory.
73
77
  compilation.emitAsset("index.html", new RawSource(html));
@@ -1 +1 @@
1
- {"version":3,"file":"TrackunitIrisAppWebpackPlugin.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-webpack-plugin/src/lib/TrackunitIrisAppWebpackPlugin.ts"],"names":[],"mappings":";;;;AACA,+CAAyB;AACzB,mDAA6B;AAE7B,iDAAyC;AACzC,uDAAuD;AACvD,mDAAmD;AACnD,mDAAkD;AAOlD;;GAEG;AACH,MAAa,6BAA6B;IACxC;;;;OAIG;IACH,YAA2B,OAA6C;QAA7C,YAAO,GAAP,OAAO,CAAsC;IAAG,CAAC;IAE5E;;OAEG;IACI,KAAK,CAAC,QAAqB;QAChC,MAAM,UAAU,GAAG,6BAA6B,CAAC,IAAI,CAAC;QAEtD,oEAAoE;QACpE,0DAA0D;QAC1D,uEAAuE;QACvE,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;QAE7B,kEAAkE;QAClE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;QAEhC,gEAAgE;QAChE,6CAA6C;QAC7C,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;QAEtC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,KAAK,CAAC,EAAE;YAClD,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC;gBACvB,UAAU,CAAC,GAAG,EAAE;oBACd,IAAA,sBAAO,EACL,oGAAoG,CACrG,CAAC;gBACJ,CAAC,EAAE,CAAC,CAAC,CAAC;YACR,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,gEAAgE;QAChE,kDAAkD;QAClD,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,WAA2B,EAAE,EAAE;YAC7E,iEAAiE;YACjE,WAAW,CAAC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AAA,+BAAe,EAC1B,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,EAC3D,YAAY,EACZ,WAAW,CACZ,CAAC;gBAEF,oEAAoE;gBACpE,oDAAoD;gBACpD,WAAW,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;YAC3D,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtFD,sEAsFC","sourcesContent":["import { IrisAppManifest } from \"@trackunit/iris-app-api\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport * as wp from \"webpack\";\nimport { logInfo } from \"./consoleUtils\";\nimport { updateCustomFields } from \"./customFieldUtil\";\nimport { updateExtensions } from \"./extensionUtil\";\nimport { updateIndexHtml } from \"./indexHtmlUtil\";\n\ninterface TrackunitIrisAppWebpackPluginOptions {\n nxRootDir: string;\n appDir: string;\n manifest?: IrisAppManifest;\n}\n/**\n * Webpack plugin that generates a manifest.json file\n */\nexport class TrackunitIrisAppWebpackPlugin {\n /**\n * @param options - Plugin options\n * @param {string} options.appDir - Directory path where the app resides\n * @param {object} options.manifest - Object containing the app's manifest\n */\n public constructor(private options: TrackunitIrisAppWebpackPluginOptions) {}\n\n /**\n Webpack plugin for generating a Markdown file from app manifest and index HTML file.\n */\n public apply(compiler: wp.Compiler) {\n const pluginName = TrackunitIrisAppWebpackPlugin.name;\n\n // webpack module instance can be accessed from the compiler object,\n // this ensures that correct version of the module is used\n // (do not require/import the webpack or any symbols from it directly).\n const { webpack } = compiler;\n\n // Compilation object gives us reference to some useful constants.\n const { Compilation } = webpack;\n\n // RawSource is one of the \"sources\" classes that should be used\n // to represent asset sources in compilation.\n const { RawSource } = webpack.sources;\n\n compiler.hooks.done.tap(\"AfterBuildPlugin\", stats => {\n if (!stats.hasErrors()) {\n setTimeout(() => {\n logInfo(\n \"\\n✨ Iris App is now started, check it out ✨\\nhttps://new.manager.trackunit.com/goto/iris-app-dev\\n\"\n );\n }, 0);\n }\n });\n\n // Tapping to the \"thisCompilation\" hook in order to further tap\n // to the compilation process on an earlier stage.\n compiler.hooks.thisCompilation.tap(pluginName, (compilation: wp.Compilation) => {\n // Tapping to the assets processing pipeline on a specific stage.\n compilation.contextDependencies.add(this.options.appDir);\n compilation.hooks.processAssets.tap(\n {\n name: pluginName,\n\n // Using one of the later asset processing stages to ensure\n // that all assets were already added to the compilation by other plugins.\n stage: Compilation.PROCESS_ASSETS_STAGE_DERIVED,\n },\n async assets => {\n // \"assets\" is an object that contains all assets\n // in the compilation, the keys of the object are pathnames of the assets\n // and the values are file sources.\n\n // Iterating over all the assets and\n // generating content for our Markdown file.\n if (!this.options.manifest) {\n throw Error(\"you must provide a app manifest\");\n }\n const manifestJson = this.options.manifest;\n\n const appSrc = path.join(this.options.appDir, \"src\");\n manifestJson.customFieldDefinitions = updateCustomFields(\n this.options.manifest.customFieldDefinitions,\n appSrc\n );\n\n manifestJson.extensions = updateExtensions(this.options.manifest.extensions);\n compilation.emitAsset(\"manifest.json\", new RawSource(JSON.stringify(manifestJson, null, 2)));\n\n const packageJson = fs.readFileSync(`${this.options.appDir}/package.json`, \"utf8\");\n compilation.emitAsset(\"package.json\", new RawSource(packageJson));\n\n const html = updateIndexHtml(\n fs.readFileSync(path.join(__dirname, \"index.html\"), \"utf8\"),\n manifestJson,\n packageJson\n );\n\n // Adding new asset to the compilation, so it would be automatically\n // generated by the webpack in the output directory.\n compilation.emitAsset(\"index.html\", new RawSource(html));\n }\n );\n });\n }\n}\n"]}
1
+ {"version":3,"file":"TrackunitIrisAppWebpackPlugin.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-webpack-plugin/src/lib/TrackunitIrisAppWebpackPlugin.ts"],"names":[],"mappings":";;;;AACA,kFAAqH;AACrH,+CAAyB;AACzB,mDAA6B;AAQ7B;;GAEG;AACH,MAAa,6BAA6B;IACxC;;;;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logInfo, updateCustomFields, updateExtensions, updateIndexHtml } from \"@trackunit/iris-app-build-utilities\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport * as wp from \"webpack\";\ninterface TrackunitIrisAppWebpackPluginOptions {\n nxRootDir: string;\n appDir: string;\n manifest?: IrisAppManifest;\n}\n\n/**\n * Webpack plugin for generating a manifest.json file and index.html file for Iris Apps.\n */\nexport class TrackunitIrisAppWebpackPlugin {\n /**\n * Constructor for the TrackunitIrisAppWebpackPlugin.\n *\n * @param options - The options for the TrackunitIrisAppWebpackPlugin.\n * @param {string} options.appDir - The directory path where the app resides.\n * @param {IrisAppManifest} options.manifest - The manifest for the app.\n */\n public constructor(private options: TrackunitIrisAppWebpackPluginOptions) {}\n\n /**\n Webpack plugin for generating a Markdown file from app manifest and index HTML file.\n */\n public apply(compiler: wp.Compiler): void {\n const pluginName = TrackunitIrisAppWebpackPlugin.name;\n\n // webpack module instance can be accessed from the compiler object,\n // this ensures that correct version of the module is used\n // (do not require/import the webpack or any symbols from it directly).\n const { webpack } = compiler;\n\n // Compilation object gives us reference to some useful constants.\n const { Compilation } = webpack;\n\n // RawSource is one of the \"sources\" classes that should be used\n // to represent asset sources in compilation.\n const { RawSource } = webpack.sources;\n\n compiler.hooks.done.tap(\"AfterBuildPlugin\", stats => {\n if (!stats.hasErrors()) {\n setTimeout(() => {\n logInfo(\n \"\\n✨ Iris App is now started, check it out ✨\\nhttps://new.manager.trackunit.com/goto/iris-app-dev\\n\"\n );\n }, 0);\n }\n });\n\n // Tapping to the \"thisCompilation\" hook in order to further tap\n // to the compilation process on an earlier stage.\n compiler.hooks.thisCompilation.tap(pluginName, (compilation: wp.Compilation) => {\n // Tapping to the assets processing pipeline on a specific stage.\n compilation.contextDependencies.add(this.options.appDir);\n compilation.hooks.processAssets.tap(\n {\n name: pluginName,\n\n // Using one of the later asset processing stages to ensure\n // that all assets were already added to the compilation by other plugins.\n stage: Compilation.PROCESS_ASSETS_STAGE_DERIVED,\n },\n async _ => {\n // \"assets\" is an object that contains all assets\n // in the compilation, the keys of the object are pathnames of the assets\n // and the values are file sources.\n\n // Iterating over all the assets and\n // generating content for our Markdown file.\n if (!this.options.manifest) {\n throw Error(\"you must provide a app manifest\");\n }\n const manifestJson = this.options.manifest;\n\n const appSrc = path.join(this.options.appDir, \"src\");\n manifestJson.customFieldDefinitions = updateCustomFields(\n this.options.manifest.customFieldDefinitions,\n appSrc\n );\n\n manifestJson.extensions = updateExtensions(this.options.manifest.extensions);\n compilation.emitAsset(\"manifest.json\", new RawSource(JSON.stringify(manifestJson, null, 2)));\n\n const packageJson = fs.readFileSync(`${this.options.appDir}/package.json`, \"utf8\");\n compilation.emitAsset(\"package.json\", new RawSource(packageJson));\n\n const devtools = `<script nonce=\"{{nonce}}\" src=\"http://localhost:8097\"></script>`;\n const html = updateIndexHtml({\n manifest: manifestJson,\n packageJson,\n devtools,\n });\n\n // Adding new asset to the compilation, so it would be automatically\n // generated by the webpack in the output directory.\n compilation.emitAsset(\"index.html\", new RawSource(html));\n }\n );\n });\n }\n}\n"]}
@@ -1,16 +0,0 @@
1
- export declare const RESET = "\u001B[0m";
2
- export declare const GREEN = "\u001B[32m";
3
- export declare const RED = "\u001B[31m";
4
- export declare const YELLOW = "\u001B[33m";
5
- /**
6
- * Logs an error message and exits the program with a non-zero exit code.
7
- */
8
- export declare const logError: (message: string) => void;
9
- /**
10
- * Logs a warning message.
11
- */
12
- export declare const logWarning: (message: string) => void;
13
- /**
14
- * Logs an info message.
15
- */
16
- export declare const logInfo: (message: string) => void;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.logInfo = exports.logWarning = exports.logError = exports.YELLOW = exports.RED = exports.GREEN = exports.RESET = void 0;
4
- exports.RESET = "\x1b[0m";
5
- exports.GREEN = "\x1b[32m";
6
- exports.RED = "\x1b[31m";
7
- exports.YELLOW = "\x1b[33m";
8
- /**
9
- * Logs an error message and exits the program with a non-zero exit code.
10
- */
11
- const logError = (message) => {
12
- // eslint-disable-next-line no-console
13
- console.error(exports.RED, message, exports.RESET);
14
- };
15
- exports.logError = logError;
16
- /**
17
- * Logs a warning message.
18
- */
19
- const logWarning = (message) => {
20
- // eslint-disable-next-line no-console
21
- console.warn(exports.YELLOW, message, exports.RESET);
22
- };
23
- exports.logWarning = logWarning;
24
- /**
25
- * Logs an info message.
26
- */
27
- const logInfo = (message) => {
28
- // eslint-disable-next-line no-console
29
- console.info(exports.GREEN, message, exports.RESET);
30
- };
31
- exports.logInfo = logInfo;
32
- //# sourceMappingURL=consoleUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"consoleUtils.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-webpack-plugin/src/lib/consoleUtils.ts"],"names":[],"mappings":";;;AAAa,QAAA,KAAK,GAAG,SAAS,CAAC;AAClB,QAAA,KAAK,GAAG,UAAU,CAAC;AACnB,QAAA,GAAG,GAAG,UAAU,CAAC;AACjB,QAAA,MAAM,GAAG,UAAU,CAAC;AAEjC;;GAEG;AACI,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAE,EAAE;IAC1C,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC,WAAG,EAAE,OAAO,EAAE,aAAK,CAAC,CAAC;AACrC,CAAC,CAAC;AAHW,QAAA,QAAQ,YAGnB;AAEF;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,EAAE;IAC5C,sCAAsC;IACtC,OAAO,CAAC,IAAI,CAAC,cAAM,EAAE,OAAO,EAAE,aAAK,CAAC,CAAC;AACvC,CAAC,CAAC;AAHW,QAAA,UAAU,cAGrB;AAEF;;GAEG;AACI,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,EAAE;IACzC,sCAAsC;IACtC,OAAO,CAAC,IAAI,CAAC,aAAK,EAAE,OAAO,EAAE,aAAK,CAAC,CAAC;AACtC,CAAC,CAAC;AAHW,QAAA,OAAO,WAGlB","sourcesContent":["export const RESET = \"\\x1b[0m\";\nexport const GREEN = \"\\x1b[32m\";\nexport const RED = \"\\x1b[31m\";\nexport const YELLOW = \"\\x1b[33m\";\n\n/**\n * Logs an error message and exits the program with a non-zero exit code.\n */\nexport const logError = (message: string) => {\n // eslint-disable-next-line no-console\n console.error(RED, message, RESET);\n};\n\n/**\n * Logs a warning message.\n */\nexport const logWarning = (message: string) => {\n // eslint-disable-next-line no-console\n console.warn(YELLOW, message, RESET);\n};\n\n/**\n * Logs an info message.\n */\nexport const logInfo = (message: string) => {\n // eslint-disable-next-line no-console\n console.info(GREEN, message, RESET);\n};\n"]}
@@ -1,9 +0,0 @@
1
- import { CustomFieldDefinition } from "@trackunit/iris-app-api";
2
- /**
3
- * Updates the custom field definitions with the given app source directory.
4
- * If the custom field definitions are not provided, it returns an empty array.
5
- * If the app source directory is not provided, it returns the custom field definitions.
6
- *
7
- * @returns {CustomFieldDefinition[]} the updated custom field definitions array
8
- */
9
- export declare const updateCustomFields: (customFieldDefinitions?: Array<CustomFieldDefinition>, appSrc?: string) => Array<CustomFieldDefinition>;
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateCustomFields = void 0;
4
- const iris_app_api_1 = require("@trackunit/iris-app-api");
5
- const process_1 = require("process");
6
- const consoleUtils_1 = require("./consoleUtils");
7
- const irisAppTranslationUtils_1 = require("./irisAppTranslationUtils");
8
- /**
9
- * Updates the custom field definitions with the given app source directory.
10
- * If the custom field definitions are not provided, it returns an empty array.
11
- * If the app source directory is not provided, it returns the custom field definitions.
12
- *
13
- * @returns {CustomFieldDefinition[]} the updated custom field definitions array
14
- */
15
- const updateCustomFields = (customFieldDefinitions, appSrc) => {
16
- if (!customFieldDefinitions || !appSrc) {
17
- return [];
18
- }
19
- customFieldDefinitions.forEach(customFieldDefinition => {
20
- if ((0, iris_app_api_1.isCustomFieldTranslationArray)(customFieldDefinition.translations)) {
21
- const foundEn = customFieldDefinition.translations.find(translation => translation.language === "en");
22
- if (!foundEn) {
23
- (0, consoleUtils_1.logError)(` ✨ Translation not found for language "en" you must supply the english translation for custom field: ${customFieldDefinition.key}`);
24
- (0, process_1.exit)(1);
25
- }
26
- }
27
- else {
28
- const titles = (0, irisAppTranslationUtils_1.convertTranslationKeyIfNeeded)(customFieldDefinition.translations.title, appSrc);
29
- const descriptions = (0, irisAppTranslationUtils_1.convertTranslationKeyIfNeeded)(customFieldDefinition.translations.description, appSrc);
30
- if (!titles || !descriptions) {
31
- (0, consoleUtils_1.logError)(` ✨ Translation not found for language "en" you must supply the english translation for custom field: ${customFieldDefinition.key}`);
32
- (0, process_1.exit)(1);
33
- }
34
- const titleKeys = (0, irisAppTranslationUtils_1.isTranslationsObject)(titles)
35
- ? Object.keys(titles).filter((key) => key in titles)
36
- : null;
37
- if (titleKeys !== null && titleKeys.indexOf("en") === -1) {
38
- (0, consoleUtils_1.logError)(` ✨ Translation not found 'title' for language "en" you must supply the english translation for custom field: ${customFieldDefinition.key}`);
39
- (0, process_1.exit)(1);
40
- }
41
- const descriptionKeys = (0, irisAppTranslationUtils_1.isTranslationsObject)(descriptions)
42
- ? Object.keys(descriptions).filter((key) => key in descriptions)
43
- : null;
44
- if (descriptionKeys !== null && descriptionKeys.indexOf("en") === -1) {
45
- (0, consoleUtils_1.logError)(` ✨ Translation not found 'description' for language "en" you must supply the english translation for custom field: ${customFieldDefinition.key}`);
46
- (0, process_1.exit)(1);
47
- }
48
- const keys = new Set([...(titleKeys || []), ...(descriptionKeys || [])]);
49
- const translations = [
50
- {
51
- language: "en",
52
- title: (0, irisAppTranslationUtils_1.isTranslationsObject)(titles) ? titles.en : titles,
53
- description: (0, irisAppTranslationUtils_1.isTranslationsObject)(descriptions) ? descriptions.en : descriptions,
54
- },
55
- ];
56
- keys.forEach(language => {
57
- if (language !== "en") {
58
- translations.push({
59
- language,
60
- title: (0, irisAppTranslationUtils_1.isTranslationsObject)(titles) ? titles[language] : titles,
61
- description: (0, irisAppTranslationUtils_1.isTranslationsObject)(descriptions) ? descriptions[language] : descriptions,
62
- });
63
- }
64
- });
65
- customFieldDefinition.translations = translations;
66
- }
67
- });
68
- return customFieldDefinitions;
69
- };
70
- exports.updateCustomFields = updateCustomFields;
71
- //# sourceMappingURL=customFieldUtil.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customFieldUtil.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-webpack-plugin/src/lib/customFieldUtil.ts"],"names":[],"mappings":";;;AAAA,0DAKiC;AACjC,qCAA+B;AAC/B,iDAA0C;AAC1C,uEAAgG;AAEhG;;;;;;GAMG;AACI,MAAM,kBAAkB,GAAG,CAChC,sBAAqD,EACrD,MAAe,EACe,EAAE;IAChC,IAAI,CAAC,sBAAsB,IAAI,CAAC,MAAM,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,sBAAsB,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAAE;QACrD,IAAI,IAAA,4CAA6B,EAAC,qBAAqB,CAAC,YAAY,CAAC,EAAE,CAAC;YACtE,MAAM,OAAO,GAAG,qBAAqB,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;YACtG,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,IAAA,uBAAQ,EACN,wGAAwG,qBAAqB,CAAC,GAAG,EAAE,CACpI,CAAC;gBACF,IAAA,cAAI,EAAC,CAAC,CAAC,CAAC;YACV,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,IAAA,uDAA6B,EAAC,qBAAqB,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YAC/F,MAAM,YAAY,GAAG,IAAA,uDAA6B,EAAC,qBAAqB,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;YAE3G,IAAI,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE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AAK,EAAE,IAAA,8CAAoB,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;oBACxD,WAAW,EAAE,IAAA,8CAAoB,EAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY;iBACjF;aACF,CAAC;YAEF,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBACtB,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;oBACtB,YAAY,CAAC,IAAI,CAAC;wBAChB,QAAQ;wBAER,KAAK,EAAE,IAAA,8CAAoB,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAE,CAAC,CAAC,CAAC,MAAM;wBAChE,WAAW,EAAE,IAAA,8CAAoB,EAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY;qBACxF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CAAC,CAAC;YACH,qBAAqB,CAAC,YAAY,GAAG,YAAY,CAAC;QACpD,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,sBAAsB,CAAC;AAChC,CAAC,CAAC;AAvEW,QAAA,kBAAkB,sBAuE7B","sourcesContent":["import {\n CustomFieldDefinition,\n CustomFieldTranslationArray,\n isCustomFieldTranslationArray,\n TranslationLanguageKeys,\n} from \"@trackunit/iris-app-api\";\nimport { exit } from \"process\";\nimport { logError } from \"./consoleUtils\";\nimport { convertTranslationKeyIfNeeded, isTranslationsObject } from \"./irisAppTranslationUtils\";\n\n/**\n * Updates the custom field definitions with the given app source directory.\n * If the custom field definitions are not provided, it returns an empty array.\n * If the app source directory is not provided, it returns the custom field definitions.\n *\n * @returns {CustomFieldDefinition[]} the updated custom field definitions array\n */\nexport const updateCustomFields = (\n customFieldDefinitions?: Array<CustomFieldDefinition>,\n appSrc?: string\n): Array<CustomFieldDefinition> => {\n if (!customFieldDefinitions || !appSrc) {\n return [];\n }\n customFieldDefinitions.forEach(customFieldDefinition => {\n if (isCustomFieldTranslationArray(customFieldDefinition.translations)) {\n const foundEn = customFieldDefinition.translations.find(translation => translation.language === \"en\");\n if (!foundEn) {\n logError(\n ` ✨ Translation not found for language \"en\" you must supply the english translation for custom field: ${customFieldDefinition.key}`\n );\n exit(1);\n }\n } else {\n const titles = convertTranslationKeyIfNeeded(customFieldDefinition.translations.title, appSrc);\n const descriptions = convertTranslationKeyIfNeeded(customFieldDefinition.translations.description, appSrc);\n\n if (!titles || !descriptions) {\n logError(\n ` ✨ Translation not found for language \"en\" you must supply the english translation for custom field: ${customFieldDefinition.key}`\n );\n exit(1);\n }\n const titleKeys = isTranslationsObject(titles)\n ? Object.keys(titles).filter((key): key is TranslationLanguageKeys => key in titles)\n : null;\n\n if (titleKeys !== null && titleKeys.indexOf(\"en\") === -1) {\n logError(\n ` ✨ Translation not found 'title' for language \"en\" you must supply the english translation for custom field: ${customFieldDefinition.key}`\n );\n exit(1);\n }\n\n const descriptionKeys = isTranslationsObject(descriptions)\n ? Object.keys(descriptions).filter((key): key is TranslationLanguageKeys => key in descriptions)\n : null;\n\n if (descriptionKeys !== null && descriptionKeys.indexOf(\"en\") === -1) {\n logError(\n ` ✨ Translation not found 'description' for language \"en\" you must supply the english translation for custom field: ${customFieldDefinition.key}`\n );\n exit(1);\n }\n\n const keys = new Set([...(titleKeys || []), ...(descriptionKeys || [])]);\n const translations: CustomFieldTranslationArray = [\n {\n language: \"en\",\n title: isTranslationsObject(titles) ? titles.en : titles,\n description: isTranslationsObject(descriptions) ? descriptions.en : descriptions,\n },\n ];\n\n keys.forEach(language => {\n if (language !== \"en\") {\n translations.push({\n language,\n\n title: isTranslationsObject(titles) ? titles[language]! : titles,\n description: isTranslationsObject(descriptions) ? descriptions[language] : descriptions,\n });\n }\n });\n customFieldDefinition.translations = translations;\n }\n });\n return customFieldDefinitions;\n};\n"]}
@@ -1,14 +0,0 @@
1
- import { AssetHomeExtensionManifest, FleetExtensionManifest, IrisAppExtension } from "@trackunit/iris-app-api";
2
- /**
3
- * Updates the extensions with the correct translation keys and paths
4
- *
5
- * @param extensions - The extensions to update
6
- * @returns { IrisAppExtension[]} The updated extensions
7
- */
8
- export declare const updateExtensions: (extensions: Array<IrisAppExtension>) => Array<IrisAppExtension>;
9
- /**
10
- * Updates the conditions of the extension
11
- *
12
- * @param extension - The extension to update
13
- */
14
- export declare const updateConditions: (extension: AssetHomeExtensionManifest | FleetExtensionManifest) => void;
@@ -1,115 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateConditions = exports.updateExtensions = void 0;
4
- const iris_app_api_1 = require("@trackunit/iris-app-api");
5
- const irisAppTranslationUtils_1 = require("./irisAppTranslationUtils");
6
- const fixUrl = (image, extensionId) => {
7
- if ((0, iris_app_api_1.isIconByPath)(image) || (0, iris_app_api_1.isImageByPath)(image)) {
8
- if (image.path.toString().startsWith("/")) {
9
- image.path = (extensionId + image.path.toString());
10
- }
11
- else {
12
- image.path = (extensionId + "/" + image.path.toString());
13
- }
14
- }
15
- };
16
- /**
17
- * Updates the extensions with the correct translation keys and paths
18
- *
19
- * @param extensions - The extensions to update
20
- * @returns { IrisAppExtension[]} The updated extensions
21
- */
22
- const updateExtensions = (extensions) => {
23
- extensions.forEach(extension => {
24
- if (extension.type !== "IRIS_APP_SETTINGS_EXTENSION" &&
25
- extension.type !== "WIDGET_EXTENSION" &&
26
- extension.type !== "LIFECYCLE_EXTENSION" &&
27
- extension.type !== "SERVERLESS_FUNCTION_EXTENSION" &&
28
- extension.type !== "AI_AGENT_EXTENSION" &&
29
- extension.menuItem.name) {
30
- extension.menuItem.name =
31
- (0, irisAppTranslationUtils_1.convertTranslationKeyIfNeeded)(extension.menuItem.name, extension.sourceRoot) || "Unknown";
32
- }
33
- if (extension.type === "WIDGET_EXTENSION" && extension.header.name) {
34
- if ((0, iris_app_api_1.isIconByPath)(extension.header.image) && !extension.header.image.path.startsWith(extension.id)) {
35
- fixUrl(extension.header.image, extension.id);
36
- }
37
- if (extension.footer &&
38
- ((0, iris_app_api_1.isIconByPath)(extension.footer.poweredByImage) || (0, iris_app_api_1.isImageByPath)(extension.footer.poweredByImage)) &&
39
- !extension.footer.poweredByImage.path.startsWith(extension.id)) {
40
- fixUrl(extension.footer.poweredByImage, extension.id);
41
- }
42
- if (extension.footer &&
43
- (0, iris_app_api_1.isFooterWithLink)(extension.footer) &&
44
- (0, irisAppTranslationUtils_1.isTranslationKey)(extension.footer.linkDescription)) {
45
- extension.footer.linkDescription = (0, irisAppTranslationUtils_1.convertTranslationKeyIfNeeded)(extension.footer.linkDescription, extension.sourceRoot);
46
- }
47
- extension.header.name = (0, irisAppTranslationUtils_1.convertTranslationKeyIfNeeded)(extension.header.name, extension.sourceRoot) || "Unknown";
48
- }
49
- if (extension.type === "REPORT_EXTENSION" && (0, irisAppTranslationUtils_1.isTranslationKey)(extension.menuItem.description)) {
50
- extension.menuItem.description =
51
- (0, irisAppTranslationUtils_1.convertTranslationKeyIfNeeded)(extension.menuItem.description, extension.sourceRoot) || "Unknown";
52
- }
53
- if (extension.type === "ASSET_HOME_EXTENSION" || extension.type === "FLEET_EXTENSION") {
54
- (0, exports.updateConditions)(extension);
55
- }
56
- if (extension.type === "FLEET_EXTENSION") {
57
- if ((0, iris_app_api_1.isIconByPath)(extension.menuItem.image) && !extension.menuItem.image.path.startsWith(extension.id)) {
58
- fixUrl(extension.menuItem.image, extension.id);
59
- }
60
- if (extension.menuItem.description) {
61
- extension.menuItem.description = (0, irisAppTranslationUtils_1.convertTranslationKeyIfNeeded)(extension.menuItem.description, extension.sourceRoot);
62
- }
63
- }
64
- });
65
- return extensions;
66
- };
67
- exports.updateExtensions = updateExtensions;
68
- /**
69
- * Updates the conditions of the extension
70
- *
71
- * @param extension - The extension to update
72
- */
73
- const updateConditions = (extension) => {
74
- if (extension.conditions?.brand) {
75
- if (Array.isArray(extension.conditions.brand)) {
76
- extension.conditions.brand.forEach(brand => {
77
- if (typeof brand !== "string") {
78
- brand.pattern = brand.pattern.toString();
79
- }
80
- });
81
- }
82
- else if (typeof extension.conditions.brand !== "string") {
83
- extension.conditions.brand.pattern = extension.conditions.brand.pattern.toString();
84
- }
85
- }
86
- if (extension.conditions?.model) {
87
- if (Array.isArray(extension.conditions.model)) {
88
- extension.conditions.model.forEach(model => {
89
- if (typeof model !== "string") {
90
- model.pattern = model.pattern.toString();
91
- }
92
- });
93
- }
94
- else if (typeof extension.conditions.model !== "string") {
95
- extension.conditions.model.pattern = extension.conditions.model.pattern.toString();
96
- }
97
- }
98
- if (extension.type === "ASSET_HOME_EXTENSION") {
99
- const dtCondition = extension.conditions?.telematicsDeviceType;
100
- if (dtCondition) {
101
- if (Array.isArray(dtCondition)) {
102
- dtCondition.forEach(dt => {
103
- if (typeof dt !== "string") {
104
- dt.pattern = dt.pattern.toString();
105
- }
106
- });
107
- }
108
- else if (typeof dtCondition !== "string") {
109
- dtCondition.pattern = dtCondition.pattern.toString();
110
- }
111
- }
112
- }
113
- };
114
- exports.updateConditions = updateConditions;
115
- //# sourceMappingURL=extensionUtil.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extensionUtil.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-webpack-plugin/src/lib/extensionUtil.ts"],"names":[],"mappings":";;;AAAA,0DAWiC;AACjC,uEAA4F;AAE5F,MAAM,MAAM,GAAG,CAAC,KAAqD,EAAE,WAAmB,EAAE,EAAE;IAC5F,IAAI,IAAA,2BAAY,EAAC,KAAK,CAAC,IAAI,IAAA,4BAAa,EAAC,KAAK,CAAC,EAAE,CAAC;QAChD,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1C,KAAK,CAAC,IAAI,GAAG,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAi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ByName,\n IconByPath,\n ImageByPath,\n IrisAppExtension,\n isFooterWithLink,\n isIconByPath,\n isImageByPath,\n SvgImagePath,\n} from \"@trackunit/iris-app-api\";\nimport { convertTranslationKeyIfNeeded, isTranslationKey } from \"./irisAppTranslationUtils\";\n\nconst fixUrl = (image: IconByName | IconByPath | ImageByPath | string, extensionId: string) => {\n if (isIconByPath(image) || isImageByPath(image)) {\n if (image.path.toString().startsWith(\"/\")) {\n image.path = (extensionId + image.path.toString()) as SvgImagePath;\n } else {\n image.path = (extensionId + \"/\" + image.path.toString()) as SvgImagePath;\n }\n }\n};\n\n/**\n * Updates the extensions with the correct translation keys and paths\n *\n * @param extensions - The extensions to update\n * @returns { IrisAppExtension[]} The updated extensions\n */\nexport const updateExtensions = (extensions: Array<IrisAppExtension>): Array<IrisAppExtension> => {\n extensions.forEach(extension => {\n if (\n extension.type !== \"IRIS_APP_SETTINGS_EXTENSION\" &&\n extension.type !== \"WIDGET_EXTENSION\" &&\n extension.type !== \"LIFECYCLE_EXTENSION\" &&\n extension.type !== \"SERVERLESS_FUNCTION_EXTENSION\" &&\n extension.type !== \"AI_AGENT_EXTENSION\" &&\n extension.menuItem.name\n ) {\n extension.menuItem.name =\n convertTranslationKeyIfNeeded(extension.menuItem.name, extension.sourceRoot) || \"Unknown\";\n }\n\n if (extension.type === \"WIDGET_EXTENSION\" && extension.header.name) {\n if (isIconByPath(extension.header.image) && !extension.header.image.path.startsWith(extension.id)) {\n fixUrl(extension.header.image, extension.id);\n }\n\n if (\n extension.footer &&\n (isIconByPath(extension.footer.poweredByImage) || isImageByPath(extension.footer.poweredByImage)) &&\n !extension.footer.poweredByImage.path.startsWith(extension.id)\n ) {\n fixUrl(extension.footer.poweredByImage, extension.id);\n }\n if (\n extension.footer &&\n isFooterWithLink(extension.footer) &&\n isTranslationKey(extension.footer.linkDescription)\n ) {\n extension.footer.linkDescription = convertTranslationKeyIfNeeded(\n extension.footer.linkDescription,\n extension.sourceRoot\n );\n }\n extension.header.name = convertTranslationKeyIfNeeded(extension.header.name, extension.sourceRoot) || \"Unknown\";\n }\n\n if (extension.type === \"REPORT_EXTENSION\" && isTranslationKey(extension.menuItem.description)) {\n extension.menuItem.description =\n convertTranslationKeyIfNeeded(extension.menuItem.description, extension.sourceRoot) || \"Unknown\";\n }\n if (extension.type === \"ASSET_HOME_EXTENSION\" || extension.type === \"FLEET_EXTENSION\") {\n updateConditions(extension);\n }\n if (extension.type === \"FLEET_EXTENSION\") {\n if (isIconByPath(extension.menuItem.image) && !extension.menuItem.image.path.startsWith(extension.id)) {\n fixUrl(extension.menuItem.image, extension.id);\n }\n if (extension.menuItem.description) {\n extension.menuItem.description = convertTranslationKeyIfNeeded(\n extension.menuItem.description,\n extension.sourceRoot\n );\n }\n }\n });\n return extensions;\n};\n\n/**\n * Updates the conditions of the extension\n *\n * @param extension - The extension to update\n */\nexport const updateConditions = (extension: AssetHomeExtensionManifest | FleetExtensionManifest) => {\n if (extension.conditions?.brand) {\n if (Array.isArray(extension.conditions.brand)) {\n extension.conditions.brand.forEach(brand => {\n if (typeof brand !== \"string\") {\n brand.pattern = brand.pattern.toString();\n }\n });\n } else if (typeof extension.conditions.brand !== \"string\") {\n extension.conditions.brand.pattern = extension.conditions.brand.pattern.toString();\n }\n }\n if (extension.conditions?.model) {\n if (Array.isArray(extension.conditions.model)) {\n extension.conditions.model.forEach(model => {\n if (typeof model !== \"string\") {\n model.pattern = model.pattern.toString();\n }\n });\n } else if (typeof extension.conditions.model !== \"string\") {\n extension.conditions.model.pattern = extension.conditions.model.pattern.toString();\n }\n }\n if (extension.type === \"ASSET_HOME_EXTENSION\") {\n const dtCondition = extension.conditions?.telematicsDeviceType;\n if (dtCondition) {\n if (Array.isArray(dtCondition)) {\n dtCondition.forEach(dt => {\n if (typeof dt !== \"string\") {\n dt.pattern = dt.pattern.toString();\n }\n });\n } else if (typeof dtCondition !== \"string\") {\n dtCondition.pattern = dtCondition.pattern.toString();\n }\n }\n }\n};\n"]}
@@ -1,19 +0,0 @@
1
- <!DOCTYPE html>
2
- <html class="notranslate" translate="no" style="height:100dvh;">
3
- <head>
4
- <base id="baseHref" href="/" />
5
- <script>
6
- module = location.pathname.split('/')[1];
7
- scope = "{{scope}}";
8
- manifestScopes = {{manifestScopes}};
9
- </script>
10
- <script src="/remoteEntry.js"></script>
11
- <script defer src="/extensionloader.js"></script>
12
- <meta http-equiv="Content-Security-Policy" content="{{cspContent}}" />
13
- <meta name="referrer" content="strict-origin">
14
- <script nonce="{{nonce}}" src="http://localhost:8097"></script>
15
- </head>
16
- <body class="@container" style="height:100dvh;">
17
- <div id="single-spa-application:app"></div>
18
- </body>
19
- </html>
@@ -1,5 +0,0 @@
1
- import { IrisAppManifest } from "@trackunit/iris-app-api";
2
- /**
3
- * Updates the index.html file with the given manifest and package.json file.
4
- */
5
- export declare const updateIndexHtml: (indexContents: string, manifest: IrisAppManifest, packageJson: string) => string;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateIndexHtml = void 0;
4
- const iris_app_api_1 = require("@trackunit/iris-app-api");
5
- const crypto_1 = require("crypto");
6
- const csp_header_1 = require("csp-header");
7
- /**
8
- * Updates the index.html file with the given manifest and package.json file.
9
- */
10
- const updateIndexHtml = (indexContents, manifest, packageJson) => {
11
- const scopeAndModuleNonce = (0, crypto_1.randomBytes)(16).toString("base64");
12
- const csp = (0, csp_header_1.getCSP)({
13
- // eslint-disable-next-line local-rules/no-typescript-assertion
14
- directives: (0, iris_app_api_1.irisAppCspInput)(manifest.validDomains, manifest.cspHeader),
15
- presets: {
16
- irisAppDefaultCsp: iris_app_api_1.irisAppDefaultCsp,
17
- localDev: { "connect-src": ["ws://localhost:8097/"], "script-src": [`'nonce-${scopeAndModuleNonce}'`] },
18
- },
19
- });
20
- const cspWithoutSandbox = csp
21
- .split(";")
22
- .filter(substring => !substring.trim().startsWith("sandbox"))
23
- .join(";");
24
- let html = indexContents.replace("{{cspContent}}", cspWithoutSandbox);
25
- html = html.replace("{{nonce}}", scopeAndModuleNonce);
26
- html = html.replace("{{scope}}", JSON.parse(packageJson).name);
27
- if (manifest.scopes) {
28
- html = html.replace("{{manifestScopes}}", JSON.stringify(manifest.scopes));
29
- }
30
- else {
31
- html = html.replace("{{manifestScopes}}", "undefined");
32
- }
33
- return html;
34
- };
35
- exports.updateIndexHtml = updateIndexHtml;
36
- //# sourceMappingURL=indexHtmlUtil.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"indexHtmlUtil.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-webpack-plugin/src/lib/indexHtmlUtil.ts"],"names":[],"mappings":";;;AAAA,0DAA8F;AAC9F,mCAAqC;AACrC,2CAAoC;AAEpC;;GAEG;AACI,MAAM,eAAe,GAAG,CAAC,aAAqB,EAAE,QAAyB,EAAE,WAAmB,EAAE,EAAE;IACvG,MAAM,mBAAmB,GAAG,IAAA,oBAAW,EAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAE/D,MAAM,GAAG,GAAG,IAAA,mBAAM,EAAC;QACjB,+DAA+D;QAC/D,UAAU,EAAE,IAAA,8BAAe,EAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,SAAS,CAAuC;QAC5G,OAAO,EAAE;YACP,iBAAiB,EAAjB,gCAAiB;YACjB,QAAQ,EAAE,EAAE,aAAa,EAAE,CAAC,sBAAsB,CAAC,EAAE,YAAY,EAAE,CAAC,UAAU,mBAAmB,GAAG,CAAC,EAAE;SACxG;KACF,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,GAAG;SAC1B,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;SAC5D,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,IAAI,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAEtE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;IAEtD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/D,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7E,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA3BW,QAAA,eAAe,mBA2B1B","sourcesContent":["import { irisAppCspInput, irisAppDefaultCsp, IrisAppManifest } from \"@trackunit/iris-app-api\";\nimport { randomBytes } from \"crypto\";\nimport { getCSP } from \"csp-header\";\n\n/**\n * Updates the index.html file with the given manifest and package.json file.\n */\nexport const updateIndexHtml = (indexContents: string, manifest: IrisAppManifest, packageJson: string) => {\n const scopeAndModuleNonce = randomBytes(16).toString(\"base64\");\n\n const csp = getCSP({\n // eslint-disable-next-line local-rules/no-typescript-assertion\n directives: irisAppCspInput(manifest.validDomains, manifest.cspHeader) as import(\"csp-header\").CSPDirectives,\n presets: {\n irisAppDefaultCsp,\n localDev: { \"connect-src\": [\"ws://localhost:8097/\"], \"script-src\": [`'nonce-${scopeAndModuleNonce}'`] },\n },\n });\n\n const cspWithoutSandbox = csp\n .split(\";\")\n .filter(substring => !substring.trim().startsWith(\"sandbox\"))\n .join(\";\");\n let html = indexContents.replace(\"{{cspContent}}\", cspWithoutSandbox);\n\n html = html.replace(\"{{nonce}}\", scopeAndModuleNonce);\n\n html = html.replace(\"{{scope}}\", JSON.parse(packageJson).name);\n if (manifest.scopes) {\n html = html.replace(\"{{manifestScopes}}\", JSON.stringify(manifest.scopes));\n } else {\n html = html.replace(\"{{manifestScopes}}\", \"undefined\");\n }\n return html;\n};\n"]}
@@ -1,34 +0,0 @@
1
- import { TranslationKey, Translations } from "@trackunit/iris-app-api";
2
- /**
3
- * Convert translation key if needed
4
- *
5
- * @param translationObj - The translation object to convert
6
- * @param srcDir - The source directory
7
- */
8
- export declare const convertTranslationKeyIfNeeded: (translationObj: string | Translations | TranslationKey | null | undefined, srcDir: string) => Translations | string | undefined;
9
- /**
10
- * Check if the object is a translation key
11
- *
12
- * @param object - The object to check
13
- * @returns {boolean} if the object is a translation key, false otherwise
14
- * @example
15
- * const translationKey: TranslationKey = {
16
- * key: "hello",
17
- * };
18
- * console.log(isTranslationKey(translationKey)); // true
19
- */
20
- export declare const isTranslationKey: (object: string | Translations | TranslationKey | undefined | null) => object is TranslationKey;
21
- /**
22
- * Check if the object is a translations object
23
- *
24
- * @param object - The object to check
25
- * @returns {boolean} if the object is a translations object, false otherwise
26
- * @example
27
- * const translations: Translations = {
28
- * en: "Hello",
29
- * da: "Hej",
30
- * };
31
- * console.log(isTranslationsObject(translations)); // true
32
- * console.log(isTranslationsObject({ edn: "Hello" })); // false
33
- */
34
- export declare const isTranslationsObject: (object: string | Translations | TranslationKey | undefined | null) => object is Translations;
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTranslationsObject = exports.isTranslationKey = exports.convertTranslationKeyIfNeeded = void 0;
4
- const tslib_1 = require("tslib");
5
- const iris_app_api_1 = require("@trackunit/iris-app-api");
6
- const fs = tslib_1.__importStar(require("fs"));
7
- const path = tslib_1.__importStar(require("path"));
8
- const process_1 = require("process");
9
- const consoleUtils_1 = require("./consoleUtils");
10
- /**
11
- * Convert translation key if needed
12
- *
13
- * @param translationObj - The translation object to convert
14
- * @param srcDir - The source directory
15
- */
16
- const convertTranslationKeyIfNeeded = (translationObj, srcDir) => {
17
- const result = translationObj;
18
- if ((0, exports.isTranslationKey)(result)) {
19
- const translationKey = result.key;
20
- const enTranslationFilePath = path.join(srcDir, "locales", "en", "translation.json");
21
- if (!fs.existsSync(enTranslationFilePath)) {
22
- (0, consoleUtils_1.logError)(` ✨ Translation file not found for: "${result.key}" looked here: ${enTranslationFilePath}`);
23
- (0, process_1.exit)(1);
24
- }
25
- const enTranslations = JSON.parse(fs.readFileSync(enTranslationFilePath, "utf8"));
26
- if (!enTranslations[translationKey]) {
27
- (0, consoleUtils_1.logError)(` ✨ Translation not found for: "${result.key}" looked here: ${enTranslationFilePath}`);
28
- (0, process_1.exit)(1);
29
- }
30
- const translations = {
31
- en: enTranslations[translationKey],
32
- };
33
- iris_app_api_1.languageKeys.forEach(languageCode => {
34
- const translationFilePath = path.join(srcDir, "locales", languageCode, "translation.json");
35
- if (fs.existsSync(translationFilePath)) {
36
- const lngTranslations = JSON.parse(fs.readFileSync(translationFilePath, "utf8"));
37
- translations[languageCode] = lngTranslations[translationKey];
38
- }
39
- else {
40
- (0, consoleUtils_1.logWarning)(` ✨ Warning translation file not found for: "${result.key}" looked here: ${translationFilePath}`);
41
- }
42
- });
43
- return translations;
44
- }
45
- return result || undefined;
46
- };
47
- exports.convertTranslationKeyIfNeeded = convertTranslationKeyIfNeeded;
48
- /**
49
- * Check if the object is a translation key
50
- *
51
- * @param object - The object to check
52
- * @returns {boolean} if the object is a translation key, false otherwise
53
- * @example
54
- * const translationKey: TranslationKey = {
55
- * key: "hello",
56
- * };
57
- * console.log(isTranslationKey(translationKey)); // true
58
- */
59
- const isTranslationKey = (object) => {
60
- return typeof object === "object" && object !== null && "key" in object;
61
- };
62
- exports.isTranslationKey = isTranslationKey;
63
- /**
64
- * Check if the object is a translations object
65
- *
66
- * @param object - The object to check
67
- * @returns {boolean} if the object is a translations object, false otherwise
68
- * @example
69
- * const translations: Translations = {
70
- * en: "Hello",
71
- * da: "Hej",
72
- * };
73
- * console.log(isTranslationsObject(translations)); // true
74
- * console.log(isTranslationsObject({ edn: "Hello" })); // false
75
- */
76
- const isTranslationsObject = (object) => {
77
- return typeof object === "object" && object !== null && "en" in object;
78
- };
79
- exports.isTranslationsObject = isTranslationsObject;
80
- //# sourceMappingURL=irisAppTranslationUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"irisAppTranslationUtils.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-webpack-plugin/src/lib/irisAppTranslationUtils.ts"],"names":[],"mappings":";;;;AAAA,0DAAqF;AACrF,+CAAyB;AACzB,mDAA6B;AAC7B,qCAA+B;AAC/B,iDAAsD;AAEtD;;;;;GAKG;AACI,MAAM,6BAA6B,GAAG,CAC3C,cAAyE,EACzE,MAAc,EACqB,EAAE;IACrC,MAAM,MAAM,GAAG,cAAc,CAAC;IAE9B,IAAI,IAAA,wBAAgB,EAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC;QAElC,MAAM,qBAAqB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC;QACrF,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAAE,CAAC;YAC1C,IAAA,uBAAQ,EAAC,uCAAuC,MAAM,CAAC,GAAG,kBAAkB,qBAAqB,EAAE,CAAC,CAAC;YACrG,IAAA,cAAI,EAAC,CAAC,CAAC,CAAC;QACV,CAAC;QACD,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC,CAAC;QAClF,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,CAAC;YACpC,IAAA,uBAAQ,EAAC,kCAAkC,MAAM,CAAC,GAAG,kBAAkB,qBAAqB,EAAE,CAAC,CAAC;YAChG,IAAA,cAAI,EAAC,CAAC,CAAC,CAAC;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ris-app-api\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { exit } from \"process\";\nimport { logError, logWarning } from \"./consoleUtils\";\n\n/**\n * Convert translation key if needed\n *\n * @param translationObj - The translation object to convert\n * @param srcDir - The source directory\n */\nexport const convertTranslationKeyIfNeeded = (\n translationObj: string | Translations | TranslationKey | null | undefined,\n srcDir: string\n): Translations | string | undefined => {\n const result = translationObj;\n\n if (isTranslationKey(result)) {\n const translationKey = result.key;\n\n const enTranslationFilePath = path.join(srcDir, \"locales\", \"en\", \"translation.json\");\n if (!fs.existsSync(enTranslationFilePath)) {\n logError(` ✨ Translation file not found for: \"${result.key}\" looked here: ${enTranslationFilePath}`);\n exit(1);\n }\n const enTranslations = JSON.parse(fs.readFileSync(enTranslationFilePath, \"utf8\"));\n if (!enTranslations[translationKey]) {\n logError(` ✨ Translation not found for: \"${result.key}\" looked here: ${enTranslationFilePath}`);\n exit(1);\n }\n\n const translations: Translations = {\n en: enTranslations[translationKey],\n };\n\n languageKeys.forEach(languageCode => {\n const translationFilePath = path.join(srcDir, \"locales\", languageCode, \"translation.json\");\n if (fs.existsSync(translationFilePath)) {\n const lngTranslations = JSON.parse(fs.readFileSync(translationFilePath, \"utf8\"));\n translations[languageCode] = lngTranslations[translationKey];\n } else {\n logWarning(` ✨ Warning translation file not found for: \"${result.key}\" looked here: ${translationFilePath}`);\n }\n });\n return translations;\n }\n return result || undefined;\n};\n\n/**\n * Check if the object is a translation key\n *\n * @param object - The object to check\n * @returns {boolean} if the object is a translation key, false otherwise\n * @example\n * const translationKey: TranslationKey = {\n * key: \"hello\",\n * };\n * console.log(isTranslationKey(translationKey)); // true\n */\nexport const isTranslationKey = (\n object: string | Translations | TranslationKey | undefined | null\n): object is TranslationKey => {\n return typeof object === \"object\" && object !== null && \"key\" in object;\n};\n\n/**\n * Check if the object is a translations object\n *\n * @param object - The object to check\n * @returns {boolean} if the object is a translations object, false otherwise\n * @example\n * const translations: Translations = {\n * en: \"Hello\",\n * da: \"Hej\",\n * };\n * console.log(isTranslationsObject(translations)); // true\n * console.log(isTranslationsObject({ edn: \"Hello\" })); // false\n */\nexport const isTranslationsObject = (\n object: string | Translations | TranslationKey | undefined | null\n): object is Translations => {\n return typeof object === \"object\" && object !== null && \"en\" in object;\n};\n"]}