@loaders.gl/json 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.
- package/dist/bundle.js +2 -2
- package/dist/bundle.js.map +1 -0
- package/dist/geojson-loader.js +69 -66
- package/dist/geojson-loader.js.map +1 -0
- package/dist/geojson-worker.js +1 -1
- package/dist/index.js +7 -19
- package/dist/index.js.map +1 -0
- package/dist/json-loader.js +38 -48
- package/dist/json-loader.js.map +1 -0
- package/dist/jsonl-loader.js +1 -53
- package/dist/{es5/jsonl-loader.js.map → jsonl-loader.js.map} +0 -0
- package/dist/{es5/lib → lib}/clarinet/LICENSE +0 -0
- package/dist/lib/clarinet/clarinet.js +493 -510
- package/dist/lib/clarinet/clarinet.js.map +1 -0
- package/dist/lib/jsonpath/jsonpath.js +78 -81
- package/dist/lib/jsonpath/jsonpath.js.map +1 -0
- package/dist/lib/parse-json-in-batches.js +98 -94
- package/dist/lib/parse-json-in-batches.js.map +1 -0
- package/dist/lib/parse-json.js +29 -24
- package/dist/lib/parse-json.js.map +1 -0
- package/dist/lib/parse-ndjson-in-batches.js +34 -32
- package/dist/lib/parse-ndjson-in-batches.js.map +1 -0
- package/dist/lib/parse-ndjson.js +10 -13
- package/dist/lib/parse-ndjson.js.map +1 -0
- package/dist/lib/parser/json-parser.js +125 -95
- package/dist/lib/parser/json-parser.js.map +1 -0
- package/dist/lib/parser/streaming-json-parser.js +88 -95
- package/dist/lib/parser/streaming-json-parser.js.map +1 -0
- package/dist/ndjson-loader.js +25 -28
- package/dist/ndjson-loader.js.map +1 -0
- package/dist/workers/geojson-worker.js +4 -5
- package/dist/workers/geojson-worker.js.map +1 -0
- package/package.json +8 -8
- package/dist/es5/bundle.js +0 -7
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/geojson-loader.js +0 -209
- package/dist/es5/geojson-loader.js.map +0 -1
- package/dist/es5/index.js +0 -62
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/json-loader.js +0 -85
- package/dist/es5/json-loader.js.map +0 -1
- package/dist/es5/jsonl-loader.js +0 -2
- package/dist/es5/lib/clarinet/clarinet.js +0 -535
- package/dist/es5/lib/clarinet/clarinet.js.map +0 -1
- package/dist/es5/lib/jsonpath/jsonpath.js +0 -144
- package/dist/es5/lib/jsonpath/jsonpath.js.map +0 -1
- package/dist/es5/lib/parse-json-in-batches.js +0 -278
- package/dist/es5/lib/parse-json-in-batches.js.map +0 -1
- package/dist/es5/lib/parse-json.js +0 -46
- package/dist/es5/lib/parse-json.js.map +0 -1
- package/dist/es5/lib/parse-ndjson-in-batches.js +0 -158
- package/dist/es5/lib/parse-ndjson-in-batches.js.map +0 -1
- package/dist/es5/lib/parse-ndjson.js +0 -18
- package/dist/es5/lib/parse-ndjson.js.map +0 -1
- package/dist/es5/lib/parser/json-parser.js +0 -159
- package/dist/es5/lib/parser/json-parser.js.map +0 -1
- package/dist/es5/lib/parser/streaming-json-parser.js +0 -158
- package/dist/es5/lib/parser/streaming-json-parser.js.map +0 -1
- package/dist/es5/ndjson-loader.js +0 -67
- package/dist/es5/ndjson-loader.js.map +0 -1
- package/dist/es5/workers/geojson-worker.js +0 -8
- package/dist/es5/workers/geojson-worker.js.map +0 -1
- package/dist/esm/bundle.js +0 -5
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/geojson-loader.js +0 -81
- package/dist/esm/geojson-loader.js.map +0 -1
- package/dist/esm/index.js +0 -7
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/json-loader.js +0 -47
- package/dist/esm/json-loader.js.map +0 -1
- package/dist/esm/jsonl-loader.js +0 -2
- package/dist/esm/jsonl-loader.js.map +0 -1
- package/dist/esm/lib/clarinet/LICENSE +0 -28
- package/dist/esm/lib/clarinet/clarinet.js +0 -518
- package/dist/esm/lib/clarinet/clarinet.js.map +0 -1
- package/dist/esm/lib/jsonpath/jsonpath.js +0 -86
- package/dist/esm/lib/jsonpath/jsonpath.js.map +0 -1
- package/dist/esm/lib/parse-json-in-batches.js +0 -104
- package/dist/esm/lib/parse-json-in-batches.js.map +0 -1
- package/dist/esm/lib/parse-json.js +0 -34
- package/dist/esm/lib/parse-json.js.map +0 -1
- package/dist/esm/lib/parse-ndjson-in-batches.js +0 -37
- package/dist/esm/lib/parse-ndjson-in-batches.js.map +0 -1
- package/dist/esm/lib/parse-ndjson.js +0 -11
- package/dist/esm/lib/parse-ndjson.js.map +0 -1
- package/dist/esm/lib/parser/json-parser.js +0 -128
- package/dist/esm/lib/parser/json-parser.js.map +0 -1
- package/dist/esm/lib/parser/streaming-json-parser.js +0 -93
- package/dist/esm/lib/parser/streaming-json-parser.js.map +0 -1
- package/dist/esm/ndjson-loader.js +0 -32
- package/dist/esm/ndjson-loader.js.map +0 -1
- package/dist/esm/workers/geojson-worker.js +0 -4
- package/dist/esm/workers/geojson-worker.js.map +0 -1
package/dist/lib/parse-ndjson.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
throw new Error(`NDJSONLoader: failed to parse JSON on line ${counter + 1}`);
|
|
11
|
-
}
|
|
12
|
-
});
|
|
1
|
+
export default function parseNDJSONSync(ndjsonText) {
|
|
2
|
+
const lines = ndjsonText.trim().split('\n');
|
|
3
|
+
return lines.map((line, counter) => {
|
|
4
|
+
try {
|
|
5
|
+
return JSON.parse(line);
|
|
6
|
+
} catch (error) {
|
|
7
|
+
throw new Error("NDJSONLoader: failed to parse JSON on line ".concat(counter + 1));
|
|
8
|
+
}
|
|
9
|
+
});
|
|
13
10
|
}
|
|
14
|
-
|
|
11
|
+
//# sourceMappingURL=parse-ndjson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/parse-ndjson.ts"],"names":["parseNDJSONSync","ndjsonText","lines","trim","split","map","line","counter","JSON","parse","error","Error"],"mappings":"AAAA,eAAe,SAASA,eAAT,CAAyBC,UAAzB,EAA6C;AAC1D,QAAMC,KAAK,GAAGD,UAAU,CAACE,IAAX,GAAkBC,KAAlB,CAAwB,IAAxB,CAAd;AACA,SAAOF,KAAK,CAACG,GAAN,CAAU,CAACC,IAAD,EAAOC,OAAP,KAAmB;AAClC,QAAI;AACF,aAAOC,IAAI,CAACC,KAAL,CAAWH,IAAX,CAAP;AACD,KAFD,CAEE,OAAOI,KAAP,EAAc;AACd,YAAM,IAAIC,KAAJ,sDAAwDJ,OAAO,GAAG,CAAlE,EAAN;AACD;AACF,GANM,CAAP;AAOD","sourcesContent":["export default function parseNDJSONSync(ndjsonText: string) {\n const lines = ndjsonText.trim().split('\\n');\n return lines.map((line, counter) => {\n try {\n return JSON.parse(line);\n } catch (error) {\n throw new Error(`NDJSONLoader: failed to parse JSON on line ${counter + 1}`);\n }\n });\n}\n"],"file":"parse-ndjson.js"}
|
|
@@ -1,98 +1,128 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.currentState.key = name;
|
|
32
|
-
},
|
|
33
|
-
oncloseobject: () => {
|
|
34
|
-
this._closeObject();
|
|
35
|
-
},
|
|
36
|
-
onopenarray: () => {
|
|
37
|
-
this._openArray();
|
|
38
|
-
},
|
|
39
|
-
onclosearray: () => {
|
|
40
|
-
this._closeArray();
|
|
41
|
-
},
|
|
42
|
-
onvalue: (value) => {
|
|
43
|
-
this._pushOrSet(value);
|
|
44
|
-
},
|
|
45
|
-
onerror: (error) => {
|
|
46
|
-
throw error;
|
|
47
|
-
},
|
|
48
|
-
onend: () => {
|
|
49
|
-
this.result = this.currentState.container.pop();
|
|
50
|
-
},
|
|
51
|
-
...options
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
reset() {
|
|
55
|
-
this.result = undefined;
|
|
56
|
-
this.previousStates = [];
|
|
57
|
-
this.currentState = Object.freeze({ container: [], key: null });
|
|
58
|
-
this.jsonpath = new jsonpath_1.default();
|
|
59
|
-
}
|
|
60
|
-
write(chunk) {
|
|
61
|
-
this.parser.write(chunk);
|
|
62
|
-
}
|
|
63
|
-
close() {
|
|
64
|
-
this.parser.close();
|
|
65
|
-
}
|
|
66
|
-
// PRIVATE METHODS
|
|
67
|
-
_pushOrSet(value) {
|
|
68
|
-
const { container, key } = this.currentState;
|
|
69
|
-
if (key !== null) {
|
|
70
|
-
container[key] = value;
|
|
71
|
-
this.currentState.key = null;
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
container.push(value);
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import ClarinetParser from '../clarinet/clarinet';
|
|
3
|
+
import JSONPath from '../jsonpath/jsonpath';
|
|
4
|
+
export default class JSONParser {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
_defineProperty(this, "parser", void 0);
|
|
7
|
+
|
|
8
|
+
_defineProperty(this, "result", undefined);
|
|
9
|
+
|
|
10
|
+
_defineProperty(this, "previousStates", []);
|
|
11
|
+
|
|
12
|
+
_defineProperty(this, "currentState", Object.freeze({
|
|
13
|
+
container: [],
|
|
14
|
+
key: null
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
_defineProperty(this, "jsonpath", new JSONPath());
|
|
18
|
+
|
|
19
|
+
this.reset();
|
|
20
|
+
this.parser = new ClarinetParser({
|
|
21
|
+
onready: () => {
|
|
22
|
+
this.jsonpath = new JSONPath();
|
|
23
|
+
this.previousStates.length = 0;
|
|
24
|
+
this.currentState.container.length = 0;
|
|
25
|
+
},
|
|
26
|
+
onopenobject: name => {
|
|
27
|
+
this._openObject({});
|
|
28
|
+
|
|
29
|
+
if (typeof name !== 'undefined') {
|
|
30
|
+
this.parser.emit('onkey', name);
|
|
75
31
|
}
|
|
32
|
+
},
|
|
33
|
+
onkey: name => {
|
|
34
|
+
this.jsonpath.set(name);
|
|
35
|
+
this.currentState.key = name;
|
|
36
|
+
},
|
|
37
|
+
oncloseobject: () => {
|
|
38
|
+
this._closeObject();
|
|
39
|
+
},
|
|
40
|
+
onopenarray: () => {
|
|
41
|
+
this._openArray();
|
|
42
|
+
},
|
|
43
|
+
onclosearray: () => {
|
|
44
|
+
this._closeArray();
|
|
45
|
+
},
|
|
46
|
+
onvalue: value => {
|
|
47
|
+
this._pushOrSet(value);
|
|
48
|
+
},
|
|
49
|
+
onerror: error => {
|
|
50
|
+
throw error;
|
|
51
|
+
},
|
|
52
|
+
onend: () => {
|
|
53
|
+
this.result = this.currentState.container.pop();
|
|
54
|
+
},
|
|
55
|
+
...options
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
reset() {
|
|
60
|
+
this.result = undefined;
|
|
61
|
+
this.previousStates = [];
|
|
62
|
+
this.currentState = Object.freeze({
|
|
63
|
+
container: [],
|
|
64
|
+
key: null
|
|
65
|
+
});
|
|
66
|
+
this.jsonpath = new JSONPath();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
write(chunk) {
|
|
70
|
+
this.parser.write(chunk);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
close() {
|
|
74
|
+
this.parser.close();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
_pushOrSet(value) {
|
|
78
|
+
const {
|
|
79
|
+
container,
|
|
80
|
+
key
|
|
81
|
+
} = this.currentState;
|
|
82
|
+
|
|
83
|
+
if (key !== null) {
|
|
84
|
+
container[key] = value;
|
|
85
|
+
this.currentState.key = null;
|
|
86
|
+
} else {
|
|
87
|
+
container.push(value);
|
|
76
88
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
_openArray(newContainer = []) {
|
|
92
|
+
this.jsonpath.push(null);
|
|
93
|
+
|
|
94
|
+
this._pushOrSet(newContainer);
|
|
95
|
+
|
|
96
|
+
this.previousStates.push(this.currentState);
|
|
97
|
+
this.currentState = {
|
|
98
|
+
container: newContainer,
|
|
99
|
+
isArray: true,
|
|
100
|
+
key: null
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
_closeArray() {
|
|
105
|
+
this.jsonpath.pop();
|
|
106
|
+
this.currentState = this.previousStates.pop();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
_openObject(newContainer = {}) {
|
|
110
|
+
this.jsonpath.push(null);
|
|
111
|
+
|
|
112
|
+
this._pushOrSet(newContainer);
|
|
113
|
+
|
|
114
|
+
this.previousStates.push(this.currentState);
|
|
115
|
+
this.currentState = {
|
|
116
|
+
container: newContainer,
|
|
117
|
+
isArray: false,
|
|
118
|
+
key: null
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
_closeObject() {
|
|
123
|
+
this.jsonpath.pop();
|
|
124
|
+
this.currentState = this.previousStates.pop();
|
|
125
|
+
}
|
|
126
|
+
|
|
97
127
|
}
|
|
98
|
-
|
|
128
|
+
//# sourceMappingURL=json-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/parser/json-parser.ts"],"names":["ClarinetParser","JSONPath","JSONParser","constructor","options","undefined","Object","freeze","container","key","reset","parser","onready","jsonpath","previousStates","length","currentState","onopenobject","name","_openObject","emit","onkey","set","oncloseobject","_closeObject","onopenarray","_openArray","onclosearray","_closeArray","onvalue","value","_pushOrSet","onerror","error","onend","result","pop","write","chunk","close","push","newContainer","isArray"],"mappings":";AAEA,OAAOA,cAAP,MAAoD,sBAApD;AACA,OAAOC,QAAP,MAAqB,sBAArB;AAIA,eAAe,MAAMC,UAAN,CAAiB;AAO9BC,EAAAA,WAAW,CAACC,OAAD,EAAiC;AAAA;;AAAA,oCALnCC,SAKmC;;AAAA,4CAJ3B,EAI2B;;AAAA,0CAH7BC,MAAM,CAACC,MAAP,CAAc;AAACC,MAAAA,SAAS,EAAE,EAAZ;AAAgBC,MAAAA,GAAG,EAAE;AAArB,KAAd,CAG6B;;AAAA,sCAFvB,IAAIR,QAAJ,EAEuB;;AAC1C,SAAKS,KAAL;AACA,SAAKC,MAAL,GAAc,IAAIX,cAAJ,CAAmB;AAC/BY,MAAAA,OAAO,EAAE,MAAM;AACb,aAAKC,QAAL,GAAgB,IAAIZ,QAAJ,EAAhB;AACA,aAAKa,cAAL,CAAoBC,MAApB,GAA6B,CAA7B;AACA,aAAKC,YAAL,CAAkBR,SAAlB,CAA4BO,MAA5B,GAAqC,CAArC;AACD,OAL8B;AAO/BE,MAAAA,YAAY,EAAGC,IAAD,IAAU;AACtB,aAAKC,WAAL,CAAiB,EAAjB;;AACA,YAAI,OAAOD,IAAP,KAAgB,WAApB,EAAiC;AAC/B,eAAKP,MAAL,CAAYS,IAAZ,CAAiB,OAAjB,EAA0BF,IAA1B;AACD;AACF,OAZ8B;AAc/BG,MAAAA,KAAK,EAAGH,IAAD,IAAU;AACf,aAAKL,QAAL,CAAcS,GAAd,CAAkBJ,IAAlB;AACA,aAAKF,YAAL,CAAkBP,GAAlB,GAAwBS,IAAxB;AACD,OAjB8B;AAmB/BK,MAAAA,aAAa,EAAE,MAAM;AACnB,aAAKC,YAAL;AACD,OArB8B;AAuB/BC,MAAAA,WAAW,EAAE,MAAM;AACjB,aAAKC,UAAL;AACD,OAzB8B;AA2B/BC,MAAAA,YAAY,EAAE,MAAM;AAClB,aAAKC,WAAL;AACD,OA7B8B;AA+B/BC,MAAAA,OAAO,EAAGC,KAAD,IAAW;AAClB,aAAKC,UAAL,CAAgBD,KAAhB;AACD,OAjC8B;AAmC/BE,MAAAA,OAAO,EAAGC,KAAD,IAAW;AAClB,cAAMA,KAAN;AACD,OArC8B;AAuC/BC,MAAAA,KAAK,EAAE,MAAM;AACX,aAAKC,MAAL,GAAc,KAAKnB,YAAL,CAAkBR,SAAlB,CAA4B4B,GAA5B,EAAd;AACD,OAzC8B;AA2C/B,SAAGhC;AA3C4B,KAAnB,CAAd;AA6CD;;AAEDM,EAAAA,KAAK,GAAS;AACZ,SAAKyB,MAAL,GAAc9B,SAAd;AACA,SAAKS,cAAL,GAAsB,EAAtB;AACA,SAAKE,YAAL,GAAoBV,MAAM,CAACC,MAAP,CAAc;AAACC,MAAAA,SAAS,EAAE,EAAZ;AAAgBC,MAAAA,GAAG,EAAE;AAArB,KAAd,CAApB;AACA,SAAKI,QAAL,GAAgB,IAAIZ,QAAJ,EAAhB;AACD;;AAEDoC,EAAAA,KAAK,CAACC,KAAD,EAAc;AACjB,SAAK3B,MAAL,CAAY0B,KAAZ,CAAkBC,KAAlB;AACD;;AAEDC,EAAAA,KAAK,GAAS;AACZ,SAAK5B,MAAL,CAAY4B,KAAZ;AACD;;AAIDR,EAAAA,UAAU,CAACD,KAAD,EAAc;AACtB,UAAM;AAACtB,MAAAA,SAAD;AAAYC,MAAAA;AAAZ,QAAmB,KAAKO,YAA9B;;AACA,QAAIP,GAAG,KAAK,IAAZ,EAAkB;AAChBD,MAAAA,SAAS,CAACC,GAAD,CAAT,GAAiBqB,KAAjB;AACA,WAAKd,YAAL,CAAkBP,GAAlB,GAAwB,IAAxB;AACD,KAHD,MAGO;AACLD,MAAAA,SAAS,CAACgC,IAAV,CAAeV,KAAf;AACD;AACF;;AAEDJ,EAAAA,UAAU,CAACe,YAAY,GAAG,EAAhB,EAA0B;AAClC,SAAK5B,QAAL,CAAc2B,IAAd,CAAmB,IAAnB;;AACA,SAAKT,UAAL,CAAgBU,YAAhB;;AACA,SAAK3B,cAAL,CAAoB0B,IAApB,CAAyB,KAAKxB,YAA9B;AACA,SAAKA,YAAL,GAAoB;AAACR,MAAAA,SAAS,EAAEiC,YAAZ;AAA0BC,MAAAA,OAAO,EAAE,IAAnC;AAAyCjC,MAAAA,GAAG,EAAE;AAA9C,KAApB;AACD;;AAEDmB,EAAAA,WAAW,GAAS;AAClB,SAAKf,QAAL,CAAcuB,GAAd;AACA,SAAKpB,YAAL,GAAoB,KAAKF,cAAL,CAAoBsB,GAApB,EAApB;AACD;;AAEDjB,EAAAA,WAAW,CAACsB,YAAY,GAAG,EAAhB,EAA0B;AACnC,SAAK5B,QAAL,CAAc2B,IAAd,CAAmB,IAAnB;;AACA,SAAKT,UAAL,CAAgBU,YAAhB;;AACA,SAAK3B,cAAL,CAAoB0B,IAApB,CAAyB,KAAKxB,YAA9B;AACA,SAAKA,YAAL,GAAoB;AAACR,MAAAA,SAAS,EAAEiC,YAAZ;AAA0BC,MAAAA,OAAO,EAAE,KAAnC;AAA0CjC,MAAAA,GAAG,EAAE;AAA/C,KAApB;AACD;;AAEDe,EAAAA,YAAY,GAAS;AACnB,SAAKX,QAAL,CAAcuB,GAAd;AACA,SAAKpB,YAAL,GAAoB,KAAKF,cAAL,CAAoBsB,GAApB,EAApB;AACD;;AAzG6B","sourcesContent":["// @ts-nocheck\n\nimport ClarinetParser, {ClarinetParserOptions} from '../clarinet/clarinet';\nimport JSONPath from '../jsonpath/jsonpath';\n\n// JSONParser builds a JSON object using the events emitted by the Clarinet parser\n\nexport default class JSONParser {\n readonly parser: ClarinetParser;\n result = undefined;\n previousStates = [];\n currentState = Object.freeze({container: [], key: null});\n jsonpath: JSONPath = new JSONPath();\n\n constructor(options: ClarinetParserOptions) {\n this.reset();\n this.parser = new ClarinetParser({\n onready: () => {\n this.jsonpath = new JSONPath();\n this.previousStates.length = 0;\n this.currentState.container.length = 0;\n },\n\n onopenobject: (name) => {\n this._openObject({});\n if (typeof name !== 'undefined') {\n this.parser.emit('onkey', name);\n }\n },\n\n onkey: (name) => {\n this.jsonpath.set(name);\n this.currentState.key = name;\n },\n\n oncloseobject: () => {\n this._closeObject();\n },\n\n onopenarray: () => {\n this._openArray();\n },\n\n onclosearray: () => {\n this._closeArray();\n },\n\n onvalue: (value) => {\n this._pushOrSet(value);\n },\n\n onerror: (error) => {\n throw error;\n },\n\n onend: () => {\n this.result = this.currentState.container.pop();\n },\n\n ...options\n });\n }\n\n reset(): void {\n this.result = undefined;\n this.previousStates = [];\n this.currentState = Object.freeze({container: [], key: null});\n this.jsonpath = new JSONPath();\n }\n\n write(chunk): void {\n this.parser.write(chunk);\n }\n\n close(): void {\n this.parser.close();\n }\n\n // PRIVATE METHODS\n\n _pushOrSet(value): void {\n const {container, key} = this.currentState;\n if (key !== null) {\n container[key] = value;\n this.currentState.key = null;\n } else {\n container.push(value);\n }\n }\n\n _openArray(newContainer = []): void {\n this.jsonpath.push(null);\n this._pushOrSet(newContainer);\n this.previousStates.push(this.currentState);\n this.currentState = {container: newContainer, isArray: true, key: null};\n }\n\n _closeArray(): void {\n this.jsonpath.pop();\n this.currentState = this.previousStates.pop();\n }\n\n _openObject(newContainer = {}): void {\n this.jsonpath.push(null);\n this._pushOrSet(newContainer);\n this.previousStates.push(this.currentState);\n this.currentState = {container: newContainer, isArray: false, key: null};\n }\n\n _closeObject(): void {\n this.jsonpath.pop();\n this.currentState = this.previousStates.pop();\n }\n}\n"],"file":"json-parser.js"}
|
|
@@ -1,100 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (this._matchJSONPath()) {
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
this.streamingJsonPath = this.getJsonPath().clone();
|
|
20
|
-
this.streamingArray = [];
|
|
21
|
-
this._openArray(this.streamingArray);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
this._openArray();
|
|
26
|
-
},
|
|
27
|
-
// Redefine onopenarray to inject value for top-level object
|
|
28
|
-
onopenobject: (name) => {
|
|
29
|
-
if (!this.topLevelObject) {
|
|
30
|
-
this.topLevelObject = {};
|
|
31
|
-
this._openObject(this.topLevelObject);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
this._openObject({});
|
|
35
|
-
}
|
|
36
|
-
if (typeof name !== 'undefined') {
|
|
37
|
-
this.parser.emit('onkey', name);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
this.streamingJsonPath = null;
|
|
42
|
-
this.streamingArray = null;
|
|
43
|
-
this.topLevelObject = null;
|
|
44
|
-
const jsonpaths = options.jsonpaths || [];
|
|
45
|
-
this.jsonPaths = jsonpaths.map((jsonpath) => new jsonpath_1.default(jsonpath));
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* write REDEFINITION
|
|
49
|
-
* - super.write() chunk to parser
|
|
50
|
-
* - get the contents (so far) of "topmost-level" array as batch of rows
|
|
51
|
-
* - clear top-level array
|
|
52
|
-
* - return the batch of rows\
|
|
53
|
-
*/
|
|
54
|
-
write(chunk) {
|
|
55
|
-
super.write(chunk);
|
|
56
|
-
let array = [];
|
|
57
|
-
if (this.streamingArray) {
|
|
58
|
-
array = [...this.streamingArray];
|
|
59
|
-
this.streamingArray.length = 0;
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import { default as JSONParser } from './json-parser';
|
|
3
|
+
import JSONPath from '../jsonpath/jsonpath';
|
|
4
|
+
export default class StreamingJSONParser extends JSONParser {
|
|
5
|
+
constructor(options = {}) {
|
|
6
|
+
super({
|
|
7
|
+
onopenarray: () => {
|
|
8
|
+
if (!this.streamingArray) {
|
|
9
|
+
if (this._matchJSONPath()) {
|
|
10
|
+
this.streamingJsonPath = this.getJsonPath().clone();
|
|
11
|
+
this.streamingArray = [];
|
|
12
|
+
|
|
13
|
+
this._openArray(this.streamingArray);
|
|
14
|
+
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
60
17
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
getStreamingJsonPath() {
|
|
72
|
-
return this.streamingJsonPath;
|
|
73
|
-
}
|
|
74
|
-
getStreamingJsonPathAsString() {
|
|
75
|
-
return this.streamingJsonPath && this.streamingJsonPath.toString();
|
|
76
|
-
}
|
|
77
|
-
getJsonPath() {
|
|
78
|
-
return this.jsonpath;
|
|
79
|
-
}
|
|
80
|
-
// PRIVATE METHODS
|
|
81
|
-
/**
|
|
82
|
-
* Checks is this.getJsonPath matches the jsonpaths provided in options
|
|
83
|
-
*/
|
|
84
|
-
_matchJSONPath() {
|
|
85
|
-
const currentPath = this.getJsonPath();
|
|
86
|
-
// console.debug(`Testing JSONPath`, currentPath);
|
|
87
|
-
// Backwards compatibility, match any array
|
|
88
|
-
// TODO implement using wildcard once that is supported
|
|
89
|
-
if (this.jsonPaths.length === 0) {
|
|
90
|
-
return true;
|
|
18
|
+
|
|
19
|
+
this._openArray();
|
|
20
|
+
},
|
|
21
|
+
onopenobject: name => {
|
|
22
|
+
if (!this.topLevelObject) {
|
|
23
|
+
this.topLevelObject = {};
|
|
24
|
+
|
|
25
|
+
this._openObject(this.topLevelObject);
|
|
26
|
+
} else {
|
|
27
|
+
this._openObject({});
|
|
91
28
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
29
|
+
|
|
30
|
+
if (typeof name !== 'undefined') {
|
|
31
|
+
this.parser.emit('onkey', name);
|
|
96
32
|
}
|
|
97
|
-
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
_defineProperty(this, "jsonPaths", void 0);
|
|
37
|
+
|
|
38
|
+
_defineProperty(this, "streamingJsonPath", null);
|
|
39
|
+
|
|
40
|
+
_defineProperty(this, "streamingArray", null);
|
|
41
|
+
|
|
42
|
+
_defineProperty(this, "topLevelObject", null);
|
|
43
|
+
|
|
44
|
+
const jsonpaths = options.jsonpaths || [];
|
|
45
|
+
this.jsonPaths = jsonpaths.map(jsonpath => new JSONPath(jsonpath));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
write(chunk) {
|
|
49
|
+
super.write(chunk);
|
|
50
|
+
let array = [];
|
|
51
|
+
|
|
52
|
+
if (this.streamingArray) {
|
|
53
|
+
array = [...this.streamingArray];
|
|
54
|
+
this.streamingArray.length = 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return array;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
getPartialResult() {
|
|
61
|
+
return this.topLevelObject;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
getStreamingJsonPath() {
|
|
65
|
+
return this.streamingJsonPath;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
getStreamingJsonPathAsString() {
|
|
69
|
+
return this.streamingJsonPath && this.streamingJsonPath.toString();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
getJsonPath() {
|
|
73
|
+
return this.jsonpath;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_matchJSONPath() {
|
|
77
|
+
const currentPath = this.getJsonPath();
|
|
78
|
+
|
|
79
|
+
if (this.jsonPaths.length === 0) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
for (const jsonPath of this.jsonPaths) {
|
|
84
|
+
if (jsonPath.equals(currentPath)) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
98
87
|
}
|
|
88
|
+
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
|
|
99
92
|
}
|
|
100
|
-
|
|
93
|
+
//# sourceMappingURL=streaming-json-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/parser/streaming-json-parser.ts"],"names":["default","JSONParser","JSONPath","StreamingJSONParser","constructor","options","onopenarray","streamingArray","_matchJSONPath","streamingJsonPath","getJsonPath","clone","_openArray","onopenobject","name","topLevelObject","_openObject","parser","emit","jsonpaths","jsonPaths","map","jsonpath","write","chunk","array","length","getPartialResult","getStreamingJsonPath","getStreamingJsonPathAsString","toString","currentPath","jsonPath","equals"],"mappings":";AAAA,SAAQA,OAAO,IAAIC,UAAnB,QAAoC,eAApC;AACA,OAAOC,QAAP,MAAqB,sBAArB;AAMA,eAAe,MAAMC,mBAAN,SAAkCF,UAAlC,CAA6C;AAM1DG,EAAAA,WAAW,CAACC,OAA6B,GAAG,EAAjC,EAAqC;AAC9C,UAAM;AACJC,MAAAA,WAAW,EAAE,MAAM;AACjB,YAAI,CAAC,KAAKC,cAAV,EAA0B;AACxB,cAAI,KAAKC,cAAL,EAAJ,EAA2B;AAEzB,iBAAKC,iBAAL,GAAyB,KAAKC,WAAL,GAAmBC,KAAnB,EAAzB;AACA,iBAAKJ,cAAL,GAAsB,EAAtB;;AACA,iBAAKK,UAAL,CAAgB,KAAKL,cAArB;;AACA;AACD;AACF;;AAED,aAAKK,UAAL;AACD,OAbG;AAgBJC,MAAAA,YAAY,EAAGC,IAAD,IAAU;AACtB,YAAI,CAAC,KAAKC,cAAV,EAA0B;AACxB,eAAKA,cAAL,GAAsB,EAAtB;;AACA,eAAKC,WAAL,CAAiB,KAAKD,cAAtB;AACD,SAHD,MAGO;AACL,eAAKC,WAAL,CAAiB,EAAjB;AACD;;AACD,YAAI,OAAOF,IAAP,KAAgB,WAApB,EAAiC;AAC/B,eAAKG,MAAL,CAAYC,IAAZ,CAAiB,OAAjB,EAA0BJ,IAA1B;AACD;AACF;AA1BG,KAAN;;AAD8C;;AAAA,+CAJH,IAIG;;AAAA,4CAHT,IAGS;;AAAA,4CAFR,IAEQ;;AA6B9C,UAAMK,SAAS,GAAGd,OAAO,CAACc,SAAR,IAAqB,EAAvC;AACA,SAAKC,SAAL,GAAiBD,SAAS,CAACE,GAAV,CAAeC,QAAD,IAAc,IAAIpB,QAAJ,CAAaoB,QAAb,CAA5B,CAAjB;AACD;;AASDC,EAAAA,KAAK,CAACC,KAAD,EAAQ;AACX,UAAMD,KAAN,CAAYC,KAAZ;AACA,QAAIC,KAAY,GAAG,EAAnB;;AACA,QAAI,KAAKlB,cAAT,EAAyB;AACvBkB,MAAAA,KAAK,GAAG,CAAC,GAAG,KAAKlB,cAAT,CAAR;AACA,WAAKA,cAAL,CAAoBmB,MAApB,GAA6B,CAA7B;AACD;;AACD,WAAOD,KAAP;AACD;;AAODE,EAAAA,gBAAgB,GAAG;AACjB,WAAO,KAAKZ,cAAZ;AACD;;AAEDa,EAAAA,oBAAoB,GAAG;AACrB,WAAO,KAAKnB,iBAAZ;AACD;;AAEDoB,EAAAA,4BAA4B,GAAG;AAC7B,WAAO,KAAKpB,iBAAL,IAA0B,KAAKA,iBAAL,CAAuBqB,QAAvB,EAAjC;AACD;;AAEDpB,EAAAA,WAAW,GAAG;AACZ,WAAO,KAAKY,QAAZ;AACD;;AAODd,EAAAA,cAAc,GAAG;AACf,UAAMuB,WAAW,GAAG,KAAKrB,WAAL,EAApB;;AAKA,QAAI,KAAKU,SAAL,CAAeM,MAAf,KAA0B,CAA9B,EAAiC;AAC/B,aAAO,IAAP;AACD;;AAED,SAAK,MAAMM,QAAX,IAAuB,KAAKZ,SAA5B,EAAuC;AACrC,UAAIY,QAAQ,CAACC,MAAT,CAAgBF,WAAhB,CAAJ,EAAkC;AAChC,eAAO,IAAP;AACD;AACF;;AAED,WAAO,KAAP;AACD;;AAnGyD","sourcesContent":["import {default as JSONParser} from './json-parser';\nimport JSONPath from '../jsonpath/jsonpath';\n\n/**\n * The `StreamingJSONParser` looks for the first array in the JSON structure.\n * and emits an array of chunks\n */\nexport default class StreamingJSONParser extends JSONParser {\n private jsonPaths: JSONPath[];\n private streamingJsonPath: JSONPath | null = null;\n private streamingArray: any[] | null = null;\n private topLevelObject: object | null = null;\n\n constructor(options: {[key: string]: any} = {}) {\n super({\n onopenarray: () => {\n if (!this.streamingArray) {\n if (this._matchJSONPath()) {\n // @ts-ignore\n this.streamingJsonPath = this.getJsonPath().clone();\n this.streamingArray = [];\n this._openArray(this.streamingArray as []);\n return;\n }\n }\n\n this._openArray();\n },\n\n // Redefine onopenarray to inject value for top-level object\n onopenobject: (name) => {\n if (!this.topLevelObject) {\n this.topLevelObject = {};\n this._openObject(this.topLevelObject);\n } else {\n this._openObject({});\n }\n if (typeof name !== 'undefined') {\n this.parser.emit('onkey', name);\n }\n }\n });\n const jsonpaths = options.jsonpaths || [];\n this.jsonPaths = jsonpaths.map((jsonpath) => new JSONPath(jsonpath));\n }\n\n /**\n * write REDEFINITION\n * - super.write() chunk to parser\n * - get the contents (so far) of \"topmost-level\" array as batch of rows\n * - clear top-level array\n * - return the batch of rows\\\n */\n write(chunk) {\n super.write(chunk);\n let array: any[] = [];\n if (this.streamingArray) {\n array = [...this.streamingArray];\n this.streamingArray.length = 0;\n }\n return array;\n }\n\n /**\n * Returns a partially formed result object\n * Useful for returning the \"wrapper\" object when array is not top level\n * e.g. GeoJSON\n */\n getPartialResult() {\n return this.topLevelObject;\n }\n\n getStreamingJsonPath() {\n return this.streamingJsonPath;\n }\n\n getStreamingJsonPathAsString() {\n return this.streamingJsonPath && this.streamingJsonPath.toString();\n }\n\n getJsonPath() {\n return this.jsonpath;\n }\n\n // PRIVATE METHODS\n\n /**\n * Checks is this.getJsonPath matches the jsonpaths provided in options\n */\n _matchJSONPath() {\n const currentPath = this.getJsonPath();\n // console.debug(`Testing JSONPath`, currentPath);\n\n // Backwards compatibility, match any array\n // TODO implement using wildcard once that is supported\n if (this.jsonPaths.length === 0) {\n return true;\n }\n\n for (const jsonPath of this.jsonPaths) {\n if (jsonPath.equals(currentPath)) {\n return true;\n }\n }\n\n return false;\n }\n}\n"],"file":"streaming-json-parser.js"}
|
package/dist/ndjson-loader.js
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
extensions: ['ndjson'],
|
|
18
|
-
mimeTypes: ['application/x-ndjson'],
|
|
19
|
-
category: 'table',
|
|
20
|
-
text: true,
|
|
21
|
-
parse,
|
|
22
|
-
parseTextSync,
|
|
23
|
-
parseInBatches,
|
|
24
|
-
options: {}
|
|
1
|
+
import parseNDJSONSync from './lib/parse-ndjson';
|
|
2
|
+
import parseNDJSONInBatches from './lib/parse-ndjson-in-batches';
|
|
3
|
+
const VERSION = typeof "4.0.0-alpha.5" !== 'undefined' ? "4.0.0-alpha.5" : 'latest';
|
|
4
|
+
export const NDJSONLoader = {
|
|
5
|
+
name: 'NDJSON',
|
|
6
|
+
id: 'ndjson',
|
|
7
|
+
module: 'json',
|
|
8
|
+
version: VERSION,
|
|
9
|
+
extensions: ['ndjson'],
|
|
10
|
+
mimeTypes: ['application/x-ndjson'],
|
|
11
|
+
category: 'table',
|
|
12
|
+
text: true,
|
|
13
|
+
parse,
|
|
14
|
+
parseTextSync,
|
|
15
|
+
parseInBatches,
|
|
16
|
+
options: {}
|
|
25
17
|
};
|
|
18
|
+
|
|
26
19
|
async function parse(arrayBuffer) {
|
|
27
|
-
|
|
20
|
+
return parseTextSync(new TextDecoder().decode(arrayBuffer));
|
|
28
21
|
}
|
|
22
|
+
|
|
29
23
|
function parseTextSync(text) {
|
|
30
|
-
|
|
24
|
+
return parseNDJSONSync(text);
|
|
31
25
|
}
|
|
26
|
+
|
|
32
27
|
function parseInBatches(asyncIterator, options) {
|
|
33
|
-
|
|
28
|
+
return parseNDJSONInBatches(asyncIterator, options);
|
|
34
29
|
}
|
|
35
|
-
|
|
30
|
+
|
|
31
|
+
export const _typecheckNDJSONLoader = NDJSONLoader;
|
|
32
|
+
//# sourceMappingURL=ndjson-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ndjson-loader.ts"],"names":["parseNDJSONSync","parseNDJSONInBatches","VERSION","NDJSONLoader","name","id","module","version","extensions","mimeTypes","category","text","parse","parseTextSync","parseInBatches","options","arrayBuffer","TextDecoder","decode","asyncIterator","_typecheckNDJSONLoader"],"mappings":"AAEA,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,CALc;AAM1BC,EAAAA,SAAS,EAAE,CAAC,sBAAD,CANe;AAO1BC,EAAAA,QAAQ,EAAE,OAPgB;AAQ1BC,EAAAA,IAAI,EAAE,IARoB;AAS1BC,EAAAA,KAT0B;AAU1BC,EAAAA,aAV0B;AAW1BC,EAAAA,cAX0B;AAY1BC,EAAAA,OAAO,EAAE;AAZiB,CAArB;;AAeP,eAAeH,KAAf,CAAqBI,WAArB,EAA+C;AAC7C,SAAOH,aAAa,CAAC,IAAII,WAAJ,GAAkBC,MAAlB,CAAyBF,WAAzB,CAAD,CAApB;AACD;;AAED,SAASH,aAAT,CAAuBF,IAAvB,EAAqC;AACnC,SAAOX,eAAe,CAACW,IAAD,CAAtB;AACD;;AAED,SAASG,cAAT,CACEK,aADF,EAEEJ,OAFF,EAGwB;AACtB,SAAOd,oBAAoB,CAACkB,aAAD,EAAgBJ,OAAhB,CAA3B;AACD;;AAED,OAAO,MAAMK,sBAAwC,GAAGjB,YAAjD","sourcesContent":["import type {Batch} from '@loaders.gl/schema';\nimport 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 const NDJSONLoader = {\n name: 'NDJSON',\n id: 'ndjson',\n module: 'json',\n version: VERSION,\n extensions: ['ndjson'],\n mimeTypes: ['application/x-ndjson'],\n category: 'table',\n text: true,\n parse,\n parseTextSync,\n parseInBatches,\n options: {}\n};\n\nasync function parse(arrayBuffer: ArrayBuffer) {\n return parseTextSync(new TextDecoder().decode(arrayBuffer));\n}\n\nfunction parseTextSync(text: string) {\n return parseNDJSONSync(text);\n}\n\nfunction parseInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: LoaderOptions\n): AsyncIterable<Batch> {\n return parseNDJSONInBatches(asyncIterator, options);\n}\n\nexport const _typecheckNDJSONLoader: LoaderWithParser = NDJSONLoader;\n"],"file":"ndjson-loader.js"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
(0, loader_utils_1.createLoaderWorker)(geojson_loader_1.GeoJSONLoader);
|
|
1
|
+
import { createLoaderWorker } from '@loaders.gl/loader-utils';
|
|
2
|
+
import { GeoJSONLoader } from '../geojson-loader';
|
|
3
|
+
createLoaderWorker(GeoJSONLoader);
|
|
4
|
+
//# sourceMappingURL=geojson-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/workers/geojson-worker.ts"],"names":["createLoaderWorker","GeoJSONLoader"],"mappings":"AAAA,SAAQA,kBAAR,QAAiC,0BAAjC;AACA,SAAQC,aAAR,QAA4B,mBAA5B;AAEAD,kBAAkB,CAACC,aAAD,CAAlB","sourcesContent":["import {createLoaderWorker} from '@loaders.gl/loader-utils';\nimport {GeoJSONLoader} from '../geojson-loader';\n\ncreateLoaderWorker(GeoJSONLoader);\n"],"file":"geojson-worker.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/json",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.5",
|
|
4
4
|
"description": "Framework-independent loader for JSON and streaming JSON formats",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"JSON async iterator"
|
|
22
22
|
],
|
|
23
23
|
"types": "dist/index.d.ts",
|
|
24
|
-
"main": "dist/
|
|
25
|
-
"module": "dist/
|
|
24
|
+
"main": "dist/index.js",
|
|
25
|
+
"module": "dist/index.js",
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"files": [
|
|
28
28
|
"src",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"scripts": {
|
|
33
33
|
"pre-build": "npm run build-bundle && npm run build-worker",
|
|
34
34
|
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js",
|
|
35
|
-
"build-worker": "esbuild src/workers/geojson-worker.ts --bundle --outfile=dist/geojson-worker.js"
|
|
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": "
|
|
39
|
-
"@loaders.gl/loader-utils": "
|
|
40
|
-
"@loaders.gl/schema": "
|
|
38
|
+
"@loaders.gl/gis": "4.0.0-alpha.5",
|
|
39
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.5",
|
|
40
|
+
"@loaders.gl/schema": "4.0.0-alpha.5"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "7a71a54bdf1ddf985cc3af3db90b82e7fa97d025"
|
|
43
43
|
}
|
package/dist/es5/bundle.js
DELETED
package/dist/es5/bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
|