You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "rajsite (via GitHub)" <gi...@apache.org> on 2024/03/13 22:29:25 UTC

[I] Avoid circular dependencies in apache-arrow [arrow]

rajsite opened a new issue, #40516:
URL: https://github.com/apache/arrow/issues/40516

   ### 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
   ```
   
   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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [JS] Avoid circular dependencies in apache-arrow [arrow]

Posted by "domoritz (via GitHub)" <gi...@apache.org>.
domoritz commented on issue #40516:
URL: https://github.com/apache/arrow/issues/40516#issuecomment-1996300536

   Thanks for the issue report. I've looked at circular deps before and luckily I think all of these are just warning and the bundler can easily serialize the dependencies. However, it would be nice to clean this up. We need to be careful not to make the library less readable by breaking up code that makes sense together into separate files.
   
   And easy reproduction in the repo itself is to remove https://github.com/apache/arrow/blob/6b1e254f3b62924f216e06e9e563e92c69f9efd3/js/gulp/bundle-task.js#L86 and then running `yarn gulp bundle:rollup`. Then you get warnings for all the sample bundles we have. 
   
   I don't know how much I can make it a priority compared to other things I have on my plate. This seems like a good issue for someone else to contribute. @rajsite would you be open to making a pull request? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [JS] Avoid circular dependencies in apache-arrow [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on issue #40516:
URL: https://github.com/apache/arrow/issues/40516#issuecomment-1996280407

   @domoritz Could you take a look at this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org