Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "immediate" instead of "set-immediate-shim" #716

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 86 additions & 93 deletions dist/jszip.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ exports.uncompressWorker = function () {
return new FlateWorker("Inflate", {});
};

},{"./stream/GenericWorker":28,"./utils":32,"pako":38}],8:[function(require,module,exports){
},{"./stream/GenericWorker":28,"./utils":32,"pako":39}],8:[function(require,module,exports){
'use strict';

var utils = require('../utils');
Expand Down Expand Up @@ -1150,7 +1150,66 @@ module.exports = function(data, options) {
});
};

},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(require,module,exports){
},{"./external":6,"./nodejsUtils":12,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(require,module,exports){
'use strict';

module.exports = {
/**
* True if this is running in Nodejs, will be undefined in a browser.
* In a browser, browserify won't include this file and the whole module
* will be resolved an empty object.
*/
isNode : typeof Buffer !== "undefined",
/**
* Create a new nodejs Buffer from an existing content.
* @param {Object} data the data to pass to the constructor.
* @param {String} encoding the encoding to use.
* @return {Buffer} a new Buffer.
*/
newBufferFrom: function(data, encoding) {
if (Buffer.from && Buffer.from !== Uint8Array.from) {
return Buffer.from(data, encoding);
} else {
if (typeof data === "number") {
// Safeguard for old Node.js versions. On newer versions,
// Buffer.from(number) / Buffer(number, encoding) already throw.
throw new Error("The \"data\" argument must not be a number");
}
return new Buffer(data, encoding);
}
},
/**
* Create a new nodejs Buffer with the specified size.
* @param {Integer} size the size of the buffer.
* @return {Buffer} a new Buffer.
*/
allocBuffer: function (size) {
if (Buffer.alloc) {
return Buffer.alloc(size);
} else {
var buf = new Buffer(size);
buf.fill(0);
return buf;
}
},
/**
* Find out if an object is a Buffer.
* @param {Object} b the object to test.
* @return {Boolean} true if the object is a Buffer, false otherwise.
*/
isBuffer : function(b){
return Buffer.isBuffer(b);
},

isStream : function (obj) {
return obj &&
typeof obj.on === "function" &&
typeof obj.pause === "function" &&
typeof obj.resume === "function";
}
};

},{}],13:[function(require,module,exports){
"use strict";

var utils = require('../utils');
Expand Down Expand Up @@ -1226,7 +1285,7 @@ NodejsStreamInputAdapter.prototype.resume = function () {

module.exports = NodejsStreamInputAdapter;

},{"../stream/GenericWorker":28,"../utils":32}],13:[function(require,module,exports){
},{"../stream/GenericWorker":28,"../utils":32}],14:[function(require,module,exports){
'use strict';

var Readable = require('readable-stream').Readable;
Expand Down Expand Up @@ -1270,66 +1329,7 @@ NodejsStreamOutputAdapter.prototype._read = function() {

module.exports = NodejsStreamOutputAdapter;

},{"../utils":32,"readable-stream":16}],14:[function(require,module,exports){
'use strict';

module.exports = {
/**
* True if this is running in Nodejs, will be undefined in a browser.
* In a browser, browserify won't include this file and the whole module
* will be resolved an empty object.
*/
isNode : typeof Buffer !== "undefined",
/**
* Create a new nodejs Buffer from an existing content.
* @param {Object} data the data to pass to the constructor.
* @param {String} encoding the encoding to use.
* @return {Buffer} a new Buffer.
*/
newBufferFrom: function(data, encoding) {
if (Buffer.from && Buffer.from !== Uint8Array.from) {
return Buffer.from(data, encoding);
} else {
if (typeof data === "number") {
// Safeguard for old Node.js versions. On newer versions,
// Buffer.from(number) / Buffer(number, encoding) already throw.
throw new Error("The \"data\" argument must not be a number");
}
return new Buffer(data, encoding);
}
},
/**
* Create a new nodejs Buffer with the specified size.
* @param {Integer} size the size of the buffer.
* @return {Buffer} a new Buffer.
*/
allocBuffer: function (size) {
if (Buffer.alloc) {
return Buffer.alloc(size);
} else {
var buf = new Buffer(size);
buf.fill(0);
return buf;
}
},
/**
* Find out if an object is a Buffer.
* @param {Object} b the object to test.
* @return {Boolean} true if the object is a Buffer, false otherwise.
*/
isBuffer : function(b){
return Buffer.isBuffer(b);
},

isStream : function (obj) {
return obj &&
typeof obj.on === "function" &&
typeof obj.pause === "function" &&
typeof obj.resume === "function";
}
};

},{}],15:[function(require,module,exports){
},{"../utils":32,"readable-stream":16}],15:[function(require,module,exports){
'use strict';
var utf8 = require('./utf8');
var utils = require('./utils');
Expand Down Expand Up @@ -1720,7 +1720,7 @@ var out = {
};
module.exports = out;

},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(require,module,exports){
},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":13,"./nodejsUtils":12,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(require,module,exports){
/*
* This file is used by module bundlers (browserify/webpack/etc) when
* including a stream implementation. We use "readable-stream" to get a
Expand Down Expand Up @@ -2714,7 +2714,7 @@ StreamHelper.prototype = {

module.exports = StreamHelper;

},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(require,module,exports){
},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":14,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(require,module,exports){
'use strict';

exports.base64 = true;
Expand Down Expand Up @@ -3031,13 +3031,13 @@ Utf8EncodeWorker.prototype.processChunk = function (chunk) {
};
exports.Utf8EncodeWorker = Utf8EncodeWorker;

},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(require,module,exports){
},{"./nodejsUtils":12,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(require,module,exports){
'use strict';

var support = require('./support');
var base64 = require('./base64');
var nodejsUtils = require('./nodejsUtils');
var setImmediate = require('set-immediate-shim');
var setImmediate = require('immediate');
var external = require("./external");


Expand Down Expand Up @@ -3509,7 +3509,7 @@ exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinarySt
});
};

},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"set-immediate-shim":54}],33:[function(require,module,exports){
},{"./base64":1,"./external":6,"./nodejsUtils":12,"./support":30,"immediate":36}],33:[function(require,module,exports){
'use strict';
var readerFor = require('./reader/readerFor');
var utils = require('./utils');
Expand Down Expand Up @@ -4552,7 +4552,9 @@ function race(iterable) {
}
}

},{"immediate":36}],38:[function(require,module,exports){
},{"immediate":38}],38:[function(require,module,exports){
arguments[4][36][0].apply(exports,arguments)
},{"dup":36}],39:[function(require,module,exports){
// Top level file is just a mixin of submodules & constants
'use strict';

Expand All @@ -4568,7 +4570,7 @@ assign(pako, deflate, inflate, constants);

module.exports = pako;

},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(require,module,exports){
},{"./lib/deflate":40,"./lib/inflate":41,"./lib/utils/common":42,"./lib/zlib/constants":45}],40:[function(require,module,exports){
'use strict';


Expand Down Expand Up @@ -4970,7 +4972,7 @@ exports.deflate = deflate;
exports.deflateRaw = deflateRaw;
exports.gzip = gzip;

},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(require,module,exports){
},{"./utils/common":42,"./utils/strings":43,"./zlib/deflate":47,"./zlib/messages":52,"./zlib/zstream":54}],41:[function(require,module,exports){
'use strict';


Expand Down Expand Up @@ -5390,7 +5392,7 @@ exports.inflate = inflate;
exports.inflateRaw = inflateRaw;
exports.ungzip = inflate;

},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(require,module,exports){
},{"./utils/common":42,"./utils/strings":43,"./zlib/constants":45,"./zlib/gzheader":48,"./zlib/inflate":50,"./zlib/messages":52,"./zlib/zstream":54}],42:[function(require,module,exports){
'use strict';


Expand Down Expand Up @@ -5494,7 +5496,7 @@ exports.setTyped = function (on) {

exports.setTyped(TYPED_OK);

},{}],42:[function(require,module,exports){
},{}],43:[function(require,module,exports){
// String encode/decode helpers
'use strict';

Expand Down Expand Up @@ -5681,7 +5683,7 @@ exports.utf8border = function (buf, max) {
return (pos + _utf8len[buf[pos]] > max) ? pos : max;
};

},{"./common":41}],43:[function(require,module,exports){
},{"./common":42}],44:[function(require,module,exports){
'use strict';

// Note: adler32 takes 12% for level 0 and 2% for level 6.
Expand Down Expand Up @@ -5734,7 +5736,7 @@ function adler32(adler, buf, len, pos) {

module.exports = adler32;

},{}],44:[function(require,module,exports){
},{}],45:[function(require,module,exports){
'use strict';

// (C) 1995-2013 Jean-loup Gailly and Mark Adler
Expand Down Expand Up @@ -5804,7 +5806,7 @@ module.exports = {
//Z_NULL: null // Use -1 or null inline, depending on var type
};

},{}],45:[function(require,module,exports){
},{}],46:[function(require,module,exports){
'use strict';

// Note: we can't get significant speed boost here.
Expand Down Expand Up @@ -5865,7 +5867,7 @@ function crc32(crc, buf, len, pos) {

module.exports = crc32;

},{}],46:[function(require,module,exports){
},{}],47:[function(require,module,exports){
'use strict';

// (C) 1995-2013 Jean-loup Gailly and Mark Adler
Expand Down Expand Up @@ -7741,7 +7743,7 @@ exports.deflatePrime = deflatePrime;
exports.deflateTune = deflateTune;
*/

},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(require,module,exports){
},{"../utils/common":42,"./adler32":44,"./crc32":46,"./messages":52,"./trees":53}],48:[function(require,module,exports){
'use strict';

// (C) 1995-2013 Jean-loup Gailly and Mark Adler
Expand Down Expand Up @@ -7801,7 +7803,7 @@ function GZheader() {

module.exports = GZheader;

},{}],48:[function(require,module,exports){
},{}],49:[function(require,module,exports){
'use strict';

// (C) 1995-2013 Jean-loup Gailly and Mark Adler
Expand Down Expand Up @@ -8148,7 +8150,7 @@ module.exports = function inflate_fast(strm, start) {
return;
};

},{}],49:[function(require,module,exports){
},{}],50:[function(require,module,exports){
'use strict';

// (C) 1995-2013 Jean-loup Gailly and Mark Adler
Expand Down Expand Up @@ -9706,7 +9708,7 @@ exports.inflateSyncPoint = inflateSyncPoint;
exports.inflateUndermine = inflateUndermine;
*/

},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(require,module,exports){
},{"../utils/common":42,"./adler32":44,"./crc32":46,"./inffast":49,"./inftrees":51}],51:[function(require,module,exports){
'use strict';

// (C) 1995-2013 Jean-loup Gailly and Mark Adler
Expand Down Expand Up @@ -10051,7 +10053,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
return 0;
};

},{"../utils/common":41}],51:[function(require,module,exports){
},{"../utils/common":42}],52:[function(require,module,exports){
'use strict';

// (C) 1995-2013 Jean-loup Gailly and Mark Adler
Expand Down Expand Up @@ -10085,7 +10087,7 @@ module.exports = {
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
};

},{}],52:[function(require,module,exports){
},{}],53:[function(require,module,exports){
'use strict';

// (C) 1995-2013 Jean-loup Gailly and Mark Adler
Expand Down Expand Up @@ -11307,7 +11309,7 @@ exports._tr_flush_block = _tr_flush_block;
exports._tr_tally = _tr_tally;
exports._tr_align = _tr_align;

},{"../utils/common":41}],53:[function(require,module,exports){
},{"../utils/common":42}],54:[function(require,module,exports){
'use strict';

// (C) 1995-2013 Jean-loup Gailly and Mark Adler
Expand Down Expand Up @@ -11356,14 +11358,5 @@ function ZStream() {

module.exports = ZStream;

},{}],54:[function(require,module,exports){
'use strict';
module.exports = typeof setImmediate === 'function' ? setImmediate :
function setImmediate() {
var args = [].slice.apply(arguments);
args.splice(1, 0, 0);
setTimeout.apply(null, args);
};

},{}]},{},[10])(10)
});
2 changes: 1 addition & 1 deletion dist/jszip.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var support = require('./support');
var base64 = require('./base64');
var nodejsUtils = require('./nodejsUtils');
var setImmediate = require('set-immediate-shim');
var setImmediate = require('immediate');
var external = require("./external");


Expand Down
Loading