{"id":17170653,"url":"https://github.com/cawa-93/unplugin-auto-expose","last_synced_at":"2025-08-21T10:31:54.353Z","repository":{"id":38197311,"uuid":"501612085","full_name":"cawa-93/unplugin-auto-expose","owner":"cawa-93","description":"Plugins for automatic exposeInMainWorld everything you exported from preload and easily importing exposed api in renderer","archived":false,"fork":false,"pushed_at":"2024-05-23T00:04:31.000Z","size":1348,"stargazers_count":38,"open_issues_count":10,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-23T01:25:44.095Z","etag":null,"topics":["electron","electron-plugin","rollup-plugin","vite-plugin"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/unplugin-auto-expose","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cawa-93.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://www.buymeacoffee.com/kozack/"}},"created_at":"2022-06-09T10:47:13.000Z","updated_at":"2024-05-23T01:25:47.127Z","dependencies_parsed_at":"2023-11-08T06:38:04.129Z","dependency_job_id":"28001bfe-ab19-46e7-af4f-32386c202e25","html_url":"https://github.com/cawa-93/unplugin-auto-expose","commit_stats":{"total_commits":412,"total_committers":6,"mean_commits":68.66666666666667,"dds":"0.14320388349514568","last_synced_commit":"8043cead78a77728b889129aeaa7ab1c2b0adafe"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawa-93%2Funplugin-auto-expose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawa-93%2Funplugin-auto-expose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawa-93%2Funplugin-auto-expose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawa-93%2Funplugin-auto-expose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cawa-93","download_url":"https://codeload.github.com/cawa-93/unplugin-auto-expose/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230507051,"owners_count":18236944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["electron","electron-plugin","rollup-plugin","vite-plugin"],"created_at":"2024-10-14T23:31:20.386Z","updated_at":"2024-12-19T22:08:48.235Z","avatar_url":"https://github.com/cawa-93.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/kozack/","https://www.buymeacoffee.com/kozack"],"categories":[],"sub_categories":[],"readme":"\u003e [!Important]\n\u003e This project is mainrained by **developer from Ukraine** 🇺🇦\n\u003e \n\u003e Due to the ongoing war resulting from Russia's full-scale invasion of Ukraine, I currently lack the time for the full development of this open-source project. My primary focus is on ensuring the well-being of myself and my family. I'll prioritize and review all new contributions as soon as possible.\n\u003e\n\u003e If you can, please consider [supporting Ukraine](https://stand-with-ukraine.pp.ua/) or [me personally](https://www.buymeacoffee.com/kozack). \n\u003e\n\u003e Thank you for your understanding and support.\n\n\n\u003e [!CAUTION]\n\u003e This plugin is deprecated.\n\u003e \n\u003e The plugin should be replaced by native module resulution features. You can find the reference here: https://github.com/cawa-93/vite-electron-builder/pull/1018\n---\n\n# unplugin-auto-expose\n\nPlugins for automatic `exposeInMainWorld`. Easily export your exposed api from `preload`  to `renderer`.\n\n## Example\n```ts\n// preload.ts\nexport const foo = 'foo string'\n// Equivalent\nelectron.contextBridge.exposeInMainWorld('__electron_preload_foo', 'foo string')\n```\n```ts\n// renderer.ts\nimport {foo} from '#preload'\n// Equivalent\nconst foo = window.__electron_preload_foo\n```\n\n## Supports all export declaration\n\n```ts\n// Export named declaration\nexport const prop = 1\nexport function method() {}\n\n// Named Re-export\nexport {prop} from 'file'\nexport {prop as propAlias} from 'file'\n\n// Export all declaration\nexport * from 'file'\nexport * as props from 'file'\n\n// Default exports\nexport default 'foo'\n```\n\n## Configuration\nThis package contains two plugins: one for preload and one for renderer builds.\n```ts\n// preload/vite.config.ts\n\nimport {preload} from 'unplugin-auto-expose';\n\nexport default defineConfig({\n  plugins: [\n    preload.vite()\n  ]\n})\n```\n```ts\n// renderer/vite.config.ts\n\nimport {renderer} from 'unplugin-auto-expose';\n\nexport default defineConfig({\n  plugins: [\n    renderer.vite({\n      preloadEntry: '/absolute/path/to/preload.ts'\n    })\n  ]\n})\n```\n## TypeScript\nTo configure the TypeScript, add a path to your renderer.\n\n```json5\n// tsconfig.json`:\n{\n  \"compilerOptions\": {\n    \"paths\": {\n      \"#preload\": [\n        \"/path/to/preload\"\n      ]\n    }\n  }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcawa-93%2Funplugin-auto-expose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcawa-93%2Funplugin-auto-expose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcawa-93%2Funplugin-auto-expose/lists"}