@loaders.gl/json 3.1.7 → 3.2.0-alpha.2
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/dist.min.js +16 -21
- package/dist/es5/geojson-loader.js +1 -1
- package/dist/es5/geojson-loader.js.map +1 -1
- package/dist/es5/json-loader.js +1 -1
- package/dist/es5/json-loader.js.map +1 -1
- package/dist/es5/ndjgeoson-loader.js +65 -0
- package/dist/es5/ndjgeoson-loader.js.map +1 -0
- package/dist/es5/ndjson-loader.js +28 -40
- package/dist/es5/ndjson-loader.js.map +1 -1
- package/dist/esm/geojson-loader.js +1 -1
- package/dist/esm/geojson-loader.js.map +1 -1
- package/dist/esm/json-loader.js +1 -1
- package/dist/esm/json-loader.js.map +1 -1
- package/dist/esm/ndjgeoson-loader.js +27 -0
- package/dist/esm/ndjgeoson-loader.js.map +1 -0
- package/dist/esm/ndjson-loader.js +6 -20
- package/dist/esm/ndjson-loader.js.map +1 -1
- package/dist/geojson-loader.d.ts +1 -1
- package/dist/geojson-loader.d.ts.map +1 -1
- package/dist/geojson-worker.js +46 -15
- package/dist/json-loader.d.ts.map +1 -1
- package/dist/json-loader.js +0 -13
- package/dist/ndjgeoson-loader.d.ts +34 -0
- package/dist/ndjgeoson-loader.d.ts.map +1 -0
- package/dist/ndjgeoson-loader.js +40 -0
- package/dist/ndjson-loader.d.ts +5 -10
- package/dist/ndjson-loader.d.ts.map +1 -1
- package/dist/ndjson-loader.js +10 -16
- package/package.json +5 -5
- package/src/geojson-loader.ts +1 -1
- package/src/json-loader.ts +0 -13
- package/src/ndjgeoson-loader.ts +48 -0
- package/src/ndjson-loader.ts +9 -24
- package/dist/es5/jsonl-loader.js +0 -2
- package/dist/es5/jsonl-loader.js.map +0 -1
- package/dist/esm/jsonl-loader.js +0 -2
- package/dist/esm/jsonl-loader.js.map +0 -1
- package/dist/jsonl-loader.d.ts +0 -1
- package/dist/jsonl-loader.d.ts.map +0 -1
- package/dist/jsonl-loader.js +0 -54
- package/src/jsonl-loader.ts +0 -53
package/dist/dist.min.js
CHANGED
|
@@ -1405,15 +1405,6 @@ Char: ${this.c}`;
|
|
|
1405
1405
|
});
|
|
1406
1406
|
|
|
1407
1407
|
// src/ndjson-loader.ts
|
|
1408
|
-
async function parse2(arrayBuffer) {
|
|
1409
|
-
return parseTextSync2(new TextDecoder().decode(arrayBuffer));
|
|
1410
|
-
}
|
|
1411
|
-
function parseTextSync2(text) {
|
|
1412
|
-
return parseNDJSONSync(text);
|
|
1413
|
-
}
|
|
1414
|
-
function parseInBatches2(asyncIterator, options) {
|
|
1415
|
-
return parseNDJSONInBatches(asyncIterator, options);
|
|
1416
|
-
}
|
|
1417
1408
|
var VERSION2, NDJSONLoader;
|
|
1418
1409
|
var init_ndjson_loader = __esm({
|
|
1419
1410
|
"src/ndjson-loader.ts"() {
|
|
@@ -1425,13 +1416,17 @@ Char: ${this.c}`;
|
|
|
1425
1416
|
id: "ndjson",
|
|
1426
1417
|
module: "json",
|
|
1427
1418
|
version: VERSION2,
|
|
1428
|
-
extensions: ["ndjson"],
|
|
1429
|
-
mimeTypes: [
|
|
1419
|
+
extensions: ["ndjson", "jsonl"],
|
|
1420
|
+
mimeTypes: [
|
|
1421
|
+
"application/x-ndjson",
|
|
1422
|
+
"application/jsonlines",
|
|
1423
|
+
"application/json-seq"
|
|
1424
|
+
],
|
|
1430
1425
|
category: "table",
|
|
1431
1426
|
text: true,
|
|
1432
|
-
parse:
|
|
1433
|
-
parseTextSync:
|
|
1434
|
-
parseInBatches:
|
|
1427
|
+
parse: async (arrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),
|
|
1428
|
+
parseTextSync: parseNDJSONSync,
|
|
1429
|
+
parseInBatches: parseNDJSONInBatches,
|
|
1435
1430
|
options: {}
|
|
1436
1431
|
};
|
|
1437
1432
|
}
|
|
@@ -2438,10 +2433,10 @@ Char: ${this.c}`;
|
|
|
2438
2433
|
});
|
|
2439
2434
|
|
|
2440
2435
|
// src/geojson-loader.ts
|
|
2441
|
-
async function
|
|
2442
|
-
return
|
|
2436
|
+
async function parse2(arrayBuffer, options) {
|
|
2437
|
+
return parseTextSync2(new TextDecoder().decode(arrayBuffer), options);
|
|
2443
2438
|
}
|
|
2444
|
-
function
|
|
2439
|
+
function parseTextSync2(text, options) {
|
|
2445
2440
|
options = { ...DEFAULT_GEOJSON_LOADER_OPTIONS, ...options };
|
|
2446
2441
|
options.json = { ...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson, ...options.geojson };
|
|
2447
2442
|
options.gis = options.gis || {};
|
|
@@ -2453,7 +2448,7 @@ Char: ${this.c}`;
|
|
|
2453
2448
|
return json;
|
|
2454
2449
|
}
|
|
2455
2450
|
}
|
|
2456
|
-
function
|
|
2451
|
+
function parseInBatches2(asyncIterator, options) {
|
|
2457
2452
|
options = { ...DEFAULT_GEOJSON_LOADER_OPTIONS, ...options };
|
|
2458
2453
|
options.json = { ...DEFAULT_GEOJSON_LOADER_OPTIONS.geojson, ...options.geojson };
|
|
2459
2454
|
const geojsonIterator = parseJSONInBatches(asyncIterator, options);
|
|
@@ -2502,9 +2497,9 @@ Char: ${this.c}`;
|
|
|
2502
2497
|
};
|
|
2503
2498
|
GeoJSONLoader = {
|
|
2504
2499
|
...GeoJSONWorkerLoader,
|
|
2505
|
-
parse:
|
|
2506
|
-
parseTextSync:
|
|
2507
|
-
parseInBatches:
|
|
2500
|
+
parse: parse2,
|
|
2501
|
+
parseTextSync: parseTextSync2,
|
|
2502
|
+
parseInBatches: parseInBatches2
|
|
2508
2503
|
};
|
|
2509
2504
|
}
|
|
2510
2505
|
});
|
|
@@ -29,7 +29,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
29
29
|
|
|
30
30
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
31
31
|
|
|
32
|
-
var VERSION = typeof "3.
|
|
32
|
+
var VERSION = typeof "3.2.0-alpha.2" !== 'undefined' ? "3.2.0-alpha.2" : 'latest';
|
|
33
33
|
var DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
34
34
|
geojson: {
|
|
35
35
|
shape: 'object-row-table'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/geojson-loader.ts"],"names":["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","asyncIterator","geojsonIterator","makeBinaryGeometryIterator","batch","data"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;;;;;AAIA,IAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../src/geojson-loader.ts"],"names":["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","asyncIterator","geojsonIterator","makeBinaryGeometryIterator","batch","data"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;;;;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAWA,IAAMC,8BAA8B,GAAG;AACrCC,EAAAA,OAAO,EAAE;AACPC,IAAAA,KAAK,EAAE;AADA,GAD4B;AAIrCC,EAAAA,IAAI,EAAE;AACJC,IAAAA,SAAS,EAAE,CAAC,GAAD,EAAM,YAAN;AADP,GAJ+B;AAOrCC,EAAAA,GAAG,EAAE;AACHC,IAAAA,MAAM,EAAE;AADL;AAPgC,CAAvC;AAeO,IAAMC,mBAA2B,GAAG;AACzCC,EAAAA,IAAI,EAAE,SADmC;AAEzCC,EAAAA,EAAE,EAAE,SAFqC;AAGzCC,EAAAA,MAAM,EAAE,SAHiC;AAIzCC,EAAAA,OAAO,EAAEZ,OAJgC;AAKzCa,EAAAA,MAAM,EAAE,IALiC;AAMzCC,EAAAA,UAAU,EAAE,CAAC,SAAD,CAN6B;AAOzCC,EAAAA,SAAS,EAAE,CAAC,sBAAD,CAP8B;AAQzCC,EAAAA,QAAQ,EAAE,UAR+B;AASzCC,EAAAA,IAAI,EAAE,IATmC;AAUzCC,EAAAA,OAAO,EAAEjB;AAVgC,CAApC;;;AAaA,IAAMkB,aAA+B,mCACvCX,mBADuC;AAE1CY,EAAAA,KAAK,EAALA,KAF0C;AAG1CC,EAAAA,aAAa,EAAbA,aAH0C;AAI1CC,EAAAA,cAAc,EAAdA;AAJ0C,EAArC;;;;SAOQF,K;;;;;qEAAf,kBAAqBG,WAArB,EAAkCL,OAAlC;AAAA;AAAA;AAAA;AAAA;AAAA,8CACSG,aAAa,CAAC,IAAIG,WAAJ,GAAkBC,MAAlB,CAAyBF,WAAzB,CAAD,EAAwCL,OAAxC,CADtB;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAIA,SAASG,aAAT,CAAuBJ,IAAvB,EAA6BC,OAA7B,EAAsC;AAEpCA,EAAAA,OAAO,mCAAOjB,8BAAP,GAA0CiB,OAA1C,CAAP;AACAA,EAAAA,OAAO,CAACd,IAAR,mCAAmBH,8BAA8B,CAACC,OAAlD,GAA8DgB,OAAO,CAAChB,OAAtE;AACAgB,EAAAA,OAAO,CAACZ,GAAR,GAAcY,OAAO,CAACZ,GAAR,IAAe,EAA7B;AACA,MAAMF,IAAI,GAAG,wBAAca,IAAd,EAAoBC,OAApB,CAAb;;AACA,UAAQA,OAAO,CAACZ,GAAR,CAAYC,MAApB;AACE,SAAK,QAAL;AACE,aAAO,0BAAgBH,IAAhB,CAAP;;AACF;AACE,aAAOA,IAAP;AAJJ;AAMD;;AAED,SAASkB,cAAT,CAAwBI,aAAxB,EAAuCR,OAAvC,EAAoE;AAElEA,EAAAA,OAAO,mCAAOjB,8BAAP,GAA0CiB,OAA1C,CAAP;AACAA,EAAAA,OAAO,CAACd,IAAR,mCAAmBH,8BAA8B,CAACC,OAAlD,GAA8DgB,OAAO,CAAChB,OAAtE;AAEA,MAAMyB,eAAe,GAAG,iCAAmBD,aAAnB,EAAkCR,OAAlC,CAAxB;;AAEA,UAAQA,OAAO,CAACZ,GAAR,CAAYC,MAApB;AACE,SAAK,QAAL;AACE,aAAOqB,0BAA0B,CAACD,eAAD,CAAjC;;AACF;AACE,aAAOA,eAAP;AAJJ;AAMD;;SAEeC,0B;;;;;4FAAhB,iBAA2CD,eAA3C;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qDAC4BA,eAD5B;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;;AACmBE,YAAAA,KADnB;AAEIA,YAAAA,KAAK,CAACC,IAAN,GAAa,0BAAgBD,KAAK,CAACC,IAAtB,CAAb;AAFJ;AAGI,mBAAMD,KAAN;;AAHJ;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","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"],"file":"geojson-loader.js"}
|
package/dist/es5/json-loader.js
CHANGED
|
@@ -21,7 +21,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
21
21
|
|
|
22
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
23
23
|
|
|
24
|
-
var VERSION = typeof "3.
|
|
24
|
+
var VERSION = typeof "3.2.0-alpha.2" !== 'undefined' ? "3.2.0-alpha.2" : 'latest';
|
|
25
25
|
var DEFAULT_JSON_LOADER_OPTIONS = {
|
|
26
26
|
json: {
|
|
27
27
|
shape: 'row-table',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/json-loader.ts"],"names":["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"],"mappings":";;;;;;;;;;;;;;;AAEA;;AACA;;;;;;AAIA,IAAMA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../src/json-loader.ts"],"names":["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"],"mappings":";;;;;;;;;;;;;;;AAEA;;AACA;;;;;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAcA,IAAMC,2BAA2B,GAAG;AAClCC,EAAAA,IAAI,EAAE;AACJC,IAAAA,KAAK,EAAE,WADH;AAEJC,IAAAA,KAAK,EAAE,KAFH;AAGJC,IAAAA,SAAS,EAAE;AAHP;AAD4B,CAApC;AASO,IAAMC,UAA4B,GAAG;AAC1CC,EAAAA,IAAI,EAAE,MADoC;AAE1CC,EAAAA,EAAE,EAAE,MAFsC;AAG1CC,EAAAA,MAAM,EAAE,MAHkC;AAI1CC,EAAAA,OAAO,EAAEV,OAJiC;AAK1CW,EAAAA,UAAU,EAAE,CAAC,MAAD,EAAS,SAAT,CAL8B;AAM1CC,EAAAA,SAAS,EAAE,CAAC,kBAAD,CAN+B;AAO1CC,EAAAA,QAAQ,EAAE,OAPgC;AAQ1CC,EAAAA,IAAI,EAAE,IARoC;AAS1CC,EAAAA,KAAK,EAALA,KAT0C;AAU1CC,EAAAA,aAAa,EAAbA,aAV0C;AAW1CC,EAAAA,cAAc,EAAdA,cAX0C;AAY1CC,EAAAA,OAAO,EAAEjB;AAZiC,CAArC;;;SAeQc,K;;;;;qEAAf,iBAAqBI,WAArB,EAA+CD,OAA/C;AAAA;AAAA;AAAA;AAAA;AAAA,6CACSF,aAAa,CAAC,IAAII,WAAJ,GAAkBC,MAAlB,CAAyBF,WAAzB,CAAD,EAAwCD,OAAxC,CADtB;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAIA,SAASF,aAAT,CAAuBF,IAAvB,EAAqCI,OAArC,EAAkE;AAChE,MAAMI,WAAW,mCAAOJ,OAAP;AAAgBhB,IAAAA,IAAI,kCAAMD,2BAA2B,CAACC,IAAlC,GAA2CgB,OAA3C,aAA2CA,OAA3C,uBAA2CA,OAAO,CAAEhB,IAApD;AAApB,IAAjB;;AACA,SAAO,wBAAcY,IAAd,EAAoBQ,WAApB,CAAP;AACD;;AAED,SAASL,cAAT,CACEM,aADF,EAEEL,OAFF,EAGwB;AACtB,MAAMI,WAAW,mCAAOJ,OAAP;AAAgBhB,IAAAA,IAAI,kCAAMD,2BAA2B,CAACC,IAAlC,GAA2CgB,OAA3C,aAA2CA,OAA3C,uBAA2CA,OAAO,CAAEhB,IAApD;AAApB,IAAjB;;AACA,SAAO,iCAAmBqB,aAAnB,EAAkCD,WAAlC,CAAP;AACD","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"],"file":"json-loader.js"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports._typecheckNDJSONLoader = exports.NDJSONLoader = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _parseNdjson = _interopRequireDefault(require("./lib/parse-ndjson"));
|
|
15
|
+
|
|
16
|
+
var _parseNdjsonInBatches = _interopRequireDefault(require("./lib/parse-ndjson-in-batches"));
|
|
17
|
+
|
|
18
|
+
var VERSION = typeof "3.2.0-alpha.2" !== 'undefined' ? "3.2.0-alpha.2" : 'latest';
|
|
19
|
+
var DEFAULT_NDGEOJSON_LOADER_OPTIONS = {
|
|
20
|
+
geojson: {
|
|
21
|
+
shape: 'object-row-table'
|
|
22
|
+
},
|
|
23
|
+
gis: {
|
|
24
|
+
format: 'geojson'
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var NDJSONLoader = {
|
|
28
|
+
name: 'NDJSON',
|
|
29
|
+
id: 'ndjson',
|
|
30
|
+
module: 'json',
|
|
31
|
+
version: VERSION,
|
|
32
|
+
extensions: ['ndjson', 'ndgeojson'],
|
|
33
|
+
mimeTypes: ['application/geo+x-ndjson', 'application/geo+x-ldjson', 'application/jsonlines', 'application/geo+json-seq', 'application/x-ndjson'],
|
|
34
|
+
category: 'table',
|
|
35
|
+
text: true,
|
|
36
|
+
parse: function () {
|
|
37
|
+
var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer) {
|
|
38
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
39
|
+
while (1) {
|
|
40
|
+
switch (_context.prev = _context.next) {
|
|
41
|
+
case 0:
|
|
42
|
+
return _context.abrupt("return", (0, _parseNdjson.default)(new TextDecoder().decode(arrayBuffer)));
|
|
43
|
+
|
|
44
|
+
case 1:
|
|
45
|
+
case "end":
|
|
46
|
+
return _context.stop();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, _callee);
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
function parse(_x) {
|
|
53
|
+
return _parse.apply(this, arguments);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return parse;
|
|
57
|
+
}(),
|
|
58
|
+
parseTextSync: _parseNdjson.default,
|
|
59
|
+
parseInBatches: _parseNdjsonInBatches.default,
|
|
60
|
+
options: DEFAULT_NDGEOJSON_LOADER_OPTIONS
|
|
61
|
+
};
|
|
62
|
+
exports.NDJSONLoader = NDJSONLoader;
|
|
63
|
+
var _typecheckNDJSONLoader = NDJSONLoader;
|
|
64
|
+
exports._typecheckNDJSONLoader = _typecheckNDJSONLoader;
|
|
65
|
+
//# sourceMappingURL=ndjgeoson-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ndjgeoson-loader.ts"],"names":["VERSION","DEFAULT_NDGEOJSON_LOADER_OPTIONS","geojson","shape","gis","format","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","arrayBuffer","TextDecoder","decode","parseTextSync","parseNDJSONSync","parseInBatches","parseNDJSONInBatches","options","_typecheckNDJSONLoader"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAWA,IAAMC,gCAAgC,GAAG;AACvCC,EAAAA,OAAO,EAAE;AACPC,IAAAA,KAAK,EAAE;AADA,GAD8B;AAIvCC,EAAAA,GAAG,EAAE;AACHC,IAAAA,MAAM,EAAE;AADL;AAJkC,CAAzC;AASO,IAAMC,YAAY,GAAG;AAC1BC,EAAAA,IAAI,EAAE,QADoB;AAE1BC,EAAAA,EAAE,EAAE,QAFsB;AAG1BC,EAAAA,MAAM,EAAE,MAHkB;AAI1BC,EAAAA,OAAO,EAAEV,OAJiB;AAK1BW,EAAAA,UAAU,EAAE,CAAC,QAAD,EAAW,WAAX,CALc;AAM1BC,EAAAA,SAAS,EAAE,CACT,0BADS,EAET,0BAFS,EAGT,uBAHS,EAIT,0BAJS,EAKT,sBALS,CANe;AAa1BC,EAAAA,QAAQ,EAAE,OAbgB;AAc1BC,EAAAA,IAAI,EAAE,IAdoB;AAe1BC,EAAAA,KAAK;AAAA,2EAAE,iBAAOC,WAAP;AAAA;AAAA;AAAA;AAAA;AAAA,+CAAoC,0BAAgB,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBF,WAAzB,CAAhB,CAApC;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAF;;AAAA;AAAA;AAAA;;AAAA;AAAA,KAfqB;AAgB1BG,EAAAA,aAAa,EAAEC,oBAhBW;AAiB1BC,EAAAA,cAAc,EAAEC,6BAjBU;AAkB1BC,EAAAA,OAAO,EAAEtB;AAlBiB,CAArB;;AAqBA,IAAMuB,sBAAwC,GAAGlB,YAAjD","sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport parseNDJSONSync from './lib/parse-ndjson';\nimport parseNDJSONInBatches from './lib/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"],"file":"ndjgeoson-loader.js"}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.NDJSONLoader = void 0;
|
|
9
9
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
|
|
@@ -15,53 +15,41 @@ var _parseNdjson = _interopRequireDefault(require("./lib/parse-ndjson"));
|
|
|
15
15
|
|
|
16
16
|
var _parseNdjsonInBatches = _interopRequireDefault(require("./lib/parse-ndjson-in-batches"));
|
|
17
17
|
|
|
18
|
-
var VERSION = typeof "3.
|
|
18
|
+
var VERSION = typeof "3.2.0-alpha.2" !== 'undefined' ? "3.2.0-alpha.2" : 'latest';
|
|
19
19
|
var NDJSONLoader = {
|
|
20
20
|
name: 'NDJSON',
|
|
21
21
|
id: 'ndjson',
|
|
22
22
|
module: 'json',
|
|
23
23
|
version: VERSION,
|
|
24
|
-
extensions: ['ndjson'],
|
|
25
|
-
mimeTypes: ['application/x-ndjson'],
|
|
24
|
+
extensions: ['ndjson', 'jsonl'],
|
|
25
|
+
mimeTypes: ['application/x-ndjson', 'application/jsonlines', 'application/json-seq'],
|
|
26
26
|
category: 'table',
|
|
27
27
|
text: true,
|
|
28
|
-
parse:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
_parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer) {
|
|
41
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
42
|
-
while (1) {
|
|
43
|
-
switch (_context.prev = _context.next) {
|
|
44
|
-
case 0:
|
|
45
|
-
return _context.abrupt("return", parseTextSync(new TextDecoder().decode(arrayBuffer)));
|
|
46
|
-
|
|
47
|
-
case 1:
|
|
48
|
-
case "end":
|
|
49
|
-
return _context.stop();
|
|
28
|
+
parse: function () {
|
|
29
|
+
var _parse = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer) {
|
|
30
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
31
|
+
while (1) {
|
|
32
|
+
switch (_context.prev = _context.next) {
|
|
33
|
+
case 0:
|
|
34
|
+
return _context.abrupt("return", (0, _parseNdjson.default)(new TextDecoder().decode(arrayBuffer)));
|
|
35
|
+
|
|
36
|
+
case 1:
|
|
37
|
+
case "end":
|
|
38
|
+
return _context.stop();
|
|
39
|
+
}
|
|
50
40
|
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}));
|
|
54
|
-
return _parse.apply(this, arguments);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function parseTextSync(text) {
|
|
58
|
-
return (0, _parseNdjson.default)(text);
|
|
59
|
-
}
|
|
41
|
+
}, _callee);
|
|
42
|
+
}));
|
|
60
43
|
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
}
|
|
44
|
+
function parse(_x) {
|
|
45
|
+
return _parse.apply(this, arguments);
|
|
46
|
+
}
|
|
64
47
|
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
return parse;
|
|
49
|
+
}(),
|
|
50
|
+
parseTextSync: _parseNdjson.default,
|
|
51
|
+
parseInBatches: _parseNdjsonInBatches.default,
|
|
52
|
+
options: {}
|
|
53
|
+
};
|
|
54
|
+
exports.NDJSONLoader = NDJSONLoader;
|
|
67
55
|
//# sourceMappingURL=ndjson-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ndjson-loader.ts"],"names":["VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","
|
|
1
|
+
{"version":3,"sources":["../../src/ndjson-loader.ts"],"names":["VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","arrayBuffer","TextDecoder","decode","parseTextSync","parseNDJSONSync","parseInBatches","parseNDJSONInBatches","options"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAEO,IAAMC,YAAY,GAAG;AAC1BC,EAAAA,IAAI,EAAE,QADoB;AAE1BC,EAAAA,EAAE,EAAE,QAFsB;AAG1BC,EAAAA,MAAM,EAAE,MAHkB;AAI1BC,EAAAA,OAAO,EAAEL,OAJiB;AAK1BM,EAAAA,UAAU,EAAE,CAAC,QAAD,EAAW,OAAX,CALc;AAM1BC,EAAAA,SAAS,EAAE,CACT,sBADS,EAET,uBAFS,EAGT,sBAHS,CANe;AAW1BC,EAAAA,QAAQ,EAAE,OAXgB;AAY1BC,EAAAA,IAAI,EAAE,IAZoB;AAa1BC,EAAAA,KAAK;AAAA,2EAAE,iBAAOC,WAAP;AAAA;AAAA;AAAA;AAAA;AAAA,+CAAoC,0BAAgB,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBF,WAAzB,CAAhB,CAApC;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAAF;;AAAA;AAAA;AAAA;;AAAA;AAAA,KAbqB;AAc1BG,EAAAA,aAAa,EAAEC,oBAdW;AAe1BC,EAAAA,cAAc,EAAEC,6BAfU;AAgB1BC,EAAAA,OAAO,EAAE;AAhBiB,CAArB","sourcesContent":["import parseNDJSONSync from './lib/parse-ndjson';\nimport parseNDJSONInBatches from './lib/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 = {\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"],"file":"ndjson-loader.js"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
2
2
|
import parseJSONSync from './lib/parse-json';
|
|
3
3
|
import parseJSONInBatches from './lib/parse-json-in-batches';
|
|
4
|
-
const VERSION = typeof "3.
|
|
4
|
+
const VERSION = typeof "3.2.0-alpha.2" !== 'undefined' ? "3.2.0-alpha.2" : 'latest';
|
|
5
5
|
const DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
6
6
|
geojson: {
|
|
7
7
|
shape: 'object-row-table'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/geojson-loader.ts"],"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","asyncIterator","geojsonIterator","makeBinaryGeometryIterator","batch","data"],"mappings":"AAEA,SAAQA,eAAR,QAA8B,iBAA9B;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,OAAOC,kBAAP,MAA+B,6BAA/B;AAIA,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../src/geojson-loader.ts"],"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","asyncIterator","geojsonIterator","makeBinaryGeometryIterator","batch","data"],"mappings":"AAEA,SAAQA,eAAR,QAA8B,iBAA9B;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,OAAOC,kBAAP,MAA+B,6BAA/B;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAWA,MAAMC,8BAA8B,GAAG;AACrCC,EAAAA,OAAO,EAAE;AACPC,IAAAA,KAAK,EAAE;AADA,GAD4B;AAIrCC,EAAAA,IAAI,EAAE;AACJC,IAAAA,SAAS,EAAE,CAAC,GAAD,EAAM,YAAN;AADP,GAJ+B;AAOrCC,EAAAA,GAAG,EAAE;AACHC,IAAAA,MAAM,EAAE;AADL;AAPgC,CAAvC;AAeA,OAAO,MAAMC,mBAA2B,GAAG;AACzCC,EAAAA,IAAI,EAAE,SADmC;AAEzCC,EAAAA,EAAE,EAAE,SAFqC;AAGzCC,EAAAA,MAAM,EAAE,SAHiC;AAIzCC,EAAAA,OAAO,EAAEZ,OAJgC;AAKzCa,EAAAA,MAAM,EAAE,IALiC;AAMzCC,EAAAA,UAAU,EAAE,CAAC,SAAD,CAN6B;AAOzCC,EAAAA,SAAS,EAAE,CAAC,sBAAD,CAP8B;AAQzCC,EAAAA,QAAQ,EAAE,UAR+B;AASzCC,EAAAA,IAAI,EAAE,IATmC;AAUzCC,EAAAA,OAAO,EAAEjB;AAVgC,CAApC;AAaP,OAAO,MAAMkB,aAA+B,GAAG,EAC7C,GAAGX,mBAD0C;AAE7CY,EAAAA,KAF6C;AAG7CC,EAAAA,aAH6C;AAI7CC,EAAAA;AAJ6C,CAAxC;;AAOP,eAAeF,KAAf,CAAqBG,WAArB,EAAkCL,OAAlC,EAA2C;AACzC,SAAOG,aAAa,CAAC,IAAIG,WAAJ,GAAkBC,MAAlB,CAAyBF,WAAzB,CAAD,EAAwCL,OAAxC,CAApB;AACD;;AAED,SAASG,aAAT,CAAuBJ,IAAvB,EAA6BC,OAA7B,EAAsC;AAEpCA,EAAAA,OAAO,GAAG,EAAC,GAAGjB,8BAAJ;AAAoC,OAAGiB;AAAvC,GAAV;AACAA,EAAAA,OAAO,CAACd,IAAR,GAAe,EAAC,GAAGH,8BAA8B,CAACC,OAAnC;AAA4C,OAAGgB,OAAO,CAAChB;AAAvD,GAAf;AACAgB,EAAAA,OAAO,CAACZ,GAAR,GAAcY,OAAO,CAACZ,GAAR,IAAe,EAA7B;AACA,QAAMF,IAAI,GAAGN,aAAa,CAACmB,IAAD,EAAOC,OAAP,CAA1B;;AACA,UAAQA,OAAO,CAACZ,GAAR,CAAYC,MAApB;AACE,SAAK,QAAL;AACE,aAAOV,eAAe,CAACO,IAAD,CAAtB;;AACF;AACE,aAAOA,IAAP;AAJJ;AAMD;;AAED,SAASkB,cAAT,CAAwBI,aAAxB,EAAuCR,OAAvC,EAAoE;AAElEA,EAAAA,OAAO,GAAG,EAAC,GAAGjB,8BAAJ;AAAoC,OAAGiB;AAAvC,GAAV;AACAA,EAAAA,OAAO,CAACd,IAAR,GAAe,EAAC,GAAGH,8BAA8B,CAACC,OAAnC;AAA4C,OAAGgB,OAAO,CAAChB;AAAvD,GAAf;AAEA,QAAMyB,eAAe,GAAG5B,kBAAkB,CAAC2B,aAAD,EAAgBR,OAAhB,CAA1C;;AAEA,UAAQA,OAAO,CAACZ,GAAR,CAAYC,MAApB;AACE,SAAK,QAAL;AACE,aAAOqB,0BAA0B,CAACD,eAAD,CAAjC;;AACF;AACE,aAAOA,eAAP;AAJJ;AAMD;;AAED,gBAAgBC,0BAAhB,CAA2CD,eAA3C,EAA4D;AAC1D,aAAW,MAAME,KAAjB,IAA0BF,eAA1B,EAA2C;AACzCE,IAAAA,KAAK,CAACC,IAAN,GAAajC,eAAe,CAACgC,KAAK,CAACC,IAAP,CAA5B;AACA,UAAMD,KAAN;AACD;AACF","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"],"file":"geojson-loader.js"}
|
package/dist/esm/json-loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import parseJSONSync from './lib/parse-json';
|
|
2
2
|
import parseJSONInBatches from './lib/parse-json-in-batches';
|
|
3
|
-
const VERSION = typeof "3.
|
|
3
|
+
const VERSION = typeof "3.2.0-alpha.2" !== 'undefined' ? "3.2.0-alpha.2" : 'latest';
|
|
4
4
|
const DEFAULT_JSON_LOADER_OPTIONS = {
|
|
5
5
|
json: {
|
|
6
6
|
shape: 'row-table',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/json-loader.ts"],"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"],"mappings":"AAEA,OAAOA,aAAP,MAA0B,kBAA1B;AACA,OAAOC,kBAAP,MAA+B,6BAA/B;AAIA,MAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../../src/json-loader.ts"],"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"],"mappings":"AAEA,OAAOA,aAAP,MAA0B,kBAA1B;AACA,OAAOC,kBAAP,MAA+B,6BAA/B;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAcA,MAAMC,2BAA2B,GAAG;AAClCC,EAAAA,IAAI,EAAE;AACJC,IAAAA,KAAK,EAAE,WADH;AAEJC,IAAAA,KAAK,EAAE,KAFH;AAGJC,IAAAA,SAAS,EAAE;AAHP;AAD4B,CAApC;AASA,OAAO,MAAMC,UAA4B,GAAG;AAC1CC,EAAAA,IAAI,EAAE,MADoC;AAE1CC,EAAAA,EAAE,EAAE,MAFsC;AAG1CC,EAAAA,MAAM,EAAE,MAHkC;AAI1CC,EAAAA,OAAO,EAAEV,OAJiC;AAK1CW,EAAAA,UAAU,EAAE,CAAC,MAAD,EAAS,SAAT,CAL8B;AAM1CC,EAAAA,SAAS,EAAE,CAAC,kBAAD,CAN+B;AAO1CC,EAAAA,QAAQ,EAAE,OAPgC;AAQ1CC,EAAAA,IAAI,EAAE,IARoC;AAS1CC,EAAAA,KAT0C;AAU1CC,EAAAA,aAV0C;AAW1CC,EAAAA,cAX0C;AAY1CC,EAAAA,OAAO,EAAEjB;AAZiC,CAArC;;AAeP,eAAec,KAAf,CAAqBI,WAArB,EAA+CD,OAA/C,EAA4E;AAC1E,SAAOF,aAAa,CAAC,IAAII,WAAJ,GAAkBC,MAAlB,CAAyBF,WAAzB,CAAD,EAAwCD,OAAxC,CAApB;AACD;;AAED,SAASF,aAAT,CAAuBF,IAAvB,EAAqCI,OAArC,EAAkE;AAChE,QAAMI,WAAW,GAAG,EAAC,GAAGJ,OAAJ;AAAahB,IAAAA,IAAI,EAAE,EAAC,GAAGD,2BAA2B,CAACC,IAAhC;AAAsC,UAAGgB,OAAH,aAAGA,OAAH,uBAAGA,OAAO,CAAEhB,IAAZ;AAAtC;AAAnB,GAApB;AACA,SAAOJ,aAAa,CAACgB,IAAD,EAAOQ,WAAP,CAApB;AACD;;AAED,SAASL,cAAT,CACEM,aADF,EAEEL,OAFF,EAGwB;AACtB,QAAMI,WAAW,GAAG,EAAC,GAAGJ,OAAJ;AAAahB,IAAAA,IAAI,EAAE,EAAC,GAAGD,2BAA2B,CAACC,IAAhC;AAAsC,UAAGgB,OAAH,aAAGA,OAAH,uBAAGA,OAAO,CAAEhB,IAAZ;AAAtC;AAAnB,GAApB;AACA,SAAOH,kBAAkB,CAACwB,aAAD,EAAgBD,WAAhB,CAAzB;AACD","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"],"file":"json-loader.js"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import parseNDJSONSync from './lib/parse-ndjson';
|
|
2
|
+
import parseNDJSONInBatches from './lib/parse-ndjson-in-batches';
|
|
3
|
+
const VERSION = typeof "3.2.0-alpha.2" !== 'undefined' ? "3.2.0-alpha.2" : 'latest';
|
|
4
|
+
const DEFAULT_NDGEOJSON_LOADER_OPTIONS = {
|
|
5
|
+
geojson: {
|
|
6
|
+
shape: 'object-row-table'
|
|
7
|
+
},
|
|
8
|
+
gis: {
|
|
9
|
+
format: 'geojson'
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export const NDJSONLoader = {
|
|
13
|
+
name: 'NDJSON',
|
|
14
|
+
id: 'ndjson',
|
|
15
|
+
module: 'json',
|
|
16
|
+
version: VERSION,
|
|
17
|
+
extensions: ['ndjson', 'ndgeojson'],
|
|
18
|
+
mimeTypes: ['application/geo+x-ndjson', 'application/geo+x-ldjson', 'application/jsonlines', 'application/geo+json-seq', 'application/x-ndjson'],
|
|
19
|
+
category: 'table',
|
|
20
|
+
text: true,
|
|
21
|
+
parse: async arrayBuffer => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),
|
|
22
|
+
parseTextSync: parseNDJSONSync,
|
|
23
|
+
parseInBatches: parseNDJSONInBatches,
|
|
24
|
+
options: DEFAULT_NDGEOJSON_LOADER_OPTIONS
|
|
25
|
+
};
|
|
26
|
+
export const _typecheckNDJSONLoader = NDJSONLoader;
|
|
27
|
+
//# sourceMappingURL=ndjgeoson-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ndjgeoson-loader.ts"],"names":["parseNDJSONSync","parseNDJSONInBatches","VERSION","DEFAULT_NDGEOJSON_LOADER_OPTIONS","geojson","shape","gis","format","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","arrayBuffer","TextDecoder","decode","parseTextSync","parseInBatches","options","_typecheckNDJSONLoader"],"mappings":"AACA,OAAOA,eAAP,MAA4B,oBAA5B;AACA,OAAOC,oBAAP,MAAiC,+BAAjC;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAWA,MAAMC,gCAAgC,GAAG;AACvCC,EAAAA,OAAO,EAAE;AACPC,IAAAA,KAAK,EAAE;AADA,GAD8B;AAIvCC,EAAAA,GAAG,EAAE;AACHC,IAAAA,MAAM,EAAE;AADL;AAJkC,CAAzC;AASA,OAAO,MAAMC,YAAY,GAAG;AAC1BC,EAAAA,IAAI,EAAE,QADoB;AAE1BC,EAAAA,EAAE,EAAE,QAFsB;AAG1BC,EAAAA,MAAM,EAAE,MAHkB;AAI1BC,EAAAA,OAAO,EAAEV,OAJiB;AAK1BW,EAAAA,UAAU,EAAE,CAAC,QAAD,EAAW,WAAX,CALc;AAM1BC,EAAAA,SAAS,EAAE,CACT,0BADS,EAET,0BAFS,EAGT,uBAHS,EAIT,0BAJS,EAKT,sBALS,CANe;AAa1BC,EAAAA,QAAQ,EAAE,OAbgB;AAc1BC,EAAAA,IAAI,EAAE,IAdoB;AAe1BC,EAAAA,KAAK,EAAE,MAAOC,WAAP,IAAoClB,eAAe,CAAC,IAAImB,WAAJ,GAAkBC,MAAlB,CAAyBF,WAAzB,CAAD,CAfhC;AAgB1BG,EAAAA,aAAa,EAAErB,eAhBW;AAiB1BsB,EAAAA,cAAc,EAAErB,oBAjBU;AAkB1BsB,EAAAA,OAAO,EAAEpB;AAlBiB,CAArB;AAqBP,OAAO,MAAMqB,sBAAwC,GAAGhB,YAAjD","sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport parseNDJSONSync from './lib/parse-ndjson';\nimport parseNDJSONInBatches from './lib/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"],"file":"ndjgeoson-loader.js"}
|
|
@@ -1,32 +1,18 @@
|
|
|
1
1
|
import parseNDJSONSync from './lib/parse-ndjson';
|
|
2
2
|
import parseNDJSONInBatches from './lib/parse-ndjson-in-batches';
|
|
3
|
-
const VERSION = typeof "3.
|
|
3
|
+
const VERSION = typeof "3.2.0-alpha.2" !== 'undefined' ? "3.2.0-alpha.2" : 'latest';
|
|
4
4
|
export const NDJSONLoader = {
|
|
5
5
|
name: 'NDJSON',
|
|
6
6
|
id: 'ndjson',
|
|
7
7
|
module: 'json',
|
|
8
8
|
version: VERSION,
|
|
9
|
-
extensions: ['ndjson'],
|
|
10
|
-
mimeTypes: ['application/x-ndjson'],
|
|
9
|
+
extensions: ['ndjson', 'jsonl'],
|
|
10
|
+
mimeTypes: ['application/x-ndjson', 'application/jsonlines', 'application/json-seq'],
|
|
11
11
|
category: 'table',
|
|
12
12
|
text: true,
|
|
13
|
-
parse,
|
|
14
|
-
parseTextSync,
|
|
15
|
-
parseInBatches,
|
|
13
|
+
parse: async arrayBuffer => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),
|
|
14
|
+
parseTextSync: parseNDJSONSync,
|
|
15
|
+
parseInBatches: parseNDJSONInBatches,
|
|
16
16
|
options: {}
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
async function parse(arrayBuffer) {
|
|
20
|
-
return parseTextSync(new TextDecoder().decode(arrayBuffer));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function parseTextSync(text) {
|
|
24
|
-
return parseNDJSONSync(text);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function parseInBatches(asyncIterator, options) {
|
|
28
|
-
return parseNDJSONInBatches(asyncIterator, options);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const _typecheckNDJSONLoader = NDJSONLoader;
|
|
32
18
|
//# sourceMappingURL=ndjson-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ndjson-loader.ts"],"names":["parseNDJSONSync","parseNDJSONInBatches","VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","
|
|
1
|
+
{"version":3,"sources":["../../src/ndjson-loader.ts"],"names":["parseNDJSONSync","parseNDJSONInBatches","VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","arrayBuffer","TextDecoder","decode","parseTextSync","parseInBatches","options"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,oBAA5B;AACA,OAAOC,oBAAP,MAAiC,+BAAjC;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAEA,OAAO,MAAMC,YAAY,GAAG;AAC1BC,EAAAA,IAAI,EAAE,QADoB;AAE1BC,EAAAA,EAAE,EAAE,QAFsB;AAG1BC,EAAAA,MAAM,EAAE,MAHkB;AAI1BC,EAAAA,OAAO,EAAEL,OAJiB;AAK1BM,EAAAA,UAAU,EAAE,CAAC,QAAD,EAAW,OAAX,CALc;AAM1BC,EAAAA,SAAS,EAAE,CACT,sBADS,EAET,uBAFS,EAGT,sBAHS,CANe;AAW1BC,EAAAA,QAAQ,EAAE,OAXgB;AAY1BC,EAAAA,IAAI,EAAE,IAZoB;AAa1BC,EAAAA,KAAK,EAAE,MAAOC,WAAP,IAAoCb,eAAe,CAAC,IAAIc,WAAJ,GAAkBC,MAAlB,CAAyBF,WAAzB,CAAD,CAbhC;AAc1BG,EAAAA,aAAa,EAAEhB,eAdW;AAe1BiB,EAAAA,cAAc,EAAEhB,oBAfU;AAgB1BiB,EAAAA,OAAO,EAAE;AAhBiB,CAArB","sourcesContent":["import parseNDJSONSync from './lib/parse-ndjson';\nimport parseNDJSONInBatches from './lib/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 = {\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"],"file":"ndjson-loader.js"}
|
package/dist/geojson-loader.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson-loader.d.ts","sourceRoot":"","sources":["../src/geojson-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AASrD,oBAAY,oBAAoB,GAAG,iBAAiB,GAAG;IACrD,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,kBAAkB,CAAC;KAC5B,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,MAAM,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"geojson-loader.d.ts","sourceRoot":"","sources":["../src/geojson-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AASrD,oBAAY,oBAAoB,GAAG,iBAAiB,GAAG;IACrD,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,kBAAkB,CAAC;KAC5B,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;KAC/B,CAAC;CACH,CAAC;AAcF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAWjC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,gBAK3B,CAAC"}
|
package/dist/geojson-worker.js
CHANGED
|
@@ -35,16 +35,33 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// ../worker-utils/src/lib/worker-farm/worker-body.ts
|
|
38
|
+
function getParentPort() {
|
|
39
|
+
let parentPort;
|
|
40
|
+
try {
|
|
41
|
+
eval("globalThis.parentPort = require('worker_threads').parentPort");
|
|
42
|
+
parentPort = globalThis.parentPort;
|
|
43
|
+
} catch {
|
|
44
|
+
}
|
|
45
|
+
return parentPort;
|
|
46
|
+
}
|
|
38
47
|
var onMessageWrapperMap = new Map();
|
|
39
48
|
var WorkerBody = class {
|
|
49
|
+
static inWorkerThread() {
|
|
50
|
+
return typeof self !== "undefined" || Boolean(getParentPort());
|
|
51
|
+
}
|
|
40
52
|
static set onmessage(onMessage) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
const { type, payload } = message.data;
|
|
53
|
+
function handleMessage(message) {
|
|
54
|
+
const parentPort3 = getParentPort();
|
|
55
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
46
56
|
onMessage(type, payload);
|
|
47
|
-
}
|
|
57
|
+
}
|
|
58
|
+
const parentPort2 = getParentPort();
|
|
59
|
+
if (parentPort2) {
|
|
60
|
+
parentPort2.on("message", handleMessage);
|
|
61
|
+
parentPort2.on("exit", () => console.debug("Node worker closing"));
|
|
62
|
+
} else {
|
|
63
|
+
globalThis.onmessage = handleMessage;
|
|
64
|
+
}
|
|
48
65
|
}
|
|
49
66
|
static addEventListener(onMessage) {
|
|
50
67
|
let onMessageWrapper = onMessageWrapperMap.get(onMessage);
|
|
@@ -53,22 +70,36 @@
|
|
|
53
70
|
if (!isKnownMessage(message)) {
|
|
54
71
|
return;
|
|
55
72
|
}
|
|
56
|
-
const
|
|
73
|
+
const parentPort3 = getParentPort();
|
|
74
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
57
75
|
onMessage(type, payload);
|
|
58
76
|
};
|
|
59
77
|
}
|
|
60
|
-
|
|
78
|
+
const parentPort2 = getParentPort();
|
|
79
|
+
if (parentPort2) {
|
|
80
|
+
console.error("not implemented");
|
|
81
|
+
} else {
|
|
82
|
+
globalThis.addEventListener("message", onMessageWrapper);
|
|
83
|
+
}
|
|
61
84
|
}
|
|
62
85
|
static removeEventListener(onMessage) {
|
|
63
86
|
const onMessageWrapper = onMessageWrapperMap.get(onMessage);
|
|
64
87
|
onMessageWrapperMap.delete(onMessage);
|
|
65
|
-
|
|
88
|
+
const parentPort2 = getParentPort();
|
|
89
|
+
if (parentPort2) {
|
|
90
|
+
console.error("not implemented");
|
|
91
|
+
} else {
|
|
92
|
+
globalThis.removeEventListener("message", onMessageWrapper);
|
|
93
|
+
}
|
|
66
94
|
}
|
|
67
95
|
static postMessage(type, payload) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
96
|
+
const data = { source: "loaders.gl", type, payload };
|
|
97
|
+
const transferList = getTransferList(payload);
|
|
98
|
+
const parentPort2 = getParentPort();
|
|
99
|
+
if (parentPort2) {
|
|
100
|
+
parentPort2.postMessage(data, transferList);
|
|
101
|
+
} else {
|
|
102
|
+
globalThis.postMessage(data, transferList);
|
|
72
103
|
}
|
|
73
104
|
}
|
|
74
105
|
};
|
|
@@ -80,7 +111,7 @@
|
|
|
80
111
|
// ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
|
|
81
112
|
var requestId = 0;
|
|
82
113
|
function createLoaderWorker(loader) {
|
|
83
|
-
if (
|
|
114
|
+
if (!WorkerBody.inWorkerThread()) {
|
|
84
115
|
return;
|
|
85
116
|
}
|
|
86
117
|
WorkerBody.onmessage = async (type, payload) => {
|
|
@@ -2235,7 +2266,7 @@ Char: ${this.c}`;
|
|
|
2235
2266
|
}
|
|
2236
2267
|
|
|
2237
2268
|
// src/geojson-loader.ts
|
|
2238
|
-
var VERSION = true ? "3.
|
|
2269
|
+
var VERSION = true ? "3.2.0-alpha.2" : "latest";
|
|
2239
2270
|
var DEFAULT_GEOJSON_LOADER_OPTIONS = {
|
|
2240
2271
|
geojson: {
|
|
2241
2272
|
shape: "object-row-table"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-loader.d.ts","sourceRoot":"","sources":["../src/json-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAQ9E;;;GAGG;AACH,oBAAY,iBAAiB,GAAG,aAAa,GAAG;IAC9C,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC;CACH,CAAC;AAWF,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"json-loader.d.ts","sourceRoot":"","sources":["../src/json-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAQ9E;;;GAGG;AACH,oBAAY,iBAAiB,GAAG,aAAa,GAAG;IAC9C,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC;CACH,CAAC;AAWF,eAAO,MAAM,UAAU,EAAE,gBAaxB,CAAC"}
|
package/dist/json-loader.js
CHANGED
|
@@ -24,19 +24,6 @@ exports.JSONLoader = {
|
|
|
24
24
|
version: VERSION,
|
|
25
25
|
extensions: ['json', 'geojson'],
|
|
26
26
|
mimeTypes: ['application/json'],
|
|
27
|
-
// TODO - support various line based JSON formats
|
|
28
|
-
/*
|
|
29
|
-
extensions: {
|
|
30
|
-
json: null,
|
|
31
|
-
jsonl: {stream: true},
|
|
32
|
-
ndjson: {stream: true}
|
|
33
|
-
},
|
|
34
|
-
mimeTypes: {
|
|
35
|
-
'application/json': null,
|
|
36
|
-
'application/json-seq': {stream: true},
|
|
37
|
-
'application/x-ndjson': {stream: true}
|
|
38
|
-
},
|
|
39
|
-
*/
|
|
40
27
|
category: 'table',
|
|
41
28
|
text: true,
|
|
42
29
|
parse,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
+
import parseNDJSONSync from './lib/parse-ndjson';
|
|
3
|
+
import parseNDJSONInBatches from './lib/parse-ndjson-in-batches';
|
|
4
|
+
export declare type NDGeoJSONLoaderOptions = LoaderOptions & {
|
|
5
|
+
geojson?: {
|
|
6
|
+
shape?: 'object-row-table';
|
|
7
|
+
};
|
|
8
|
+
gis?: {
|
|
9
|
+
format: 'geojson';
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const NDJSONLoader: {
|
|
13
|
+
name: string;
|
|
14
|
+
id: string;
|
|
15
|
+
module: string;
|
|
16
|
+
version: any;
|
|
17
|
+
extensions: string[];
|
|
18
|
+
mimeTypes: string[];
|
|
19
|
+
category: string;
|
|
20
|
+
text: boolean;
|
|
21
|
+
parse: (arrayBuffer: ArrayBuffer) => Promise<any[]>;
|
|
22
|
+
parseTextSync: typeof parseNDJSONSync;
|
|
23
|
+
parseInBatches: typeof parseNDJSONInBatches;
|
|
24
|
+
options: {
|
|
25
|
+
geojson: {
|
|
26
|
+
shape: string;
|
|
27
|
+
};
|
|
28
|
+
gis: {
|
|
29
|
+
format: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare const _typecheckNDJSONLoader: LoaderWithParser;
|
|
34
|
+
//# sourceMappingURL=ndjgeoson-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ndjgeoson-loader.d.ts","sourceRoot":"","sources":["../src/ndjgeoson-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC9E,OAAO,eAAe,MAAM,oBAAoB,CAAC;AACjD,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AAMjE,oBAAY,sBAAsB,GAAG,aAAa,GAAG;IACnD,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,kBAAkB,CAAC;KAC5B,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,MAAM,EAAE,SAAS,CAAC;KACnB,CAAC;CACH,CAAC;AAWF,eAAO,MAAM,YAAY;;;;;;;;;yBAeI,WAAW;;;;;;;;;;;CAIvC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,gBAA+B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports._typecheckNDJSONLoader = exports.NDJSONLoader = void 0;
|
|
7
|
+
const parse_ndjson_1 = __importDefault(require("./lib/parse-ndjson"));
|
|
8
|
+
const parse_ndjson_in_batches_1 = __importDefault(require("./lib/parse-ndjson-in-batches"));
|
|
9
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
10
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
11
|
+
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
12
|
+
const DEFAULT_NDGEOJSON_LOADER_OPTIONS = {
|
|
13
|
+
geojson: {
|
|
14
|
+
shape: 'object-row-table'
|
|
15
|
+
},
|
|
16
|
+
gis: {
|
|
17
|
+
format: 'geojson'
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.NDJSONLoader = {
|
|
21
|
+
name: 'NDJSON',
|
|
22
|
+
id: 'ndjson',
|
|
23
|
+
module: 'json',
|
|
24
|
+
version: VERSION,
|
|
25
|
+
extensions: ['ndjson', 'ndgeojson'],
|
|
26
|
+
mimeTypes: [
|
|
27
|
+
'application/geo+x-ndjson',
|
|
28
|
+
'application/geo+x-ldjson',
|
|
29
|
+
'application/jsonlines',
|
|
30
|
+
'application/geo+json-seq',
|
|
31
|
+
'application/x-ndjson'
|
|
32
|
+
],
|
|
33
|
+
category: 'table',
|
|
34
|
+
text: true,
|
|
35
|
+
parse: async (arrayBuffer) => (0, parse_ndjson_1.default)(new TextDecoder().decode(arrayBuffer)),
|
|
36
|
+
parseTextSync: parse_ndjson_1.default,
|
|
37
|
+
parseInBatches: parse_ndjson_in_batches_1.default,
|
|
38
|
+
options: DEFAULT_NDGEOJSON_LOADER_OPTIONS
|
|
39
|
+
};
|
|
40
|
+
exports._typecheckNDJSONLoader = exports.NDJSONLoader;
|
package/dist/ndjson-loader.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import parseNDJSONSync from './lib/parse-ndjson';
|
|
2
|
+
import parseNDJSONInBatches from './lib/parse-ndjson-in-batches';
|
|
3
3
|
export declare const NDJSONLoader: {
|
|
4
4
|
name: string;
|
|
5
5
|
id: string;
|
|
@@ -9,14 +9,9 @@ export declare const NDJSONLoader: {
|
|
|
9
9
|
mimeTypes: string[];
|
|
10
10
|
category: string;
|
|
11
11
|
text: boolean;
|
|
12
|
-
parse:
|
|
13
|
-
parseTextSync: typeof
|
|
14
|
-
parseInBatches: typeof
|
|
12
|
+
parse: (arrayBuffer: ArrayBuffer) => Promise<any[]>;
|
|
13
|
+
parseTextSync: typeof parseNDJSONSync;
|
|
14
|
+
parseInBatches: typeof parseNDJSONInBatches;
|
|
15
15
|
options: {};
|
|
16
16
|
};
|
|
17
|
-
declare function parse(arrayBuffer: ArrayBuffer): Promise<any[]>;
|
|
18
|
-
declare function parseTextSync(text: string): any[];
|
|
19
|
-
declare function parseInBatches(asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>, options?: LoaderOptions): AsyncIterable<Batch>;
|
|
20
|
-
export declare const _typecheckNDJSONLoader: LoaderWithParser;
|
|
21
|
-
export {};
|
|
22
17
|
//# sourceMappingURL=ndjson-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ndjson-loader.d.ts","sourceRoot":"","sources":["../src/ndjson-loader.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ndjson-loader.d.ts","sourceRoot":"","sources":["../src/ndjson-loader.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,oBAAoB,CAAC;AACjD,OAAO,oBAAoB,MAAM,+BAA+B,CAAC;AAMjE,eAAO,MAAM,YAAY;;;;;;;;;yBAaI,WAAW;;;;CAIvC,CAAC"}
|
package/dist/ndjson-loader.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.NDJSONLoader = void 0;
|
|
7
7
|
const parse_ndjson_1 = __importDefault(require("./lib/parse-ndjson"));
|
|
8
8
|
const parse_ndjson_in_batches_1 = __importDefault(require("./lib/parse-ndjson-in-batches"));
|
|
9
9
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
@@ -14,22 +14,16 @@ exports.NDJSONLoader = {
|
|
|
14
14
|
id: 'ndjson',
|
|
15
15
|
module: 'json',
|
|
16
16
|
version: VERSION,
|
|
17
|
-
extensions: ['ndjson'],
|
|
18
|
-
mimeTypes: [
|
|
17
|
+
extensions: ['ndjson', 'jsonl'],
|
|
18
|
+
mimeTypes: [
|
|
19
|
+
'application/x-ndjson',
|
|
20
|
+
'application/jsonlines',
|
|
21
|
+
'application/json-seq'
|
|
22
|
+
],
|
|
19
23
|
category: 'table',
|
|
20
24
|
text: true,
|
|
21
|
-
parse,
|
|
22
|
-
parseTextSync,
|
|
23
|
-
parseInBatches,
|
|
25
|
+
parse: async (arrayBuffer) => (0, parse_ndjson_1.default)(new TextDecoder().decode(arrayBuffer)),
|
|
26
|
+
parseTextSync: parse_ndjson_1.default,
|
|
27
|
+
parseInBatches: parse_ndjson_in_batches_1.default,
|
|
24
28
|
options: {}
|
|
25
29
|
};
|
|
26
|
-
async function parse(arrayBuffer) {
|
|
27
|
-
return parseTextSync(new TextDecoder().decode(arrayBuffer));
|
|
28
|
-
}
|
|
29
|
-
function parseTextSync(text) {
|
|
30
|
-
return (0, parse_ndjson_1.default)(text);
|
|
31
|
-
}
|
|
32
|
-
function parseInBatches(asyncIterator, options) {
|
|
33
|
-
return (0, parse_ndjson_in_batches_1.default)(asyncIterator, options);
|
|
34
|
-
}
|
|
35
|
-
exports._typecheckNDJSONLoader = exports.NDJSONLoader;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/json",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0-alpha.2",
|
|
4
4
|
"description": "Framework-independent loader for JSON and streaming JSON formats",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"build-worker": "esbuild src/workers/geojson-worker.ts --bundle --outfile=dist/geojson-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@loaders.gl/gis": "3.
|
|
39
|
-
"@loaders.gl/loader-utils": "3.
|
|
40
|
-
"@loaders.gl/schema": "3.
|
|
38
|
+
"@loaders.gl/gis": "3.2.0-alpha.2",
|
|
39
|
+
"@loaders.gl/loader-utils": "3.2.0-alpha.2",
|
|
40
|
+
"@loaders.gl/schema": "3.2.0-alpha.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "52a602739cbfce60fc314f474efc984d199dff78"
|
|
43
43
|
}
|
package/src/geojson-loader.ts
CHANGED
package/src/json-loader.ts
CHANGED
|
@@ -35,19 +35,6 @@ export const JSONLoader: LoaderWithParser = {
|
|
|
35
35
|
version: VERSION,
|
|
36
36
|
extensions: ['json', 'geojson'],
|
|
37
37
|
mimeTypes: ['application/json'],
|
|
38
|
-
// TODO - support various line based JSON formats
|
|
39
|
-
/*
|
|
40
|
-
extensions: {
|
|
41
|
-
json: null,
|
|
42
|
-
jsonl: {stream: true},
|
|
43
|
-
ndjson: {stream: true}
|
|
44
|
-
},
|
|
45
|
-
mimeTypes: {
|
|
46
|
-
'application/json': null,
|
|
47
|
-
'application/json-seq': {stream: true},
|
|
48
|
-
'application/x-ndjson': {stream: true}
|
|
49
|
-
},
|
|
50
|
-
*/
|
|
51
38
|
category: 'table',
|
|
52
39
|
text: true,
|
|
53
40
|
parse,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
2
|
+
import parseNDJSONSync from './lib/parse-ndjson';
|
|
3
|
+
import parseNDJSONInBatches from './lib/parse-ndjson-in-batches';
|
|
4
|
+
|
|
5
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
+
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
8
|
+
|
|
9
|
+
export type NDGeoJSONLoaderOptions = LoaderOptions & {
|
|
10
|
+
geojson?: {
|
|
11
|
+
shape?: 'object-row-table';
|
|
12
|
+
};
|
|
13
|
+
gis?: {
|
|
14
|
+
format: 'geojson';
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const DEFAULT_NDGEOJSON_LOADER_OPTIONS = {
|
|
19
|
+
geojson: {
|
|
20
|
+
shape: 'object-row-table'
|
|
21
|
+
},
|
|
22
|
+
gis: {
|
|
23
|
+
format: 'geojson'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const NDJSONLoader = {
|
|
28
|
+
name: 'NDJSON',
|
|
29
|
+
id: 'ndjson',
|
|
30
|
+
module: 'json',
|
|
31
|
+
version: VERSION,
|
|
32
|
+
extensions: ['ndjson', 'ndgeojson'],
|
|
33
|
+
mimeTypes: [
|
|
34
|
+
'application/geo+x-ndjson',
|
|
35
|
+
'application/geo+x-ldjson',
|
|
36
|
+
'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch
|
|
37
|
+
'application/geo+json-seq',
|
|
38
|
+
'application/x-ndjson'
|
|
39
|
+
],
|
|
40
|
+
category: 'table',
|
|
41
|
+
text: true,
|
|
42
|
+
parse: async (arrayBuffer: ArrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),
|
|
43
|
+
parseTextSync: parseNDJSONSync,
|
|
44
|
+
parseInBatches: parseNDJSONInBatches,
|
|
45
|
+
options: DEFAULT_NDGEOJSON_LOADER_OPTIONS
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const _typecheckNDJSONLoader: LoaderWithParser = NDJSONLoader;
|
package/src/ndjson-loader.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type {Batch} from '@loaders.gl/schema';
|
|
2
|
-
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
3
1
|
import parseNDJSONSync from './lib/parse-ndjson';
|
|
4
2
|
import parseNDJSONInBatches from './lib/parse-ndjson-in-batches';
|
|
5
3
|
|
|
@@ -12,29 +10,16 @@ export const NDJSONLoader = {
|
|
|
12
10
|
id: 'ndjson',
|
|
13
11
|
module: 'json',
|
|
14
12
|
version: VERSION,
|
|
15
|
-
extensions: ['ndjson'],
|
|
16
|
-
mimeTypes: [
|
|
13
|
+
extensions: ['ndjson', 'jsonl'],
|
|
14
|
+
mimeTypes: [
|
|
15
|
+
'application/x-ndjson',
|
|
16
|
+
'application/jsonlines', // https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html#cm-batch
|
|
17
|
+
'application/json-seq'
|
|
18
|
+
],
|
|
17
19
|
category: 'table',
|
|
18
20
|
text: true,
|
|
19
|
-
parse,
|
|
20
|
-
parseTextSync,
|
|
21
|
-
parseInBatches,
|
|
21
|
+
parse: async (arrayBuffer: ArrayBuffer) => parseNDJSONSync(new TextDecoder().decode(arrayBuffer)),
|
|
22
|
+
parseTextSync: parseNDJSONSync,
|
|
23
|
+
parseInBatches: parseNDJSONInBatches,
|
|
22
24
|
options: {}
|
|
23
25
|
};
|
|
24
|
-
|
|
25
|
-
async function parse(arrayBuffer: ArrayBuffer) {
|
|
26
|
-
return parseTextSync(new TextDecoder().decode(arrayBuffer));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function parseTextSync(text: string) {
|
|
30
|
-
return parseNDJSONSync(text);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function parseInBatches(
|
|
34
|
-
asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,
|
|
35
|
-
options?: LoaderOptions
|
|
36
|
-
): AsyncIterable<Batch> {
|
|
37
|
-
return parseNDJSONInBatches(asyncIterator, options);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const _typecheckNDJSONLoader: LoaderWithParser = NDJSONLoader;
|
package/dist/es5/jsonl-loader.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"jsonl-loader.js"}
|
package/dist/esm/jsonl-loader.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"jsonl-loader.js"}
|
package/dist/jsonl-loader.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=jsonl-loader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl-loader.d.ts","sourceRoot":"","sources":["../src/jsonl-loader.ts"],"names":[],"mappings":""}
|
package/dist/jsonl-loader.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* TODO JSONL loader
|
|
3
|
-
export const JSONLoader: LoaderWithParser = {
|
|
4
|
-
name: 'JSON',
|
|
5
|
-
id: 'json',
|
|
6
|
-
module: 'json',
|
|
7
|
-
version: VERSION,
|
|
8
|
-
extensions: ['json', 'geojson'],
|
|
9
|
-
mimeTypes: ['application/json'],
|
|
10
|
-
// TODO - support various line based JSON formats
|
|
11
|
-
/*
|
|
12
|
-
extensions: {
|
|
13
|
-
json: null,
|
|
14
|
-
jsonl: {stream: true},
|
|
15
|
-
ndjson: {stream: true}
|
|
16
|
-
},
|
|
17
|
-
mimeTypes: {
|
|
18
|
-
'application/json': null,
|
|
19
|
-
'application/json-seq': {stream: true},
|
|
20
|
-
'application/x-ndjson': {stream: true}
|
|
21
|
-
},
|
|
22
|
-
*
|
|
23
|
-
category: 'table',
|
|
24
|
-
text: true,
|
|
25
|
-
parse,
|
|
26
|
-
parseTextSync,
|
|
27
|
-
parseInBatches,
|
|
28
|
-
options: DEFAULT_JSON_LOADER_OPTIONS
|
|
29
|
-
};
|
|
30
|
-
{
|
|
31
|
-
name: 'TEST-JSONL_LOADER',
|
|
32
|
-
extensions: ['jsonl'],
|
|
33
|
-
parse: async (arrayBuffer, options, context) => {
|
|
34
|
-
const characters = new Uint8Array(arrayBuffer);
|
|
35
|
-
const result = [];
|
|
36
|
-
|
|
37
|
-
const len = characters.length;
|
|
38
|
-
let startIndex = 0;
|
|
39
|
-
for (let i = 0; i <= len; i++) {
|
|
40
|
-
if (characters[i] === 10 || i === len) {
|
|
41
|
-
// Note: we need to make a copy of the buffer here because we cannot
|
|
42
|
-
// handover the ownership of arrayBuffer to the child process
|
|
43
|
-
const json = characters.slice(startIndex, i);
|
|
44
|
-
if (json.length > 1) {
|
|
45
|
-
result.push(await context.parse(json.buffer, {}, 'line.json'));
|
|
46
|
-
}
|
|
47
|
-
startIndex = i + 1;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return result;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
*/
|
package/src/jsonl-loader.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/* TODO JSONL loader
|
|
2
|
-
export const JSONLoader: LoaderWithParser = {
|
|
3
|
-
name: 'JSON',
|
|
4
|
-
id: 'json',
|
|
5
|
-
module: 'json',
|
|
6
|
-
version: VERSION,
|
|
7
|
-
extensions: ['json', 'geojson'],
|
|
8
|
-
mimeTypes: ['application/json'],
|
|
9
|
-
// TODO - support various line based JSON formats
|
|
10
|
-
/*
|
|
11
|
-
extensions: {
|
|
12
|
-
json: null,
|
|
13
|
-
jsonl: {stream: true},
|
|
14
|
-
ndjson: {stream: true}
|
|
15
|
-
},
|
|
16
|
-
mimeTypes: {
|
|
17
|
-
'application/json': null,
|
|
18
|
-
'application/json-seq': {stream: true},
|
|
19
|
-
'application/x-ndjson': {stream: true}
|
|
20
|
-
},
|
|
21
|
-
*
|
|
22
|
-
category: 'table',
|
|
23
|
-
text: true,
|
|
24
|
-
parse,
|
|
25
|
-
parseTextSync,
|
|
26
|
-
parseInBatches,
|
|
27
|
-
options: DEFAULT_JSON_LOADER_OPTIONS
|
|
28
|
-
};
|
|
29
|
-
{
|
|
30
|
-
name: 'TEST-JSONL_LOADER',
|
|
31
|
-
extensions: ['jsonl'],
|
|
32
|
-
parse: async (arrayBuffer, options, context) => {
|
|
33
|
-
const characters = new Uint8Array(arrayBuffer);
|
|
34
|
-
const result = [];
|
|
35
|
-
|
|
36
|
-
const len = characters.length;
|
|
37
|
-
let startIndex = 0;
|
|
38
|
-
for (let i = 0; i <= len; i++) {
|
|
39
|
-
if (characters[i] === 10 || i === len) {
|
|
40
|
-
// Note: we need to make a copy of the buffer here because we cannot
|
|
41
|
-
// handover the ownership of arrayBuffer to the child process
|
|
42
|
-
const json = characters.slice(startIndex, i);
|
|
43
|
-
if (json.length > 1) {
|
|
44
|
-
result.push(await context.parse(json.buffer, {}, 'line.json'));
|
|
45
|
-
}
|
|
46
|
-
startIndex = i + 1;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return result;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
*/
|