@loaders.gl/json 3.4.13 → 3.4.15

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.
Files changed (33) hide show
  1. package/dist/es5/bundle.js +1 -1
  2. package/dist/es5/bundle.js.map +1 -1
  3. package/dist/es5/geojson-loader.js +34 -103
  4. package/dist/es5/geojson-loader.js.map +1 -1
  5. package/dist/es5/index.js +7 -7
  6. package/dist/es5/json-loader.js +22 -33
  7. package/dist/es5/json-loader.js.map +1 -1
  8. package/dist/es5/lib/clarinet/clarinet.js +295 -318
  9. package/dist/es5/lib/clarinet/clarinet.js.map +1 -1
  10. package/dist/es5/lib/jsonpath/jsonpath.js +44 -88
  11. package/dist/es5/lib/jsonpath/jsonpath.js.map +1 -1
  12. package/dist/es5/lib/parse-json-in-batches.js +74 -181
  13. package/dist/es5/lib/parse-json-in-batches.js.map +1 -1
  14. package/dist/es5/lib/parse-json.js +4 -7
  15. package/dist/es5/lib/parse-json.js.map +1 -1
  16. package/dist/es5/lib/parse-ndjson-in-batches.js +29 -103
  17. package/dist/es5/lib/parse-ndjson-in-batches.js.map +1 -1
  18. package/dist/es5/lib/parse-ndjson.js +2 -2
  19. package/dist/es5/lib/parse-ndjson.js.map +1 -1
  20. package/dist/es5/lib/parser/json-parser.js +84 -106
  21. package/dist/es5/lib/parser/json-parser.js.map +1 -1
  22. package/dist/es5/lib/parser/streaming-json-parser.js +52 -95
  23. package/dist/es5/lib/parser/streaming-json-parser.js.map +1 -1
  24. package/dist/es5/ndgeoson-loader.js +5 -23
  25. package/dist/es5/ndgeoson-loader.js.map +1 -1
  26. package/dist/es5/ndjson-loader.js +3 -21
  27. package/dist/es5/ndjson-loader.js.map +1 -1
  28. package/dist/esm/geojson-loader.js +1 -1
  29. package/dist/esm/json-loader.js +1 -1
  30. package/dist/esm/ndgeoson-loader.js +1 -1
  31. package/dist/esm/ndjson-loader.js +1 -1
  32. package/dist/geojson-worker.js +1 -1
  33. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var moduleExports = require('./index');
3
+ const moduleExports = require('./index');
4
4
  globalThis.loaders = globalThis.loaders || {};
5
5
  module.exports = Object.assign(globalThis.loaders, moduleExports);
6
6
  //# sourceMappingURL=bundle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,OAAO,GAAGD,UAAU,CAACC,OAAO,IAAI,CAAC,CAAC;AAC7CC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,OAAO,EAAEH,aAAa,CAAC"}
1
+ {"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":";;AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,OAAO,GAAGD,UAAU,CAACC,OAAO,IAAI,CAAC,CAAC;AAC7CC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,OAAO,EAAEH,aAAa,CAAC"}
@@ -5,20 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.GeoJSONWorkerLoader = exports.GeoJSONLoader = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var _awaitAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/awaitAsyncGenerator"));
12
- var _wrapAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapAsyncGenerator"));
13
8
  var _gis = require("@loaders.gl/gis");
14
9
  var _parseJson = _interopRequireDefault(require("./lib/parse-json"));
15
10
  var _parseJsonInBatches = _interopRequireDefault(require("./lib/parse-json-in-batches"));
16
- 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; }
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
- 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
- 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 "3.4.13" !== 'undefined' ? "3.4.13" : 'latest';
21
- var DEFAULT_GEOJSON_LOADER_OPTIONS = {
11
+ const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
12
+ const DEFAULT_GEOJSON_LOADER_OPTIONS = {
22
13
  geojson: {
23
14
  shape: 'object-row-table'
24
15
  },
@@ -29,7 +20,7 @@ var DEFAULT_GEOJSON_LOADER_OPTIONS = {
29
20
  format: 'geojson'
30
21
  }
31
22
  };
32
- var GeoJSONWorkerLoader = {
23
+ const GeoJSONWorkerLoader = {
33
24
  name: 'GeoJSON',
34
25
  id: 'geojson',
35
26
  module: 'geojson',
@@ -42,34 +33,27 @@ var GeoJSONWorkerLoader = {
42
33
  options: DEFAULT_GEOJSON_LOADER_OPTIONS
43
34
  };
44
35
  exports.GeoJSONWorkerLoader = GeoJSONWorkerLoader;
45
- var GeoJSONLoader = _objectSpread(_objectSpread({}, GeoJSONWorkerLoader), {}, {
46
- parse: parse,
47
- parseTextSync: parseTextSync,
48
- parseInBatches: parseInBatches
49
- });
36
+ const GeoJSONLoader = {
37
+ ...GeoJSONWorkerLoader,
38
+ parse,
39
+ parseTextSync,
40
+ parseInBatches
41
+ };
50
42
  exports.GeoJSONLoader = GeoJSONLoader;
51
- function parse(_x2, _x3) {
52
- return _parse.apply(this, arguments);
53
- }
54
- function _parse() {
55
- _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(arrayBuffer, options) {
56
- return _regenerator.default.wrap(function _callee2$(_context2) {
57
- while (1) switch (_context2.prev = _context2.next) {
58
- case 0:
59
- return _context2.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer), options));
60
- case 1:
61
- case "end":
62
- return _context2.stop();
63
- }
64
- }, _callee2);
65
- }));
66
- return _parse.apply(this, arguments);
43
+ async function parse(arrayBuffer, options) {
44
+ return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
67
45
  }
68
46
  function parseTextSync(text, options) {
69
- options = _objectSpread(_objectSpread({}, DEFAULT_GEOJSON_LOADER_OPTIONS), options);
70
- options.json = _objectSpread(_objectSpread({}, DEFAULT_GEOJSON_LOADER_OPTIONS.geojson), options.geojson);
47
+ options = {
48
+ ...DEFAULT_GEOJSON_LOADER_OPTIONS,
49
+ ...options
50
+ };
51
+ options.json = {
52
+ ...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson,
53
+ ...options.geojson
54
+ };
71
55
  options.gis = options.gis || {};
72
- var json = (0, _parseJson.default)(text, options);
56
+ const json = (0, _parseJson.default)(text, options);
73
57
  switch (options.gis.format) {
74
58
  case 'binary':
75
59
  return (0, _gis.geojsonToBinary)(json);
@@ -78,9 +62,15 @@ function parseTextSync(text, options) {
78
62
  }
79
63
  }
80
64
  function parseInBatches(asyncIterator, options) {
81
- options = _objectSpread(_objectSpread({}, DEFAULT_GEOJSON_LOADER_OPTIONS), options);
82
- options.json = _objectSpread(_objectSpread({}, DEFAULT_GEOJSON_LOADER_OPTIONS.geojson), options.geojson);
83
- var geojsonIterator = (0, _parseJsonInBatches.default)(asyncIterator, options);
65
+ options = {
66
+ ...DEFAULT_GEOJSON_LOADER_OPTIONS,
67
+ ...options
68
+ };
69
+ options.json = {
70
+ ...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson,
71
+ ...options.geojson
72
+ };
73
+ const geojsonIterator = (0, _parseJsonInBatches.default)(asyncIterator, options);
84
74
  switch (options.gis.format) {
85
75
  case 'binary':
86
76
  return makeBinaryGeometryIterator(geojsonIterator);
@@ -88,69 +78,10 @@ function parseInBatches(asyncIterator, options) {
88
78
  return geojsonIterator;
89
79
  }
90
80
  }
91
- function makeBinaryGeometryIterator(_x) {
92
- return _makeBinaryGeometryIterator.apply(this, arguments);
93
- }
94
- function _makeBinaryGeometryIterator() {
95
- _makeBinaryGeometryIterator = (0, _wrapAsyncGenerator2.default)(_regenerator.default.mark(function _callee(geojsonIterator) {
96
- var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, batch;
97
- return _regenerator.default.wrap(function _callee$(_context) {
98
- while (1) switch (_context.prev = _context.next) {
99
- case 0:
100
- _iteratorAbruptCompletion = false;
101
- _didIteratorError = false;
102
- _context.prev = 2;
103
- _iterator = _asyncIterator(geojsonIterator);
104
- case 4:
105
- _context.next = 6;
106
- return (0, _awaitAsyncGenerator2.default)(_iterator.next());
107
- case 6:
108
- if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
109
- _context.next = 14;
110
- break;
111
- }
112
- batch = _step.value;
113
- batch.data = (0, _gis.geojsonToBinary)(batch.data);
114
- _context.next = 11;
115
- return batch;
116
- case 11:
117
- _iteratorAbruptCompletion = false;
118
- _context.next = 4;
119
- break;
120
- case 14:
121
- _context.next = 20;
122
- break;
123
- case 16:
124
- _context.prev = 16;
125
- _context.t0 = _context["catch"](2);
126
- _didIteratorError = true;
127
- _iteratorError = _context.t0;
128
- case 20:
129
- _context.prev = 20;
130
- _context.prev = 21;
131
- if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
132
- _context.next = 25;
133
- break;
134
- }
135
- _context.next = 25;
136
- return (0, _awaitAsyncGenerator2.default)(_iterator.return());
137
- case 25:
138
- _context.prev = 25;
139
- if (!_didIteratorError) {
140
- _context.next = 28;
141
- break;
142
- }
143
- throw _iteratorError;
144
- case 28:
145
- return _context.finish(25);
146
- case 29:
147
- return _context.finish(20);
148
- case 30:
149
- case "end":
150
- return _context.stop();
151
- }
152
- }, _callee, null, [[2, 16, 20, 30], [21,, 25, 29]]);
153
- }));
154
- return _makeBinaryGeometryIterator.apply(this, arguments);
81
+ async function* makeBinaryGeometryIterator(geojsonIterator) {
82
+ for await (const batch of geojsonIterator) {
83
+ batch.data = (0, _gis.geojsonToBinary)(batch.data);
84
+ yield batch;
85
+ }
155
86
  }
156
87
  //# sourceMappingURL=geojson-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"geojson-loader.js","names":["_gis","require","_parseJson","_interopRequireDefault","_parseJsonInBatches","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","_asyncIterator","iterable","method","async","sync","retry","Symbol","asyncIterator","iterator","call","AsyncFromSyncIterator","TypeError","s","AsyncFromSyncIteratorContinuation","r","Promise","reject","done","resolve","value","then","n","next","prototype","return","_return","ret","throw","_throw","thr","VERSION","DEFAULT_GEOJSON_LOADER_OPTIONS","geojson","shape","json","jsonpaths","gis","format","GeoJSONWorkerLoader","name","id","module","version","worker","extensions","mimeTypes","category","text","options","exports","GeoJSONLoader","parse","parseTextSync","parseInBatches","_x2","_x3","_parse","_asyncToGenerator2","_regenerator","mark","_callee2","arrayBuffer","wrap","_callee2$","_context2","prev","abrupt","TextDecoder","decode","stop","parseJSONSync","geojsonToBinary","geojsonIterator","parseJSONInBatches","makeBinaryGeometryIterator","_x","_makeBinaryGeometryIterator","_wrapAsyncGenerator2","_callee","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_iterator","_step","batch","_callee$","_context","_awaitAsyncGenerator2","sent","data","t0","finish"],"sources":["../../src/geojson-loader.ts"],"sourcesContent":["import type {Loader, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {JSONLoaderOptions} from './json-loader';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport parseJSONSync from './lib/parse-json';\nimport parseJSONInBatches from './lib/parse-json-in-batches';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type GeoJSONLoaderOptions = JSONLoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format?: 'geojson' | 'binary';\n };\n};\n\nconst DEFAULT_GEOJSON_LOADER_OPTIONS = {\n geojson: {\n shape: 'object-row-table'\n },\n json: {\n jsonpaths: ['$', '$.features']\n },\n gis: {\n format: 'geojson'\n }\n};\n\n/**\n * GeoJSON loader\n */\nexport const GeoJSONWorkerLoader: Loader = {\n name: 'GeoJSON',\n id: 'geojson',\n module: 'geojson',\n version: VERSION,\n worker: true,\n extensions: ['geojson'],\n mimeTypes: ['application/geo+json'],\n category: 'geometry',\n text: true,\n options: DEFAULT_GEOJSON_LOADER_OPTIONS\n};\n\nexport const GeoJSONLoader: LoaderWithParser = {\n ...GeoJSONWorkerLoader,\n parse,\n parseTextSync,\n parseInBatches\n};\n\nasync function parse(arrayBuffer, options) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer), options);\n}\n\nfunction parseTextSync(text, options) {\n // Apps can call the parse method directly, we so apply default options here\n options = {...DEFAULT_GEOJSON_LOADER_OPTIONS, ...options};\n options.json = {...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson, ...options.geojson};\n options.gis = options.gis || {};\n const json = parseJSONSync(text, options);\n switch (options.gis.format) {\n case 'binary':\n return geojsonToBinary(json);\n default:\n return json;\n }\n}\n\nfunction parseInBatches(asyncIterator, options): AsyncIterable<any> {\n // Apps can call the parse method directly, we so apply default options here\n options = {...DEFAULT_GEOJSON_LOADER_OPTIONS, ...options};\n options.json = {...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson, ...options.geojson};\n\n const geojsonIterator = parseJSONInBatches(asyncIterator, options);\n\n switch (options.gis.format) {\n case 'binary':\n return makeBinaryGeometryIterator(geojsonIterator);\n default:\n return geojsonIterator;\n }\n}\n\nasync function* makeBinary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IAAA;UAAA;QAAA;UAAAgE,QAAA,CAAAhE,IAAA;UAAA;QAAA;UAAAgE,QAAA,CAAArB,IAAA;UAAAqB,QAAA,CAAAI,EAAA,GAAAJ,QAAA;UAAAN,iBAAA;UAAAC,cAAA,GAAAK,QAAA,CAAAI,EAAA;QAAA;UAAAJ,QAAA,CAAArB,IAAA;UAAAqB,QAAA,CAAArB,IAAA;UAAA,MAAAc,yBAAA,IAAAG,SAAA,CAAA1D,MAAA;YAAA8D,QAAA,CAAAhE,IAAA;YAAA;UAAA;UAAAgE,QAAA,CAAAhE,IAAA;UAAA,WAAAiE,qBAAA,CAAA3F,OAAA,EAAAsF,SAAA,CAAA1D,MAAA;QAAA;UAAA8D,QAAA,CAAArB,IAAA;UAAA,KAAAe,iBAAA;YAAAM,QAAA,CAAAhE,IAAA;YAAA;UAAA;UAAA,MAAA2D,cAAA;QAAA;UAAA,OAAAK,QAAA,CAAAK,MAAA;QAAA;UAAA,OAAAL,QAAA,CAAAK,MAAA;QAAA;QAAA;UAAA,OAAAL,QAAA,CAAAjB,IAAA;MAAA;IAAA,GAAAS,OAAA;EAAA,CAEd;EAAA,OAAAF,2BAAA,CAAA1F,KAAA,OAAAI,SAAA;AAAA"}
1
+ {"version":3,"file":"geojson-loader.js","names":["_gis","require","_parseJson","_interopRequireDefault","_parseJsonInBatches","VERSION","DEFAULT_GEOJSON_LOADER_OPTIONS","geojson","shape","json","jsonpaths","gis","format","GeoJSONWorkerLoader","name","id","module","version","worker","extensions","mimeTypes","category","text","options","exports","GeoJSONLoader","parse","parseTextSync","parseInBatches","arrayBuffer","TextDecoder","decode","parseJSONSync","geojsonToBinary","asyncIterator","geojsonIterator","parseJSONInBatches","makeBinaryGeometryIterator","batch","data"],"sources":["../../src/geojson-loader.ts"],"sourcesContent":["import type {Loader, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {JSONLoaderOptions} from './json-loader';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport parseJSONSync from './lib/parse-json';\nimport parseJSONInBatches from './lib/parse-json-in-batches';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type GeoJSONLoaderOptions = JSONLoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format?: 'geojson' | 'binary';\n };\n};\n\nconst DEFAULT_GEOJSON_LOADER_OPTIONS = {\n geojson: {\n shape: 'object-row-table'\n },\n json: {\n jsonpaths: ['$', '$.features']\n },\n gis: {\n format: 'geojson'\n }\n};\n\n/**\n * GeoJSON loader\n */\nexport const GeoJSONWorkerLoader: Loader = {\n name: 'GeoJSON',\n id: 'geojson',\n module: 'geojson',\n version: VERSION,\n worker: true,\n extensions: ['geojson'],\n mimeTypes: ['application/geo+json'],\n category: 'geometry',\n text: true,\n options: DEFAULT_GEOJSON_LOADER_OPTIONS\n};\n\nexport const GeoJSONLoader: LoaderWithParser = {\n ...GeoJSONWorkerLoader,\n parse,\n parseTextSync,\n parseInBatches\n};\n\nasync function parse(arrayBuffer, options) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer), options);\n}\n\nfunction parseTextSync(text, options) {\n // Apps can call the parse method directly, we so apply default options here\n options = {...DEFAULT_GEOJSON_LOADER_OPTIONS, ...options};\n options.json = {...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson, ...options.geojson};\n options.gis = options.gis || {};\n const json = parseJSONSync(text, options);\n switch (options.gis.format) {\n case 'binary':\n return geojsonToBinary(json);\n default:\n return json;\n }\n}\n\nfunction parseInBatches(asyncIterator, options): AsyncIterable<any> {\n // Apps can call the parse method directly, we so apply default options here\n options = {...DEFAULT_GEOJSON_LOADER_OPTIONS, ...options};\n options.json = {...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson, ...options.geojson};\n\n const geojsonIterator = parseJSONInBatches(asyncIterator, options);\n\n switch (options.gis.format) {\n case 'binary':\n return makeBinaryGeometryIterator(geojsonIterator);\n default:\n return geojsonIterator;\n }\n}\n\nasync function* makeBinaryGeometryIterator(geojsonIterator) {\n for await (const batch of geojsonIterator) {\n batch.data = geojsonToBinary(batch.data);\n yield batch;\n }\n}\n"],"mappings":";;;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAIA,MAAMI,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAW3E,MAAMC,8BAA8B,GAAG;EACrCC,OAAO,EAAE;IACPC,KAAK,EAAE;EACT,CAAC;EACDC,IAAI,EAAE;IACJC,SAAS,EAAE,CAAC,GAAG,EAAE,YAAY;EAC/B,CAAC;EACDC,GAAG,EAAE;IACHC,MAAM,EAAE;EACV;AACF,CAAC;AAKM,MAAMC,mBAA2B,GAAG;EACzCC,IAAI,EAAE,SAAS;EACfC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAE,SAAS;EACjBC,OAAO,EAAEZ,OAAO;EAChBa,MAAM,EAAE,IAAI;EACZC,UAAU,EAAE,CAAC,SAAS,CAAC;EACvBC,SAAS,EAAE,CAAC,sBAAsB,CAAC;EACnCC,QAAQ,EAAE,UAAU;EACpBC,IAAI,EAAE,IAAI;EACVC,OAAO,EAAEjB;AACX,CAAC;AAACkB,OAAA,CAAAX,mBAAA,GAAAA,mBAAA;AAEK,MAAMY,aAA+B,GAAG;EAC7C,GAAGZ,mBAAmB;EACtBa,KAAK;EACLC,aAAa;EACbC;AACF,CAAC;AAACJ,OAAA,CAAAC,aAAA,GAAAA,aAAA;AAEF,eAAeC,KAAKA,CAACG,WAAW,EAAEN,OAAO,EAAE;EACzC,OAAOI,aAAa,CAAC,IAAIG,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,EAAEN,OAAO,CAAC;AACtE;AAEA,SAASI,aAAaA,CAACL,IAAI,EAAEC,OAAO,EAAE;EAEpCA,OAAO,GAAG;IAAC,GAAGjB,8BAA8B;IAAE,GAAGiB;EAAO,CAAC;EACzDA,OAAO,CAACd,IAAI,GAAG;IAAC,GAAGH,8BAA8B,CAACC,OAAO;IAAE,GAAGgB,OAAO,CAAChB;EAAO,CAAC;EAC9EgB,OAAO,CAACZ,GAAG,GAAGY,OAAO,CAACZ,GAAG,IAAI,CAAC,CAAC;EAC/B,MAAMF,IAAI,GAAG,IAAAuB,kBAAa,EAACV,IAAI,EAAEC,OAAO,CAAC;EACzC,QAAQA,OAAO,CAACZ,GAAG,CAACC,MAAM;IACxB,KAAK,QAAQ;MACX,OAAO,IAAAqB,oBAAe,EAACxB,IAAI,CAAC;IAC9B;MACE,OAAOA,IAAI;EACf;AACF;AAEA,SAASmB,cAAcA,CAACM,aAAa,EAAEX,OAAO,EAAsB;EAElEA,OAAO,GAAG;IAAC,GAAGjB,8BAA8B;IAAE,GAAGiB;EAAO,CAAC;EACzDA,OAAO,CAACd,IAAI,GAAG;IAAC,GAAGH,8BAA8B,CAACC,OAAO;IAAE,GAAGgB,OAAO,CAAChB;EAAO,CAAC;EAE9E,MAAM4B,eAAe,GAAG,IAAAC,2BAAkB,EAACF,aAAa,EAAEX,OAAO,CAAC;EAElE,QAAQA,OAAO,CAACZ,GAAG,CAACC,MAAM;IACxB,KAAK,QAAQ;MACX,OAAOyB,0BAA0B,CAACF,eAAe,CAAC;IACpD;MACE,OAAOA,eAAe;EAC1B;AACF;AAEA,gBAAgBE,0BAA0BA,CAACF,eAAe,EAAE;EAC1D,WAAW,MAAMG,KAAK,IAAIH,eAAe,EAAE;IACzCG,KAAK,CAACC,IAAI,GAAG,IAAAN,oBAAe,EAACK,KAAK,CAACC,IAAI,CAAC;IACxC,MAAMD,KAAK;EACb;AACF"}
package/dist/es5/index.js CHANGED
@@ -6,43 +6,43 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  Object.defineProperty(exports, "JSONLoader", {
8
8
  enumerable: true,
9
- get: function get() {
9
+ get: function () {
10
10
  return _jsonLoader.JSONLoader;
11
11
  }
12
12
  });
13
13
  Object.defineProperty(exports, "NDJSONLoader", {
14
14
  enumerable: true,
15
- get: function get() {
15
+ get: function () {
16
16
  return _ndjsonLoader.NDJSONLoader;
17
17
  }
18
18
  });
19
19
  Object.defineProperty(exports, "_ClarinetParser", {
20
20
  enumerable: true,
21
- get: function get() {
21
+ get: function () {
22
22
  return _clarinet.default;
23
23
  }
24
24
  });
25
25
  Object.defineProperty(exports, "_GeoJSONLoader", {
26
26
  enumerable: true,
27
- get: function get() {
27
+ get: function () {
28
28
  return _geojsonLoader.GeoJSONLoader;
29
29
  }
30
30
  });
31
31
  Object.defineProperty(exports, "_GeoJSONWorkerLoader", {
32
32
  enumerable: true,
33
- get: function get() {
33
+ get: function () {
34
34
  return _geojsonLoader.GeoJSONWorkerLoader;
35
35
  }
36
36
  });
37
37
  Object.defineProperty(exports, "_JSONPath", {
38
38
  enumerable: true,
39
- get: function get() {
39
+ get: function () {
40
40
  return _jsonpath.default;
41
41
  }
42
42
  });
43
43
  Object.defineProperty(exports, "_rebuildJsonObject", {
44
44
  enumerable: true,
45
- get: function get() {
45
+ get: function () {
46
46
  return _parseJsonInBatches.rebuildJsonObject;
47
47
  }
48
48
  });
@@ -5,22 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.JSONLoader = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
8
  var _parseJson = _interopRequireDefault(require("./lib/parse-json"));
12
9
  var _parseJsonInBatches = _interopRequireDefault(require("./lib/parse-json-in-batches"));
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
- 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 "3.4.13" !== 'undefined' ? "3.4.13" : 'latest';
16
- var DEFAULT_JSON_LOADER_OPTIONS = {
10
+ const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
11
+ const DEFAULT_JSON_LOADER_OPTIONS = {
17
12
  json: {
18
13
  shape: 'row-table',
19
14
  table: false,
20
15
  jsonpaths: []
21
16
  }
22
17
  };
23
- var JSONLoader = {
18
+ const JSONLoader = {
24
19
  name: 'JSON',
25
20
  id: 'json',
26
21
  module: 'json',
@@ -29,39 +24,33 @@ var JSONLoader = {
29
24
  mimeTypes: ['application/json'],
30
25
  category: 'table',
31
26
  text: true,
32
- parse: parse,
33
- parseTextSync: parseTextSync,
34
- parseInBatches: parseInBatches,
27
+ parse,
28
+ parseTextSync,
29
+ parseInBatches,
35
30
  options: DEFAULT_JSON_LOADER_OPTIONS
36
31
  };
37
32
  exports.JSONLoader = JSONLoader;
38
- function parse(_x, _x2) {
39
- return _parse.apply(this, arguments);
40
- }
41
- function _parse() {
42
- _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, options) {
43
- return _regenerator.default.wrap(function _callee$(_context) {
44
- while (1) switch (_context.prev = _context.next) {
45
- case 0:
46
- return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer), options));
47
- case 1:
48
- case "end":
49
- return _context.stop();
50
- }
51
- }, _callee);
52
- }));
53
- return _parse.apply(this, arguments);
33
+ async function parse(arrayBuffer, options) {
34
+ return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
54
35
  }
55
36
  function parseTextSync(text, options) {
56
- var jsonOptions = _objectSpread(_objectSpread({}, options), {}, {
57
- json: _objectSpread(_objectSpread({}, DEFAULT_JSON_LOADER_OPTIONS.json), options === null || options === void 0 ? void 0 : options.json)
58
- });
37
+ const jsonOptions = {
38
+ ...options,
39
+ json: {
40
+ ...DEFAULT_JSON_LOADER_OPTIONS.json,
41
+ ...(options === null || options === void 0 ? void 0 : options.json)
42
+ }
43
+ };
59
44
  return (0, _parseJson.default)(text, jsonOptions);
60
45
  }
61
46
  function parseInBatches(asyncIterator, options) {
62
- var jsonOptions = _objectSpread(_objectSpread({}, options), {}, {
63
- json: _objectSpread(_objectSpread({}, DEFAULT_JSON_LOADER_OPTIONS.json), options === null || options === void 0 ? void 0 : options.json)
64
- });
47
+ const jsonOptions = {
48
+ ...options,
49
+ json: {
50
+ ...DEFAULT_JSON_LOADER_OPTIONS.json,
51
+ ...(options === null || options === void 0 ? void 0 : options.json)
52
+ }
53
+ };
65
54
  return (0, _parseJsonInBatches.default)(asyncIterator, jsonOptions);
66
55
  }
67
56
  //# sourceMappingURL=json-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"json-loader.js","names":["_parseJson","_interopRequireDefault","require","_parseJsonInBatches","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","VERSION","DEFAULT_JSON_LOADER_OPTIONS","json","shape","table","jsonpaths","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","parseTextSync","parseInBatches","options","exports","_x","_x2","_parse","_asyncToGenerator2","_regenerator","mark","_callee","arrayBuffer","wrap","_callee$","_context","prev","next","abrupt","TextDecoder","decode","stop","jsonOptions","parseJSONSync","asyncIterator","parseJSONInBatches"],"sources":["../../src/json-loader.ts"],"sourcesContent":["import type {Batch} from '@loaders.gl/schema';\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport parseJSONSync from './lib/parse-json';\nimport parseJSONInBatches from './lib/parse-json-in-batches';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * @param table -\n * @param jsonpaths -\n */\nexport type JSONLoaderOptions = LoaderOptions & {\n json?: {\n shape?: 'row-table';\n table?: false;\n jsonpaths?: string[];\n };\n};\n\nconst DEFAULT_JSON_LOADER_OPTIONS = {\n json: {\n shape: 'row-table',\n table: false,\n jsonpaths: []\n // batchSize: 'auto'\n }\n};\n\nexport const JSONLoader: LoaderWithParser = {\n name: 'JSON',\n id: 'json',\n module: 'json',\n version: VERSION,\n extensions: ['json', 'geojson'],\n mimeTypes: ['application/json'],\n category: 'table',\n text: true,\n parse,\n parseTextSync,\n parseInBatches,\n options: DEFAULT_JSON_LOADER_OPTIONS\n};\n\nasync function parse(arrayBuffer: ArrayBuffer, options?: JSONLoaderOptions) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer), options);\n}\n\nfunction parseTextSync(text: string, options?: JSONLoaderOptions) {\n const jsonOptions = {...options, json: {...DEFAULT_JSON_LOADER_OPTIONS.json, ...options?.json}};\n return parseJSONSync(text, jsonOptions as JSONLoaderOptions);\n}\n\nfunction parseInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: JSONLoaderOptions\n): AsyncIterable<Batch> {\n const jsonOptions = {...options, json: {...DEFAULT_JSON_LOADER_OPTIONS.json, ...options?.json}};\n return parseJSONInBatches(asyncIterator, jsonOptions as JSONLoaderOptions);\n}\n"],"mappings":";;;;;;;;;;AAEA,IAAAA,UAAA,GAAAC,sBAAA,C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f,aAAA,CAAAA,aAAA,KAAMc,2BAA2B,CAACC,IAAI,GAAKgB,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEhB,IAAI;EAAC,EAAC;EAC/F,OAAO,IAAAoC,kBAAa,EAACxB,IAAI,EAAEuB,WAAgC,CAAC;AAC9D;AAEA,SAASpB,cAAcA,CACrBsB,aAAiE,EACjErB,OAA2B,EACL;EACtB,IAAMmB,WAAW,GAAAlD,aAAA,CAAAA,aAAA,KAAO+B,OAAO;IAAEhB,IAAI,EAAAf,aAAA,CAAAA,aAAA,KAAMc,2BAA2B,CAACC,IAAI,GAAKgB,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEhB,IAAI;EAAC,EAAC;EAC/F,OAAO,IAAAsC,2BAAkB,EAACD,aAAa,EAAEF,WAAgC,CAAC;AAC5E"}
1
+ {"version":3,"file":"json-loader.js","names":["_parseJson","_interopRequireDefault","require","_parseJsonInBatches","VERSION","DEFAULT_JSON_LOADER_OPTIONS","json","shape","table","jsonpaths","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","parseTextSync","parseInBatches","options","exports","arrayBuffer","TextDecoder","decode","jsonOptions","parseJSONSync","asyncIterator","parseJSONInBatches"],"sources":["../../src/json-loader.ts"],"sourcesContent":["import type {Batch} from '@loaders.gl/schema';\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport parseJSONSync from './lib/parse-json';\nimport parseJSONInBatches from './lib/parse-json-in-batches';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * @param table -\n * @param jsonpaths -\n */\nexport type JSONLoaderOptions = LoaderOptions & {\n json?: {\n shape?: 'row-table';\n table?: false;\n jsonpaths?: string[];\n };\n};\n\nconst DEFAULT_JSON_LOADER_OPTIONS = {\n json: {\n shape: 'row-table',\n table: false,\n jsonpaths: []\n // batchSize: 'auto'\n }\n};\n\nexport const JSONLoader: LoaderWithParser = {\n name: 'JSON',\n id: 'json',\n module: 'json',\n version: VERSION,\n extensions: ['json', 'geojson'],\n mimeTypes: ['application/json'],\n category: 'table',\n text: true,\n parse,\n parseTextSync,\n parseInBatches,\n options: DEFAULT_JSON_LOADER_OPTIONS\n};\n\nasync function parse(arrayBuffer: ArrayBuffer, options?: JSONLoaderOptions) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer), options);\n}\n\nfunction parseTextSync(text: string, options?: JSONLoaderOptions) {\n const jsonOptions = {...options, json: {...DEFAULT_JSON_LOADER_OPTIONS.json, ...options?.json}};\n return parseJSONSync(text, jsonOptions as JSONLoaderOptions);\n}\n\nfunction parseInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: JSONLoaderOptions\n): AsyncIterable<Batch> {\n const jsonOptions = {...options, json: {...DEFAULT_JSON_LOADER_OPTIONS.json, ...options?.json}};\n return parseJSONInBatches(asyncIterator, jsonOptions as JSONLoaderOptions);\n}\n"],"mappings":";;;;;;;AAEA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAIA,MAAME,OAAO,GAAG,eAAkB,KAAK,WAAW,cAAiB,QAAQ;AAc3E,MAAMC,2BAA2B,GAAG;EAClCC,IAAI,EAAE;IACJC,KAAK,EAAE,WAAW;IAClBC,KAAK,EAAE,KAAK;IACZC,SAAS,EAAE;EAEb;AACF,CAAC;AAEM,MAAMC,UAA4B,GAAG;EAC1CC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,MAAM;EACVC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEV,OAAO;EAChBW,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;EAC/BC,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,QAAQ,EAAE,OAAO;EACjBC,IAAI,EAAE,IAAI;EAC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