@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.
- package/dist/dist.dev.js +52 -24
- package/dist/dist.min.js +2 -2
- package/dist/filesystems/IndexedArchive.js +2 -0
- package/dist/filesystems/zip-filesystem.d.ts.map +1 -1
- package/dist/filesystems/zip-filesystem.js +7 -3
- package/dist/index.cjs +20 -6
- package/dist/index.cjs.map +2 -2
- package/dist/lib/tar/tar.js +4 -1
- package/dist/tar-builder.js +3 -1
- package/dist/zip-loader.d.ts +15 -2
- package/dist/zip-loader.d.ts.map +1 -1
- package/dist/zip-loader.js +3 -1
- package/dist/zip-writer.d.ts +19 -2
- package/dist/zip-writer.d.ts.map +1 -1
- package/dist/zip-writer.js +1 -1
- package/package.json +5 -5
- package/src/filesystems/zip-filesystem.ts +4 -0
- package/src/zip-loader.ts +5 -2
- package/src/zip-writer.ts +2 -2
package/dist/zip-loader.js
CHANGED
|
@@ -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.
|
|
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',
|
package/dist/zip-writer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
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:
|
|
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
|
package/dist/zip-writer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zip-writer.d.ts","sourceRoot":"","sources":["../src/zip-writer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
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"}
|
package/dist/zip-writer.js
CHANGED
|
@@ -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.
|
|
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-
|
|
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-
|
|
43
|
-
"@loaders.gl/crypto": "4.2.0-
|
|
44
|
-
"@loaders.gl/loader-utils": "4.2.0-
|
|
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": "
|
|
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
|
|
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
|
|
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>,
|