Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workers as ESM, remove RequireJS #11400

Merged
merged 14 commits into from
Sep 1, 2023
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ packages/engine/Build/**
packages/engine/Source/Scene/GltfPipeline/**
packages/engine/Source/Shaders/**
packages/engine/Source/ThirdParty/**
packages/engine/Source/Workers/**
!packages/engine/Source/Workers/transferTypedArrayTest.js

# packages/widgets
packages/widgets/Build/**
Expand Down
3 changes: 0 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ packages/engine/index.js
packages/engine/Source/Scene/GltfPipeline/**
packages/engine/Source/Shaders/**/*.js
packages/engine/Source/ThirdParty/**
packages/engine/Source/Workers/**/*
!packages/engine/Source/Workers/cesiumWorkerBootstrapper.js
!packages/engine/Source/Workers/transferTypedArrayTest.js

packages/widgets/Build/**
packages/widgets/index.js
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

#### @cesium/engine

##### Breaking Changes :mega:

- Firefox 114 is now the minimum Firefox version required to run CesiumJS. [#11400](https://github.com/CesiumGS/cesium/pull/11400)
- `TaskProcessor` now loads worker files as ESM instead of AMD. [#11400](https://github.com/CesiumGS/cesium/pull/11400)

##### Fixes :wrench:

- Fixed issue where terrain with multiple layers was loading higher LOD tiles inconsistently. [#11312](https://github.com/CesiumGS/cesium/issues/11312)
Expand Down
12 changes: 0 additions & 12 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,18 +270,6 @@ https://github.com/sole/tween.js
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

### RequireJS

https://github.com/jrburke/requirejs

> Copyright (c) 2010-2015, The Dojo Foundation
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

### Knockout

http://knockoutjs.com/
Expand Down
2 changes: 1 addition & 1 deletion Specs/BadGeometry.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { queryToObject, RuntimeError } from "@cesium/engine";

function BadGeometry() {
this._workerName = "../../Specs/TestWorkers/createBadGeometry";
this._workerName = "../../Build/Specs/TestWorkers/createBadGeometry";

// Make this worker loadable when testing against the built version of Cesium.
if (
Expand Down
12 changes: 4 additions & 8 deletions Specs/TestWorkers/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"extends": "../.eslintrc.json",
"env": {
"amd": true
},
"parserOptions": {
"ecmaVersion": 2015,
"sourceType": "script"
}
"extends": "cesium/browser",
"plugins": [
"es"
]
}
8 changes: 3 additions & 5 deletions Specs/TestWorkers/createBadGeometry.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
define(function () {
"use strict";
import { createTaskProcessorWorker } from "@cesium/engine";

return function () {
throw new Error("BadGeometry.createGeometry");
};
export default createTaskProcessorWorker(function () {
throw new Error("BadGeometry.createGeometry");
});
10 changes: 3 additions & 7 deletions Specs/TestWorkers/returnByteLength.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
define(["Workers/createTaskProcessorWorker"], function (
createTaskProcessorWorker
) {
"use strict";
import { createTaskProcessorWorker } from "@cesium/engine";

return createTaskProcessorWorker(function (parameters, transferableObjects) {
return parameters.byteLength;
});
export default createTaskProcessorWorker(function (parameters) {
return parameters.byteLength;
});
14 changes: 5 additions & 9 deletions Specs/TestWorkers/returnNonCloneable.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
define(["Workers/createTaskProcessorWorker"], function (
createTaskProcessorWorker
) {
"use strict";
import { createTaskProcessorWorker } from "@cesium/engine";

return createTaskProcessorWorker(function (parameters, transferableObjects) {
return function () {
//functions are not cloneable
};
});
export default createTaskProcessorWorker(function () {
return function () {
//functions are not cloneable
};
});
10 changes: 3 additions & 7 deletions Specs/TestWorkers/returnParameters.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
define(["Workers/createTaskProcessorWorker"], function (
createTaskProcessorWorker
) {
"use strict";
import { createTaskProcessorWorker } from "@cesium/engine";

return createTaskProcessorWorker(function (parameters, transferableObjects) {
return parameters;
});
export default createTaskProcessorWorker(function (parameters) {
return parameters;
});
11 changes: 4 additions & 7 deletions Specs/TestWorkers/returnWasmConfig.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
define([], function () {
"use strict";
import { createTaskProcessorWorker } from "@cesium/engine";

return function returnWasmConfig(event) {
const data = event.data;
const wasmConfig = data.webAssemblyConfig;
self.postMessage(wasmConfig);
};
export default createTaskProcessorWorker(function returnWasmConfig(parameters) {
const wasmConfig = parameters.webAssemblyConfig;
return wasmConfig;
});
10 changes: 3 additions & 7 deletions Specs/TestWorkers/throwError.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
define(["Workers/createTaskProcessorWorker"], function (
createTaskProcessorWorker
) {
"use strict";
import { createTaskProcessorWorker } from "@cesium/engine";

return createTaskProcessorWorker(function (parameters, transferableObjects) {
throw new Error(parameters.message);
});
export default createTaskProcessorWorker(function (parameters) {
throw new Error(parameters.message);
});
17 changes: 8 additions & 9 deletions Specs/TestWorkers/transferArrayBuffer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
define(["Workers/createTaskProcessorWorker"], function (
createTaskProcessorWorker
) {
"use strict";
import { createTaskProcessorWorker } from "@cesium/engine";

return createTaskProcessorWorker(function (parameters, transferableObjects) {
const arrayBuffer = new ArrayBuffer(parameters.byteLength);
transferableObjects.push(arrayBuffer);
return arrayBuffer;
});
export default createTaskProcessorWorker(function (
parameters,
transferableObjects
) {
const arrayBuffer = new ArrayBuffer(parameters.byteLength);
transferableObjects.push(arrayBuffer);
return arrayBuffer;
});
6 changes: 0 additions & 6 deletions ThirdParty.extra.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@
{
"name": "rbush"
},
{
"name": "requirejs",
"license": ["MIT"],
"version": "2.1.20",
"url": "https://www.npmjs.com/package/requirejs"
},
{
"name": "topojson-client"
},
Expand Down
12 changes: 2 additions & 10 deletions ThirdParty.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"license": [
"Apache-2.0"
],
"version": "3.0.3",
"version": "3.0.4",
"url": "https://www.npmjs.com/package/dompurify",
"notes": "dompurify is available as both MPL-2.0 OR Apache-2.0"
},
Expand Down Expand Up @@ -158,7 +158,7 @@
"license": [
"BSD-3-Clause"
],
"version": "7.2.3",
"version": "7.2.4",
"url": "https://www.npmjs.com/package/protobufjs"
},
{
Expand All @@ -169,14 +169,6 @@
"version": "3.0.1",
"url": "https://www.npmjs.com/package/rbush"
},
{
"name": "requirejs",
"license": [
"MIT"
],
"version": "2.1.20",
"url": "https://www.npmjs.com/package/requirejs"
},
{
"name": "topojson-client",
"license": [
Expand Down