@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.
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/geojson-loader.js +34 -103
- package/dist/es5/geojson-loader.js.map +1 -1
- package/dist/es5/index.js +7 -7
- package/dist/es5/json-loader.js +22 -33
- package/dist/es5/json-loader.js.map +1 -1
- package/dist/es5/lib/clarinet/clarinet.js +295 -318
- package/dist/es5/lib/clarinet/clarinet.js.map +1 -1
- package/dist/es5/lib/jsonpath/jsonpath.js +44 -88
- package/dist/es5/lib/jsonpath/jsonpath.js.map +1 -1
- package/dist/es5/lib/parse-json-in-batches.js +74 -181
- package/dist/es5/lib/parse-json-in-batches.js.map +1 -1
- package/dist/es5/lib/parse-json.js +4 -7
- package/dist/es5/lib/parse-json.js.map +1 -1
- package/dist/es5/lib/parse-ndjson-in-batches.js +29 -103
- package/dist/es5/lib/parse-ndjson-in-batches.js.map +1 -1
- package/dist/es5/lib/parse-ndjson.js +2 -2
- package/dist/es5/lib/parse-ndjson.js.map +1 -1
- package/dist/es5/lib/parser/json-parser.js +84 -106
- package/dist/es5/lib/parser/json-parser.js.map +1 -1
- package/dist/es5/lib/parser/streaming-json-parser.js +52 -95
- package/dist/es5/lib/parser/streaming-json-parser.js.map +1 -1
- package/dist/es5/ndgeoson-loader.js +5 -23
- package/dist/es5/ndgeoson-loader.js.map +1 -1
- package/dist/es5/ndjson-loader.js +3 -21
- package/dist/es5/ndjson-loader.js.map +1 -1
- package/dist/esm/geojson-loader.js +1 -1
- package/dist/esm/json-loader.js +1 -1
- package/dist/esm/ndgeoson-loader.js +1 -1
- package/dist/esm/ndjson-loader.js +1 -1
- package/dist/geojson-worker.js +1 -1
- package/package.json +5 -5
package/dist/es5/bundle.js
CHANGED
package/dist/es5/bundle.js.map
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
const GeoJSONLoader = {
|
|
37
|
+
...GeoJSONWorkerLoader,
|
|
38
|
+
parse,
|
|
39
|
+
parseTextSync,
|
|
40
|
+
parseInBatches
|
|
41
|
+
};
|
|
50
42
|
exports.GeoJSONLoader = GeoJSONLoader;
|
|
51
|
-
function parse(
|
|
52
|
-
return
|
|
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 =
|
|
70
|
-
|
|
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
|
-
|
|
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 =
|
|
82
|
-
|
|
83
|
-
|
|
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(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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","
|
|
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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C,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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
45
|
+
get: function () {
|
|
46
46
|
return _parseJsonInBatches.rebuildJsonObject;
|
|
47
47
|
}
|
|
48
48
|
});
|
package/dist/es5/json-loader.js
CHANGED
|
@@ -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
|
-
|
|
14
|
-
|
|
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
|
-
|
|
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
|
|
33
|
-
parseTextSync
|
|
34
|
-
parseInBatches
|
|
27
|
+
parse,
|
|
28
|
+
parseTextSync,
|
|
29
|
+
parseInBatches,
|
|
35
30
|
options: DEFAULT_JSON_LOADER_OPTIONS
|
|
36
31
|
};
|
|
37
32
|
exports.JSONLoader = JSONLoader;
|
|
38
|
-
function parse(
|
|
39
|
-
return
|
|
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
|
-
|
|
57
|
-
|
|
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
|
-
|
|
63
|
-
|
|
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","
|
|
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;EACj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