@loaders.gl/csv 4.4.0-alpha.2 → 4.4.0-alpha.9
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/csv-arrow-loader.d.ts +1 -1
- package/dist/csv-arrow-loader.d.ts.map +1 -1
- package/dist/csv-arrow-loader.js +1 -0
- package/dist/csv-arrow-loader.js.map +1 -0
- package/dist/csv-format.js +1 -0
- package/dist/csv-format.js.map +1 -0
- package/dist/csv-loader.d.ts +1 -1
- package/dist/csv-loader.d.ts.map +1 -1
- package/dist/csv-loader.js +8 -7
- package/dist/csv-loader.js.map +1 -0
- package/dist/csv-writer.js +1 -0
- package/dist/csv-writer.js.map +1 -0
- package/dist/dist.dev.js +28 -5
- package/dist/dist.min.js +10 -10
- package/dist/index.cjs +7 -6
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/encoders/encode-csv.js +1 -0
- package/dist/lib/encoders/encode-csv.js.map +1 -0
- package/dist/papaparse/async-iterator-streamer.js +1 -0
- package/dist/papaparse/async-iterator-streamer.js.map +1 -0
- package/dist/papaparse/papa-constants.js +1 -0
- package/dist/papaparse/papa-constants.js.map +1 -0
- package/dist/papaparse/papa-parser.js +1 -0
- package/dist/papaparse/papa-parser.js.map +1 -0
- package/dist/papaparse/papa-writer.js +1 -0
- package/dist/papaparse/papa-writer.js.map +1 -0
- package/dist/papaparse/papaparse.js +1 -0
- package/dist/papaparse/papaparse.js.map +1 -0
- package/package.json +4 -4
- package/src/csv-arrow-loader.ts +3 -1
- package/src/csv-loader.ts +9 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"papaparse.js","sourceRoot":"","sources":["../../src/papaparse/papaparse.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AACpC,kCAAkC;AAElC,8DAA8D;AAC9D,qCAAqC;AAErC,gBAAgB;AAChB,sBAAsB;AACtB,wCAAwC;AACxC,6EAA6E;AAC7E,yEAAyE;AACzE,wCAAwC;AAExC,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAC,yBAAsB;AAC7E,OAAO,EAAC,SAAS,EAAC,yBAAsB;AACxC,OAAO,EAAC,IAAI,EAAC,4BAAyB;AAKtC,eAAe;IACb,GAAG,IAAI;IAEP,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAElB,aAAa;IAEb,2CAA2C;IAC3C,MAAM;IACN,YAAY;CACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/csv",
|
|
3
|
-
"version": "4.4.0-alpha.
|
|
3
|
+
"version": "4.4.0-alpha.9",
|
|
4
4
|
"description": "Framework-independent loader for CSV and DSV table formats",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@loaders.gl/loader-utils": "4.4.0-alpha.
|
|
48
|
-
"@loaders.gl/schema": "4.4.0-alpha.
|
|
47
|
+
"@loaders.gl/loader-utils": "4.4.0-alpha.9",
|
|
48
|
+
"@loaders.gl/schema": "4.4.0-alpha.9",
|
|
49
49
|
"d3-dsv": "^1.2.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@loaders.gl/core": "4.4.0-alpha.1"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "e9e6710379718c7663e97eba868c76e15de4cb84"
|
|
55
55
|
}
|
package/src/csv-arrow-loader.ts
CHANGED
|
@@ -33,7 +33,9 @@ async function parseCSVToArrow(csvText: string, options?: CSVLoaderOptions): Pro
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function parseCSVToArrowBatches(
|
|
36
|
-
asyncIterator:
|
|
36
|
+
asyncIterator:
|
|
37
|
+
| AsyncIterable<ArrayBufferLike | ArrayBufferView>
|
|
38
|
+
| Iterable<ArrayBufferLike | ArrayBufferView>,
|
|
37
39
|
options?: CSVArrowLoaderOptions
|
|
38
40
|
): AsyncIterable<ArrowTableBatch> {
|
|
39
41
|
const tableIterator = CSVLoader.parseInBatches(asyncIterator, options);
|
package/src/csv-loader.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
6
6
|
import type {Schema, ArrayRowTable, ObjectRowTable, TableBatch} from '@loaders.gl/schema';
|
|
7
7
|
|
|
8
|
-
import {log} from '@loaders.gl/loader-utils';
|
|
8
|
+
import {log, toArrayBufferIterator} from '@loaders.gl/loader-utils';
|
|
9
9
|
import {
|
|
10
10
|
AsyncQueue,
|
|
11
11
|
deduceTableSchema,
|
|
@@ -133,14 +133,16 @@ async function parseCSV(
|
|
|
133
133
|
|
|
134
134
|
// TODO - support batch size 0 = no batching/single batch?
|
|
135
135
|
function parseCSVInBatches(
|
|
136
|
-
asyncIterator:
|
|
136
|
+
asyncIterator:
|
|
137
|
+
| AsyncIterable<ArrayBufferLike | ArrayBufferView>
|
|
138
|
+
| Iterable<ArrayBufferLike | ArrayBufferView>,
|
|
137
139
|
options?: CSVLoaderOptions
|
|
138
140
|
): AsyncIterable<TableBatch> {
|
|
139
141
|
// Papaparse does not support standard batch size handling
|
|
140
142
|
// TODO - investigate papaparse chunks mode
|
|
141
143
|
options = {...options};
|
|
142
|
-
if (options
|
|
143
|
-
options.batchSize = 4000;
|
|
144
|
+
if (options?.core?.batchSize === 'auto') {
|
|
145
|
+
options.core.batchSize = 4000;
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
// Apps can call the parse method directly, we so apply default options here
|
|
@@ -208,7 +210,7 @@ function parseCSVInBatches(
|
|
|
208
210
|
row = JSON.parse(JSON.stringify(row));
|
|
209
211
|
}
|
|
210
212
|
|
|
211
|
-
const shape = csvOptions.shape || DEFAULT_CSV_SHAPE;
|
|
213
|
+
const shape = (options as any)?.shape || csvOptions.shape || DEFAULT_CSV_SHAPE;
|
|
212
214
|
|
|
213
215
|
// Add the row
|
|
214
216
|
tableBatchBuilder =
|
|
@@ -218,7 +220,7 @@ function parseCSVInBatches(
|
|
|
218
220
|
schema,
|
|
219
221
|
{
|
|
220
222
|
shape,
|
|
221
|
-
...options
|
|
223
|
+
...(options?.core || {})
|
|
222
224
|
}
|
|
223
225
|
);
|
|
224
226
|
|
|
@@ -251,7 +253,7 @@ function parseCSVInBatches(
|
|
|
251
253
|
}
|
|
252
254
|
};
|
|
253
255
|
|
|
254
|
-
Papa.parse(asyncIterator, config, AsyncIteratorStreamer);
|
|
256
|
+
Papa.parse(toArrayBufferIterator(asyncIterator), config, AsyncIteratorStreamer);
|
|
255
257
|
|
|
256
258
|
// TODO - Does it matter if we return asyncIterable or asyncIterator
|
|
257
259
|
// return asyncQueue[Symbol.asyncIterator]();
|