@loaders.gl/zip 4.2.0-alpha.5 → 4.2.0-beta.1

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.
@@ -4,8 +4,10 @@
4
4
  import JSZip from 'jszip';
5
5
  // __VERSION__ is injected by babel-plugin-version-inline
6
6
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
7
- const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
7
+ const VERSION = typeof "4.2.0-alpha.6" !== 'undefined' ? "4.2.0-alpha.6" : 'latest';
8
8
  export const ZipLoader = {
9
+ dataType: null,
10
+ batchType: null,
9
11
  id: 'zip',
10
12
  module: 'zip',
11
13
  name: 'Zip Archive',
@@ -1,4 +1,4 @@
1
- import type { WriterWithEncoder, WriterOptions } from '@loaders.gl/loader-utils';
1
+ import type { WriterOptions } from '@loaders.gl/loader-utils';
2
2
  import { JSZipGeneratorOptions } from 'jszip';
3
3
  export type ZipWriterOptions = WriterOptions & {
4
4
  zip?: {
@@ -12,5 +12,22 @@ export type ZipWriterOptions = WriterOptions & {
12
12
  /**
13
13
  * Zip exporter
14
14
  */
15
- export declare const ZipWriter: WriterWithEncoder<Record<string, ArrayBuffer>, never, ZipWriterOptions>;
15
+ export declare const ZipWriter: {
16
+ readonly name: "Zip Archive";
17
+ readonly id: "zip";
18
+ readonly module: "zip";
19
+ readonly version: any;
20
+ readonly extensions: ["zip"];
21
+ readonly category: "archive";
22
+ readonly mimeTypes: ["application/zip"];
23
+ readonly options: {
24
+ readonly zip: {
25
+ readonly onUpdate: () => void;
26
+ };
27
+ readonly jszip: {};
28
+ };
29
+ readonly encode: typeof encodeZipAsync;
30
+ };
31
+ declare function encodeZipAsync(fileMap: Record<string, ArrayBuffer>, options?: ZipWriterOptions): Promise<ArrayBuffer>;
32
+ export {};
16
33
  //# sourceMappingURL=zip-writer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zip-writer.d.ts","sourceRoot":"","sources":["../src/zip-writer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,iBAAiB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC/E,OAAc,EAAC,qBAAqB,EAAC,MAAM,OAAO,CAAC;AAKnD,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE;YAAC,OAAO,EAAE,MAAM,CAAA;SAAC,KAAK,IAAI,CAAC;KAClD,CAAC;IACF,mCAAmC;IACnC,KAAK,CAAC,EAAE,qBAAqB,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAe7F,CAAC"}
1
+ {"version":3,"file":"zip-writer.d.ts","sourceRoot":"","sources":["../src/zip-writer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC/E,OAAc,EAAC,qBAAqB,EAAC,MAAM,OAAO,CAAC;AAKnD,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE;YAAC,OAAO,EAAE,MAAM,CAAA;SAAC,KAAK,IAAI,CAAC;KAClD,CAAC;IACF,mCAAmC;IACnC,KAAK,CAAC,EAAE,qBAAqB,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;CAesE,CAAC;AAE7F,iBAAe,cAAc,CAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACpC,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,WAAW,CAAC,CAuBtB"}
@@ -3,7 +3,7 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
  import JSZip from 'jszip';
5
5
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
6
- const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
6
+ const VERSION = typeof "4.2.0-alpha.6" !== 'undefined' ? "4.2.0-alpha.6" : 'latest';
7
7
  /**
8
8
  * Zip exporter
9
9
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/zip",
3
- "version": "4.2.0-alpha.5",
3
+ "version": "4.2.0-beta.1",
4
4
  "description": "Zip Archive Loader",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,14 +39,14 @@
39
39
  "build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
40
40
  },
41
41
  "dependencies": {
42
- "@loaders.gl/compression": "4.2.0-alpha.5",
43
- "@loaders.gl/crypto": "4.2.0-alpha.5",
44
- "@loaders.gl/loader-utils": "4.2.0-alpha.5",
42
+ "@loaders.gl/compression": "4.2.0-beta.1",
43
+ "@loaders.gl/crypto": "4.2.0-beta.1",
44
+ "@loaders.gl/loader-utils": "4.2.0-beta.1",
45
45
  "jszip": "^3.1.5",
46
46
  "md5": "^2.3.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@loaders.gl/core": "^4.0.0"
50
50
  },
51
- "gitHead": "32d95a81971f104e4dfeb88ab57065f05321a76a"
51
+ "gitHead": "c386a9196516fe3ff24847b40e6c77be039cf905"
52
52
  }
@@ -94,6 +94,10 @@ export class ZipFileSystem implements FileSystem {
94
94
  * @returns - Response with file data
95
95
  */
96
96
  async fetch(filename: string): Promise<Response> {
97
+ if (this.fileName && filename.indexOf(this.fileName) === 0) {
98
+ filename = filename.substring(this.fileName.length + 1);
99
+ }
100
+
97
101
  let uncompressedFile: ArrayBuffer;
98
102
  if (this.archive) {
99
103
  uncompressedFile = await this.archive.getFile(filename, 'http');
package/src/zip-loader.ts CHANGED
@@ -11,7 +11,10 @@ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
11
11
 
12
12
  type FileMap = Record<string, ArrayBuffer>;
13
13
 
14
- export const ZipLoader: LoaderWithParser<FileMap, never, LoaderOptions> = {
14
+ export const ZipLoader = {
15
+ dataType: null as unknown as FileMap,
16
+ batchType: null as unknown as never,
17
+
15
18
  id: 'zip',
16
19
  module: 'zip',
17
20
  name: 'Zip Archive',
@@ -22,7 +25,7 @@ export const ZipLoader: LoaderWithParser<FileMap, never, LoaderOptions> = {
22
25
  tests: ['PK'],
23
26
  options: {},
24
27
  parse: parseZipAsync
25
- };
28
+ } as const satisfies LoaderWithParser<FileMap, never, LoaderOptions>;
26
29
 
27
30
  // TODO - Could return a map of promises, perhaps as an option...
28
31
  async function parseZipAsync(data: any, options = {}): Promise<FileMap> {
package/src/zip-writer.ts CHANGED
@@ -19,7 +19,7 @@ export type ZipWriterOptions = WriterOptions & {
19
19
  /**
20
20
  * Zip exporter
21
21
  */
22
- export const ZipWriter: WriterWithEncoder<Record<string, ArrayBuffer>, never, ZipWriterOptions> = {
22
+ export const ZipWriter = {
23
23
  name: 'Zip Archive',
24
24
  id: 'zip',
25
25
  module: 'zip',
@@ -34,7 +34,7 @@ export const ZipWriter: WriterWithEncoder<Record<string, ArrayBuffer>, never, Zi
34
34
  jszip: {}
35
35
  },
36
36
  encode: encodeZipAsync
37
- };
37
+ } as const satisfies WriterWithEncoder<Record<string, ArrayBuffer>, never, ZipWriterOptions>;
38
38
 
39
39
  async function encodeZipAsync(
40
40
  fileMap: Record<string, ArrayBuffer>,