Fix esm build named exports

This commit is contained in:
Vitaly Puzrin 2020-11-19 02:37:53 +03:00
parent 8d5f9c70f8
commit d0382badcc
8 changed files with 77 additions and 68 deletions

View file

@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.2] - 2020-11-19
### Fixed
- Fix esm build named exports.
## [2.0.1] - 2020-11-17
### Changed
@ -161,6 +167,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- First release.
[2.0.2]: https://github.com/nodeca/pako/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/nodeca/pako/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/nodeca/pako/compare/1.0.11...2.0.0
[1.0.10]: https://github.com/nodeca/pako/compare/1.0.10...1.0.11

View file

@ -7,8 +7,12 @@ const { Inflate, inflate, inflateRaw, ungzip } = require('./lib/inflate');
const constants = require('./lib/zlib/constants');
module.exports = {
Deflate, deflate, deflateRaw, gzip,
Inflate, inflate, inflateRaw, ungzip,
constants
};
module.exports.Deflate = Deflate;
module.exports.deflate = deflate;
module.exports.deflateRaw = deflateRaw;
module.exports.gzip = gzip;
module.exports.Inflate = Inflate;
module.exports.inflate = inflate;
module.exports.inflateRaw = inflateRaw;
module.exports.ungzip = ungzip;
module.exports.constants = constants;

View file

@ -373,10 +373,8 @@ function gzip(input, options) {
}
module.exports = {
Deflate,
deflate,
deflateRaw,
gzip,
constants: require('./zlib/constants')
};
module.exports.Deflate = Deflate;
module.exports.deflate = deflate;
module.exports.deflateRaw = deflateRaw;
module.exports.gzip = gzip;
module.exports.constants = require('./zlib/constants');

View file

@ -412,10 +412,8 @@ function inflateRaw(input, options) {
**/
module.exports = {
Inflate,
inflate,
inflateRaw,
ungzip: inflate,
constants: require('./zlib/constants')
};
module.exports.Inflate = Inflate;
module.exports.inflate = inflate;
module.exports.inflateRaw = inflateRaw;
module.exports.ungzip = inflate;
module.exports.constants = require('./zlib/constants');

View file

@ -1830,21 +1830,21 @@ const deflateSetDictionary = (strm, dictionary) => {
};
exports.deflateInit = deflateInit;
exports.deflateInit2 = deflateInit2;
exports.deflateReset = deflateReset;
exports.deflateResetKeep = deflateResetKeep;
exports.deflateSetHeader = deflateSetHeader;
exports.deflate = deflate;
exports.deflateEnd = deflateEnd;
exports.deflateSetDictionary = deflateSetDictionary;
exports.deflateInfo = 'pako deflate (from Nodeca project)';
module.exports.deflateInit = deflateInit;
module.exports.deflateInit2 = deflateInit2;
module.exports.deflateReset = deflateReset;
module.exports.deflateResetKeep = deflateResetKeep;
module.exports.deflateSetHeader = deflateSetHeader;
module.exports.deflate = deflate;
module.exports.deflateEnd = deflateEnd;
module.exports.deflateSetDictionary = deflateSetDictionary;
module.exports.deflateInfo = 'pako deflate (from Nodeca project)';
/* Not implemented
exports.deflateBound = deflateBound;
exports.deflateCopy = deflateCopy;
exports.deflateParams = deflateParams;
exports.deflatePending = deflatePending;
exports.deflatePrime = deflatePrime;
exports.deflateTune = deflateTune;
module.exports.deflateBound = deflateBound;
module.exports.deflateCopy = deflateCopy;
module.exports.deflateParams = deflateParams;
module.exports.deflatePending = deflatePending;
module.exports.deflatePrime = deflatePrime;
module.exports.deflateTune = deflateTune;
*/

View file

@ -1525,23 +1525,23 @@ const inflateSetDictionary = (strm, dictionary) => {
};
exports.inflateReset = inflateReset;
exports.inflateReset2 = inflateReset2;
exports.inflateResetKeep = inflateResetKeep;
exports.inflateInit = inflateInit;
exports.inflateInit2 = inflateInit2;
exports.inflate = inflate;
exports.inflateEnd = inflateEnd;
exports.inflateGetHeader = inflateGetHeader;
exports.inflateSetDictionary = inflateSetDictionary;
exports.inflateInfo = 'pako inflate (from Nodeca project)';
module.exports.inflateReset = inflateReset;
module.exports.inflateReset2 = inflateReset2;
module.exports.inflateResetKeep = inflateResetKeep;
module.exports.inflateInit = inflateInit;
module.exports.inflateInit2 = inflateInit2;
module.exports.inflate = inflate;
module.exports.inflateEnd = inflateEnd;
module.exports.inflateGetHeader = inflateGetHeader;
module.exports.inflateSetDictionary = inflateSetDictionary;
module.exports.inflateInfo = 'pako inflate (from Nodeca project)';
/* Not implemented
exports.inflateCopy = inflateCopy;
exports.inflateGetDictionary = inflateGetDictionary;
exports.inflateMark = inflateMark;
exports.inflatePrime = inflatePrime;
exports.inflateSync = inflateSync;
exports.inflateSyncPoint = inflateSyncPoint;
exports.inflateUndermine = inflateUndermine;
module.exports.inflateCopy = inflateCopy;
module.exports.inflateGetDictionary = inflateGetDictionary;
module.exports.inflateMark = inflateMark;
module.exports.inflatePrime = inflatePrime;
module.exports.inflateSync = inflateSync;
module.exports.inflateSyncPoint = inflateSyncPoint;
module.exports.inflateUndermine = inflateUndermine;
*/

View file

@ -1222,8 +1222,8 @@ const _tr_tally = (s, dist, lc) =>
*/
};
exports._tr_init = _tr_init;
exports._tr_stored_block = _tr_stored_block;
exports._tr_flush_block = _tr_flush_block;
exports._tr_tally = _tr_tally;
exports._tr_align = _tr_align;
module.exports._tr_init = _tr_init;
module.exports._tr_stored_block = _tr_stored_block;
module.exports._tr_flush_block = _tr_flush_block;
module.exports._tr_tally = _tr_tally;
module.exports._tr_align = _tr_align;

View file

@ -24,30 +24,32 @@ const plugins_es5 = [
banner
];
const umd_out_base = { format: 'umd', name: 'pako', exports: 'named' };
export default [
// es6
{
input: 'index.js',
output: [
{ file: 'dist/pako.js', format: 'umd', name: 'pako' },
{ file: 'dist/pako.min.js', format: 'umd', name: 'pako', plugins: [ terser() ] }
{ ...umd_out_base, file: 'dist/pako.js' },
{ ...umd_out_base, file: 'dist/pako.min.js', plugins: [ terser() ] }
],
plugins: plugins
},
{
input: 'lib/deflate.js',
output: [
{ file: 'dist/pako_deflate.js', format: 'umd', name: 'pako' },
{ file: 'dist/pako_deflate.min.js', format: 'umd', name: 'pako', plugins: [ terser() ] }
{ ...umd_out_base, file: 'dist/pako_deflate.js' },
{ ...umd_out_base, file: 'dist/pako_deflate.min.js', plugins: [ terser() ] }
],
plugins: plugins
},
{
input: 'lib/inflate.js',
output: [
{ file: 'dist/pako_inflate.js', format: 'umd', name: 'pako' },
{ file: 'dist/pako_inflate.min.js', format: 'umd', name: 'pako', plugins: [ terser() ] }
{ ...umd_out_base, file: 'dist/pako_inflate.js' },
{ ...umd_out_base, file: 'dist/pako_inflate.min.js', plugins: [ terser() ] }
],
plugins: plugins
},
@ -55,24 +57,24 @@ export default [
{
input: 'index.js',
output: [
{ file: 'dist/pako.es5.js', format: 'umd', name: 'pako' },
{ file: 'dist/pako.es5.min.js', format: 'umd', name: 'pako', plugins: [ terser() ] }
{ ...umd_out_base, file: 'dist/pako.es5.js' },
{ ...umd_out_base, file: 'dist/pako.es5.min.js', plugins: [ terser() ] }
],
plugins: plugins_es5
},
{
input: 'lib/deflate.js',
output: [
{ file: 'dist/pako_deflate.es5.js', format: 'umd', name: 'pako' },
{ file: 'dist/pako_deflate.es5.min.js', format: 'umd', name: 'pako', plugins: [ terser() ] }
{ ...umd_out_base, file: 'dist/pako_deflate.es5.js' },
{ ...umd_out_base, file: 'dist/pako_deflate.es5.min.js', plugins: [ terser() ] }
],
plugins: plugins_es5
},
{
input: 'lib/inflate.js',
output: [
{ file: 'dist/pako_inflate.es5.js', format: 'umd', name: 'pako' },
{ file: 'dist/pako_inflate.es5.min.js', format: 'umd', name: 'pako', plugins: [ terser() ] }
{ ...umd_out_base, file: 'dist/pako_inflate.es5.js' },
{ ...umd_out_base, file: 'dist/pako_inflate.es5.min.js', plugins: [ terser() ] }
],
plugins: plugins_es5
},