Skip to content

Commit 66ab9d1

Browse files
authored
Finally commit to breaking the module API for 2.0 (#1056)
1 parent 86f7dcd commit 66ab9d1

File tree

15 files changed

+57
-83
lines changed

15 files changed

+57
-83
lines changed

examples/node_simple.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22

33
// Connecting to ROS
4-
import ROSLIB from "../src/index";
4+
import * as ROSLIB from "../src/RosLib";
55

66
const ros = new ROSLIB.Ros({
77
url: "ws://localhost:9090",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
},
5858
"scripts": {
5959
"build": "vite build",
60-
"doc": "typedoc src/index.ts",
60+
"doc": "typedoc src/RosLib.ts",
6161
"lint": "eslint .",
6262
"test": "vitest",
6363
"prepublishOnly": "npm run test",

src/RosLib.ts

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,51 @@
44
*/
55

66
/** @description Library version */
7-
export * from "./index.js";
8-
import ROSLIB from "./index.js";
7+
export const REVISION = import.meta.env.VITE_ROSLIBJS_VERSION;
98

10-
// same as index.js, except add to global namespace for in-browser support (i.e. CDN)
11-
globalThis.ROSLIB = ROSLIB;
9+
// Core exports
10+
export { default as Ros } from "./core/Ros.js";
11+
export { default as Topic } from "./core/Topic.js";
12+
export { default as Param } from "./core/Param.js";
13+
export { default as Service } from "./core/Service.js";
14+
export { default as Action } from "./core/Action.js";
15+
16+
// ActionLib exports
17+
export { default as ActionClient } from "./actionlib/ActionClient.js";
18+
export { default as ActionListener } from "./actionlib/ActionListener.js";
19+
export { default as Goal } from "./actionlib/Goal.js";
20+
export { default as SimpleActionServer } from "./actionlib/SimpleActionServer.js";
21+
22+
// Math exports
23+
export { default as Pose, type IPose } from "./math/Pose.js";
24+
export { default as Quaternion, type IQuaternion } from "./math/Quaternion.js";
25+
export { default as Transform, type ITransform } from "./math/Transform.js";
26+
export { default as Vector3, type IVector3 } from "./math/Vector3.js";
27+
28+
// TF exports
29+
export { default as TFClient } from "./tf/TFClient.js";
30+
export { default as ROS2TFClient } from "./tf/ROS2TFClient.js";
31+
32+
// URDF exports
33+
export { default as UrdfBox } from "./urdf/UrdfBox.js";
34+
export { default as UrdfColor } from "./urdf/UrdfColor.js";
35+
export { default as UrdfCylinder } from "./urdf/UrdfCylinder.js";
36+
export { default as UrdfLink } from "./urdf/UrdfLink.js";
37+
export { default as UrdfMaterial } from "./urdf/UrdfMaterial.js";
38+
export { default as UrdfMesh } from "./urdf/UrdfMesh.js";
39+
export {
40+
default as UrdfModel,
41+
type UrdfModelOptions,
42+
} from "./urdf/UrdfModel.js";
43+
export { default as UrdfSphere } from "./urdf/UrdfSphere.js";
44+
export {
45+
default as UrdfVisual,
46+
type UrdfGeometryLike,
47+
} from "./urdf/UrdfVisual.js";
48+
49+
export {
50+
UrdfAttrs,
51+
UrdfType,
52+
type UrdfDefaultOptions,
53+
} from "./urdf/UrdfTypes.js";
54+
export { isElement, parseUrdfOrigin } from "./urdf/UrdfUtils.js";

src/actionlib/index.ts

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

src/core/index.ts

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

src/index.ts

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

src/math/index.ts

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

src/tf/index.ts

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

src/urdf/UrdfBox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @author Russell Toris - rctoris@wpi.edu
55
*/
66

7-
import { Vector3 } from "../math/index.js";
7+
import Vector3 from "../math/Vector3.js";
88
import { UrdfAttrs, UrdfType, type UrdfDefaultOptions } from "./UrdfTypes.js";
99
import type { Optional, Nullable } from "../types/interface-types.js";
1010

src/urdf/UrdfJoint.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
*/
55

66
import { UrdfAttrs, type UrdfDefaultOptions } from "./UrdfTypes.js";
7-
import { Pose, Vector3 } from "../math/index.js";
7+
import Pose from "../math/Pose.js";
8+
import Vector3 from "../math/Vector3.js";
89
import { parseUrdfOrigin } from "./UrdfUtils.js";
910
import type { Nullable } from "../types/interface-types.js";
1011

0 commit comments

Comments
 (0)