@loaders.gl/json 4.0.0-alpha.1 → 4.0.0-alpha.11

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 (188) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +2 -2
  4. package/dist/dist.min.js +3094 -0
  5. package/dist/es5/bundle.js +6 -0
  6. package/dist/es5/bundle.js.map +1 -0
  7. package/dist/es5/geojson-loader.js +157 -0
  8. package/dist/es5/geojson-loader.js.map +1 -0
  9. package/dist/es5/geojson-writer.js +27 -0
  10. package/dist/es5/geojson-writer.js.map +1 -0
  11. package/dist/es5/index.js +69 -0
  12. package/dist/es5/index.js.map +1 -0
  13. package/dist/es5/json-loader.js +67 -0
  14. package/dist/es5/json-loader.js.map +1 -0
  15. package/dist/es5/json-writer.js +42 -0
  16. package/dist/es5/json-writer.js.map +1 -0
  17. package/dist/es5/lib/clarinet/clarinet.js +446 -0
  18. package/dist/es5/lib/clarinet/clarinet.js.map +1 -0
  19. package/dist/es5/lib/encoders/encode-utils.js +42 -0
  20. package/dist/es5/lib/encoders/encode-utils.js.map +1 -0
  21. package/dist/es5/lib/encoders/geojson-encoder.js +178 -0
  22. package/dist/es5/lib/encoders/geojson-encoder.js.map +1 -0
  23. package/dist/es5/lib/encoders/json-encoder.js +30 -0
  24. package/dist/es5/lib/encoders/json-encoder.js.map +1 -0
  25. package/dist/es5/lib/encoders/utf8-encoder.js +54 -0
  26. package/dist/es5/lib/encoders/utf8-encoder.js.map +1 -0
  27. package/dist/es5/lib/json-parser/json-parser.js +140 -0
  28. package/dist/es5/lib/json-parser/json-parser.js.map +1 -0
  29. package/dist/es5/lib/json-parser/streaming-json-parser.js +123 -0
  30. package/dist/es5/lib/json-parser/streaming-json-parser.js.map +1 -0
  31. package/dist/es5/lib/jsonpath/jsonpath.js +119 -0
  32. package/dist/es5/lib/jsonpath/jsonpath.js.map +1 -0
  33. package/dist/es5/lib/parsers/parse-json-in-batches.js +206 -0
  34. package/dist/es5/lib/parsers/parse-json-in-batches.js.map +1 -0
  35. package/dist/es5/lib/parsers/parse-json.js +38 -0
  36. package/dist/es5/lib/parsers/parse-json.js.map +1 -0
  37. package/dist/es5/lib/parsers/parse-ndjson-in-batches.js +114 -0
  38. package/dist/es5/lib/parsers/parse-ndjson-in-batches.js.map +1 -0
  39. package/dist/es5/lib/parsers/parse-ndjson.js +19 -0
  40. package/dist/es5/lib/parsers/parse-ndjson.js.map +1 -0
  41. package/dist/es5/ndgeoson-loader.js +54 -0
  42. package/dist/es5/ndgeoson-loader.js.map +1 -0
  43. package/dist/es5/ndjson-loader.js +44 -0
  44. package/dist/es5/ndjson-loader.js.map +1 -0
  45. package/dist/es5/workers/geojson-worker.js +6 -0
  46. package/dist/es5/workers/geojson-worker.js.map +1 -0
  47. package/dist/esm/bundle.js +4 -0
  48. package/dist/esm/bundle.js.map +1 -0
  49. package/dist/esm/geojson-loader.js +79 -0
  50. package/dist/esm/geojson-loader.js.map +1 -0
  51. package/dist/esm/geojson-writer.js +18 -0
  52. package/dist/esm/geojson-writer.js.map +1 -0
  53. package/dist/esm/index.js +9 -0
  54. package/dist/esm/index.js.map +1 -0
  55. package/dist/esm/json-loader.js +48 -0
  56. package/dist/esm/json-loader.js.map +1 -0
  57. package/dist/esm/json-writer.js +14 -0
  58. package/dist/esm/json-writer.js.map +1 -0
  59. package/dist/esm/lib/clarinet/LICENSE +28 -0
  60. package/dist/esm/lib/clarinet/clarinet.js +415 -0
  61. package/dist/esm/lib/clarinet/clarinet.js.map +1 -0
  62. package/dist/esm/lib/encoders/encode-utils.js +31 -0
  63. package/dist/esm/lib/encoders/encode-utils.js.map +1 -0
  64. package/dist/esm/lib/encoders/geojson-encoder.js +98 -0
  65. package/dist/esm/lib/encoders/geojson-encoder.js.map +1 -0
  66. package/dist/esm/lib/encoders/json-encoder.js +12 -0
  67. package/dist/esm/lib/encoders/json-encoder.js.map +1 -0
  68. package/dist/esm/lib/encoders/utf8-encoder.js +32 -0
  69. package/dist/esm/lib/encoders/utf8-encoder.js.map +1 -0
  70. package/dist/{lib/parser → esm/lib/json-parser}/json-parser.js +4 -22
  71. package/dist/esm/lib/json-parser/json-parser.js.map +1 -0
  72. package/dist/{lib/parser → esm/lib/json-parser}/streaming-json-parser.js +2 -23
  73. package/dist/esm/lib/json-parser/streaming-json-parser.js.map +1 -0
  74. package/dist/esm/lib/jsonpath/jsonpath.js +67 -0
  75. package/dist/esm/lib/jsonpath/jsonpath.js.map +1 -0
  76. package/dist/{lib → esm/lib/parsers}/parse-json-in-batches.js +19 -15
  77. package/dist/esm/lib/parsers/parse-json-in-batches.js.map +1 -0
  78. package/dist/{lib → esm/lib/parsers}/parse-json.js +4 -9
  79. package/dist/esm/lib/parsers/parse-json.js.map +1 -0
  80. package/dist/{lib → esm/lib/parsers}/parse-ndjson-in-batches.js +3 -6
  81. package/dist/esm/lib/parsers/parse-ndjson-in-batches.js.map +1 -0
  82. package/dist/esm/lib/parsers/parse-ndjson.js +13 -0
  83. package/dist/esm/lib/parsers/parse-ndjson.js.map +1 -0
  84. package/dist/esm/ndgeoson-loader.js +27 -0
  85. package/dist/esm/ndgeoson-loader.js.map +1 -0
  86. package/dist/esm/ndjson-loader.js +18 -0
  87. package/dist/esm/ndjson-loader.js.map +1 -0
  88. package/dist/esm/workers/geojson-worker.js +4 -0
  89. package/dist/esm/workers/geojson-worker.js.map +1 -0
  90. package/dist/geojson-loader.d.ts +16 -0
  91. package/dist/geojson-loader.d.ts.map +1 -0
  92. package/dist/geojson-loader.js +65 -69
  93. package/dist/geojson-worker.js +1016 -232
  94. package/dist/geojson-writer.d.ts +6 -0
  95. package/dist/geojson-writer.d.ts.map +1 -0
  96. package/dist/geojson-writer.js +22 -0
  97. package/dist/index.d.ts +13 -0
  98. package/dist/index.d.ts.map +1 -0
  99. package/dist/index.js +24 -6
  100. package/dist/json-loader.d.ts +17 -0
  101. package/dist/json-loader.d.ts.map +1 -0
  102. package/dist/json-loader.js +33 -38
  103. package/dist/json-writer.d.ts +6 -0
  104. package/dist/json-writer.d.ts.map +1 -0
  105. package/dist/json-writer.js +18 -0
  106. package/dist/lib/clarinet/clarinet.d.ts +74 -0
  107. package/dist/lib/clarinet/clarinet.d.ts.map +1 -0
  108. package/dist/lib/clarinet/clarinet.js +510 -493
  109. package/dist/lib/encoders/encode-utils.d.ts +19 -0
  110. package/dist/lib/encoders/encode-utils.d.ts.map +1 -0
  111. package/dist/lib/encoders/encode-utils.js +47 -0
  112. package/dist/lib/encoders/geojson-encoder.d.ts +14 -0
  113. package/dist/lib/encoders/geojson-encoder.d.ts.map +1 -0
  114. package/dist/lib/encoders/geojson-encoder.js +104 -0
  115. package/dist/lib/encoders/json-encoder.d.ts +16 -0
  116. package/dist/lib/encoders/json-encoder.d.ts.map +1 -0
  117. package/dist/lib/encoders/json-encoder.js +22 -0
  118. package/dist/lib/encoders/utf8-encoder.d.ts +12 -0
  119. package/dist/lib/encoders/utf8-encoder.d.ts.map +1 -0
  120. package/dist/lib/encoders/utf8-encoder.js +32 -0
  121. package/dist/lib/json-parser/json-parser.d.ts +22 -0
  122. package/dist/lib/json-parser/json-parser.d.ts.map +1 -0
  123. package/dist/lib/json-parser/json-parser.js +98 -0
  124. package/dist/lib/json-parser/streaming-json-parser.d.ts +37 -0
  125. package/dist/lib/json-parser/streaming-json-parser.d.ts.map +1 -0
  126. package/dist/lib/json-parser/streaming-json-parser.js +100 -0
  127. package/dist/lib/jsonpath/jsonpath.d.ts +32 -0
  128. package/dist/lib/jsonpath/jsonpath.d.ts.map +1 -0
  129. package/dist/lib/jsonpath/jsonpath.js +81 -78
  130. package/dist/lib/parsers/parse-json-in-batches.d.ts +5 -0
  131. package/dist/lib/parsers/parse-json-in-batches.d.ts.map +1 -0
  132. package/dist/lib/parsers/parse-json-in-batches.js +100 -0
  133. package/dist/lib/parsers/parse-json.d.ts +4 -0
  134. package/dist/lib/parsers/parse-json.d.ts.map +1 -0
  135. package/dist/lib/parsers/parse-json.js +32 -0
  136. package/dist/lib/parsers/parse-ndjson-in-batches.d.ts +4 -0
  137. package/dist/lib/parsers/parse-ndjson-in-batches.d.ts.map +1 -0
  138. package/dist/lib/parsers/parse-ndjson-in-batches.js +36 -0
  139. package/dist/lib/parsers/parse-ndjson.d.ts +3 -0
  140. package/dist/lib/parsers/parse-ndjson.d.ts.map +1 -0
  141. package/dist/lib/parsers/parse-ndjson.js +17 -0
  142. package/dist/ndgeoson-loader.d.ts +34 -0
  143. package/dist/ndgeoson-loader.d.ts.map +1 -0
  144. package/dist/ndgeoson-loader.js +37 -0
  145. package/dist/ndjson-loader.d.ts +4 -0
  146. package/dist/ndjson-loader.d.ts.map +1 -0
  147. package/dist/ndjson-loader.js +26 -31
  148. package/dist/workers/geojson-worker.d.ts +2 -0
  149. package/dist/workers/geojson-worker.d.ts.map +1 -0
  150. package/dist/workers/geojson-worker.js +5 -4
  151. package/package.json +10 -10
  152. package/src/geojson-loader.ts +10 -6
  153. package/src/geojson-writer.ts +27 -0
  154. package/src/index.ts +10 -0
  155. package/src/json-loader.ts +15 -24
  156. package/src/json-writer.ts +24 -0
  157. package/src/lib/encoders/encode-utils.ts +54 -0
  158. package/src/lib/encoders/geojson-encoder.ts +139 -0
  159. package/src/lib/encoders/json-encoder.ts +30 -0
  160. package/src/lib/encoders/utf8-encoder.ts +35 -0
  161. package/src/lib/{parse-json-in-batches.ts → parsers/parse-json-in-batches.ts} +30 -8
  162. package/src/lib/{parse-json.ts → parsers/parse-json.ts} +7 -3
  163. package/src/lib/{parse-ndjson-in-batches.ts → parsers/parse-ndjson-in-batches.ts} +1 -1
  164. package/src/lib/parsers/parse-ndjson.ts +15 -0
  165. package/src/ndgeoson-loader.ts +48 -0
  166. package/src/ndjson-loader.ts +20 -27
  167. package/dist/bundle.js.map +0 -1
  168. package/dist/geojson-loader.js.map +0 -1
  169. package/dist/index.js.map +0 -1
  170. package/dist/json-loader.js.map +0 -1
  171. package/dist/jsonl-loader.js +0 -2
  172. package/dist/jsonl-loader.js.map +0 -1
  173. package/dist/lib/clarinet/clarinet.js.map +0 -1
  174. package/dist/lib/jsonpath/jsonpath.js.map +0 -1
  175. package/dist/lib/parse-json-in-batches.js.map +0 -1
  176. package/dist/lib/parse-json.js.map +0 -1
  177. package/dist/lib/parse-ndjson-in-batches.js.map +0 -1
  178. package/dist/lib/parse-ndjson.js +0 -11
  179. package/dist/lib/parse-ndjson.js.map +0 -1
  180. package/dist/lib/parser/json-parser.js.map +0 -1
  181. package/dist/lib/parser/streaming-json-parser.js.map +0 -1
  182. package/dist/ndjson-loader.js.map +0 -1
  183. package/dist/workers/geojson-worker.js.map +0 -1
  184. package/src/jsonl-loader.ts +0 -53
  185. package/src/lib/parse-ndjson.ts +0 -10
  186. /package/dist/{lib → es5/lib}/clarinet/LICENSE +0 -0
  187. /package/src/lib/{parser → json-parser}/json-parser.ts +0 -0
  188. /package/src/lib/{parser → json-parser}/streaming-json-parser.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ndgeoson-loader.js","names":["_parseNdjson","require","_parseNdjsonInBatches","VERSION","DEFAULT_NDGEOJSON_LOADER_OPTIONS","geojson","shape","gis","format","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","wrap","_callee$","_context","prev","next","abrupt","parseNDJSONSync","TextDecoder","decode","stop","_x","apply","arguments","parseTextSync","parseInBatches","parseNDJSONInBatches","options","exports","_typecheckNDJSONLoader"],"sources":["../../src/ndgeoson-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {parseNDJSONSync} from './lib/parsers/parse-ndjson';\nimport {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-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 NDGeoJSONLoaderOptions = LoaderOptions & {\n geojson?: {\n shape?: 'object-row-table';\n };\n gis?: {\n format: 'geojson';\n };\n};\n\nconst DEFAULT_NDGEOJSON_LOADER_OPTIONS = {\n geojson: {\n shape: 'object-row-table'\n },\n gis: {\n format: 'geojson'\n }\n};\n\nexport const NDJSONLoader = {\n name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson', 'ndgeojson'],\n mimeTypes: [\n 'application/geo+x-ndjson',\n 'application/geo+x-ldjson',\n 'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch\n 'application/geo+json-seq',\n 'application/x-ndjson'\n ],\n category: 'table',\n text: true,\n parse: async (arrayBuffer: ArrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),\n parseTextSync: parseNDJSONSync,\n parseInBatches: parseNDJSONInBatches,\n options: DEFAULT_NDGEOJSON_LOADER_OPTIONS\n};\n\nexport const _typecheckNDJSONLoader: LoaderWithParser = NDJSONLoader;\n"],"mappings":";;;;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAIA,IAAME,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAW3E,IAAMC,gCAAgC,GAAG;EACvCC,OAAO,EAAE;IACPC,KAAK,EAAE;EACT,CAAC;EACDC,GAAG,EAAE;IACHC,MAAM,EAAE;EACV;AACF,CAAC;AAEM,IAAMC,YAAY,GAAG;EAC1BC,IAAI,EAAE,QAAQ;EACdC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEV,OAAO;EAChBW,UAAU,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC;EACnCC,SAAS,EAAE,CACT,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,CACvB;EACDC,QAAQ,EAAE,OAAO;EACjBC,IAAI,EAAE,IAAI;EACVC,KAAK;IAAA,IAAAC,MAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAE,SAAAC,QAAOC,WAAwB;MAAA,OAAAH,YAAA,CAAAD,OAAA,CAAAK,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,OAAAF,QAAA,CAAAG,MAAA,WAAK,IAAAC,4BAAe,EAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACT,WAAW,CAAC,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAO,IAAA;QAAA;MAAA,GAAAX,OAAA;IAAA;IAAA,SAAAN,MAAAkB,EAAA;MAAA,OAAAjB,MAAA,CAAAkB,KAAA,OAAAC,SAAA;IAAA;IAAA,OAAApB,KAAA;EAAA;EACjGqB,aAAa,EAAEP,4BAAe;EAC9BQ,cAAc,EAAEC,0CAAoB;EACpCC,OAAO,EAAEtC;AACX,CAAC;AAACuC,OAAA,CAAAlC,YAAA,GAAAA,YAAA;AAEK,IAAMmC,sBAAwC,GAAGnC,YAAY;AAACkC,OAAA,CAAAC,sBAAA,GAAAA,sBAAA"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.NDJSONLoader = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
+ var _parseNdjson = require("./lib/parsers/parse-ndjson");
11
+ var _parseNdjsonInBatches = require("./lib/parsers/parse-ndjson-in-batches");
12
+ var VERSION = typeof "4.0.0-alpha.11" !== 'undefined' ? "4.0.0-alpha.11" : 'latest';
13
+ var NDJSONLoader = {
14
+ name: 'NDJSON',
15
+ id: 'ndjson',
16
+ module: 'json',
17
+ version: VERSION,
18
+ extensions: ['ndjson', 'jsonl'],
19
+ mimeTypes: ['application/x-ndjson', 'application/jsonlines', 'application/json-seq'],
20
+ category: 'table',
21
+ text: true,
22
+ parse: function () {
23
+ var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer) {
24
+ return _regenerator.default.wrap(function _callee$(_context) {
25
+ while (1) switch (_context.prev = _context.next) {
26
+ case 0:
27
+ return _context.abrupt("return", (0, _parseNdjson.parseNDJSONSync)(new TextDecoder().decode(arrayBuffer)));
28
+ case 1:
29
+ case "end":
30
+ return _context.stop();
31
+ }
32
+ }, _callee);
33
+ }));
34
+ function parse(_x) {
35
+ return _parse.apply(this, arguments);
36
+ }
37
+ return parse;
38
+ }(),
39
+ parseTextSync: _parseNdjson.parseNDJSONSync,
40
+ parseInBatches: _parseNdjsonInBatches.parseNDJSONInBatches,
41
+ options: {}
42
+ };
43
+ exports.NDJSONLoader = NDJSONLoader;
44
+ //# sourceMappingURL=ndjson-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ndjson-loader.js","names":["_parseNdjson","require","_parseNdjsonInBatches","VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","_parse","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","wrap","_callee$","_context","prev","next","abrupt","parseNDJSONSync","TextDecoder","decode","stop","_x","apply","arguments","parseTextSync","parseInBatches","parseNDJSONInBatches","options","exports"],"sources":["../../src/ndjson-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {ObjectRowTable, ArrayRowTable, TableBatch} from '@loaders.gl/schema';\nimport {parseNDJSONSync} from './lib/parsers/parse-ndjson';\nimport {parseNDJSONInBatches} from './lib/parsers/parse-ndjson-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 const NDJSONLoader: LoaderWithParser<\n ObjectRowTable | ArrayRowTable,\n TableBatch,\n LoaderOptions\n> = {\n name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson', 'jsonl'],\n mimeTypes: [\n 'application/x-ndjson',\n 'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch\n 'application/json-seq'\n ],\n category: 'table',\n text: true,\n parse: async (arrayBuffer: ArrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),\n parseTextSync: parseNDJSONSync,\n parseInBatches: parseNDJSONInBatches,\n options: {}\n};\n"],"mappings":";;;;;;;;;AAIA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAIA,IAAME,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAEpE,IAAMC,YAIZ,GAAG;EACFC,IAAI,EAAE,QAAQ;EACdC,EAAE,EAAE,QAAQ;EACZC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAEL,OAAO;EAChBM,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;EAC/BC,SAAS,EAAE,CACT,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,CACvB;EACDC,QAAQ,EAAE,OAAO;EACjBC,IAAI,EAAE,IAAI;EACVC,KAAK;IAAA,IAAAC,MAAA,OAAAC,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAE,SAAAC,QAAOC,WAAwB;MAAA,OAAAH,YAAA,CAAAD,OAAA,CAAAK,IAAA,UAAAC,SAAAC,QAAA;QAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;UAAA;YAAA,OAAAF,QAAA,CAAAG,MAAA,WAAK,IAAAC,4BAAe,EAAC,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CAACT,WAAW,CAAC,CAAC;UAAA;UAAA;YAAA,OAAAG,QAAA,CAAAO,IAAA;QAAA;MAAA,GAAAX,OAAA;IAAA;IAAA,SAAAN,MAAAkB,EAAA;MAAA,OAAAjB,MAAA,CAAAkB,KAAA,OAAAC,SAAA;IAAA;IAAA,OAAApB,KAAA;EAAA;EACjGqB,aAAa,EAAEP,4BAAe;EAC9BQ,cAAc,EAAEC,0CAAoB;EACpCC,OAAO,EAAE,CAAC;AACZ,CAAC;AAACC,OAAA,CAAAlC,YAAA,GAAAA,YAAA"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ var _loaderUtils = require("@loaders.gl/loader-utils");
4
+ var _geojsonLoader = require("../geojson-loader");
5
+ (0, _loaderUtils.createLoaderWorker)(_geojsonLoader.GeoJSONLoader);
6
+ //# sourceMappingURL=geojson-worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geojson-worker.js","names":["_loaderUtils","require","_geojsonLoader","createLoaderWorker","GeoJSONLoader"],"sources":["../../../src/workers/geojson-worker.ts"],"sourcesContent":["import {createLoaderWorker} from '@loaders.gl/loader-utils';\nimport {GeoJSONLoader} from '../geojson-loader';\n\ncreateLoaderWorker(GeoJSONLoader);\n"],"mappings":";;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,+BAAkB,EAACC,4BAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ const moduleExports = require('./index');
2
+ globalThis.loaders = globalThis.loaders || {};
3
+ module.exports = Object.assign(globalThis.loaders, moduleExports);
4
+ //# sourceMappingURL=bundle.js.map
@@ -0,0 +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,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"}
@@ -0,0 +1,79 @@
1
+ import { geojsonToBinary } from '@loaders.gl/gis';
2
+ import { parseJSONSync } from './lib/parsers/parse-json';
3
+ import { parseJSONInBatches } from './lib/parsers/parse-json-in-batches';
4
+ const VERSION = typeof "4.0.0-alpha.11" !== 'undefined' ? "4.0.0-alpha.11" : 'latest';
5
+ const DEFAULT_GEOJSON_LOADER_OPTIONS = {
6
+ geojson: {
7
+ shape: 'object-row-table'
8
+ },
9
+ json: {
10
+ jsonpaths: ['$', '$.features']
11
+ },
12
+ gis: {
13
+ format: 'geojson'
14
+ }
15
+ };
16
+ export const GeoJSONWorkerLoader = {
17
+ name: 'GeoJSON',
18
+ id: 'geojson',
19
+ module: 'geojson',
20
+ version: VERSION,
21
+ worker: true,
22
+ extensions: ['geojson'],
23
+ mimeTypes: ['application/geo+json'],
24
+ category: 'geometry',
25
+ text: true,
26
+ options: DEFAULT_GEOJSON_LOADER_OPTIONS
27
+ };
28
+ export const GeoJSONLoader = {
29
+ ...GeoJSONWorkerLoader,
30
+ parse,
31
+ parseTextSync,
32
+ parseInBatches
33
+ };
34
+ async function parse(arrayBuffer, options) {
35
+ return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
36
+ }
37
+ function parseTextSync(text, options) {
38
+ options = {
39
+ ...DEFAULT_GEOJSON_LOADER_OPTIONS,
40
+ ...options
41
+ };
42
+ options.json = {
43
+ ...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson,
44
+ ...options.geojson
45
+ };
46
+ options.gis = options.gis || {};
47
+ const table = parseJSONSync(text, options);
48
+ table.shape = 'geojson-row-table';
49
+ switch (options.gis.format) {
50
+ case 'binary':
51
+ return geojsonToBinary(table.data);
52
+ default:
53
+ return table;
54
+ }
55
+ }
56
+ function parseInBatches(asyncIterator, options) {
57
+ options = {
58
+ ...DEFAULT_GEOJSON_LOADER_OPTIONS,
59
+ ...options
60
+ };
61
+ options.json = {
62
+ ...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson,
63
+ ...options.geojson
64
+ };
65
+ const geojsonIterator = parseJSONInBatches(asyncIterator, options);
66
+ switch (options.gis.format) {
67
+ case 'binary':
68
+ return makeBinaryGeometryIterator(geojsonIterator);
69
+ default:
70
+ return geojsonIterator;
71
+ }
72
+ }
73
+ async function* makeBinaryGeometryIterator(geojsonIterator) {
74
+ for await (const batch of geojsonIterator) {
75
+ batch.data = geojsonToBinary(batch.data);
76
+ yield batch;
77
+ }
78
+ }
79
+ //# sourceMappingURL=geojson-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geojson-loader.js","names":["geojsonToBinary","parseJSONSync","parseJSONInBatches","VERSION","DEFAULT_GEOJSON_LOADER_OPTIONS","geojson","shape","json","jsonpaths","gis","format","GeoJSONWorkerLoader","name","id","module","version","worker","extensions","mimeTypes","category","text","options","GeoJSONLoader","parse","parseTextSync","parseInBatches","arrayBuffer","TextDecoder","decode","table","data","asyncIterator","geojsonIterator","makeBinaryGeometryIterator","batch"],"sources":["../../src/geojson-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {Loader, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport type {JSONLoaderOptions} from './json-loader';\nimport {geojsonToBinary} from '@loaders.gl/gis';\nimport {parseJSONSync} from './lib/parsers/parse-json';\nimport {parseJSONInBatches} from './lib/parsers/parse-json-in-batches';\nimport {GeoJSONRowTable} from '@loaders.gl/schema';\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 table = parseJSONSync(text, options) as GeoJSONRowTable;\n table.shape = 'geojson-row-table';\n switch (options.gis.format) {\n case 'binary':\n return geojsonToBinary(table.data);\n default:\n return table;\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":"AAIA,SAAQA,eAAe,QAAO,iBAAiB;AAC/C,SAAQC,aAAa,QAAO,0BAA0B;AACtD,SAAQC,kBAAkB,QAAO,qCAAqC;AAKtE,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,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;AAKD,OAAO,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;AAED,OAAO,MAAMkB,aAA+B,GAAG;EAC7C,GAAGX,mBAAmB;EACtBY,KAAK;EACLC,aAAa;EACbC;AACF,CAAC;AAED,eAAeF,KAAKA,CAACG,WAAW,EAAEL,OAAO,EAAE;EACzC,OAAOG,aAAa,CAAC,IAAIG,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,EAAEL,OAAO,CAAC;AACtE;AAEA,SAASG,aAAaA,CAACJ,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,MAAMoB,KAAK,GAAG5B,aAAa,CAACmB,IAAI,EAAEC,OAAO,CAAoB;EAC7DQ,KAAK,CAACvB,KAAK,GAAG,mBAAmB;EACjC,QAAQe,OAAO,CAACZ,GAAG,CAACC,MAAM;IACxB,KAAK,QAAQ;MACX,OAAOV,eAAe,CAAC6B,KAAK,CAACC,IAAI,CAAC;IACpC;MACE,OAAOD,KAAK;EAChB;AACF;AAEA,SAASJ,cAAcA,CAACM,aAAa,EAAEV,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,MAAM2B,eAAe,GAAG9B,kBAAkB,CAAC6B,aAAa,EAAEV,OAAO,CAAC;EAElE,QAAQA,OAAO,CAACZ,GAAG,CAACC,MAAM;IACxB,KAAK,QAAQ;MACX,OAAOuB,0BAA0B,CAACD,eAAe,CAAC;IACpD;MACE,OAAOA,eAAe;EAC1B;AACF;AAEA,gBAAgBC,0BAA0BA,CAACD,eAAe,EAAE;EAC1D,WAAW,MAAME,KAAK,IAAIF,eAAe,EAAE;IACzCE,KAAK,CAACJ,IAAI,GAAG9B,eAAe,CAACkC,KAAK,CAACJ,IAAI,CAAC;IACxC,MAAMI,KAAK;EACb;AACF"}
@@ -0,0 +1,18 @@
1
+ import { encodeTableAsGeojsonInBatches } from './lib/encoders/geojson-encoder';
2
+ export const GeoJSONWriter = {
3
+ id: 'geojson',
4
+ version: 'latest',
5
+ module: 'geojson',
6
+ name: 'GeoJSON',
7
+ extensions: ['geojson'],
8
+ mimeTypes: ['application/geo+json'],
9
+ options: {
10
+ geojson: {
11
+ featureArray: false,
12
+ geometryColumn: null
13
+ }
14
+ },
15
+ text: true,
16
+ encodeInBatches: (tableIterator, options) => encodeTableAsGeojsonInBatches(tableIterator, options)
17
+ };
18
+ //# sourceMappingURL=geojson-writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geojson-writer.js","names":["encodeTableAsGeojsonInBatches","GeoJSONWriter","id","version","module","name","extensions","mimeTypes","options","geojson","featureArray","geometryColumn","text","encodeInBatches","tableIterator"],"sources":["../../src/geojson-writer.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright Foursquare, Inc 20222\n\nimport type {Writer} from '@loaders.gl/loader-utils';\nimport type {Table, TableBatch} from '@loaders.gl/schema';\nimport type {GeoJSONWriterOptions} from './lib/encoders/geojson-encoder';\nimport {encodeTableAsGeojsonInBatches} from './lib/encoders/geojson-encoder';\n\nexport type {GeoJSONWriterOptions};\n\nexport const GeoJSONWriter: Writer<Table, TableBatch, GeoJSONWriterOptions> = {\n id: 'geojson',\n version: 'latest',\n module: 'geojson',\n name: 'GeoJSON',\n extensions: ['geojson'],\n mimeTypes: ['application/geo+json'],\n options: {\n geojson: {\n featureArray: false,\n geometryColumn: null\n }\n },\n text: true,\n encodeInBatches: (tableIterator: AsyncIterable<TableBatch>, options) =>\n encodeTableAsGeojsonInBatches(tableIterator, options)\n};\n"],"mappings":"AAMA,SAAQA,6BAA6B,QAAO,gCAAgC;AAI5E,OAAO,MAAMC,aAA8D,GAAG;EAC5EC,EAAE,EAAE,SAAS;EACbC,OAAO,EAAE,QAAQ;EACjBC,MAAM,EAAE,SAAS;EACjBC,IAAI,EAAE,SAAS;EACfC,UAAU,EAAE,CAAC,SAAS,CAAC;EACvBC,SAAS,EAAE,CAAC,sBAAsB,CAAC;EACnCC,OAAO,EAAE;IACPC,OAAO,EAAE;MACPC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE;IAClB;EACF,CAAC;EACDC,IAAI,EAAE,IAAI;EACVC,eAAe,EAAEA,CAACC,aAAwC,EAAEN,OAAO,KACjER,6BAA6B,CAACc,aAAa,EAAEN,OAAO;AACxD,CAAC"}
@@ -0,0 +1,9 @@
1
+ export { JSONLoader } from './json-loader';
2
+ export { NDJSONLoader } from './ndjson-loader';
3
+ export { JSONWriter } from './json-writer';
4
+ export { GeoJSONLoader as _GeoJSONLoader, GeoJSONWorkerLoader as _GeoJSONWorkerLoader } from './geojson-loader';
5
+ export { GeoJSONWriter as _GeoJSONWriter } from './geojson-writer';
6
+ export { default as _JSONPath } from './lib/jsonpath/jsonpath';
7
+ export { default as _ClarinetParser } from './lib/clarinet/clarinet';
8
+ export { rebuildJsonObject as _rebuildJsonObject } from './lib/parsers/parse-json-in-batches';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["JSONLoader","NDJSONLoader","JSONWriter","GeoJSONLoader","_GeoJSONLoader","GeoJSONWorkerLoader","_GeoJSONWorkerLoader","GeoJSONWriter","_GeoJSONWriter","default","_JSONPath","_ClarinetParser","rebuildJsonObject","_rebuildJsonObject"],"sources":["../../src/index.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nexport type {JSONLoaderOptions} from './json-loader';\nexport {JSONLoader} from './json-loader';\nexport {NDJSONLoader} from './ndjson-loader';\n\nexport type {JSONWriterOptions} from './json-writer';\nexport {JSONWriter} from './json-writer';\n\n// EXPERIMENTAL EXPORTS - WARNING: MAY BE REMOVED WIHTOUT NOTICE IN FUTURE RELEASES\nexport type {GeoJSONLoaderOptions as _GeoJSONLoaderOptions} from './geojson-loader';\nexport {\n GeoJSONLoader as _GeoJSONLoader,\n GeoJSONWorkerLoader as _GeoJSONWorkerLoader\n} from './geojson-loader';\n\nexport type {GeoJSONWriterOptions as _GeoJSONWriterOptions} from './geojson-writer';\nexport {GeoJSONWriter as _GeoJSONWriter} from './geojson-writer';\n\nexport {default as _JSONPath} from './lib/jsonpath/jsonpath';\nexport {default as _ClarinetParser} from './lib/clarinet/clarinet';\n\nexport {rebuildJsonObject as _rebuildJsonObject} from './lib/parsers/parse-json-in-batches';\n"],"mappings":"AAGA,SAAQA,UAAU,QAAO,eAAe;AACxC,SAAQC,YAAY,QAAO,iBAAiB;AAG5C,SAAQC,UAAU,QAAO,eAAe;AAIxC,SACEC,aAAa,IAAIC,cAAc,EAC/BC,mBAAmB,IAAIC,oBAAoB,QACtC,kBAAkB;AAGzB,SAAQC,aAAa,IAAIC,cAAc,QAAO,kBAAkB;AAEhE,SAAQC,OAAO,IAAIC,SAAS,QAAO,yBAAyB;AAC5D,SAAQD,OAAO,IAAIE,eAAe,QAAO,yBAAyB;AAElE,SAAQC,iBAAiB,IAAIC,kBAAkB,QAAO,qCAAqC"}
@@ -0,0 +1,48 @@
1
+ import { parseJSONSync } from './lib/parsers/parse-json';
2
+ import { parseJSONInBatches } from './lib/parsers/parse-json-in-batches';
3
+ const VERSION = typeof "4.0.0-alpha.11" !== 'undefined' ? "4.0.0-alpha.11" : 'latest';
4
+ const DEFAULT_JSON_LOADER_OPTIONS = {
5
+ json: {
6
+ shape: 'row-table',
7
+ table: false,
8
+ jsonpaths: []
9
+ }
10
+ };
11
+ export const JSONLoader = {
12
+ name: 'JSON',
13
+ id: 'json',
14
+ module: 'json',
15
+ version: VERSION,
16
+ extensions: ['json', 'geojson'],
17
+ mimeTypes: ['application/json'],
18
+ category: 'table',
19
+ text: true,
20
+ parse,
21
+ parseTextSync,
22
+ parseInBatches,
23
+ options: DEFAULT_JSON_LOADER_OPTIONS
24
+ };
25
+ async function parse(arrayBuffer, options) {
26
+ return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
27
+ }
28
+ function parseTextSync(text, options) {
29
+ const jsonOptions = {
30
+ ...options,
31
+ json: {
32
+ ...DEFAULT_JSON_LOADER_OPTIONS.json,
33
+ ...(options === null || options === void 0 ? void 0 : options.json)
34
+ }
35
+ };
36
+ return parseJSONSync(text, jsonOptions);
37
+ }
38
+ function parseInBatches(asyncIterator, options) {
39
+ const jsonOptions = {
40
+ ...options,
41
+ json: {
42
+ ...DEFAULT_JSON_LOADER_OPTIONS.json,
43
+ ...(options === null || options === void 0 ? void 0 : options.json)
44
+ }
45
+ };
46
+ return parseJSONInBatches(asyncIterator, jsonOptions);
47
+ }
48
+ //# sourceMappingURL=json-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-loader.js","names":["parseJSONSync","parseJSONInBatches","VERSION","DEFAULT_JSON_LOADER_OPTIONS","json","shape","table","jsonpaths","JSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","parseTextSync","parseInBatches","options","arrayBuffer","TextDecoder","decode","jsonOptions","asyncIterator"],"sources":["../../src/json-loader.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport type {Table, TableBatch} from '@loaders.gl/schema';\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {parseJSONSync} from './lib/parsers/parse-json';\nimport {parseJSONInBatches} from './lib/parsers/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\ntype ParseJSONOptions = {\n shape?: 'row-table';\n table?: boolean;\n jsonpaths?: string[];\n};\n\n/**\n * @param table -\n * @param jsonpaths -\n */\nexport type JSONLoaderOptions = LoaderOptions & {\n json?: ParseJSONOptions;\n};\n\nconst DEFAULT_JSON_LOADER_OPTIONS: {json: Required<ParseJSONOptions>} = {\n json: {\n shape: 'row-table',\n table: false,\n jsonpaths: []\n // batchSize: 'auto'\n }\n};\n\nexport const JSONLoader: LoaderWithParser<Table, TableBatch, JSONLoaderOptions> = {\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<TableBatch> {\n const jsonOptions = {...options, json: {...DEFAULT_JSON_LOADER_OPTIONS.json, ...options?.json}};\n return parseJSONInBatches(asyncIterator, jsonOptions as JSONLoaderOptions);\n}\n"],"mappings":"AAIA,SAAQA,aAAa,QAAO,0BAA0B;AACtD,SAAQC,kBAAkB,QAAO,qCAAqC;AAItE,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAgB3E,MAAMC,2BAA+D,GAAG;EACtEC,IAAI,EAAE;IACJC,KAAK,EAAE,WAAW;IAClBC,KAAK,EAAE,KAAK;IACZC,SAAS,EAAE;EAEb;AACF,CAAC;AAED,OAAO,MAAMC,UAAkE,GAAG;EAChFC,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;EACVC,KAAK;EACLC,aAAa;EACbC,cAAc;EACdC,OAAO,EAAEjB;AACX,CAAC;AAED,eAAec,KAAKA,CAACI,WAAwB,EAAED,OAA2B,EAAE;EAC1E,OAAOF,aAAa,CAAC,IAAII,WAAW,CAAC,CAAC,CAACC,MAAM,CAACF,WAAW,CAAC,EAAED,OAAO,CAAC;AACtE;AAEA,SAASF,aAAaA,CAACF,IAAY,EAAEI,OAA2B,EAAE;EAChE,MAAMI,WAAW,GAAG;IAAC,GAAGJ,OAAO;IAAEhB,IAAI,EAAE;MAAC,GAAGD,2BAA2B,CAACC,IAAI;MAAE,IAAGgB,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEhB,IAAI;IAAA;EAAC,CAAC;EAC/F,OAAOJ,aAAa,CAACgB,IAAI,EAAEQ,WAAgC,CAAC;AAC9D;AAEA,SAASL,cAAcA,CACrBM,aAAiE,EACjEL,OAA2B,EACA;EAC3B,MAAMI,WAAW,GAAG;IAAC,GAAGJ,OAAO;IAAEhB,IAAI,EAAE;MAAC,GAAGD,2BAA2B,CAACC,IAAI;MAAE,IAAGgB,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEhB,IAAI;IAAA;EAAC,CAAC;EAC/F,OAAOH,kBAAkB,CAACwB,aAAa,EAAED,WAAgC,CAAC;AAC5E"}
@@ -0,0 +1,14 @@
1
+ import { encodeTableAsJSON } from './lib/encoders/json-encoder';
2
+ export const JSONWriter = {
3
+ id: 'json',
4
+ version: 'latest',
5
+ module: 'json',
6
+ name: 'JSON',
7
+ extensions: ['json'],
8
+ mimeTypes: ['application/json'],
9
+ options: {},
10
+ text: true,
11
+ encode: async (table, options) => new TextEncoder().encode(encodeTableAsJSON(table, options)).buffer,
12
+ encodeText: (table, options) => encodeTableAsJSON(table, options)
13
+ };
14
+ //# sourceMappingURL=json-writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-writer.js","names":["encodeTableAsJSON","JSONWriter","id","version","module","name","extensions","mimeTypes","options","text","encode","table","TextEncoder","buffer","encodeText"],"sources":["../../src/json-writer.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright 2022 Foursquare Labs, Inc.\n\n/* global TextEncoder */\nimport type {Writer} from '@loaders.gl/loader-utils';\nimport type {Table, TableBatch} from '@loaders.gl/schema';\nimport type {JSONWriterOptions} from './lib/encoders/json-encoder';\nimport {encodeTableAsJSON} from './lib/encoders/json-encoder';\n\nexport type {JSONWriterOptions};\n\nexport const JSONWriter: Writer<Table, TableBatch, JSONWriterOptions> = {\n id: 'json',\n version: 'latest',\n module: 'json',\n name: 'JSON',\n extensions: ['json'],\n mimeTypes: ['application/json'],\n options: {},\n text: true,\n encode: async (table: Table, options: JSONWriterOptions) =>\n new TextEncoder().encode(encodeTableAsJSON(table, options)).buffer,\n encodeText: (table: Table, options: JSONWriterOptions) => encodeTableAsJSON(table, options)\n};\n"],"mappings":"AAOA,SAAQA,iBAAiB,QAAO,6BAA6B;AAI7D,OAAO,MAAMC,UAAwD,GAAG;EACtEC,EAAE,EAAE,MAAM;EACVC,OAAO,EAAE,QAAQ;EACjBC,MAAM,EAAE,MAAM;EACdC,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE,CAAC,MAAM,CAAC;EACpBC,SAAS,EAAE,CAAC,kBAAkB,CAAC;EAC/BC,OAAO,EAAE,CAAC,CAAC;EACXC,IAAI,EAAE,IAAI;EACVC,MAAM,EAAE,MAAAA,CAAOC,KAAY,EAAEH,OAA0B,KACrD,IAAII,WAAW,CAAC,CAAC,CAACF,MAAM,CAACV,iBAAiB,CAACW,KAAK,EAAEH,OAAO,CAAC,CAAC,CAACK,MAAM;EACpEC,UAAU,EAAEA,CAACH,KAAY,EAAEH,OAA0B,KAAKR,iBAAiB,CAACW,KAAK,EAAEH,OAAO;AAC5F,CAAC"}
@@ -0,0 +1,28 @@
1
+ Copyright (c) Isaac Z. Schlueter ("Author")
2
+ Copyright (c) 2011 nuno job <nunojob.com>
3
+ All rights reserved.
4
+
5
+ The BSD License
6
+
7
+ Redistribution and use in source and binary forms, with or without
8
+ modification, are permitted provided that the following conditions
9
+ are met:
10
+
11
+ 1. Redistributions of source code must retain the above copyright
12
+ notice, this list of conditions and the following disclaimer.
13
+
14
+ 2. Redistributions in binary form must reproduce the above copyright
15
+ notice, this list of conditions and the following disclaimer in the
16
+ documentation and/or other materials provided with the distribution.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
22
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
25
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
28
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.