New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@foxglove/rosmsg

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@foxglove/rosmsg - npm Package Compare versions

Comparing version 5.0.2 to 5.0.3

4

package.json
{
"name": "@foxglove/rosmsg",
"version": "5.0.2",
"version": "5.0.3",
"description": "Parser for ROS and ROS 2 .msg definitions",

@@ -50,3 +50,3 @@ "license": "MIT",

"dependencies": {
"@foxglove/message-definition": "^0.2.0",
"@foxglove/message-definition": "^0.3.1",
"md5-typescript": "^1.0.5"

@@ -53,0 +53,0 @@ },

@@ -237,2 +237,2 @@ # @foxglove/rosmsg

Join our [Slack channel](https://foxglove.dev/join-slack) to ask questions, share feedback, and stay up to date on what our team is working on.
Join our [Slack channel](https://foxglove.dev/slack) to ask questions, share feedback, and stay up to date on what our team is working on.

@@ -626,2 +626,69 @@ // This file incorporates work covered by the following copyright and

});
it("handles duplicate types", () => {
const messageDefinition = `
foo_msgs/TypeA a
foo_msgs/TypeB b
================================================================================
MSG: foo_msgs/TypeA
uint64 u
================================================================================
MSG: foo_msgs/TypeB
foo_msgs/TypeA a
int32 i
================================================================================
MSG: foo_msgs/TypeA
uint64 u
`;
const types = parse(messageDefinition, { ros2: true });
expect(types).toEqual([
{
definitions: [
{
type: "foo_msgs/TypeA",
isArray: false,
name: "a",
isComplex: true,
},
{
type: "foo_msgs/TypeB",
isArray: false,
name: "b",
isComplex: true,
},
],
},
{
name: "foo_msgs/TypeA",
definitions: [
{
type: "uint64",
isArray: false,
name: "u",
isComplex: false,
},
],
},
{
name: "foo_msgs/TypeB",
definitions: [
{
type: "foo_msgs/TypeA",
isArray: false,
name: "a",
isComplex: true,
},
{
type: "int32",
isArray: false,
name: "i",
isComplex: false,
},
],
},
]);
});
});

@@ -1112,2 +1112,69 @@ // This file incorporates work covered by the following copyright and

});
it("handles duplicate types", () => {
const messageDefinition = `
foo_msgs/msg/TypeA a
foo_msgs/msg/TypeB b
================================================================================
MSG: foo_msgs/msg/TypeA
uint64 u
================================================================================
MSG: foo_msgs/msg/TypeB
foo_msgs/msg/TypeA a
int32 i
================================================================================
MSG: foo_msgs/msg/TypeA
uint64 u
`;
const types = parse(messageDefinition, { ros2: true });
expect(types).toEqual([
{
definitions: [
{
type: "foo_msgs/msg/TypeA",
isArray: false,
name: "a",
isComplex: true,
},
{
type: "foo_msgs/msg/TypeB",
isArray: false,
name: "b",
isComplex: true,
},
],
},
{
name: "foo_msgs/msg/TypeA",
definitions: [
{
type: "uint64",
isArray: false,
name: "u",
isComplex: false,
},
],
},
{
name: "foo_msgs/msg/TypeB",
definitions: [
{
type: "foo_msgs/msg/TypeA",
isArray: false,
name: "a",
isComplex: true,
},
{
type: "int32",
isArray: false,
name: "i",
isComplex: false,
},
],
},
]);
});
});

@@ -10,3 +10,7 @@ // This file incorporates work covered by the following copyright and

import { MessageDefinition, MessageDefinitionField } from "@foxglove/message-definition";
import {
MessageDefinition,
MessageDefinitionField,
isMsgDefEqual,
} from "@foxglove/message-definition";
import { Grammar, Parser } from "nearley";

@@ -80,8 +84,18 @@

// Filter out duplicate types to handle the case where schemas are erroneously duplicated
// e.g. caused by a bug in `mcap convert`. Removing duplicates here will avoid that searching
// a type by name will return more than one result.
const seenTypes: MessageDefinition[] = [];
const uniqueTypes = types.filter((definition) => {
return seenTypes.find((otherDefinition) => isMsgDefEqual(definition, otherDefinition))
? false
: seenTypes.push(definition); // Always evaluates to true;
});
// Fix up complex type names
if (options.skipTypeFixup !== true) {
fixupTypes(types);
fixupTypes(uniqueTypes);
}
return types;
return uniqueTypes;
}

@@ -88,0 +102,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc