@trackunit/iris-app-build-utilities 0.0.117 → 0.0.120

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
@@ -2,6 +2,15 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.0.120](https://github.com/Trackunit/manager/compare/iris-app-build-utilities/0.0.119...iris-app-build-utilities/0.0.120) (2023-04-26)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `css-components` updated to version `0.0.316`
10
+ ## [0.0.119](https://github.com/Trackunit/manager/compare/iris-app-build-utilities/0.0.118...iris-app-build-utilities/0.0.119) (2023-04-25)
11
+
12
+ ## [0.0.118](https://github.com/Trackunit/manager/compare/iris-app-build-utilities/0.0.117...iris-app-build-utilities/0.0.118) (2023-04-24)
13
+
5
14
  ## [0.0.117](https://github.com/Trackunit/manager/compare/iris-app-build-utilities/0.0.116...iris-app-build-utilities/0.0.117) (2023-04-20)
6
15
 
7
16
  ### Dependency Updates
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-build-utilities",
3
- "version": "0.0.117",
3
+ "version": "0.0.120",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "repository": "https://github.com/Trackunit/manager",
6
6
  "dependencies": {
7
7
  "@react-google-maps/api": "2.17.1",
8
8
  "@react-spring/web": "9.6.0",
9
9
  "csstype": "3.1.1",
10
- "get-port": "5.1.1",
11
10
  "i18next": "21.10.0",
12
11
  "jest-canvas-mock": "2.4.0",
13
12
  "moment-timezone": "0.5.39",
@@ -23,21 +22,14 @@
23
22
  "@floating-ui/react": "0.22.2",
24
23
  "@heroicons/react": "2.0.16",
25
24
  "@sentry/browser": "7.24.2",
26
- "@trackunit/css-component-tokens": "0.0.24",
27
- "@trackunit/css-components": "0.0.315",
28
- "@trackunit/css-core": "0.0.80",
25
+ "@trackunit/css-components": "0.0.316",
26
+ "@trackunit/css-core": "0.0.81",
29
27
  "@trackunit/css-tailwind-custom-properties-plugin": "0.0.16",
30
28
  "@trackunit/i18n-library-translation": "0.0.41",
31
29
  "@trackunit/iris-app-api": "0.0.88",
32
- "@trackunit/iris-app-runtime-core": "0.3.28",
33
- "@trackunit/iris-app-runtime-core-api": "0.3.25",
34
- "@trackunit/react-components": "0.1.80",
35
30
  "@trackunit/react-core-contexts-api": "0.2.24",
36
- "@trackunit/react-core-contexts-test": "0.1.45",
37
- "@trackunit/react-core-hooks": "0.2.41",
38
31
  "@trackunit/tailwind-styled-components": "0.0.55",
39
32
  "@trackunit/ui-design-tokens": "0.0.66",
40
- "@trackunit/ui-icons": "0.0.63",
41
33
  "camelcase": "5.3.1",
42
34
  "capitalize": "2.0.4",
43
35
  "date-fns": "2.29.3",
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Gets the first available port in the specified range.
3
+ *
4
+ * @param minPort min port number inclusive
5
+ * @param maxPort max port number inclusive
6
+ * @returns {number} the first available port in the range
7
+ */
8
+ export declare const getAvailablePort: (minPort: number, maxPort: number) => Promise<number>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAvailablePort = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const net = tslib_1.__importStar(require("net"));
6
+ const findPort = (port) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
7
+ return new Promise(resolve => {
8
+ const server = net.createServer();
9
+ server.once("error", (err) => {
10
+ if (err.code === "EADDRINUSE") {
11
+ resolve(false);
12
+ }
13
+ else {
14
+ resolve(true);
15
+ }
16
+ });
17
+ server.once("listening", () => {
18
+ server.close(() => {
19
+ resolve(true);
20
+ });
21
+ });
22
+ server.listen(port);
23
+ });
24
+ });
25
+ /**
26
+ * Gets the first available port in the specified range.
27
+ *
28
+ * @param minPort min port number inclusive
29
+ * @param maxPort max port number inclusive
30
+ * @returns {number} the first available port in the range
31
+ */
32
+ const getAvailablePort = (minPort, maxPort) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
33
+ if (minPort < 1 || maxPort > 65535 || minPort > maxPort) {
34
+ throw new Error("Invalid port range.");
35
+ }
36
+ for (let port = minPort; port <= maxPort; port++) {
37
+ const isAvailable = yield findPort(port);
38
+ if (isAvailable) {
39
+ return port;
40
+ }
41
+ }
42
+ throw new Error("No available ports in the specified range.");
43
+ });
44
+ exports.getAvailablePort = getAvailablePort;
45
+ //# sourceMappingURL=getAvailablePort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAvailablePort.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app-build-utilities/src/getAvailablePort.ts"],"names":[],"mappings":";;;;AAAA,iDAA2B;AAE3B,MAAM,QAAQ,GAAG,CAAO,IAAY,EAAoB,EAAE;IACxD,OAAO,IAAI,OAAO,CAAU,OAAO,CAAC,EAAE;QACpC,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC;QAElC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAqB,EAAE,EAAE;YAC7C,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,EAAE;gBAC7B,OAAO,CAAC,KAAK,CAAC,CAAC;aAChB;iBAAM;gBACL,OAAO,CAAC,IAAI,CAAC,CAAC;aACf;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE;YAC5B,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;gBAChB,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF;;;;;;GAMG;AACI,MAAM,gBAAgB,GAAG,CAAO,OAAe,EAAE,OAAe,EAAmB,EAAE;IAC1F,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,KAAK,IAAI,OAAO,GAAG,OAAO,EAAE;QACvD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;KACxC;IAED,KAAK,IAAI,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,IAAI,EAAE,EAAE;QAChD,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,WAAW,EAAE;YACf,OAAO,IAAI,CAAC;SACb;KACF;IAED,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;AAChE,CAAC,CAAA,CAAC;AAbW,QAAA,gBAAgB,oBAa3B","sourcesContent":["import * as net from \"net\";\n\nconst findPort = async (port: number): Promise<boolean> => {\n return new Promise<boolean>(resolve => {\n const server = net.createServer();\n\n server.once(\"error\", (err: { code: string }) => {\n if (err.code === \"EADDRINUSE\") {\n resolve(false);\n } else {\n resolve(true);\n }\n });\n\n server.once(\"listening\", () => {\n server.close(() => {\n resolve(true);\n });\n });\n\n server.listen(port);\n });\n};\n\n/**\n * Gets the first available port in the specified range.\n *\n * @param minPort min port number inclusive\n * @param maxPort max port number inclusive\n * @returns {number} the first available port in the range\n */\nexport const getAvailablePort = async (minPort: number, maxPort: number): Promise<number> => {\n if (minPort < 1 || maxPort > 65535 || minPort > maxPort) {\n throw new Error(\"Invalid port range.\");\n }\n\n for (let port = minPort; port <= maxPort; port++) {\n const isAvailable = await findPort(port);\n if (isAvailable) {\n return port;\n }\n }\n\n throw new Error(\"No available ports in the specified range.\");\n};\n"]}
@@ -19,8 +19,12 @@ const getTailwindContentForApp = (options) => {
19
19
  }
20
20
  return [
21
21
  ...(0, tailwind_1.createGlobPatternsForDependencies)(options.appDir, "/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}"),
22
- nxRootDir + "/node_modules/@trackunit/react-components/index.{js,css}",
23
- nxRootDir + "/node_modules/@trackunit/custom-field-components/index.{js,css}",
22
+ nxRootDir + "/node_modules/@trackunit/react-components/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}",
23
+ nxRootDir + "/node_modules/@trackunit/react-form-components/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}",
24
+ nxRootDir + "/node_modules/@trackunit/react-filter-components/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}",
25
+ nxRootDir + "/node_modules/@trackunit/react-table/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}",
26
+ nxRootDir + "/node_modules/@trackunit/base-map/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}",
27
+ nxRootDir + "/node_modules/@trackunit/tu-map/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}",
24
28
  ];
25
29
  };
26
30
  exports.getTailwindContentForApp = getTailwindContentForApp;
@@ -1 +1 @@
1
- {"version":3,"file":"getTailwindContentForApp.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app-build-utilities/src/getTailwindContentForApp.ts"],"names":[],"mappings":";;;;AAAA,mDAAyE;AACzE,2BAAgC;AAChC,mDAA6B;AAC7B,+BAA4B;AA2B5B;;;;;GAKG;AACI,MAAM,wBAAwB,GAAG,CAAC,OAAgC,EAAY,EAAE;IACrF,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE9E,IAAI,CAAC,IAAA,eAAU,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE;QAC3C,MAAM,IAAI,KAAK,CACb,yIAAyI,CAC1I,CAAC;KACH;IACD,OAAO;QACL,GAAG,IAAA,4CAAiC,EAAC,OAAO,CAAC,MAAM,EAAE,8CAA8C,CAAC;QACpG,SAAS,GAAG,0DAA0D;QACtE,SAAS,GAAG,iEAAiE;KAC9E,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,wBAAwB,4BAanC;AAEF;;;;;GAKG;AACI,MAAM,0BAA0B,GAAG,CAAC,OAAwC,EAAU,EAAE;IAC7F,8DAA8D;IAC9D,MAAM,YAAY,GAAG,OAAO,CAAC,oDAAoD,CAAC,CAAC;IACnF,OAAO;QACL,OAAO,EAAE,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,EAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC;QACtE,OAAO,EAAE,IAAA,gCAAwB,EAAC,OAAO,CAAC;QAC1C,OAAO,EAAE,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;KAChD,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,0BAA0B,8BAQrC","sourcesContent":["import { createGlobPatternsForDependencies } from \"@nrwl/react/tailwind\";\nimport { existsSync } from \"fs\";\nimport * as path from \"path\";\nimport { join } from \"path\";\nimport { Config } from \"tailwindcss\";\n\nexport interface ITailwindContentOptions {\n /*\n * Root of the nx repo.\n */\n nxRootDir?: string;\n\n /**\n * The name of the folder in the nx repo this iris app is in.\n */\n appDir: string;\n}\n\nexport interface ITrackunitTailwindConfigOptions {\n /*\n * Root of the nx repo.\n */\n nxRootDir?: string;\n\n /**\n * The name of the folder in the nx repo this iris app is in.\n */\n appDir: string;\n}\n\n/**\n * Generates a list of exposed extensions from a manifest.\n *\n * @param options {ITailwindContentOptions} The options include necessary information to get the dependencies.\n * @returns {string[]} Exposes object for module federation. The list of files to include in the tailwind content.\n */\nexport const getTailwindContentForApp = (options: ITailwindContentOptions): string[] => {\n const nxRootDir = options.nxRootDir || path.resolve(options.appDir, \"../../\");\n\n if (!existsSync(join(nxRootDir, \"nx.json\"))) {\n throw new Error(\n \"nx.json not found. Are you sure this is an nx repo, if you have more then 2 levels of nesting you need to pass in the nxRootDir option.\"\n );\n }\n return [\n ...createGlobPatternsForDependencies(options.appDir, \"/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}\"),\n nxRootDir + \"/node_modules/@trackunit/react-components/index.{js,css}\",\n nxRootDir + \"/node_modules/@trackunit/custom-field-components/index.{js,css}\",\n ];\n};\n\n/**\n * Generates a trackunit tailwind config for use with iris apps.\n *\n * @param options {ITrackunitTailwindConfigOptions} The options include necessary information to get the dependencies.\n * @returns {Config} Tailwind config for the app.\n */\nexport const getTrackunitTailwindConfig = (options: ITrackunitTailwindConfigOptions): Config => {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const tailwindBase = require(\"@trackunit/css-tailwind/tailwind-base.generated.js\");\n return {\n presets: [tailwindBase?.default ? tailwindBase.default : tailwindBase],\n content: getTailwindContentForApp(options),\n plugins: [require(\"@trackunit/css-components\")],\n };\n};\n"]}
1
+ {"version":3,"file":"getTailwindContentForApp.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app-build-utilities/src/getTailwindContentForApp.ts"],"names":[],"mappings":";;;;AAAA,mDAAyE;AACzE,2BAAgC;AAChC,mDAA6B;AAC7B,+BAA4B;AA2B5B;;;;;GAKG;AACI,MAAM,wBAAwB,GAAG,CAAC,OAAgC,EAAY,EAAE;IACrF,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE9E,IAAI,CAAC,IAAA,eAAU,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE;QAC3C,MAAM,IAAI,KAAK,CACb,yIAAyI,CAC1I,CAAC;KACH;IACD,OAAO;QACL,GAAG,IAAA,4CAAiC,EAAC,OAAO,CAAC,MAAM,EAAE,8CAA8C,CAAC;QACpG,SAAS,GAAG,uFAAuF;QACnG,SAAS,GAAG,4FAA4F;QACxG,SAAS,GAAG,8FAA8F;QAC1G,SAAS,GAAG,kFAAkF;QAC9F,SAAS,GAAG,+EAA+E;QAC3F,SAAS,GAAG,6EAA6E;KAC1F,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,wBAAwB,4BAiBnC;AAEF;;;;;GAKG;AACI,MAAM,0BAA0B,GAAG,CAAC,OAAwC,EAAU,EAAE;IAC7F,8DAA8D;IAC9D,MAAM,YAAY,GAAG,OAAO,CAAC,oDAAoD,CAAC,CAAC;IACnF,OAAO;QACL,OAAO,EAAE,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,EAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC;QACtE,OAAO,EAAE,IAAA,gCAAwB,EAAC,OAAO,CAAC;QAC1C,OAAO,EAAE,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;KAChD,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,0BAA0B,8BAQrC","sourcesContent":["import { createGlobPatternsForDependencies } from \"@nrwl/react/tailwind\";\nimport { existsSync } from \"fs\";\nimport * as path from \"path\";\nimport { join } from \"path\";\nimport { Config } from \"tailwindcss\";\n\nexport interface ITailwindContentOptions {\n /*\n * Root of the nx repo.\n */\n nxRootDir?: string;\n\n /**\n * The name of the folder in the nx repo this iris app is in.\n */\n appDir: string;\n}\n\nexport interface ITrackunitTailwindConfigOptions {\n /*\n * Root of the nx repo.\n */\n nxRootDir?: string;\n\n /**\n * The name of the folder in the nx repo this iris app is in.\n */\n appDir: string;\n}\n\n/**\n * Generates a list of exposed extensions from a manifest.\n *\n * @param options {ITailwindContentOptions} The options include necessary information to get the dependencies.\n * @returns {string[]} Exposes object for module federation. The list of files to include in the tailwind content.\n */\nexport const getTailwindContentForApp = (options: ITailwindContentOptions): string[] => {\n const nxRootDir = options.nxRootDir || path.resolve(options.appDir, \"../../\");\n\n if (!existsSync(join(nxRootDir, \"nx.json\"))) {\n throw new Error(\n \"nx.json not found. Are you sure this is an nx repo, if you have more then 2 levels of nesting you need to pass in the nxRootDir option.\"\n );\n }\n return [\n ...createGlobPatternsForDependencies(options.appDir, \"/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}\"),\n nxRootDir + \"/node_modules/@trackunit/react-components/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}\",\n nxRootDir + \"/node_modules/@trackunit/react-form-components/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}\",\n nxRootDir + \"/node_modules/@trackunit/react-filter-components/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}\",\n nxRootDir + \"/node_modules/@trackunit/react-table/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}\",\n nxRootDir + \"/node_modules/@trackunit/base-map/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}\",\n nxRootDir + \"/node_modules/@trackunit/tu-map/**/!(*.stories|*.spec).{tsx,jsx,ts,js,html}\",\n ];\n};\n\n/**\n * Generates a trackunit tailwind config for use with iris apps.\n *\n * @param options {ITrackunitTailwindConfigOptions} The options include necessary information to get the dependencies.\n * @returns {Config} Tailwind config for the app.\n */\nexport const getTrackunitTailwindConfig = (options: ITrackunitTailwindConfigOptions): Config => {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const tailwindBase = require(\"@trackunit/css-tailwind/tailwind-base.generated.js\");\n return {\n presets: [tailwindBase?.default ? tailwindBase.default : tailwindBase],\n content: getTailwindContentForApp(options),\n plugins: [require(\"@trackunit/css-components\")],\n };\n};\n"]}
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTileWebpackDevServer = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const getPort = require("get-port");
6
5
  const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
6
+ const getAvailablePort_1 = require("./getAvailablePort");
7
7
  /**
8
8
  * Generates a dev server configuration for webpack configuration.
9
9
  *
@@ -11,7 +11,7 @@ const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
11
11
  * @returns {Configuration} The dev server for tiles.
12
12
  */
13
13
  const getTileWebpackDevServer = (webpackDevServerConfiguration = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
14
- const port = yield getPort({ port: [22220, 22221, 22222, 22223, 22224, 22225, 22226, 22227, 22228, 22229] });
14
+ const port = yield (0, getAvailablePort_1.getAvailablePort)(22220, 22229);
15
15
  return Object.assign({ port, historyApiFallback: true, headers: {
16
16
  "Access-Control-Allow-Credentials": "true",
17
17
  "Access-Control-Max-Age": "3600",
@@ -1 +1 @@
1
- {"version":3,"file":"getTileWebpackDevServer.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app-build-utilities/src/getTileWebpackDevServer.ts"],"names":[],"mappings":";;;;AAAA,oCAAqC;AACrC,oEAA+B;AAG/B;;;;;GAKG;AACI,MAAM,uBAAuB,GAAG,CACrC,gCAA+C,EAAE,EACzB,EAAE;IAC1B,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;IAC7G,uBACE,IAAI,EACJ,kBAAkB,EAAE,IAAI,EACxB,OAAO,EAAE;YACP,kCAAkC,EAAE,MAAM;YAC1C,wBAAwB,EAAE,MAAM;YAChC,8BAA8B,EAAE,iCAAiC;YACjE,8BAA8B,EAC5B,yGAAyG;SAC5G,EACD,IAAI,EAAE;YACJ,MAAM,EAAE,CAAC,iEAAiE,CAAC;SAC5E,EACD,WAAW,EAAE,CAAC,MAAc,EAAE,EAAE,GAAE,CAAC,EACnC,gBAAgB,EAAE,CAAC,WAAyB,EAAE,SAAiB,EAAE,EAAE;;YACjE,WAAW,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,GAAG;gBACT,UAAU,EAAE,CAAC,GAAY,EAAE,GAAa,EAAE,IAAgB,EAAE,EAAE;oBAC5D,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,EAAE;wBACxB,IAAI,EAAE,CAAC;qBACR;yBAAM;wBACL,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;qBACvB;gBACH,CAAC;aACF,CAAC,CAAC;YACH,MAAA,SAAS,CAAC,GAAG,0CAAE,GAAG,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;gBAClD,QAAQ,CAAC,MAAM,CAAC,6BAA6B,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,mCAAmC,CAAC,CAAC;gBAC9G,IAAI,EAAE,CAAC;YACT,CAAC,CAAC,CAAC;YACH,MAAA,SAAS,CAAC,GAAG,0CAAE,GAAG,CAAC,mBAAmB,EAAE,CAAO,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;gBACxE,QAAQ,CAAC,MAAM,CAAC,6BAA6B,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,mCAAmC,CAAC,CAAC;gBAC9G,QAAQ,CAAC,MAAM,CACb,8BAA8B,EAC9B,yGAAyG,CAC1G,CAAC;gBACF,IAAI;oBACF,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAK,EAAC,oBAAoB,IAAI,gBAAgB,CAAC,CAAC;oBACnE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;oBAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;iBACnC;gBAAC,OAAO,CAAC,EAAE;oBACV,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;iBAClB;YACH,CAAC,CAAA,CAAC,CAAC;YACH,OAAO,WAAW,CAAC;QACrB,CAAC,IACE,6BAA6B,EAChC;AACJ,CAAC,CAAA,CAAC;AAtDW,QAAA,uBAAuB,2BAsDlC","sourcesContent":["import getPort = require(\"get-port\");\nimport fetch from \"node-fetch\";\nimport Server, { Configuration, Middleware, Request, Response } from \"webpack-dev-server\";\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 getTileWebpackDevServer = async (\n webpackDevServerConfiguration: Configuration = {}\n): Promise<Configuration> => {\n const port = await getPort({ port: [22220, 22221, 22222, 22223, 22224, 22225, 22226, 22227, 22228, 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, x-trackunitappversion\",\n },\n open: {\n target: [\"https://dev.manager.trackunit.com/iris-sdk-portal/main#runLocal\"],\n },\n onListening: (server: Server) => {},\n setupMiddlewares: (middlewares: 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, 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 console.error(\"ERROR: \", e);\n response.status(500);\n response.send(e);\n }\n });\n return middlewares;\n },\n ...webpackDevServerConfiguration,\n };\n};\n"]}
1
+ {"version":3,"file":"getTileWebpackDevServer.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app-build-utilities/src/getTileWebpackDevServer.ts"],"names":[],"mappings":";;;;AAAA,oEAA+B;AAE/B,yDAAsD;AAEtD;;;;;GAKG;AACI,MAAM,uBAAuB,GAAG,CACrC,gCAA+C,EAAE,EACzB,EAAE;IAC1B,MAAM,IAAI,GAAG,MAAM,IAAA,mCAAgB,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAClD,uBACE,IAAI,EACJ,kBAAkB,EAAE,IAAI,EACxB,OAAO,EAAE;YACP,kCAAkC,EAAE,MAAM;YAC1C,wBAAwB,EAAE,MAAM;YAChC,8BAA8B,EAAE,iCAAiC;YACjE,8BAA8B,EAC5B,yGAAyG;SAC5G,EACD,IAAI,EAAE;YACJ,MAAM,EAAE,CAAC,iEAAiE,CAAC;SAC5E,EACD,WAAW,EAAE,CAAC,MAAc,EAAE,EAAE,GAAE,CAAC,EACnC,gBAAgB,EAAE,CAAC,WAAyB,EAAE,SAAiB,EAAE,EAAE;;YACjE,WAAW,CAAC,IAAI,CAAC;gBACf,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,GAAG;gBACT,UAAU,EAAE,CAAC,GAAY,EAAE,GAAa,EAAE,IAAgB,EAAE,EAAE;oBAC5D,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,EAAE;wBACxB,IAAI,EAAE,CAAC;qBACR;yBAAM;wBACL,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;qBACvB;gBACH,CAAC;aACF,CAAC,CAAC;YACH,MAAA,SAAS,CAAC,GAAG,0CAAE,GAAG,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;gBAClD,QAAQ,CAAC,MAAM,CAAC,6BAA6B,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,mCAAmC,CAAC,CAAC;gBAC9G,IAAI,EAAE,CAAC;YACT,CAAC,CAAC,CAAC;YACH,MAAA,SAAS,CAAC,GAAG,0CAAE,GAAG,CAAC,mBAAmB,EAAE,CAAO,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;gBACxE,QAAQ,CAAC,MAAM,CAAC,6BAA6B,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,mCAAmC,CAAC,CAAC;gBAC9G,QAAQ,CAAC,MAAM,CACb,8BAA8B,EAC9B,yGAAyG,CAC1G,CAAC;gBACF,IAAI;oBACF,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAK,EAAC,oBAAoB,IAAI,gBAAgB,CAAC,CAAC;oBACnE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;oBAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;iBACnC;gBAAC,OAAO,CAAC,EAAE;oBACV,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;iBAClB;YACH,CAAC,CAAA,CAAC,CAAC;YACH,OAAO,WAAW,CAAC;QACrB,CAAC,IACE,6BAA6B,EAChC;AACJ,CAAC,CAAA,CAAC;AAtDW,QAAA,uBAAuB,2BAsDlC","sourcesContent":["import fetch from \"node-fetch\";\nimport 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 getTileWebpackDevServer = 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, x-trackunitappversion\",\n },\n open: {\n target: [\"https://dev.manager.trackunit.com/iris-sdk-portal/main#runLocal\"],\n },\n onListening: (server: Server) => {},\n setupMiddlewares: (middlewares: 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, 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 console.error(\"ERROR: \", e);\n response.status(500);\n response.send(e);\n }\n });\n return middlewares;\n },\n ...webpackDevServerConfiguration,\n };\n};\n"]}