@loaders.gl/zip
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-beta.3
@@ -12,7 +12,5 @@ "use strict"; | ||
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); | ||
var _jszip = _interopRequireDefault(require("jszip")); | ||
var VERSION = typeof "2.0.0-beta.2" !== 'undefined' ? "2.0.0-beta.2" : 'latest'; | ||
var VERSION = typeof "2.0.0-beta.3" !== 'undefined' ? "2.0.0-beta.3" : 'latest'; | ||
var ZipLoader = { | ||
@@ -30,85 +28,71 @@ id: 'zip', | ||
function parseZipAsync(_x, _x2) { | ||
return _parseZipAsync.apply(this, arguments); | ||
} | ||
function parseZipAsync(data, options) { | ||
var promises, fileMap, jsZip, zip; | ||
return _regenerator["default"].async(function parseZipAsync$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
promises = []; | ||
fileMap = {}; | ||
_context.prev = 2; | ||
jsZip = new _jszip["default"](); | ||
_context.next = 6; | ||
return _regenerator["default"].awrap(jsZip.loadAsync(data, options)); | ||
function _parseZipAsync() { | ||
_parseZipAsync = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(data, options) { | ||
var promises, fileMap, jsZip, zip; | ||
return _regenerator["default"].wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
promises = []; | ||
fileMap = {}; | ||
_context.prev = 2; | ||
jsZip = new _jszip["default"](); | ||
_context.next = 6; | ||
return jsZip.loadAsync(data, options); | ||
case 6: | ||
zip = _context.sent; | ||
zip.forEach(function (relativePath, zipEntry) { | ||
var subFilename = zipEntry.name; | ||
var promise = loadZipEntry(jsZip, subFilename, options).then(function (arrayBufferOrError) { | ||
fileMap[relativePath] = arrayBufferOrError; | ||
}); | ||
promises.push(promise); | ||
case 6: | ||
zip = _context.sent; | ||
zip.forEach(function (relativePath, zipEntry) { | ||
var subFilename = zipEntry.name; | ||
var promise = loadZipEntry(jsZip, subFilename, options).then(function (arrayBufferOrError) { | ||
fileMap[relativePath] = arrayBufferOrError; | ||
}); | ||
_context.next = 10; | ||
return Promise.all(promises); | ||
promises.push(promise); | ||
}); | ||
_context.next = 10; | ||
return _regenerator["default"].awrap(Promise.all(promises)); | ||
case 10: | ||
return _context.abrupt("return", fileMap); | ||
case 10: | ||
return _context.abrupt("return", fileMap); | ||
case 13: | ||
_context.prev = 13; | ||
_context.t0 = _context["catch"](2); | ||
options.log.error("Unable to read zip archive: ".concat(_context.t0)); | ||
throw _context.t0; | ||
case 13: | ||
_context.prev = 13; | ||
_context.t0 = _context["catch"](2); | ||
options.log.error("Unable to read zip archive: ".concat(_context.t0)); | ||
throw _context.t0; | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee, null, [[2, 13]]); | ||
})); | ||
return _parseZipAsync.apply(this, arguments); | ||
} | ||
}, null, null, [[2, 13]]); | ||
} | ||
function loadZipEntry(_x3, _x4, _x5) { | ||
return _loadZipEntry.apply(this, arguments); | ||
} | ||
function loadZipEntry(jsZip, subFilename, options) { | ||
var arrayBuffer; | ||
return _regenerator["default"].async(function loadZipEntry$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.prev = 0; | ||
_context2.next = 3; | ||
return _regenerator["default"].awrap(jsZip.file(subFilename).async(options.dataType || 'arraybuffer')); | ||
function _loadZipEntry() { | ||
_loadZipEntry = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(jsZip, subFilename, options) { | ||
var arrayBuffer; | ||
return _regenerator["default"].wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.prev = 0; | ||
_context2.next = 3; | ||
return jsZip.file(subFilename).async(options.dataType || 'arraybuffer'); | ||
case 3: | ||
arrayBuffer = _context2.sent; | ||
return _context2.abrupt("return", arrayBuffer); | ||
case 3: | ||
arrayBuffer = _context2.sent; | ||
return _context2.abrupt("return", arrayBuffer); | ||
case 7: | ||
_context2.prev = 7; | ||
_context2.t0 = _context2["catch"](0); | ||
options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(_context2.t0)); | ||
return _context2.abrupt("return", _context2.t0); | ||
case 7: | ||
_context2.prev = 7; | ||
_context2.t0 = _context2["catch"](0); | ||
options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(_context2.t0)); | ||
return _context2.abrupt("return", _context2.t0); | ||
case 11: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
case 11: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
}, _callee2, null, [[0, 7]]); | ||
})); | ||
return _loadZipEntry.apply(this, arguments); | ||
} | ||
}, null, null, [[0, 7]]); | ||
} | ||
//# sourceMappingURL=zip-loader.js.map |
import JSZip from 'jszip'; | ||
const VERSION = typeof "2.0.0-beta.2" !== 'undefined' ? "2.0.0-beta.2" : 'latest'; | ||
const VERSION = typeof "2.0.0-beta.3" !== 'undefined' ? "2.0.0-beta.3" : 'latest'; | ||
export const ZipLoader = { | ||
@@ -4,0 +4,0 @@ id: 'zip', |
import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
import JSZip from 'jszip'; | ||
var VERSION = typeof "2.0.0-beta.2" !== 'undefined' ? "2.0.0-beta.2" : 'latest'; | ||
var VERSION = typeof "2.0.0-beta.3" !== 'undefined' ? "2.0.0-beta.3" : 'latest'; | ||
export var ZipLoader = { | ||
@@ -16,85 +15,71 @@ id: 'zip', | ||
function parseZipAsync(_x, _x2) { | ||
return _parseZipAsync.apply(this, arguments); | ||
} | ||
function parseZipAsync(data, options) { | ||
var promises, fileMap, jsZip, zip; | ||
return _regeneratorRuntime.async(function parseZipAsync$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
promises = []; | ||
fileMap = {}; | ||
_context.prev = 2; | ||
jsZip = new JSZip(); | ||
_context.next = 6; | ||
return _regeneratorRuntime.awrap(jsZip.loadAsync(data, options)); | ||
function _parseZipAsync() { | ||
_parseZipAsync = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(data, options) { | ||
var promises, fileMap, jsZip, zip; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
promises = []; | ||
fileMap = {}; | ||
_context.prev = 2; | ||
jsZip = new JSZip(); | ||
_context.next = 6; | ||
return jsZip.loadAsync(data, options); | ||
case 6: | ||
zip = _context.sent; | ||
zip.forEach(function (relativePath, zipEntry) { | ||
var subFilename = zipEntry.name; | ||
var promise = loadZipEntry(jsZip, subFilename, options).then(function (arrayBufferOrError) { | ||
fileMap[relativePath] = arrayBufferOrError; | ||
}); | ||
promises.push(promise); | ||
case 6: | ||
zip = _context.sent; | ||
zip.forEach(function (relativePath, zipEntry) { | ||
var subFilename = zipEntry.name; | ||
var promise = loadZipEntry(jsZip, subFilename, options).then(function (arrayBufferOrError) { | ||
fileMap[relativePath] = arrayBufferOrError; | ||
}); | ||
_context.next = 10; | ||
return Promise.all(promises); | ||
promises.push(promise); | ||
}); | ||
_context.next = 10; | ||
return _regeneratorRuntime.awrap(Promise.all(promises)); | ||
case 10: | ||
return _context.abrupt("return", fileMap); | ||
case 10: | ||
return _context.abrupt("return", fileMap); | ||
case 13: | ||
_context.prev = 13; | ||
_context.t0 = _context["catch"](2); | ||
options.log.error("Unable to read zip archive: ".concat(_context.t0)); | ||
throw _context.t0; | ||
case 13: | ||
_context.prev = 13; | ||
_context.t0 = _context["catch"](2); | ||
options.log.error("Unable to read zip archive: ".concat(_context.t0)); | ||
throw _context.t0; | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee, null, [[2, 13]]); | ||
})); | ||
return _parseZipAsync.apply(this, arguments); | ||
} | ||
}, null, null, [[2, 13]]); | ||
} | ||
function loadZipEntry(_x3, _x4, _x5) { | ||
return _loadZipEntry.apply(this, arguments); | ||
} | ||
function loadZipEntry(jsZip, subFilename, options) { | ||
var arrayBuffer; | ||
return _regeneratorRuntime.async(function loadZipEntry$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.prev = 0; | ||
_context2.next = 3; | ||
return _regeneratorRuntime.awrap(jsZip.file(subFilename).async(options.dataType || 'arraybuffer')); | ||
function _loadZipEntry() { | ||
_loadZipEntry = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(jsZip, subFilename, options) { | ||
var arrayBuffer; | ||
return _regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_context2.prev = 0; | ||
_context2.next = 3; | ||
return jsZip.file(subFilename).async(options.dataType || 'arraybuffer'); | ||
case 3: | ||
arrayBuffer = _context2.sent; | ||
return _context2.abrupt("return", arrayBuffer); | ||
case 3: | ||
arrayBuffer = _context2.sent; | ||
return _context2.abrupt("return", arrayBuffer); | ||
case 7: | ||
_context2.prev = 7; | ||
_context2.t0 = _context2["catch"](0); | ||
options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(_context2.t0)); | ||
return _context2.abrupt("return", _context2.t0); | ||
case 7: | ||
_context2.prev = 7; | ||
_context2.t0 = _context2["catch"](0); | ||
options.log.error("Unable to read ".concat(subFilename, " from zip archive: ").concat(_context2.t0)); | ||
return _context2.abrupt("return", _context2.t0); | ||
case 11: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
case 11: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
}, _callee2, null, [[0, 7]]); | ||
})); | ||
return _loadZipEntry.apply(this, arguments); | ||
} | ||
}, null, null, [[0, 7]]); | ||
} | ||
//# sourceMappingURL=zip-loader.js.map |
{ | ||
"name": "@loaders.gl/zip", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-beta.3", | ||
"description": "Zip Archive Loader", | ||
@@ -33,6 +33,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"@loaders.gl/core": "2.0.0-beta.2", | ||
"@loaders.gl/core": "2.0.0-beta.3", | ||
"jszip": "^3.1.5" | ||
}, | ||
"gitHead": "d6dcb340fb885a48d968029d53d521fa7aeb036e" | ||
"gitHead": "94e3a75727664a5dfd8c4f151d613c6a12679922" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
793174
16492
+ Added@loaders.gl/core@2.0.0-beta.3(transitive)
+ Added@loaders.gl/loader-utils@2.0.0-beta.3(transitive)
- Removed@loaders.gl/core@2.0.0-beta.2(transitive)
- Removed@loaders.gl/loader-utils@2.0.0-beta.2(transitive)