diff --git a/js/src/Arrow.dom.ts b/js/src/Arrow.dom.ts index cdb4171162f..f4b8beb0a9b 100644 --- a/js/src/Arrow.dom.ts +++ b/js/src/Arrow.dom.ts @@ -24,14 +24,18 @@ import { builderThroughDOMStream } from './io/whatwg/builder.js'; import { recordBatchReaderThroughDOMStream } from './io/whatwg/reader.js'; import { recordBatchWriterThroughDOMStream } from './io/whatwg/writer.js'; -streamAdapters.toDOMStream = toDOMStream; -Builder['throughDOM'] = builderThroughDOMStream; -RecordBatchReader['throughDOM'] = recordBatchReaderThroughDOMStream; -RecordBatchFileReader['throughDOM'] = recordBatchReaderThroughDOMStream; -RecordBatchStreamReader['throughDOM'] = recordBatchReaderThroughDOMStream; -RecordBatchWriter['throughDOM'] = recordBatchWriterThroughDOMStream; -RecordBatchFileWriter['throughDOM'] = recordBatchWriterThroughDOMStream; -RecordBatchStreamWriter['throughDOM'] = recordBatchWriterThroughDOMStream; +// Override in IIFE so that bundlers don't tree-shake out this logic, +// but also so we're still compliant with `"sideEffects": false` +(() => { + streamAdapters.toDOMStream = toDOMStream; + Builder['throughDOM'] = builderThroughDOMStream; + RecordBatchReader['throughDOM'] = recordBatchReaderThroughDOMStream; + RecordBatchFileReader['throughDOM'] = recordBatchReaderThroughDOMStream; + RecordBatchStreamReader['throughDOM'] = recordBatchReaderThroughDOMStream; + RecordBatchWriter['throughDOM'] = recordBatchWriterThroughDOMStream; + RecordBatchFileWriter['throughDOM'] = recordBatchWriterThroughDOMStream; + RecordBatchStreamWriter['throughDOM'] = recordBatchWriterThroughDOMStream; +})(); export type { TypeMap, StructRowProxy, diff --git a/js/src/Arrow.node.ts b/js/src/Arrow.node.ts index d47f0880ff4..bedd88a6121 100644 --- a/js/src/Arrow.node.ts +++ b/js/src/Arrow.node.ts @@ -24,9 +24,13 @@ import { builderThroughNodeStream } from './io/node/builder.js'; import { recordBatchReaderThroughNodeStream } from './io/node/reader.js'; import { recordBatchWriterThroughNodeStream } from './io/node/writer.js'; -streamAdapters.toNodeStream = toNodeStream; -Builder['throughNode'] = builderThroughNodeStream; -RecordBatchReader['throughNode'] = recordBatchReaderThroughNodeStream; -RecordBatchWriter['throughNode'] = recordBatchWriterThroughNodeStream; +// Override in IIFE so that bundlers don't tree-shake out this logic, +// but also so we're still compliant with `"sideEffects": false` +(() => { + streamAdapters.toNodeStream = toNodeStream; + Builder['throughNode'] = builderThroughNodeStream; + RecordBatchReader['throughNode'] = recordBatchReaderThroughNodeStream; + RecordBatchWriter['throughNode'] = recordBatchWriterThroughNodeStream; +})(); export * from './Arrow.dom.js';