Modernize the package (esm, tree-shaking) #94
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1. Deprecated
_esm5
buildThe build for
_esm5
is pointed in themodule
of thepackage.json
which corresponds to the native ESM modules loaders. However, the build doesn't produce the modules and almost not distinguishable from CJS.This PR removes
_esm5
altogether and instead uses the_esm2015
build. This build does produce correct ESM modules and has to be references inmodule
entry point.Also, need to point that
es2015
entry point inpackage.json
is non-standard and is not used anywhere (ref: https://stackoverflow.com/questions/43131060/npm-package-json-undocumented-keys)2.
Lens
,Prism
,Optic
namespaces are now modulesFor only one reason to merge
Lens
namespace inlens/base.ts
andlens/json.ts
the library had side-effects listed inpackage.json
. However, it always does this and no point of this artificial separation.Now these namespace are moved to separate files (
lens.ts
,prism.ts
,optic.ts
) that don;t have namespaces and instead export all of their functions as plain names exports.then to keep namaspacy-look in public API, they are re-exported as
export * as
so that they can still be accessed asLens.blahblah
.Note, that no function code was actually changed, only re-arranged.