Skip to content

Commit 7129b24

Browse files
committed
Convert CJS style exports to ESM style.
1 parent 395d3b9 commit 7129b24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+86
-628
lines changed

lib/CopyrightModule.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright(c) 2012-2014 National ICT Australia Limited (NICTA).
3+
* Copyright(c) 2014-2024 Terria Pty Ltd.
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -15,4 +15,4 @@
1515
* limitations under the License.
1616
*
1717
*/
18-
module.exports = {};
18+
export default {};

lib/Core/inherit.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

lib/Core/polyfill.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ function polyfill(callback) {
88
callback();
99
}
1010

11-
module.exports = polyfill;
11+
export default polyfill;

lib/Core/printWindow.ts

Lines changed: 0 additions & 74 deletions
This file was deleted.

lib/Core/sortedIndices.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"use strict";
2-
31
/**
42
* Returns indices such that array[indices[i]] = sortedArray[i].
53
* Eg. sortedIndices(['c', 'a', 'b', 'd']) => [1, 2, 0, 3]. (The sorted array is [a, b, c, d], and "a" was in position 1, "b" in position 2, etc.)
@@ -34,4 +32,4 @@ function sortedIndices(array, compareFunction) {
3432
// expect(inverseIndices).toEqual([2, 0, 1, 3]);
3533
// });
3634

37-
module.exports = sortedIndices;
35+
export default sortedIndices;

lib/Core/supportsWebGL.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
"use strict";
1+
import defined from "terriajs-cesium/Source/Core/defined";
22

3-
var defined = require("terriajs-cesium/Source/Core/defined").default;
4-
5-
var result;
3+
let result;
64

75
/**
86
* Determines if the current browser supports WebGL.
@@ -55,4 +53,4 @@ function supportsWebGL() {
5553
return result;
5654
}
5755

58-
module.exports = supportsWebGL;
56+
export default supportsWebGL;

lib/Map/DragPoints/CesiumDragPoints.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
"use strict";
2-
3-
var defined = require("terriajs-cesium/Source/Core/defined").default;
4-
var ScreenSpaceEventHandler =
5-
require("terriajs-cesium/Source/Core/ScreenSpaceEventHandler").default;
6-
var ScreenSpaceEventType =
7-
require("terriajs-cesium/Source/Core/ScreenSpaceEventType").default;
8-
var CustomDataSource =
9-
require("terriajs-cesium/Source/DataSources/CustomDataSource").default;
1+
import defined from "terriajs-cesium/Source/Core/defined";
2+
import ScreenSpaceEventHandler from "terriajs-cesium/Source/Core/ScreenSpaceEventHandler";
3+
import ScreenSpaceEventType from "terriajs-cesium/Source/Core/ScreenSpaceEventType";
4+
import CustomDataSource from "terriajs-cesium/Source/DataSources/CustomDataSource";
105

116
/**
127
* Callback for when a point is moved.
@@ -23,7 +18,7 @@ var CustomDataSource =
2318
* @param {Terria} terria The Terria instance.
2419
* @param {PointMovedCallback} pointMovedCallback A function that is called when a point is moved.
2520
*/
26-
var CesiumDragPoints = function (terria, pointMovedCallback) {
21+
const CesiumDragPoints = function (terria, pointMovedCallback) {
2722
this._terria = terria;
2823
this._setUp = false;
2924
this.type = "Cesium";
@@ -164,4 +159,4 @@ CesiumDragPoints.prototype._setCameraMotion = function (state) {
164159
this._scene.screenSpaceCameraController.enableTranslate = state;
165160
};
166161

167-
module.exports = CesiumDragPoints;
162+
export default CesiumDragPoints;

lib/Map/DragPoints/DragPoints.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
var defined = require("terriajs-cesium/Source/Core/defined").default;
2-
var CesiumDragPoints = require("./CesiumDragPoints");
3-
var LeafletDragPoints = require("./LeafletDragPoints");
4-
var ViewerMode = require("../../Models/ViewerMode").default;
1+
import defined from "terriajs-cesium/Source/Core/defined";
2+
import CesiumDragPoints from "./CesiumDragPoints";
3+
import LeafletDragPoints from "./LeafletDragPoints";
4+
import ViewerMode from "../../Models/ViewerMode";
55

66
/**
77
* Callback for when a point is moved.

lib/Map/DragPoints/LeafletDragPoints.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
"use strict";
2-
var defined = require("terriajs-cesium/Source/Core/defined").default;
3-
var Cartesian3 = require("terriajs-cesium/Source/Core/Cartesian3").default;
4-
var CustomDataSource =
5-
require("terriajs-cesium/Source/DataSources/CustomDataSource").default;
1+
import defined from "terriajs-cesium/Source/Core/defined";
2+
import Cartesian3 from "terriajs-cesium/Source/Core/Cartesian3";
3+
import CustomDataSource from "terriajs-cesium/Source/DataSources/CustomDataSource";
64

75
/**
86
* Callback for when a point is moved.
@@ -19,7 +17,7 @@ var CustomDataSource =
1917
* @param {Terria} terria The Terria instance.
2018
* @param {PointMovedCallback} pointMovedCallback A function that is called when a point is moved.
2119
*/
22-
var LeafletDragPoints = function (terria, pointMovedCallback) {
20+
const LeafletDragPoints = function (terria, pointMovedCallback) {
2321
this._terria = terria;
2422
this._setUp = false;
2523
this.type = "Leaflet";
@@ -160,4 +158,4 @@ LeafletDragPoints.prototype.destroy = function () {
160158
this._setUp = false;
161159
};
162160

163-
module.exports = LeafletDragPoints;
161+
export default LeafletDragPoints;

lib/Map/Vector/EarthGravityModel1996.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
"use strict";
2-
3-
var CesiumMath = require("terriajs-cesium/Source/Core/Math").default;
4-
var defined = require("terriajs-cesium/Source/Core/defined").default;
5-
var loadArrayBuffer = require("../../Core/loadArrayBuffer").default;
1+
import CesiumMath from "terriajs-cesium/Source/Core/Math";
2+
import defined from "terriajs-cesium/Source/Core/defined";
3+
import loadArrayBuffer from "../../Core/loadArrayBuffer";
64

75
/**
86
* The Earth Gravity Model 1996 (EGM96) geoid.
@@ -131,4 +129,4 @@ function getHeightValue(data, recordIndex, heightIndex) {
131129
return data[recordIndex * 1440 + heightIndex];
132130
}
133131

134-
module.exports = EarthGravityModel1996;
132+
export default EarthGravityModel1996;

0 commit comments

Comments
 (0)