[JS] Avoid circular dependencies in apache-arrow
- Dominant language
- TypeScript
- Stars
- 112
- Forks
- 23
- Avg merge
- 21h 18m
- Merged PRs (30d)
- 8
Description
### Describe the enhancement requested
Currently the apache-arrow library has circular dependencies which cause warnings in tools like rollup:
```
src/example.js → dist/example.js...
(!) Circular dependencies
node_modules/apache-arrow/vector.mjs -> node_modules/apache-arrow/util/vector.mjs -> node_modules/apache-arrow/vector.mjs
node_modules/apache-arrow/vector.mjs -> node_modules/apache-arrow/util/vector.mjs -> node_modules/apache-arrow/row/map.mjs -> node_modules/apache-arrow/vector.mjs
node_modules/apache-arrow/vector.mjs -> node_modules/apache-arrow/util/vector.mjs -> node_modules/apache-arrow/row/map.mjs -> node_modules/apache-arrow/visitor/get.mjs -> node_modules/apache-arrow/vector.mjs
...and 10 more
created dist/example.js in 890ms
```
See the following stackblitz which reproduces that build warning: https://stackblitz.com/edit/apache-arrow-circular-dependencies?file=src%2Fexample.js
It would be nice if the library was organized such that circular dependencies could be avoided.
To workaround the warnings in rollup one can use an [onwarn](https://rollupjs.org/configuration-options/#onwarn) handler in the rollup configuration with an implementation like:
```js
const onwarn = (warning, defaultHandler) => {
const ignoredWarnings = [
{
code: 'CIRCULAR_DEPENDENCY',
file: 'node_modules/apache-arrow'
}
];
if (
!ignoredWarnings.some(
({ code, file }) => warning.code === code && warning.message.includes(file)
)
) {
defaultHandler(warning);
}
};
```
### Component(s)
JavaScript
Contributor guide
Assessment
This issue has not been assessed yet.