@carto/api-client 0.5.6-alpha.0 → 0.5.6-alpha.bundle.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/CHANGELOG.md +0 -4
- package/build/api-client.cjs +15 -5
- package/build/api-client.cjs.map +1 -1
- package/build/api-client.d.cts +7 -0
- package/build/api-client.d.ts +7 -0
- package/build/api-client.js +15 -5
- package/build/api-client.js.map +1 -1
- package/build/worker.global.js +19721 -0
- package/build/worker.global.js.map +1 -0
- package/package.json +4 -1
- package/src/sources/types.ts +8 -0
- package/src/widget-sources/widget-tileset-source.ts +18 -5
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"homepage": "https://github.com/CartoDB/carto-api-client#readme",
|
|
9
9
|
"author": "Don McCurdy <donmccurdy@carto.com>",
|
|
10
10
|
"packageManager": "yarn@4.3.1",
|
|
11
|
-
"version": "0.5.6-alpha.
|
|
11
|
+
"version": "0.5.6-alpha.bundle.2",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
"./worker": {
|
|
31
31
|
"types": "./build/worker.d.ts",
|
|
32
32
|
"default": "./build/worker.js"
|
|
33
|
+
},
|
|
34
|
+
"./worker.global": {
|
|
35
|
+
"default": "./build/worker.global.js"
|
|
33
36
|
}
|
|
34
37
|
},
|
|
35
38
|
"browserslist": [
|
package/src/sources/types.ts
CHANGED
|
@@ -188,6 +188,14 @@ export type TilesetSourceOptions = {
|
|
|
188
188
|
* are used by default if the runtime environment supports ES Module Workers.
|
|
189
189
|
*/
|
|
190
190
|
widgetWorker?: boolean;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Script URL used to create Web Workers for local widget calculations. In
|
|
194
|
+
* most cases a custom URL is not needed; bundlers will resolve the worker
|
|
195
|
+
* URL from a `@carto/api-client/worker` import internally. Advanced uses
|
|
196
|
+
* may require deploying the script manually and providing a custom URL.
|
|
197
|
+
*/
|
|
198
|
+
widgetWorkerUrl?: string;
|
|
191
199
|
};
|
|
192
200
|
|
|
193
201
|
export type ColumnsOption = {
|
|
@@ -99,13 +99,26 @@ export class WidgetTilesetSource<
|
|
|
99
99
|
return this._workerImpl;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
// For Vite (and perhaps other bundlers) to parse WorkerOptions, it
|
|
103
|
+
// must be a static, inline object – duplicated below.
|
|
104
|
+
if (this.props.widgetWorkerUrl) {
|
|
105
|
+
this._workerImpl = new Worker(this.props.widgetWorkerUrl, {
|
|
105
106
|
type: 'module',
|
|
106
107
|
name: 'cartowidgettileset',
|
|
107
|
-
}
|
|
108
|
-
|
|
108
|
+
});
|
|
109
|
+
} else {
|
|
110
|
+
this._workerImpl = new Worker(
|
|
111
|
+
new URL('@carto/api-client/worker', import.meta.url),
|
|
112
|
+
{
|
|
113
|
+
type: 'module',
|
|
114
|
+
name: 'cartowidgettileset',
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
this._workerImpl.addEventListener('error', (e) => {
|
|
120
|
+
console.error('widget-tileset-source worker error', e);
|
|
121
|
+
});
|
|
109
122
|
|
|
110
123
|
this._workerImpl.postMessage({
|
|
111
124
|
method: Method.INIT,
|