@trackunit/iris-app-sdk-vite 0.0.10 → 0.0.14

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,33 @@
1
+ ## 0.0.14 (2026-02-26)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - disable TypeScript declaration generation in Vite plugin configuration ([39c16ac6b9c](https://github.com/Trackunit/manager/commit/39c16ac6b9c))
6
+
7
+ ### 🧱 Updated Dependencies
8
+
9
+ - Updated iris-app-build-utilities to 1.12.50
10
+ - Updated iris-app-api to 1.14.45
11
+
12
+ ### ❤️ Thank You
13
+
14
+ - Mikkel Thorbjørn Andersen
15
+
16
+ ## 0.0.13 (2026-02-25)
17
+
18
+ This was a version bump only for iris-app-sdk-vite to align it with other projects, there were no code changes.
19
+
20
+ ## 0.0.12 (2026-02-25)
21
+
22
+ This was a version bump only for iris-app-sdk-vite to align it with other projects, there were no code changes.
23
+
24
+ ## 0.0.11 (2026-02-25)
25
+
26
+ ### 🧱 Updated Dependencies
27
+
28
+ - Updated iris-app-build-utilities to 1.12.49
29
+ - Updated iris-app-api to 1.14.44
30
+
1
31
  ## 0.0.10 (2026-02-25)
2
32
 
3
33
  ### 🧱 Updated Dependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-sdk-vite",
3
- "version": "0.0.10",
3
+ "version": "0.0.14",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "repository": "https://github.com/Trackunit/manager",
6
6
  "executors": "./executors.json",
@@ -11,10 +11,17 @@
11
11
  "@nx/devkit": "22.4.4",
12
12
  "rxjs": "7.8.1",
13
13
  "win-ca": "^3.5.1",
14
- "@trackunit/iris-app-build-utilities": "1.12.48",
15
- "@trackunit/iris-app-api": "1.14.43",
14
+ "@trackunit/iris-app-build-utilities": "1.12.50",
15
+ "@trackunit/iris-app-api": "1.14.45",
16
16
  "tslib": "^2.6.2",
17
- "vite": "7.3.1"
17
+ "vite": "7.3.1",
18
+ "@module-federation/vite": "1.11.0",
19
+ "@nx/vite": "22.4.4",
20
+ "vite-plugin-checker": "^0.12.0",
21
+ "vite-plugin-css-injected-by-js": "^3.5.2",
22
+ "rollup-plugin-visualizer": "^5.12.0",
23
+ "@tailwindcss/postcss": "^4.1.18",
24
+ "@vitejs/plugin-react-swc": "^4.2.3"
18
25
  },
19
26
  "types": "./src/index.d.ts",
20
27
  "main": "./src/index.js",
@@ -36,8 +36,9 @@ async function* buildExecutor(options, context) {
36
36
  });
37
37
  // Now we can safely import the manifest (it uses @trackunit/* imports)
38
38
  const IrisAppManifest = (await Promise.resolve(`${manifestPath}`).then(s => tslib_1.__importStar(require(s)))).default;
39
- // Get default config (internally imports @trackunit/iris-app-vite-plugin)
40
- const defaultConfig = await (0, defaultViteConfig_1.getDefaultViteConfig)("production", context.root, projectRootDir, IrisAppManifest, context);
39
+ const defaultConfig = await (0, defaultViteConfig_1.getDefaultViteConfig)("production", context.root, projectRootDir, IrisAppManifest, context, {
40
+ skipTypeChecking: options.skipTypeChecking,
41
+ });
41
42
  // Load optional custom config
42
43
  let finalConfig = defaultConfig;
43
44
  if (options.viteConfig || (0, fs_1.existsSync)((0, path_1.join)(projectRootDir, "vite.config.ts"))) {
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/build/executor.ts"],"names":[],"mappings":";;AA+BA,gCAgGC;;AA9HD,wEAAoE;AACpE,kFAA8F;AAC9F,2BAAwC;AACxC,+BAAqC;AACrC,+BAAkC;AAClC,2DAAqC;AACrC,kBAAgB;AAChB,kEAAkE;AAQlE,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,UAAkB,EAAE,EAAE;IAC3D,MAAM,kBAAkB,GAAG,IAAA,cAAO,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrD,IAAI,kBAAkB,KAAK,IAAI,EAAE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,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;iBACnD,CAAC,CAAC;gBACH,UAAU,CAAC,QAAQ,EAAE,CAAC;YACxB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,sCAAsC;gBACtC,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;gBAC1C,UAAU,CAAC,IAAI,CAAC;oBACd,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE,IAAA,cAAO,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;iBACnD,CAAC,CAAC;gBACH,UAAU,CAAC,QAAQ,EAAE,CAAC;YACxB,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,CAAC,CAAC,IAAI,CACL,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QAC9B,IAAI,OAAO,EAAE,CAAC;YACZ,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,mCAAmC,OAAO,IAAI,CAAC,CAAC;QAC/D,CAAC;aAAM,CAAC;YACN,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACjD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,IAAA,8BAAa,EAAC,UAAU,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import { ExecutorContext } from \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/devkit/src/utils/rxjs-for-await\";\nimport { checkPackageVersion, enableTsConfigPath } from \"@trackunit/iris-app-build-utilities\";\nimport { existsSync, rmSync } from \"fs\";\nimport { join, resolve } from \"path\";\nimport { Observable } from \"rxjs\";\nimport * as op from \"rxjs/operators\";\nimport \"win-ca\";\nimport { getDefaultViteConfig } from \"../utils/defaultViteConfig\";\nimport { BuildExecutorSchema } from \"./schema\";\n\nexport type NodeBuildEvent = {\n outfile: string;\n success: boolean;\n};\n\nconst deleteOutputDir = (root: string, outputPath: string) => {\n const resolvedOutputPath = resolve(root, outputPath);\n if (resolvedOutputPath === root) {\n throw new Error(\"Output path MUST not be project root directory!\");\n }\n rmSync(resolvedOutputPath, { recursive: true, force: true });\n};\n\n/**\n * Build executor for building Iris Apps with Vite.\n *\n * @param {BuildExecutorSchema} options build executor options for this nx executor\n * @param {ExecutorContext} context build executor context for this nx executor\n * @yields {NodeBuildEvent} the build event\n */\nexport default async function* buildExecutor(\n options: BuildExecutorSchema,\n context: ExecutorContext\n): AsyncGenerator<NodeBuildEvent> {\n await checkPackageVersion(false);\n\n // eslint-disable-next-line local-rules/no-typescript-assertion, @typescript-eslint/no-non-null-assertion\n const projectRoot = context.projectsConfigurations.projects[context.projectName!]!.root;\n const projectRootDir = join(context.root, projectRoot);\n const manifestPath = join(context.root, projectRoot, \"iris-app-manifest.ts\");\n\n // ✅ CRITICAL: Register tsconfig paths BEFORE any @trackunit/* imports\n enableTsConfigPath({\n projectRootDir,\n });\n\n // Now we can safely import the manifest (it uses @trackunit/* imports)\n const IrisAppManifest = (await import(manifestPath)).default;\n\n // Get default config (internally imports @trackunit/iris-app-vite-plugin)\n const defaultConfig = await getDefaultViteConfig(\n \"production\",\n context.root,\n projectRootDir,\n IrisAppManifest,\n context\n );\n\n // Load optional custom config\n let finalConfig = defaultConfig;\n if (options.viteConfig || existsSync(join(projectRootDir, \"vite.config.ts\"))) {\n const customConfigFile = await import(options.viteConfig ?? join(projectRootDir, \"vite.config.ts\"));\n let customConfig = customConfigFile.default(defaultConfig);\n const isPromise = customConfig instanceof Promise;\n if (isPromise) {\n customConfig = await customConfig;\n }\n finalConfig = customConfig;\n }\n\n // Set output path\n finalConfig.build = {\n ...finalConfig.build,\n outDir: resolve(context.root, options.outputPath),\n emptyOutDir: true,\n };\n\n // Delete existing output\n deleteOutputDir(context.root, options.outputPath);\n\n if (context.isVerbose) {\n // eslint-disable-next-line no-console\n console.log(\"Using Vite config\", JSON.stringify(finalConfig.plugins, null, 2));\n }\n\n const observable = new Observable<NodeBuildEvent>(subscriber => {\n void (async () => {\n try {\n const { build } = await import(\"vite\");\n\n const buildResult = await build({ ...finalConfig, configFile: false });\n\n // Log build stats if available\n if (context.isVerbose) {\n // eslint-disable-next-line no-console\n console.log(\"Build completed:\", buildResult);\n }\n\n subscriber.next({\n success: true,\n outfile: resolve(context.root, options.outputPath),\n });\n subscriber.complete();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Vite build error:\", error);\n subscriber.next({\n success: false,\n outfile: resolve(context.root, options.outputPath),\n });\n subscriber.complete();\n }\n })();\n }).pipe(\n op.tap(({ success, outfile }) => {\n if (success) {\n // eslint-disable-next-line no-console\n console.info(`\\n ✅ Iris App build completed: ${outfile}\\n`);\n } else {\n // eslint-disable-next-line no-console\n console.error(`\\n ❌ Iris App build failed\\n`);\n }\n })\n );\n\n return yield* eachValueFrom(observable);\n}\n"]}
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/build/executor.ts"],"names":[],"mappings":";;AA+BA,gCAkGC;;AAhID,wEAAoE;AACpE,kFAA8F;AAC9F,2BAAwC;AACxC,+BAAqC;AACrC,+BAAkC;AAClC,2DAAqC;AACrC,kBAAgB;AAChB,kEAAkE;AAQlE,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,UAAkB,EAAE,EAAE;IAC3D,MAAM,kBAAkB,GAAG,IAAA,cAAO,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrD,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,IAAA,WAAM,EAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF;;;;;;GAMG;AACY,KAAK,SAAS,CAAC,CAAC,aAAa,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AAC,CAAC;gBAC1C,UAAU,CAAC,IAAI,CAAC;oBACd,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE,IAAA,cAAO,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;iBACnD,CAAC,CAAC;gBACH,UAAU,CAAC,QAAQ,EAAE,CAAC;YACxB,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;IACP,CAAC,CAAC,CAAC,IAAI,CACL,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QAC9B,IAAI,OAAO,EAAE,CAAC;YACZ,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,mCAAmC,OAAO,IAAI,CAAC,CAAC;QAC/D,CAAC;aAAM,CAAC;YACN,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACjD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,IAAA,8BAAa,EAAC,UAAU,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import { ExecutorContext } from \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/devkit/src/utils/rxjs-for-await\";\nimport { checkPackageVersion, enableTsConfigPath } from \"@trackunit/iris-app-build-utilities\";\nimport { existsSync, rmSync } from \"fs\";\nimport { join, resolve } from \"path\";\nimport { Observable } from \"rxjs\";\nimport * as op from \"rxjs/operators\";\nimport \"win-ca\";\nimport { getDefaultViteConfig } from \"../utils/defaultViteConfig\";\nimport { BuildExecutorSchema } from \"./schema\";\n\nexport type NodeBuildEvent = {\n outfile: string;\n success: boolean;\n};\n\nconst deleteOutputDir = (root: string, outputPath: string) => {\n const resolvedOutputPath = resolve(root, outputPath);\n if (resolvedOutputPath === root) {\n throw new Error(\"Output path MUST not be project root directory!\");\n }\n rmSync(resolvedOutputPath, { recursive: true, force: true });\n};\n\n/**\n * Build executor for building Iris Apps with Vite.\n *\n * @param {BuildExecutorSchema} options build executor options for this nx executor\n * @param {ExecutorContext} context build executor context for this nx executor\n * @yields {NodeBuildEvent} the build event\n */\nexport default async function* buildExecutor(\n options: BuildExecutorSchema,\n context: ExecutorContext\n): AsyncGenerator<NodeBuildEvent> {\n await checkPackageVersion(false);\n\n // eslint-disable-next-line local-rules/no-typescript-assertion, @typescript-eslint/no-non-null-assertion\n const projectRoot = context.projectsConfigurations.projects[context.projectName!]!.root;\n const projectRootDir = join(context.root, projectRoot);\n const manifestPath = join(context.root, projectRoot, \"iris-app-manifest.ts\");\n\n // ✅ CRITICAL: Register tsconfig paths BEFORE any @trackunit/* imports\n enableTsConfigPath({\n projectRootDir,\n });\n\n // Now we can safely import the manifest (it uses @trackunit/* imports)\n const IrisAppManifest = (await import(manifestPath)).default;\n\n const defaultConfig = await getDefaultViteConfig(\n \"production\",\n context.root,\n projectRootDir,\n IrisAppManifest,\n context,\n {\n skipTypeChecking: options.skipTypeChecking,\n }\n );\n\n // Load optional custom config\n let finalConfig = defaultConfig;\n if (options.viteConfig || existsSync(join(projectRootDir, \"vite.config.ts\"))) {\n const customConfigFile = await import(options.viteConfig ?? join(projectRootDir, \"vite.config.ts\"));\n let customConfig = customConfigFile.default(defaultConfig);\n const isPromise = customConfig instanceof Promise;\n if (isPromise) {\n customConfig = await customConfig;\n }\n finalConfig = customConfig;\n }\n\n // Set output path\n finalConfig.build = {\n ...finalConfig.build,\n outDir: resolve(context.root, options.outputPath),\n emptyOutDir: true,\n };\n\n // Delete existing output\n deleteOutputDir(context.root, options.outputPath);\n\n if (context.isVerbose) {\n // eslint-disable-next-line no-console\n console.log(\"Using Vite config\", JSON.stringify(finalConfig.plugins, null, 2));\n }\n\n const observable = new Observable<NodeBuildEvent>(subscriber => {\n void (async () => {\n try {\n const { build } = await import(\"vite\");\n\n const buildResult = await build({ ...finalConfig, configFile: false });\n\n // Log build stats if available\n if (context.isVerbose) {\n // eslint-disable-next-line no-console\n console.log(\"Build completed:\", buildResult);\n }\n\n subscriber.next({\n success: true,\n outfile: resolve(context.root, options.outputPath),\n });\n subscriber.complete();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Vite build error:\", error);\n subscriber.next({\n success: false,\n outfile: resolve(context.root, options.outputPath),\n });\n subscriber.complete();\n }\n })();\n }).pipe(\n op.tap(({ success, outfile }) => {\n if (success) {\n // eslint-disable-next-line no-console\n console.info(`\\n ✅ Iris App build completed: ${outfile}\\n`);\n } else {\n // eslint-disable-next-line no-console\n console.error(`\\n ❌ Iris App build failed\\n`);\n }\n })\n );\n\n return yield* eachValueFrom(observable);\n}\n"]}
@@ -18,8 +18,12 @@
18
18
  "outputPath": {
19
19
  "type": "string",
20
20
  "description": "Output directory for the build"
21
+ },
22
+ "skipTypeChecking": {
23
+ "type": "boolean",
24
+ "description": "Skip TypeScript type checking during the build",
25
+ "default": false
21
26
  }
22
27
  },
23
28
  "required": ["outputPath"]
24
29
  }
25
-
@@ -34,6 +34,7 @@ async function* serveExecutor(options, context) {
34
34
  // Get default config (internally imports @trackunit/iris-app-vite-plugin)
35
35
  const defaultConfig = await (0, defaultViteConfig_1.getDefaultViteConfig)("development", context.root, projectRootDir, IrisAppManifest, context, {
36
36
  serverlessPortMap: serverlessResult.portMap,
37
+ skipTypeChecking: options.skipTypeChecking,
37
38
  });
38
39
  // Load optional custom config
39
40
  let finalConfig = defaultConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/serve/executor.ts"],"names":[],"mappings":";;AAwBA,gCA+GC;;AAtID,wEAAoE;AACpE,kFAI6C;AAC7C,2BAAgC;AAChC,+BAA4B;AAC5B,+BAAkC;AAClC,2DAAqC;AACrC,kBAAgB;AAChB,kEAAkE;AAKlE;;;;;;GAMG;AACY,KAAK,SAAS,CAAC,CAAC,aAAa,CAC1C,OAA4B,EAC5B,OAAwB;IAExB,MAAM,IAAA,8CAAmB,EAAC,KAAK,CAAC,CAAC;IAEjC,yG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AAC,IAAI,IAAI,WAAW,CAAC;oBACzC,MAAM,OAAO,GAAG,UAAU,IAAI,IAAI,IAAI,EAAE,CAAC;oBAEzC,MAAM,CAAC,SAAS,EAAE,CAAC;oBAEnB,UAAU,CAAC,IAAI,CAAC;wBACd,OAAO;wBACP,OAAO,EAAE,IAAI;qBACd,CAAC,CAAC;oBAEH,0DAA0D;gBAC5D,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,sCAAsC;oBACtC,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;oBAC3C,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAC1B,CAAC;YACH,CAAC,CAAC,EAAE,CAAC;YAEL,OAAO,GAAG,EAAE;gBACV,6DAA6D;YAC/D,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC,IAAI,CACL,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;YACrB,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,0CAA0C,OAAO,IAAI,CAAC,CAAC;QACtE,CAAC,CAAC,EACF,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;YAChC,OAAO;YACP,OAAO;SACR,CAAC,CAAC,EACH,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE;YACf,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAC7B,CAAC,CAAC,CACH,CAAC;QAEF,OAAO,KAAK,CAAC,CAAC,IAAA,8BAAa,EAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAC3B,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { ExecutorContext } from \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/devkit/src/utils/rxjs-for-await\";\nimport {\n checkPackageVersion,\n enableTsConfigPath,\n spawnServerlessExtensions,\n} from \"@trackunit/iris-app-build-utilities\";\nimport { existsSync } from \"fs\";\nimport { join } from \"path\";\nimport { Observable } from \"rxjs\";\nimport * as op from \"rxjs/operators\";\nimport \"win-ca\";\nimport { getDefaultViteConfig } from \"../utils/defaultViteConfig\";\nimport { ServeExecutorSchema } from \"./schema\";\n\ntype ServeResult = { baseUrl: string; success: boolean };\n\n/**\n * Serve executor for serving Iris Apps with Vite.\n *\n * @param {ServeExecutorSchema} options serve executor options for this nx executor\n * @param {ExecutorContext} context serve executor context for this nx executor\n * @yields {ServeResult} the serve result\n */\nexport default async function* serveExecutor(\n options: ServeExecutorSchema,\n context: ExecutorContext\n): AsyncGenerator<ServeResult> {\n await checkPackageVersion(false);\n\n // eslint-disable-next-line local-rules/no-typescript-assertion, @typescript-eslint/no-non-null-assertion\n const projectRoot = context.projectsConfigurations.projects[context.projectName!]!.root;\n const projectRootDir = join(context.root, projectRoot);\n const manifestPath = join(context.root, projectRoot, \"iris-app-manifest.ts\");\n\n // ✅ CRITICAL: Register tsconfig paths BEFORE any @trackunit/* imports\n enableTsConfigPath({\n projectRootDir,\n });\n\n // Now we can safely import the manifest (it uses @trackunit/* imports)\n const IrisAppManifest = (await import(manifestPath)).default;\n\n const serverlessResult = await spawnServerlessExtensions(IrisAppManifest, context.root);\n\n try {\n // Get default config (internally imports @trackunit/iris-app-vite-plugin)\n const defaultConfig = await getDefaultViteConfig(\n \"development\",\n context.root,\n projectRootDir,\n IrisAppManifest,\n context,\n {\n serverlessPortMap: serverlessResult.portMap,\n }\n );\n\n // Load optional custom config\n let finalConfig = defaultConfig;\n if (options.viteConfig || existsSync(join(projectRootDir, \"vite.config.ts\"))) {\n const customConfigFile = await import(options.viteConfig ?? join(projectRootDir, \"vite.config.ts\"));\n let customConfig = customConfigFile.default(defaultConfig);\n const isPromise = customConfig instanceof Promise;\n if (isPromise) {\n customConfig = await customConfig;\n }\n finalConfig = customConfig;\n }\n\n // Apply port override if specified\n if (options.port !== undefined) {\n finalConfig.server = { ...finalConfig.server, port: options.port };\n }\n if (options.host) {\n finalConfig.server = { ...finalConfig.server, host: options.host };\n }\n\n if (context.isVerbose) {\n // eslint-disable-next-line no-console\n console.log(\"Using Vite config\", JSON.stringify(finalConfig.plugins, null, 2));\n }\n\n // Create and start Vite dev server\n const observable = new Observable<{ baseUrl: string; success: boolean }>(subscriber => {\n void (async () => {\n try {\n // Dynamic import vite to avoid issues\n const { createServer } = await import(\"vite\");\n\n const server = await createServer({ ...finalConfig, configFile: false });\n await server.listen();\n\n const address = server.httpServer?.address();\n const port = typeof address === \"object\" && address !== null ? address.port : (options.port ?? 22220);\n const host = options.host ?? \"localhost\";\n const baseUrl = `http://${host}:${port}`;\n\n server.printUrls();\n\n subscriber.next({\n baseUrl,\n success: true,\n });\n\n // Keep alive - server continues running until interrupted\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Vite server error:\", error);\n subscriber.error(error);\n }\n })();\n\n return () => {\n // Cleanup on unsubscribe - handled by Vite's signal handling\n };\n }).pipe(\n op.tap(({ baseUrl }) => {\n // eslint-disable-next-line no-console\n console.info(`\\n 🚀 Iris App dev server running at: ${baseUrl}\\n`);\n }),\n op.map(({ baseUrl, success }) => ({\n baseUrl,\n success,\n })),\n op.finalize(() => {\n serverlessResult.cleanup();\n })\n );\n\n return yield* eachValueFrom(observable);\n } catch (error) {\n serverlessResult.cleanup();\n throw error;\n }\n}\n"]}
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/serve/executor.ts"],"names":[],"mappings":";;AAwBA,gCAgHC;;AAvID,wEAAoE;AACpE,kFAI6C;AAC7C,2BAAgC;AAChC,+BAA4B;AAC5B,+BAAkC;AAClC,2DAAqC;AACrC,kBAAgB;AAChB,kEAAkE;AAKlE;;;;;;GAMG;AACY,KAAK,SAAS,CAAC,CAAC,aAAa,CAC1C,OAA4B,EAC5B,OAAwB;IAExB,MAAM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{ ExecutorContext } from \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/devkit/src/utils/rxjs-for-await\";\nimport {\n checkPackageVersion,\n enableTsConfigPath,\n spawnServerlessExtensions,\n} from \"@trackunit/iris-app-build-utilities\";\nimport { existsSync } from \"fs\";\nimport { join } from \"path\";\nimport { Observable } from \"rxjs\";\nimport * as op from \"rxjs/operators\";\nimport \"win-ca\";\nimport { getDefaultViteConfig } from \"../utils/defaultViteConfig\";\nimport { ServeExecutorSchema } from \"./schema\";\n\ntype ServeResult = { baseUrl: string; success: boolean };\n\n/**\n * Serve executor for serving Iris Apps with Vite.\n *\n * @param {ServeExecutorSchema} options serve executor options for this nx executor\n * @param {ExecutorContext} context serve executor context for this nx executor\n * @yields {ServeResult} the serve result\n */\nexport default async function* serveExecutor(\n options: ServeExecutorSchema,\n context: ExecutorContext\n): AsyncGenerator<ServeResult> {\n await checkPackageVersion(false);\n\n // eslint-disable-next-line local-rules/no-typescript-assertion, @typescript-eslint/no-non-null-assertion\n const projectRoot = context.projectsConfigurations.projects[context.projectName!]!.root;\n const projectRootDir = join(context.root, projectRoot);\n const manifestPath = join(context.root, projectRoot, \"iris-app-manifest.ts\");\n\n // ✅ CRITICAL: Register tsconfig paths BEFORE any @trackunit/* imports\n enableTsConfigPath({\n projectRootDir,\n });\n\n // Now we can safely import the manifest (it uses @trackunit/* imports)\n const IrisAppManifest = (await import(manifestPath)).default;\n\n const serverlessResult = await spawnServerlessExtensions(IrisAppManifest, context.root);\n\n try {\n // Get default config (internally imports @trackunit/iris-app-vite-plugin)\n const defaultConfig = await getDefaultViteConfig(\n \"development\",\n context.root,\n projectRootDir,\n IrisAppManifest,\n context,\n {\n serverlessPortMap: serverlessResult.portMap,\n skipTypeChecking: options.skipTypeChecking,\n }\n );\n\n // Load optional custom config\n let finalConfig = defaultConfig;\n if (options.viteConfig || existsSync(join(projectRootDir, \"vite.config.ts\"))) {\n const customConfigFile = await import(options.viteConfig ?? join(projectRootDir, \"vite.config.ts\"));\n let customConfig = customConfigFile.default(defaultConfig);\n const isPromise = customConfig instanceof Promise;\n if (isPromise) {\n customConfig = await customConfig;\n }\n finalConfig = customConfig;\n }\n\n // Apply port override if specified\n if (options.port !== undefined) {\n finalConfig.server = { ...finalConfig.server, port: options.port };\n }\n if (options.host) {\n finalConfig.server = { ...finalConfig.server, host: options.host };\n }\n\n if (context.isVerbose) {\n // eslint-disable-next-line no-console\n console.log(\"Using Vite config\", JSON.stringify(finalConfig.plugins, null, 2));\n }\n\n // Create and start Vite dev server\n const observable = new Observable<{ baseUrl: string; success: boolean }>(subscriber => {\n void (async () => {\n try {\n // Dynamic import vite to avoid issues\n const { createServer } = await import(\"vite\");\n\n const server = await createServer({ ...finalConfig, configFile: false });\n await server.listen();\n\n const address = server.httpServer?.address();\n const port = typeof address === \"object\" && address !== null ? address.port : (options.port ?? 22220);\n const host = options.host ?? \"localhost\";\n const baseUrl = `http://${host}:${port}`;\n\n server.printUrls();\n\n subscriber.next({\n baseUrl,\n success: true,\n });\n\n // Keep alive - server continues running until interrupted\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Vite server error:\", error);\n subscriber.error(error);\n }\n })();\n\n return () => {\n // Cleanup on unsubscribe - handled by Vite's signal handling\n };\n }).pipe(\n op.tap(({ baseUrl }) => {\n // eslint-disable-next-line no-console\n console.info(`\\n 🚀 Iris App dev server running at: ${baseUrl}\\n`);\n }),\n op.map(({ baseUrl, success }) => ({\n baseUrl,\n success,\n })),\n op.finalize(() => {\n serverlessResult.cleanup();\n })\n );\n\n return yield* eachValueFrom(observable);\n } catch (error) {\n serverlessResult.cleanup();\n throw error;\n }\n}\n"]}
@@ -23,8 +23,12 @@
23
23
  "type": "string",
24
24
  "description": "Dev server host",
25
25
  "default": "localhost"
26
+ },
27
+ "skipTypeChecking": {
28
+ "type": "boolean",
29
+ "description": "Skip TypeScript type checking during dev server",
30
+ "default": false
26
31
  }
27
32
  },
28
33
  "required": []
29
34
  }
30
-
@@ -1,50 +1,34 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.getDefaultViteConfig = void 0;
37
- const path_1 = require("path");
38
- // Package name stored in variable to prevent TypeScript from statically analyzing
39
- // the import path during build. At runtime, enableTsConfigPath() must be called
40
- // first to register the path mapping.
41
- const VITE_PLUGIN_PACKAGE = "@trackunit/iris-app-vite-plugin";
4
+ const getTrackunitIrisAppVitePlugins_1 = require("./getTrackunitIrisAppVitePlugins");
5
+ const VIRTUAL_ENTRY_ID = "virtual:iris-app-entry";
6
+ const RESOLVED_VIRTUAL_ENTRY_ID = `\0${VIRTUAL_ENTRY_ID}`;
7
+ /**
8
+ * Rollup plugin providing a virtual empty entry module.
9
+ * Iris apps use Module Federation which generates remoteEntry.js as the real entry,
10
+ * so we just need a no-op input to satisfy Rollup's requirement for an entry point.
11
+ * Using a virtual module avoids tsconfig path resolution issues that occur when
12
+ * referencing physical files inside node_modules.
13
+ */
14
+ const virtualEntryPlugin = {
15
+ name: "iris-app-virtual-entry",
16
+ resolveId(id) {
17
+ if (id === VIRTUAL_ENTRY_ID) {
18
+ return RESOLVED_VIRTUAL_ENTRY_ID;
19
+ }
20
+ return null;
21
+ },
22
+ load(id) {
23
+ if (id === RESOLVED_VIRTUAL_ENTRY_ID) {
24
+ return "";
25
+ }
26
+ return null;
27
+ },
28
+ };
42
29
  /**
43
30
  * Gets the default Vite config for Iris Apps.
44
31
  *
45
- * IMPORTANT: This function MUST be called AFTER enableTsConfigPath() has been called,
46
- * because it dynamically imports @trackunit/iris-app-vite-plugin which uses tsconfig paths.
47
- *
48
32
  * @param mode - "production" or "development"
49
33
  * @param nxRootDir - the root of the nx workspace
50
34
  * @param appDir - the app directory
@@ -54,17 +38,17 @@ const VITE_PLUGIN_PACKAGE = "@trackunit/iris-app-vite-plugin";
54
38
  */
55
39
  const getDefaultViteConfig = async (mode, nxRootDir, appDir, _irisAppManifest, context, options = {}) => {
56
40
  // Dynamic import - safe after enableTsConfigPath() is called
57
- const { getTrackunitIrisAppVitePlugins } = await Promise.resolve(`${VITE_PLUGIN_PACKAGE}`).then(s => __importStar(require(s)));
58
- const irisAppPlugins = await getTrackunitIrisAppVitePlugins({
41
+ const irisAppPlugins = await (0, getTrackunitIrisAppVitePlugins_1.getTrackunitIrisAppVitePlugins)({
59
42
  appDir,
60
43
  workspaceRoot: nxRootDir,
61
44
  config: { mode },
62
45
  serverlessPortMap: options.serverlessPortMap,
46
+ skipTypeChecking: options.skipTypeChecking,
63
47
  });
64
48
  return {
65
49
  root: appDir,
66
50
  mode,
67
- plugins: [...irisAppPlugins],
51
+ plugins: [...irisAppPlugins, virtualEntryPlugin],
68
52
  // Optimize dependency pre-bundling
69
53
  optimizeDeps: {
70
54
  // Force include common dependencies to speed up dev server startup
@@ -90,8 +74,7 @@ const getDefaultViteConfig = async (mode, nxRootDir, appDir, _irisAppManifest, c
90
74
  // Use JavaScript entry instead of index.html for Module Federation remotes
91
75
  // The MF plugin generates remoteEntry.js as the actual bundle entry
92
76
  rollupOptions: {
93
- // this is just a dummy input to make the build pass - as Iris apps are module federation apps
94
- input: (0, path_1.join)(__dirname, "index.ts"),
77
+ input: VIRTUAL_ENTRY_ID,
95
78
  // Preserve the entry file name for Module Federation compatibility
96
79
  output: {
97
80
  // ESM format for Module Federation
@@ -1 +1 @@
1
- {"version":3,"file":"defaultViteConfig.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/utils/defaultViteConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,+BAA4B;AAG5B,kFAAkF;AAClF,gFAAgF;AAChF,sCAAsC;AACtC,MAAM,mBAAmB,GAAG,iCAAiC,CAAC;AAM9D;;;;;;;;;;;;GAYG;AACI,MAAM,oBAAoB,GAAG,KAAK,EACvC,IAAkC,EAClC,SAAiB,EACjB,MAAc,EACd,gBAAiC,EACjC,OAAwB,EACxB,UAAuC,EAAE,EACpB,EAAE;IACvB,6DAA6D;IAC7D,MAAM,EAAE,8BAA8B,EAAE,GAAG,yBAAa,mBAAmB,uCAAC,CAAC;IAE7E,MAAM,cAAc,GAAG,MAAM,8BAA8B,CAAC;QAC1D,MAAM;QACN,aAAa,EAAE,SAAS;QACxB,MAAM,EAAE,EAAE,IAAI,EAAE;QAChB,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;KAC7C,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI;QACJ,OAAO,EAAE,CAAC,GAAG,cAAc,CAAC;QAC5B,mCAAmC;QACnC,YAAY,EAAE;YACZ,mEAAmE;YACnE,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,mBAAmB,CAAC;YACpD,6CAA6C;YAC7C,cAAc,EAAE;gBACd,MAAM,EAAE,QAAQ;aACjB;SACF;QACD,KAAK,EAAE;YACL,MAAM,EAAE,aAAa,OAAO,CAAC,WAAW,EAAE;YAC1C,WAAW,EAAE,IAAI;YACjB,+DAA+D;YAC/D,MAAM,EAAE,QAAQ;YAChB,yDAAyD;YACzD,MAAM,EAAE,SAAS;YACjB,sDAAsD;YACtD,SAAS,EAAE,KAAK;YAChB,oCAAoC;YACpC,qBAAqB,EAAE,IAAI;YAC3B,8DAA8D;YAC9D,SAAS,EAAE,EAAE;YACb,2EAA2E;YAC3E,oEAAoE;YACpE,aAAa,EAAE;gBACb,8FAA8F;gBAC9F,KAAK,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,UAAU,CAAC;gBAClC,mEAAmE;gBACnE,MAAM,EAAE;oBACN,mCAAmC;oBACnC,MAAM,EAAE,KAAK;oBACb,6CAA6C;oBAC7C,cAAc,EAAE,WAAW;oBAC3B,mBAAmB;oBACnB,cAAc,EAAE,kBAAkB;oBAClC,gBAAgB;oBAChB,cAAc,EAAE,+BAA+B;iBAChD;aACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA/DW,QAAA,oBAAoB,wBA+D/B","sourcesContent":["import { ExecutorContext } from \"@nx/devkit\";\nimport type { IrisAppManifest } from \"@trackunit/iris-app-api\";\nimport type { ServerlessPortMap } from \"@trackunit/iris-app-build-utilities\";\nimport { join } from \"path\";\nimport type { UserConfig } from \"vite\";\n\n// Package name stored in variable to prevent TypeScript from statically analyzing\n// the import path during build. At runtime, enableTsConfigPath() must be called\n// first to register the path mapping.\nconst VITE_PLUGIN_PACKAGE = \"@trackunit/iris-app-vite-plugin\";\n\ntype GetDefaultViteConfigOptions = {\n serverlessPortMap?: ServerlessPortMap;\n};\n\n/**\n * Gets the default Vite config for Iris Apps.\n *\n * IMPORTANT: This function MUST be called AFTER enableTsConfigPath() has been called,\n * because it dynamically imports @trackunit/iris-app-vite-plugin which uses tsconfig paths.\n *\n * @param mode - \"production\" or \"development\"\n * @param nxRootDir - the root of the nx workspace\n * @param appDir - the app directory\n * @param _irisAppManifest - the iris app manifest (used for logging/validation)\n * @param context - NX executor context\n * @returns {Promise<UserConfig>} the default Vite config\n */\nexport const getDefaultViteConfig = async (\n mode: \"production\" | \"development\",\n nxRootDir: string,\n appDir: string,\n _irisAppManifest: IrisAppManifest,\n context: ExecutorContext,\n options: GetDefaultViteConfigOptions = {}\n): Promise<UserConfig> => {\n // Dynamic import - safe after enableTsConfigPath() is called\n const { getTrackunitIrisAppVitePlugins } = await import(VITE_PLUGIN_PACKAGE);\n\n const irisAppPlugins = await getTrackunitIrisAppVitePlugins({\n appDir,\n workspaceRoot: nxRootDir,\n config: { mode },\n serverlessPortMap: options.serverlessPortMap,\n });\n\n return {\n root: appDir,\n mode,\n plugins: [...irisAppPlugins],\n // Optimize dependency pre-bundling\n optimizeDeps: {\n // Force include common dependencies to speed up dev server startup\n include: [\"react\", \"react-dom\", \"react/jsx-runtime\"],\n // Use esbuild for faster dependency scanning\n esbuildOptions: {\n target: \"esnext\",\n },\n },\n build: {\n outDir: `dist/apps/${context.projectName}`,\n emptyOutDir: true,\n // Target modern browsers - faster builds, no legacy transforms\n target: \"esnext\",\n // Use esbuild for minification (MUCH faster than terser)\n minify: \"esbuild\",\n // Disable source maps in production for faster builds\n sourcemap: false,\n // Increase chunk size warning limit\n chunkSizeWarningLimit: 1000,\n // Put remoteEntry.js at root (not in assets/) to match rspack\n assetsDir: \"\",\n // Use JavaScript entry instead of index.html for Module Federation remotes\n // The MF plugin generates remoteEntry.js as the actual bundle entry\n rollupOptions: {\n // this is just a dummy input to make the build pass - as Iris apps are module federation apps\n input: join(__dirname, \"index.ts\"),\n // Preserve the entry file name for Module Federation compatibility\n output: {\n // ESM format for Module Federation\n format: \"esm\",\n // Entry files at root level (same as rspack)\n entryFileNames: \"[name].js\",\n // Chunks with hash\n chunkFileNames: \"[name]-[hash].js\",\n // Static assets\n assetFileNames: \"static/[name]-[hash][extname]\",\n },\n },\n },\n };\n};\n"]}
1
+ {"version":3,"file":"defaultViteConfig.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/utils/defaultViteConfig.ts"],"names":[],"mappings":";;;AAIA,qFAAkF;AAElF,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AAClD,MAAM,yBAAyB,GAAG,KAAK,gBAAgB,EAAE,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,kBAAkB,GAAiB;IACvC,IAAI,EAAE,wBAAwB;IAC9B,SAAS,CAAC,EAAU;QAClB,IAAI,EAAE,KAAK,gBAAgB,EAAE,CAAC;YAC5B,OAAO,yBAAyB,CAAC;QACnC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,EAAU;QACb,IAAI,EAAE,KAAK,yBAAyB,EAAE,CAAC;YACrC,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;AAOF;;;;;;;;;GASG;AACI,MAAM,oBAAoB,GAAG,KAAK,EACvC,IAAkC,EAClC,SAAiB,EACjB,MAAc,EACd,gBAAiC,EACjC,OAAwB,EACxB,UAAuC,EAAE,EACpB,EAAE;IACvB,6DAA6D;IAE7D,MAAM,cAAc,GAAG,MAAM,IAAA,+DAA8B,EAAC;QAC1D,MAAM;QACN,aAAa,EAAE,SAAS;QACxB,MAAM,EAAE,EAAE,IAAI,EAAE;QAChB,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;QAC5C,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;KAC3C,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI;QACJ,OAAO,EAAE,CAAC,GAAG,cAAc,EAAE,kBAAkB,CAAC;QAChD,mCAAmC;QACnC,YAAY,EAAE;YACZ,mEAAmE;YACnE,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,mBAAmB,CAAC;YACpD,6CAA6C;YAC7C,cAAc,EAAE;gBACd,MAAM,EAAE,QAAQ;aACjB;SACF;QACD,KAAK,EAAE;YACL,MAAM,EAAE,aAAa,OAAO,CAAC,WAAW,EAAE;YAC1C,WAAW,EAAE,IAAI;YACjB,+DAA+D;YAC/D,MAAM,EAAE,QAAQ;YAChB,yDAAyD;YACzD,MAAM,EAAE,SAAS;YACjB,sDAAsD;YACtD,SAAS,EAAE,KAAK;YAChB,oCAAoC;YACpC,qBAAqB,EAAE,IAAI;YAC3B,8DAA8D;YAC9D,SAAS,EAAE,EAAE;YACb,2EAA2E;YAC3E,oEAAoE;YACpE,aAAa,EAAE;gBACb,KAAK,EAAE,gBAAgB;gBACvB,mEAAmE;gBACnE,MAAM,EAAE;oBACN,mCAAmC;oBACnC,MAAM,EAAE,KAAK;oBACb,6CAA6C;oBAC7C,cAAc,EAAE,WAAW;oBAC3B,mBAAmB;oBACnB,cAAc,EAAE,kBAAkB;oBAClC,gBAAgB;oBAChB,cAAc,EAAE,+BAA+B;iBAChD;aACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA9DW,QAAA,oBAAoB,wBA8D/B","sourcesContent":["import { ExecutorContext } from \"@nx/devkit\";\nimport type { IrisAppManifest } from \"@trackunit/iris-app-api\";\nimport type { ServerlessPortMap } from \"@trackunit/iris-app-build-utilities\";\nimport type { PluginOption, UserConfig } from \"vite\";\nimport { getTrackunitIrisAppVitePlugins } from \"./getTrackunitIrisAppVitePlugins\";\n\nconst VIRTUAL_ENTRY_ID = \"virtual:iris-app-entry\";\nconst RESOLVED_VIRTUAL_ENTRY_ID = `\\0${VIRTUAL_ENTRY_ID}`;\n\n/**\n * Rollup plugin providing a virtual empty entry module.\n * Iris apps use Module Federation which generates remoteEntry.js as the real entry,\n * so we just need a no-op input to satisfy Rollup's requirement for an entry point.\n * Using a virtual module avoids tsconfig path resolution issues that occur when\n * referencing physical files inside node_modules.\n */\nconst virtualEntryPlugin: PluginOption = {\n name: \"iris-app-virtual-entry\",\n resolveId(id: string) {\n if (id === VIRTUAL_ENTRY_ID) {\n return RESOLVED_VIRTUAL_ENTRY_ID;\n }\n return null;\n },\n load(id: string) {\n if (id === RESOLVED_VIRTUAL_ENTRY_ID) {\n return \"\";\n }\n return null;\n },\n};\n\ntype GetDefaultViteConfigOptions = {\n serverlessPortMap?: ServerlessPortMap;\n skipTypeChecking?: boolean;\n};\n\n/**\n * Gets the default Vite config for Iris Apps.\n *\n * @param mode - \"production\" or \"development\"\n * @param nxRootDir - the root of the nx workspace\n * @param appDir - the app directory\n * @param _irisAppManifest - the iris app manifest (used for logging/validation)\n * @param context - NX executor context\n * @returns {Promise<UserConfig>} the default Vite config\n */\nexport const getDefaultViteConfig = async (\n mode: \"production\" | \"development\",\n nxRootDir: string,\n appDir: string,\n _irisAppManifest: IrisAppManifest,\n context: ExecutorContext,\n options: GetDefaultViteConfigOptions = {}\n): Promise<UserConfig> => {\n // Dynamic import - safe after enableTsConfigPath() is called\n\n const irisAppPlugins = await getTrackunitIrisAppVitePlugins({\n appDir,\n workspaceRoot: nxRootDir,\n config: { mode },\n serverlessPortMap: options.serverlessPortMap,\n skipTypeChecking: options.skipTypeChecking,\n });\n\n return {\n root: appDir,\n mode,\n plugins: [...irisAppPlugins, virtualEntryPlugin],\n // Optimize dependency pre-bundling\n optimizeDeps: {\n // Force include common dependencies to speed up dev server startup\n include: [\"react\", \"react-dom\", \"react/jsx-runtime\"],\n // Use esbuild for faster dependency scanning\n esbuildOptions: {\n target: \"esnext\",\n },\n },\n build: {\n outDir: `dist/apps/${context.projectName}`,\n emptyOutDir: true,\n // Target modern browsers - faster builds, no legacy transforms\n target: \"esnext\",\n // Use esbuild for minification (MUCH faster than terser)\n minify: \"esbuild\",\n // Disable source maps in production for faster builds\n sourcemap: false,\n // Increase chunk size warning limit\n chunkSizeWarningLimit: 1000,\n // Put remoteEntry.js at root (not in assets/) to match rspack\n assetsDir: \"\",\n // Use JavaScript entry instead of index.html for Module Federation remotes\n // The MF plugin generates remoteEntry.js as the actual bundle entry\n rollupOptions: {\n input: VIRTUAL_ENTRY_ID,\n // Preserve the entry file name for Module Federation compatibility\n output: {\n // ESM format for Module Federation\n format: \"esm\",\n // Entry files at root level (same as rspack)\n entryFileNames: \"[name].js\",\n // Chunks with hash\n chunkFileNames: \"[name]-[hash].js\",\n // Static assets\n assetFileNames: \"static/[name]-[hash][extname]\",\n },\n },\n },\n };\n};\n"]}
@@ -0,0 +1,626 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTrackunitIrisAppVitePlugins = getTrackunitIrisAppVitePlugins;
4
+ const tslib_1 = require("tslib");
5
+ const vite_1 = require("@module-federation/vite");
6
+ const nx_tsconfig_paths_plugin_1 = require("@nx/vite/plugins/nx-tsconfig-paths.plugin");
7
+ const iris_app_build_utilities_1 = require("@trackunit/iris-app-build-utilities");
8
+ const plugin_react_swc_1 = tslib_1.__importDefault(require("@vitejs/plugin-react-swc"));
9
+ const fs = tslib_1.__importStar(require("node:fs"));
10
+ const path = tslib_1.__importStar(require("node:path"));
11
+ const vite_2 = require("vite");
12
+ const vite_plugin_checker_1 = tslib_1.__importDefault(require("vite-plugin-checker"));
13
+ const vite_plugin_css_injected_by_js_1 = tslib_1.__importDefault(require("vite-plugin-css-injected-by-js"));
14
+ // Only import enableTsConfigPath statically - other utilities are dynamically imported
15
+ // AFTER tsconfig paths are registered to avoid oxc analysis warnings
16
+ // MIME types for serving extension assets during development
17
+ const MIME_TYPES = {
18
+ ".svg": "image/svg+xml",
19
+ ".png": "image/png",
20
+ ".jpg": "image/jpeg",
21
+ ".jpeg": "image/jpeg",
22
+ ".gif": "image/gif",
23
+ ".webp": "image/webp",
24
+ ".ico": "image/x-icon",
25
+ };
26
+ const getMimeType = (filePath) => MIME_TYPES[path.extname(filePath).toLowerCase()] || "application/octet-stream";
27
+ /**
28
+ * Resolves a URL path like "/{extensionId}/assets/icon.svg" to the actual file path on disk.
29
+ * Returns null if no matching extension is found or the file doesn't exist.
30
+ */
31
+ const resolveExtensionAsset = (url, manifest, workspaceRoot) => {
32
+ for (const ext of manifest.extensions) {
33
+ if (url.startsWith(`/${ext.id}/`)) {
34
+ const assetPath = url.substring(ext.id.length + 2);
35
+ const filePath = path.join(workspaceRoot, ext.sourceRoot, assetPath);
36
+ if (fs.existsSync(filePath) && fs.statSync(filePath).isFile()) {
37
+ return filePath;
38
+ }
39
+ }
40
+ }
41
+ return null;
42
+ };
43
+ // Flag to track if tsconfig paths have been registered
44
+ let tsconfigPathsRegistered = false;
45
+ /**
46
+ * Registers tsconfig paths for resolving @trackunit/* imports at runtime.
47
+ * This is needed because the manifest file imports from @trackunit/* packages.
48
+ */
49
+ const registerTsConfigPaths = (workspaceRoot, appDir) => {
50
+ if (tsconfigPathsRegistered) {
51
+ return;
52
+ }
53
+ (0, iris_app_build_utilities_1.enableTsConfigPath)({ projectRootDir: appDir, workspaceRoot });
54
+ tsconfigPathsRegistered = true;
55
+ };
56
+ /**
57
+ * Loads the Iris app manifest from the app directory.
58
+ * Uses require() with cache clearing since Node.js doesn't support query strings in import paths.
59
+ */
60
+ const loadManifest = (workspaceRoot, appDir) => {
61
+ // Register tsconfig paths before loading the manifest
62
+ registerTsConfigPaths(workspaceRoot, appDir);
63
+ const manifestPath = path.join(appDir, "iris-app-manifest.ts");
64
+ // Clear require cache to ensure fresh manifest on HMR
65
+ try {
66
+ delete require.cache[require.resolve(manifestPath)];
67
+ }
68
+ catch {
69
+ // Ignore if not in cache
70
+ }
71
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
72
+ const manifestModule = require(manifestPath);
73
+ manifestModule.default.moduleFormat = "esm";
74
+ return manifestModule.default;
75
+ };
76
+ /**
77
+ * Converts the shared dependencies from webpack format to Vite module federation format.
78
+ * Handles both array and object variants of the Shared type.
79
+ *
80
+ * NOTE: We do NOT set `import: false` here because iris apps run in an iframe (separate
81
+ * JavaScript context). The host's shared dependencies are NOT accessible across the iframe
82
+ * boundary, so the iris app must bundle its own copies as a fallback. The `singleton: true`
83
+ * config ensures that within the iframe context, only one instance is used.
84
+ */
85
+ const convertSharedToViteFormat = (shared) => {
86
+ const result = {};
87
+ const processItem = (item) => {
88
+ if (typeof item === "string") {
89
+ // Bundle this dependency - iris apps need their own copy since they run in an iframe
90
+ result[item] = {};
91
+ }
92
+ else if (item !== null && typeof item === "object") {
93
+ for (const [key, value] of Object.entries(item)) {
94
+ const baseConfig = typeof value === "string" ? {} : (value ?? {});
95
+ // Remove import: false if it was set - we need to bundle shared deps for iframe isolation
96
+ const { import: _import, ...restConfig } = baseConfig;
97
+ result[key] = restConfig;
98
+ }
99
+ }
100
+ };
101
+ // Handle both array and object variants of Shared type
102
+ if (Array.isArray(shared)) {
103
+ for (const item of shared) {
104
+ processItem(item);
105
+ }
106
+ }
107
+ else {
108
+ processItem(shared);
109
+ }
110
+ // For now we do not use any shared for vite build - as it create random crashes, it seemed like react was not garanteed to be loaded
111
+ return {};
112
+ // return result;
113
+ };
114
+ /**
115
+ * Converts the webpack Exposes type to Vite's expected format.
116
+ * getExposedExtensions returns an object with string values, but the Exposes type
117
+ * is a union that includes arrays. This extracts just the object entries.
118
+ *
119
+ */
120
+ const convertExposesToViteFormat = (exposes) => {
121
+ const result = {};
122
+ if (typeof exposes === "object" && !Array.isArray(exposes)) {
123
+ for (const [key, value] of Object.entries(exposes)) {
124
+ if (typeof value === "string") {
125
+ result[key] = value;
126
+ }
127
+ }
128
+ }
129
+ return result;
130
+ };
131
+ const generateIndexHtml = ({ manifest, packageJson, options, }) => {
132
+ // Register tsconfig paths to load the utility
133
+ registerTsConfigPaths(options.workspaceRoot ?? options.appDir, options.appDir);
134
+ // Only include dev scripts and React DevTools connection in development
135
+ const devtools = options.config.mode === "development"
136
+ ? `<script nonce="{{nonce}}" src="http://localhost:8097"></script>
137
+ <script nonce="{{nonce}}">
138
+ // Polyfill for Node.js globals that some libraries expect
139
+ if (typeof global === 'undefined') { window.global = window; }
140
+ if (typeof process === 'undefined') { window.process = { env: {} }; }
141
+ </script>
142
+ `
143
+ : `
144
+ <script nonce="{{nonce}}">
145
+ // Polyfill for Node.js globals that some libraries expect
146
+ if (typeof global === 'undefined') { window.global = window; }
147
+ if (typeof process === 'undefined') { window.process = { env: {} }; }
148
+ </script>`;
149
+ return (0, iris_app_build_utilities_1.updateIndexHtml)({ manifest, packageJson, devtools });
150
+ };
151
+ /**
152
+ * Vite plugin that generates manifest.json, package.json, and index.html for Iris Apps.
153
+ * This is the Vite equivalent of TrackunitIrisAppWebpackPlugin.
154
+ *
155
+ * Returns an array of plugins including Module Federation configuration.
156
+ */
157
+ async function getTrackunitIrisAppVitePlugins(options) {
158
+ const resolvedAppDir = path.resolve(options.appDir);
159
+ const workspaceRoot = options.workspaceRoot ?? path.resolve(options.appDir, "../..");
160
+ // Load manifest upfront for federation config
161
+ const initialManifest = loadManifest(workspaceRoot, resolvedAppDir);
162
+ // Get build utilities (tsconfig paths now registered via loadManifest)
163
+ // Get an available port in the Iris app port range
164
+ const port = await (0, iris_app_build_utilities_1.getAvailablePort)(22220, 22229);
165
+ // Get module federation configuration from manifest
166
+ const webpackExposes = await (0, iris_app_build_utilities_1.getExposedExtensions)({
167
+ nxRootDir: workspaceRoot,
168
+ manifest: initialManifest,
169
+ });
170
+ const shared = (0, iris_app_build_utilities_1.getSharedDependencies)({ manifest: initialManifest });
171
+ const viteExposes = convertExposesToViteFormat(webpackExposes);
172
+ const viteShared = convertSharedToViteFormat(shared);
173
+ const hasExposes = Object.keys(viteExposes).length > 0;
174
+ // Only create the federation plugin when there are modules to expose.
175
+ // @module-federation/vite deadlocks during build when exposes is empty because
176
+ // its proxyRemoteEntry plugin waits for a module-parse promise that never resolves.
177
+ let federationPlugin = null;
178
+ if (hasExposes) {
179
+ federationPlugin = (0, vite_1.federation)({
180
+ name: initialManifest.moduleFederationName,
181
+ filename: "remoteEntry.js",
182
+ library: { type: "global", name: initialManifest.moduleFederationName },
183
+ exposes: viteExposes,
184
+ shared: viteShared,
185
+ remotes: {},
186
+ manifest: false,
187
+ dts: false,
188
+ shareStrategy: "loaded-first",
189
+ getPublicPath: `return (function() {
190
+ var base;
191
+ if (typeof import.meta !== 'undefined' && import.meta.url) {
192
+ base = new URL('./', import.meta.url).href;
193
+ } else if (typeof document !== 'undefined' && document.currentScript) {
194
+ base = new URL('./', document.currentScript.src).href;
195
+ } else {
196
+ base = document.baseURI;
197
+ }
198
+ return base;
199
+ })()`,
200
+ });
201
+ }
202
+ // Conditionally create bundle analyzer plugin (same pattern as webpack/rspack)
203
+ // Created here so we have access to the output directory path
204
+ let bundleAnalyzerPlugin = null;
205
+ if (process.env.BUNDLE_ANALYSE === "true") {
206
+ // Compute output directory: dist/apps/{app-name}
207
+ const appName = path.basename(resolvedAppDir);
208
+ const statsPath = path.join(workspaceRoot, "dist", "apps", appName, "stats.html");
209
+ // Dynamic ESM import for optional dependency
210
+ const { visualizer } = await Promise.resolve().then(() => tslib_1.__importStar(require("rollup-plugin-visualizer")));
211
+ bundleAnalyzerPlugin = visualizer({
212
+ filename: statsPath,
213
+ template: "treemap",
214
+ gzipSize: true,
215
+ brotliSize: true,
216
+ });
217
+ // eslint-disable-next-line no-console
218
+ console.log(`\n📊 Bundle analyzer enabled - stats.html will be created at:\n ${statsPath}\n`);
219
+ }
220
+ // Plugin to disable hostAutoInit for pure remotes
221
+ // The @module-federation/vite plugin always injects a hostAutoInit module
222
+ // that auto-initializes the federation runtime. For pure remotes (Iris Apps),
223
+ // we don't need this - the host handles initialization. This plugin intercepts
224
+ // the virtual module and returns an empty module to prevent the build error.
225
+ const disableHostAutoInitPlugin = {
226
+ name: "disable-host-auto-init",
227
+ enforce: "pre",
228
+ resolveId(id) {
229
+ // Match the hostAutoInit virtual module pattern: __H_A_I__hostAutoInit__H_A_I__
230
+ if (id.includes("__H_A_I__hostAutoInit__H_A_I__")) {
231
+ return "\0virtual:empty-host-auto-init";
232
+ }
233
+ return null;
234
+ },
235
+ load(id) {
236
+ if (id === "\0virtual:empty-host-auto-init") {
237
+ // Return empty module - no auto-initialization needed for pure remotes
238
+ return "export default {}";
239
+ }
240
+ return null;
241
+ },
242
+ };
243
+ // Create the iris app plugin
244
+ let config;
245
+ let manifest = initialManifest;
246
+ const reloadManifest = () => {
247
+ return loadManifest(workspaceRoot, resolvedAppDir);
248
+ };
249
+ const generateManifestJson = (manifestData) => {
250
+ // Register tsconfig paths to load utilities
251
+ registerTsConfigPaths(workspaceRoot, resolvedAppDir);
252
+ const manifestCopy = { ...manifestData };
253
+ const appSrc = path.join(resolvedAppDir, "src");
254
+ manifestCopy.customFieldDefinitions = (0, iris_app_build_utilities_1.updateCustomFields)(manifestData.customFieldDefinitions, appSrc);
255
+ manifestCopy.extensions = (0, iris_app_build_utilities_1.updateExtensions)([...manifestData.extensions]);
256
+ return manifestCopy;
257
+ };
258
+ // No explicit type annotation to avoid excessive stack depth error with federation plugin's complex types
259
+ const irisAppPlugin = {
260
+ name: "trackunit-iris-app-vite-configuration",
261
+ config(conf) {
262
+ // Base config for both serve and build
263
+ const baseConfig = {
264
+ // Use empty base for runtime URL resolution - assets will use relative paths
265
+ base: "",
266
+ // Runtime URL resolution - equivalent to rspack's publicPath: "auto"
267
+ // Uses document.currentScript to determine base URL at runtime
268
+ experimental: {
269
+ renderBuiltUrl(filename, { hostType }) {
270
+ // CSS files cannot execute JavaScript runtime expressions - use relative paths instead
271
+ // This applies to fonts, images, and other assets referenced via url() in CSS
272
+ if (hostType === "css") {
273
+ return { relative: true };
274
+ }
275
+ // For JS/HTML, use runtime resolution using document.currentScript (like webpack/rspack's publicPath: "auto")
276
+ return {
277
+ runtime: `((function() {
278
+ return document.baseURI + ${JSON.stringify(filename)};
279
+ })())`,
280
+ };
281
+ },
282
+ },
283
+ // PostCSS configuration for Tailwind CSS v4
284
+ // Using @tailwindcss/postcss instead of @tailwindcss/vite for better monorepo support
285
+ css: {
286
+ postcss: {
287
+ plugins: [require("@tailwindcss/postcss")({})],
288
+ },
289
+ },
290
+ server: {
291
+ port,
292
+ host: "localhost",
293
+ // Enable CORS for cross-origin requests from new.manager.trackunit.com
294
+ cors: {
295
+ origin: true, // Reflect request origin (supports all origins)
296
+ credentials: true,
297
+ methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
298
+ allowedHeaders: [
299
+ "X-Requested-With",
300
+ "baggage",
301
+ "content-type",
302
+ "Authorization",
303
+ "sentry-trace",
304
+ "session-id",
305
+ "commit-number",
306
+ "x-trackunitappversion",
307
+ ],
308
+ maxAge: 3600,
309
+ },
310
+ },
311
+ // Production build optimization
312
+ build: {
313
+ // Use esbuild for fast minification (Vite's default)
314
+ minify: "esbuild",
315
+ // CSS code splitting is required for relativeCSSInjection to work
316
+ // (cssInjectedByJsPlugin enforces cssCodeSplit: true when relativeCSSInjection is enabled)
317
+ // Each chunk's CSS is injected when that chunk loads - ideal for Module Federation
318
+ // NOTE: We don't set cssCodeSplit here because the plugin controls it
319
+ cssCodeSplit: true,
320
+ rollupOptions: {
321
+ output: {
322
+ // Chunk splitting strategy - bundle small modules together to reduce HTTP requests
323
+ manualChunks(id) {
324
+ // Skip Module Federation virtual modules and runtime - let MF handle these
325
+ if (id.includes("__mf__virtual") ||
326
+ id.includes("@mf-types") ||
327
+ id.includes("virtualExposes") ||
328
+ id.includes("virtual_mf-exposes") ||
329
+ id.includes("remoteEntry") ||
330
+ id.includes("_mf_")) {
331
+ return undefined;
332
+ }
333
+ // Skip node_modules - let Rollup handle vendor chunking
334
+ if (id.includes("node_modules")) {
335
+ return undefined;
336
+ }
337
+ // 1. Split translations per language (like Rspack's splitChunks cacheGroups)
338
+ const translationMatch = id.match(/[\\/]locales[\\/]([^/\\]+)[\\/]translation\.json$/);
339
+ if (translationMatch) {
340
+ return `translations-${translationMatch[1]}`;
341
+ }
342
+ // Let Rollup handle everything else - default chunking is fine
343
+ // Vite/Rollup will merge small chunks automatically
344
+ return undefined;
345
+ },
346
+ },
347
+ },
348
+ },
349
+ };
350
+ return (0, vite_2.mergeConfig)(conf, baseConfig, false); // false = don't concatenate root-level arrays
351
+ },
352
+ configResolved(resolvedConfig) {
353
+ config = resolvedConfig;
354
+ },
355
+ buildStart() {
356
+ manifest = reloadManifest();
357
+ },
358
+ configureServer(server) {
359
+ // Route /invoke requests to local serverless extensions when available.
360
+ server.middlewares.use("/invoke", (0, iris_app_build_utilities_1.createInvokeProxyMiddleware)(options.serverlessPortMap));
361
+ // Serve extension assets from source during development (/{extensionId}/... → {sourceRoot}/...)
362
+ server.middlewares.use((req, res, next) => {
363
+ const url = req.url?.split("?")[0] ?? "/";
364
+ const filePath = resolveExtensionAsset(url, manifest ?? reloadManifest(), workspaceRoot);
365
+ if (filePath) {
366
+ res.setHeader("Content-Type", getMimeType(filePath));
367
+ res.end(fs.readFileSync(filePath));
368
+ return;
369
+ }
370
+ next();
371
+ });
372
+ // Global CORS headers middleware - must be first to set headers on all responses
373
+ server.middlewares.use((req, res, next) => {
374
+ // Set Access-Control-Allow-Origin based on request origin (needed for CORS preflight)
375
+ const origin = req.headers.origin || "https://dev.manager.trackunit.com";
376
+ res.setHeader("Access-Control-Allow-Origin", origin);
377
+ res.setHeader("Access-Control-Allow-Credentials", "true");
378
+ res.setHeader("Access-Control-Max-Age", "3600");
379
+ res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
380
+ res.setHeader("Access-Control-Allow-Headers", "X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion");
381
+ next();
382
+ });
383
+ // IMPORTANT: This middleware must be synchronous for requests we want to pass through to Vite.
384
+ // Async middlewares break Connect's middleware chain when calling next().
385
+ // We use a sync wrapper and only do async work for routes we handle ourselves.
386
+ server.middlewares.use((req, res, next) => {
387
+ const url = req.url?.split("?")[0] ?? "/";
388
+ // Let Vite handle its internal routes (@fs, @vite, @react-refresh, node_modules, etc.)
389
+ // MUST call next() synchronously for these to work properly
390
+ const isViteInternal = url.startsWith("/@") ||
391
+ url.startsWith("/node_modules/") ||
392
+ url.startsWith("/__mf__virtual/") ||
393
+ url.startsWith("/__vite");
394
+ if (isViteInternal) {
395
+ next();
396
+ return;
397
+ }
398
+ // CORS preflight handler - respond to OPTIONS requests
399
+ if (req.method === "OPTIONS") {
400
+ res.statusCode = 204;
401
+ res.end();
402
+ return;
403
+ }
404
+ // For non-GET/HEAD/OPTIONS on root path, return allowed methods
405
+ if (req.url?.endsWith("/") && req.method !== "GET" && req.method !== "HEAD") {
406
+ res.end("GET, HEAD");
407
+ return;
408
+ }
409
+ // Serve manifest.json during development (async route - handle response ourselves)
410
+ if (req.url === "/manifest.json") {
411
+ void (async () => {
412
+ try {
413
+ manifest = reloadManifest();
414
+ const manifestJson = generateManifestJson(manifest);
415
+ res.setHeader("Content-Type", "application/json");
416
+ res.end(JSON.stringify(manifestJson, null, 2));
417
+ }
418
+ catch (error) {
419
+ // eslint-disable-next-line no-console
420
+ console.error("Error generating manifest.json:", error);
421
+ res.statusCode = 500;
422
+ res.end(String(error));
423
+ }
424
+ })();
425
+ return; // Don't call next() - we're handling this route
426
+ }
427
+ // Serve package.json during development
428
+ if (req.url === "/package.json") {
429
+ try {
430
+ const packageJsonPath = path.join(resolvedAppDir, "package.json");
431
+ const packageJson = fs.readFileSync(packageJsonPath, "utf8");
432
+ res.setHeader("Content-Type", "application/json");
433
+ res.end(packageJson);
434
+ return;
435
+ }
436
+ catch (error) {
437
+ // eslint-disable-next-line no-console
438
+ console.error("Error serving package.json:", error);
439
+ }
440
+ }
441
+ // Serve manifestAndToken during development (async route - handle response ourselves)
442
+ if (req.url?.startsWith("/manifestAndToken")) {
443
+ void (async () => {
444
+ try {
445
+ const host = req.headers.host || "localhost";
446
+ const resp = await fetch(`http://${host}/manifest.json`);
447
+ const body = await resp.json();
448
+ res.setHeader("Content-Type", "application/json");
449
+ res.end(JSON.stringify({ manifest: body }));
450
+ }
451
+ catch (e) {
452
+ // eslint-disable-next-line no-console
453
+ console.error("ERROR: ", e);
454
+ res.statusCode = 500;
455
+ res.end(String(e));
456
+ }
457
+ })();
458
+ return; // Don't call next() - we're handling this route
459
+ }
460
+ // Serve extensionloader.js during development (async route - handle response ourselves)
461
+ if (req.url?.startsWith("/extensionloader.js")) {
462
+ void (async () => {
463
+ try {
464
+ // To test extensionloader locally set LOCAL=true in front of the serve command
465
+ let loaderUrl = "https://iris.trackunit.app/extensionloader.js";
466
+ if (process.env.LOCAL === "true") {
467
+ loaderUrl = "http://localhost:3000/extensionloader.js";
468
+ }
469
+ const resp = await fetch(loaderUrl);
470
+ const body = await resp.text();
471
+ res.setHeader("Content-Type", "application/javascript");
472
+ res.end(body);
473
+ }
474
+ catch (e) {
475
+ // eslint-disable-next-line no-console
476
+ console.error("ERROR: ", e);
477
+ res.statusCode = 500;
478
+ res.end(String(e));
479
+ }
480
+ })();
481
+ return; // Don't call next() - we're handling this route
482
+ }
483
+ // Serve generated index.html for root path and SPA fallback routes
484
+ // This handles the case where no physical index.html exists (async route - handle response ourselves)
485
+ if (req.method === "GET") {
486
+ const acceptsHtml = req.headers.accept?.includes("text/html");
487
+ const hasExtension = /\.\w+$/.test(url);
488
+ const isRootOrSpaRoute = url === "/" || url === "/index.html" || (!hasExtension && acceptsHtml);
489
+ if (isRootOrSpaRoute) {
490
+ void (async () => {
491
+ try {
492
+ manifest = reloadManifest();
493
+ const packageJsonPath = path.join(resolvedAppDir, "package.json");
494
+ const packageJson = fs.readFileSync(packageJsonPath, "utf8");
495
+ const html = generateIndexHtml({ manifest, packageJson, options });
496
+ const transformedHtml = await server.transformIndexHtml(req.url ?? "/", html);
497
+ res.setHeader("Content-Type", "text/html");
498
+ res.end(transformedHtml);
499
+ }
500
+ catch (error) {
501
+ // eslint-disable-next-line no-console
502
+ console.error("Error generating index.html:", error);
503
+ res.statusCode = 500;
504
+ res.end(String(error));
505
+ }
506
+ })();
507
+ return; // Don't call next() - we're handling this route
508
+ }
509
+ }
510
+ next();
511
+ });
512
+ // Log success message when server starts
513
+ server.httpServer?.once("listening", () => {
514
+ setTimeout(() => {
515
+ (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`);
516
+ }, 100);
517
+ });
518
+ },
519
+ generateBundle() {
520
+ if (!manifest) {
521
+ manifest = reloadManifest();
522
+ }
523
+ const packageJsonPath = path.join(resolvedAppDir, "package.json");
524
+ const packageJson = fs.readFileSync(packageJsonPath, "utf8");
525
+ // Generate and emit manifest.json
526
+ const manifestJson = generateManifestJson(manifest);
527
+ this.emitFile({
528
+ type: "asset",
529
+ fileName: "manifest.json",
530
+ source: JSON.stringify(manifestJson, null, 2),
531
+ });
532
+ // Emit package.json
533
+ this.emitFile({
534
+ type: "asset",
535
+ fileName: "package.json",
536
+ source: packageJson,
537
+ });
538
+ const html = generateIndexHtml({ manifest, packageJson, options });
539
+ this.emitFile({
540
+ type: "asset",
541
+ fileName: "index.html",
542
+ source: html,
543
+ });
544
+ },
545
+ closeBundle() {
546
+ if (config.command === "build") {
547
+ const manifestForCopy = manifest ?? reloadManifest();
548
+ const copyPatterns = (0, iris_app_build_utilities_1.getCopyPatterns)({
549
+ nxRootDir: workspaceRoot,
550
+ appDir: resolvedAppDir,
551
+ manifest: manifestForCopy,
552
+ mode: "production",
553
+ });
554
+ const nonExistingPatterns = [];
555
+ for (const pattern of copyPatterns) {
556
+ const exists = fs.existsSync(pattern.from);
557
+ if (!exists) {
558
+ nonExistingPatterns.push(pattern);
559
+ }
560
+ }
561
+ if (nonExistingPatterns.length > 0) {
562
+ throw new Error(`Copy patterns do not exist: ${nonExistingPatterns.map(p => p.from).join(", ")}`);
563
+ }
564
+ for (const pattern of copyPatterns) {
565
+ try {
566
+ if (fs.existsSync(pattern.from)) {
567
+ const stat = fs.statSync(pattern.from);
568
+ if (stat.isDirectory()) {
569
+ // Copy directory recursively
570
+ fs.cpSync(pattern.from, pattern.to, { recursive: true });
571
+ }
572
+ else {
573
+ // Copy single file
574
+ const targetDir = path.dirname(pattern.to);
575
+ if (!fs.existsSync(targetDir)) {
576
+ fs.mkdirSync(targetDir, { recursive: true });
577
+ }
578
+ fs.copyFileSync(pattern.from, pattern.to);
579
+ }
580
+ }
581
+ }
582
+ catch (error) {
583
+ // eslint-disable-next-line no-console
584
+ console.error(`Error: Could not copy ${pattern.from} to ${pattern.to}:`, error);
585
+ throw error;
586
+ }
587
+ }
588
+ }
589
+ },
590
+ };
591
+ // Return array of plugins:
592
+ // 1. nxViteTsPaths - handles tsconfig path resolution
593
+ // 2. disableHostAutoInitPlugin - intercepts hostAutoInit virtual module (must be before federation)
594
+ // 3. federationPlugin - Module Federation for micro-frontends
595
+ // 4. irisAppPlugin - Iris App specific handling
596
+ // 5. cssInjectedByJsPlugin - Vite equivalent of rspack's "style-loader"
597
+ // Injects CSS via JS as inline <style> tags instead of external CSS files
598
+ // 6. bundleAnalyzerPlugin - optional bundle analysis
599
+ //
600
+ // NOTE: Tailwind CSS is configured via PostCSS (in baseConfig.css.postcss above)
601
+ // NOT using @tailwindcss/vite because it doesn't respect tailwind.config.js content paths
602
+ // PostCSS approach matches Rspack and properly uses getTailwindContentForApp() from config files
603
+ const plugins = [
604
+ (0, nx_tsconfig_paths_plugin_1.nxViteTsPaths)(),
605
+ // React Fast Refresh — enables HMR for React components so file changes
606
+ // are hot-swapped without a full page reload. Safe with Module Federation
607
+ // because Iris apps bundle their own React (iframe isolation).
608
+ (0, plugin_react_swc_1.default)({}),
609
+ hasExposes && disableHostAutoInitPlugin,
610
+ federationPlugin,
611
+ !options.skipTypeChecking &&
612
+ (0, vite_plugin_checker_1.default)({ typescript: { tsconfigPath: path.join(resolvedAppDir, "tsconfig.app.json") } }),
613
+ irisAppPlugin,
614
+ // Equivalent to rspack's style-loader - injects CSS as inline <style> tags
615
+ // topExecutionPriority ensures CSS is injected before other code runs,
616
+ // relativeCSSInjection: true ensures CSS is injected per chunk (requires cssCodeSplit: true)
617
+ // This is ideal for Module Federation - CSS loads with each remote chunk
618
+ (0, vite_plugin_css_injected_by_js_1.default)({
619
+ topExecutionPriority: true,
620
+ relativeCSSInjection: true,
621
+ }),
622
+ bundleAnalyzerPlugin,
623
+ ];
624
+ return plugins.filter(Boolean);
625
+ }
626
+ //# sourceMappingURL=getTrackunitIrisAppVitePlugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTrackunitIrisAppVitePlugins.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/utils/getTrackunitIrisAppVitePlugins.ts"],"names":[],"mappings":";;AAyNA,wEAugBC;;AAhuBD,kDAAqD;AACrD,wFAA0E;AAE1E,kFAa6C;AAC7C,wFAA6C;AAC7C,oDAA8B;AAE9B,wDAAkC;AAClC,+BAAgH;AAChH,sFAA0C;AAC1C,4GAAmE;AAEnE,uFAAuF;AACvF,qEAAqE;AAErE,6DAA6D;AAC7D,MAAM,UAAU,GAA2B;IACzC,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,cAAc;CACvB,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAU,EAAE,CAC/C,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,0BAA0B,CAAC;AAEjF;;;GAGG;AACH,MAAM,qBAAqB,GAAG,CAAC,GAAW,EAAE,QAAyB,EAAE,aAAqB,EAAiB,EAAE;IAC7G,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;QACtC,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;YAClC,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACnD,MAAM,QAAQ,GAAG,IA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AAiF;IACjF,0FAA0F;IAC1F,iGAAiG;IACjG,MAAM,OAAO,GAAwB;QACnC,IAAA,wCAAa,GAAE;QACf,wEAAwE;QACxE,0EAA0E;QAC1E,+DAA+D;QAC/D,IAAA,0BAAK,EAAC,EAAE,CAAC;QACT,UAAU,IAAI,yBAAyB;QACvC,gBAAgB;QAChB,CAAC,OAAO,CAAC,gBAAgB;YACvB,IAAA,6BAAO,EAAC,EAAE,UAAU,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,mBAAmB,CAAC,EAAE,EAAE,CAAC;QAC3F,aAAa;QACb,2EAA2E;QAC3E,uEAAuE;QACvE,6FAA6F;QAC7F,yEAAyE;QACzE,IAAA,wCAAqB,EAAC;YACpB,oBAAoB,EAAE,IAAI;YAC1B,oBAAoB,EAAE,IAAI;SAC3B,CAAC;QACF,oBAAoB;KACrB,CAAC;IACF,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import { federation } from \"@module-federation/vite\";\nimport { nxViteTsPaths } from \"@nx/vite/plugins/nx-tsconfig-paths.plugin\";\nimport type { Exposes, IrisAppManifest, Shared } from \"@trackunit/iris-app-api\";\nimport {\n CopyPattern,\n createInvokeProxyMiddleware,\n enableTsConfigPath,\n getAvailablePort,\n getCopyPatterns,\n getExposedExtensions,\n getSharedDependencies,\n logInfo,\n ServerlessPortMap,\n updateCustomFields,\n updateExtensions,\n updateIndexHtml,\n} from \"@trackunit/iris-app-build-utilities\";\nimport react from \"@vitejs/plugin-react-swc\";\nimport * as fs from \"node:fs\";\nimport type { IncomingMessage, ServerResponse } from \"node:http\";\nimport * as path from \"node:path\";\nimport { mergeConfig, type PluginOption, type ResolvedConfig, type UserConfig, type ViteDevServer } from \"vite\";\nimport checker from \"vite-plugin-checker\";\nimport cssInjectedByJsPlugin from \"vite-plugin-css-injected-by-js\";\n\n// Only import enableTsConfigPath statically - other utilities are dynamically imported\n// AFTER tsconfig paths are registered to avoid oxc analysis warnings\n\n// MIME types for serving extension assets during development\nconst MIME_TYPES: Record<string, string> = {\n \".svg\": \"image/svg+xml\",\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\",\n \".webp\": \"image/webp\",\n \".ico\": \"image/x-icon\",\n};\n\nconst getMimeType = (filePath: string): string =>\n MIME_TYPES[path.extname(filePath).toLowerCase()] || \"application/octet-stream\";\n\n/**\n * Resolves a URL path like \"/{extensionId}/assets/icon.svg\" to the actual file path on disk.\n * Returns null if no matching extension is found or the file doesn't exist.\n */\nconst resolveExtensionAsset = (url: string, manifest: IrisAppManifest, workspaceRoot: string): string | null => {\n for (const ext of manifest.extensions) {\n if (url.startsWith(`/${ext.id}/`)) {\n const assetPath = url.substring(ext.id.length + 2);\n const filePath = path.join(workspaceRoot, ext.sourceRoot, assetPath);\n\n if (fs.existsSync(filePath) && fs.statSync(filePath).isFile()) {\n return filePath;\n }\n }\n }\n return null;\n};\n\ninterface TrackunitIrisAppVitePluginOptions {\n appDir: string;\n /** Path to the workspace root (where tsconfig.base.json is located) */\n workspaceRoot?: string;\n serverlessPortMap?: ServerlessPortMap;\n config: UserConfig;\n skipTypeChecking?: boolean;\n}\n\ninterface ViteSharedConfig {\n [key: string]: {\n singleton?: boolean;\n eager?: boolean;\n requiredVersion?: string;\n /** When false, the shared dependency is NOT bundled - it's loaded from the host at runtime */\n import?: false;\n };\n}\n\ninterface ViteExposesConfig {\n [key: string]: string;\n}\n\n// Flag to track if tsconfig paths have been registered\nlet tsconfigPathsRegistered = false;\n\n/**\n * Registers tsconfig paths for resolving @trackunit/* imports at runtime.\n * This is needed because the manifest file imports from @trackunit/* packages.\n */\nconst registerTsConfigPaths = (workspaceRoot: string, appDir: string): void => {\n if (tsconfigPathsRegistered) {\n return;\n }\n\n enableTsConfigPath({ projectRootDir: appDir, workspaceRoot });\n tsconfigPathsRegistered = true;\n};\n\n/**\n * Loads the Iris app manifest from the app directory.\n * Uses require() with cache clearing since Node.js doesn't support query strings in import paths.\n */\nconst loadManifest = (workspaceRoot: string, appDir: string): IrisAppManifest => {\n // Register tsconfig paths before loading the manifest\n registerTsConfigPaths(workspaceRoot, appDir);\n\n const manifestPath = path.join(appDir, \"iris-app-manifest.ts\");\n // Clear require cache to ensure fresh manifest on HMR\n try {\n delete require.cache[require.resolve(manifestPath)];\n } catch {\n // Ignore if not in cache\n }\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const manifestModule = require(manifestPath);\n manifestModule.default.moduleFormat = \"esm\";\n return manifestModule.default;\n};\n\n/**\n * Converts the shared dependencies from webpack format to Vite module federation format.\n * Handles both array and object variants of the Shared type.\n *\n * NOTE: We do NOT set `import: false` here because iris apps run in an iframe (separate\n * JavaScript context). The host's shared dependencies are NOT accessible across the iframe\n * boundary, so the iris app must bundle its own copies as a fallback. The `singleton: true`\n * config ensures that within the iframe context, only one instance is used.\n */\nconst convertSharedToViteFormat = (shared: Shared): ViteSharedConfig => {\n const result: ViteSharedConfig = {};\n\n const processItem = (item: unknown): void => {\n if (typeof item === \"string\") {\n // Bundle this dependency - iris apps need their own copy since they run in an iframe\n result[item] = {};\n } else if (item !== null && typeof item === \"object\") {\n for (const [key, value] of Object.entries(item)) {\n const baseConfig = typeof value === \"string\" ? {} : (value ?? {});\n // Remove import: false if it was set - we need to bundle shared deps for iframe isolation\n const { import: _import, ...restConfig } = baseConfig;\n result[key] = restConfig;\n }\n }\n };\n\n // Handle both array and object variants of Shared type\n if (Array.isArray(shared)) {\n for (const item of shared) {\n processItem(item);\n }\n } else {\n processItem(shared);\n }\n // For now we do not use any shared for vite build - as it create random crashes, it seemed like react was not garanteed to be loaded\n return {};\n // return result;\n};\n\n/**\n * Converts the webpack Exposes type to Vite's expected format.\n * getExposedExtensions returns an object with string values, but the Exposes type\n * is a union that includes arrays. This extracts just the object entries.\n *\n */\nconst convertExposesToViteFormat = (exposes: Exposes): ViteExposesConfig => {\n const result: ViteExposesConfig = {};\n\n if (typeof exposes === \"object\" && !Array.isArray(exposes)) {\n for (const [key, value] of Object.entries(exposes)) {\n if (typeof value === \"string\") {\n result[key] = value;\n }\n }\n }\n\n return result;\n};\n \nconst generateIndexHtml = ({\n manifest,\n packageJson,\n options,\n}: {\n manifest: IrisAppManifest;\n packageJson: string;\n options: TrackunitIrisAppVitePluginOptions;\n}): string => {\n // Register tsconfig paths to load the utility\n registerTsConfigPaths(options.workspaceRoot ?? options.appDir, options.appDir);\n\n // Only include dev scripts and React DevTools connection in development\n const devtools =\n options.config.mode === \"development\"\n ? `<script nonce=\"{{nonce}}\" src=\"http://localhost:8097\"></script>\n <script nonce=\"{{nonce}}\">\n // Polyfill for Node.js globals that some libraries expect\n if (typeof global === 'undefined') { window.global = window; }\n if (typeof process === 'undefined') { window.process = { env: {} }; }\n </script>\n`\n : `\n<script nonce=\"{{nonce}}\">\n // Polyfill for Node.js globals that some libraries expect\n if (typeof global === 'undefined') { window.global = window; }\n if (typeof process === 'undefined') { window.process = { env: {} }; }\n </script>`;\n\n return updateIndexHtml({ manifest, packageJson, devtools });\n};\n\n/**\n * Vite plugin that generates manifest.json, package.json, and index.html for Iris Apps.\n * This is the Vite equivalent of TrackunitIrisAppWebpackPlugin.\n *\n * Returns an array of plugins including Module Federation configuration.\n */\nexport async function getTrackunitIrisAppVitePlugins(\n options: TrackunitIrisAppVitePluginOptions\n): Promise<Array<PluginOption>> {\n const resolvedAppDir = path.resolve(options.appDir);\n const workspaceRoot = options.workspaceRoot ?? path.resolve(options.appDir, \"../..\");\n\n // Load manifest upfront for federation config\n const initialManifest = loadManifest(workspaceRoot, resolvedAppDir);\n\n // Get build utilities (tsconfig paths now registered via loadManifest)\n\n // Get an available port in the Iris app port range\n const port = await getAvailablePort(22220, 22229);\n\n // Get module federation configuration from manifest\n const webpackExposes = await getExposedExtensions({\n nxRootDir: workspaceRoot,\n manifest: initialManifest,\n });\n const shared = getSharedDependencies({ manifest: initialManifest });\n const viteExposes = convertExposesToViteFormat(webpackExposes);\n const viteShared = convertSharedToViteFormat(shared);\n const hasExposes = Object.keys(viteExposes).length > 0;\n\n // Only create the federation plugin when there are modules to expose.\n // @module-federation/vite deadlocks during build when exposes is empty because\n // its proxyRemoteEntry plugin waits for a module-parse promise that never resolves.\n let federationPlugin: PluginOption | null = null;\n if (hasExposes) {\n federationPlugin = federation({\n name: initialManifest.moduleFederationName,\n filename: \"remoteEntry.js\",\n library: { type: \"global\", name: initialManifest.moduleFederationName },\n exposes: viteExposes,\n shared: viteShared,\n remotes: {},\n manifest: false,\n dts: false,\n shareStrategy: \"loaded-first\",\n getPublicPath: `return (function() {\n var base;\n if (typeof import.meta !== 'undefined' && import.meta.url) {\n base = new URL('./', import.meta.url).href;\n } else if (typeof document !== 'undefined' && document.currentScript) {\n base = new URL('./', document.currentScript.src).href;\n } else {\n base = document.baseURI;\n }\n return base;\n })()`,\n });\n }\n\n // Conditionally create bundle analyzer plugin (same pattern as webpack/rspack)\n // Created here so we have access to the output directory path\n let bundleAnalyzerPlugin: PluginOption | null = null;\n if (process.env.BUNDLE_ANALYSE === \"true\") {\n // Compute output directory: dist/apps/{app-name}\n const appName = path.basename(resolvedAppDir);\n const statsPath = path.join(workspaceRoot, \"dist\", \"apps\", appName, \"stats.html\");\n\n // Dynamic ESM import for optional dependency\n const { visualizer } = await import(\"rollup-plugin-visualizer\");\n bundleAnalyzerPlugin = visualizer({\n filename: statsPath,\n template: \"treemap\",\n gzipSize: true,\n brotliSize: true,\n });\n\n // eslint-disable-next-line no-console\n console.log(`\\n📊 Bundle analyzer enabled - stats.html will be created at:\\n ${statsPath}\\n`);\n }\n\n // Plugin to disable hostAutoInit for pure remotes\n // The @module-federation/vite plugin always injects a hostAutoInit module\n // that auto-initializes the federation runtime. For pure remotes (Iris Apps),\n // we don't need this - the host handles initialization. This plugin intercepts\n // the virtual module and returns an empty module to prevent the build error.\n const disableHostAutoInitPlugin: PluginOption = {\n name: \"disable-host-auto-init\",\n enforce: \"pre\",\n resolveId(id) {\n // Match the hostAutoInit virtual module pattern: __H_A_I__hostAutoInit__H_A_I__\n if (id.includes(\"__H_A_I__hostAutoInit__H_A_I__\")) {\n return \"\\0virtual:empty-host-auto-init\";\n }\n return null;\n },\n load(id) {\n if (id === \"\\0virtual:empty-host-auto-init\") {\n // Return empty module - no auto-initialization needed for pure remotes\n return \"export default {}\";\n }\n return null;\n },\n };\n\n // Create the iris app plugin\n let config: ResolvedConfig;\n let manifest: IrisAppManifest | undefined = initialManifest;\n\n const reloadManifest = (): IrisAppManifest => {\n return loadManifest(workspaceRoot, resolvedAppDir);\n };\n\n const generateManifestJson = (manifestData: IrisAppManifest): IrisAppManifest => {\n // Register tsconfig paths to load utilities\n registerTsConfigPaths(workspaceRoot, resolvedAppDir);\n\n const manifestCopy = { ...manifestData };\n const appSrc = path.join(resolvedAppDir, \"src\");\n\n manifestCopy.customFieldDefinitions = updateCustomFields(manifestData.customFieldDefinitions, appSrc);\n manifestCopy.extensions = updateExtensions([...manifestData.extensions]);\n return manifestCopy;\n };\n\n // No explicit type annotation to avoid excessive stack depth error with federation plugin's complex types\n const irisAppPlugin = {\n name: \"trackunit-iris-app-vite-configuration\",\n\n config(conf: UserConfig) {\n // Base config for both serve and build\n const baseConfig: UserConfig = {\n // Use empty base for runtime URL resolution - assets will use relative paths\n base: \"\",\n // Runtime URL resolution - equivalent to rspack's publicPath: \"auto\"\n // Uses document.currentScript to determine base URL at runtime\n experimental: {\n renderBuiltUrl(filename, { hostType }) {\n // CSS files cannot execute JavaScript runtime expressions - use relative paths instead\n // This applies to fonts, images, and other assets referenced via url() in CSS\n if (hostType === \"css\") {\n return { relative: true };\n }\n // For JS/HTML, use runtime resolution using document.currentScript (like webpack/rspack's publicPath: \"auto\")\n return {\n runtime: `((function() {\n return document.baseURI + ${JSON.stringify(filename)};\n })())`,\n };\n },\n },\n // PostCSS configuration for Tailwind CSS v4\n // Using @tailwindcss/postcss instead of @tailwindcss/vite for better monorepo support\n css: {\n postcss: {\n plugins: [require(\"@tailwindcss/postcss\")({})],\n },\n },\n server: {\n port,\n host: \"localhost\",\n // Enable CORS for cross-origin requests from new.manager.trackunit.com\n cors: {\n origin: true, // Reflect request origin (supports all origins)\n credentials: true,\n methods: [\"GET\", \"POST\", \"PUT\", \"DELETE\", \"OPTIONS\"],\n allowedHeaders: [\n \"X-Requested-With\",\n \"baggage\",\n \"content-type\",\n \"Authorization\",\n \"sentry-trace\",\n \"session-id\",\n \"commit-number\",\n \"x-trackunitappversion\",\n ],\n maxAge: 3600,\n },\n },\n // Production build optimization\n build: {\n // Use esbuild for fast minification (Vite's default)\n minify: \"esbuild\",\n // CSS code splitting is required for relativeCSSInjection to work\n // (cssInjectedByJsPlugin enforces cssCodeSplit: true when relativeCSSInjection is enabled)\n // Each chunk's CSS is injected when that chunk loads - ideal for Module Federation\n // NOTE: We don't set cssCodeSplit here because the plugin controls it\n cssCodeSplit: true,\n rollupOptions: {\n output: {\n // Chunk splitting strategy - bundle small modules together to reduce HTTP requests\n manualChunks(id: string) {\n // Skip Module Federation virtual modules and runtime - let MF handle these\n if (\n id.includes(\"__mf__virtual\") ||\n id.includes(\"@mf-types\") ||\n id.includes(\"virtualExposes\") ||\n id.includes(\"virtual_mf-exposes\") ||\n id.includes(\"remoteEntry\") ||\n id.includes(\"_mf_\")\n ) {\n return undefined;\n }\n\n // Skip node_modules - let Rollup handle vendor chunking\n if (id.includes(\"node_modules\")) {\n return undefined;\n }\n\n // 1. Split translations per language (like Rspack's splitChunks cacheGroups)\n const translationMatch = id.match(/[\\\\/]locales[\\\\/]([^/\\\\]+)[\\\\/]translation\\.json$/);\n if (translationMatch) {\n return `translations-${translationMatch[1]}`;\n }\n\n // Let Rollup handle everything else - default chunking is fine\n // Vite/Rollup will merge small chunks automatically\n return undefined;\n },\n },\n },\n },\n };\n\n return mergeConfig(conf, baseConfig, false); // false = don't concatenate root-level arrays\n },\n\n configResolved(resolvedConfig: ResolvedConfig) {\n config = resolvedConfig;\n },\n buildStart() {\n manifest = reloadManifest();\n },\n\n configureServer(server: ViteDevServer) {\n // Route /invoke requests to local serverless extensions when available.\n server.middlewares.use(\"/invoke\", createInvokeProxyMiddleware(options.serverlessPortMap));\n\n // Serve extension assets from source during development (/{extensionId}/... → {sourceRoot}/...)\n server.middlewares.use((req: IncomingMessage, res: ServerResponse, next: () => void) => {\n const url = req.url?.split(\"?\")[0] ?? \"/\";\n const filePath = resolveExtensionAsset(url, manifest ?? reloadManifest(), workspaceRoot);\n\n if (filePath) {\n res.setHeader(\"Content-Type\", getMimeType(filePath));\n res.end(fs.readFileSync(filePath));\n return;\n }\n next();\n });\n\n // Global CORS headers middleware - must be first to set headers on all responses\n server.middlewares.use((req: IncomingMessage, res: ServerResponse, next: () => void) => {\n // Set Access-Control-Allow-Origin based on request origin (needed for CORS preflight)\n const origin = req.headers.origin || \"https://dev.manager.trackunit.com\";\n res.setHeader(\"Access-Control-Allow-Origin\", origin);\n res.setHeader(\"Access-Control-Allow-Credentials\", \"true\");\n res.setHeader(\"Access-Control-Max-Age\", \"3600\");\n res.setHeader(\"Access-Control-Allow-Methods\", \"GET, POST, PUT, DELETE, OPTIONS\");\n res.setHeader(\n \"Access-Control-Allow-Headers\",\n \"X-Requested-With, baggage, content-type, Authorization, sentry-trace, session-id, commit-number, x-trackunitappversion\"\n );\n next();\n });\n\n // IMPORTANT: This middleware must be synchronous for requests we want to pass through to Vite.\n // Async middlewares break Connect's middleware chain when calling next().\n // We use a sync wrapper and only do async work for routes we handle ourselves.\n server.middlewares.use((req: IncomingMessage, res: ServerResponse, next: () => void) => {\n const url = req.url?.split(\"?\")[0] ?? \"/\";\n\n // Let Vite handle its internal routes (@fs, @vite, @react-refresh, node_modules, etc.)\n // MUST call next() synchronously for these to work properly\n const isViteInternal =\n url.startsWith(\"/@\") ||\n url.startsWith(\"/node_modules/\") ||\n url.startsWith(\"/__mf__virtual/\") ||\n url.startsWith(\"/__vite\");\n if (isViteInternal) {\n next();\n return;\n }\n\n // CORS preflight handler - respond to OPTIONS requests\n if (req.method === \"OPTIONS\") {\n res.statusCode = 204;\n res.end();\n return;\n }\n\n // For non-GET/HEAD/OPTIONS on root path, return allowed methods\n if (req.url?.endsWith(\"/\") && req.method !== \"GET\" && req.method !== \"HEAD\") {\n res.end(\"GET, HEAD\");\n return;\n }\n\n // Serve manifest.json during development (async route - handle response ourselves)\n if (req.url === \"/manifest.json\") {\n void (async () => {\n try {\n manifest = reloadManifest();\n const manifestJson = generateManifestJson(manifest);\n\n res.setHeader(\"Content-Type\", \"application/json\");\n res.end(JSON.stringify(manifestJson, null, 2));\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Error generating manifest.json:\", error);\n res.statusCode = 500;\n res.end(String(error));\n }\n })();\n return; // Don't call next() - we're handling this route\n }\n\n // Serve package.json during development\n if (req.url === \"/package.json\") {\n try {\n const packageJsonPath = path.join(resolvedAppDir, \"package.json\");\n const packageJson = fs.readFileSync(packageJsonPath, \"utf8\");\n\n res.setHeader(\"Content-Type\", \"application/json\");\n res.end(packageJson);\n return;\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Error serving package.json:\", error);\n }\n }\n\n // Serve manifestAndToken during development (async route - handle response ourselves)\n if (req.url?.startsWith(\"/manifestAndToken\")) {\n void (async () => {\n try {\n const host = req.headers.host || \"localhost\";\n const resp = await fetch(`http://${host}/manifest.json`);\n const body = await resp.json();\n res.setHeader(\"Content-Type\", \"application/json\");\n res.end(JSON.stringify({ manifest: body }));\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"ERROR: \", e);\n res.statusCode = 500;\n res.end(String(e));\n }\n })();\n return; // Don't call next() - we're handling this route\n }\n\n // Serve extensionloader.js during development (async route - handle response ourselves)\n if (req.url?.startsWith(\"/extensionloader.js\")) {\n void (async () => {\n try {\n // To test extensionloader locally set LOCAL=true in front of the serve command\n let loaderUrl = \"https://iris.trackunit.app/extensionloader.js\";\n if (process.env.LOCAL === \"true\") {\n loaderUrl = \"http://localhost:3000/extensionloader.js\";\n }\n const resp = await fetch(loaderUrl);\n const body = await resp.text();\n res.setHeader(\"Content-Type\", \"application/javascript\");\n res.end(body);\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"ERROR: \", e);\n res.statusCode = 500;\n res.end(String(e));\n }\n })();\n return; // Don't call next() - we're handling this route\n }\n\n // Serve generated index.html for root path and SPA fallback routes\n // This handles the case where no physical index.html exists (async route - handle response ourselves)\n if (req.method === \"GET\") {\n const acceptsHtml = req.headers.accept?.includes(\"text/html\");\n const hasExtension = /\\.\\w+$/.test(url);\n const isRootOrSpaRoute = url === \"/\" || url === \"/index.html\" || (!hasExtension && acceptsHtml);\n\n if (isRootOrSpaRoute) {\n void (async () => {\n try {\n manifest = reloadManifest();\n const packageJsonPath = path.join(resolvedAppDir, \"package.json\");\n const packageJson = fs.readFileSync(packageJsonPath, \"utf8\");\n const html = generateIndexHtml({ manifest, packageJson, options });\n\n const transformedHtml = await server.transformIndexHtml(req.url ?? \"/\", html);\n res.setHeader(\"Content-Type\", \"text/html\");\n res.end(transformedHtml);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Error generating index.html:\", error);\n res.statusCode = 500;\n res.end(String(error));\n }\n })();\n return; // Don't call next() - we're handling this route\n }\n }\n next();\n });\n\n // Log success message when server starts\n server.httpServer?.once(\"listening\", () => {\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 }, 100);\n });\n },\n\n generateBundle() {\n if (!manifest) {\n manifest = reloadManifest();\n }\n\n const packageJsonPath = path.join(resolvedAppDir, \"package.json\");\n const packageJson = fs.readFileSync(packageJsonPath, \"utf8\");\n\n // Generate and emit manifest.json\n const manifestJson = generateManifestJson(manifest);\n this.emitFile({\n type: \"asset\",\n fileName: \"manifest.json\",\n source: JSON.stringify(manifestJson, null, 2),\n });\n\n // Emit package.json\n this.emitFile({\n type: \"asset\",\n fileName: \"package.json\",\n source: packageJson,\n });\n\n const html = generateIndexHtml({ manifest, packageJson, options });\n this.emitFile({\n type: \"asset\",\n fileName: \"index.html\",\n source: html,\n });\n },\n\n closeBundle() {\n if (config.command === \"build\") {\n const manifestForCopy = manifest ?? reloadManifest();\n const copyPatterns = getCopyPatterns({\n nxRootDir: workspaceRoot,\n appDir: resolvedAppDir,\n manifest: manifestForCopy,\n mode: \"production\",\n });\n\n const nonExistingPatterns: Array<CopyPattern> = [];\n for (const pattern of copyPatterns) {\n const exists = fs.existsSync(pattern.from);\n if (!exists) {\n nonExistingPatterns.push(pattern);\n }\n }\n if (nonExistingPatterns.length > 0) {\n throw new Error(`Copy patterns do not exist: ${nonExistingPatterns.map(p => p.from).join(\", \")}`);\n }\n\n for (const pattern of copyPatterns) {\n try {\n if (fs.existsSync(pattern.from)) {\n const stat = fs.statSync(pattern.from);\n if (stat.isDirectory()) {\n // Copy directory recursively\n fs.cpSync(pattern.from, pattern.to, { recursive: true });\n } else {\n // Copy single file\n const targetDir = path.dirname(pattern.to);\n if (!fs.existsSync(targetDir)) {\n fs.mkdirSync(targetDir, { recursive: true });\n }\n fs.copyFileSync(pattern.from, pattern.to);\n }\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(`Error: Could not copy ${pattern.from} to ${pattern.to}:`, error);\n throw error;\n }\n }\n }\n },\n };\n\n // Return array of plugins:\n // 1. nxViteTsPaths - handles tsconfig path resolution\n // 2. disableHostAutoInitPlugin - intercepts hostAutoInit virtual module (must be before federation)\n // 3. federationPlugin - Module Federation for micro-frontends\n // 4. irisAppPlugin - Iris App specific handling\n // 5. cssInjectedByJsPlugin - Vite equivalent of rspack's \"style-loader\"\n // Injects CSS via JS as inline <style> tags instead of external CSS files\n // 6. bundleAnalyzerPlugin - optional bundle analysis\n //\n // NOTE: Tailwind CSS is configured via PostCSS (in baseConfig.css.postcss above)\n // NOT using @tailwindcss/vite because it doesn't respect tailwind.config.js content paths\n // PostCSS approach matches Rspack and properly uses getTailwindContentForApp() from config files\n const plugins: Array<PluginOption> = [\n nxViteTsPaths(),\n // React Fast Refresh — enables HMR for React components so file changes\n // are hot-swapped without a full page reload. Safe with Module Federation\n // because Iris apps bundle their own React (iframe isolation).\n react({}),\n hasExposes && disableHostAutoInitPlugin,\n federationPlugin,\n !options.skipTypeChecking &&\n checker({ typescript: { tsconfigPath: path.join(resolvedAppDir, \"tsconfig.app.json\") } }),\n irisAppPlugin,\n // Equivalent to rspack's style-loader - injects CSS as inline <style> tags\n // topExecutionPriority ensures CSS is injected before other code runs,\n // relativeCSSInjection: true ensures CSS is injected per chunk (requires cssCodeSplit: true)\n // This is ideal for Module Federation - CSS loads with each remote chunk\n cssInjectedByJsPlugin({\n topExecutionPriority: true,\n relativeCSSInjection: true,\n }),\n bundleAnalyzerPlugin,\n ];\n return plugins.filter(Boolean);\n}\n"]}
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // eslint-disable-next-line local-rules/no-internal-barrel-files
3
- // dummy file to build - as Iris apps are module federation apps.
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/utils/index.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,iEAAiE","sourcesContent":["// eslint-disable-next-line local-rules/no-internal-barrel-files\n// dummy file to build - as Iris apps are module federation apps."]}