Define exports for all Antora packages
As a follow up to #979 (closed), define the exports key in package.json of each Antora package. Defining exports accomplishes two things:
- Controls which source paths in the package are public and thus can be required
- Allows the name of the require request to be customized, thus hiding the internal structure of the package
If a source path is not listed in the exports key, it cannot be required using the require
statement. (However, it's still possible to resolve the location of the package and require the path directly). For backwards compatibility, any internal source path that has been broadcasted (such as in docs or support) should be listed. The package.json file should also be included for retrieving information about the package.
By configuring an export, we can simplify the request request for a helper function from @antora/content-aggregator/lib/git-plugin-http
to @antora/content-aggregator/git-plugin-http
or from @antora/content-classifier/lib/util/parse-resource-id
to @antora/content-classifier/parse-resource-id
. It also allows us to set up require requests for specific functions rather then exporting them as properties of the default export.
We can continuously tune the exports as we receive feedback about how they are used.