Giter Club home page Giter Club logo

Comments (6)

mbostock avatar mbostock commented on May 14, 2024

Is this strictly to benefit maintainers of standalone.js? That doesn’t seem particularly onerous at the moment, and it’s nice having some flexibility to support the old monolithic API while designing new CommonJS modules.

(If you’re intending this as a mechanism for creating custom builds, I’m expecting people to either concatenate the pre-built files or to use Browserify to require the non-standalone files directly.)

from d3-selection.

gmaclennan avatar gmaclennan commented on May 14, 2024

Yes, that makes sense to me. Following my suggestion you would be stuck building the new CommonJS modules to match the old API.

from d3-selection.

mbostock avatar mbostock commented on May 14, 2024

OK, closing.

from d3-selection.

mbostock avatar mbostock commented on May 14, 2024

Following up on this, I’ve made some changes to how the code is structured. I found it confusing to have two different APIs (one if source files are required directly and another for the “standalone” version). So instead this module now just has one source file, index.js, which populates the d3 object directly. Other D3 modules can follow this same approach of decorating the d3 object.

from d3-selection.

gmaclennan avatar gmaclennan commented on May 14, 2024

The disadvantage of this approach is being able to require smaller components of d3, which is what I have done in the past with Smash, selecting individual files. This could be done with a require('d3-selection/mouse') etc. and keep the code size down if the code was separated into individual files in the repo. This isn't necessarily incompatible with the approach of having a single index.js entry point.

However... for the d3-selection module at least there isn't a lot of sense / need to just require a smaller piece, and perhaps the amount of space/kb saves is not that significant?

from d3-selection.

mbostock avatar mbostock commented on May 14, 2024

The ability to require smaller components of D3 is one of the main reasons we are breaking D3 up into different repositories. (Imagine d3-selection, d3-transition, d3-scale, etc.) I don’t believe it is worth it to break it down further than the repository / module level.

from d3-selection.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.