apache / apache/arrow-js

[JS] Avoid circular dependencies in apache-arrow

Open
#63 2 comments 1 reaction 0 assignees View on GitHub
Type: enhancement
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.