@electron-ipc-bridge/vite-plugin 0.0.4 → 0.1.1

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 metacurb
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 metacurb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { createLogger } from "vite";
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "@electron-ipc-bridge/vite-plugin",
8
- version: "0.0.4",
8
+ version: "0.1.1",
9
9
  publishConfig: {
10
10
  access: "public"
11
11
  },
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/plugin.ts", "../package.json", "../src/constants.ts", "../src/generate-ipc.ts", "../../shared/dist/constants.js", "../../shared/dist/utils/to-snake-case.js", "../../shared/dist/utils/to-camel-case.js", "../../shared/dist/utils/derive-namespace.js", "../src/generator/generate-global-types.ts", "../src/generator/get-return-type.ts", "../src/generator/build-namespaces.ts", "../src/generator/build-type-definitions.ts", "../src/generator/generate-runtime-types.ts", "../src/normalize-path.ts", "../src/parser/find-controllers.ts", "../src/strategies/nest.ts", "../src/parser/resolve-controllers-from-nest-root.ts", "../src/parser/resolve-controllers-from-module-class.ts", "../src/parser/resolve-controller.ts", "../src/parser/collect-dependencies.ts", "../src/parser/extract-metadata.ts", "../src/parser/get-decorator.ts", "../src/parser/parse-controller.ts", "../src/parser/parse-method.ts", "../src/parser/collect-external-type-references.ts", "../src/parser/extract-type.ts", "../src/parser/constants.ts", "../src/parser/resolve-return-type.ts", "../src/parser/is-truncated-type-string.ts", "../src/parser/process-create-ipc-app-call.ts", "../src/parser/ast-utils.ts", "../src/parser/resolve-controllers-from-array.ts", "../src/parser/resolve-controllers-from-module.ts", "../src/preload/resolve-api-root.ts", "../src/resolve-type-paths.ts", "../src/plugin-state.ts"],
4
- "sourcesContent": ["import path from \"path\";\nimport { createLogger, type Logger, Plugin } from \"vite\";\n\nimport pkg from \"../package.json\" with { type: \"json\" };\n\nimport { DEFAULT_MAIN_ENTRY, DEFAULT_PRELOAD_ENTRY } from \"./constants.js\";\nimport { generateIpc } from \"./generate-ipc.js\";\nimport { normalizePath } from \"./normalize-path.js\";\nimport { PluginState } from \"./plugin-state.js\";\nimport type { PluginOptions } from \"./types.js\";\n\nexport { type PluginOptions, type PluginTypesOptions } from \"./types.js\";\n\n/**\n * Creates a Vite plugin that generates TypeScript type definitions\n * for your IPC controllers, enabling type-safe `window` usage in the renderer.\n *\n * @param options - Plugin configuration\n * @returns Vite plugin instance\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { electronIpcBridge } from \"@electron-ipc-bridge/vite-plugin\";\n *\n * export default defineConfig({\n * plugins: [electronIpcBridge(options)],\n * });\n * ```\n */\nexport function electronIpcBridge({\n main = DEFAULT_MAIN_ENTRY,\n preload = DEFAULT_PRELOAD_ENTRY,\n resolutionStrategy,\n types = {},\n}: PluginOptions = {}): Plugin {\n let root = process.cwd();\n let logger: Logger;\n\n const state = new PluginState();\n\n const generate = () => {\n generateIpc(root, logger, state, { main, preload, resolutionStrategy, types });\n };\n\n return {\n buildStart() {\n if (state.claimInitialGeneration()) {\n generate();\n }\n },\n configResolved(config) {\n root = config.root;\n logger = createLogger(config.logLevel, {\n allowClearScreen: config.clearScreen,\n customLogger: config.customLogger,\n prefix: `[${pkg.name}]`,\n });\n },\n configureServer(server) {\n const preloadPath = path.resolve(root, preload);\n server.watcher.add(preloadPath);\n server.watcher.on(\"change\", (file) => {\n if (normalizePath(file) === normalizePath(preloadPath)) {\n state.scheduleGenerate(generate);\n }\n });\n },\n name: \"electron-ipc-bridge\",\n transform(_code, id) {\n if (id.includes(\"node_modules\") || id.endsWith(\".d.ts\")) return null;\n\n const absId = normalizePath(path.resolve(id));\n const mainEntryPath = normalizePath(path.resolve(root, main));\n const preloadEntryPath = normalizePath(path.resolve(root, preload));\n\n if (state.shouldRegenerate(absId, mainEntryPath, preloadEntryPath)) {\n state.scheduleGenerate(generate);\n }\n return null;\n },\n };\n}\n", "{\n \"name\": \"@electron-ipc-bridge/vite-plugin\",\n \"version\": \"0.0.4\",\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/metacurb/electron-ipc-bridge.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/metacurb/electron-ipc-bridge/issues\"\n },\n \"homepage\": \"https://metacurb.github.io/electron-ipc-bridge/\",\n \"description\": \"A Vite plugin for Electron-IPC-Bridge\",\n \"type\": \"module\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"node scripts/build.mjs\",\n \"test\": \"pnpm exec jest --config jest.config.cjs\"\n },\n \"peerDependencies\": {\n \"typescript\": \"^5.0.0\",\n \"vite\": \"^5.0.0 || ^6.0.0 || ^7.0.0\"\n },\n \"devDependencies\": {\n \"@electron-ipc-bridge/shared\": \"workspace:*\",\n \"@types/node\": \"^25.2.3\",\n \"esbuild\": \"^0.27.3\",\n \"typescript\": \"^5.9.3\",\n \"vite\": \"^7.3.1\"\n }\n}\n", "export const DEFAULT_GLOBAL_TYPES_FILENAME = \"ipc.d.ts\";\nexport const DEFAULT_MAIN_ENTRY = \"src/main/index.ts\";\nexport const DEFAULT_PRELOAD_ENTRY = \"src/preload/index.ts\";\nexport const DEFAULT_RENDERER_RUNTIME_DIR = \"src/renderer/src\";\nexport const DEFAULT_RUNTIME_TYPES_FILENAME = \"ipc.types.ts\";\n", "import crypto from \"crypto\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport { Logger } from \"vite\";\n\nimport { generateGlobalTypes } from \"./generator/generate-global-types.js\";\nimport { generateRuntimeTypes } from \"./generator/generate-runtime-types.js\";\nimport { normalizePath } from \"./normalize-path.js\";\nimport { findControllers } from \"./parser/find-controllers.js\";\nimport { PluginState } from \"./plugin-state.js\";\nimport { resolveApiRootFromPreload } from \"./preload/resolve-api-root.js\";\nimport { resolveTypePaths } from \"./resolve-type-paths.js\";\nimport type { PluginTypesOptions, ResolutionStrategy } from \"./types.js\";\n\nexport function generateIpc(\n root: string,\n logger: Logger,\n state: PluginState,\n options: {\n main: string;\n preload: string;\n types: PluginTypesOptions;\n resolutionStrategy?: ResolutionStrategy;\n },\n): void {\n try {\n const { main, preload, resolutionStrategy, types } = options;\n const preloadPath = path.resolve(root, preload);\n const { dependencies: preloadDependencies, namespace: resolvedApiRoot } = resolveApiRootFromPreload(preloadPath);\n const entryPath = path.resolve(root, main);\n if (!fs.existsSync(entryPath)) {\n logger.warn(`Main entry not found at: ${entryPath}`);\n return;\n }\n\n logger.info(`Generating IPC types from ${entryPath}...`);\n const { controllers, processedFiles, program } = findControllers(\n entryPath,\n undefined,\n state.getProgram(),\n resolutionStrategy,\n );\n state.setProgram(program);\n\n if (controllers.length === 0) {\n logger.warn(`No createIpcApp() call found in ${entryPath}; generated types will be empty.`);\n }\n\n state.setControllerFiles(new Set([...processedFiles, ...preloadDependencies].map(normalizePath)));\n\n const { globalPath, runtimePath } = resolveTypePaths({\n hasRendererRuntimeDir: (absPath) => fs.existsSync(absPath),\n preloadPath,\n root,\n types,\n });\n\n if (!runtimePath && !globalPath) {\n logger.warn(`Both runtime and global type outputs are disabled; nothing to generate.`);\n return;\n }\n\n let runtimeTypesContent: string | null = null;\n let globalTypesContent: string | null = null;\n\n if (runtimePath) {\n runtimeTypesContent = generateRuntimeTypes(controllers);\n }\n\n if (globalPath) {\n const ipcApiImportPath = (() => {\n if (!runtimePath) {\n throw new Error(\"Global type generation requires a runtime types output path.\");\n }\n const rel = path\n .relative(path.dirname(globalPath), runtimePath)\n .replace(/\\\\/g, \"/\")\n .replace(/\\.tsx?$/, \".ts\")\n .replace(/(\\.d)?\\.ts$/, \"\");\n return rel.startsWith(\".\") ? rel : `./${rel}`;\n })();\n globalTypesContent = generateGlobalTypes(resolvedApiRoot, ipcApiImportPath);\n }\n\n const combinedHash = crypto\n .createHash(\"md5\")\n .update(runtimeTypesContent ?? \"\")\n .update(globalTypesContent ?? \"\")\n .digest(\"hex\");\n\n if (!state.updateHash(combinedHash)) return;\n\n if (runtimePath && runtimeTypesContent != null) {\n fs.mkdirSync(path.dirname(runtimePath), { recursive: true });\n fs.writeFileSync(runtimePath, runtimeTypesContent);\n logger.info(`Runtime types generated at ${path.relative(root, runtimePath)}`);\n }\n\n if (globalPath && globalTypesContent != null) {\n fs.mkdirSync(path.dirname(globalPath), { recursive: true });\n fs.writeFileSync(globalPath, globalTypesContent);\n logger.info(`Global types generated at ${path.relative(root, globalPath)}`);\n }\n } catch (err) {\n logger.error(`Type generation failed: ${err instanceof Error ? err.message : String(err)}`);\n }\n}\n", "export const IPC_CONTRACT_CHANNEL = \"ipc_controller_contract\";\nexport const IPC_DEFAULT_API_ROOT = \"ipc\";\nexport const IPC_DECORATOR_ON = \"IpcOn\";\nexport const IPC_DECORATOR_ONCE = \"IpcOnce\";\nexport const IPC_DECORATOR_HANDLE = \"IpcHandle\";\nexport const IPC_DECORATOR_HANDLE_ONCE = \"IpcHandleOnce\";\nexport const IPC_METHOD_DECORATOR_NAMES = [\n IPC_DECORATOR_HANDLE,\n IPC_DECORATOR_ON,\n IPC_DECORATOR_HANDLE_ONCE,\n IPC_DECORATOR_ONCE,\n];\nexport const IPC_PARAM_INJECTION_DECORATOR_NAMES = [\n \"Channel\",\n \"CorrelationId\",\n \"Origin\",\n \"ProcessId\",\n \"RawEvent\",\n \"Sender\",\n \"Window\",\n];\n", "export const toSnakeCase = (str) => str\n .trim()\n .replace(/[\\s-]+/g, \"_\")\n .replace(/(?<=[A-Z])(?=[A-Z][a-z])/g, \"_\")\n .replace(/([a-z\\d])([A-Z])/g, \"$1_$2\")\n .toLocaleLowerCase();\n", "import { toSnakeCase } from \"./to-snake-case.js\";\nexport const toCamelCase = (str) => toSnakeCase(str)\n .replace(/_([a-z0-9])/g, (_, c) => c.toLocaleUpperCase())\n .replace(/_/g, \"\")\n .replace(/^./, (s) => s.toLocaleLowerCase());\n", "import { toCamelCase } from \"./to-camel-case.js\";\nexport const deriveNamespace = (name) => toCamelCase(name.replace(/Controller$/, \"\"));\n", "import { IPC_DEFAULT_API_ROOT } from \"@electron-ipc-bridge/shared\";\n\nexport const generateGlobalTypes = (namespace: string = IPC_DEFAULT_API_ROOT, ipcApiImportPath: string): string => {\n const isValidIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(namespace);\n const windowProperty = isValidIdentifier ? `${namespace}: IpcApi;` : `[${JSON.stringify(namespace)}]: IpcApi;`;\n\n return `// Auto-generated by @electron-ipc-bridge/vite-plugin\n// Do not edit manually\n\nimport type { IpcApi } from \"${ipcApiImportPath}\";\n\ndeclare global {\n interface Window {\n ${windowProperty}\n }\n}\n\nexport {};\n`;\n};\n", "import { IPC_DECORATOR_ON, IPC_DECORATOR_ONCE } from \"@electron-ipc-bridge/shared\";\n\nexport const getReturnType = (decorator: string, originalReturnType: string): string => {\n if (decorator === IPC_DECORATOR_ON || decorator === IPC_DECORATOR_ONCE) {\n return \"void\";\n }\n\n if (originalReturnType.startsWith(\"Promise<\")) {\n return originalReturnType;\n }\n\n return `Promise<${originalReturnType}>`;\n};\n", "import type { ControllerMetadata } from \"../parser/types.js\";\n\nimport { getReturnType } from \"./get-return-type.js\";\n\nexport const buildNamespaces = (controllers: ControllerMetadata[]): string[] => {\n return controllers.map((controller) => {\n const methods = controller.methods.map((method) => {\n const params = method.params.map((p) => `${p.name}${p.optional ? \"?\" : \"\"}: ${p.type}`).join(\", \");\n const returnType = getReturnType(method.decoratorName, method.returnType);\n return `${method.name}(${params}): ${returnType};`;\n });\n\n return ` ${controller.namespace}: {\\n ${methods.join(\"\\n \")}\\n };`;\n });\n};\n", "import type { ControllerMetadata } from \"../parser/types.js\";\n\nexport const buildTypeDefinitions = (controllers: ControllerMetadata[]): string => {\n const referencedTypes = new Map<string, string>();\n\n const collectTypes = (types: (typeof controllers)[0][\"referencedTypes\"]) => {\n types.forEach((t) => {\n if (t.definition && !referencedTypes.has(t.name)) {\n referencedTypes.set(t.name, t.definition);\n collectTypes(t.referencedTypes);\n }\n });\n };\n\n controllers.forEach((c) => collectTypes(c.referencedTypes));\n\n return Array.from(referencedTypes.entries())\n .sort((a, b) => a[0].localeCompare(b[0]))\n .map(([, def]) => `export ${def}`)\n .join(\"\\n\\n\");\n};\n", "import type { ControllerMetadata } from \"../parser/types.js\";\n\nimport { buildNamespaces } from \"./build-namespaces.js\";\nimport { buildTypeDefinitions } from \"./build-type-definitions.js\";\n\nexport const generateRuntimeTypes = (controllers: ControllerMetadata[]): string => {\n const referenceTypes = Array.from(new Set(controllers.flatMap((c) => c.requiredReferenceTypes ?? []))).sort();\n const referenceDirectives = referenceTypes.map((refType) => `/// <reference types=\"${refType}\" />`).join(\"\\n\");\n const typeDefinitions = buildTypeDefinitions(controllers);\n const namespaces = buildNamespaces(controllers);\n\n const sections = [\"// Auto-generated by @electron-ipc-bridge/vite-plugin\", \"// Do not edit manually\", \"\"];\n if (referenceDirectives) {\n sections.push(referenceDirectives, \"\");\n }\n if (typeDefinitions) {\n sections.push(typeDefinitions, \"\");\n }\n\n return `${sections.join(\"\\n\")}\nexport interface IpcApi {\n${namespaces.join(\"\\n\")}\n}\n`;\n};\n", "export const normalizePath = (p: string): string => p.replace(/\\\\/g, \"/\");\n", "import path from \"path\";\nimport {\n CallExpression,\n CompilerOptions,\n createProgram,\n findConfigFile,\n forEachChild,\n isCallExpression,\n isIdentifier,\n parseJsonConfigFileContent,\n Program,\n readConfigFile,\n sys,\n TypeChecker,\n} from \"typescript\";\n\nimport { nestResolutionStrategy } from \"../strategies/nest.js\";\nimport type { DependencyResolutionStrategy } from \"../strategies/types.js\";\nimport type { ResolutionStrategy } from \"../types.js\";\n\nimport { processCreateIpcAppCall } from \"./process-create-ipc-app-call.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\n/** Maps a user-facing strategy name (e.g. `\"nest\"`) to its concrete implementation function. */\nfunction resolveStrategy(option?: ResolutionStrategy): DependencyResolutionStrategy | undefined {\n if (option === \"nest\") return nestResolutionStrategy;\n return undefined;\n}\n\nexport interface FindControllersResult {\n controllers: ControllerMetadata[];\n processedFiles: Set<string>;\n program: Program;\n}\n\nconst isCreateIpcAppCall = (node: CallExpression, typeChecker: TypeChecker): boolean => {\n if (!isIdentifier(node.expression)) return false;\n const sym = typeChecker.getSymbolAtLocation(node.expression);\n if (!sym) return false;\n let target = sym;\n try {\n const aliased = typeChecker.getAliasedSymbol(sym);\n if (aliased) target = aliased;\n } catch {\n // Not an alias; use original symbol (e.g. local createIpcApp)\n }\n return target.name === \"createIpcApp\";\n};\n\nexport const findControllers = (\n entryFile: string,\n tsConfigPath?: string,\n oldProgram?: Program,\n resolutionStrategy?: ResolutionStrategy,\n): FindControllersResult => {\n const strategy = resolveStrategy(resolutionStrategy);\n const searchConfig = tsConfigPath || \"tsconfig.node.json\";\n let configFile = findConfigFile(path.dirname(entryFile), sys.fileExists, searchConfig);\n\n if (!configFile && !tsConfigPath) {\n configFile = findConfigFile(path.dirname(entryFile), sys.fileExists, \"tsconfig.json\");\n }\n\n let compilerOptions: CompilerOptions = {};\n if (configFile) {\n const { config } = readConfigFile(configFile, sys.readFile);\n const { options } = parseJsonConfigFileContent(config, sys, path.dirname(configFile));\n compilerOptions = options;\n }\n\n const program = createProgram([entryFile], compilerOptions, undefined, oldProgram);\n const typeChecker = program.getTypeChecker();\n const sourceFile = program.getSourceFile(entryFile);\n\n if (!sourceFile) {\n return { controllers: [], processedFiles: new Set(), program };\n }\n\n const controllers: ControllerMetadata[] = [];\n const processedFiles = new Set<string>();\n const fileCache = new Map<string, ControllerMetadata[]>();\n\n processedFiles.add(path.resolve(entryFile));\n\n forEachChild(sourceFile, function visit(node) {\n if (isCallExpression(node) && isCreateIpcAppCall(node, typeChecker)) {\n processCreateIpcAppCall(node, typeChecker, processedFiles, controllers, fileCache, strategy);\n }\n forEachChild(node, visit);\n });\n\n return { controllers, processedFiles, program };\n};\n", "import {\n ClassDeclaration,\n forEachChild,\n isCallExpression,\n isClassDeclaration,\n isIdentifier,\n isPropertyAccessExpression,\n SourceFile,\n TypeChecker,\n} from \"typescript\";\n\nimport { resolveControllersFromNestRoot } from \"../parser/resolve-controllers-from-nest-root.js\";\n\nimport type { DependencyResolutionStrategy, ResolutionContext } from \"./types.js\";\n\n/**\n * Scans a source file for `NestFactory.createApplicationContext(ModuleClass)` and\n * returns the class declaration of `ModuleClass` if found.\n */\nconst findNestRootModule = (sourceFile: SourceFile, typeChecker: TypeChecker): ClassDeclaration | undefined => {\n let found: ClassDeclaration | undefined;\n\n const visit = (node: import(\"typescript\").Node): void => {\n if (found) return;\n if (!isCallExpression(node)) {\n forEachChild(node, visit);\n return;\n }\n const expr = node.expression;\n if (!isPropertyAccessExpression(expr) || expr.name.text !== \"createApplicationContext\") {\n forEachChild(node, visit);\n return;\n }\n const firstArg = node.arguments[0];\n if (!firstArg || !isIdentifier(firstArg)) {\n forEachChild(node, visit);\n return;\n }\n const symbol = typeChecker.getSymbolAtLocation(firstArg);\n if (!symbol) {\n forEachChild(node, visit);\n return;\n }\n let targetSymbol = symbol;\n try {\n const aliased = typeChecker.getAliasedSymbol(symbol);\n if (aliased) targetSymbol = aliased;\n } catch {\n // not an alias\n }\n const decl = targetSymbol.declarations?.[0];\n if (decl && isClassDeclaration(decl)) {\n found = decl;\n return;\n }\n forEachChild(node, visit);\n };\n\n forEachChild(sourceFile, visit);\n return found;\n};\n\n/**\n * NestJS resolution strategy: locates the root module via\n * `NestFactory.createApplicationContext(ModuleClass)` and recursively walks\n * `@Module({ imports: [...] })` to discover all IPC controllers.\n */\nexport const nestResolutionStrategy = (context: ResolutionContext): ReturnType<DependencyResolutionStrategy> => {\n const { fileCache, processedFiles, sourceFile, typeChecker } = context;\n const rootModule = findNestRootModule(sourceFile, typeChecker);\n if (!rootModule) return [];\n\n const controllers: ReturnType<DependencyResolutionStrategy> = [];\n const visitedModules = new Set<string>();\n resolveControllersFromNestRoot(rootModule, typeChecker, processedFiles, controllers, fileCache, visitedModules);\n return controllers;\n};\n", "import path from \"path\";\nimport {\n ClassDeclaration,\n Expression,\n getDecorators,\n isArrayLiteralExpression,\n isArrowFunction,\n isBlock,\n isCallExpression,\n isClassDeclaration,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isReturnStatement,\n TypeChecker,\n} from \"typescript\";\n\nimport { resolveControllersFromModuleClass } from \"./resolve-controllers-from-module-class.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nconst normalizePathSafe = (p: string) => path.normalize(p).replace(/\\\\/g, \"/\");\n\nfunction resolveImportElementToClass(element: Expression, typeChecker: TypeChecker): ClassDeclaration | undefined {\n if (isIdentifier(element)) {\n const symbol = typeChecker.getSymbolAtLocation(element);\n if (!symbol) return undefined;\n let target = symbol;\n try {\n const aliased = typeChecker.getAliasedSymbol(symbol);\n if (aliased) target = aliased;\n } catch {\n // not an alias\n }\n const decl = target.declarations?.[0];\n return decl && isClassDeclaration(decl) ? decl : undefined;\n }\n if (isCallExpression(element)) {\n const firstArg = element.arguments[0];\n if (!firstArg) return undefined;\n if (isArrowFunction(firstArg)) {\n const body = firstArg.body;\n if (isIdentifier(body)) return resolveImportElementToClass(body, typeChecker);\n if (isBlock(body)) {\n const ret = body.statements.find((s) => isReturnStatement(s));\n if (ret && isReturnStatement(ret) && ret.expression)\n return resolveImportElementToClass(ret.expression, typeChecker);\n }\n }\n }\n return undefined;\n}\n\n/**\n * Resolves all IPC controllers from a Nest root module and its imported modules recursively.\n */\nexport const resolveControllersFromNestRoot = (\n targetDecl: ClassDeclaration,\n typeChecker: TypeChecker,\n processedFiles: Set<string>,\n controllers: ControllerMetadata[],\n fileCache: Map<string, ControllerMetadata[]>,\n visitedModules: Set<string>,\n): void => {\n const sourceFile = targetDecl.getSourceFile();\n const filePath = normalizePathSafe(sourceFile.fileName);\n if (visitedModules.has(filePath)) return;\n visitedModules.add(filePath);\n\n resolveControllersFromModuleClass(targetDecl, typeChecker, processedFiles, controllers, fileCache);\n\n const decorators = getDecorators(targetDecl);\n if (!decorators) return;\n\n for (const decorator of decorators) {\n if (!isCallExpression(decorator.expression)) continue;\n const moduleArgs = decorator.expression.arguments;\n const moduleOptions = moduleArgs[0];\n if (!moduleOptions || !isObjectLiteralExpression(moduleOptions)) continue;\n\n const importsProp = moduleOptions.properties.find(\n (p): p is import(\"typescript\").PropertyAssignment =>\n isPropertyAssignment(p) && isIdentifier(p.name) && p.name.text === \"imports\",\n );\n if (!importsProp || !isArrayLiteralExpression(importsProp.initializer)) continue;\n\n for (const element of importsProp.initializer.elements) {\n const importClass = resolveImportElementToClass(element, typeChecker);\n if (importClass) {\n resolveControllersFromNestRoot(\n importClass,\n typeChecker,\n processedFiles,\n controllers,\n fileCache,\n visitedModules,\n );\n }\n }\n break;\n }\n};\n", "import {\n ClassDeclaration,\n getDecorators,\n isArrayLiteralExpression,\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n TypeChecker,\n} from \"typescript\";\n\nimport { resolveController } from \"./resolve-controller.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nexport const resolveControllersFromModuleClass = (\n targetDecl: ClassDeclaration,\n typeChecker: TypeChecker,\n processedFiles: Set<string>,\n controllers: ControllerMetadata[],\n fileCache: Map<string, ControllerMetadata[]>,\n): void => {\n const decorators = getDecorators(targetDecl);\n if (!decorators) return;\n\n for (const decorator of decorators) {\n if (!isCallExpression(decorator.expression)) continue;\n const moduleArgs = decorator.expression.arguments;\n const moduleOptions = moduleArgs[0];\n if (!moduleOptions || !isObjectLiteralExpression(moduleOptions)) continue;\n\n const properties = moduleOptions.properties;\n for (const prop of properties) {\n if (!isPropertyAssignment(prop) || !isIdentifier(prop.name)) continue;\n if (prop.name.text === \"providers\" || prop.name.text === \"controllers\") {\n if (!isArrayLiteralExpression(prop.initializer)) continue;\n const providerElements = prop.initializer.elements;\n providerElements.forEach((element) => {\n resolveController(element, typeChecker, processedFiles, controllers, fileCache);\n });\n }\n }\n }\n};\n", "import { Expression, isClassDeclaration, TypeChecker } from \"typescript\";\n\nimport { collectDependencies } from \"./collect-dependencies.js\";\nimport { extractControllerMetadata } from \"./extract-metadata.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nexport const resolveController = (\n node: Expression,\n typeChecker: TypeChecker,\n processedFiles: Set<string>,\n controllers: ControllerMetadata[],\n fileCache: Map<string, ControllerMetadata[]>,\n): void => {\n const symbol = typeChecker.getSymbolAtLocation(node);\n if (!symbol) return;\n\n let targetSymbol = symbol;\n try {\n const aliasedSymbol = typeChecker.getAliasedSymbol(symbol);\n targetSymbol = aliasedSymbol || symbol;\n } catch {\n // Not an alias\n }\n\n if (!targetSymbol.declarations || targetSymbol.declarations.length === 0) return;\n\n const targetDecl = targetSymbol.declarations[0];\n if (!isClassDeclaration(targetDecl)) return;\n\n const sourceFile = targetDecl.getSourceFile();\n const fileName = sourceFile.fileName;\n const className = targetDecl.name?.text;\n if (!className) return;\n\n let fileControllers = fileCache.get(fileName);\n if (fileControllers === undefined) {\n fileControllers = extractControllerMetadata(sourceFile, typeChecker);\n fileCache.set(fileName, fileControllers);\n processedFiles.add(fileName);\n }\n\n const match = fileControllers.find((c) => c.className === className);\n if (match) {\n controllers.push(match);\n collectDependencies(match.referencedTypes, processedFiles);\n }\n};\n", "import { ControllerMetadata, TypeDefinition } from \"./types.js\";\n\nexport const collectDependencies = (\n referencedTypes: ControllerMetadata[\"referencedTypes\"],\n processedFiles: Set<string>,\n) => {\n const visited = new Set<TypeDefinition>();\n\n const visit = (types: typeof referencedTypes) => {\n for (const type of types) {\n if (visited.has(type)) {\n continue;\n }\n visited.add(type);\n\n if (type.sourceFile) {\n processedFiles.add(type.sourceFile);\n }\n visit(type.referencedTypes);\n }\n };\n visit(referencedTypes);\n};\n", "import { forEachChild, isClassDeclaration, SourceFile, TypeChecker } from \"typescript\";\n\nimport { getDecorator } from \"./get-decorator.js\";\nimport { parseController } from \"./parse-controller.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nexport const extractControllerMetadata = (sourceFile: SourceFile, typeChecker: TypeChecker): ControllerMetadata[] => {\n const controllers: ControllerMetadata[] = [];\n\n forEachChild(sourceFile, (node) => {\n if (isClassDeclaration(node)) {\n const decorator = getDecorator(node, \"IpcController\");\n if (decorator) {\n const controller = parseController(node, decorator, sourceFile, typeChecker);\n if (controller) {\n controllers.push(controller);\n }\n }\n }\n });\n\n return controllers;\n};\n", "import { canHaveDecorators, Decorator, getDecorators, isCallExpression, isIdentifier, Node } from \"typescript\";\n\nexport const getDecorator = (node: Node, name: string): Decorator | undefined => {\n if (!canHaveDecorators(node)) return undefined;\n\n const decorators = getDecorators(node);\n if (!decorators) return undefined;\n\n return decorators.find(\n (m) =>\n isCallExpression(m.expression) && isIdentifier(m.expression.expression) && m.expression.expression.text === name,\n );\n};\n", "import { deriveNamespace } from \"@electron-ipc-bridge/shared\";\nimport {\n ClassDeclaration,\n Decorator,\n isCallExpression,\n isIdentifier,\n isMethodDeclaration,\n isStringLiteral,\n SourceFile,\n TypeChecker,\n} from \"typescript\";\n\nimport { parseMethod } from \"./parse-method.js\";\nimport { ControllerMetadata, MethodMetadata } from \"./types.js\";\n\nexport const parseController = (\n node: ClassDeclaration,\n decorator: Decorator,\n sourceFile: SourceFile,\n typeChecker: TypeChecker,\n): ControllerMetadata => {\n const className = node.name!.text;\n let namespace = deriveNamespace(className);\n\n if (isCallExpression(decorator.expression)) {\n const args = decorator.expression.arguments;\n if (args.length > 0 && isStringLiteral(args[0])) {\n namespace = args[0].text;\n }\n }\n\n const methods: MethodMetadata[] = [];\n\n node.members.forEach((member) => {\n if (isMethodDeclaration(member) && member.name && isIdentifier(member.name)) {\n const methodMeta = parseMethod(member, typeChecker);\n if (methodMeta) {\n methods.push(methodMeta);\n }\n }\n });\n\n const referencedTypes = methods.flatMap((m) => m.referencedTypes);\n const requiredReferenceTypes = Array.from(new Set(methods.flatMap((m) => m.requiredReferenceTypes ?? []))).sort();\n\n return {\n className,\n filePath: sourceFile.fileName,\n methods,\n namespace,\n referencedTypes,\n requiredReferenceTypes,\n };\n};\n", "import {\n IPC_DECORATOR_ON,\n IPC_DECORATOR_ONCE,\n IPC_METHOD_DECORATOR_NAMES,\n IPC_PARAM_INJECTION_DECORATOR_NAMES,\n} from \"@electron-ipc-bridge/shared\";\nimport type { Decorator } from \"typescript\";\nimport { Identifier, isCallExpression, isStringLiteral, MethodDeclaration, TypeChecker } from \"typescript\";\n\nimport { collectExternalTypeReferencesFromType } from \"./collect-external-type-references.js\";\nimport { collectTypeDefinitions, collectTypeDefinitionsFromType } from \"./extract-type.js\";\nimport { getDecorator } from \"./get-decorator.js\";\nimport { resolveReturnType } from \"./resolve-return-type.js\";\nimport { MethodMetadata, ParamMetadata, TypeDefinition } from \"./types.js\";\n\nexport const parseMethod = (node: MethodDeclaration, typeChecker: TypeChecker): MethodMetadata | null => {\n let found: (typeof IPC_METHOD_DECORATOR_NAMES)[number] | null = null;\n let decorator: Decorator | null = null;\n for (const d of IPC_METHOD_DECORATOR_NAMES) {\n const dec = getDecorator(node, d);\n if (dec) {\n found = d;\n decorator = dec;\n break;\n }\n }\n if (!found || !decorator) return null;\n\n let name = (node.name as Identifier).text;\n\n if (isCallExpression(decorator.expression)) {\n const args = decorator.expression.arguments;\n if (args.length > 0 && isStringLiteral(args[0])) {\n name = args[0].text;\n }\n }\n\n const signature = typeChecker.getSignatureFromDeclaration(node);\n const returnType = resolveReturnType(node, signature ?? undefined, typeChecker);\n\n const referencedTypes: TypeDefinition[] = [];\n const requiredReferenceTypes = new Set<string>();\n const seen = new Set<string>();\n\n const paramInfos = node.parameters.map((param) => {\n const hasInjection = IPC_PARAM_INJECTION_DECORATOR_NAMES.some((d) => getDecorator(param, d));\n return { hasInjection, param };\n });\n\n const params: ParamMetadata[] = [];\n for (const { hasInjection, param } of paramInfos) {\n const type = typeChecker.getTypeAtLocation(param);\n const typeString = typeChecker.typeToString(type);\n const extracted = !hasInjection && param.type ? collectTypeDefinitions(param.type, typeChecker, seen) : [];\n if (!hasInjection) {\n collectExternalTypeReferencesFromType(type, typeChecker, requiredReferenceTypes);\n }\n referencedTypes.push(...extracted);\n params.push({\n name: param.name.getText(),\n optional: !!param.questionToken || !!param.initializer,\n type: typeString,\n });\n }\n\n const filteredParams = params.filter((_, index) => !paramInfos[index].hasInjection);\n\n if (node.type) {\n const returnTypeRefs = collectTypeDefinitions(node.type, typeChecker, seen);\n referencedTypes.push(...returnTypeRefs);\n } else if (signature) {\n const returnTypeRefs = collectTypeDefinitionsFromType(signature.getReturnType(), typeChecker, seen);\n referencedTypes.push(...returnTypeRefs);\n }\n\n if (signature && found !== IPC_DECORATOR_ON && found !== IPC_DECORATOR_ONCE) {\n collectExternalTypeReferencesFromType(signature.getReturnType(), typeChecker, requiredReferenceTypes);\n }\n\n return {\n decoratorName: found,\n name,\n params: filteredParams,\n referencedTypes,\n requiredReferenceTypes: Array.from(requiredReferenceTypes).sort(),\n returnType,\n };\n};\n", "import {\n isEnumDeclaration,\n isInterfaceDeclaration,\n isTypeAliasDeclaration,\n Symbol,\n Type,\n TypeChecker,\n} from \"typescript\";\n\nconst NODE_TYPES_PATH_RE = /[\\\\/]@types[\\\\/]node[\\\\/]/i;\n\nconst pickDeclaration = (symbol: Symbol | undefined) =>\n symbol\n ?.getDeclarations()\n ?.find((d) => isTypeAliasDeclaration(d) || isInterfaceDeclaration(d) || isEnumDeclaration(d));\n\nconst resolveDeclarationFromSymbol = (symbol: Symbol | undefined, typeChecker: TypeChecker) => {\n let decl = pickDeclaration(symbol);\n if (!decl && symbol) {\n try {\n const aliased = typeChecker.getAliasedSymbol(symbol);\n const aliasedDecl = pickDeclaration(aliased);\n if (aliasedDecl) {\n decl = aliasedDecl;\n }\n } catch {\n // Not an alias; fall back to original symbol\n }\n }\n return decl;\n};\n\nconst addReferenceTypeIfExternal = (symbol: Symbol | undefined, typeChecker: TypeChecker, out: Set<string>): void => {\n const decl = resolveDeclarationFromSymbol(symbol, typeChecker);\n if (!decl) return;\n\n const sourceFile = decl.getSourceFile();\n if (NODE_TYPES_PATH_RE.test(sourceFile.fileName)) {\n out.add(\"node\");\n }\n};\n\nconst walkTypeForExternalRefs = (type: Type, typeChecker: TypeChecker, seen: Set<Type>, out: Set<string>): void => {\n if (seen.has(type)) return;\n seen.add(type);\n\n addReferenceTypeIfExternal(type.getSymbol(), typeChecker, out);\n\n const typeWithAlias = type as Type & { aliasSymbol?: Symbol };\n addReferenceTypeIfExternal(typeWithAlias.aliasSymbol, typeChecker, out);\n\n const typeWithNested = type as Type & {\n aliasTypeArguments?: readonly Type[];\n typeArguments?: readonly Type[];\n types?: readonly Type[];\n };\n\n typeWithNested.aliasTypeArguments?.forEach((arg) => walkTypeForExternalRefs(arg, typeChecker, seen, out));\n typeWithNested.typeArguments?.forEach((arg) => walkTypeForExternalRefs(arg, typeChecker, seen, out));\n typeWithNested.types?.forEach((nested) => walkTypeForExternalRefs(nested, typeChecker, seen, out));\n};\n\nexport const collectExternalTypeReferencesFromType = (\n type: Type,\n typeChecker: TypeChecker,\n out = new Set<string>(),\n): Set<string> => {\n walkTypeForExternalRefs(type, typeChecker, new Set<Type>(), out);\n return out;\n};\n", "import {\n createPrinter,\n EmitHint,\n forEachChild,\n isEnumDeclaration,\n isInterfaceDeclaration,\n isTypeAliasDeclaration,\n isTypeReferenceNode,\n Node,\n Symbol,\n Type,\n TypeChecker,\n} from \"typescript\";\n\nimport { BUILTIN_TYPE_NAMES } from \"./constants.js\";\nimport { TypeDefinition } from \"./types.js\";\n\nconst printer = createPrinter({ removeComments: true });\n\nexport const collectTypeDefinitions = (\n node: Node,\n typeChecker: TypeChecker,\n seen = new Set<string>(),\n): TypeDefinition[] => {\n const result: TypeDefinition[] = [];\n walkForTypeRefs(node, typeChecker, seen, result);\n return result;\n};\n\nexport const collectTypeDefinitionsFromType = (\n type: Type,\n typeChecker: TypeChecker,\n seen = new Set<string>(),\n): TypeDefinition[] => {\n const result: TypeDefinition[] = [];\n walkTypeForTypeRefs(type, typeChecker, seen, result);\n return result;\n};\n\nconst pickDeclaration = (symbol: Symbol | undefined) =>\n symbol\n ?.getDeclarations()\n ?.find((d) => isTypeAliasDeclaration(d) || isInterfaceDeclaration(d) || isEnumDeclaration(d));\n\nconst resolveDeclarationFromSymbol = (symbol: Symbol | undefined, typeChecker: TypeChecker) => {\n let decl = pickDeclaration(symbol);\n if (!decl && symbol) {\n try {\n const aliased = typeChecker.getAliasedSymbol(symbol);\n const aliasedDecl = pickDeclaration(aliased);\n if (aliasedDecl) {\n decl = aliasedDecl;\n }\n } catch {\n // Not an alias; fall back to original symbol\n }\n }\n return decl;\n};\n\nconst addDefinitionFromDeclaration = (\n decl: ReturnType<typeof pickDeclaration>,\n typeChecker: TypeChecker,\n seen: Set<string>,\n out: TypeDefinition[],\n): void => {\n if (!decl || !(isTypeAliasDeclaration(decl) || isInterfaceDeclaration(decl) || isEnumDeclaration(decl))) {\n return;\n }\n const name = decl.name.text;\n if (BUILTIN_TYPE_NAMES.has(name) || seen.has(name)) {\n return;\n }\n seen.add(name);\n\n const sourceFile = decl.getSourceFile();\n if (sourceFile.fileName.includes(\"node_modules\")) {\n return;\n }\n\n const referencedTypes: TypeDefinition[] = [];\n walkForTypeRefs(decl, typeChecker, seen, referencedTypes);\n\n const definition = printer\n .printNode(EmitHint.Unspecified, decl, sourceFile)\n .replace(/^\\s*export\\s+/, \"\")\n .replace(/^\\s*declare\\s+/, \"\")\n .trim();\n\n if (definition) {\n out.push({ definition, name, referencedTypes, sourceFile: sourceFile.fileName });\n }\n};\n\nconst walkForTypeRefs = (node: Node, typeChecker: TypeChecker, seen: Set<string>, out: TypeDefinition[]): void => {\n if (isTypeReferenceNode(node)) {\n const sym = typeChecker.getSymbolAtLocation(node.typeName);\n addDefinitionFromDeclaration(resolveDeclarationFromSymbol(sym, typeChecker), typeChecker, seen, out);\n\n if (node.typeArguments) {\n node.typeArguments.forEach((arg) => walkForTypeRefs(arg, typeChecker, seen, out));\n }\n return;\n }\n\n forEachChild(node, (child) => walkForTypeRefs(child, typeChecker, seen, out));\n};\n\nconst walkTypeForTypeRefs = (type: Type, typeChecker: TypeChecker, seen: Set<string>, out: TypeDefinition[]): void => {\n addDefinitionFromDeclaration(resolveDeclarationFromSymbol(type.getSymbol(), typeChecker), typeChecker, seen, out);\n\n const typeWithAlias = type as Type & { aliasSymbol?: Symbol };\n addDefinitionFromDeclaration(\n resolveDeclarationFromSymbol(typeWithAlias.aliasSymbol, typeChecker),\n typeChecker,\n seen,\n out,\n );\n\n const typeWithNested = type as Type & {\n aliasTypeArguments?: readonly Type[];\n typeArguments?: readonly Type[];\n types?: readonly Type[];\n };\n\n typeWithNested.aliasTypeArguments?.forEach((arg) => walkTypeForTypeRefs(arg, typeChecker, seen, out));\n typeWithNested.typeArguments?.forEach((arg) => walkTypeForTypeRefs(arg, typeChecker, seen, out));\n typeWithNested.types?.forEach((nested) => walkTypeForTypeRefs(nested, typeChecker, seen, out));\n};\n", "export const BUILTIN_TYPE_NAMES = new Set([\n \"Promise\",\n \"Array\",\n \"Map\",\n \"Set\",\n \"WeakMap\",\n \"WeakSet\",\n \"Date\",\n \"RegExp\",\n \"Function\",\n \"Symbol\",\n \"Error\",\n \"Record\",\n \"Partial\",\n \"Required\",\n \"Readonly\",\n \"Pick\",\n \"Omit\",\n \"Exclude\",\n \"Extract\",\n \"NonNullable\",\n \"ReturnType\",\n \"Parameters\",\n \"InstanceType\",\n \"ConstructorParameters\",\n \"__type\",\n \"undefined\",\n]);\n", "import type { Signature } from \"typescript\";\nimport { createPrinter, EmitHint, MethodDeclaration, TypeChecker, TypeFormatFlags } from \"typescript\";\n\nimport { isTruncatedTypeString } from \"./is-truncated-type-string.js\";\n\nconst printer = createPrinter();\n\nexport const resolveReturnType = (\n node: MethodDeclaration,\n signature: Signature | undefined,\n typeChecker: TypeChecker,\n): string => {\n if (node.type) {\n return printer.printNode(EmitHint.Unspecified, node.type, node.getSourceFile()).trim();\n }\n const inferred =\n signature != null\n ? typeChecker.typeToString(\n signature.getReturnType(),\n undefined,\n TypeFormatFlags.NoTruncation | TypeFormatFlags.UseFullyQualifiedType,\n )\n : \"unknown\";\n\n if (isTruncatedTypeString(inferred)) return \"unknown\";\n\n // Strip import(\"...\") wrappers only for local file paths (starting with ./, ../, /, or Drive letter)\n // This keeps external package imports (like import(\"zod\")) intact, while simplifying local types to their names\n // (since we generate definitions for them in the same file).\n return inferred.replace(/import\\(\"(?:\\.|\\/|[a-zA-Z]:).*?\"\\)\\./g, \"\");\n};\n", "/** True if the type string was truncated by TypeScript (e.g. \"... 27 more ...\"). */\nexport const isTruncatedTypeString = (s: string): boolean => /\\.\\.\\.\\s+\\d+\\s+more\\s+\\.\\.\\./.test(s);\n", "import {\n CallExpression,\n isArrayLiteralExpression,\n isCallExpression,\n isClassDeclaration,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n PropertyAssignment,\n TypeChecker,\n} from \"typescript\";\n\nimport { DependencyResolutionStrategy } from \"../strategies/types.js\";\n\nimport { resolveExpression } from \"./ast-utils.js\";\nimport { resolveControllersFromArray } from \"./resolve-controllers-from-array.js\";\nimport { resolveControllersFromModule } from \"./resolve-controllers-from-module.js\";\nimport { resolveControllersFromModuleClass } from \"./resolve-controllers-from-module-class.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nexport const processCreateIpcAppCall = (\n node: CallExpression,\n typeChecker: TypeChecker,\n processedFiles: Set<string>,\n controllers: ControllerMetadata[],\n fileCache: Map<string, ControllerMetadata[]>,\n resolutionStrategy?: DependencyResolutionStrategy,\n): void => {\n const args = node.arguments;\n if (args.length === 0) return;\n\n const optionsObj = resolveExpression(args[0], typeChecker);\n if (!isObjectLiteralExpression(optionsObj)) return;\n\n const controllersProp = optionsObj.properties.find(\n (p): p is PropertyAssignment => isPropertyAssignment(p) && isIdentifier(p.name) && p.name.text === \"controllers\",\n );\n\n if (!controllersProp) return;\n\n const initializer = resolveExpression(controllersProp.initializer, typeChecker);\n\n if (isArrayLiteralExpression(initializer)) {\n resolveControllersFromArray(initializer, typeChecker, processedFiles, controllers, fileCache);\n return;\n }\n\n if (isCallExpression(initializer)) {\n resolveControllersFromModule(initializer, typeChecker, processedFiles, controllers, fileCache);\n\n for (const arg of initializer.arguments) {\n const resolvedArg = resolveExpression(arg, typeChecker);\n\n if (isCallExpression(resolvedArg)) {\n for (const factoryArg of resolvedArg.arguments) {\n const resolvedFactoryArg = resolveExpression(factoryArg, typeChecker);\n\n if (!isIdentifier(resolvedFactoryArg)) continue;\n const factorySymbol = typeChecker.getSymbolAtLocation(resolvedFactoryArg);\n if (!factorySymbol) continue;\n\n let targetSymbol = factorySymbol;\n try {\n const aliased = typeChecker.getAliasedSymbol(factorySymbol);\n targetSymbol = aliased || factorySymbol;\n } catch {\n // Not an alias\n }\n\n const targetDecl = targetSymbol.declarations?.[0];\n if (targetDecl && isClassDeclaration(targetDecl)) {\n resolveControllersFromModuleClass(targetDecl, typeChecker, processedFiles, controllers, fileCache);\n }\n }\n }\n }\n\n if (controllers.length === 0 && resolutionStrategy) {\n const context = {\n fileCache,\n processedFiles,\n sourceFile: node.getSourceFile(),\n typeChecker,\n };\n const resolved = resolutionStrategy(context);\n controllers.push(...resolved);\n }\n }\n};\n", "import {\n Expression,\n isAsExpression,\n isAwaitExpression,\n isIdentifier,\n isNonNullExpression,\n isParenthesizedExpression,\n isSatisfiesExpression,\n isTypeAssertionExpression,\n isVariableDeclaration,\n TypeChecker,\n} from \"typescript\";\n\nexport const unwrapExpression = (expr: Expression): Expression => {\n let current = expr;\n while (true) {\n if (isAwaitExpression(current)) {\n current = current.expression;\n continue;\n }\n if (isParenthesizedExpression(current)) {\n current = current.expression;\n continue;\n }\n if (isAsExpression(current)) {\n current = current.expression;\n continue;\n }\n if (isTypeAssertionExpression(current)) {\n current = current.expression;\n continue;\n }\n if (isNonNullExpression(current)) {\n current = current.expression;\n continue;\n }\n if (isSatisfiesExpression(current)) {\n current = current.expression;\n continue;\n }\n return current;\n }\n};\n\nexport const resolveExpression = (expr: Expression, typeChecker: TypeChecker): Expression => {\n let current = unwrapExpression(expr);\n const visited = new Set<Expression>();\n\n while (isIdentifier(current)) {\n if (visited.has(current)) break;\n visited.add(current);\n\n const symbol = typeChecker.getSymbolAtLocation(current);\n if (!symbol) break;\n\n let targetSymbol = symbol;\n try {\n const aliasedSymbol = typeChecker.getAliasedSymbol(symbol);\n targetSymbol = aliasedSymbol || symbol;\n } catch {\n // Not an alias\n }\n\n const decl = targetSymbol.declarations?.[0];\n if (decl && isVariableDeclaration(decl) && decl.initializer) {\n current = unwrapExpression(decl.initializer);\n } else {\n break;\n }\n }\n\n return current;\n};\n", "import { ArrayLiteralExpression, TypeChecker } from \"typescript\";\n\nimport { resolveController } from \"./resolve-controller.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nexport const resolveControllersFromArray = (\n initializer: ArrayLiteralExpression,\n typeChecker: TypeChecker,\n processedFiles: Set<string>,\n controllers: ControllerMetadata[],\n fileCache: Map<string, ControllerMetadata[]>,\n): void => {\n initializer.elements.forEach((element) => {\n resolveController(element, typeChecker, processedFiles, controllers, fileCache);\n });\n};\n", "import { CallExpression, isClassDeclaration, isIdentifier, TypeChecker } from \"typescript\";\n\nimport { resolveControllersFromModuleClass } from \"./resolve-controllers-from-module-class.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nexport const resolveControllersFromModule = (\n callExpr: CallExpression,\n typeChecker: TypeChecker,\n processedFiles: Set<string>,\n controllers: ControllerMetadata[],\n fileCache: Map<string, ControllerMetadata[]>,\n): void => {\n const moduleArg = callExpr.arguments[0];\n if (moduleArg && isIdentifier(moduleArg)) {\n const moduleSymbol = typeChecker.getSymbolAtLocation(moduleArg);\n if (!moduleSymbol) return;\n\n let targetSymbol = moduleSymbol;\n try {\n const aliasedSymbol = typeChecker.getAliasedSymbol(moduleSymbol);\n targetSymbol = aliasedSymbol || moduleSymbol;\n } catch {\n // Not an alias\n }\n\n const targetDecl = targetSymbol.declarations?.[0];\n if (!targetDecl || !isClassDeclaration(targetDecl)) return;\n\n resolveControllersFromModuleClass(targetDecl, typeChecker, processedFiles, controllers, fileCache);\n }\n};\n", "import { IPC_DEFAULT_API_ROOT } from \"@electron-ipc-bridge/shared\";\nimport fs from \"fs\";\nimport {\n createSourceFile,\n forEachChild,\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isStringLiteral,\n ScriptTarget,\n} from \"typescript\";\n\nexport const resolveApiRootFromPreload = (preloadPath: string): { namespace: string; dependencies: Set<string> } => {\n const dependencies = new Set<string>();\n dependencies.add(preloadPath);\n let namespace: string = IPC_DEFAULT_API_ROOT;\n\n if (!fs.existsSync(preloadPath)) {\n return { dependencies, namespace };\n }\n\n const content = fs.readFileSync(preloadPath, \"utf-8\");\n const sourceFile = createSourceFile(preloadPath, content, ScriptTarget.Latest, true);\n\n const visit = (node: import(\"typescript\").Node) => {\n if (isCallExpression(node) && isIdentifier(node.expression) && node.expression.text === \"setupPreload\") {\n const args = node.arguments;\n if (args.length > 0) {\n const first = args[0];\n if (isStringLiteral(first)) {\n namespace = first.text;\n } else if (isObjectLiteralExpression(first)) {\n const namespaceProp = first.properties.find(\n (p) => isPropertyAssignment(p) && isIdentifier(p.name) && p.name.text === \"namespace\",\n );\n if (namespaceProp && isPropertyAssignment(namespaceProp) && isStringLiteral(namespaceProp.initializer)) {\n namespace = namespaceProp.initializer.text;\n }\n }\n }\n }\n forEachChild(node, visit);\n };\n\n forEachChild(sourceFile, visit);\n\n return { dependencies, namespace };\n};\n", "import path from \"path\";\n\nimport {\n DEFAULT_GLOBAL_TYPES_FILENAME,\n DEFAULT_RENDERER_RUNTIME_DIR,\n DEFAULT_RUNTIME_TYPES_FILENAME,\n} from \"./constants.js\";\nimport type { PluginTypesOptions } from \"./plugin.js\";\n\nexport interface ResolveTypePathsOptions {\n hasRendererRuntimeDir: (absPath: string) => boolean;\n preloadPath: string;\n root: string;\n types: PluginTypesOptions;\n}\n\nexport interface ResolvedTypePaths {\n globalPath: string | null;\n runtimePath: string | null;\n}\n\nexport const resolveTypePaths = ({\n hasRendererRuntimeDir,\n preloadPath,\n root,\n types,\n}: ResolveTypePathsOptions): ResolvedTypePaths => {\n const runtimePath =\n types.runtime === false\n ? null\n : types.runtime\n ? path.resolve(root, types.runtime)\n : (() => {\n const rendererSrc = path.resolve(root, DEFAULT_RENDERER_RUNTIME_DIR);\n if (hasRendererRuntimeDir(rendererSrc)) {\n return path.join(rendererSrc, DEFAULT_RUNTIME_TYPES_FILENAME);\n }\n return path.resolve(root, path.join(\"src\", DEFAULT_RUNTIME_TYPES_FILENAME));\n })();\n\n const globalPath =\n types.global === false\n ? null\n : types.global\n ? path.resolve(root, types.global)\n : path.join(path.dirname(preloadPath), DEFAULT_GLOBAL_TYPES_FILENAME);\n\n return { globalPath, runtimePath };\n};\n", "import type { Program } from \"typescript\";\n\nexport class PluginState {\n private controllerFiles: Set<string> | null = null;\n private debounceTimer: ReturnType<typeof setTimeout> | null = null;\n private hasGeneratedOnce = false;\n private lastHash: string | null = null;\n private program: Program | null = null;\n\n constructor(private readonly debounceMs = 100) {}\n\n claimInitialGeneration(): boolean {\n if (!this.hasGeneratedOnce) {\n this.hasGeneratedOnce = true;\n return true;\n }\n return false;\n }\n\n getProgram(): Program | undefined {\n return this.program ?? undefined;\n }\n\n scheduleGenerate(callback: () => void): void {\n if (this.debounceTimer) clearTimeout(this.debounceTimer);\n this.debounceTimer = setTimeout(() => {\n callback();\n this.debounceTimer = null;\n }, this.debounceMs);\n }\n\n setControllerFiles(files: Set<string>): void {\n this.controllerFiles = files;\n }\n\n setProgram(program: Program): void {\n this.program = program;\n }\n\n shouldRegenerate(absId: string, mainEntryPath: string, preloadEntryPath?: string): boolean {\n const isMainEntry = absId === mainEntryPath;\n const isPreloadEntry = preloadEntryPath ? absId === preloadEntryPath : false;\n const isControllerFile = this.controllerFiles?.has(absId);\n return isMainEntry || isPreloadEntry || !!isControllerFile;\n }\n\n updateHash(hash: string): boolean {\n if (hash === this.lastHash) {\n return false;\n }\n this.lastHash = hash;\n return true;\n }\n}\n"],
4
+ "sourcesContent": ["import path from \"path\";\nimport { createLogger, type Logger, Plugin } from \"vite\";\n\nimport pkg from \"../package.json\" with { type: \"json\" };\n\nimport { DEFAULT_MAIN_ENTRY, DEFAULT_PRELOAD_ENTRY } from \"./constants.js\";\nimport { generateIpc } from \"./generate-ipc.js\";\nimport { normalizePath } from \"./normalize-path.js\";\nimport { PluginState } from \"./plugin-state.js\";\nimport type { PluginOptions } from \"./types.js\";\n\nexport { type PluginOptions, type PluginTypesOptions } from \"./types.js\";\n\n/**\n * Creates a Vite plugin that generates TypeScript type definitions\n * for your IPC controllers, enabling type-safe `window` usage in the renderer.\n *\n * @param options - Plugin configuration\n * @returns Vite plugin instance\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { electronIpcBridge } from \"@electron-ipc-bridge/vite-plugin\";\n *\n * export default defineConfig({\n * plugins: [electronIpcBridge(options)],\n * });\n * ```\n */\nexport function electronIpcBridge({\n main = DEFAULT_MAIN_ENTRY,\n preload = DEFAULT_PRELOAD_ENTRY,\n resolutionStrategy,\n types = {},\n}: PluginOptions = {}): Plugin {\n let root = process.cwd();\n let logger: Logger;\n\n const state = new PluginState();\n\n const generate = () => {\n generateIpc(root, logger, state, { main, preload, resolutionStrategy, types });\n };\n\n return {\n buildStart() {\n if (state.claimInitialGeneration()) {\n generate();\n }\n },\n configResolved(config) {\n root = config.root;\n logger = createLogger(config.logLevel, {\n allowClearScreen: config.clearScreen,\n customLogger: config.customLogger,\n prefix: `[${pkg.name}]`,\n });\n },\n configureServer(server) {\n const preloadPath = path.resolve(root, preload);\n server.watcher.add(preloadPath);\n server.watcher.on(\"change\", (file) => {\n if (normalizePath(file) === normalizePath(preloadPath)) {\n state.scheduleGenerate(generate);\n }\n });\n },\n name: \"electron-ipc-bridge\",\n transform(_code, id) {\n if (id.includes(\"node_modules\") || id.endsWith(\".d.ts\")) return null;\n\n const absId = normalizePath(path.resolve(id));\n const mainEntryPath = normalizePath(path.resolve(root, main));\n const preloadEntryPath = normalizePath(path.resolve(root, preload));\n\n if (state.shouldRegenerate(absId, mainEntryPath, preloadEntryPath)) {\n state.scheduleGenerate(generate);\n }\n return null;\n },\n };\n}\n", "{\n \"name\": \"@electron-ipc-bridge/vite-plugin\",\n \"version\": \"0.1.1\",\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/metacurb/electron-ipc-bridge.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/metacurb/electron-ipc-bridge/issues\"\n },\n \"homepage\": \"https://metacurb.github.io/electron-ipc-bridge/\",\n \"description\": \"A Vite plugin for Electron-IPC-Bridge\",\n \"type\": \"module\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"node scripts/build.mjs\",\n \"test\": \"pnpm exec jest --config jest.config.cjs\"\n },\n \"peerDependencies\": {\n \"typescript\": \"^5.0.0\",\n \"vite\": \"^5.0.0 || ^6.0.0 || ^7.0.0\"\n },\n \"devDependencies\": {\n \"@electron-ipc-bridge/shared\": \"workspace:*\",\n \"@types/node\": \"^25.2.3\",\n \"esbuild\": \"^0.27.3\",\n \"typescript\": \"^5.9.3\",\n \"vite\": \"^7.3.1\"\n }\n}\n", "export const DEFAULT_GLOBAL_TYPES_FILENAME = \"ipc.d.ts\";\nexport const DEFAULT_MAIN_ENTRY = \"src/main/index.ts\";\nexport const DEFAULT_PRELOAD_ENTRY = \"src/preload/index.ts\";\nexport const DEFAULT_RENDERER_RUNTIME_DIR = \"src/renderer/src\";\nexport const DEFAULT_RUNTIME_TYPES_FILENAME = \"ipc.types.ts\";\n", "import crypto from \"crypto\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport { Logger } from \"vite\";\n\nimport { generateGlobalTypes } from \"./generator/generate-global-types.js\";\nimport { generateRuntimeTypes } from \"./generator/generate-runtime-types.js\";\nimport { normalizePath } from \"./normalize-path.js\";\nimport { findControllers } from \"./parser/find-controllers.js\";\nimport { PluginState } from \"./plugin-state.js\";\nimport { resolveApiRootFromPreload } from \"./preload/resolve-api-root.js\";\nimport { resolveTypePaths } from \"./resolve-type-paths.js\";\nimport type { PluginTypesOptions, ResolutionStrategy } from \"./types.js\";\n\nexport function generateIpc(\n root: string,\n logger: Logger,\n state: PluginState,\n options: {\n main: string;\n preload: string;\n types: PluginTypesOptions;\n resolutionStrategy?: ResolutionStrategy;\n },\n): void {\n try {\n const { main, preload, resolutionStrategy, types } = options;\n const preloadPath = path.resolve(root, preload);\n const { dependencies: preloadDependencies, namespace: resolvedApiRoot } = resolveApiRootFromPreload(preloadPath);\n const entryPath = path.resolve(root, main);\n if (!fs.existsSync(entryPath)) {\n logger.warn(`Main entry not found at: ${entryPath}`);\n return;\n }\n\n logger.info(`Generating IPC types from ${entryPath}...`);\n const { controllers, processedFiles, program } = findControllers(\n entryPath,\n undefined,\n state.getProgram(),\n resolutionStrategy,\n );\n state.setProgram(program);\n\n if (controllers.length === 0) {\n logger.warn(`No createIpcApp() call found in ${entryPath}; generated types will be empty.`);\n }\n\n state.setControllerFiles(new Set([...processedFiles, ...preloadDependencies].map(normalizePath)));\n\n const { globalPath, runtimePath } = resolveTypePaths({\n hasRendererRuntimeDir: (absPath) => fs.existsSync(absPath),\n preloadPath,\n root,\n types,\n });\n\n if (!runtimePath && !globalPath) {\n logger.warn(`Both runtime and global type outputs are disabled; nothing to generate.`);\n return;\n }\n\n let runtimeTypesContent: string | null = null;\n let globalTypesContent: string | null = null;\n\n if (runtimePath) {\n runtimeTypesContent = generateRuntimeTypes(controllers);\n }\n\n if (globalPath) {\n const ipcApiImportPath = (() => {\n if (!runtimePath) {\n throw new Error(\"Global type generation requires a runtime types output path.\");\n }\n const rel = path\n .relative(path.dirname(globalPath), runtimePath)\n .replace(/\\\\/g, \"/\")\n .replace(/\\.tsx?$/, \".ts\")\n .replace(/(\\.d)?\\.ts$/, \"\");\n return rel.startsWith(\".\") ? rel : `./${rel}`;\n })();\n globalTypesContent = generateGlobalTypes(resolvedApiRoot, ipcApiImportPath);\n }\n\n const combinedHash = crypto\n .createHash(\"md5\")\n .update(runtimeTypesContent ?? \"\")\n .update(globalTypesContent ?? \"\")\n .digest(\"hex\");\n\n if (!state.updateHash(combinedHash)) return;\n\n if (runtimePath && runtimeTypesContent != null) {\n fs.mkdirSync(path.dirname(runtimePath), { recursive: true });\n fs.writeFileSync(runtimePath, runtimeTypesContent);\n logger.info(`Runtime types generated at ${path.relative(root, runtimePath)}`);\n }\n\n if (globalPath && globalTypesContent != null) {\n fs.mkdirSync(path.dirname(globalPath), { recursive: true });\n fs.writeFileSync(globalPath, globalTypesContent);\n logger.info(`Global types generated at ${path.relative(root, globalPath)}`);\n }\n } catch (err) {\n logger.error(`Type generation failed: ${err instanceof Error ? err.message : String(err)}`);\n }\n}\n", "export const IPC_CONTRACT_CHANNEL = \"ipc_controller_contract\";\nexport const IPC_DEFAULT_API_ROOT = \"ipc\";\nexport const IPC_DECORATOR_ON = \"IpcOn\";\nexport const IPC_DECORATOR_ONCE = \"IpcOnce\";\nexport const IPC_DECORATOR_HANDLE = \"IpcHandle\";\nexport const IPC_DECORATOR_HANDLE_ONCE = \"IpcHandleOnce\";\nexport const IPC_METHOD_DECORATOR_NAMES = [\n IPC_DECORATOR_HANDLE,\n IPC_DECORATOR_ON,\n IPC_DECORATOR_HANDLE_ONCE,\n IPC_DECORATOR_ONCE,\n];\nexport const IPC_PARAM_INJECTION_DECORATOR_NAMES = [\n \"Channel\",\n \"CorrelationId\",\n \"Origin\",\n \"ProcessId\",\n \"RawEvent\",\n \"Sender\",\n \"Window\",\n];\n", "export const toSnakeCase = (str) => str\n .trim()\n .replace(/[\\s-]+/g, \"_\")\n .replace(/(?<=[A-Z])(?=[A-Z][a-z])/g, \"_\")\n .replace(/([a-z\\d])([A-Z])/g, \"$1_$2\")\n .toLocaleLowerCase();\n", "import { toSnakeCase } from \"./to-snake-case.js\";\nexport const toCamelCase = (str) => toSnakeCase(str)\n .replace(/_([a-z0-9])/g, (_, c) => c.toLocaleUpperCase())\n .replace(/_/g, \"\")\n .replace(/^./, (s) => s.toLocaleLowerCase());\n", "import { toCamelCase } from \"./to-camel-case.js\";\nexport const deriveNamespace = (name) => toCamelCase(name.replace(/Controller$/, \"\"));\n", "import { IPC_DEFAULT_API_ROOT } from \"@electron-ipc-bridge/shared\";\n\nexport const generateGlobalTypes = (namespace: string = IPC_DEFAULT_API_ROOT, ipcApiImportPath: string): string => {\n const isValidIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(namespace);\n const windowProperty = isValidIdentifier ? `${namespace}: IpcApi;` : `[${JSON.stringify(namespace)}]: IpcApi;`;\n\n return `// Auto-generated by @electron-ipc-bridge/vite-plugin\n// Do not edit manually\n\nimport type { IpcApi } from \"${ipcApiImportPath}\";\n\ndeclare global {\n interface Window {\n ${windowProperty}\n }\n}\n\nexport {};\n`;\n};\n", "import { IPC_DECORATOR_ON, IPC_DECORATOR_ONCE } from \"@electron-ipc-bridge/shared\";\n\nexport const getReturnType = (decorator: string, originalReturnType: string): string => {\n if (decorator === IPC_DECORATOR_ON || decorator === IPC_DECORATOR_ONCE) {\n return \"void\";\n }\n\n if (originalReturnType.startsWith(\"Promise<\")) {\n return originalReturnType;\n }\n\n return `Promise<${originalReturnType}>`;\n};\n", "import type { ControllerMetadata } from \"../parser/types.js\";\n\nimport { getReturnType } from \"./get-return-type.js\";\n\nexport const buildNamespaces = (controllers: ControllerMetadata[]): string[] => {\n return controllers.map((controller) => {\n const methods = controller.methods.map((method) => {\n const params = method.params.map((p) => `${p.name}${p.optional ? \"?\" : \"\"}: ${p.type}`).join(\", \");\n const returnType = getReturnType(method.decoratorName, method.returnType);\n return `${method.name}(${params}): ${returnType};`;\n });\n\n return ` ${controller.namespace}: {\\n ${methods.join(\"\\n \")}\\n };`;\n });\n};\n", "import type { ControllerMetadata } from \"../parser/types.js\";\n\nexport const buildTypeDefinitions = (controllers: ControllerMetadata[]): string => {\n const referencedTypes = new Map<string, string>();\n\n const collectTypes = (types: (typeof controllers)[0][\"referencedTypes\"]) => {\n types.forEach((t) => {\n if (t.definition && !referencedTypes.has(t.name)) {\n referencedTypes.set(t.name, t.definition);\n collectTypes(t.referencedTypes);\n }\n });\n };\n\n controllers.forEach((c) => collectTypes(c.referencedTypes));\n\n return Array.from(referencedTypes.entries())\n .sort((a, b) => a[0].localeCompare(b[0]))\n .map(([, def]) => `export ${def}`)\n .join(\"\\n\\n\");\n};\n", "import type { ControllerMetadata } from \"../parser/types.js\";\n\nimport { buildNamespaces } from \"./build-namespaces.js\";\nimport { buildTypeDefinitions } from \"./build-type-definitions.js\";\n\nexport const generateRuntimeTypes = (controllers: ControllerMetadata[]): string => {\n const referenceTypes = Array.from(new Set(controllers.flatMap((c) => c.requiredReferenceTypes ?? []))).sort();\n const referenceDirectives = referenceTypes.map((refType) => `/// <reference types=\"${refType}\" />`).join(\"\\n\");\n const typeDefinitions = buildTypeDefinitions(controllers);\n const namespaces = buildNamespaces(controllers);\n\n const sections = [\"// Auto-generated by @electron-ipc-bridge/vite-plugin\", \"// Do not edit manually\", \"\"];\n if (referenceDirectives) {\n sections.push(referenceDirectives, \"\");\n }\n if (typeDefinitions) {\n sections.push(typeDefinitions, \"\");\n }\n\n return `${sections.join(\"\\n\")}\nexport interface IpcApi {\n${namespaces.join(\"\\n\")}\n}\n`;\n};\n", "export const normalizePath = (p: string): string => p.replace(/\\\\/g, \"/\");\n", "import path from \"path\";\nimport {\n CallExpression,\n CompilerOptions,\n createProgram,\n findConfigFile,\n forEachChild,\n isCallExpression,\n isIdentifier,\n parseJsonConfigFileContent,\n Program,\n readConfigFile,\n sys,\n TypeChecker,\n} from \"typescript\";\n\nimport { nestResolutionStrategy } from \"../strategies/nest.js\";\nimport type { DependencyResolutionStrategy } from \"../strategies/types.js\";\nimport type { ResolutionStrategy } from \"../types.js\";\n\nimport { processCreateIpcAppCall } from \"./process-create-ipc-app-call.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\n/** Maps a user-facing strategy name (e.g. `\"nest\"`) to its concrete implementation function. */\nfunction resolveStrategy(option?: ResolutionStrategy): DependencyResolutionStrategy | undefined {\n if (option === \"nest\") return nestResolutionStrategy;\n return undefined;\n}\n\nexport interface FindControllersResult {\n controllers: ControllerMetadata[];\n processedFiles: Set<string>;\n program: Program;\n}\n\nconst isCreateIpcAppCall = (node: CallExpression, typeChecker: TypeChecker): boolean => {\n if (!isIdentifier(node.expression)) return false;\n const sym = typeChecker.getSymbolAtLocation(node.expression);\n if (!sym) return false;\n let target = sym;\n try {\n const aliased = typeChecker.getAliasedSymbol(sym);\n if (aliased) target = aliased;\n } catch {\n // Not an alias; use original symbol (e.g. local createIpcApp)\n }\n return target.name === \"createIpcApp\";\n};\n\nexport const findControllers = (\n entryFile: string,\n tsConfigPath?: string,\n oldProgram?: Program,\n resolutionStrategy?: ResolutionStrategy,\n): FindControllersResult => {\n const strategy = resolveStrategy(resolutionStrategy);\n const searchConfig = tsConfigPath || \"tsconfig.node.json\";\n let configFile = findConfigFile(path.dirname(entryFile), sys.fileExists, searchConfig);\n\n if (!configFile && !tsConfigPath) {\n configFile = findConfigFile(path.dirname(entryFile), sys.fileExists, \"tsconfig.json\");\n }\n\n let compilerOptions: CompilerOptions = {};\n if (configFile) {\n const { config } = readConfigFile(configFile, sys.readFile);\n const { options } = parseJsonConfigFileContent(config, sys, path.dirname(configFile));\n compilerOptions = options;\n }\n\n const program = createProgram([entryFile], compilerOptions, undefined, oldProgram);\n const typeChecker = program.getTypeChecker();\n const sourceFile = program.getSourceFile(entryFile);\n\n if (!sourceFile) {\n return { controllers: [], processedFiles: new Set(), program };\n }\n\n const controllers: ControllerMetadata[] = [];\n const processedFiles = new Set<string>();\n const fileCache = new Map<string, ControllerMetadata[]>();\n\n processedFiles.add(path.resolve(entryFile));\n\n forEachChild(sourceFile, function visit(node) {\n if (isCallExpression(node) && isCreateIpcAppCall(node, typeChecker)) {\n processCreateIpcAppCall(node, typeChecker, processedFiles, controllers, fileCache, strategy);\n }\n forEachChild(node, visit);\n });\n\n return { controllers, processedFiles, program };\n};\n", "import {\n ClassDeclaration,\n forEachChild,\n isCallExpression,\n isClassDeclaration,\n isIdentifier,\n isPropertyAccessExpression,\n SourceFile,\n TypeChecker,\n} from \"typescript\";\n\nimport { resolveControllersFromNestRoot } from \"../parser/resolve-controllers-from-nest-root.js\";\n\nimport type { DependencyResolutionStrategy, ResolutionContext } from \"./types.js\";\n\n/**\n * Scans a source file for `NestFactory.createApplicationContext(ModuleClass)` and\n * returns the class declaration of `ModuleClass` if found.\n */\nconst findNestRootModule = (sourceFile: SourceFile, typeChecker: TypeChecker): ClassDeclaration | undefined => {\n let found: ClassDeclaration | undefined;\n\n const visit = (node: import(\"typescript\").Node): void => {\n if (found) return;\n if (!isCallExpression(node)) {\n forEachChild(node, visit);\n return;\n }\n const expr = node.expression;\n if (!isPropertyAccessExpression(expr) || expr.name.text !== \"createApplicationContext\") {\n forEachChild(node, visit);\n return;\n }\n const firstArg = node.arguments[0];\n if (!firstArg || !isIdentifier(firstArg)) {\n forEachChild(node, visit);\n return;\n }\n const symbol = typeChecker.getSymbolAtLocation(firstArg);\n if (!symbol) {\n forEachChild(node, visit);\n return;\n }\n let targetSymbol = symbol;\n try {\n const aliased = typeChecker.getAliasedSymbol(symbol);\n if (aliased) targetSymbol = aliased;\n } catch {\n // not an alias\n }\n const decl = targetSymbol.declarations?.[0];\n if (decl && isClassDeclaration(decl)) {\n found = decl;\n return;\n }\n forEachChild(node, visit);\n };\n\n forEachChild(sourceFile, visit);\n return found;\n};\n\n/**\n * NestJS resolution strategy: locates the root module via\n * `NestFactory.createApplicationContext(ModuleClass)` and recursively walks\n * `@Module({ imports: [...] })` to discover all IPC controllers.\n */\nexport const nestResolutionStrategy = (context: ResolutionContext): ReturnType<DependencyResolutionStrategy> => {\n const { fileCache, processedFiles, sourceFile, typeChecker } = context;\n const rootModule = findNestRootModule(sourceFile, typeChecker);\n if (!rootModule) return [];\n\n const controllers: ReturnType<DependencyResolutionStrategy> = [];\n const visitedModules = new Set<string>();\n resolveControllersFromNestRoot(rootModule, typeChecker, processedFiles, controllers, fileCache, visitedModules);\n return controllers;\n};\n", "import path from \"path\";\nimport {\n ClassDeclaration,\n Expression,\n getDecorators,\n isArrayLiteralExpression,\n isArrowFunction,\n isBlock,\n isCallExpression,\n isClassDeclaration,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isReturnStatement,\n TypeChecker,\n} from \"typescript\";\n\nimport { resolveControllersFromModuleClass } from \"./resolve-controllers-from-module-class.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nconst normalizePathSafe = (p: string) => path.normalize(p).replace(/\\\\/g, \"/\");\n\nfunction resolveImportElementToClass(element: Expression, typeChecker: TypeChecker): ClassDeclaration | undefined {\n if (isIdentifier(element)) {\n const symbol = typeChecker.getSymbolAtLocation(element);\n if (!symbol) return undefined;\n let target = symbol;\n try {\n const aliased = typeChecker.getAliasedSymbol(symbol);\n if (aliased) target = aliased;\n } catch {\n // not an alias\n }\n const decl = target.declarations?.[0];\n return decl && isClassDeclaration(decl) ? decl : undefined;\n }\n if (isCallExpression(element)) {\n const firstArg = element.arguments[0];\n if (!firstArg) return undefined;\n if (isArrowFunction(firstArg)) {\n const body = firstArg.body;\n if (isIdentifier(body)) return resolveImportElementToClass(body, typeChecker);\n if (isBlock(body)) {\n const ret = body.statements.find((s) => isReturnStatement(s));\n if (ret && isReturnStatement(ret) && ret.expression)\n return resolveImportElementToClass(ret.expression, typeChecker);\n }\n }\n }\n return undefined;\n}\n\n/**\n * Resolves all IPC controllers from a Nest root module and its imported modules recursively.\n */\nexport const resolveControllersFromNestRoot = (\n targetDecl: ClassDeclaration,\n typeChecker: TypeChecker,\n processedFiles: Set<string>,\n controllers: ControllerMetadata[],\n fileCache: Map<string, ControllerMetadata[]>,\n visitedModules: Set<string>,\n): void => {\n const sourceFile = targetDecl.getSourceFile();\n const filePath = normalizePathSafe(sourceFile.fileName);\n if (visitedModules.has(filePath)) return;\n visitedModules.add(filePath);\n\n resolveControllersFromModuleClass(targetDecl, typeChecker, processedFiles, controllers, fileCache);\n\n const decorators = getDecorators(targetDecl);\n if (!decorators) return;\n\n for (const decorator of decorators) {\n if (!isCallExpression(decorator.expression)) continue;\n const moduleArgs = decorator.expression.arguments;\n const moduleOptions = moduleArgs[0];\n if (!moduleOptions || !isObjectLiteralExpression(moduleOptions)) continue;\n\n const importsProp = moduleOptions.properties.find(\n (p): p is import(\"typescript\").PropertyAssignment =>\n isPropertyAssignment(p) && isIdentifier(p.name) && p.name.text === \"imports\",\n );\n if (!importsProp || !isArrayLiteralExpression(importsProp.initializer)) continue;\n\n for (const element of importsProp.initializer.elements) {\n const importClass = resolveImportElementToClass(element, typeChecker);\n if (importClass) {\n resolveControllersFromNestRoot(\n importClass,\n typeChecker,\n processedFiles,\n controllers,\n fileCache,\n visitedModules,\n );\n }\n }\n break;\n }\n};\n", "import {\n ClassDeclaration,\n getDecorators,\n isArrayLiteralExpression,\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n TypeChecker,\n} from \"typescript\";\n\nimport { resolveController } from \"./resolve-controller.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nexport const resolveControllersFromModuleClass = (\n targetDecl: ClassDeclaration,\n typeChecker: TypeChecker,\n processedFiles: Set<string>,\n controllers: ControllerMetadata[],\n fileCache: Map<string, ControllerMetadata[]>,\n): void => {\n const decorators = getDecorators(targetDecl);\n if (!decorators) return;\n\n for (const decorator of decorators) {\n if (!isCallExpression(decorator.expression)) continue;\n const moduleArgs = decorator.expression.arguments;\n const moduleOptions = moduleArgs[0];\n if (!moduleOptions || !isObjectLiteralExpression(moduleOptions)) continue;\n\n const properties = moduleOptions.properties;\n for (const prop of properties) {\n if (!isPropertyAssignment(prop) || !isIdentifier(prop.name)) continue;\n if (prop.name.text === \"providers\" || prop.name.text === \"controllers\") {\n if (!isArrayLiteralExpression(prop.initializer)) continue;\n const providerElements = prop.initializer.elements;\n providerElements.forEach((element) => {\n resolveController(element, typeChecker, processedFiles, controllers, fileCache);\n });\n }\n }\n }\n};\n", "import { Expression, isClassDeclaration, TypeChecker } from \"typescript\";\n\nimport { collectDependencies } from \"./collect-dependencies.js\";\nimport { extractControllerMetadata } from \"./extract-metadata.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nexport const resolveController = (\n node: Expression,\n typeChecker: TypeChecker,\n processedFiles: Set<string>,\n controllers: ControllerMetadata[],\n fileCache: Map<string, ControllerMetadata[]>,\n): void => {\n const symbol = typeChecker.getSymbolAtLocation(node);\n if (!symbol) return;\n\n let targetSymbol = symbol;\n try {\n const aliasedSymbol = typeChecker.getAliasedSymbol(symbol);\n targetSymbol = aliasedSymbol || symbol;\n } catch {\n // Not an alias\n }\n\n if (!targetSymbol.declarations || targetSymbol.declarations.length === 0) return;\n\n const targetDecl = targetSymbol.declarations[0];\n if (!isClassDeclaration(targetDecl)) return;\n\n const sourceFile = targetDecl.getSourceFile();\n const fileName = sourceFile.fileName;\n const className = targetDecl.name?.text;\n if (!className) return;\n\n let fileControllers = fileCache.get(fileName);\n if (fileControllers === undefined) {\n fileControllers = extractControllerMetadata(sourceFile, typeChecker);\n fileCache.set(fileName, fileControllers);\n processedFiles.add(fileName);\n }\n\n const match = fileControllers.find((c) => c.className === className);\n if (match) {\n controllers.push(match);\n collectDependencies(match.referencedTypes, processedFiles);\n }\n};\n", "import { ControllerMetadata, TypeDefinition } from \"./types.js\";\n\nexport const collectDependencies = (\n referencedTypes: ControllerMetadata[\"referencedTypes\"],\n processedFiles: Set<string>,\n) => {\n const visited = new Set<TypeDefinition>();\n\n const visit = (types: typeof referencedTypes) => {\n for (const type of types) {\n if (visited.has(type)) {\n continue;\n }\n visited.add(type);\n\n if (type.sourceFile) {\n processedFiles.add(type.sourceFile);\n }\n visit(type.referencedTypes);\n }\n };\n visit(referencedTypes);\n};\n", "import { forEachChild, isClassDeclaration, SourceFile, TypeChecker } from \"typescript\";\n\nimport { getDecorator } from \"./get-decorator.js\";\nimport { parseController } from \"./parse-controller.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nexport const extractControllerMetadata = (sourceFile: SourceFile, typeChecker: TypeChecker): ControllerMetadata[] => {\n const controllers: ControllerMetadata[] = [];\n\n forEachChild(sourceFile, (node) => {\n if (isClassDeclaration(node)) {\n const decorator = getDecorator(node, \"IpcController\");\n if (decorator) {\n const controller = parseController(node, decorator, sourceFile, typeChecker);\n if (controller) {\n controllers.push(controller);\n }\n }\n }\n });\n\n return controllers;\n};\n", "import { canHaveDecorators, Decorator, getDecorators, isCallExpression, isIdentifier, Node } from \"typescript\";\n\nexport const getDecorator = (node: Node, name: string): Decorator | undefined => {\n if (!canHaveDecorators(node)) return undefined;\n\n const decorators = getDecorators(node);\n if (!decorators) return undefined;\n\n return decorators.find(\n (m) =>\n isCallExpression(m.expression) && isIdentifier(m.expression.expression) && m.expression.expression.text === name,\n );\n};\n", "import { deriveNamespace } from \"@electron-ipc-bridge/shared\";\nimport {\n ClassDeclaration,\n Decorator,\n isCallExpression,\n isIdentifier,\n isMethodDeclaration,\n isStringLiteral,\n SourceFile,\n TypeChecker,\n} from \"typescript\";\n\nimport { parseMethod } from \"./parse-method.js\";\nimport { ControllerMetadata, MethodMetadata } from \"./types.js\";\n\nexport const parseController = (\n node: ClassDeclaration,\n decorator: Decorator,\n sourceFile: SourceFile,\n typeChecker: TypeChecker,\n): ControllerMetadata => {\n const className = node.name!.text;\n let namespace = deriveNamespace(className);\n\n if (isCallExpression(decorator.expression)) {\n const args = decorator.expression.arguments;\n if (args.length > 0 && isStringLiteral(args[0])) {\n namespace = args[0].text;\n }\n }\n\n const methods: MethodMetadata[] = [];\n\n node.members.forEach((member) => {\n if (isMethodDeclaration(member) && member.name && isIdentifier(member.name)) {\n const methodMeta = parseMethod(member, typeChecker);\n if (methodMeta) {\n methods.push(methodMeta);\n }\n }\n });\n\n const referencedTypes = methods.flatMap((m) => m.referencedTypes);\n const requiredReferenceTypes = Array.from(new Set(methods.flatMap((m) => m.requiredReferenceTypes ?? []))).sort();\n\n return {\n className,\n filePath: sourceFile.fileName,\n methods,\n namespace,\n referencedTypes,\n requiredReferenceTypes,\n };\n};\n", "import {\n IPC_DECORATOR_ON,\n IPC_DECORATOR_ONCE,\n IPC_METHOD_DECORATOR_NAMES,\n IPC_PARAM_INJECTION_DECORATOR_NAMES,\n} from \"@electron-ipc-bridge/shared\";\nimport type { Decorator } from \"typescript\";\nimport { Identifier, isCallExpression, isStringLiteral, MethodDeclaration, TypeChecker } from \"typescript\";\n\nimport { collectExternalTypeReferencesFromType } from \"./collect-external-type-references.js\";\nimport { collectTypeDefinitions, collectTypeDefinitionsFromType } from \"./extract-type.js\";\nimport { getDecorator } from \"./get-decorator.js\";\nimport { resolveReturnType } from \"./resolve-return-type.js\";\nimport { MethodMetadata, ParamMetadata, TypeDefinition } from \"./types.js\";\n\nexport const parseMethod = (node: MethodDeclaration, typeChecker: TypeChecker): MethodMetadata | null => {\n let found: (typeof IPC_METHOD_DECORATOR_NAMES)[number] | null = null;\n let decorator: Decorator | null = null;\n for (const d of IPC_METHOD_DECORATOR_NAMES) {\n const dec = getDecorator(node, d);\n if (dec) {\n found = d;\n decorator = dec;\n break;\n }\n }\n if (!found || !decorator) return null;\n\n let name = (node.name as Identifier).text;\n\n if (isCallExpression(decorator.expression)) {\n const args = decorator.expression.arguments;\n if (args.length > 0 && isStringLiteral(args[0])) {\n name = args[0].text;\n }\n }\n\n const signature = typeChecker.getSignatureFromDeclaration(node);\n const returnType = resolveReturnType(node, signature ?? undefined, typeChecker);\n\n const referencedTypes: TypeDefinition[] = [];\n const requiredReferenceTypes = new Set<string>();\n const seen = new Set<string>();\n\n const paramInfos = node.parameters.map((param) => {\n const hasInjection = IPC_PARAM_INJECTION_DECORATOR_NAMES.some((d) => getDecorator(param, d));\n return { hasInjection, param };\n });\n\n const params: ParamMetadata[] = [];\n for (const { hasInjection, param } of paramInfos) {\n const type = typeChecker.getTypeAtLocation(param);\n const typeString = typeChecker.typeToString(type);\n const extracted = !hasInjection && param.type ? collectTypeDefinitions(param.type, typeChecker, seen) : [];\n if (!hasInjection) {\n collectExternalTypeReferencesFromType(type, typeChecker, requiredReferenceTypes);\n }\n referencedTypes.push(...extracted);\n params.push({\n name: param.name.getText(),\n optional: !!param.questionToken || !!param.initializer,\n type: typeString,\n });\n }\n\n const filteredParams = params.filter((_, index) => !paramInfos[index].hasInjection);\n\n if (node.type) {\n const returnTypeRefs = collectTypeDefinitions(node.type, typeChecker, seen);\n referencedTypes.push(...returnTypeRefs);\n } else if (signature) {\n const returnTypeRefs = collectTypeDefinitionsFromType(signature.getReturnType(), typeChecker, seen);\n referencedTypes.push(...returnTypeRefs);\n }\n\n if (signature && found !== IPC_DECORATOR_ON && found !== IPC_DECORATOR_ONCE) {\n collectExternalTypeReferencesFromType(signature.getReturnType(), typeChecker, requiredReferenceTypes);\n }\n\n return {\n decoratorName: found,\n name,\n params: filteredParams,\n referencedTypes,\n requiredReferenceTypes: Array.from(requiredReferenceTypes).sort(),\n returnType,\n };\n};\n", "import {\n isEnumDeclaration,\n isInterfaceDeclaration,\n isTypeAliasDeclaration,\n Symbol,\n Type,\n TypeChecker,\n} from \"typescript\";\n\nconst NODE_TYPES_PATH_RE = /[\\\\/]@types[\\\\/]node[\\\\/]/i;\n\nconst pickDeclaration = (symbol: Symbol | undefined) =>\n symbol\n ?.getDeclarations()\n ?.find((d) => isTypeAliasDeclaration(d) || isInterfaceDeclaration(d) || isEnumDeclaration(d));\n\nconst resolveDeclarationFromSymbol = (symbol: Symbol | undefined, typeChecker: TypeChecker) => {\n let decl = pickDeclaration(symbol);\n if (!decl && symbol) {\n try {\n const aliased = typeChecker.getAliasedSymbol(symbol);\n const aliasedDecl = pickDeclaration(aliased);\n if (aliasedDecl) {\n decl = aliasedDecl;\n }\n } catch {\n // Not an alias; fall back to original symbol\n }\n }\n return decl;\n};\n\nconst addReferenceTypeIfExternal = (symbol: Symbol | undefined, typeChecker: TypeChecker, out: Set<string>): void => {\n const decl = resolveDeclarationFromSymbol(symbol, typeChecker);\n if (!decl) return;\n\n const sourceFile = decl.getSourceFile();\n if (NODE_TYPES_PATH_RE.test(sourceFile.fileName)) {\n out.add(\"node\");\n }\n};\n\nconst walkTypeForExternalRefs = (type: Type, typeChecker: TypeChecker, seen: Set<Type>, out: Set<string>): void => {\n if (seen.has(type)) return;\n seen.add(type);\n\n addReferenceTypeIfExternal(type.getSymbol(), typeChecker, out);\n\n const typeWithAlias = type as Type & { aliasSymbol?: Symbol };\n addReferenceTypeIfExternal(typeWithAlias.aliasSymbol, typeChecker, out);\n\n const typeWithNested = type as Type & {\n aliasTypeArguments?: readonly Type[];\n typeArguments?: readonly Type[];\n types?: readonly Type[];\n };\n\n typeWithNested.aliasTypeArguments?.forEach((arg) => walkTypeForExternalRefs(arg, typeChecker, seen, out));\n typeWithNested.typeArguments?.forEach((arg) => walkTypeForExternalRefs(arg, typeChecker, seen, out));\n typeWithNested.types?.forEach((nested) => walkTypeForExternalRefs(nested, typeChecker, seen, out));\n};\n\nexport const collectExternalTypeReferencesFromType = (\n type: Type,\n typeChecker: TypeChecker,\n out = new Set<string>(),\n): Set<string> => {\n walkTypeForExternalRefs(type, typeChecker, new Set<Type>(), out);\n return out;\n};\n", "import {\n createPrinter,\n EmitHint,\n forEachChild,\n isEnumDeclaration,\n isInterfaceDeclaration,\n isTypeAliasDeclaration,\n isTypeReferenceNode,\n Node,\n Symbol,\n Type,\n TypeChecker,\n} from \"typescript\";\n\nimport { BUILTIN_TYPE_NAMES } from \"./constants.js\";\nimport { TypeDefinition } from \"./types.js\";\n\nconst printer = createPrinter({ removeComments: true });\n\nexport const collectTypeDefinitions = (\n node: Node,\n typeChecker: TypeChecker,\n seen = new Set<string>(),\n): TypeDefinition[] => {\n const result: TypeDefinition[] = [];\n walkForTypeRefs(node, typeChecker, seen, result);\n return result;\n};\n\nexport const collectTypeDefinitionsFromType = (\n type: Type,\n typeChecker: TypeChecker,\n seen = new Set<string>(),\n): TypeDefinition[] => {\n const result: TypeDefinition[] = [];\n walkTypeForTypeRefs(type, typeChecker, seen, result);\n return result;\n};\n\nconst pickDeclaration = (symbol: Symbol | undefined) =>\n symbol\n ?.getDeclarations()\n ?.find((d) => isTypeAliasDeclaration(d) || isInterfaceDeclaration(d) || isEnumDeclaration(d));\n\nconst resolveDeclarationFromSymbol = (symbol: Symbol | undefined, typeChecker: TypeChecker) => {\n let decl = pickDeclaration(symbol);\n if (!decl && symbol) {\n try {\n const aliased = typeChecker.getAliasedSymbol(symbol);\n const aliasedDecl = pickDeclaration(aliased);\n if (aliasedDecl) {\n decl = aliasedDecl;\n }\n } catch {\n // Not an alias; fall back to original symbol\n }\n }\n return decl;\n};\n\nconst addDefinitionFromDeclaration = (\n decl: ReturnType<typeof pickDeclaration>,\n typeChecker: TypeChecker,\n seen: Set<string>,\n out: TypeDefinition[],\n): void => {\n if (!decl || !(isTypeAliasDeclaration(decl) || isInterfaceDeclaration(decl) || isEnumDeclaration(decl))) {\n return;\n }\n const name = decl.name.text;\n if (BUILTIN_TYPE_NAMES.has(name) || seen.has(name)) {\n return;\n }\n seen.add(name);\n\n const sourceFile = decl.getSourceFile();\n if (sourceFile.fileName.includes(\"node_modules\")) {\n return;\n }\n\n const referencedTypes: TypeDefinition[] = [];\n walkForTypeRefs(decl, typeChecker, seen, referencedTypes);\n\n const definition = printer\n .printNode(EmitHint.Unspecified, decl, sourceFile)\n .replace(/^\\s*export\\s+/, \"\")\n .replace(/^\\s*declare\\s+/, \"\")\n .trim();\n\n if (definition) {\n out.push({ definition, name, referencedTypes, sourceFile: sourceFile.fileName });\n }\n};\n\nconst walkForTypeRefs = (node: Node, typeChecker: TypeChecker, seen: Set<string>, out: TypeDefinition[]): void => {\n if (isTypeReferenceNode(node)) {\n const sym = typeChecker.getSymbolAtLocation(node.typeName);\n addDefinitionFromDeclaration(resolveDeclarationFromSymbol(sym, typeChecker), typeChecker, seen, out);\n\n if (node.typeArguments) {\n node.typeArguments.forEach((arg) => walkForTypeRefs(arg, typeChecker, seen, out));\n }\n return;\n }\n\n forEachChild(node, (child) => walkForTypeRefs(child, typeChecker, seen, out));\n};\n\nconst walkTypeForTypeRefs = (type: Type, typeChecker: TypeChecker, seen: Set<string>, out: TypeDefinition[]): void => {\n addDefinitionFromDeclaration(resolveDeclarationFromSymbol(type.getSymbol(), typeChecker), typeChecker, seen, out);\n\n const typeWithAlias = type as Type & { aliasSymbol?: Symbol };\n addDefinitionFromDeclaration(\n resolveDeclarationFromSymbol(typeWithAlias.aliasSymbol, typeChecker),\n typeChecker,\n seen,\n out,\n );\n\n const typeWithNested = type as Type & {\n aliasTypeArguments?: readonly Type[];\n typeArguments?: readonly Type[];\n types?: readonly Type[];\n };\n\n typeWithNested.aliasTypeArguments?.forEach((arg) => walkTypeForTypeRefs(arg, typeChecker, seen, out));\n typeWithNested.typeArguments?.forEach((arg) => walkTypeForTypeRefs(arg, typeChecker, seen, out));\n typeWithNested.types?.forEach((nested) => walkTypeForTypeRefs(nested, typeChecker, seen, out));\n};\n", "export const BUILTIN_TYPE_NAMES = new Set([\n \"Promise\",\n \"Array\",\n \"Map\",\n \"Set\",\n \"WeakMap\",\n \"WeakSet\",\n \"Date\",\n \"RegExp\",\n \"Function\",\n \"Symbol\",\n \"Error\",\n \"Record\",\n \"Partial\",\n \"Required\",\n \"Readonly\",\n \"Pick\",\n \"Omit\",\n \"Exclude\",\n \"Extract\",\n \"NonNullable\",\n \"ReturnType\",\n \"Parameters\",\n \"InstanceType\",\n \"ConstructorParameters\",\n \"__type\",\n \"undefined\",\n]);\n", "import type { Signature } from \"typescript\";\nimport { createPrinter, EmitHint, MethodDeclaration, TypeChecker, TypeFormatFlags } from \"typescript\";\n\nimport { isTruncatedTypeString } from \"./is-truncated-type-string.js\";\n\nconst printer = createPrinter();\n\nexport const resolveReturnType = (\n node: MethodDeclaration,\n signature: Signature | undefined,\n typeChecker: TypeChecker,\n): string => {\n if (node.type) {\n return printer.printNode(EmitHint.Unspecified, node.type, node.getSourceFile()).trim();\n }\n const inferred =\n signature != null\n ? typeChecker.typeToString(\n signature.getReturnType(),\n undefined,\n TypeFormatFlags.NoTruncation | TypeFormatFlags.UseFullyQualifiedType,\n )\n : \"unknown\";\n\n if (isTruncatedTypeString(inferred)) return \"unknown\";\n\n // Strip import(\"...\") wrappers only for local file paths (starting with ./, ../, /, or Drive letter)\n // This keeps external package imports (like import(\"zod\")) intact, while simplifying local types to their names\n // (since we generate definitions for them in the same file).\n return inferred.replace(/import\\(\"(?:\\.|\\/|[a-zA-Z]:).*?\"\\)\\./g, \"\");\n};\n", "/** True if the type string was truncated by TypeScript (e.g. \"... 27 more ...\"). */\nexport const isTruncatedTypeString = (s: string): boolean => /\\.\\.\\.\\s+\\d+\\s+more\\s+\\.\\.\\./.test(s);\n", "import {\n CallExpression,\n isArrayLiteralExpression,\n isCallExpression,\n isClassDeclaration,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n PropertyAssignment,\n TypeChecker,\n} from \"typescript\";\n\nimport { DependencyResolutionStrategy } from \"../strategies/types.js\";\n\nimport { resolveExpression } from \"./ast-utils.js\";\nimport { resolveControllersFromArray } from \"./resolve-controllers-from-array.js\";\nimport { resolveControllersFromModule } from \"./resolve-controllers-from-module.js\";\nimport { resolveControllersFromModuleClass } from \"./resolve-controllers-from-module-class.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nexport const processCreateIpcAppCall = (\n node: CallExpression,\n typeChecker: TypeChecker,\n processedFiles: Set<string>,\n controllers: ControllerMetadata[],\n fileCache: Map<string, ControllerMetadata[]>,\n resolutionStrategy?: DependencyResolutionStrategy,\n): void => {\n const args = node.arguments;\n if (args.length === 0) return;\n\n const optionsObj = resolveExpression(args[0], typeChecker);\n if (!isObjectLiteralExpression(optionsObj)) return;\n\n const controllersProp = optionsObj.properties.find(\n (p): p is PropertyAssignment => isPropertyAssignment(p) && isIdentifier(p.name) && p.name.text === \"controllers\",\n );\n\n if (!controllersProp) return;\n\n const initializer = resolveExpression(controllersProp.initializer, typeChecker);\n\n if (isArrayLiteralExpression(initializer)) {\n resolveControllersFromArray(initializer, typeChecker, processedFiles, controllers, fileCache);\n return;\n }\n\n if (isCallExpression(initializer)) {\n resolveControllersFromModule(initializer, typeChecker, processedFiles, controllers, fileCache);\n\n for (const arg of initializer.arguments) {\n const resolvedArg = resolveExpression(arg, typeChecker);\n\n if (isCallExpression(resolvedArg)) {\n for (const factoryArg of resolvedArg.arguments) {\n const resolvedFactoryArg = resolveExpression(factoryArg, typeChecker);\n\n if (!isIdentifier(resolvedFactoryArg)) continue;\n const factorySymbol = typeChecker.getSymbolAtLocation(resolvedFactoryArg);\n if (!factorySymbol) continue;\n\n let targetSymbol = factorySymbol;\n try {\n const aliased = typeChecker.getAliasedSymbol(factorySymbol);\n targetSymbol = aliased || factorySymbol;\n } catch {\n // Not an alias\n }\n\n const targetDecl = targetSymbol.declarations?.[0];\n if (targetDecl && isClassDeclaration(targetDecl)) {\n resolveControllersFromModuleClass(targetDecl, typeChecker, processedFiles, controllers, fileCache);\n }\n }\n }\n }\n\n if (controllers.length === 0 && resolutionStrategy) {\n const context = {\n fileCache,\n processedFiles,\n sourceFile: node.getSourceFile(),\n typeChecker,\n };\n const resolved = resolutionStrategy(context);\n controllers.push(...resolved);\n }\n }\n};\n", "import {\n Expression,\n isAsExpression,\n isAwaitExpression,\n isIdentifier,\n isNonNullExpression,\n isParenthesizedExpression,\n isSatisfiesExpression,\n isTypeAssertionExpression,\n isVariableDeclaration,\n TypeChecker,\n} from \"typescript\";\n\nexport const unwrapExpression = (expr: Expression): Expression => {\n let current = expr;\n while (true) {\n if (isAwaitExpression(current)) {\n current = current.expression;\n continue;\n }\n if (isParenthesizedExpression(current)) {\n current = current.expression;\n continue;\n }\n if (isAsExpression(current)) {\n current = current.expression;\n continue;\n }\n if (isTypeAssertionExpression(current)) {\n current = current.expression;\n continue;\n }\n if (isNonNullExpression(current)) {\n current = current.expression;\n continue;\n }\n if (isSatisfiesExpression(current)) {\n current = current.expression;\n continue;\n }\n return current;\n }\n};\n\nexport const resolveExpression = (expr: Expression, typeChecker: TypeChecker): Expression => {\n let current = unwrapExpression(expr);\n const visited = new Set<Expression>();\n\n while (isIdentifier(current)) {\n if (visited.has(current)) break;\n visited.add(current);\n\n const symbol = typeChecker.getSymbolAtLocation(current);\n if (!symbol) break;\n\n let targetSymbol = symbol;\n try {\n const aliasedSymbol = typeChecker.getAliasedSymbol(symbol);\n targetSymbol = aliasedSymbol || symbol;\n } catch {\n // Not an alias\n }\n\n const decl = targetSymbol.declarations?.[0];\n if (decl && isVariableDeclaration(decl) && decl.initializer) {\n current = unwrapExpression(decl.initializer);\n } else {\n break;\n }\n }\n\n return current;\n};\n", "import { ArrayLiteralExpression, TypeChecker } from \"typescript\";\n\nimport { resolveController } from \"./resolve-controller.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nexport const resolveControllersFromArray = (\n initializer: ArrayLiteralExpression,\n typeChecker: TypeChecker,\n processedFiles: Set<string>,\n controllers: ControllerMetadata[],\n fileCache: Map<string, ControllerMetadata[]>,\n): void => {\n initializer.elements.forEach((element) => {\n resolveController(element, typeChecker, processedFiles, controllers, fileCache);\n });\n};\n", "import { CallExpression, isClassDeclaration, isIdentifier, TypeChecker } from \"typescript\";\n\nimport { resolveControllersFromModuleClass } from \"./resolve-controllers-from-module-class.js\";\nimport { ControllerMetadata } from \"./types.js\";\n\nexport const resolveControllersFromModule = (\n callExpr: CallExpression,\n typeChecker: TypeChecker,\n processedFiles: Set<string>,\n controllers: ControllerMetadata[],\n fileCache: Map<string, ControllerMetadata[]>,\n): void => {\n const moduleArg = callExpr.arguments[0];\n if (moduleArg && isIdentifier(moduleArg)) {\n const moduleSymbol = typeChecker.getSymbolAtLocation(moduleArg);\n if (!moduleSymbol) return;\n\n let targetSymbol = moduleSymbol;\n try {\n const aliasedSymbol = typeChecker.getAliasedSymbol(moduleSymbol);\n targetSymbol = aliasedSymbol || moduleSymbol;\n } catch {\n // Not an alias\n }\n\n const targetDecl = targetSymbol.declarations?.[0];\n if (!targetDecl || !isClassDeclaration(targetDecl)) return;\n\n resolveControllersFromModuleClass(targetDecl, typeChecker, processedFiles, controllers, fileCache);\n }\n};\n", "import { IPC_DEFAULT_API_ROOT } from \"@electron-ipc-bridge/shared\";\nimport fs from \"fs\";\nimport {\n createSourceFile,\n forEachChild,\n isCallExpression,\n isIdentifier,\n isObjectLiteralExpression,\n isPropertyAssignment,\n isStringLiteral,\n ScriptTarget,\n} from \"typescript\";\n\nexport const resolveApiRootFromPreload = (preloadPath: string): { namespace: string; dependencies: Set<string> } => {\n const dependencies = new Set<string>();\n dependencies.add(preloadPath);\n let namespace: string = IPC_DEFAULT_API_ROOT;\n\n if (!fs.existsSync(preloadPath)) {\n return { dependencies, namespace };\n }\n\n const content = fs.readFileSync(preloadPath, \"utf-8\");\n const sourceFile = createSourceFile(preloadPath, content, ScriptTarget.Latest, true);\n\n const visit = (node: import(\"typescript\").Node) => {\n if (isCallExpression(node) && isIdentifier(node.expression) && node.expression.text === \"setupPreload\") {\n const args = node.arguments;\n if (args.length > 0) {\n const first = args[0];\n if (isStringLiteral(first)) {\n namespace = first.text;\n } else if (isObjectLiteralExpression(first)) {\n const namespaceProp = first.properties.find(\n (p) => isPropertyAssignment(p) && isIdentifier(p.name) && p.name.text === \"namespace\",\n );\n if (namespaceProp && isPropertyAssignment(namespaceProp) && isStringLiteral(namespaceProp.initializer)) {\n namespace = namespaceProp.initializer.text;\n }\n }\n }\n }\n forEachChild(node, visit);\n };\n\n forEachChild(sourceFile, visit);\n\n return { dependencies, namespace };\n};\n", "import path from \"path\";\n\nimport {\n DEFAULT_GLOBAL_TYPES_FILENAME,\n DEFAULT_RENDERER_RUNTIME_DIR,\n DEFAULT_RUNTIME_TYPES_FILENAME,\n} from \"./constants.js\";\nimport type { PluginTypesOptions } from \"./plugin.js\";\n\nexport interface ResolveTypePathsOptions {\n hasRendererRuntimeDir: (absPath: string) => boolean;\n preloadPath: string;\n root: string;\n types: PluginTypesOptions;\n}\n\nexport interface ResolvedTypePaths {\n globalPath: string | null;\n runtimePath: string | null;\n}\n\nexport const resolveTypePaths = ({\n hasRendererRuntimeDir,\n preloadPath,\n root,\n types,\n}: ResolveTypePathsOptions): ResolvedTypePaths => {\n const runtimePath =\n types.runtime === false\n ? null\n : types.runtime\n ? path.resolve(root, types.runtime)\n : (() => {\n const rendererSrc = path.resolve(root, DEFAULT_RENDERER_RUNTIME_DIR);\n if (hasRendererRuntimeDir(rendererSrc)) {\n return path.join(rendererSrc, DEFAULT_RUNTIME_TYPES_FILENAME);\n }\n return path.resolve(root, path.join(\"src\", DEFAULT_RUNTIME_TYPES_FILENAME));\n })();\n\n const globalPath =\n types.global === false\n ? null\n : types.global\n ? path.resolve(root, types.global)\n : path.join(path.dirname(preloadPath), DEFAULT_GLOBAL_TYPES_FILENAME);\n\n return { globalPath, runtimePath };\n};\n", "import type { Program } from \"typescript\";\n\nexport class PluginState {\n private controllerFiles: Set<string> | null = null;\n private debounceTimer: ReturnType<typeof setTimeout> | null = null;\n private hasGeneratedOnce = false;\n private lastHash: string | null = null;\n private program: Program | null = null;\n\n constructor(private readonly debounceMs = 100) {}\n\n claimInitialGeneration(): boolean {\n if (!this.hasGeneratedOnce) {\n this.hasGeneratedOnce = true;\n return true;\n }\n return false;\n }\n\n getProgram(): Program | undefined {\n return this.program ?? undefined;\n }\n\n scheduleGenerate(callback: () => void): void {\n if (this.debounceTimer) clearTimeout(this.debounceTimer);\n this.debounceTimer = setTimeout(() => {\n callback();\n this.debounceTimer = null;\n }, this.debounceMs);\n }\n\n setControllerFiles(files: Set<string>): void {\n this.controllerFiles = files;\n }\n\n setProgram(program: Program): void {\n this.program = program;\n }\n\n shouldRegenerate(absId: string, mainEntryPath: string, preloadEntryPath?: string): boolean {\n const isMainEntry = absId === mainEntryPath;\n const isPreloadEntry = preloadEntryPath ? absId === preloadEntryPath : false;\n const isControllerFile = this.controllerFiles?.has(absId);\n return isMainEntry || isPreloadEntry || !!isControllerFile;\n }\n\n updateHash(hash: string): boolean {\n if (hash === this.lastHash) {\n return false;\n }\n this.lastHash = hash;\n return true;\n }\n}\n"],
5
5
  "mappings": ";AAAA,OAAOA,WAAU;AACjB,SAAS,oBAAyC;;;ACDlD;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,eAAiB;AAAA,IACf,QAAU;AAAA,EACZ;AAAA,EACA,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,IACN,KAAO;AAAA,EACT;AAAA,EACA,UAAY;AAAA,EACZ,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,MAAQ;AAAA,EACR,OAAS;AAAA,EACT,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,EACF;AAAA,EACA,OAAS;AAAA,IACP;AAAA,EACF;AAAA,EACA,SAAW;AAAA,IACT,OAAS;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,kBAAoB;AAAA,IAClB,YAAc;AAAA,IACd,MAAQ;AAAA,EACV;AAAA,EACA,iBAAmB;AAAA,IACjB,+BAA+B;AAAA,IAC/B,eAAe;AAAA,IACf,SAAW;AAAA,IACX,YAAc;AAAA,IACd,MAAQ;AAAA,EACV;AACF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,cAAc,OAAO;AAAA,QACrB,QAAQ,IAAI,gBAAI,IAAI;AAAA,MACtB,CAAC;AAAA,IACH;AAAA,IACA,gBAAgB,QAAQ;AACtB,YAAM,cAAcE,MAAK,QAAQ,MAAM,OAAO;AAC9C,aAAO,QAAQ,IAAI,WAAW;AAC9B,aAAO,QAAQ,GAAG,UAAU,CAAC,SAAS;AACpC,YAAI,cAAc,IAAI,MAAM,cAAc,WAAW,GAAG;AACtD,gBAAM,iBAAiB,QAAQ;AAAA,QACjC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,MAAM;AAAA,IACN,UAAU,OAAO,IAAI;AACnB,UAAI,GAAG,SAAS,cAAc,KAAK,GAAG,SAAS,OAAO,EAAG,QAAO;AAEhE,YAAM,QAAQ,cAAcA,MAAK,QAAQ,EAAE,CAAC;AAC5C,YAAM,gBAAgB,cAAcA,MAAK,QAAQ,MAAM,IAAI,CAAC;AAC5D,YAAM,mBAAmB,cAAcA,MAAK,QAAQ,MAAM,OAAO,CAAC;AAElE,UAAI,MAAM,iBAAiB,OAAO,eAAe,gBAAgB,GAAG;AAClE,cAAM,iBAAiB,QAAQ;AAAA,MACjC;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;",
6
6
  "names": ["path", "fs", "path", "path", "forEachChild", "isCallExpression", "isIdentifier", "forEachChild", "isCallExpression", "isClassDeclaration", "isIdentifier", "getDecorators", "isArrayLiteralExpression", "isCallExpression", "isClassDeclaration", "isIdentifier", "isObjectLiteralExpression", "isPropertyAssignment", "getDecorators", "isCallExpression", "isIdentifier", "isClassDeclaration", "forEachChild", "isCallExpression", "isIdentifier", "isStringLiteral", "isCallExpression", "isEnumDeclaration", "isInterfaceDeclaration", "isTypeAliasDeclaration", "pickDeclaration", "isTypeAliasDeclaration", "isInterfaceDeclaration", "isEnumDeclaration", "resolveDeclarationFromSymbol", "createPrinter", "EmitHint", "printer", "createPrinter", "EmitHint", "isCallExpression", "isCallExpression", "isStringLiteral", "isIdentifier", "forEachChild", "isClassDeclaration", "getDecorators", "isCallExpression", "isIdentifier", "isIdentifier", "isClassDeclaration", "isCallExpression", "getDecorators", "isObjectLiteralExpression", "isPropertyAssignment", "isArrayLiteralExpression", "isCallExpression", "forEachChild", "isIdentifier", "isClassDeclaration", "isArrayLiteralExpression", "isCallExpression", "isClassDeclaration", "isIdentifier", "isObjectLiteralExpression", "isPropertyAssignment", "isIdentifier", "isClassDeclaration", "isIdentifier", "isIdentifier", "isClassDeclaration", "isObjectLiteralExpression", "isPropertyAssignment", "isIdentifier", "isArrayLiteralExpression", "isCallExpression", "isClassDeclaration", "isIdentifier", "path", "forEachChild", "isCallExpression", "forEachChild", "isCallExpression", "isIdentifier", "isObjectLiteralExpression", "isPropertyAssignment", "isStringLiteral", "path", "path", "path", "fs", "path"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electron-ipc-bridge/vite-plugin",
3
- "version": "0.0.4",
3
+ "version": "0.1.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,7 +34,7 @@
34
34
  "esbuild": "^0.27.3",
35
35
  "typescript": "^5.9.3",
36
36
  "vite": "^7.3.1",
37
- "@electron-ipc-bridge/shared": "0.0.4"
37
+ "@electron-ipc-bridge/shared": "0.1.1"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "node scripts/build.mjs",
@@ -1,6 +0,0 @@
1
- import { ClassDeclaration, SourceFile, TypeChecker } from "typescript";
2
- /**
3
- * Finds the NestJS root module class in a source file by looking for
4
- * NestFactory.createApplicationContext(ModuleClass).
5
- */
6
- export declare const findNestRootModule: (sourceFile: SourceFile, typeChecker: TypeChecker) => ClassDeclaration | undefined;