reddit-moderator-toolbox icon indicating copy to clipboard operation
reddit-moderator-toolbox copied to clipboard

Bump pako from 0.2.6 to 2.0.4

Open dependabot[bot] opened this issue 3 years ago • 4 comments

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 => .mjs to fix node.js import.
  • Added module entry in package.json for some bundlers.

[2.0.0] - 2020-11-17

Changed

  • Removed binary strings and Array support.
  • Removed fallbacks for TypedArray methods (.set(), .subarray()).
  • Rewritten top-level wrappers.
  • Removed support of Inflate & Deflate instance create without new.
  • 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 /dist folder 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

Dependabot compatibility score

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 rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will 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 version will 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 dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

dependabot[bot] avatar Sep 10 '22 09:09 dependabot[bot]

Yeah... this is going to need some testing considering the huge version bump

creesch avatar Sep 10 '22 15:09 creesch

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)

eritbh avatar Oct 17 '22 19:10 eritbh

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!

adhesivecheese avatar Oct 17 '22 22:10 adhesivecheese

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)
}

adhesivecheese avatar Oct 19 '22 02:10 adhesivecheese

Superseded by #675.

dependabot[bot] avatar Nov 07 '22 03:11 dependabot[bot]