@loaders.gl/json 4.2.0-alpha.6 → 4.2.0-beta.2
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 -46
- package/dist/dist.min.js +5 -5
- package/dist/geojson-loader.d.ts +58 -4
- package/dist/geojson-loader.d.ts.map +1 -1
- package/dist/geojson-loader.js +3 -1
- package/dist/geojson-worker.js +49 -47
- package/dist/geojson-writer.d.ts +18 -2
- package/dist/geojson-writer.d.ts.map +1 -1
- package/dist/index.cjs +9 -3
- package/dist/index.cjs.map +2 -2
- package/dist/json-loader.d.ts +3 -3
- package/dist/json-loader.d.ts.map +1 -1
- package/dist/json-loader.js +3 -1
- package/dist/json-writer.d.ts +14 -3
- package/dist/json-writer.d.ts.map +1 -1
- package/dist/ndgeoson-loader.d.ts +26 -2
- package/dist/ndgeoson-loader.d.ts.map +1 -1
- package/dist/ndgeoson-loader.js +3 -1
- package/dist/ndjson-loader.d.ts +18 -2
- package/dist/ndjson-loader.d.ts.map +1 -1
- package/dist/ndjson-loader.js +3 -1
- package/package.json +5 -5
- package/src/geojson-loader.ts +7 -4
- package/src/geojson-writer.ts +2 -2
- package/src/json-loader.ts +9 -6
- package/src/json-writer.ts +2 -2
- package/src/ndgeoson-loader.ts +9 -6
- package/src/ndjson-loader.ts +5 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/json",
|
|
3
|
-
"version": "4.2.0-
|
|
3
|
+
"version": "4.2.0-beta.2",
|
|
4
4
|
"description": "Framework-independent loader for JSON and streaming JSON formats",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"build-worker": "esbuild src/workers/geojson-worker.ts --bundle --outfile=dist/geojson-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@loaders.gl/gis": "4.2.0-
|
|
48
|
-
"@loaders.gl/loader-utils": "4.2.0-
|
|
49
|
-
"@loaders.gl/schema": "4.2.0-
|
|
47
|
+
"@loaders.gl/gis": "4.2.0-beta.2",
|
|
48
|
+
"@loaders.gl/loader-utils": "4.2.0-beta.2",
|
|
49
|
+
"@loaders.gl/schema": "4.2.0-beta.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@loaders.gl/core": "^4.0.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "13c03663fec365a4d24c06377d50035cebd7ba9f"
|
|
55
55
|
}
|
package/src/geojson-loader.ts
CHANGED
|
@@ -25,7 +25,10 @@ export type GeoJSONLoaderOptions = JSONLoaderOptions & {
|
|
|
25
25
|
/**
|
|
26
26
|
* GeoJSON loader
|
|
27
27
|
*/
|
|
28
|
-
export const GeoJSONWorkerLoader
|
|
28
|
+
export const GeoJSONWorkerLoader = {
|
|
29
|
+
dataType: null as unknown as GeoJSON,
|
|
30
|
+
batchType: null as unknown as TableBatch,
|
|
31
|
+
|
|
29
32
|
name: 'GeoJSON',
|
|
30
33
|
id: 'geojson',
|
|
31
34
|
module: 'geojson',
|
|
@@ -47,16 +50,16 @@ export const GeoJSONWorkerLoader: Loader<GeoJSON, TableBatch, GeoJSONLoaderOptio
|
|
|
47
50
|
format: 'geojson'
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
|
-
}
|
|
53
|
+
} as const satisfies Loader<GeoJSON, TableBatch, GeoJSONLoaderOptions>;
|
|
51
54
|
|
|
52
|
-
export const GeoJSONLoader
|
|
55
|
+
export const GeoJSONLoader = {
|
|
53
56
|
...GeoJSONWorkerLoader,
|
|
54
57
|
// @ts-expect-error
|
|
55
58
|
parse,
|
|
56
59
|
// @ts-expect-error
|
|
57
60
|
parseTextSync,
|
|
58
61
|
parseInBatches
|
|
59
|
-
}
|
|
62
|
+
} as const satisfies LoaderWithParser<GeoJSON, TableBatch, GeoJSONLoaderOptions>;
|
|
60
63
|
|
|
61
64
|
async function parse(arrayBuffer: ArrayBuffer, options?: GeoJSONLoaderOptions) {
|
|
62
65
|
return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
|
package/src/geojson-writer.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type GeoJSONWriterOptions = WriterOptions & {
|
|
|
19
19
|
chunkSize?: number;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export const GeoJSONWriter
|
|
22
|
+
export const GeoJSONWriter = {
|
|
23
23
|
id: 'geojson',
|
|
24
24
|
version: 'latest',
|
|
25
25
|
module: 'geojson',
|
|
@@ -42,4 +42,4 @@ export const GeoJSONWriter: WriterWithEncoder<Table, TableBatch, GeoJSONWriterOp
|
|
|
42
42
|
|
|
43
43
|
encodeInBatches: (tableIterator: AsyncIterable<TableBatch> | Iterable<TableBatch>, options) =>
|
|
44
44
|
encodeTableAsGeojsonInBatches(tableIterator, options)
|
|
45
|
-
}
|
|
45
|
+
} as const satisfies WriterWithEncoder<Table, TableBatch, GeoJSONWriterOptions>;
|
package/src/json-loader.ts
CHANGED
|
@@ -34,11 +34,10 @@ export type JSONLoaderOptions = LoaderOptions & {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
export const JSONLoader
|
|
38
|
-
Table,
|
|
39
|
-
TableBatch | MetadataBatch | JSONBatch,
|
|
40
|
-
|
|
41
|
-
> = {
|
|
37
|
+
export const JSONLoader = {
|
|
38
|
+
dataType: null as unknown as Table,
|
|
39
|
+
batchType: null as unknown as TableBatch | MetadataBatch | JSONBatch,
|
|
40
|
+
|
|
42
41
|
name: 'JSON',
|
|
43
42
|
id: 'json',
|
|
44
43
|
module: 'json',
|
|
@@ -58,7 +57,11 @@ export const JSONLoader: LoaderWithParser<
|
|
|
58
57
|
parse,
|
|
59
58
|
parseTextSync,
|
|
60
59
|
parseInBatches
|
|
61
|
-
}
|
|
60
|
+
} as const satisfies LoaderWithParser<
|
|
61
|
+
Table,
|
|
62
|
+
TableBatch | MetadataBatch | JSONBatch,
|
|
63
|
+
JSONLoaderOptions
|
|
64
|
+
>;
|
|
62
65
|
|
|
63
66
|
async function parse(arrayBuffer: ArrayBuffer, options?: JSONLoaderOptions) {
|
|
64
67
|
return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
|
package/src/json-writer.ts
CHANGED
|
@@ -19,7 +19,7 @@ type RowArray = unknown[];
|
|
|
19
19
|
type RowObject = {[key: string]: unknown};
|
|
20
20
|
type TableJSON = RowArray[] | RowObject[];
|
|
21
21
|
|
|
22
|
-
export const JSONWriter
|
|
22
|
+
export const JSONWriter = {
|
|
23
23
|
id: 'json',
|
|
24
24
|
version: 'latest',
|
|
25
25
|
module: 'json',
|
|
@@ -31,4 +31,4 @@ export const JSONWriter: WriterWithEncoder<Table, TableBatch, JSONWriterOptions>
|
|
|
31
31
|
encode: async (table: Table, options: JSONWriterOptions) =>
|
|
32
32
|
new TextEncoder().encode(encodeTableAsJSON(table, options)).buffer,
|
|
33
33
|
encodeTextSync: (table: Table, options: JSONWriterOptions) => encodeTableAsJSON(table, options)
|
|
34
|
-
}
|
|
34
|
+
} as const satisfies WriterWithEncoder<Table, TableBatch, JSONWriterOptions>;
|
package/src/ndgeoson-loader.ts
CHANGED
|
@@ -18,11 +18,10 @@ export type NDGeoJSONLoaderOptions = LoaderOptions & {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
/** NDGeoJSONLoader */
|
|
21
|
-
export const NDJSONLoader
|
|
22
|
-
ArrayRowTable | ObjectRowTable,
|
|
23
|
-
Batch,
|
|
24
|
-
|
|
25
|
-
> = {
|
|
21
|
+
export const NDJSONLoader = {
|
|
22
|
+
dataType: null as unknown as ArrayRowTable | ObjectRowTable,
|
|
23
|
+
batchType: null as unknown as Batch,
|
|
24
|
+
|
|
26
25
|
name: 'NDJSON',
|
|
27
26
|
id: 'ndjson',
|
|
28
27
|
module: 'json',
|
|
@@ -48,4 +47,8 @@ export const NDJSONLoader: LoaderWithParser<
|
|
|
48
47
|
format: 'geojson'
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
|
-
}
|
|
50
|
+
} as const satisfies LoaderWithParser<
|
|
51
|
+
ArrayRowTable | ObjectRowTable,
|
|
52
|
+
Batch,
|
|
53
|
+
NDGeoJSONLoaderOptions
|
|
54
|
+
>;
|
package/src/ndjson-loader.ts
CHANGED
|
@@ -11,11 +11,10 @@ import {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-in-batches';
|
|
|
11
11
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
12
12
|
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
13
13
|
|
|
14
|
-
export const NDJSONLoader
|
|
15
|
-
|
|
16
|
-
TableBatch,
|
|
17
|
-
|
|
18
|
-
> = {
|
|
14
|
+
export const NDJSONLoader = {
|
|
15
|
+
dataType: null as unknown as ArrayRowTable | ObjectRowTable,
|
|
16
|
+
batchType: null as unknown as TableBatch,
|
|
17
|
+
|
|
19
18
|
name: 'NDJSON',
|
|
20
19
|
id: 'ndjson',
|
|
21
20
|
module: 'json',
|
|
@@ -32,4 +31,4 @@ export const NDJSONLoader: LoaderWithParser<
|
|
|
32
31
|
parseTextSync: parseNDJSONSync,
|
|
33
32
|
parseInBatches: parseNDJSONInBatches,
|
|
34
33
|
options: {}
|
|
35
|
-
}
|
|
34
|
+
} as const satisfies LoaderWithParser<ObjectRowTable | ArrayRowTable, TableBatch, LoaderOptions>;
|