@loaders.gl/wkt 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,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.VERSION = 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
  exports.VERSION = VERSION;
9
9
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/utils/version.ts"],"names":["VERSION"],"mappings":";;;;;;AAGO,IAAMA,OAAO,GAAG,mBAAuB,WAAvB,aAAmD,QAAnE","sourcesContent":["// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n"],"file":"version.js"}
1
+ {"version":3,"sources":["../../../../src/lib/utils/version.ts"],"names":["VERSION"],"mappings":";;;;;;AAGO,IAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE","sourcesContent":["// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n"],"file":"version.js"}
@@ -1,2 +1,2 @@
1
- export const VERSION = typeof "3.1.6" !== 'undefined' ? "3.1.6" : 'latest';
1
+ export const VERSION = typeof "3.2.0-alpha.1" !== 'undefined' ? "3.2.0-alpha.1" : 'latest';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/utils/version.ts"],"names":["VERSION"],"mappings":"AAGA,OAAO,MAAMA,OAAO,GAAG,mBAAuB,WAAvB,aAAmD,QAAnE","sourcesContent":["// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n"],"file":"version.js"}
1
+ {"version":3,"sources":["../../../../src/lib/utils/version.ts"],"names":["VERSION"],"mappings":"AAGA,OAAO,MAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE","sourcesContent":["// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n"],"file":"version.js"}
@@ -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
- self.onmessage = (message) => {
42
- if (!isKnownMessage(message)) {
43
- return;
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 { type, payload } = message.data;
73
+ const parentPort3 = getParentPort();
74
+ const { type, payload } = parentPort3 ? message : message.data;
57
75
  onMessage(type, payload);
58
76
  };
59
77
  }
60
- self.addEventListener("message", onMessageWrapper);
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
- self.removeEventListener("message", onMessageWrapper);
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
- if (self) {
69
- const data = { source: "loaders.gl", type, payload };
70
- const transferList = getTransferList(payload);
71
- self.postMessage(data, transferList);
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 (typeof self === "undefined") {
114
+ if (!WorkerBody.inWorkerThread()) {
84
115
  return;
85
116
  }
86
117
  WorkerBody.onmessage = async (type, payload) => {
@@ -152,7 +183,7 @@
152
183
  }
153
184
 
154
185
  // src/lib/utils/version.ts
155
- var VERSION = true ? "3.1.6" : "latest";
186
+ var VERSION = true ? "3.2.0-alpha.1" : "latest";
156
187
 
157
188
  // src/lib/parse-wkt.ts
158
189
  var numberRegexp = /[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@loaders.gl/wkt",
3
3
  "description": "Loader and Writer for the WKT (Well Known Text) Format",
4
- "version": "3.1.6",
4
+ "version": "3.2.0-alpha.1",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -35,8 +35,8 @@
35
35
  "fuzzer": "^0.2.1"
36
36
  },
37
37
  "dependencies": {
38
- "@loaders.gl/loader-utils": "3.1.6",
39
- "@loaders.gl/schema": "3.1.6"
38
+ "@loaders.gl/loader-utils": "3.2.0-alpha.1",
39
+ "@loaders.gl/schema": "3.2.0-alpha.1"
40
40
  },
41
- "gitHead": "4fe0724b942697a95ff3eb3af47b7a7c18556c52"
41
+ "gitHead": "423a2815092b08dcf93ad5b7dc2940b167305afe"
42
42
  }