Socket
Socket
Sign inDemoInstall

@serialport/binding-mock

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serialport/binding-mock - npm Package Compare versions

Comparing version 10.2.1 to 10.2.2

.releaserc

48

dist/index.d.ts
/// <reference types="node" />
import { BindingInterface, BindingPortInterface, PortStatus, SetOptions, UpdateOptions, OpenOptions, PortInfo } from '@serialport/bindings-interface';
interface MockPortInternal {
data: Buffer;
echo: boolean;
record: boolean;
info: PortInfo;
maxReadSize: number;
readyData?: Buffer;
openOpt?: OpenOptions;
import { BindingInterface } from '@serialport/bindings-interface';
import { BindingPortInterface } from '@serialport/bindings-interface';
import { OpenOptions } from '@serialport/bindings-interface';
import { PortInfo } from '@serialport/bindings-interface';
import { PortStatus } from '@serialport/bindings-interface';
import { SetOptions } from '@serialport/bindings-interface';
import { UpdateOptions } from '@serialport/bindings-interface';
export declare class CanceledError extends Error {
canceled: true;
constructor(message: string);
}
interface CreatePortOptions {
export declare interface CreatePortOptions {
echo?: boolean;

@@ -21,11 +25,10 @@ record?: boolean;

}
export declare class CanceledError extends Error {
canceled: true;
constructor(message: string);
}
export interface MockBindingInterface extends BindingInterface<MockPortBinding> {
export declare const MockBinding: MockBindingInterface;
export declare interface MockBindingInterface extends BindingInterface<MockPortBinding> {
reset(): void;
createPort(path: string, opt?: CreatePortOptions): void;
}
export declare const MockBinding: MockBindingInterface;
/**

@@ -60,2 +63,13 @@ * Mock bindings for pretend serialport access

}
export {};
export declare interface MockPortInternal {
data: Buffer;
echo: boolean;
record: boolean;
info: PortInfo;
maxReadSize: number;
readyData?: Buffer;
openOpt?: OpenOptions;
}
export { }

@@ -1,9 +0,12 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MockPortBinding = exports.MockBinding = exports.CanceledError = void 0;
const debug_1 = __importDefault(require("debug"));
const debug = (0, debug_1.default)('serialport/binding-mock');
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var debugFactory = require('debug');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var debugFactory__default = /*#__PURE__*/_interopDefaultLegacy(debugFactory);
const debug = debugFactory__default["default"]('serialport/binding-mock');
let ports = {};

@@ -20,4 +23,3 @@ let serialNumber = 0;

}
exports.CanceledError = CanceledError;
exports.MockBinding = {
const MockBinding = {
reset() {

@@ -30,11 +32,3 @@ ports = {};

serialNumber++;
const optWithDefaults = {
echo: false,
record: false,
manufacturer: 'The J5 Robotics Company',
vendorId: undefined,
productId: undefined,
maxReadSize: 1024,
...options,
};
const optWithDefaults = Object.assign({ echo: false, record: false, manufacturer: 'The J5 Robotics Company', vendorId: undefined, productId: undefined, maxReadSize: 1024 }, options);
ports[path] = {

@@ -73,14 +67,3 @@ data: Buffer.alloc(0),

}
const openOptions = {
dataBits: 8,
lock: true,
stopBits: 1,
parity: 'none',
rtscts: false,
xon: false,
xoff: false,
xany: false,
hupcl: true,
...options,
};
const openOptions = Object.assign({ dataBits: 8, lock: true, stopBits: 1, parity: 'none', rtscts: false, xon: false, xoff: false, xany: false, hupcl: true }, options);
const { path } = openOptions;

@@ -95,7 +78,7 @@ debug(null, `open: opening path ${path}`);

if ((_a = port.openOpt) === null || _a === void 0 ? void 0 : _a.lock) {
debug(serialNumber, `open: Port is locked cannot open`);
debug(serialNumber, 'open: Port is locked cannot open');
throw new Error('Port is locked cannot open');
}
debug(serialNumber, `open: opened path ${path}`);
port.openOpt = { ...openOptions };
port.openOpt = Object.assign({}, openOptions);
return new MockPortBinding(port, openOptions);

@@ -299,2 +282,5 @@ },

}
exports.CanceledError = CanceledError;
exports.MockBinding = MockBinding;
exports.MockPortBinding = MockPortBinding;
{
"name": "@serialport/binding-mock",
"version": "10.2.1",
"version": "10.2.2",
"description": "The mock serialport bindings",
"types": "./dist/index.d.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"keywords": [
"serialport-binding",
"debug"
],
"dependencies": {
"@serialport/bindings-interface": "1.2.0",
"debug": "^4.3.2"
"exports": {
"require": "./dist/index.js",
"default": "./dist/index-esm.mjs"
},
"devDependencies": {
"typescript": "^4.5.5"
},
"engines": {
"node": ">=12.0.0"
},
"publishConfig": {
"access": "public"
"repository": "git@github.com:serialport/binding-mock.git",
"homepage": "https://github.com/serialport/binding-mock",
"scripts": {
"test": "mocha",
"lint": "tsc && eslint lib/**/*.ts",
"format": "eslint lib/**/*.ts --fix",
"clean": "rm -rf dist-ts dist",
"build": "npm run clean && tsc -p tsconfig-build.json && rollup -c && node -r esbuild-register bundle-types",
"prepublishOnly": "npm run build",
"semantic-release": "semantic-release"
},
"keywords": [
"serialport-binding",
"debug"
],
"license": "MIT",
"scripts": {
"build": "tsc --build tsconfig-build.json"
"devDependencies": {
"@microsoft/api-extractor": "7.19.4",
"@types/chai": "4.3.0",
"@types/mocha": "9.1.0",
"@types/node": "17.0.15",
"@typescript-eslint/eslint-plugin": "5.10.2",
"@typescript-eslint/parser": "5.10.2",
"chai": "4.3.6",
"esbuild": "0.14.18",
"esbuild-register": "3.3.2",
"eslint": "8.8.0",
"mocha": "9.2.0",
"rollup": "2.67.0",
"rollup-plugin-node-resolve": "5.2.0",
"semantic-release": "19.0.2",
"typescript": "4.5.5"
},
"repository": {
"type": "git",
"url": "git://github.com/serialport/node-serialport.git"
"mocha": {
"bail": true,
"require": [
"esbuild-register"
],
"spec": "lib/**/*-test.ts"
},
"funding": "https://opencollective.com/serialport/donate",
"gitHead": "6accdd9247512ebd4f87c92f6f1ae4b0bca10197"
"dependencies": {
"@serialport/bindings-interface": "^1.2.1",
"debug": "^4.3.3"
}
}

@@ -6,2 +6,5 @@ # @serialport/binding-mock

const MockBinding = new MockBinding()
MockBinding.createPort('/dev/fakePort', { echo: true })
await MockBinding.write(Buffer.from('data')))
```

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