Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider implementing subpath exports #250

Open
fershad opened this issue Feb 10, 2025 · 0 comments
Open

Consider implementing subpath exports #250

fershad opened this issue Feb 10, 2025 · 0 comments
Labels
designing Specific outcomes to address, but that we’re not committing to
Milestone

Comments

@fershad
Copy link
Contributor

fershad commented Feb 10, 2025

Is your feature request related to a problem? Please describe.
Currently, CO2.js allows developers to use/access the following functionality:

  • Perform carbon emissions estimates using existing models
  • Perform a green web hosting check
  • Access grid intensity data

This functionality is all exported from the main package, which means that adding additional things (models or data especially) means having to avoid naming conflicts for existing exports. It also makes importing and using the functions cumbersome.

Example:

import { co2 } from "@tgwf/co2";
const oneByte = new co2({ model: "1byte" });

Describe the solution you'd like
Introducing subpath exports would allow more organised means of exporting functionality, and make it easier to expand the features, functionality, and models in CO2.js. For example, the code above could look like this instead:

import { oneByte } from "@tgwf/co2/models";

As we look to add more data into CO2.js (see #244), named exports would make it possible to expose that data in a more meaningful manner without creating super long names for exported functions.

@fershad fershad added this to the 0.17 milestone Feb 10, 2025
@fershad fershad added the designing Specific outcomes to address, but that we’re not committing to label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
designing Specific outcomes to address, but that we’re not committing to
Projects
None yet
Development

No branches or pull requests

1 participant