@loaders.gl/json 4.0.0-alpha.23 → 4.0.0-alpha.24

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.min.js CHANGED
@@ -2588,7 +2588,7 @@ Char: ${this.c}`;
2588
2588
  numericProps: wrapProps(polygons.numericProps, 1)
2589
2589
  }
2590
2590
  };
2591
- if (polygons.triangles) {
2591
+ if (binaryFeatures.polygons && polygons.triangles) {
2592
2592
  binaryFeatures.polygons.triangles = { value: new Uint32Array(polygons.triangles), size: 1 };
2593
2593
  }
2594
2594
  return binaryFeatures;
@@ -17,7 +17,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
17
17
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18
18
  function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
19
19
  function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(value) { var ret = this.s.return; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, throw: function _throw(value) { var thr = this.s.return; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); }
20
- var VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
20
+ var VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
21
21
  var GeoJSONWorkerLoader = {
22
22
  name: 'GeoJSON',
23
23
  id: 'geojson',
@@ -12,7 +12,7 @@ var _parseJson = require("./lib/parsers/parse-json");
12
12
  var _parseJsonInBatches = require("./lib/parsers/parse-json-in-batches");
13
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
- var VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
15
+ var VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
16
16
  var DEFAULT_JSON_LOADER_OPTIONS = {
17
17
  json: {
18
18
  shape: 'object-row-table',
@@ -9,7 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _parseNdjson = require("./lib/parsers/parse-ndjson");
11
11
  var _parseNdjsonInBatches = require("./lib/parsers/parse-ndjson-in-batches");
12
- var VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
12
+ var VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
13
13
  var NDJSONLoader = {
14
14
  name: 'NDJSON',
15
15
  id: 'ndjson',
@@ -9,7 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _parseNdjson = require("./lib/parsers/parse-ndjson");
11
11
  var _parseNdjsonInBatches = require("./lib/parsers/parse-ndjson-in-batches");
12
- var VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
12
+ var VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
13
13
  var NDJSONLoader = {
14
14
  name: 'NDJSON',
15
15
  id: 'ndjson',
@@ -1,7 +1,7 @@
1
1
  import { geojsonToBinary } from '@loaders.gl/gis';
2
2
  import { parseJSONSync } from './lib/parsers/parse-json';
3
3
  import { parseJSONInBatches } from './lib/parsers/parse-json-in-batches';
4
- const VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
4
+ const VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
5
5
  export const GeoJSONWorkerLoader = {
6
6
  name: 'GeoJSON',
7
7
  id: 'geojson',
@@ -1,6 +1,6 @@
1
1
  import { parseJSONSync } from './lib/parsers/parse-json';
2
2
  import { parseJSONInBatches } from './lib/parsers/parse-json-in-batches';
3
- const VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
3
+ const VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
4
4
  const DEFAULT_JSON_LOADER_OPTIONS = {
5
5
  json: {
6
6
  shape: 'object-row-table',
@@ -1,6 +1,6 @@
1
1
  import { parseNDJSONSync } from './lib/parsers/parse-ndjson';
2
2
  import { parseNDJSONInBatches } from './lib/parsers/parse-ndjson-in-batches';
3
- const VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
3
+ const VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
4
4
  export const NDJSONLoader = {
5
5
  name: 'NDJSON',
6
6
  id: 'ndjson',
@@ -1,6 +1,6 @@
1
1
  import { parseNDJSONSync } from './lib/parsers/parse-ndjson';
2
2
  import { parseNDJSONInBatches } from './lib/parsers/parse-ndjson-in-batches';
3
- const VERSION = typeof "4.0.0-alpha.23" !== 'undefined' ? "4.0.0-alpha.23" : 'latest';
3
+ const VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
4
4
  export const NDJSONLoader = {
5
5
  name: 'NDJSON',
6
6
  id: 'ndjson',
@@ -909,7 +909,7 @@
909
909
  numericProps: wrapProps(polygons.numericProps, 1)
910
910
  }
911
911
  };
912
- if (polygons.triangles) {
912
+ if (binaryFeatures.polygons && polygons.triangles) {
913
913
  binaryFeatures.polygons.triangles = { value: new Uint32Array(polygons.triangles), size: 1 };
914
914
  }
915
915
  return binaryFeatures;
@@ -2432,7 +2432,7 @@ Char: ${this.c}`;
2432
2432
  }
2433
2433
 
2434
2434
  // src/geojson-loader.ts
2435
- var VERSION = true ? "4.0.0-alpha.23" : "latest";
2435
+ var VERSION = true ? "4.0.0-alpha.24" : "latest";
2436
2436
  var GeoJSONWorkerLoader = {
2437
2437
  name: "GeoJSON",
2438
2438
  id: "geojson",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/json",
3
- "version": "4.0.0-alpha.23",
3
+ "version": "4.0.0-alpha.24",
4
4
  "description": "Framework-independent loader for JSON and streaming JSON formats",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -35,9 +35,9 @@
35
35
  "build-worker": "esbuild src/workers/geojson-worker.ts --bundle --outfile=dist/geojson-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
36
36
  },
37
37
  "dependencies": {
38
- "@loaders.gl/gis": "4.0.0-alpha.23",
39
- "@loaders.gl/loader-utils": "4.0.0-alpha.23",
40
- "@loaders.gl/schema": "4.0.0-alpha.23"
38
+ "@loaders.gl/gis": "4.0.0-alpha.24",
39
+ "@loaders.gl/loader-utils": "4.0.0-alpha.24",
40
+ "@loaders.gl/schema": "4.0.0-alpha.24"
41
41
  },
42
- "gitHead": "e212f2a0c0e342f7cb65ce84fa2ff39f64b7d94b"
42
+ "gitHead": "97a8990595c132fb14e3445a8768d9f4cb98ff05"
43
43
  }
package/dist/bundle.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- // @ts-nocheck
3
- const moduleExports = require('./index');
4
- globalThis.loaders = globalThis.loaders || {};
5
- module.exports = Object.assign(globalThis.loaders, moduleExports);
@@ -1,79 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.GeoJSONLoader = exports.GeoJSONWorkerLoader = void 0;
5
- const gis_1 = require("@loaders.gl/gis");
6
- const parse_json_1 = require("./lib/parsers/parse-json");
7
- const parse_json_in_batches_1 = require("./lib/parsers/parse-json-in-batches");
8
- // __VERSION__ is injected by babel-plugin-version-inline
9
- // @ts-ignore TS2304: Cannot find name '__VERSION__'.
10
- const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
11
- /**
12
- * GeoJSON loader
13
- */
14
- exports.GeoJSONWorkerLoader = {
15
- name: 'GeoJSON',
16
- id: 'geojson',
17
- module: 'geojson',
18
- version: VERSION,
19
- worker: true,
20
- extensions: ['geojson'],
21
- mimeTypes: ['application/geo+json'],
22
- category: 'geometry',
23
- text: true,
24
- options: {
25
- geojson: {
26
- shape: 'object-row-table'
27
- },
28
- json: {
29
- shape: 'object-row-table',
30
- jsonpaths: ['$', '$.features']
31
- },
32
- gis: {
33
- format: 'geojson'
34
- }
35
- }
36
- };
37
- exports.GeoJSONLoader = {
38
- ...exports.GeoJSONWorkerLoader,
39
- // @ts-expect-error
40
- parse,
41
- // @ts-expect-error
42
- parseTextSync,
43
- parseInBatches
44
- };
45
- async function parse(arrayBuffer, options) {
46
- return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
47
- }
48
- function parseTextSync(text, options) {
49
- // Apps can call the parse method directly, we so apply default options here
50
- options = { ...exports.GeoJSONLoader.options, ...options };
51
- options.geojson = { ...exports.GeoJSONLoader.options.geojson, ...options.geojson };
52
- options.gis = options.gis || {};
53
- const table = (0, parse_json_1.parseJSONSync)(text, options);
54
- table.shape = 'geojson-row-table';
55
- switch (options.gis.format) {
56
- case 'binary':
57
- return (0, gis_1.geojsonToBinary)(table.data);
58
- default:
59
- return table;
60
- }
61
- }
62
- function parseInBatches(asyncIterator, options) {
63
- // Apps can call the parse method directly, we so apply default options here
64
- options = { ...exports.GeoJSONLoader.options, ...options };
65
- options.json = { ...exports.GeoJSONLoader.options.geojson, ...options.geojson };
66
- const geojsonIterator = (0, parse_json_in_batches_1.parseJSONInBatches)(asyncIterator, options);
67
- switch (options.gis.format) {
68
- case 'binary':
69
- return makeBinaryGeometryIterator(geojsonIterator);
70
- default:
71
- return geojsonIterator;
72
- }
73
- }
74
- async function* makeBinaryGeometryIterator(geojsonIterator) {
75
- for await (const batch of geojsonIterator) {
76
- batch.data = (0, gis_1.geojsonToBinary)(batch.data);
77
- yield batch;
78
- }
79
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- // Copyright Foursquare, Inc 20222
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.GeoJSONWriter = void 0;
6
- const geojson_encoder_1 = require("./lib/encoders/geojson-encoder");
7
- exports.GeoJSONWriter = {
8
- id: 'geojson',
9
- version: 'latest',
10
- module: 'geojson',
11
- name: 'GeoJSON',
12
- extensions: ['geojson'],
13
- mimeTypes: ['application/geo+json'],
14
- options: {
15
- geojson: {
16
- featureArray: false,
17
- geometryColumn: null
18
- }
19
- },
20
- text: true,
21
- encodeInBatches: (tableIterator, options) => (0, geojson_encoder_1.encodeTableAsGeojsonInBatches)(tableIterator, options)
22
- };
package/dist/index.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports._rebuildJsonObject = exports._ClarinetParser = exports._JSONPath = exports._GeoJSONWriter = exports._GeoJSONWorkerLoader = exports._GeoJSONLoader = exports.JSONWriter = exports.NDJSONLoader = exports.JSONLoader = void 0;
8
- var json_loader_1 = require("./json-loader");
9
- Object.defineProperty(exports, "JSONLoader", { enumerable: true, get: function () { return json_loader_1.JSONLoader; } });
10
- var ndjson_loader_1 = require("./ndjson-loader");
11
- Object.defineProperty(exports, "NDJSONLoader", { enumerable: true, get: function () { return ndjson_loader_1.NDJSONLoader; } });
12
- var json_writer_1 = require("./json-writer");
13
- Object.defineProperty(exports, "JSONWriter", { enumerable: true, get: function () { return json_writer_1.JSONWriter; } });
14
- var geojson_loader_1 = require("./geojson-loader");
15
- Object.defineProperty(exports, "_GeoJSONLoader", { enumerable: true, get: function () { return geojson_loader_1.GeoJSONLoader; } });
16
- Object.defineProperty(exports, "_GeoJSONWorkerLoader", { enumerable: true, get: function () { return geojson_loader_1.GeoJSONWorkerLoader; } });
17
- var geojson_writer_1 = require("./geojson-writer");
18
- Object.defineProperty(exports, "_GeoJSONWriter", { enumerable: true, get: function () { return geojson_writer_1.GeoJSONWriter; } });
19
- var jsonpath_1 = require("./lib/jsonpath/jsonpath");
20
- Object.defineProperty(exports, "_JSONPath", { enumerable: true, get: function () { return __importDefault(jsonpath_1).default; } });
21
- var clarinet_1 = require("./lib/clarinet/clarinet");
22
- Object.defineProperty(exports, "_ClarinetParser", { enumerable: true, get: function () { return __importDefault(clarinet_1).default; } });
23
- var parse_json_in_batches_1 = require("./lib/parsers/parse-json-in-batches");
24
- Object.defineProperty(exports, "_rebuildJsonObject", { enumerable: true, get: function () { return parse_json_in_batches_1.rebuildJsonObject; } });
@@ -1,42 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.JSONLoader = void 0;
5
- const parse_json_1 = require("./lib/parsers/parse-json");
6
- const parse_json_in_batches_1 = require("./lib/parsers/parse-json-in-batches");
7
- // __VERSION__ is injected by babel-plugin-version-inline
8
- // @ts-ignore TS2304: Cannot find name '__VERSION__'.
9
- const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
10
- const DEFAULT_JSON_LOADER_OPTIONS = {
11
- json: {
12
- shape: 'object-row-table',
13
- table: false,
14
- jsonpaths: []
15
- // batchSize: 'auto'
16
- }
17
- };
18
- exports.JSONLoader = {
19
- name: 'JSON',
20
- id: 'json',
21
- module: 'json',
22
- version: VERSION,
23
- extensions: ['json', 'geojson'],
24
- mimeTypes: ['application/json'],
25
- category: 'table',
26
- text: true,
27
- parse,
28
- parseTextSync,
29
- parseInBatches,
30
- options: DEFAULT_JSON_LOADER_OPTIONS
31
- };
32
- async function parse(arrayBuffer, options) {
33
- return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
34
- }
35
- function parseTextSync(text, options) {
36
- const jsonOptions = { ...options, json: { ...DEFAULT_JSON_LOADER_OPTIONS.json, ...options?.json } };
37
- return (0, parse_json_1.parseJSONSync)(text, jsonOptions);
38
- }
39
- function parseInBatches(asyncIterator, options) {
40
- const jsonOptions = { ...options, json: { ...DEFAULT_JSON_LOADER_OPTIONS.json, ...options?.json } };
41
- return (0, parse_json_in_batches_1.parseJSONInBatches)(asyncIterator, jsonOptions);
42
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- // loaders.gl, MIT license
3
- // Copyright 2022 Foursquare Labs, Inc.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.JSONWriter = void 0;
6
- const json_encoder_1 = require("./lib/encoders/json-encoder");
7
- exports.JSONWriter = {
8
- id: 'json',
9
- version: 'latest',
10
- module: 'json',
11
- name: 'JSON',
12
- extensions: ['json'],
13
- mimeTypes: ['application/json'],
14
- options: {},
15
- text: true,
16
- encode: async (table, options) => new TextEncoder().encode((0, json_encoder_1.encodeTableAsJSON)(table, options)).buffer,
17
- encodeText: (table, options) => (0, json_encoder_1.encodeTableAsJSON)(table, options)
18
- };