@loaders.gl/flatgeobuf 3.1.6 → 3.2.0-alpha.1

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.
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports._typecheckFlatGeobufLoader = exports.FlatGeobufLoader = void 0;
7
- var VERSION = typeof "3.1.6" !== 'undefined' ? "3.1.6" : 'latest';
7
+ var VERSION = typeof "3.2.0-alpha.1" !== 'undefined' ? "3.2.0-alpha.1" : 'latest';
8
8
  var FlatGeobufLoader = {
9
9
  id: 'flatgeobuf',
10
10
  name: 'FlatGeobuf',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/flatgeobuf-loader.ts"],"names":["VERSION","FlatGeobufLoader","id","name","module","version","worker","extensions","mimeTypes","category","options","flatgeobuf","_typecheckFlatGeobufLoader"],"mappings":";;;;;;AAIA,IAAMA,OAAO,GAAG,mBAAuB,WAAvB,aAAmD,QAAnE;AAEO,IAAMC,gBAAgB,GAAG;AAC9BC,EAAAA,EAAE,EAAE,YAD0B;AAE9BC,EAAAA,IAAI,EAAE,YAFwB;AAG9BC,EAAAA,MAAM,EAAE,YAHsB;AAI9BC,EAAAA,OAAO,EAAEL,OAJqB;AAK9BM,EAAAA,MAAM,EAAE,IALsB;AAM9BC,EAAAA,UAAU,EAAE,CAAC,KAAD,CANkB;AAO9BC,EAAAA,SAAS,EAAE,CAAC,0BAAD,CAPmB;AAQ9BC,EAAAA,QAAQ,EAAE,UARoB;AAS9BC,EAAAA,OAAO,EAAE;AACPC,IAAAA,UAAU,EAAE;AADL;AATqB,CAAzB;;AAcA,IAAMC,0BAAkC,GAAGX,gBAA3C","sourcesContent":["import type {Loader} from '@loaders.gl/loader-utils';\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 FlatGeobufLoader = {\n id: 'flatgeobuf',\n name: 'FlatGeobuf',\n module: 'flatgeobuf',\n version: VERSION,\n worker: true,\n extensions: ['fgb'],\n mimeTypes: ['application/octet-stream'],\n category: 'geometry',\n options: {\n flatgeobuf: {}\n }\n};\n\nexport const _typecheckFlatGeobufLoader: Loader = FlatGeobufLoader;\n"],"file":"flatgeobuf-loader.js"}
1
+ {"version":3,"sources":["../../src/flatgeobuf-loader.ts"],"names":["VERSION","FlatGeobufLoader","id","name","module","version","worker","extensions","mimeTypes","category","options","flatgeobuf","_typecheckFlatGeobufLoader"],"mappings":";;;;;;AAIA,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAEO,IAAMC,gBAAgB,GAAG;AAC9BC,EAAAA,EAAE,EAAE,YAD0B;AAE9BC,EAAAA,IAAI,EAAE,YAFwB;AAG9BC,EAAAA,MAAM,EAAE,YAHsB;AAI9BC,EAAAA,OAAO,EAAEL,OAJqB;AAK9BM,EAAAA,MAAM,EAAE,IALsB;AAM9BC,EAAAA,UAAU,EAAE,CAAC,KAAD,CANkB;AAO9BC,EAAAA,SAAS,EAAE,CAAC,0BAAD,CAPmB;AAQ9BC,EAAAA,QAAQ,EAAE,UARoB;AAS9BC,EAAAA,OAAO,EAAE;AACPC,IAAAA,UAAU,EAAE;AADL;AATqB,CAAzB;;AAcA,IAAMC,0BAAkC,GAAGX,gBAA3C","sourcesContent":["import type {Loader} from '@loaders.gl/loader-utils';\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 FlatGeobufLoader = {\n id: 'flatgeobuf',\n name: 'FlatGeobuf',\n module: 'flatgeobuf',\n version: VERSION,\n worker: true,\n extensions: ['fgb'],\n mimeTypes: ['application/octet-stream'],\n category: 'geometry',\n options: {\n flatgeobuf: {}\n }\n};\n\nexport const _typecheckFlatGeobufLoader: Loader = FlatGeobufLoader;\n"],"file":"flatgeobuf-loader.js"}
@@ -1,4 +1,4 @@
1
- const VERSION = typeof "3.1.6" !== 'undefined' ? "3.1.6" : 'latest';
1
+ const VERSION = typeof "3.2.0-alpha.1" !== 'undefined' ? "3.2.0-alpha.1" : 'latest';
2
2
  export const FlatGeobufLoader = {
3
3
  id: 'flatgeobuf',
4
4
  name: 'FlatGeobuf',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/flatgeobuf-loader.ts"],"names":["VERSION","FlatGeobufLoader","id","name","module","version","worker","extensions","mimeTypes","category","options","flatgeobuf","_typecheckFlatGeobufLoader"],"mappings":"AAIA,MAAMA,OAAO,GAAG,mBAAuB,WAAvB,aAAmD,QAAnE;AAEA,OAAO,MAAMC,gBAAgB,GAAG;AAC9BC,EAAAA,EAAE,EAAE,YAD0B;AAE9BC,EAAAA,IAAI,EAAE,YAFwB;AAG9BC,EAAAA,MAAM,EAAE,YAHsB;AAI9BC,EAAAA,OAAO,EAAEL,OAJqB;AAK9BM,EAAAA,MAAM,EAAE,IALsB;AAM9BC,EAAAA,UAAU,EAAE,CAAC,KAAD,CANkB;AAO9BC,EAAAA,SAAS,EAAE,CAAC,0BAAD,CAPmB;AAQ9BC,EAAAA,QAAQ,EAAE,UARoB;AAS9BC,EAAAA,OAAO,EAAE;AACPC,IAAAA,UAAU,EAAE;AADL;AATqB,CAAzB;AAcP,OAAO,MAAMC,0BAAkC,GAAGX,gBAA3C","sourcesContent":["import type {Loader} from '@loaders.gl/loader-utils';\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 FlatGeobufLoader = {\n id: 'flatgeobuf',\n name: 'FlatGeobuf',\n module: 'flatgeobuf',\n version: VERSION,\n worker: true,\n extensions: ['fgb'],\n mimeTypes: ['application/octet-stream'],\n category: 'geometry',\n options: {\n flatgeobuf: {}\n }\n};\n\nexport const _typecheckFlatGeobufLoader: Loader = FlatGeobufLoader;\n"],"file":"flatgeobuf-loader.js"}
1
+ {"version":3,"sources":["../../src/flatgeobuf-loader.ts"],"names":["VERSION","FlatGeobufLoader","id","name","module","version","worker","extensions","mimeTypes","category","options","flatgeobuf","_typecheckFlatGeobufLoader"],"mappings":"AAIA,MAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAEA,OAAO,MAAMC,gBAAgB,GAAG;AAC9BC,EAAAA,EAAE,EAAE,YAD0B;AAE9BC,EAAAA,IAAI,EAAE,YAFwB;AAG9BC,EAAAA,MAAM,EAAE,YAHsB;AAI9BC,EAAAA,OAAO,EAAEL,OAJqB;AAK9BM,EAAAA,MAAM,EAAE,IALsB;AAM9BC,EAAAA,UAAU,EAAE,CAAC,KAAD,CANkB;AAO9BC,EAAAA,SAAS,EAAE,CAAC,0BAAD,CAPmB;AAQ9BC,EAAAA,QAAQ,EAAE,UARoB;AAS9BC,EAAAA,OAAO,EAAE;AACPC,IAAAA,UAAU,EAAE;AADL;AATqB,CAAzB;AAcP,OAAO,MAAMC,0BAAkC,GAAGX,gBAA3C","sourcesContent":["import type {Loader} from '@loaders.gl/loader-utils';\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 FlatGeobufLoader = {\n id: 'flatgeobuf',\n name: 'FlatGeobuf',\n module: 'flatgeobuf',\n version: VERSION,\n worker: true,\n extensions: ['fgb'],\n mimeTypes: ['application/octet-stream'],\n category: 'geometry',\n options: {\n flatgeobuf: {}\n }\n};\n\nexport const _typecheckFlatGeobufLoader: Loader = FlatGeobufLoader;\n"],"file":"flatgeobuf-loader.js"}
@@ -3246,16 +3246,33 @@
3246
3246
  }
3247
3247
 
3248
3248
  // ../worker-utils/src/lib/worker-farm/worker-body.ts
3249
+ function getParentPort() {
3250
+ let parentPort;
3251
+ try {
3252
+ eval("globalThis.parentPort = require('worker_threads').parentPort");
3253
+ parentPort = globalThis.parentPort;
3254
+ } catch {
3255
+ }
3256
+ return parentPort;
3257
+ }
3249
3258
  var onMessageWrapperMap = new Map();
3250
3259
  var WorkerBody = class {
3260
+ static inWorkerThread() {
3261
+ return typeof self !== "undefined" || Boolean(getParentPort());
3262
+ }
3251
3263
  static set onmessage(onMessage) {
3252
- self.onmessage = (message) => {
3253
- if (!isKnownMessage(message)) {
3254
- return;
3255
- }
3256
- const { type, payload } = message.data;
3264
+ function handleMessage(message) {
3265
+ const parentPort3 = getParentPort();
3266
+ const { type, payload } = parentPort3 ? message : message.data;
3257
3267
  onMessage(type, payload);
3258
- };
3268
+ }
3269
+ const parentPort2 = getParentPort();
3270
+ if (parentPort2) {
3271
+ parentPort2.on("message", handleMessage);
3272
+ parentPort2.on("exit", () => console.debug("Node worker closing"));
3273
+ } else {
3274
+ globalThis.onmessage = handleMessage;
3275
+ }
3259
3276
  }
3260
3277
  static addEventListener(onMessage) {
3261
3278
  let onMessageWrapper = onMessageWrapperMap.get(onMessage);
@@ -3264,22 +3281,36 @@
3264
3281
  if (!isKnownMessage(message)) {
3265
3282
  return;
3266
3283
  }
3267
- const { type, payload } = message.data;
3284
+ const parentPort3 = getParentPort();
3285
+ const { type, payload } = parentPort3 ? message : message.data;
3268
3286
  onMessage(type, payload);
3269
3287
  };
3270
3288
  }
3271
- self.addEventListener("message", onMessageWrapper);
3289
+ const parentPort2 = getParentPort();
3290
+ if (parentPort2) {
3291
+ console.error("not implemented");
3292
+ } else {
3293
+ globalThis.addEventListener("message", onMessageWrapper);
3294
+ }
3272
3295
  }
3273
3296
  static removeEventListener(onMessage) {
3274
3297
  const onMessageWrapper = onMessageWrapperMap.get(onMessage);
3275
3298
  onMessageWrapperMap.delete(onMessage);
3276
- self.removeEventListener("message", onMessageWrapper);
3299
+ const parentPort2 = getParentPort();
3300
+ if (parentPort2) {
3301
+ console.error("not implemented");
3302
+ } else {
3303
+ globalThis.removeEventListener("message", onMessageWrapper);
3304
+ }
3277
3305
  }
3278
3306
  static postMessage(type, payload) {
3279
- if (self) {
3280
- const data = { source: "loaders.gl", type, payload };
3281
- const transferList = getTransferList(payload);
3282
- self.postMessage(data, transferList);
3307
+ const data = { source: "loaders.gl", type, payload };
3308
+ const transferList = getTransferList(payload);
3309
+ const parentPort2 = getParentPort();
3310
+ if (parentPort2) {
3311
+ parentPort2.postMessage(data, transferList);
3312
+ } else {
3313
+ globalThis.postMessage(data, transferList);
3283
3314
  }
3284
3315
  }
3285
3316
  };
@@ -3291,7 +3322,7 @@
3291
3322
  // ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
3292
3323
  var requestId = 0;
3293
3324
  function createLoaderWorker(loader) {
3294
- if (typeof self === "undefined") {
3325
+ if (!WorkerBody.inWorkerThread()) {
3295
3326
  return;
3296
3327
  }
3297
3328
  WorkerBody.onmessage = async (type, payload) => {
@@ -3363,7 +3394,7 @@
3363
3394
  }
3364
3395
 
3365
3396
  // src/flatgeobuf-loader.ts
3366
- var VERSION = true ? "3.1.6" : "latest";
3397
+ var VERSION = true ? "3.2.0-alpha.1" : "latest";
3367
3398
  var FlatGeobufLoader = {
3368
3399
  id: "flatgeobuf",
3369
3400
  name: "FlatGeobuf",
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@loaders.gl/flatgeobuf",
3
3
  "description": "Loader for FlatGeobuf",
4
- "version": "3.1.6",
4
+ "version": "3.2.0-alpha.1",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "https://github.com/uber-web/loaders.gl"
11
+ "url": "https://github.com/visgl/loaders.gl"
12
12
  },
13
13
  "keywords": [
14
14
  "geometry",
@@ -33,9 +33,9 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@loaders.gl/gis": "4.0.0-alpha.1",
36
- "@loaders.gl/loader-utils": "3.1.6",
36
+ "@loaders.gl/loader-utils": "3.2.0-alpha.1",
37
37
  "@math.gl/proj4": "^3.3.1",
38
38
  "flatgeobuf": "3.6.5"
39
39
  },
40
- "gitHead": "4fe0724b942697a95ff3eb3af47b7a7c18556c52"
40
+ "gitHead": "423a2815092b08dcf93ad5b7dc2940b167305afe"
41
41
  }