@loaders.gl/csv 3.1.3 → 4.0.0-alpha.5

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 (36) hide show
  1. package/dist/bundle.js +2 -2
  2. package/dist/bundle.js.map +1 -0
  3. package/dist/csv-loader.js +220 -247
  4. package/dist/csv-loader.js.map +1 -0
  5. package/dist/csv-writer.js +2 -6
  6. package/dist/{es5/csv-writer.js.map → csv-writer.js.map} +0 -0
  7. package/dist/index.js +2 -5
  8. package/dist/index.js.map +1 -0
  9. package/dist/papaparse/async-iterator-streamer.js +32 -60
  10. package/dist/papaparse/async-iterator-streamer.js.map +1 -0
  11. package/dist/papaparse/papaparse.js +795 -870
  12. package/dist/papaparse/papaparse.js.map +1 -0
  13. package/package.json +6 -6
  14. package/dist/es5/bundle.js +0 -7
  15. package/dist/es5/bundle.js.map +0 -1
  16. package/dist/es5/csv-loader.js +0 -309
  17. package/dist/es5/csv-loader.js.map +0 -1
  18. package/dist/es5/csv-writer.js +0 -2
  19. package/dist/es5/index.js +0 -14
  20. package/dist/es5/index.js.map +0 -1
  21. package/dist/es5/papaparse/async-iterator-streamer.js +0 -140
  22. package/dist/es5/papaparse/async-iterator-streamer.js.map +0 -1
  23. package/dist/es5/papaparse/papaparse.js +0 -882
  24. package/dist/es5/papaparse/papaparse.js.map +0 -1
  25. package/dist/esm/bundle.js +0 -5
  26. package/dist/esm/bundle.js.map +0 -1
  27. package/dist/esm/csv-loader.js +0 -240
  28. package/dist/esm/csv-loader.js.map +0 -1
  29. package/dist/esm/csv-writer.js +0 -2
  30. package/dist/esm/csv-writer.js.map +0 -1
  31. package/dist/esm/index.js +0 -2
  32. package/dist/esm/index.js.map +0 -1
  33. package/dist/esm/papaparse/async-iterator-streamer.js +0 -35
  34. package/dist/esm/papaparse/async-iterator-streamer.js.map +0 -1
  35. package/dist/esm/papaparse/papaparse.js +0 -860
  36. package/dist/esm/papaparse/papaparse.js.map +0 -1
@@ -1,63 +1,35 @@
1
- "use strict";
2
- // @ts-nocheck
3
- // A custom papaparse `Streamer` for async iterators
4
- // Ideally this can be contributed back to papaparse
5
- // Or papaparse can expose Streamer API so we can extend without forking.
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- /* eslint-disable no-invalid-this */
11
- // Note: papaparse is not an ES6 module
12
- const papaparse_1 = __importDefault(require("./papaparse"));
13
- const { ChunkStreamer } = papaparse_1.default;
14
- function AsyncIteratorStreamer(config) {
15
- config = config || {};
16
- ChunkStreamer.call(this, config);
17
- this.textDecoder = new TextDecoder(this._config.encoding);
18
- // Implement ChunkStreamer base class methods
19
- // this.pause = function() {
20
- // ChunkStreamer.prototype.pause.apply(this, arguments);
21
- // };
22
- // this.resume = function() {
23
- // ChunkStreamer.prototype.resume.apply(this, arguments);
24
- // this._input.resume();
25
- // };
26
- this.stream = async function (asyncIterator) {
27
- this._input = asyncIterator;
28
- try {
29
- // ES2018 version
30
- // TODO - check for pause and abort flags?
31
- for await (const chunk of asyncIterator) {
32
- this.parseChunk(this.getStringChunk(chunk));
33
- }
34
- // ES5 VERSION
35
- // while (true) {
36
- // asyncIterator.next().then(function(value) {
37
- // if (value.done) {
38
- // // finalize iterator?
39
- // }
40
- // }
41
- // const = await ;
42
- // if (done) return total;
43
- // total += value.length;
44
- // }
45
- this._finished = true;
46
- this.parseChunk('');
47
- }
48
- catch (error) {
49
- // Inform ChunkStreamer base class of error
50
- this._sendError(error);
51
- }
52
- };
53
- this._nextChunk = function nextChunk() {
54
- // Left empty, as async iterator automatically pulls next chunk
55
- };
56
- // HELPER METHODS
57
- this.getStringChunk = function (chunk) {
58
- return typeof chunk === 'string' ? chunk : this.textDecoder.decode(chunk, { stream: true });
59
- };
1
+ import Papa from './papaparse';
2
+ const {
3
+ ChunkStreamer
4
+ } = Papa;
5
+ export default function AsyncIteratorStreamer(config) {
6
+ config = config || {};
7
+ ChunkStreamer.call(this, config);
8
+ this.textDecoder = new TextDecoder(this._config.encoding);
9
+
10
+ this.stream = async function (asyncIterator) {
11
+ this._input = asyncIterator;
12
+
13
+ try {
14
+ for await (const chunk of asyncIterator) {
15
+ this.parseChunk(this.getStringChunk(chunk));
16
+ }
17
+
18
+ this._finished = true;
19
+ this.parseChunk('');
20
+ } catch (error) {
21
+ this._sendError(error);
22
+ }
23
+ };
24
+
25
+ this._nextChunk = function nextChunk() {};
26
+
27
+ this.getStringChunk = function (chunk) {
28
+ return typeof chunk === 'string' ? chunk : this.textDecoder.decode(chunk, {
29
+ stream: true
30
+ });
31
+ };
60
32
  }
61
- exports.default = AsyncIteratorStreamer;
62
33
  AsyncIteratorStreamer.prototype = Object.create(ChunkStreamer.prototype);
63
34
  AsyncIteratorStreamer.prototype.constructor = AsyncIteratorStreamer;
35
+ //# sourceMappingURL=async-iterator-streamer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/papaparse/async-iterator-streamer.ts"],"names":["Papa","ChunkStreamer","AsyncIteratorStreamer","config","call","textDecoder","TextDecoder","_config","encoding","stream","asyncIterator","_input","chunk","parseChunk","getStringChunk","_finished","error","_sendError","_nextChunk","nextChunk","decode","prototype","Object","create","constructor"],"mappings":"AAQA,OAAOA,IAAP,MAAiB,aAAjB;AACA,MAAM;AAACC,EAAAA;AAAD,IAAkBD,IAAxB;AAEA,eAAe,SAASE,qBAAT,CAA+BC,MAA/B,EAAuC;AACpDA,EAAAA,MAAM,GAAGA,MAAM,IAAI,EAAnB;AAEAF,EAAAA,aAAa,CAACG,IAAd,CAAmB,IAAnB,EAAyBD,MAAzB;AAEA,OAAKE,WAAL,GAAmB,IAAIC,WAAJ,CAAgB,KAAKC,OAAL,CAAaC,QAA7B,CAAnB;;AAaA,OAAKC,MAAL,GAAc,gBAAgBC,aAAhB,EAA+B;AAC3C,SAAKC,MAAL,GAAcD,aAAd;;AAEA,QAAI;AAGF,iBAAW,MAAME,KAAjB,IAA0BF,aAA1B,EAAyC;AACvC,aAAKG,UAAL,CAAgB,KAAKC,cAAL,CAAoBF,KAApB,CAAhB;AACD;;AAcD,WAAKG,SAAL,GAAiB,IAAjB;AACA,WAAKF,UAAL,CAAgB,EAAhB;AACD,KArBD,CAqBE,OAAOG,KAAP,EAAc;AAEd,WAAKC,UAAL,CAAgBD,KAAhB;AACD;AACF,GA5BD;;AA8BA,OAAKE,UAAL,GAAkB,SAASC,SAAT,GAAqB,CAEtC,CAFD;;AAKA,OAAKL,cAAL,GAAsB,UAAUF,KAAV,EAAiB;AACrC,WAAO,OAAOA,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,GAAoC,KAAKP,WAAL,CAAiBe,MAAjB,CAAwBR,KAAxB,EAA+B;AAACH,MAAAA,MAAM,EAAE;AAAT,KAA/B,CAA3C;AACD,GAFD;AAGD;AAEDP,qBAAqB,CAACmB,SAAtB,GAAkCC,MAAM,CAACC,MAAP,CAActB,aAAa,CAACoB,SAA5B,CAAlC;AACAnB,qBAAqB,CAACmB,SAAtB,CAAgCG,WAAhC,GAA8CtB,qBAA9C","sourcesContent":["// @ts-nocheck\n// A custom papaparse `Streamer` for async iterators\n// Ideally this can be contributed back to papaparse\n// Or papaparse can expose Streamer API so we can extend without forking.\n\n/* eslint-disable no-invalid-this */\n\n// Note: papaparse is not an ES6 module\nimport Papa from './papaparse';\nconst {ChunkStreamer} = Papa;\n\nexport default function AsyncIteratorStreamer(config) {\n config = config || {};\n\n ChunkStreamer.call(this, config);\n\n this.textDecoder = new TextDecoder(this._config.encoding);\n\n // Implement ChunkStreamer base class methods\n\n // this.pause = function() {\n // ChunkStreamer.prototype.pause.apply(this, arguments);\n // };\n\n // this.resume = function() {\n // ChunkStreamer.prototype.resume.apply(this, arguments);\n // this._input.resume();\n // };\n\n this.stream = async function (asyncIterator) {\n this._input = asyncIterator;\n\n try {\n // ES2018 version\n // TODO - check for pause and abort flags?\n for await (const chunk of asyncIterator) {\n this.parseChunk(this.getStringChunk(chunk));\n }\n\n // ES5 VERSION\n // while (true) {\n // asyncIterator.next().then(function(value) {\n // if (value.done) {\n // // finalize iterator?\n // }\n // }\n // const = await ;\n // if (done) return total;\n // total += value.length;\n // }\n\n this._finished = true;\n this.parseChunk('');\n } catch (error) {\n // Inform ChunkStreamer base class of error\n this._sendError(error);\n }\n };\n\n this._nextChunk = function nextChunk() {\n // Left empty, as async iterator automatically pulls next chunk\n };\n\n // HELPER METHODS\n this.getStringChunk = function (chunk) {\n return typeof chunk === 'string' ? chunk : this.textDecoder.decode(chunk, {stream: true});\n };\n}\n\nAsyncIteratorStreamer.prototype = Object.create(ChunkStreamer.prototype);\nAsyncIteratorStreamer.prototype.constructor = AsyncIteratorStreamer;\n"],"file":"async-iterator-streamer.js"}