mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
Revert "Other minor dependencies updates in 7.1.x patch"
This reverts commit5a5f544a48. Rationale: base64-js update in5a5f544causes extra base64-js version to be installed under plist (node_modules/plist/node_modules/base64-js), which would need to be committed to satisfy the needs of the deprecated Node.js 4 version. The extra base64-js version in node_modules/plist/node_modules/base64-js was missed at the time5a5f544was committed. The base64-js update in5a5f544is now deemed as not wanted due to the extra base64-js version that would need to be committed. The other dependencies updates in5a5f544may be nice to have but not considered necessary for the patch release. Reverting now to unblock the upcoming 7.1.4 patch release. Note that neither5a5f544nor this revert will show up in the master branch.
This commit is contained in:
+4
-6
@@ -15,15 +15,13 @@ Sometimes encoding/decoding binary data in the browser is useful, and that is wh
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
`npm install base64-js` and `var base64js = require('base64-js')`
|
||||
|
||||
For use in web browsers do:
|
||||
|
||||
`<script src="base64js.min.js"></script>`
|
||||
`npm install base64-js`
|
||||
|
||||
## methods
|
||||
|
||||
`base64js` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument.
|
||||
`var base64 = require('base64-js')`
|
||||
|
||||
`base64` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument.
|
||||
|
||||
* `byteLength` - Takes a base64 string and returns length of byte array
|
||||
* `toByteArray` - Takes a base64 string and returns a byte array
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
(function(r){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=r()}else if(typeof define==="function"&&define.amd){define([],r)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e.base64js=r()}})(function(){var r,e,n;return function(){function r(e,n,t){function o(f,i){if(!n[f]){if(!e[f]){var u="function"==typeof require&&require;if(!i&&u)return u(f,!0);if(a)return a(f,!0);var v=new Error("Cannot find module '"+f+"'");throw v.code="MODULE_NOT_FOUND",v}var d=n[f]={exports:{}};e[f][0].call(d.exports,function(r){var n=e[f][1][r];return o(n||r)},d,d.exports,r,e,n,t)}return n[f].exports}for(var a="function"==typeof require&&require,f=0;f<t.length;f++)o(t[f]);return o}return r}()({"/":[function(r,e,n){"use strict";n.byteLength=d;n.toByteArray=h;n.fromByteArray=p;var t=[];var o=[];var a=typeof Uint8Array!=="undefined"?Uint8Array:Array;var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,u=f.length;i<u;++i){t[i]=f[i];o[f.charCodeAt(i)]=i}o["-".charCodeAt(0)]=62;o["_".charCodeAt(0)]=63;function v(r){var e=r.length;if(e%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var n=r.indexOf("=");if(n===-1)n=e;var t=n===e?0:4-n%4;return[n,t]}function d(r){var e=v(r);var n=e[0];var t=e[1];return(n+t)*3/4-t}function c(r,e,n){return(e+n)*3/4-n}function h(r){var e;var n=v(r);var t=n[0];var f=n[1];var i=new a(c(r,t,f));var u=0;var d=f>0?t-4:t;for(var h=0;h<d;h+=4){e=o[r.charCodeAt(h)]<<18|o[r.charCodeAt(h+1)]<<12|o[r.charCodeAt(h+2)]<<6|o[r.charCodeAt(h+3)];i[u++]=e>>16&255;i[u++]=e>>8&255;i[u++]=e&255}if(f===2){e=o[r.charCodeAt(h)]<<2|o[r.charCodeAt(h+1)]>>4;i[u++]=e&255}if(f===1){e=o[r.charCodeAt(h)]<<10|o[r.charCodeAt(h+1)]<<4|o[r.charCodeAt(h+2)]>>2;i[u++]=e>>8&255;i[u++]=e&255}return i}function s(r){return t[r>>18&63]+t[r>>12&63]+t[r>>6&63]+t[r&63]}function l(r,e,n){var t;var o=[];for(var a=e;a<n;a+=3){t=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255);o.push(s(t))}return o.join("")}function p(r){var e;var n=r.length;var o=n%3;var a=[];var f=16383;for(var i=0,u=n-o;i<u;i+=f){a.push(l(r,i,i+f>u?u:i+f))}if(o===1){e=r[n-1];a.push(t[e>>2]+t[e<<4&63]+"==")}else if(o===2){e=(r[n-2]<<8)+r[n-1];a.push(t[e>>10]+t[e>>4&63]+t[e<<2&63]+"=")}return a.join("")}},{}]},{},[])("/")});
|
||||
(function(r){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=r()}else if(typeof define==="function"&&define.amd){define([],r)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e.base64js=r()}})(function(){var r,e,t;return function r(e,t,n){function o(i,a){if(!t[i]){if(!e[i]){var u=typeof require=="function"&&require;if(!a&&u)return u(i,!0);if(f)return f(i,!0);var d=new Error("Cannot find module '"+i+"'");throw d.code="MODULE_NOT_FOUND",d}var c=t[i]={exports:{}};e[i][0].call(c.exports,function(r){var t=e[i][1][r];return o(t?t:r)},c,c.exports,r,e,t,n)}return t[i].exports}var f=typeof require=="function"&&require;for(var i=0;i<n.length;i++)o(n[i]);return o}({"/":[function(r,e,t){"use strict";t.byteLength=c;t.toByteArray=v;t.fromByteArray=s;var n=[];var o=[];var f=typeof Uint8Array!=="undefined"?Uint8Array:Array;var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var a=0,u=i.length;a<u;++a){n[a]=i[a];o[i.charCodeAt(a)]=a}o["-".charCodeAt(0)]=62;o["_".charCodeAt(0)]=63;function d(r){var e=r.length;if(e%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}return r[e-2]==="="?2:r[e-1]==="="?1:0}function c(r){return r.length*3/4-d(r)}function v(r){var e,t,n,i,a,u;var c=r.length;a=d(r);u=new f(c*3/4-a);n=a>0?c-4:c;var v=0;for(e=0,t=0;e<n;e+=4,t+=3){i=o[r.charCodeAt(e)]<<18|o[r.charCodeAt(e+1)]<<12|o[r.charCodeAt(e+2)]<<6|o[r.charCodeAt(e+3)];u[v++]=i>>16&255;u[v++]=i>>8&255;u[v++]=i&255}if(a===2){i=o[r.charCodeAt(e)]<<2|o[r.charCodeAt(e+1)]>>4;u[v++]=i&255}else if(a===1){i=o[r.charCodeAt(e)]<<10|o[r.charCodeAt(e+1)]<<4|o[r.charCodeAt(e+2)]>>2;u[v++]=i>>8&255;u[v++]=i&255}return u}function l(r){return n[r>>18&63]+n[r>>12&63]+n[r>>6&63]+n[r&63]}function h(r,e,t){var n;var o=[];for(var f=e;f<t;f+=3){n=(r[f]<<16)+(r[f+1]<<8)+r[f+2];o.push(l(n))}return o.join("")}function s(r){var e;var t=r.length;var o=t%3;var f="";var i=[];var a=16383;for(var u=0,d=t-o;u<d;u+=a){i.push(h(r,u,u+a>d?d:u+a))}if(o===1){e=r[t-1];f+=n[e>>2];f+=n[e<<4&63];f+="=="}else if(o===2){e=(r[t-2]<<8)+r[t-1];f+=n[e>>10];f+=n[e>>4&63];f+=n[e<<2&63];f+="="}i.push(f);return i.join("")}},{}]},{},[])("/")});
|
||||
|
||||
+42
-79
@@ -14,102 +14,68 @@ for (var i = 0, len = code.length; i < len; ++i) {
|
||||
revLookup[code.charCodeAt(i)] = i
|
||||
}
|
||||
|
||||
// Support decoding URL-safe base64 strings, as Node.js does.
|
||||
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
||||
revLookup['-'.charCodeAt(0)] = 62
|
||||
revLookup['_'.charCodeAt(0)] = 63
|
||||
|
||||
function getLens (b64) {
|
||||
function placeHoldersCount (b64) {
|
||||
var len = b64.length
|
||||
|
||||
if (len % 4 > 0) {
|
||||
throw new Error('Invalid string. Length must be a multiple of 4')
|
||||
}
|
||||
|
||||
// Trim off extra bytes after placeholder bytes are found
|
||||
// See: https://github.com/beatgammit/base64-js/issues/42
|
||||
var validLen = b64.indexOf('=')
|
||||
if (validLen === -1) validLen = len
|
||||
|
||||
var placeHoldersLen = validLen === len
|
||||
? 0
|
||||
: 4 - (validLen % 4)
|
||||
|
||||
return [validLen, placeHoldersLen]
|
||||
// the number of equal signs (place holders)
|
||||
// if there are two placeholders, than the two characters before it
|
||||
// represent one byte
|
||||
// if there is only one, then the three characters before it represent 2 bytes
|
||||
// this is just a cheap hack to not do indexOf twice
|
||||
return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
|
||||
}
|
||||
|
||||
// base64 is 4/3 + up to two characters of the original data
|
||||
function byteLength (b64) {
|
||||
var lens = getLens(b64)
|
||||
var validLen = lens[0]
|
||||
var placeHoldersLen = lens[1]
|
||||
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||
}
|
||||
|
||||
function _byteLength (b64, validLen, placeHoldersLen) {
|
||||
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||
// base64 is 4/3 + up to two characters of the original data
|
||||
return b64.length * 3 / 4 - placeHoldersCount(b64)
|
||||
}
|
||||
|
||||
function toByteArray (b64) {
|
||||
var tmp
|
||||
var lens = getLens(b64)
|
||||
var validLen = lens[0]
|
||||
var placeHoldersLen = lens[1]
|
||||
var i, j, l, tmp, placeHolders, arr
|
||||
var len = b64.length
|
||||
placeHolders = placeHoldersCount(b64)
|
||||
|
||||
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
||||
|
||||
var curByte = 0
|
||||
arr = new Arr(len * 3 / 4 - placeHolders)
|
||||
|
||||
// if there are placeholders, only get up to the last complete 4 chars
|
||||
var len = placeHoldersLen > 0
|
||||
? validLen - 4
|
||||
: validLen
|
||||
l = placeHolders > 0 ? len - 4 : len
|
||||
|
||||
for (var i = 0; i < len; i += 4) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 18) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
||||
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
||||
revLookup[b64.charCodeAt(i + 3)]
|
||||
arr[curByte++] = (tmp >> 16) & 0xFF
|
||||
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
var L = 0
|
||||
|
||||
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
||||
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
|
||||
arr[L++] = (tmp >> 16) & 0xFF
|
||||
arr[L++] = (tmp >> 8) & 0xFF
|
||||
arr[L++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
if (placeHoldersLen === 2) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 2) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] >> 4)
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
if (placeHoldersLen === 1) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 10) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
||||
(revLookup[b64.charCodeAt(i + 2)] >> 2)
|
||||
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
if (placeHolders === 2) {
|
||||
tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
|
||||
arr[L++] = tmp & 0xFF
|
||||
} else if (placeHolders === 1) {
|
||||
tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
|
||||
arr[L++] = (tmp >> 8) & 0xFF
|
||||
arr[L++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
return arr
|
||||
}
|
||||
|
||||
function tripletToBase64 (num) {
|
||||
return lookup[num >> 18 & 0x3F] +
|
||||
lookup[num >> 12 & 0x3F] +
|
||||
lookup[num >> 6 & 0x3F] +
|
||||
lookup[num & 0x3F]
|
||||
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
|
||||
}
|
||||
|
||||
function encodeChunk (uint8, start, end) {
|
||||
var tmp
|
||||
var output = []
|
||||
for (var i = start; i < end; i += 3) {
|
||||
tmp =
|
||||
((uint8[i] << 16) & 0xFF0000) +
|
||||
((uint8[i + 1] << 8) & 0xFF00) +
|
||||
(uint8[i + 2] & 0xFF)
|
||||
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
|
||||
output.push(tripletToBase64(tmp))
|
||||
}
|
||||
return output.join('')
|
||||
@@ -119,33 +85,30 @@ function fromByteArray (uint8) {
|
||||
var tmp
|
||||
var len = uint8.length
|
||||
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
||||
var output = ''
|
||||
var parts = []
|
||||
var maxChunkLength = 16383 // must be multiple of 3
|
||||
|
||||
// go through the array every three bytes, we'll deal with trailing stuff later
|
||||
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
||||
parts.push(encodeChunk(
|
||||
uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
|
||||
))
|
||||
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
||||
}
|
||||
|
||||
// pad the end with zeros, but make sure to not forget the extra bytes
|
||||
if (extraBytes === 1) {
|
||||
tmp = uint8[len - 1]
|
||||
parts.push(
|
||||
lookup[tmp >> 2] +
|
||||
lookup[(tmp << 4) & 0x3F] +
|
||||
'=='
|
||||
)
|
||||
output += lookup[tmp >> 2]
|
||||
output += lookup[(tmp << 4) & 0x3F]
|
||||
output += '=='
|
||||
} else if (extraBytes === 2) {
|
||||
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
||||
parts.push(
|
||||
lookup[tmp >> 10] +
|
||||
lookup[(tmp >> 4) & 0x3F] +
|
||||
lookup[(tmp << 2) & 0x3F] +
|
||||
'='
|
||||
)
|
||||
tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
|
||||
output += lookup[tmp >> 10]
|
||||
output += lookup[(tmp >> 4) & 0x3F]
|
||||
output += lookup[(tmp << 2) & 0x3F]
|
||||
output += '='
|
||||
}
|
||||
|
||||
parts.push(output)
|
||||
|
||||
return parts.join('')
|
||||
}
|
||||
|
||||
+16
-17
@@ -1,28 +1,27 @@
|
||||
{
|
||||
"_from": "base64-js@1",
|
||||
"_id": "base64-js@1.3.0",
|
||||
"_from": "base64-js@1.2.0",
|
||||
"_id": "base64-js@1.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==",
|
||||
"_integrity": "sha1-o5mS1yNYSBGYK+XikLtqU9hnAPE=",
|
||||
"_location": "/base64-js",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "base64-js@1",
|
||||
"raw": "base64-js@1.2.0",
|
||||
"name": "base64-js",
|
||||
"escapedName": "base64-js",
|
||||
"rawSpec": "1",
|
||||
"rawSpec": "1.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1"
|
||||
"fetchSpec": "1.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
"/plist"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
|
||||
"_shasum": "cab1e6118f051095e58b5281aea8c1cd22bfc0e3",
|
||||
"_spec": "base64-js@1",
|
||||
"_where": "/Users/brodybits/Documents/cordova/cordova-android",
|
||||
"_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.0.tgz",
|
||||
"_shasum": "a39992d723584811982be5e290bb6a53d86700f1",
|
||||
"_spec": "base64-js@1.2.0",
|
||||
"_where": "/Users/brodybits/Documents/cordova/cordova-android/node_modules/plist",
|
||||
"author": {
|
||||
"name": "T. Jameson Little",
|
||||
"email": "t.jameson.little@gmail.com"
|
||||
@@ -34,11 +33,11 @@
|
||||
"deprecated": false,
|
||||
"description": "Base64 encoding/decoding in pure JS",
|
||||
"devDependencies": {
|
||||
"benchmark": "^2.1.4",
|
||||
"browserify": "^14.0.0",
|
||||
"benchmark": "^2.1.0",
|
||||
"browserify": "^13.0.0",
|
||||
"standard": "*",
|
||||
"tape": "4.x",
|
||||
"uglify-js": "^2.8.29"
|
||||
"uglify-js": "^2.6.2"
|
||||
},
|
||||
"files": [
|
||||
"test",
|
||||
@@ -62,5 +61,5 @@
|
||||
"test": "npm run lint && npm run unit",
|
||||
"unit": "tape test/*.js"
|
||||
},
|
||||
"version": "1.3.0"
|
||||
"version": "1.2.0"
|
||||
}
|
||||
|
||||
-1
@@ -10,7 +10,6 @@ test('convert big data to base64', function (t) {
|
||||
b64str = b64.fromByteArray(big)
|
||||
arr = b64.toByteArray(b64str)
|
||||
t.ok(equal(arr, big))
|
||||
t.equal(b64.byteLength(b64str), arr.length)
|
||||
t.end()
|
||||
})
|
||||
|
||||
|
||||
-40
@@ -29,46 +29,6 @@ test('convert to base64 and back', function (t) {
|
||||
}
|
||||
})
|
||||
|
||||
var data = [
|
||||
[[0, 0, 0], 'AAAA'],
|
||||
[[0, 0, 1], 'AAAB'],
|
||||
[[0, 1, -1], 'AAH/'],
|
||||
[[1, 1, 1], 'AQEB'],
|
||||
[[0, -73, 23], 'ALcX']
|
||||
]
|
||||
|
||||
test('convert known data to string', function (t) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var bytes = data[i][0]
|
||||
var expected = data[i][1]
|
||||
var actual = b64.fromByteArray(bytes)
|
||||
t.equal(actual, expected, 'Ensure that ' + bytes + ' serialise to ' + expected)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('convert known data from string', function (t) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var expected = data[i][0]
|
||||
var string = data[i][1]
|
||||
var actual = b64.toByteArray(string)
|
||||
t.ok(equal(actual, expected), 'Ensure that ' + string + ' deserialise to ' + expected)
|
||||
var length = b64.byteLength(string)
|
||||
t.equal(length, expected.length, 'Ensure that ' + string + ' has byte lentgh of ' + expected.length)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
function equal (a, b) {
|
||||
var i
|
||||
var length = a.length
|
||||
if (length !== b.length) return false
|
||||
for (i = 0; i < length; ++i) {
|
||||
if ((a[i] & 0xFF) !== (b[i] & 0xFF)) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function map (arr, callback) {
|
||||
var res = []
|
||||
var kValue, mappedValue
|
||||
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
var test = require('tape')
|
||||
var b64 = require('../')
|
||||
|
||||
test('padding bytes found inside base64 string', function (t) {
|
||||
// See https://github.com/beatgammit/base64-js/issues/42
|
||||
var str = 'SQ==QU0='
|
||||
t.deepEqual(b64.toByteArray(str), new Uint8Array([73]))
|
||||
t.equal(b64.byteLength(str), 1)
|
||||
t.end()
|
||||
})
|
||||
+2
-8
@@ -4,21 +4,15 @@ var b64 = require('../')
|
||||
test('decode url-safe style base64 strings', function (t) {
|
||||
var expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff]
|
||||
|
||||
var str = '//++/++/++//'
|
||||
var actual = b64.toByteArray(str)
|
||||
var actual = b64.toByteArray('//++/++/++//')
|
||||
for (var i = 0; i < actual.length; i++) {
|
||||
t.equal(actual[i], expected[i])
|
||||
}
|
||||
|
||||
t.equal(b64.byteLength(str), actual.length)
|
||||
|
||||
str = '__--_--_--__'
|
||||
actual = b64.toByteArray(str)
|
||||
actual = b64.toByteArray('__--_--_--__')
|
||||
for (i = 0; i < actual.length; i++) {
|
||||
t.equal(actual[i], expected[i])
|
||||
}
|
||||
|
||||
t.equal(b64.byteLength(str), actual.length)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user