use runtime adapter, instead of bundler shim

This commit is contained in:
jackkav
2026-05-28 11:00:43 +02:00
parent 419b9c6337
commit bcfcae6ffa

View File

@@ -1,4 +1,19 @@
// Bundler-time shim: Vite resolves this to network-adapter.renderer.ts,
// inso esbuild resolves this to network-adapter.node.ts.
// This file is the TypeScript target for type-checking only.
export * from './network-adapter.renderer';
// Runtime adapter selection: renderer uses IPC bridge, node uses libcurl directly.
// Vite production inlines process.type='renderer' so Rollup tree-shakes the node branch.
import type * as AdapterType from './network-adapter.renderer';
const impl = (
(process as any).type === 'renderer'
? require('./network-adapter.renderer')
: require(/* @vite-ignore */ './network-adapter.node')
) as typeof AdapterType;
export const {
getTimelinePath,
appendToTimelineOnError,
appendTimelineLines,
getAuthHeader,
executeCurlRequest,
applyRequestHooks,
applyResponseHooks,
} = impl;