@loaders.gl/zip 4.0.4 → 4.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.dev.js CHANGED
@@ -6968,7 +6968,7 @@ var __exports__ = (() => {
6968
6968
 
6969
6969
  // src/zip-loader.ts
6970
6970
  var import_jszip = __toESM(require_jszip_min(), 1);
6971
- var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
6971
+ var VERSION = true ? "4.0.6" : "latest";
6972
6972
  var ZipLoader = {
6973
6973
  id: "zip",
6974
6974
  module: "zip",
@@ -1,5 +1,5 @@
1
1
  import JSZip from 'jszip';
2
- const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
2
+ const VERSION = typeof "4.0.6" !== 'undefined' ? "4.0.6" : 'latest';
3
3
  export const ZipLoader = {
4
4
  id: 'zip',
5
5
  module: 'zip',
@@ -1 +1 @@
1
- {"version":3,"file":"zip-loader.js","names":["JSZip","VERSION","__VERSION__","ZipLoader","id","module","name","version","extensions","mimeTypes","category","tests","options","parse","parseZipAsync","data","arguments","length","undefined","promises","fileMap","jsZip","zip","loadAsync","forEach","relativePath","zipEntry","subFilename","promise","loadZipEntry","then","arrayBufferOrError","push","Promise","all","error","log","arrayBuffer","file","async","dataType"],"sources":["../src/zip-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport JSZip from 'jszip';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\ntype FileMap = Record<string, ArrayBuffer>;\n\nexport const ZipLoader: LoaderWithParser<FileMap, never, LoaderOptions> = {\n id: 'zip',\n module: 'zip',\n name: 'Zip Archive',\n version: VERSION,\n extensions: ['zip'],\n mimeTypes: ['application/zip'],\n category: 'archive',\n tests: ['PK'],\n options: {},\n parse: parseZipAsync\n};\n\n// TODO - Could return a map of promises, perhaps as an option...\nasync function parseZipAsync(data: any, options = {}): Promise<FileMap> {\n const promises: Promise<any>[] = [];\n const fileMap: Record<string, ArrayBuffer> = {};\n\n try {\n const jsZip = new JSZip();\n\n const zip = await jsZip.loadAsync(data, options);\n\n // start to load each file in this zip\n zip.forEach((relativePath, zipEntry) => {\n const subFilename = zipEntry.name;\n\n const promise = loadZipEntry(jsZip, subFilename, options).then((arrayBufferOrError) => {\n fileMap[relativePath] = arrayBufferOrError;\n });\n\n // Ensure Promise.all doesn't ignore rejected promises.\n promises.push(promise);\n });\n\n await Promise.all(promises);\n return fileMap;\n } catch (error) {\n // @ts-ignore\n options.log.error(`Unable to read zip archive: ${error}`);\n throw error;\n }\n}\n\nasync function loadZipEntry(jsZip: any, subFilename: string, options: any = {}) {\n // jszip supports both arraybuffer and text, the main loaders.gl types\n // https://stuk.github.io/jszip/documentation/api_zipobject/async.html\n try {\n const arrayBuffer = await jsZip.file(subFilename).async(options.dataType || 'arraybuffer');\n return arrayBuffer;\n } catch (error) {\n options.log.error(`Unable to read ${subFilename} from zip archive: ${error}`);\n // Store error in place of data in map\n return error;\n }\n}\n"],"mappings":"AAIA,OAAOA,KAAK,MAAM,OAAO;AAIzB,MAAMC,OAAO,GAAG,OAAOC,WAAW,KAAK,WAAW,GAAGA,WAAW,GAAG,QAAQ;AAI3E,OAAO,MAAMC,SAA0D,GAAG;EACxEC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,aAAa;EACnBC,OAAO,EAAEN,OAAO;EAChBO,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,iBAAiB,CAAC;EAC9BC,QAAQ,EAAE,SAAS;EACnBC,KAAK,EAAE,CAAC,IAAI,CAAC;EACbC,OAAO,EAAE,CAAC,CAAC;EACXC,KAAK,EAAEC;AACT,CAAC;A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;IAC1F,OAAOH,WAAW;EACpB,CAAC,CAAC,OAAOF,KAAK,EAAE;IACdvB,OAAO,CAACwB,GAAG,CAACD,KAAK,CAAE,kBAAiBR,WAAY,sBAAqBQ,KAAM,EAAC,CAAC;IAE7E,OAAOA,KAAK;EACd;AACF"}
1
+ {"version":3,"file":"zip-loader.js","names":["JSZip","VERSION","ZipLoader","id","module","name","version","extensions","mimeTypes","category","tests","options","parse","parseZipAsync","data","arguments","length","undefined","promises","fileMap","jsZip","zip","loadAsync","forEach","relativePath","zipEntry","subFilename","promise","loadZipEntry","then","arrayBufferOrError","push","Promise","all","error","log","arrayBuffer","file","async","dataType"],"sources":["../src/zip-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport JSZip from 'jszip';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\ntype FileMap = Record<string, ArrayBuffer>;\n\nexport const ZipLoader: LoaderWithParser<FileMap, never, LoaderOptions> = {\n id: 'zip',\n module: 'zip',\n name: 'Zip Archive',\n version: VERSION,\n extensions: ['zip'],\n mimeTypes: ['application/zip'],\n category: 'archive',\n tests: ['PK'],\n options: {},\n parse: parseZipAsync\n};\n\n// TODO - Could return a map of promises, perhaps as an option...\nasync function parseZipAsync(data: any, options = {}): Promise<FileMap> {\n const promises: Promise<any>[] = [];\n const fileMap: Record<string, ArrayBuffer> = {};\n\n try {\n const jsZip = new JSZip();\n\n const zip = await jsZip.loadAsync(data, options);\n\n // start to load each file in this zip\n zip.forEach((relativePath, zipEntry) => {\n const subFilename = zipEntry.name;\n\n const promise = loadZipEntry(jsZip, subFilename, options).then((arrayBufferOrError) => {\n fileMap[relativePath] = arrayBufferOrError;\n });\n\n // Ensure Promise.all doesn't ignore rejected promises.\n promises.push(promise);\n });\n\n await Promise.all(promises);\n return fileMap;\n } catch (error) {\n // @ts-ignore\n options.log.error(`Unable to read zip archive: ${error}`);\n throw error;\n }\n}\n\nasync function loadZipEntry(jsZip: any, subFilename: string, options: any = {}) {\n // jszip supports both arraybuffer and text, the main loaders.gl types\n // https://stuk.github.io/jszip/documentation/api_zipobject/async.html\n try {\n const arrayBuffer = await jsZip.file(subFilename).async(options.dataType || 'arraybuffer');\n return arrayBuffer;\n } catch (error) {\n options.log.error(`Unable to read ${subFilename} from zip archive: ${error}`);\n // Store error in place of data in map\n return error;\n }\n}\n"],"mappings":"AAIA,OAAOA,KAAK,MAAM,OAAO;AAIzB,MAAMC,OAAO,GAAG,cAAkB,KAAK,WAAW,aAAiB,QAAQ;AAI3E,OAAO,MAAMC,SAA0D,GAAG;EACxEC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,aAAa;EACnBC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,iBAAiB,CAAC;EAC9BC,QAAQ,EAAE,SAAS;EACnBC,KAAK,EAAE,CAAC,IAAI,CAAC;EACbC,OAAO,EAAE,CAAC,CAAC;EACXC,KAAK,EAAEC;AACT,CAAC;AAGD,eAAeA,aAAaA,CAACC,IAAS,EAAkC;EAAA,IAAhCH,OAAO,GAAAI,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAClD,MAAMG,QAAwB,GAAG,EAAE;EACnC,MAAMC,OAAoC,GAAG,CAAC,CAAC;EAE/C,IAAI;IACF,MAAMC,KAAK,GAAG,IAAIpB,KAAK,CAAC,CAAC;IAEzB,MAAMqB,GAAG,GAAG,MAAMD,KAAK,CAACE,SAAS,CAACR,IAAI,EAAEH,OAAO,CAAC;IAGhDU,GAAG,CAACE,OAAO,CAAC,CAACC,YAAY,EAAEC,QAAQ,KAAK;MACtC,MAAMC,WAAW,GAAGD,QAAQ,CAACpB,IAAI;MAEjC,MAAMsB,OAAO,GAAGC,YAAY,CAACR,KAAK,EAAEM,WAAW,EAAEf,OAAO,CAAC,CAACkB,IAAI,CAAEC,kBAAkB,IAAK;QACrFX,OAAO,CAACK,YAAY,CAAC,GAAGM,kBAAkB;MAC5C,CAAC,CAAC;MAGFZ,QAAQ,CAACa,IAAI,CAACJ,OAAO,CAAC;IACxB,CAAC,CAAC;IAEF,MAAMK,OAAO,CAACC,GAAG,CAACf,QAAQ,CAAC;IAC3B,OAAOC,OAAO;EAChB,CAAC,CAAC,OAAOe,KAAK,EAAE;IAEdvB,OAAO,CAACwB,GAAG,CAACD,KAAK,CAAE,+BAA8BA,KAAM,EAAC,CAAC;IACzD,MAAMA,KAAK;EACb;AACF;AAEA,eAAeN,YAAYA,CAACR,KAAU,EAAEM,WAAmB,EAAqB;EAAA,IAAnBf,OAAY,GAAAI,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAG5E,IAAI;IACF,MAAMqB,WAAW,GAAG,MAAMhB,KAAK,CAACiB,IAAI,CAACX,WAAW,CAAC,CAACY,KAAK,CAAC3B,OAAO,CAAC4B,QAAQ,IAAI,aAAa,CAAC;IAC1F,OAAOH,WAAW;EACpB,CAAC,CAAC,OAAOF,KAAK,EAAE;IACdvB,OAAO,CAACwB,GAAG,CAACD,KAAK,CAAE,kBAAiBR,WAAY,sBAAqBQ,KAAM,EAAC,CAAC;IAE7E,OAAOA,KAAK;EACd;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/zip",
3
- "version": "4.0.4",
3
+ "version": "4.0.6",
4
4
  "description": "Zip Archive Loader",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -38,11 +38,11 @@
38
38
  "build-bundle": "ocular-bundle ./src/index.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@loaders.gl/compression": "4.0.4",
42
- "@loaders.gl/crypto": "4.0.4",
43
- "@loaders.gl/loader-utils": "4.0.4",
41
+ "@loaders.gl/compression": "4.0.6",
42
+ "@loaders.gl/crypto": "4.0.6",
43
+ "@loaders.gl/loader-utils": "4.0.6",
44
44
  "jszip": "^3.1.5",
45
45
  "md5": "^2.3.0"
46
46
  },
47
- "gitHead": "4dc810fa04bb400f4aedfef98a83c7ef882ed3d7"
47
+ "gitHead": "1582e06e4ac81b61091148f3d872f67478fe7511"
48
48
  }