-
-
Notifications
You must be signed in to change notification settings - Fork 65
Description
In #263 we added subpath exports for the data and hosting APIs in the library.
For completeness, we should explore how to do the same of the co2 API in the library as well. This API exposes the carbon estimation functionality inside of CO2.js and provides developers with access to estimation models they can use.
It currently is used like this
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";In the case of models which have multiple versions (e.g. Sustainable Web Design) exports could be used to make it more explicit as to which model version is being used:
import { v4 } from "@tgwf/co2/models/swdm"
import { v3 } from "@tgwf/co2/models/swdm"