@loaders.gl/json 4.2.0-alpha.6 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/json",
3
- "version": "4.2.0-alpha.6",
3
+ "version": "4.2.0-beta.1",
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-alpha.6",
48
- "@loaders.gl/loader-utils": "4.2.0-alpha.6",
49
- "@loaders.gl/schema": "4.2.0-alpha.6"
47
+ "@loaders.gl/gis": "4.2.0-beta.1",
48
+ "@loaders.gl/loader-utils": "4.2.0-beta.1",
49
+ "@loaders.gl/schema": "4.2.0-beta.1"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@loaders.gl/core": "^4.0.0"
53
53
  },
54
- "gitHead": "37bd8ca71763529f18727ee4bf29dd176aa914ca"
54
+ "gitHead": "c386a9196516fe3ff24847b40e6c77be039cf905"
55
55
  }
@@ -25,7 +25,10 @@ export type GeoJSONLoaderOptions = JSONLoaderOptions & {
25
25
  /**
26
26
  * GeoJSON loader
27
27
  */
28
- export const GeoJSONWorkerLoader: Loader<GeoJSON, TableBatch, GeoJSONLoaderOptions> = {
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: LoaderWithParser<GeoJSON, TableBatch, GeoJSONLoaderOptions> = {
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);
@@ -19,7 +19,7 @@ export type GeoJSONWriterOptions = WriterOptions & {
19
19
  chunkSize?: number;
20
20
  };
21
21
 
22
- export const GeoJSONWriter: WriterWithEncoder<Table, TableBatch, GeoJSONWriterOptions> = {
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>;
@@ -34,11 +34,10 @@ export type JSONLoaderOptions = LoaderOptions & {
34
34
  };
35
35
  };
36
36
 
37
- export const JSONLoader: LoaderWithParser<
38
- Table,
39
- TableBatch | MetadataBatch | JSONBatch,
40
- JSONLoaderOptions
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);
@@ -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: WriterWithEncoder<Table, TableBatch, JSONWriterOptions> = {
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>;
@@ -18,11 +18,10 @@ export type NDGeoJSONLoaderOptions = LoaderOptions & {
18
18
  };
19
19
 
20
20
  /** NDGeoJSONLoader */
21
- export const NDJSONLoader: LoaderWithParser<
22
- ArrayRowTable | ObjectRowTable,
23
- Batch,
24
- NDGeoJSONLoaderOptions
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
+ >;
@@ -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: LoaderWithParser<
15
- ObjectRowTable | ArrayRowTable,
16
- TableBatch,
17
- LoaderOptions
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>;