@trackunit/iris-app-build-utilities 1.9.20 → 1.9.22

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,15 @@
1
+ ## 1.9.22 (2026-01-09)
2
+
3
+ ### 🧱 Updated Dependencies
4
+
5
+ - Updated iris-app-api to 1.12.22
6
+
7
+ ## 1.9.21 (2026-01-09)
8
+
9
+ ### 🧱 Updated Dependencies
10
+
11
+ - Updated iris-app-api to 1.12.21
12
+
1
13
  ## 1.9.20 (2026-01-08)
2
14
 
3
15
  ### 🧱 Updated Dependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-build-utilities",
3
- "version": "1.9.20",
3
+ "version": "1.9.22",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "repository": "https://github.com/Trackunit/manager",
6
6
  "engines": {
@@ -8,13 +8,14 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "tsconfig-paths": "^4.2.0",
11
- "typescript": "5.8.3",
11
+ "typescript": "5.9.3",
12
12
  "@graphql-codegen/cli": "^5.0.3",
13
- "@nx/react": "21.2.1",
13
+ "@nx/react": "21.6.10",
14
14
  "tailwindcss": "3.4.3",
15
15
  "@tailwindcss/container-queries": "^0.1.1",
16
16
  "webpack-dev-server": "5.2.1",
17
- "@trackunit/iris-app-api": "1.12.20",
17
+ "@rspack/core": "1.6.7",
18
+ "@trackunit/iris-app-api": "1.12.22",
18
19
  "tslib": "^2.6.2"
19
20
  },
20
21
  "types": "./src/index.d.ts",
@@ -0,0 +1,16 @@
1
+ import type { DevServer as RspackDevServer } from "@rspack/core";
2
+ import type { Configuration as WebpackDevServerConfiguration } from "webpack-dev-server";
3
+ /**
4
+ * Generates a dev server configuration for webpack configuration.
5
+ *
6
+ * @param webpackDevServerConfiguration The configuration to extend.
7
+ * @returns {WebpackDevServerConfiguration} The dev server for webpack.
8
+ */
9
+ export declare const getIrisAppWebpackDevServer: (webpackDevServerConfiguration?: WebpackDevServerConfiguration) => Promise<WebpackDevServerConfiguration>;
10
+ /**
11
+ * Generates a dev server configuration for rspack configuration.
12
+ *
13
+ * @param rspackDevServerConfiguration The configuration to extend.
14
+ * @returns {RspackDevServer} The dev server for rspack.
15
+ */
16
+ export declare const getIrisAppRspackDevServer: (rspackDevServerConfiguration?: RspackDevServer) => Promise<RspackDevServer>;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIrisAppRspackDevServer = exports.getIrisAppWebpackDevServer = void 0;
4
+ const getAvailablePort_1 = require("./getAvailablePort");
5
+ /**
6
+ * Creates the base Iris App dev server configuration.
7
+ *
8
+ * Returns the config without explicit typing because webpack-dev-server's Configuration
9
+ * and rspack's DevServer are nominally different types despite being structurally identical.
10
+ * The rspack team acknowledges this type incompatibility in their own codebase with @ts-ignore.
11
+ *
12
+ * @see https://github.com/web-infra-dev/rspack/blob/main/packages/rspack-dev-server/src/server.ts
13
+ */
14
+ const createIrisAppDevServerConfig = async (port) => ({
15
+ port,
16
+ historyApiFallback: true,
17
+ headers: {
18
+ "Access-Control-Allow-Credentials": "true",
19
+ "Access-Control-Max-Age": "3600",
20
+ "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
21
+ "Access-Control-Allow-Headers": "X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion",
22
+ },
23
+ onListening: () => { },
24
+ setupMiddlewares: (middlewares, devServer) => {
25
+ middlewares.push({
26
+ name: "cors-preflight",
27
+ path: "/",
28
+ middleware: (req, res, next) => {
29
+ if (req.method === "GET") {
30
+ next();
31
+ }
32
+ else {
33
+ res.end?.("GET, HEAD");
34
+ }
35
+ },
36
+ });
37
+ devServer.app?.use("/", (request, response, next) => {
38
+ response.header("Access-Control-Allow-Origin", request.headers.origin || "https://dev.manager.trackunit.com");
39
+ next();
40
+ });
41
+ devServer.app?.use("/manifestAndToken", async (request, response) => {
42
+ response.header("Access-Control-Allow-Origin", request.headers.origin || "https://dev.manager.trackunit.com");
43
+ response.header("Access-Control-Allow-Headers", "X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion");
44
+ try {
45
+ const resp = await fetch(`http://localhost:${port}/manifest.json`);
46
+ const body = await resp.json();
47
+ response.send({ manifest: body });
48
+ }
49
+ catch (e) {
50
+ // eslint-disable-next-line no-console
51
+ console.error("ERROR: ", e);
52
+ response.status(500);
53
+ response.send(e);
54
+ }
55
+ });
56
+ devServer.app?.use("/extensionloader.js", async (request, response) => {
57
+ response.header("Access-Control-Allow-Origin", request.headers.origin || "https://dev.manager.trackunit.com");
58
+ response.header("Access-Control-Allow-Headers", "X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion");
59
+ try {
60
+ // To test extensionloader locally build the iris-app-loader and flip these 2 lines.
61
+ // const resp = await fetch("http://localhost:3000/extensionloader.js");
62
+ const resp = await fetch("https://iris.trackunit.app/extensionloader.js");
63
+ const body = await resp.text();
64
+ response.send(body);
65
+ }
66
+ catch (e) {
67
+ // eslint-disable-next-line no-console
68
+ console.error("ERROR: ", e);
69
+ response.status(500);
70
+ response.send(e);
71
+ }
72
+ });
73
+ return middlewares;
74
+ },
75
+ });
76
+ /**
77
+ * Generates a dev server configuration for webpack configuration.
78
+ *
79
+ * @param webpackDevServerConfiguration The configuration to extend.
80
+ * @returns {WebpackDevServerConfiguration} The dev server for webpack.
81
+ */
82
+ const getIrisAppWebpackDevServer = async (webpackDevServerConfiguration = {}) => {
83
+ const port = await (0, getAvailablePort_1.getAvailablePort)(22220, 22229);
84
+ const baseConfig = await createIrisAppDevServerConfig(port);
85
+ // Type assertion required: webpack-dev-server and rspack have nominally different but
86
+ // structurally identical DevServer types. This is a known limitation acknowledged by
87
+ // the rspack team. See: https://github.com/web-infra-dev/rspack/blob/main/packages/rspack-dev-server/src/server.ts
88
+ // eslint-disable-next-line local-rules/no-typescript-assertion
89
+ return { ...baseConfig, ...webpackDevServerConfiguration };
90
+ };
91
+ exports.getIrisAppWebpackDevServer = getIrisAppWebpackDevServer;
92
+ /**
93
+ * Generates a dev server configuration for rspack configuration.
94
+ *
95
+ * @param rspackDevServerConfiguration The configuration to extend.
96
+ * @returns {RspackDevServer} The dev server for rspack.
97
+ */
98
+ const getIrisAppRspackDevServer = async (rspackDevServerConfiguration = {}) => {
99
+ const port = await (0, getAvailablePort_1.getAvailablePort)(22220, 22229);
100
+ const baseConfig = await createIrisAppDevServerConfig(port);
101
+ // Type assertion required: webpack-dev-server and rspack have nominally different but
102
+ // structurally identical DevServer types. This is a known limitation acknowledged by
103
+ // the rspack team. See: https://github.com/web-infra-dev/rspack/blob/main/packages/rspack-dev-server/src/server.ts
104
+ // eslint-disable-next-line local-rules/no-typescript-assertion
105
+ return { ...baseConfig, ...rspackDevServerConfiguration };
106
+ };
107
+ exports.getIrisAppRspackDevServer = getIrisAppRspackDevServer;
108
+ //# sourceMappingURL=getIrisAppDevServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getIrisAppDevServer.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app-build-utilities/src/getIrisAppDevServer.ts"],"names":[],"mappings":";;;AAEA,yDAAsD;AAEtD;;;;;;;;GAQG;AACH,MAAM,4BAA4B,GAAG,KAAK,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC;IAC5D,IAAI;IACJ,kBAAkB,EAAE,IAAI;IACxB,OAAO,EAAE;QACP,kCAAkC,EAAE,MAAM;QAC1C,wBAAwB,EAAE,MAAM;QAChC,8BAA8B,EAAE,iCAAiC;QACjE,8BAA8B,EAC5B,wHAAwH;KAC3H;IACD,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;IACrB,gBAAgB,EAAE,CAChB,WAAyE,EACzE,SAAsE,EACtE,EAAE;QACF,WAAW,CAAC,IAAI,CAAC;YACf,IAAI,EA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AAC;AAXW,QAAA,0BAA0B,8BAWrC;AAEF;;;;;GAKG;AACI,MAAM,yBAAyB,GAAG,KAAK,EAC5C,+BAAgD,EAAE,EACxB,EAAE;IAC5B,MAAM,IAAI,GAAG,MAAM,IAAA,mCAAgB,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,MAAM,4BAA4B,CAAC,IAAI,CAAC,CAAC;IAE5D,sFAAsF;IACtF,qFAAqF;IACrF,mHAAmH;IACnH,+DAA+D;IAC/D,OAAO,EAAE,GAAG,UAAU,EAAE,GAAG,4BAA4B,EAAgC,CAAC;AAC1F,CAAC,CAAC;AAXW,QAAA,yBAAyB,6BAWpC","sourcesContent":["import type { DevServer as RspackDevServer } from \"@rspack/core\";\nimport type { Configuration as WebpackDevServerConfiguration } from \"webpack-dev-server\";\nimport { getAvailablePort } from \"./getAvailablePort\";\n\n/**\n * Creates the base Iris App dev server configuration.\n *\n * Returns the config without explicit typing because webpack-dev-server's Configuration\n * and rspack's DevServer are nominally different types despite being structurally identical.\n * The rspack team acknowledges this type incompatibility in their own codebase with @ts-ignore.\n *\n * @see https://github.com/web-infra-dev/rspack/blob/main/packages/rspack-dev-server/src/server.ts\n */\nconst createIrisAppDevServerConfig = async (port: number) => ({\n port,\n historyApiFallback: true,\n headers: {\n \"Access-Control-Allow-Credentials\": \"true\",\n \"Access-Control-Max-Age\": \"3600\",\n \"Access-Control-Allow-Methods\": \"GET, POST, PUT, DELETE, OPTIONS\",\n \"Access-Control-Allow-Headers\":\n \"X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion\",\n },\n onListening: () => {},\n setupMiddlewares: (\n middlewares: Array<{ name?: string; path?: string; middleware: unknown }>,\n devServer: { app?: { use: (path: string, handler: unknown) => void } }\n ) => {\n middlewares.push({\n name: \"cors-preflight\",\n path: \"/\",\n middleware: (\n req: { method?: string },\n res: { send?: (body: unknown) => void; end?: (body: string) => void },\n next: () => void\n ) => {\n if (req.method === \"GET\") {\n next();\n } else {\n res.end?.(\"GET, HEAD\");\n }\n },\n });\n devServer.app?.use(\n \"/\",\n (\n request: { headers: { origin?: string } },\n response: { header: (name: string, value: string) => void },\n next: () => void\n ) => {\n response.header(\"Access-Control-Allow-Origin\", request.headers.origin || \"https://dev.manager.trackunit.com\");\n next();\n }\n );\n devServer.app?.use(\n \"/manifestAndToken\",\n async (\n request: { headers: { origin?: string } },\n response: {\n header: (name: string, value: string) => void;\n send: (body: unknown) => void;\n status: (code: number) => void;\n }\n ) => {\n response.header(\"Access-Control-Allow-Origin\", request.headers.origin || \"https://dev.manager.trackunit.com\");\n response.header(\n \"Access-Control-Allow-Headers\",\n \"X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion\"\n );\n try {\n const resp = await fetch(`http://localhost:${port}/manifest.json`);\n const body = await resp.json();\n response.send({ manifest: body });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"ERROR: \", e);\n response.status(500);\n response.send(e);\n }\n }\n );\n devServer.app?.use(\n \"/extensionloader.js\",\n async (\n request: { headers: { origin?: string } },\n response: {\n header: (name: string, value: string) => void;\n send: (body: unknown) => void;\n status: (code: number) => void;\n }\n ) => {\n response.header(\"Access-Control-Allow-Origin\", request.headers.origin || \"https://dev.manager.trackunit.com\");\n response.header(\n \"Access-Control-Allow-Headers\",\n \"X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion\"\n );\n try {\n // To test extensionloader locally build the iris-app-loader and flip these 2 lines.\n // const resp = await fetch(\"http://localhost:3000/extensionloader.js\");\n const resp = await fetch(\"https://iris.trackunit.app/extensionloader.js\");\n const body = await resp.text();\n response.send(body);\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"ERROR: \", e);\n response.status(500);\n response.send(e);\n }\n }\n );\n return middlewares;\n },\n});\n\n/**\n * Generates a dev server configuration for webpack configuration.\n *\n * @param webpackDevServerConfiguration The configuration to extend.\n * @returns {WebpackDevServerConfiguration} The dev server for webpack.\n */\nexport const getIrisAppWebpackDevServer = async (\n webpackDevServerConfiguration: WebpackDevServerConfiguration = {}\n): Promise<WebpackDevServerConfiguration> => {\n const port = await getAvailablePort(22220, 22229);\n const baseConfig = await createIrisAppDevServerConfig(port);\n\n // Type assertion required: webpack-dev-server and rspack have nominally different but\n // structurally identical DevServer types. This is a known limitation acknowledged by\n // the rspack team. See: https://github.com/web-infra-dev/rspack/blob/main/packages/rspack-dev-server/src/server.ts\n // eslint-disable-next-line local-rules/no-typescript-assertion\n return { ...baseConfig, ...webpackDevServerConfiguration } as unknown as WebpackDevServerConfiguration;\n};\n\n/**\n * Generates a dev server configuration for rspack configuration.\n *\n * @param rspackDevServerConfiguration The configuration to extend.\n * @returns {RspackDevServer} The dev server for rspack.\n */\nexport const getIrisAppRspackDevServer = async (\n rspackDevServerConfiguration: RspackDevServer = {}\n): Promise<RspackDevServer> => {\n const port = await getAvailablePort(22220, 22229);\n const baseConfig = await createIrisAppDevServerConfig(port);\n\n // Type assertion required: webpack-dev-server and rspack have nominally different but\n // structurally identical DevServer types. This is a known limitation acknowledged by\n // the rspack team. See: https://github.com/web-infra-dev/rspack/blob/main/packages/rspack-dev-server/src/server.ts\n // eslint-disable-next-line local-rules/no-typescript-assertion\n return { ...baseConfig, ...rspackDevServerConfiguration } as unknown as RspackDevServer;\n};\n"]}
package/src/index.d.ts CHANGED
@@ -2,6 +2,6 @@ export * from "./enableTsConfigPath";
2
2
  export * from "./getAliasesFromTsConfig";
3
3
  export * from "./getExposedExtensions";
4
4
  export * from "./getGraphqlCodeGenConfig";
5
- export * from "./getIrisAppWebpackDevServer";
5
+ export * from "./getIrisAppDevServer";
6
6
  export * from "./getSharedDependencies";
7
7
  export * from "./getTailwindContentForApp";
package/src/index.js CHANGED
@@ -5,7 +5,7 @@ tslib_1.__exportStar(require("./enableTsConfigPath"), exports);
5
5
  tslib_1.__exportStar(require("./getAliasesFromTsConfig"), exports);
6
6
  tslib_1.__exportStar(require("./getExposedExtensions"), exports);
7
7
  tslib_1.__exportStar(require("./getGraphqlCodeGenConfig"), exports);
8
- tslib_1.__exportStar(require("./getIrisAppWebpackDevServer"), exports);
8
+ tslib_1.__exportStar(require("./getIrisAppDevServer"), exports);
9
9
  tslib_1.__exportStar(require("./getSharedDependencies"), exports);
10
10
  tslib_1.__exportStar(require("./getTailwindContentForApp"), exports);
11
11
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app-build-utilities/src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,mEAAyC;AACzC,iEAAuC;AACvC,oEAA0C;AAC1C,uEAA6C;AAC7C,kEAAwC;AACxC,qEAA2C","sourcesContent":["export * from \"./enableTsConfigPath\";\nexport * from \"./getAliasesFromTsConfig\";\nexport * from \"./getExposedExtensions\";\nexport * from \"./getGraphqlCodeGenConfig\";\nexport * from \"./getIrisAppWebpackDevServer\";\nexport * from \"./getSharedDependencies\";\nexport * from \"./getTailwindContentForApp\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app-build-utilities/src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,mEAAyC;AACzC,iEAAuC;AACvC,oEAA0C;AAC1C,gEAAsC;AACtC,kEAAwC;AACxC,qEAA2C","sourcesContent":["export * from \"./enableTsConfigPath\";\nexport * from \"./getAliasesFromTsConfig\";\nexport * from \"./getExposedExtensions\";\nexport * from \"./getGraphqlCodeGenConfig\";\nexport * from \"./getIrisAppDevServer\";\nexport * from \"./getSharedDependencies\";\nexport * from \"./getTailwindContentForApp\";\n"]}
@@ -1,8 +0,0 @@
1
- import { Configuration } from "webpack-dev-server";
2
- /**
3
- * Generates a dev server configuration for webpack configuration.
4
- *
5
- * @param webpackDevServerConfiguration The configuration to extend.
6
- * @returns {Configuration} The dev server for tiles.
7
- */
8
- export declare const getIrisAppWebpackDevServer: (webpackDevServerConfiguration?: Configuration) => Promise<Configuration>;
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getIrisAppWebpackDevServer = void 0;
4
- const getAvailablePort_1 = require("./getAvailablePort");
5
- /**
6
- * Generates a dev server configuration for webpack configuration.
7
- *
8
- * @param webpackDevServerConfiguration The configuration to extend.
9
- * @returns {Configuration} The dev server for tiles.
10
- */
11
- const getIrisAppWebpackDevServer = async (webpackDevServerConfiguration = {}) => {
12
- const port = await (0, getAvailablePort_1.getAvailablePort)(22220, 22229);
13
- return {
14
- port,
15
- historyApiFallback: true,
16
- headers: {
17
- "Access-Control-Allow-Credentials": "true",
18
- "Access-Control-Max-Age": "3600",
19
- "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
20
- "Access-Control-Allow-Headers": "X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion",
21
- },
22
- onListening: (server) => { },
23
- setupMiddlewares: (middlewares, devServer) => {
24
- middlewares.push({
25
- name: "cors-preflight",
26
- path: "/",
27
- middleware: (req, res, next) => {
28
- if (req.method === "GET") {
29
- next();
30
- }
31
- else {
32
- res.send("GET, HEAD");
33
- }
34
- },
35
- });
36
- devServer.app?.use("/", (request, response, next) => {
37
- response.header("Access-Control-Allow-Origin", request.headers.origin || "https://dev.manager.trackunit.com");
38
- next();
39
- });
40
- devServer.app?.use("/manifestAndToken", async (request, response, next) => {
41
- response.header("Access-Control-Allow-Origin", request.headers.origin || "https://dev.manager.trackunit.com");
42
- response.header("Access-Control-Allow-Headers", "X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion");
43
- try {
44
- const resp = await fetch(`http://localhost:${port}/manifest.json`);
45
- const body = await resp.json();
46
- response.send({ manifest: body });
47
- }
48
- catch (e) {
49
- // eslint-disable-next-line no-console
50
- console.error("ERROR: ", e);
51
- response.status(500);
52
- response.send(e);
53
- }
54
- });
55
- devServer.app?.use("/extensionloader.js", async (request, response, next) => {
56
- response.header("Access-Control-Allow-Origin", request.headers.origin || "https://dev.manager.trackunit.com");
57
- response.header("Access-Control-Allow-Headers", "X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion");
58
- try {
59
- // To test extensionloader locally build the iris-app-loader and flip these 2 lines.
60
- // const resp = await fetch("http://localhost:3000/extensionloader.js");
61
- const resp = await fetch("https://iris.trackunit.app/extensionloader.js");
62
- const body = await resp.text();
63
- response.send(body);
64
- }
65
- catch (e) {
66
- // eslint-disable-next-line no-console
67
- console.error("ERROR: ", e);
68
- response.status(500);
69
- response.send(e);
70
- }
71
- });
72
- return middlewares;
73
- },
74
- ...webpackDevServerConfiguration,
75
- };
76
- };
77
- exports.getIrisAppWebpackDevServer = getIrisAppWebpackDevServer;
78
- //# sourceMappingURL=getIrisAppWebpackDevServer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getIrisAppWebpackDevServer.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app-build-utilities/src/getIrisAppWebpackDevServer.ts"],"names":[],"mappings":";;;AACA,yDAAsD;AAEtD;;;;;GAKG;AACI,MAAM,0BAA0B,GAAG,KAAK,EAC7C,gCAA+C,EAAE,EACzB,EAAE;IAC1B,MAAM,IAAI,GAAG,MAAM,IAAA,mCAAgB,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAClD,OAAO;QACL,IAAI;QACJ,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE;YACP,kCAAkC,EAAE,MAAM;YAC1C,wBAAwB,EAAE,MAAM;YAChC,8BAA8B,EAAE,iCAAiC;YACjE,8BAA8B,EAC5B,wHAAwH;SAC3H;QACD,WAAW,EAAE,CAAC,MAAc,EAAE,EAAE,GAAE,CAAC;QACnC,gBAAgB,EAAE,CAAC,WAA8B,EAAE,SAAiB,EAAE,EAAE;YACtE,WAAW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5B,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBACrB,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC,CAAC,CAAC;YACH,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,qBAAqB,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;gBAC1E,QAAQ,CAAC,MAAM,CAAC,6BAA6B,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,mCAAmC,CAAC,CAAC;gBAC9G,QAAQ,CAAC,MAAM,CACb,8BAA8B,EAC9B,wHAAwH,CACzH,CAAC;gBACF,IAAI,CAAC;oBACH,oFAAoF;oBACpF,wEAAwE;oBACxE,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,+CAA+C,CAAC,CAAC;oBAC1E,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;oBAC/B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACtB,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,sCAAsC;oBACtC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;oBAC5B,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBACrB,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC,CAAC,CAAC;YACH,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,GAAG,6BAA6B;KACjC,CAAC;AACJ,CAAC,CAAC;AAvEW,QAAA,0BAA0B,8BAuErC","sourcesContent":["import Server, { Configuration, Middleware, Request, Response } from \"webpack-dev-server\";\nimport { getAvailablePort } from \"./getAvailablePort\";\n\n/**\n * Generates a dev server configuration for webpack configuration.\n *\n * @param webpackDevServerConfiguration The configuration to extend.\n * @returns {Configuration} The dev server for tiles.\n */\nexport const getIrisAppWebpackDevServer = async (\n webpackDevServerConfiguration: Configuration = {}\n): Promise<Configuration> => {\n const port = await getAvailablePort(22220, 22229);\n return {\n port,\n historyApiFallback: true,\n headers: {\n \"Access-Control-Allow-Credentials\": \"true\",\n \"Access-Control-Max-Age\": \"3600\",\n \"Access-Control-Allow-Methods\": \"GET, POST, PUT, DELETE, OPTIONS\",\n \"Access-Control-Allow-Headers\":\n \"X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion\",\n },\n onListening: (server: Server) => {},\n setupMiddlewares: (middlewares: Array<Middleware>, devServer: Server) => {\n middlewares.push({\n name: \"cors-preflight\",\n path: \"/\",\n middleware: (req: Request, res: Response, next: () => void) => {\n if (req.method === \"GET\") {\n next();\n } else {\n res.send(\"GET, HEAD\");\n }\n },\n });\n devServer.app?.use(\"/\", (request, response, next) => {\n response.header(\"Access-Control-Allow-Origin\", request.headers.origin || \"https://dev.manager.trackunit.com\");\n next();\n });\n devServer.app?.use(\"/manifestAndToken\", async (request, response, next) => {\n response.header(\"Access-Control-Allow-Origin\", request.headers.origin || \"https://dev.manager.trackunit.com\");\n response.header(\n \"Access-Control-Allow-Headers\",\n \"X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion\"\n );\n try {\n const resp = await fetch(`http://localhost:${port}/manifest.json`);\n const body = await resp.json();\n response.send({ manifest: body });\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"ERROR: \", e);\n response.status(500);\n response.send(e);\n }\n });\n devServer.app?.use(\"/extensionloader.js\", async (request, response, next) => {\n response.header(\"Access-Control-Allow-Origin\", request.headers.origin || \"https://dev.manager.trackunit.com\");\n response.header(\n \"Access-Control-Allow-Headers\",\n \"X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion\"\n );\n try {\n // To test extensionloader locally build the iris-app-loader and flip these 2 lines.\n // const resp = await fetch(\"http://localhost:3000/extensionloader.js\");\n const resp = await fetch(\"https://iris.trackunit.app/extensionloader.js\");\n const body = await resp.text();\n response.send(body);\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"ERROR: \", e);\n response.status(500);\n response.send(e);\n }\n });\n return middlewares;\n },\n ...webpackDevServerConfiguration,\n };\n};\n"]}