Add an --exports option that will generate package.json exports based on the build output.
It should not support any additional configuration but instead assume basic defaults (if it requires a configuration file, then I see little point in automating this).
The option should accept these values:
wildcard uses the first path segment from path.parse().dir run on each directory within the build output to build a wildcard subpath.
dir uses the last path segment from path.parse().dir run on each directory within the build output to build a wildcard subpath.
name uses the path.parse().name run on each file in the build output to build the subpath.
The option should use these defaults:
conditional exports of types, import, require and default will be included.
package.json main maps to the "." subpath where default is exactly the value in main, and all other default conditional exports in defined subpaths will use the module system implied by the file extension (or directory) used in the main value.
Add an
--exports
option that will generate package.jsonexports
based on the build output. It should not support any additional configuration but instead assume basic defaults (if it requires a configuration file, then I see little point in automating this).The option should accept these values:
wildcard
uses the first path segment frompath.parse().dir
run on each directory within the build output to build a wildcard subpath.dir
uses the last path segment frompath.parse().dir
run on each directory within the build output to build a wildcard subpath.name
uses thepath.parse().name
run on each file in the build output to build the subpath.The option should use these defaults:
types
,import
,require
anddefault
will be included.main
maps to the"."
subpath wheredefault
is exactly the value inmain
, and all otherdefault
conditional exports in defined subpaths will use the module system implied by the file extension (or directory) used in themain
value.