feat: move plugins/index.ts out of renderer bundle (PR C)#9961
Draft
jackkav wants to merge 11 commits into
Draft
feat: move plugins/index.ts out of renderer bundle (PR C)#9961jackkav wants to merge 11 commits into
jackkav wants to merge 11 commits into
Conversation
7fa4b33 to
a3746cf
Compare
8a3448d to
7a542ec
Compare
✨ Circular References ReportGenerated at: 2026-05-27T10:20:01.770Z Summary
✨ Circular References Removed (1)Click to expand/collapseClick to view all circular references in PR (17)Click to view all circular references in base branch (18)Analysis✨ Great Job! This PR removes 1 circular reference. Keep up the good work! This report was generated automatically by comparing against the |
Removes `node:fs` and `node:path` from the renderer-reachable `src/network/network.ts`. Three timeline-path constructions and two `appendFile` calls are replaced with narrow `window.main.timeline.getPath` (sync IPC) and `window.main.timeline.appendToFile` (async IPC) helpers that live in main, where Node builtins belong. Path validation in `appendToTimeline` mirrors `writeResponseBodyToFile`: only paths inside the `responses/` directory ending in `.timeline` are accepted, preventing a compromised renderer from writing arbitrary files. Updates `config/renderer-node-import-baseline.json` to remove the two `src/network/network.ts` entries — the baseline shrinks as intended. Part of the nodeIntegration: false migration (PR B). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e adapter modules Eliminates all runtime process.type and typeof window checks by introducing network-adapter.renderer.ts and network-adapter.node.ts. Vite and Vitest resolve the import to the renderer adapter; inso esbuild resolves to the node adapter. No branching code remains in network.ts itself. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Array-form alias with find:'~' was not matching prefix imports like ~/common/insomnia-fetch in the react-router production build. Object form behaves correctly in Vite 7. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…md indented tree - logger.ts: keep LogType (consola v3 casing), drop duplicate conflict markers - cli.ts: remove stashed duplicate LogLevels import from conflict block - AGENTS.md: restore indented hierarchy in Repository Structure and Data Model sections Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…om renderer bundle - Move createPlugin implementation from src/plugins/create.ts to src/main/create-plugin.ts; expose via window.main.createPlugin IPC handler - Inline window.main.createPlugin() at both call sites (create-plugin-modal.tsx, root.tsx); delete src/plugins/create.ts - Extract getSafePluginDir from utils/plugin.ts into src/main/create-plugin.ts (main-only logic); utils/plugin.ts now exports only pure validatePluginName with no Node builtins - Remove INSOMNIA_ENABLE_PLUGIN_BRIDGE fallback from renderer-bridge.ts: bridge is always on, so invoke-method.ts (and transitively plugins/index.ts) are no longer statically bundled in the renderer - Replace static import of plugins/index in network.ts with lazy require() inside process.type !== 'renderer' guards, removing the last static renderer path to plugins/index.ts - Shrinks renderer-node-import-baseline.json by 6 entries: plugins/create.ts (×2), plugins/index.ts (×2), utils/plugin.ts (×2) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The timeline IPC bridge introduced window.main.timeline.getPath and window.main.timeline.appendToFile calls without guarding against the inso CLI context, where window is not defined. - getTimelinePath: check typeof window before using IPC; fall back to the electron shim (aliased in the inso bundle to os.tmpdir()) path - defaultSendActionRuntime.appendTimeline: fall back to fs.promises.appendFile - tryToExecutePreRequestScript catch block: skip IPC appendToFile in Node.js context (timeline loss on pre-request script error is acceptable) - Bump insomnia-inso consola from ^2.15.3 to ^3.0.0 so the bundle resolves the v3 createConsola API used since dc8d805 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e adapter modules Eliminates all runtime process.type and typeof window checks by introducing network-adapter.renderer.ts and network-adapter.node.ts. Vite and Vitest resolve the import to the renderer adapter; inso esbuild resolves to the node adapter. No branching code remains in network.ts itself. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…reatePlugin in main.ts After rebasing onto feat/network-timeline-ipc-bridge, two rebase artifacts remained: - renderer-node-import-baseline.json lost the plugins/index.ts entries (fs, path) prematurely; plugins/index.ts is still statically bundled in the renderer via har.ts/misc.ts/theme.ts - main.ts had a duplicate createPlugin interface member and ipcMainHandle registration (one from PR 9941 merge, one re-applied by the rebase) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7c7a218 to
e7f844d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/plugins/create.ts→ main IPC: moves the fullcreatePluginimplementation (fs/path) tosrc/main/create-plugin.ts; exposes it aswindow.main.createPlugin()via IPC handler + preload entrycreatePlugin(...)import increate-plugin-modal.tsxandroot.tsxwith directwindow.main.createPlugin(...)calls; deletessrc/plugins/create.tsutils/plugin.tscleanup: movesgetSafePluginDir(which owned thefs/pathcalls) intosrc/main/create-plugin.tswhere it belongs;utils/plugin.tsnow exports only purevalidatePluginName— no Node builtinsINSOMNIA_ENABLE_PLUGIN_BRIDGEfallback:renderer-bridge.tsnow always delegates throughwindow.main.plugins.*IPC; theinvoke-method.tsimport (and its transitiveplugins/index.tsimport) are gone from the renderer bundlenetwork.tslazy require: replacesimport * as plugins from '../plugins/index'withrequire('../plugins/index')calls insideprocess.type !== 'renderer'guards, breaking the last static renderer path toplugins/index.tssrc/plugins/create.ts(fs, path),src/plugins/index.ts(fs, path),src/utils/plugin.ts(fs, path)Context
Stacks on top of
feat/network-timeline-ipc-bridge(PR #9945). This is PR C of thenodeIntegration: falserenderer migration plan described inNODE_INTEGRATION_MIGRATION_PR_PLAN.md.Test plan
npm run type-check -w packages/insomnia— passes (0 errors)npm run lint -w packages/insomnia— passesnpm test -w packages/insomnia— 107 test files, 1921 tests passnpm run check:renderer-node-imports— baseline no longer containssrc/plugins/index.ts,src/plugins/create.ts, orsrc/utils/plugin.tstheme-*plugin is created🤖 Generated with Claude Code