@trackunit/iris-app-sdk-vite 1.4.15 ā 1.4.17-alpha-8f80d2f100d.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -13
- package/package.json +4 -4
- package/src/executors/build/executor.js +3 -2
- package/src/executors/build/executor.js.map +1 -1
- package/src/executors/build/schema.json +4 -3
- package/src/executors/serve/executor.js +3 -2
- package/src/executors/serve/executor.js.map +1 -1
- package/src/executors/serve/schema.json +4 -3
- package/src/executors/utils/defaultViteConfig.js +2 -2
- package/src/executors/utils/defaultViteConfig.js.map +1 -1
- package/src/executors/utils/getTrackunitIrisAppVitePlugins.js +1 -1
- package/src/executors/utils/getTrackunitIrisAppVitePlugins.js.map +1 -1
- package/src/executors/utils/resolve-type-check-options.js +7 -0
- package/src/executors/utils/resolve-type-check-options.js.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
## 1.4.15 (2026-08-21)
|
|
2
|
-
|
|
3
|
-
### š§± Updated Dependencies
|
|
4
|
-
|
|
5
|
-
- Updated iris-app to 2.5.15
|
|
6
|
-
|
|
7
|
-
## 1.4.14 (2026-08-20)
|
|
8
|
-
|
|
9
|
-
### š§± Updated Dependencies
|
|
10
|
-
|
|
11
|
-
- Updated iris-app-build-utilities to 2.4.14
|
|
12
|
-
- Updated iris-app to 2.5.14
|
|
13
|
-
|
|
14
1
|
## 1.4.13 (2026-08-20)
|
|
15
2
|
|
|
16
3
|
### š§± Updated Dependencies
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/iris-app-sdk-vite",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.17-alpha-8f80d2f100d.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"repository": "https://github.com/Trackunit/manager",
|
|
6
6
|
"executors": "./executors.json",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"rxjs": "7.8.1",
|
|
12
12
|
"win-ca": "^3.5.1",
|
|
13
|
-
"@trackunit/iris-app-build-utilities": "2.4.
|
|
14
|
-
"@trackunit/iris-app-api": "2.4.
|
|
13
|
+
"@trackunit/iris-app-build-utilities": "2.4.16-alpha-8f80d2f100d.0",
|
|
14
|
+
"@trackunit/iris-app-api": "2.4.11-alpha-8f80d2f100d.0",
|
|
15
15
|
"tslib": "^2.6.2",
|
|
16
16
|
"vite": "8.1.5",
|
|
17
17
|
"@module-federation/vite": "1.18.1",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@tailwindcss/postcss": "^4.1.18",
|
|
23
23
|
"@vitejs/plugin-react-swc": "^4.3.2",
|
|
24
24
|
"@nx/devkit": "23.1.0",
|
|
25
|
-
"@trackunit/iris-app": "2.5.
|
|
25
|
+
"@trackunit/iris-app": "2.5.17-alpha-8f80d2f100d.0",
|
|
26
26
|
"cross-keychain": "^1.1.0",
|
|
27
27
|
"jwt-decode": "^3.1.2"
|
|
28
28
|
},
|
|
@@ -11,6 +11,7 @@ const op = tslib_1.__importStar(require("rxjs/operators"));
|
|
|
11
11
|
require("win-ca");
|
|
12
12
|
const defaultViteConfig_1 = require("../utils/defaultViteConfig");
|
|
13
13
|
const manifestLoader_1 = require("../utils/manifestLoader");
|
|
14
|
+
const resolve_type_check_options_1 = require("../utils/resolve-type-check-options");
|
|
14
15
|
const resolveSdkVersion_1 = require("../utils/resolveSdkVersion");
|
|
15
16
|
const deleteOutputDir = (root, outputPath) => {
|
|
16
17
|
const resolvedOutputPath = (0, path_1.resolve)(root, outputPath);
|
|
@@ -28,7 +29,7 @@ const deleteOutputDir = (root, outputPath) => {
|
|
|
28
29
|
*/
|
|
29
30
|
async function* buildExecutor(options, context) {
|
|
30
31
|
await (0, iris_app_build_utilities_1.checkPackageVersion)(false);
|
|
31
|
-
const
|
|
32
|
+
const shouldTypeCheck = (0, resolve_type_check_options_1.resolveTypeCheckOptions)(options);
|
|
32
33
|
// eslint-disable-next-line @trackunit/no-typescript-assertion, @typescript-eslint/no-non-null-assertion
|
|
33
34
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
34
35
|
const projectRootDir = (0, path_1.join)(context.root, projectRoot);
|
|
@@ -52,7 +53,7 @@ async function* buildExecutor(options, context) {
|
|
|
52
53
|
// Advisory: warn when past the content-inset cutoff without `p-content-space`.
|
|
53
54
|
(0, iris_app_build_utilities_1.checkContentInsetAdoption)(sdkVersion, projectRootDir);
|
|
54
55
|
const defaultConfig = await (0, defaultViteConfig_1.getDefaultViteConfig)("production", context.root, projectRootDir, IrisAppManifest, context, {
|
|
55
|
-
|
|
56
|
+
shouldTypeCheck,
|
|
56
57
|
});
|
|
57
58
|
// Load optional custom config
|
|
58
59
|
let finalConfig = defaultConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/build/executor.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/build/executor.ts"],"names":[],"mappings":";;AAsCA,gCAoHC;;AAzJD,kDAAoD;AACpD,kFAI6C;AAC7C,2BAAwC;AACxC,+BAAqC;AACrC,+BAAkC;AAClC,2DAAqC;AACrC,kBAAgB;AAChB,kEAAkE;AAClE,4DAA4E;AAC5E,oFAA8E;AAC9E,kEAA+D;AAQ/D,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,EA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AO,KAAK,CAAC,CAAC,IAAA,wBAAa,EAAC,UAAU,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import { ExecutorContext } from \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/devkit/internal\";\nimport {\n checkContentInsetAdoption,\n checkPackageVersion,\n enableTsConfigPath,\n} 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 { closeManifestLoader, loadManifest } from \"../utils/manifestLoader\";\nimport { resolveTypeCheckOptions } from \"../utils/resolve-type-check-options\";\nimport { resolveSdkVersion } from \"../utils/resolveSdkVersion\";\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 const shouldTypeCheck = resolveTypeCheckOptions(options);\n\n // eslint-disable-next-line @trackunit/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\n // The app's own `vite.config.ts` is pulled in with a CommonJS `require` below,\n // which needs the TypeScript require hooks and the workspace's path aliases.\n enableTsConfigPath({ projectRootDir, workspaceRoot: context.root });\n\n // `loadManifest` lives in the shared loader module so specs can intercept the\n // import via `vi.mock(\"../utils/manifestLoader\", ...)`. Previously the\n // manifest was imported in-line via `await import(manifestPath)`, which Node's\n // resolver could not satisfy against the synthetic `/workspace/...` paths used\n // by the spec - the import threw before the spec's beforeEach `vi.mock(...)`\n // had any chance to intercept it.\n const IrisAppManifest = await loadManifest(context.root, projectRootDir);\n\n // Stamp the *installed* `@trackunit/iris-app` version (not the declared\n // range) so the host can decide content-inset behaviour from the published\n // manifest. Fail-soft: absent version keeps the legacy-inset default.\n const sdkVersion = resolveSdkVersion(projectRootDir);\n if (sdkVersion !== undefined) {\n IrisAppManifest.sdkVersion = sdkVersion;\n }\n // Advisory: warn when past the content-inset cutoff without `p-content-space`.\n checkContentInsetAdoption(sdkVersion, projectRootDir);\n\n const defaultConfig = await getDefaultViteConfig(\n \"production\",\n context.root,\n projectRootDir,\n IrisAppManifest,\n context,\n {\n shouldTypeCheck,\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 // The loader holds a Vite server open; without this the process never exits.\n op.finalize(() => {\n void closeManifestLoader();\n })\n );\n\n return yield* eachValueFrom(observable);\n}\n"]}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"title": "Build executor for Iris Apps using Vite",
|
|
6
6
|
"description": "Builds an Iris App using Vite",
|
|
7
7
|
"type": "object",
|
|
8
|
+
"additionalProperties": false,
|
|
8
9
|
"properties": {
|
|
9
10
|
"viteConfig": {
|
|
10
11
|
"type": "string",
|
|
@@ -19,10 +20,10 @@
|
|
|
19
20
|
"type": "string",
|
|
20
21
|
"description": "Output directory for the build"
|
|
21
22
|
},
|
|
22
|
-
"
|
|
23
|
+
"typeCheckOptions": {
|
|
23
24
|
"type": "boolean",
|
|
24
|
-
"description": "
|
|
25
|
-
"default":
|
|
25
|
+
"description": "Run TypeScript type checking during the build. `false` skips checking; omitted or `true` type-checks.",
|
|
26
|
+
"default": true
|
|
26
27
|
}
|
|
27
28
|
},
|
|
28
29
|
"required": ["outputPath"]
|
|
@@ -13,6 +13,7 @@ require("win-ca");
|
|
|
13
13
|
const checkCustomFields_1 = require("../utils/checkCustomFields");
|
|
14
14
|
const defaultViteConfig_1 = require("../utils/defaultViteConfig");
|
|
15
15
|
const manifestLoader_1 = require("../utils/manifestLoader");
|
|
16
|
+
const resolve_type_check_options_1 = require("../utils/resolve-type-check-options");
|
|
16
17
|
const resolveSdkVersion_1 = require("../utils/resolveSdkVersion");
|
|
17
18
|
/**
|
|
18
19
|
* Serve executor for serving Iris Apps with Vite.
|
|
@@ -24,7 +25,7 @@ const resolveSdkVersion_1 = require("../utils/resolveSdkVersion");
|
|
|
24
25
|
async function* serveExecutor(options, context) {
|
|
25
26
|
await (0, iris_app_build_utilities_1.checkPackageVersion)(false);
|
|
26
27
|
const settings = (0, iris_app_1.getSettings)();
|
|
27
|
-
const
|
|
28
|
+
const shouldTypeCheck = (0, resolve_type_check_options_1.resolveTypeCheckOptions)(options);
|
|
28
29
|
// eslint-disable-next-line @trackunit/no-typescript-assertion, @typescript-eslint/no-non-null-assertion
|
|
29
30
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
30
31
|
const projectRootDir = (0, path_1.join)(context.root, projectRoot);
|
|
@@ -67,7 +68,7 @@ async function* serveExecutor(options, context) {
|
|
|
67
68
|
// Get default config (internally imports @trackunit/iris-app-vite-plugin)
|
|
68
69
|
const defaultConfig = await (0, defaultViteConfig_1.getDefaultViteConfig)("development", context.root, projectRootDir, irisAppManifest, context, {
|
|
69
70
|
serversidePortMap: serversideResult.portMap,
|
|
70
|
-
|
|
71
|
+
shouldTypeCheck,
|
|
71
72
|
// Surface a persistent rebuild reminder when the in-sync check was skipped.
|
|
72
73
|
degraded: checkCustomFieldsResult === "unverified",
|
|
73
74
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/serve/executor.ts"],"names":[],"mappings":";;AA6BA,gCAyJC;;AArLD,kDAAoD;AACpD,kDAAkD;AAElD,kFAK6C;AAC7C,2BAAgC;AAChC,+BAA4B;AAC5B,+BAAkC;AAClC,2DAAqC;AACrC,kBAAgB;AAChB,kEAA+D;AAC/D,kEAAkE;AAClE,4DAA4E;AAC5E,kEAA+D;AAI/D;;;;;;GAMG;AACY,KAAK,SAAS,CAAC,CAAC,aAAa,CAC1C,OAA4B,EAC5B,OAAwB;IAExB,MAAM,IAAA,8CAAmB,EAAC,KAA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,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,CACV,0CAA0C,OAAO,kBAAkB,eAAe,CAAC,oBAAoB,IAAI,CAC5G,CAAC;QACJ,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;YAC3B,KAAK,IAAA,oCAAmB,GAAE,CAAC;QAC7B,CAAC,CAAC,CACH,CAAC;QAEF,OAAO,KAAK,CAAC,CAAC,IAAA,wBAAa,EAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAA,oCAAmB,GAAE,CAAC;QAC5B,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { ExecutorContext } from \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/devkit/internal\";\nimport { getSettings } from \"@trackunit/iris-app\";\nimport { IrisAppManifest } from \"@trackunit/iris-app-api\";\nimport {\n checkContentInsetAdoption,\n checkPackageVersion,\n enableTsConfigPath,\n spawnServersideExtensions,\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 { checkCustomFields } from \"../utils/checkCustomFields\";\nimport { getDefaultViteConfig } from \"../utils/defaultViteConfig\";\nimport { closeManifestLoader, loadManifest } from \"../utils/manifestLoader\";\nimport { resolveSdkVersion } from \"../utils/resolveSdkVersion\";\nimport { ServeExecutorSchema } from \"./schema\";\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 const settings = getSettings();\n const skipTypeChecking = options.skipTypeChecking ?? false;\n\n // eslint-disable-next-line @trackunit/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\n // The app's own `vite.config.ts` is pulled in with a CommonJS `require` below,\n // which needs the TypeScript require hooks and the workspace's path aliases.\n enableTsConfigPath({ projectRootDir, workspaceRoot: context.root });\n\n // `loadManifest` lives in the shared loader module so specs can intercept the\n // import via `vi.mock(\"../utils/manifestLoader\", ...)`. Previously the\n // manifest was imported in-line via `await import(manifestPath)`, which Node's\n // resolver could not satisfy against the synthetic `/workspace/...` paths used\n // by the spec - the import threw before the spec's beforeEach `vi.mock(...)`\n // had any chance to intercept it.\n const irisAppManifest: IrisAppManifest = await loadManifest(context.root, projectRootDir);\n\n // Stamp the installed SDK version so serve's published /manifest.json matches\n // production builds (plugin also refreshes on emit after disk reloads).\n const sdkVersion = resolveSdkVersion(projectRootDir);\n if (sdkVersion !== undefined) {\n irisAppManifest.sdkVersion = sdkVersion;\n }\n // Advisory: warn when past the content-inset cutoff without `p-content-space`.\n checkContentInsetAdoption(sdkVersion, projectRootDir);\n\n const checkCustomFieldsResult = await checkCustomFields(irisAppManifest, settings);\n if (checkCustomFieldsResult === \"out-of-sync\") {\n throw new Error(\n \"Custom fields are out of sync with the latest approved manifest, which can cause the app to behave in unexpected ways. Please submit and get this version approved before you continue developing the app.\"\n );\n }\n if (checkCustomFieldsResult === \"not-submitted\") {\n throw new Error(\n \"Custom fields are not submitted, which can cause the app to behave in unexpected ways. Please submit and get this version approved before you continue developing the app.\"\n );\n }\n if (checkCustomFieldsResult === \"unverified\") {\n // The check could not be completed (network/auth/server failure). This is\n // non-fatal for local development: warn loudly and continue serving rather\n // than crashing. The underlying reason was already logged by checkCustomFields.\n // eslint-disable-next-line no-console\n console.warn(\n \"\\n ā ļø Custom-field in-sync check was skipped ā the latest approved manifest could not be verified \" +\n \"(see the warning above). The dev server will start, but your custom fields were NOT validated against the approved manifest. \" +\n \"If your local custom field definitions are out of sync, the app may behave in unexpected ways.\\n\"\n );\n }\n\n const serversideResult = await spawnServersideExtensions(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 serversidePortMap: serversideResult.portMap,\n skipTypeChecking,\n // Surface a persistent rebuild reminder when the in-sync check was skipped.\n degraded: checkCustomFieldsResult === \"unverified\",\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 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 `\\n š Iris App dev server running at: ${baseUrl} for iris app: ${irisAppManifest.moduleFederationName}\\n`\n );\n }),\n op.map(({ baseUrl, success }) => ({\n baseUrl,\n success,\n })),\n op.finalize(() => {\n serversideResult.cleanup();\n void closeManifestLoader();\n })\n );\n\n return yield* eachValueFrom(observable);\n } catch (error) {\n serversideResult.cleanup();\n await closeManifestLoader();\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":";;AA8BA,gCAyJC;;AAtLD,kDAAoD;AACpD,kDAAkD;AAElD,kFAK6C;AAC7C,2BAAgC;AAChC,+BAA4B;AAC5B,+BAAkC;AAClC,2DAAqC;AACrC,kBAAgB;AAChB,kEAA+D;AAC/D,kEAAkE;AAClE,4DAA4E;AAC5E,oFAA8E;AAC9E,kEAA+D;AAI/D;;;;;;GAMG;AACY,KAAK,SAAS,CAAC,CAAC,aAAa,CAC1C,OAA4B,E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,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,CACV,0CAA0C,OAAO,kBAAkB,eAAe,CAAC,oBAAoB,IAAI,CAC5G,CAAC;QACJ,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;YAC3B,KAAK,IAAA,oCAAmB,GAAE,CAAC;QAC7B,CAAC,CAAC,CACH,CAAC;QAEF,OAAO,KAAK,CAAC,CAAC,IAAA,wBAAa,EAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAA,oCAAmB,GAAE,CAAC;QAC5B,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { ExecutorContext } from \"@nx/devkit\";\nimport { eachValueFrom } from \"@nx/devkit/internal\";\nimport { getSettings } from \"@trackunit/iris-app\";\nimport { IrisAppManifest } from \"@trackunit/iris-app-api\";\nimport {\n checkContentInsetAdoption,\n checkPackageVersion,\n enableTsConfigPath,\n spawnServersideExtensions,\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 { checkCustomFields } from \"../utils/checkCustomFields\";\nimport { getDefaultViteConfig } from \"../utils/defaultViteConfig\";\nimport { closeManifestLoader, loadManifest } from \"../utils/manifestLoader\";\nimport { resolveTypeCheckOptions } from \"../utils/resolve-type-check-options\";\nimport { resolveSdkVersion } from \"../utils/resolveSdkVersion\";\nimport { ServeExecutorSchema } from \"./schema\";\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 const settings = getSettings();\n const shouldTypeCheck = resolveTypeCheckOptions(options);\n\n // eslint-disable-next-line @trackunit/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\n // The app's own `vite.config.ts` is pulled in with a CommonJS `require` below,\n // which needs the TypeScript require hooks and the workspace's path aliases.\n enableTsConfigPath({ projectRootDir, workspaceRoot: context.root });\n\n // `loadManifest` lives in the shared loader module so specs can intercept the\n // import via `vi.mock(\"../utils/manifestLoader\", ...)`. Previously the\n // manifest was imported in-line via `await import(manifestPath)`, which Node's\n // resolver could not satisfy against the synthetic `/workspace/...` paths used\n // by the spec - the import threw before the spec's beforeEach `vi.mock(...)`\n // had any chance to intercept it.\n const irisAppManifest: IrisAppManifest = await loadManifest(context.root, projectRootDir);\n\n // Stamp the installed SDK version so serve's published /manifest.json matches\n // production builds (plugin also refreshes on emit after disk reloads).\n const sdkVersion = resolveSdkVersion(projectRootDir);\n if (sdkVersion !== undefined) {\n irisAppManifest.sdkVersion = sdkVersion;\n }\n // Advisory: warn when past the content-inset cutoff without `p-content-space`.\n checkContentInsetAdoption(sdkVersion, projectRootDir);\n\n const checkCustomFieldsResult = await checkCustomFields(irisAppManifest, settings);\n if (checkCustomFieldsResult === \"out-of-sync\") {\n throw new Error(\n \"Custom fields are out of sync with the latest approved manifest, which can cause the app to behave in unexpected ways. Please submit and get this version approved before you continue developing the app.\"\n );\n }\n if (checkCustomFieldsResult === \"not-submitted\") {\n throw new Error(\n \"Custom fields are not submitted, which can cause the app to behave in unexpected ways. Please submit and get this version approved before you continue developing the app.\"\n );\n }\n if (checkCustomFieldsResult === \"unverified\") {\n // The check could not be completed (network/auth/server failure). This is\n // non-fatal for local development: warn loudly and continue serving rather\n // than crashing. The underlying reason was already logged by checkCustomFields.\n // eslint-disable-next-line no-console\n console.warn(\n \"\\n ā ļø Custom-field in-sync check was skipped ā the latest approved manifest could not be verified \" +\n \"(see the warning above). The dev server will start, but your custom fields were NOT validated against the approved manifest. \" +\n \"If your local custom field definitions are out of sync, the app may behave in unexpected ways.\\n\"\n );\n }\n\n const serversideResult = await spawnServersideExtensions(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 serversidePortMap: serversideResult.portMap,\n shouldTypeCheck,\n // Surface a persistent rebuild reminder when the in-sync check was skipped.\n degraded: checkCustomFieldsResult === \"unverified\",\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 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 `\\n š Iris App dev server running at: ${baseUrl} for iris app: ${irisAppManifest.moduleFederationName}\\n`\n );\n }),\n op.map(({ baseUrl, success }) => ({\n baseUrl,\n success,\n })),\n op.finalize(() => {\n serversideResult.cleanup();\n void closeManifestLoader();\n })\n );\n\n return yield* eachValueFrom(observable);\n } catch (error) {\n serversideResult.cleanup();\n await closeManifestLoader();\n throw error;\n }\n}\n"]}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"title": "Serve executor for Iris Apps using Vite",
|
|
6
6
|
"description": "Starts the Vite dev server for an Iris App",
|
|
7
7
|
"type": "object",
|
|
8
|
+
"additionalProperties": false,
|
|
8
9
|
"properties": {
|
|
9
10
|
"viteConfig": {
|
|
10
11
|
"type": "string",
|
|
@@ -24,10 +25,10 @@
|
|
|
24
25
|
"description": "Dev server host",
|
|
25
26
|
"default": "localhost"
|
|
26
27
|
},
|
|
27
|
-
"
|
|
28
|
+
"typeCheckOptions": {
|
|
28
29
|
"type": "boolean",
|
|
29
|
-
"description": "
|
|
30
|
-
"default":
|
|
30
|
+
"description": "Run TypeScript type checking during dev server. `false` skips checking; omitted or `true` type-checks.",
|
|
31
|
+
"default": true
|
|
31
32
|
}
|
|
32
33
|
},
|
|
33
34
|
"required": []
|
|
@@ -37,7 +37,7 @@ const virtualEntryPlugin = {
|
|
|
37
37
|
* @param context - NX executor context
|
|
38
38
|
* @returns {Promise<UserConfig>} the default Vite config
|
|
39
39
|
*/
|
|
40
|
-
const getDefaultViteConfig = async (mode, nxRootDir, appDir, irisAppManifest, context, options
|
|
40
|
+
const getDefaultViteConfig = async (mode, nxRootDir, appDir, irisAppManifest, context, options) => {
|
|
41
41
|
// Dynamic import - safe after enableTsConfigPath() is called
|
|
42
42
|
const irisAppPlugins = await (0, getTrackunitIrisAppVitePlugins_1.getTrackunitIrisAppVitePlugins)({
|
|
43
43
|
appDir,
|
|
@@ -48,7 +48,7 @@ const getDefaultViteConfig = async (mode, nxRootDir, appDir, irisAppManifest, co
|
|
|
48
48
|
manifest: irisAppManifest,
|
|
49
49
|
config: { mode },
|
|
50
50
|
serversidePortMap: options.serversidePortMap,
|
|
51
|
-
|
|
51
|
+
shouldTypeCheck: options.shouldTypeCheck,
|
|
52
52
|
degraded: options.degraded,
|
|
53
53
|
});
|
|
54
54
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultViteConfig.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/utils/defaultViteConfig.ts"],"names":[],"mappings":";;;AAIA,2DAAwD;AACxD,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;AASF;;;;;;;;;GASG;AACI,MAAM,oBAAoB,GAAG,KAAK,EACvC,IAAkC,EAClC,SAAiB,EACjB,MAAc,EACd,eAAgC,EAChC,OAAwB,EACxB,
|
|
1
|
+
{"version":3,"file":"defaultViteConfig.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/utils/defaultViteConfig.ts"],"names":[],"mappings":";;;AAIA,2DAAwD;AACxD,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;AASF;;;;;;;;;GASG;AACI,MAAM,oBAAoB,GAAG,KAAK,EACvC,IAAkC,EAClC,SAAiB,EACjB,MAAc,EACd,eAAgC,EAChC,OAAwB,EACxB,OAAoC,EACf,EAAE;IACvB,6DAA6D;IAE7D,MAAM,cAAc,GAAG,MAAM,IAAA,+DAA8B,EAAC;QAC1D,MAAM;QACN,aAAa,EAAE,S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ExecutorContext } from \"@nx/devkit\";\nimport type { IrisAppManifest } from \"@trackunit/iris-app-api\";\nimport type { ServersidePortMap } from \"@trackunit/iris-app-build-utilities\";\nimport type { PluginOption, UserConfig } from \"vite\";\nimport { svgSpriteInline } from \"../../svgSpriteInline\";\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 serversidePortMap?: ServersidePortMap;\n shouldTypeCheck: boolean;\n /** When true, register the plugin that re-warns about the skipped custom-field check on each rebuild. */\n degraded?: 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 (may already carry a stamped `sdkVersion`)\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 // Pass the executor-loaded (and possibly sdkVersion-stamped) manifest through so\n // federation config and the first emit seed share one object ā the plugin still\n // refreshes `sdkVersion` on every generateManifestJson after disk reloads.\n manifest: irisAppManifest,\n config: { mode },\n serversidePortMap: options.serversidePortMap,\n shouldTypeCheck: options.shouldTypeCheck,\n degraded: options.degraded,\n });\n\n return {\n root: appDir,\n mode,\n plugins: [svgSpriteInline(), ...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 rolldownOptions: {\n transform: {\n target: \"esnext\",\n },\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 // Vite 8's default minifier. \"esbuild\" would require esbuild as a separate\n // install, which generated Iris app workspaces do not have.\n minify: \"oxc\",\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"]}
|
|
@@ -676,7 +676,7 @@ async function getTrackunitIrisAppVitePlugins(options) {
|
|
|
676
676
|
(0, plugin_react_swc_1.default)({}),
|
|
677
677
|
hasExposes && disableHostAutoInitPlugin,
|
|
678
678
|
federationPlugin,
|
|
679
|
-
|
|
679
|
+
options.shouldTypeCheck === true &&
|
|
680
680
|
(0, vite_plugin_checker_1.default)({ typescript: { tsconfigPath: path.join(resolvedAppDir, "tsconfig.app.json") } }),
|
|
681
681
|
irisAppPlugin,
|
|
682
682
|
// Equivalent to rspack's style-loader - injects CSS as inline <style> tags
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTrackunitIrisAppVitePlugins.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/utils/getTrackunitIrisAppVitePlugins.ts"],"names":[],"mappings":";;AAyNA,wEA6mBC;;AAt0BD,kDAAqD;AACrD,wFAA0E;AAE1E,kFAc6C;AAC7C,wFAA6C;AAC7C,oDAA8B;AAE9B,wDAAkC;AAClC,+BAAgH;AAChH,sFAA0C;AAC1C,6FAAgG;AAChG,uDAAoG;AACpG,iEAAoE;AACpE,2EAAwE;AACxE,mDAAsD;AACtD,qDAAqF;AACrF,2DAAwD;AAExD,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,GA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CAAC,CAAC;wBAChF,MAAM,KAAK,CAAC;oBACd,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;IAEF,2BAA2B;IAC3B,sDAAsD;IACtD,oGAAoG;IACpG,8DAA8D;IAC9D,gDAAgD;IAChD,wEAAwE;IACxE,6EAA6E;IAC7E,qDAAqD;IACrD,EAAE;IACF,iFAAiF;IACjF,0FAA0F;IAC1F,8EAA8E;IAC9E,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,qBAAqB,CAAC;YACpB,oBAAoB,EAAE,IAAI;YAC1B,oBAAoB,EAAE,IAAI;SAC3B,CAAC;QACF,oBAAoB;QACpB,6EAA6E;QAC7E,8EAA8E;QAC9E,OAAO,CAAC,QAAQ,IAAI,IAAA,6EAAwC,EAAC,IAAI,CAAC;KACnE,CAAC;IACF,IAAA,2BAAS,EAAC,WAAW,CAAC,GAAG,EAAE,GAAG,uBAAuB,EAAE,+BAA+B,CAAC,CAAC;IACxF,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 injectFullDescriptionImages,\n logInfo,\n ServersidePortMap,\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 { createCustomFieldsDegradedReminderPlugin } from \"./customFieldsDegradedReminderPlugin\";\nimport { logEvent, logTiming, shortenPath, timeAsync, wrapResponseTiming } from \"./devServerTiming\";\nimport { createExtensionLoaderCache } from \"./extensionLoaderCache\";\nimport { loadCssInjectedByJsPlugin } from \"./loadCssInjectedByJsPlugin\";\nimport { createManifestCache } from \"./manifestCache\";\nimport { invalidateManifestSource, loadManifestWithSources } from \"./manifestLoader\";\nimport { resolveSdkVersion } from \"./resolveSdkVersion\";\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 /**\n * Manifest already loaded by the build/serve executor (optionally with a stamped\n * `sdkVersion`). When omitted the plugin loads from disk itself ā tests and\n * direct callers use that path.\n */\n manifest?: IrisAppManifest;\n serversidePortMap?: ServersidePortMap;\n config: UserConfig;\n skipTypeChecking?: boolean;\n /** When true, register the plugin that re-warns about the skipped custom-field check on each rebuild. */\n degraded?: 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 * 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 iframeRedirect =\n options.config.mode === \"development\"\n ? `<script nonce=\"{{nonce}}\">\n if (window.self === window.top) { window.location.replace(\"https://new.manager.trackunit.com/goto/iris-app-dev\"); }\n </script>`\n : \"\";\n\n const devtools =\n options.config.mode === \"development\"\n ? `<script nonce=\"{{nonce}}\" defer src=\"http://localhost:8097\"></script>\n ${iframeRedirect}\n <script nonce=\"{{nonce}}\">\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 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 pluginConstructionStart = performance.now();\n logEvent(\"plugin construction: started\");\n\n const resolvedAppDir = path.resolve(options.appDir);\n const workspaceRoot = options.workspaceRoot ?? path.resolve(options.appDir, \"../..\");\n\n // ESM-only since v5 (Vite 8). Load via file URL ā Nx CJS executor hooks cannot\n // resolve the package's import-only exports map.\n const cssInjectedByJsPlugin = await loadCssInjectedByJsPlugin(workspaceRoot);\n\n // Prefer the executor-provided manifest (may already carry stamped sdkVersion);\n // fall back to a fresh disk load for direct/plugin-only callers.\n const initialLoad =\n options.manifest === undefined\n ? await loadManifestWithSources(workspaceRoot, resolvedAppDir)\n : { manifest: options.manifest, sourcePaths: [] };\n const initialManifest = initialLoad.manifest;\n\n // Directories holding the sources the manifest was derived from. The dev\n // server's own watcher only covers the app root, but a manifest reads across\n // the workspace ā an `aiNavigation` catalog comes off a route tree in `libs/` ā\n // so those directories are watched explicitly or an edit there is never seen.\n // Deduplicated to directories because watching each of a few thousand files\n // individually is far more expensive for the same coverage.\n let watchedSourceDirectories = new Set(initialLoad.sourcePaths.map(sourcePath => path.dirname(sourcePath)));\n let devServer: ViteDevServer | undefined;\n\n const watchManifestSources = (): void => {\n if (devServer === undefined) {\n return;\n }\n for (const directory of watchedSourceDirectories) {\n devServer.watcher.add(directory);\n }\n };\n\n // Get an available port in the Iris app port range\n const port = await timeAsync(\"getAvailablePort\", () => getAvailablePort(22220, 22229));\n\n // Get module federation configuration from manifest\n const webpackExposes = await timeAsync(`getExposedExtensions (${initialManifest.extensions.length} extensions)`, () =>\n getExposedExtensions({\n nxRootDir: workspaceRoot,\n manifest: initialManifest,\n })\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\n const reloadManifest = async (): Promise<IrisAppManifest> => {\n const loaded = await loadManifestWithSources(workspaceRoot, resolvedAppDir);\n // A reload can pull in sources the previous one never reached, e.g. a route\n // file added since, so the watch set is widened to match.\n watchedSourceDirectories = new Set(loaded.sourcePaths.map(sourcePath => path.dirname(sourcePath)));\n watchManifestSources();\n\n return loaded.manifest;\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\n // Stamp (or refresh) the installed SDK version on every emit so serve HMR\n // reloads and production builds both publish it ā the build executor also\n // stamps before config construction, but this path reloads from disk.\n const sdkVersion = resolveSdkVersion(resolvedAppDir);\n if (sdkVersion !== undefined) {\n manifestCopy.sdkVersion = sdkVersion;\n }\n\n return injectFullDescriptionImages(manifestCopy, resolvedAppDir);\n };\n\n const manifestCache = createManifestCache({\n reloadManifest,\n generateManifestJson,\n initialManifest,\n });\n\n // The /extensionloader.js handler proxies to https://iris.trackunit.app\n // (or http://localhost:3000 when LOCAL=true). The script changes very\n // rarely, so we cache the body in memory with a TTL and dedupe concurrent\n // fetches via createExtensionLoaderCache. Set IRIS_EXTENSIONLOADER_NO_CACHE=1\n // to bypass the cache for debugging.\n const getExtensionLoaderUrl = (): string =>\n process.env.LOCAL === \"true\"\n ? \"http://localhost:3000/extensionloader.js\"\n : \"https://iris.trackunit.app/extensionloader.js\";\n\n const extensionLoaderCache = createExtensionLoaderCache({\n getUrl: getExtensionLoaderUrl,\n shouldBypassCache: () => process.env.IRIS_EXTENSIONLOADER_NO_CACHE === \"1\",\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 strictPort: true,\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 // Vite 8's default minifier. \"esbuild\" would require esbuild as a separate\n // install, which generated Iris app workspaces do not have.\n minify: \"oxc\",\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 async buildStart() {\n await manifestCache.reloadManifest();\n },\n\n configureServer(server: ViteDevServer) {\n // Invalidate the manifest cache when the manifest, or any source it was\n // derived from, changes so HMR picks up edits (e.g. adding an extension,\n // or annotating a route for AI navigation). All other paths serve from the\n // cache populated by the first request.\n //\n // `invalidateManifestSource` answers both questions at once: it drops the\n // file from the loader's module graph and reports whether the manifest was\n // derived from it in the first place.\n devServer = server;\n const manifestFilePath = path.join(resolvedAppDir, \"iris-app-manifest.ts\");\n server.watcher.add(manifestFilePath);\n watchManifestSources();\n server.watcher.on(\"change\", changedPath => {\n if (invalidateManifestSource(changedPath)) {\n manifestCache.invalidateManifestCache();\n logEvent(\n `manifest cache: invalidated (${path.relative(workspaceRoot, path.normalize(changedPath))} changed)`\n );\n }\n });\n\n // Request timing middleware - MUST be registered before any other middleware\n // so we observe the full server-side response time. Logs to stdout when\n // the response takes longer than TRANSFORM_LOG_THRESHOLD_MS. Enable with\n // IRIS_TIMING=true.\n server.middlewares.use((req: IncomingMessage, res: ServerResponse, next: () => void) => {\n wrapResponseTiming(req, res);\n next();\n });\n\n // Route /invoke requests to local serverside extensions when available.\n server.middlewares.use(\"/invoke\", createInvokeProxyMiddleware(options.serversidePortMap));\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 // Use the in-memory manifest if available; fall back to initialManifest\n // (loaded once at plugin construction) so this synchronous middleware\n // never blocks on a slow manifest reload.\n const filePath = resolveExtensionAsset(url, manifestCache.getManifestSync() ?? initialManifest, 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 const manifestJson = await manifestCache.getCachedManifestJson();\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 // Calls getCachedManifestJson directly instead of HTTP-fetching /manifest.json\n // to avoid a redundant manifest reload on every request (the host calls this\n // endpoint multiple times during initial app boot).\n if (req.url?.startsWith(\"/manifestAndToken\")) {\n void (async () => {\n try {\n const manifestJson = await manifestCache.getCachedManifestJson();\n res.setHeader(\"Content-Type\", \"application/json\");\n res.end(JSON.stringify({ manifest: manifestJson }));\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.\n // To test extensionloader locally set LOCAL=true in front of the serve command.\n // The fetched body is cached in memory; see createExtensionLoaderCache.\n if (req.url?.startsWith(\"/extensionloader.js\")) {\n void (async () => {\n try {\n const body = await extensionLoaderCache.getCachedExtensionLoaderBody();\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 const currentManifest = await manifestCache.getCachedManifest();\n const packageJsonPath = path.join(resolvedAppDir, \"package.json\");\n const packageJson = fs.readFileSync(packageJsonPath, \"utf8\");\n const html = generateIndexHtml({ manifest: currentManifest, packageJson, options });\n\n const transformedHtml = await timeAsync(`server.transformIndexHtml(${shortenPath(url)})`, () =>\n server.transformIndexHtml(req.url ?? \"/\", html)\n );\n\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 logEvent(\"server: 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 async generateBundle() {\n const manifest = manifestCache.getManifestSync() ?? (await manifestCache.reloadManifest());\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 async closeBundle() {\n if (config.command === \"build\") {\n const manifestForCopy = manifestCache.getManifestSync() ?? (await manifestCache.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 Tailwind v4 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 // When the custom-field in-sync check could not be completed, keep reminding\n // the developer on every rebuild that their custom fields were not validated.\n options.degraded && createCustomFieldsDegradedReminderPlugin(true),\n ];\n logTiming(performance.now() - pluginConstructionStart, \"plugin construction: complete\");\n return plugins.filter(Boolean);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"getTrackunitIrisAppVitePlugins.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/utils/getTrackunitIrisAppVitePlugins.ts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,wCAAa,GAAE;QACf,wEAAwE;QACxE,0EAA0E;QAC1E,+DAA+D;QAC/D,IAAA,0BAAK,EAAC,EAAE,CAAC;QACT,UAAU,IAAI,yBAAyB;QACvC,gBAAgB;QAChB,OAAO,CAAC,eAAe,KAAK,IAAI;YAC9B,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,qBAAqB,CAAC;YACpB,oBAAoB,EAAE,IAAI;YAC1B,oBAAoB,EAAE,IAAI;SAC3B,CAAC;QACF,oBAAoB;QACpB,6EAA6E;QAC7E,8EAA8E;QAC9E,OAAO,CAAC,QAAQ,IAAI,IAAA,6EAAwC,EAAC,IAAI,CAAC;KACnE,CAAC;IACF,IAAA,2BAAS,EAAC,WAAW,CAAC,GAAG,EAAE,GAAG,uBAAuB,EAAE,+BAA+B,CAAC,CAAC;IACxF,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 injectFullDescriptionImages,\n logInfo,\n ServersidePortMap,\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 { createCustomFieldsDegradedReminderPlugin } from \"./customFieldsDegradedReminderPlugin\";\nimport { logEvent, logTiming, shortenPath, timeAsync, wrapResponseTiming } from \"./devServerTiming\";\nimport { createExtensionLoaderCache } from \"./extensionLoaderCache\";\nimport { loadCssInjectedByJsPlugin } from \"./loadCssInjectedByJsPlugin\";\nimport { createManifestCache } from \"./manifestCache\";\nimport { invalidateManifestSource, loadManifestWithSources } from \"./manifestLoader\";\nimport { resolveSdkVersion } from \"./resolveSdkVersion\";\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 /**\n * Manifest already loaded by the build/serve executor (optionally with a stamped\n * `sdkVersion`). When omitted the plugin loads from disk itself ā tests and\n * direct callers use that path.\n */\n manifest?: IrisAppManifest;\n serversidePortMap?: ServersidePortMap;\n config: UserConfig;\n shouldTypeCheck: boolean;\n /** When true, register the plugin that re-warns about the skipped custom-field check on each rebuild. */\n degraded?: 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 * 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 iframeRedirect =\n options.config.mode === \"development\"\n ? `<script nonce=\"{{nonce}}\">\n if (window.self === window.top) { window.location.replace(\"https://new.manager.trackunit.com/goto/iris-app-dev\"); }\n </script>`\n : \"\";\n\n const devtools =\n options.config.mode === \"development\"\n ? `<script nonce=\"{{nonce}}\" defer src=\"http://localhost:8097\"></script>\n ${iframeRedirect}\n <script nonce=\"{{nonce}}\">\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 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 pluginConstructionStart = performance.now();\n logEvent(\"plugin construction: started\");\n\n const resolvedAppDir = path.resolve(options.appDir);\n const workspaceRoot = options.workspaceRoot ?? path.resolve(options.appDir, \"../..\");\n\n // ESM-only since v5 (Vite 8). Load via file URL ā Nx CJS executor hooks cannot\n // resolve the package's import-only exports map.\n const cssInjectedByJsPlugin = await loadCssInjectedByJsPlugin(workspaceRoot);\n\n // Prefer the executor-provided manifest (may already carry stamped sdkVersion);\n // fall back to a fresh disk load for direct/plugin-only callers.\n const initialLoad =\n options.manifest === undefined\n ? await loadManifestWithSources(workspaceRoot, resolvedAppDir)\n : { manifest: options.manifest, sourcePaths: [] };\n const initialManifest = initialLoad.manifest;\n\n // Directories holding the sources the manifest was derived from. The dev\n // server's own watcher only covers the app root, but a manifest reads across\n // the workspace ā an `aiNavigation` catalog comes off a route tree in `libs/` ā\n // so those directories are watched explicitly or an edit there is never seen.\n // Deduplicated to directories because watching each of a few thousand files\n // individually is far more expensive for the same coverage.\n let watchedSourceDirectories = new Set(initialLoad.sourcePaths.map(sourcePath => path.dirname(sourcePath)));\n let devServer: ViteDevServer | undefined;\n\n const watchManifestSources = (): void => {\n if (devServer === undefined) {\n return;\n }\n for (const directory of watchedSourceDirectories) {\n devServer.watcher.add(directory);\n }\n };\n\n // Get an available port in the Iris app port range\n const port = await timeAsync(\"getAvailablePort\", () => getAvailablePort(22220, 22229));\n\n // Get module federation configuration from manifest\n const webpackExposes = await timeAsync(`getExposedExtensions (${initialManifest.extensions.length} extensions)`, () =>\n getExposedExtensions({\n nxRootDir: workspaceRoot,\n manifest: initialManifest,\n })\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\n const reloadManifest = async (): Promise<IrisAppManifest> => {\n const loaded = await loadManifestWithSources(workspaceRoot, resolvedAppDir);\n // A reload can pull in sources the previous one never reached, e.g. a route\n // file added since, so the watch set is widened to match.\n watchedSourceDirectories = new Set(loaded.sourcePaths.map(sourcePath => path.dirname(sourcePath)));\n watchManifestSources();\n\n return loaded.manifest;\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\n // Stamp (or refresh) the installed SDK version on every emit so serve HMR\n // reloads and production builds both publish it ā the build executor also\n // stamps before config construction, but this path reloads from disk.\n const sdkVersion = resolveSdkVersion(resolvedAppDir);\n if (sdkVersion !== undefined) {\n manifestCopy.sdkVersion = sdkVersion;\n }\n\n return injectFullDescriptionImages(manifestCopy, resolvedAppDir);\n };\n\n const manifestCache = createManifestCache({\n reloadManifest,\n generateManifestJson,\n initialManifest,\n });\n\n // The /extensionloader.js handler proxies to https://iris.trackunit.app\n // (or http://localhost:3000 when LOCAL=true). The script changes very\n // rarely, so we cache the body in memory with a TTL and dedupe concurrent\n // fetches via createExtensionLoaderCache. Set IRIS_EXTENSIONLOADER_NO_CACHE=1\n // to bypass the cache for debugging.\n const getExtensionLoaderUrl = (): string =>\n process.env.LOCAL === \"true\"\n ? \"http://localhost:3000/extensionloader.js\"\n : \"https://iris.trackunit.app/extensionloader.js\";\n\n const extensionLoaderCache = createExtensionLoaderCache({\n getUrl: getExtensionLoaderUrl,\n shouldBypassCache: () => process.env.IRIS_EXTENSIONLOADER_NO_CACHE === \"1\",\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 strictPort: true,\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 // Vite 8's default minifier. \"esbuild\" would require esbuild as a separate\n // install, which generated Iris app workspaces do not have.\n minify: \"oxc\",\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 async buildStart() {\n await manifestCache.reloadManifest();\n },\n\n configureServer(server: ViteDevServer) {\n // Invalidate the manifest cache when the manifest, or any source it was\n // derived from, changes so HMR picks up edits (e.g. adding an extension,\n // or annotating a route for AI navigation). All other paths serve from the\n // cache populated by the first request.\n //\n // `invalidateManifestSource` answers both questions at once: it drops the\n // file from the loader's module graph and reports whether the manifest was\n // derived from it in the first place.\n devServer = server;\n const manifestFilePath = path.join(resolvedAppDir, \"iris-app-manifest.ts\");\n server.watcher.add(manifestFilePath);\n watchManifestSources();\n server.watcher.on(\"change\", changedPath => {\n if (invalidateManifestSource(changedPath)) {\n manifestCache.invalidateManifestCache();\n logEvent(\n `manifest cache: invalidated (${path.relative(workspaceRoot, path.normalize(changedPath))} changed)`\n );\n }\n });\n\n // Request timing middleware - MUST be registered before any other middleware\n // so we observe the full server-side response time. Logs to stdout when\n // the response takes longer than TRANSFORM_LOG_THRESHOLD_MS. Enable with\n // IRIS_TIMING=true.\n server.middlewares.use((req: IncomingMessage, res: ServerResponse, next: () => void) => {\n wrapResponseTiming(req, res);\n next();\n });\n\n // Route /invoke requests to local serverside extensions when available.\n server.middlewares.use(\"/invoke\", createInvokeProxyMiddleware(options.serversidePortMap));\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 // Use the in-memory manifest if available; fall back to initialManifest\n // (loaded once at plugin construction) so this synchronous middleware\n // never blocks on a slow manifest reload.\n const filePath = resolveExtensionAsset(url, manifestCache.getManifestSync() ?? initialManifest, 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 const manifestJson = await manifestCache.getCachedManifestJson();\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 // Calls getCachedManifestJson directly instead of HTTP-fetching /manifest.json\n // to avoid a redundant manifest reload on every request (the host calls this\n // endpoint multiple times during initial app boot).\n if (req.url?.startsWith(\"/manifestAndToken\")) {\n void (async () => {\n try {\n const manifestJson = await manifestCache.getCachedManifestJson();\n res.setHeader(\"Content-Type\", \"application/json\");\n res.end(JSON.stringify({ manifest: manifestJson }));\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.\n // To test extensionloader locally set LOCAL=true in front of the serve command.\n // The fetched body is cached in memory; see createExtensionLoaderCache.\n if (req.url?.startsWith(\"/extensionloader.js\")) {\n void (async () => {\n try {\n const body = await extensionLoaderCache.getCachedExtensionLoaderBody();\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 const currentManifest = await manifestCache.getCachedManifest();\n const packageJsonPath = path.join(resolvedAppDir, \"package.json\");\n const packageJson = fs.readFileSync(packageJsonPath, \"utf8\");\n const html = generateIndexHtml({ manifest: currentManifest, packageJson, options });\n\n const transformedHtml = await timeAsync(`server.transformIndexHtml(${shortenPath(url)})`, () =>\n server.transformIndexHtml(req.url ?? \"/\", html)\n );\n\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 logEvent(\"server: 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 async generateBundle() {\n const manifest = manifestCache.getManifestSync() ?? (await manifestCache.reloadManifest());\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 async closeBundle() {\n if (config.command === \"build\") {\n const manifestForCopy = manifestCache.getManifestSync() ?? (await manifestCache.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 Tailwind v4 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.shouldTypeCheck === true &&\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 // When the custom-field in-sync check could not be completed, keep reminding\n // the developer on every rebuild that their custom fields were not validated.\n options.degraded && createCustomFieldsDegradedReminderPlugin(true),\n ];\n logTiming(performance.now() - pluginConstructionStart, \"plugin construction: complete\");\n return plugins.filter(Boolean);\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveTypeCheckOptions = void 0;
|
|
4
|
+
/** Resolves whether an Iris App Vite executor should run type checking. */
|
|
5
|
+
const resolveTypeCheckOptions = (options) => options.typeCheckOptions ?? true;
|
|
6
|
+
exports.resolveTypeCheckOptions = resolveTypeCheckOptions;
|
|
7
|
+
//# sourceMappingURL=resolve-type-check-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-type-check-options.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/vite/src/executors/utils/resolve-type-check-options.ts"],"names":[],"mappings":";;;AAIA,2EAA2E;AACpE,MAAM,uBAAuB,GAAG,CAAC,OAAyB,EAAW,EAAE,CAAC,OAAO,CAAC,gBAAgB,IAAI,IAAI,CAAC;AAAnG,QAAA,uBAAuB,2BAA4E","sourcesContent":["export type TypeCheckOptions = {\n readonly typeCheckOptions?: boolean;\n};\n\n/** Resolves whether an Iris App Vite executor should run type checking. */\nexport const resolveTypeCheckOptions = (options: TypeCheckOptions): boolean => options.typeCheckOptions ?? true;\n"]}
|