Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(csv): papaparse cleanup #3143

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/core/test/lib/api/create-data-source.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {PMTilesSource} from '@loaders.gl/pmtiles';
import {MVTSource, TableTileSource} from '@loaders.gl/mvt';
import {_GeoJSONLoader as GeoJSONLoader} from '@loaders.gl/json';

test.only('createDataSource', async (t) => {
test('createDataSource', async (t) => {
const dataSource = createDataSource(url, [PMTilesSource, TableTileSource, MVTSource], {
pmtiles: {
attributions: example.attributions,
Expand Down
12 changes: 6 additions & 6 deletions modules/csv/src/papaparse/async-iterator-streamer.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// @ts-nocheck
// A custom papaparse `Streamer` for async iterators
// Ideally this can be contributed back to papaparse
// Or papaparse can expose Streamer API so we can extend without forking.
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
// Copyright (c) 2015 Matthew Holt

/* eslint-disable no-invalid-this */
// This is a fork of papaparse v5.0.0-beta.0 under MIT license
// https://github.com/mholt/PapaParse

// Note: papaparse is not an ES6 module
import Papa from './papaparse';
const {ChunkStreamer} = Papa;

Expand Down
23 changes: 23 additions & 0 deletions modules/csv/src/papaparse/papa-constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
// Copyright (c) 2015 Matthew Holt

// This is a fork of papaparse v5.0.0-beta.0 under MIT license
// https://github.com/mholt/PapaParse

const BYTE_ORDER_MARK = '\ufeff';

export const Papa = {
RECORD_SEP: String.fromCharCode(30),
UNIT_SEP: String.fromCharCode(31),
BYTE_ORDER_MARK,
BAD_DELIMITERS: ['\r', '\n', '"', BYTE_ORDER_MARK],
WORKERS_SUPPORTED: false, // !IS_WORKER && !!globalThis.Worker
NODE_STREAM_INPUT: 1,

// Configurable chunk sizes for local and remote files, respectively
LocalChunkSize: 1024 * 1024 * 10, // 10 M,
RemoteChunkSize: 1024 * 1024 * 5, // 5 M,
DefaultDelimiter: ',' // Used if not specified and detection fail,
};
Loading
Loading