-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add @mcap/support, @mcap/nodejs, and @mcap/browser libraries (#868)
**Public-Facing Changes** - [TypeScript] Added a new package `@mcap/support`. This package provides decompression functions for zstd, lz4, and bz2, and utility functions for working with protobuf descriptors. - [TypeScript] Added a new package `@mcap/nodejs`. This package provides IReadable and IWritable implementations for Node.js `FileHandle`, reducing boilerplate for reading or writing MCAP files. - [TypeScript] Added a new package `@mcap/browser`. This package provides an IReadable implementation for the browser `Blob` (`File`) type, reducing boilerplate for reading MCAP files. - [TypeScript] Examples have been updated to use `@mcap/support` + `@mcap/nodejs` and remove repeated boilerplate **Description** **Note:** This began as un-revert of #838 (see #841) Relates to FG-2274 Resolves #719 Resolves #720 This package has been migrated from the @foxglove/mcap-support internal package in the foxglove/studio repo. Two new additions are `FileHandleWritable` under the `@mcap/nodejs` package, and `protobufDescriptors.ts` to provide helper methods for protobuf descriptors and avoid each project having to include a `protobufjs.d.ts` copy-paste. ~Studio's protobuf timestamp/duration rewriting logic has been replaced with `processRootType` & `processMessageDefinitions` functions that Studio can continue using to implement that behavior without inflicting its opinion upon other users of the library.~ Porting of deserialization for different encodings will be done in a separate PR when we have a chance to revisit the reader APIs to make them more friendly. --------- Co-authored-by: John Hurliman <[email protected]>
- Loading branch information
Showing
79 changed files
with
1,285 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,23 +6,33 @@ | |
"typescript/benchmarks", | ||
"typescript/core", | ||
"typescript/examples/*", | ||
"typescript/support", | ||
"typescript/nodejs", | ||
"typescript/browser", | ||
"website" | ||
] | ||
}, | ||
"scripts": { | ||
"prettier": "prettier --write .", | ||
"prettier:check": "prettier --check .", | ||
"docs:swift:start": "swift package --disable-sandbox preview-documentation --target MCAP", | ||
"typedoc": "typedoc --out __docs__/typescript typescript/core/src/index.ts --tsconfig typescript/core/tsconfig.json", | ||
"typedoc": "yarn typescript:build && typedoc --out __docs__/typescript --options typescript/typedoc.json", | ||
"start": "yarn workspace website start", | ||
"spellcheck": "cspell --relative '**'", | ||
"typescript:test": "yarn jest --config typescript/jest.config.json", | ||
"typescript:build": "yarn workspace @mcap/core build && yarn workspace @mcap/support build && yarn workspace @mcap/nodejs build && yarn workspace @mcap/browser build", | ||
"typescript:clean": "yarn workspace @mcap/core build --clean && yarn workspace @mcap/support build --clean && yarn workspace @mcap/nodejs build --clean && yarn workspace @mcap/browser build --clean", | ||
"test:conformance:generate-inputs": "yarn workspace @foxglove/mcap-conformance generate-inputs --data-dir \"$(pwd)/tests/conformance/data\"", | ||
"test:conformance": "yarn workspace @foxglove/mcap-conformance run-tests --data-dir \"$(pwd)/tests/conformance/data\"" | ||
}, | ||
"packageManager": "[email protected]", | ||
"devDependencies": { | ||
"@types/node": "18.13.0", | ||
"cspell": "8.0.0", | ||
"jest": "29.7.0", | ||
"prettier": "3.1.0", | ||
"ts-jest": "29.1.1", | ||
"ts-node": "10.9.1", | ||
"typedoc": "0.25.3", | ||
"typescript": "5.2.2" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Development guide | ||
|
||
Install dependencies: | ||
|
||
``` | ||
corepack enable | ||
yarn install | ||
``` | ||
|
||
Run lint/tests: | ||
|
||
``` | ||
yarn workspace @mcap/core lint | ||
yarn workspace @mcap/core test | ||
``` | ||
|
||
Read and validate an MCAP file: | ||
|
||
``` | ||
yarn workspace @foxglove/mcap-example-validate validate file.mcap | ||
``` | ||
|
||
Run benchmarks: | ||
|
||
``` | ||
yarn workspace @foxglove/mcap-benchmarks bench | ||
``` | ||
|
||
Run benchmarks with Chrome debugger attached to use profiling tools: | ||
|
||
``` | ||
yarn workspace @foxglove/mcap-benchmarks bench:debug | ||
``` | ||
|
||
## Releasing to NPM | ||
|
||
- Check out the version of the code you want to release | ||
- Update package.json in `typescript/{pkg}/package.json` with the new version. | ||
- Make a PR with your changes to package.json | ||
- Wait for the PR to pass CI and merge | ||
- Checkout main and tag the merged commit with `releases/typescript/{pkg}/v#.#.#` (replace #.#.# with the version you used in package.json) | ||
- Push the new tag to the repo with `git push origin releases/typescript/{pkg}/v#.#.#` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,10 @@ | ||
# TypeScript libraries for MCAP | ||
|
||
Install dependencies: | ||
[MCAP](https://mcap.dev/) is a modular container format and logging library for pub/sub messages with arbitrary message serialization. It is primarily intended for use in robotics applications, and works well under various workloads, resource constraints, and durability requirements. | ||
|
||
``` | ||
corepack enable | ||
yarn install | ||
``` | ||
The following NPM packages are provided for use with JavaScript and TypeScript: | ||
|
||
Run lint/tests: | ||
|
||
``` | ||
yarn workspace @mcap/core lint | ||
yarn workspace @mcap/core test | ||
``` | ||
|
||
Read and validate an MCAP file: | ||
|
||
``` | ||
yarn workspace @foxglove/mcap-example-validate validate file.mcap | ||
``` | ||
|
||
Run benchmarks: | ||
|
||
``` | ||
yarn workspace @foxglove/mcap-benchmarks bench | ||
``` | ||
|
||
Run benchmarks with Chrome debugger attached to use profiling tools: | ||
|
||
``` | ||
yarn workspace @foxglove/mcap-benchmarks bench:debug | ||
``` | ||
- **@mcap/core** – low-level readers and writers | ||
- **@mcap/support** – support for well-known compression formats | ||
- **@mcap/nodejs** – support for Node.js environment | ||
- **@mcap/browser** – support for browser environment |
Oops, something went wrong.