reddit-moderator-toolbox
reddit-moderator-toolbox copied to clipboard
Bump pako from 0.2.6 to 2.0.4
Bumps pako from 0.2.6 to 2.0.4.
Changelog
Sourced from pako's changelog.
[2.0.4] - 2021-07-29
Fixed
- Use TextEncoder and TextDecoder if available, #228.
- Use pre-generated fixtures instead of node.js zlib.
[2.0.3] - 2021-01-09
Fixed
- Add all files explicit to package exports (since behaviour changed after adding .export field)
[2.0.2] - 2020-11-19
Fixed
- Fix esm build named exports.
[2.0.1] - 2020-11-17
Changed
- Changed esm build
.js=>.mjsto fix node.jsimport.- Added
moduleentry in package.json for some bundlers.[2.0.0] - 2020-11-17
Changed
- Removed binary strings and
Arraysupport.- Removed fallbacks for TypedArray methods (
.set(),.subarray()).- Rewritten top-level wrappers.
- Removed support of
Inflate&Deflateinstance create withoutnew.Inflate.push()no longer needs second param (end is auto-detected).- Increased default inflate chunk size to 64K.
- Moved exported constants to
.constants.- Switched to es6. Legacy es5 builds available in
/dist.- Added esm build.
- Structure of
/distfolder changed.- Upgraded build tools to modern ones.
[1.0.11] - 2020-01-29
Fixed
- Fix tests in node.js v12+, #179.
[1.0.10] - 2019-02-28
Fixed
- Fix minified version, #161.
... (truncated)
Commits
0398fad2.0.4 releasedae27cbcdist rebuild26dff4fUse TextEncoder and TextDecoder if available1ac0a4cChange tests to use binary comparision with fixturesb967322Typo fix (#225)6f40f48typo fix2db010f2.0.3 released9ca8060dist rebuild108a89bAdd everything to package exportsb93a6e5Add package.json export, close #211- Additional commits viewable in compare view
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Yeah... this is going to need some testing considering the huge version bump
I fiddled with this a bit today but couldn't get it working. Pako 2.0.0 drops support for binary string inputs which requires us to stuff the binary data into an Uint8Array first, which I can do, but I wasn't able to get it to output a deflated format that the current version of Toolbox can still read, so it seems there's something else going on here.
For future Erin's benefit:
// Get Uint8Array from binary string
const bytes = Uint8Array.from(binaryString, c => c.charCodeAt(0));
// Get binary string from Uint8Array
const binaryString = bytes.reduce((data, byte) => data + String.fromCharCode(byte));
// (remember, binary strings are not base64 strings)
Okay so I'm kind of an idiot but it looks like modifying zlibInflate a bit should work?
atob outputs a string, which can then be split at the commas to get an array, which is then fed to a new Uint8Array, which can then be inflated properly; the inflated output is identical to the stringified JSON.
https://gist.github.com/adhesivecheese/d4633999b486fb0e4658fe740ad9cecc
If I am missing something, hopefully this is at least helpful to get you further along!
Okay so I was an idiot... but this time I swear I'm not; here's the patched functions to return identical output under pako 2.0.4 as 0.2.6; attached is a gist you can use to double check my work.
function zlibInflate (stringThing) {
// Expand base64
var zlibBinData = atob(stringThing);
//binary to Uint8Array
var zlibCharData = zlibBinData.split('').map(function (e) {
return e.charCodeAt(0);
});
var binData = new Uint8Array(zlibCharData);
// zlib time!
var data = pako.inflate(binData);
return String.fromCharCode.apply(null, new Uint16Array(data));
}
function zlibDeflate (objThing) {
// zlib time!
var zlibString = pako.deflate(jsonString, { to: 'string' });
//convert Uint8Array to String
zlibString = String.fromCharCode.apply(null, new Uint16Array(zlibString));
return btoa(zlibString)
}
Superseded by #675.