extension-port-stream 4.0.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -3
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/CHANGELOG.md +0 -53
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { Duplex } from 'readable-stream';
|
|
2
|
+
import { Duplex, DuplexOptions } from 'readable-stream';
|
|
3
3
|
import type { Runtime } from 'webextension-polyfill';
|
|
4
4
|
declare type Log = (data: unknown, out: boolean) => void;
|
|
5
5
|
export default class PortDuplexStream extends Duplex {
|
|
@@ -8,8 +8,9 @@ export default class PortDuplexStream extends Duplex {
|
|
|
8
8
|
/**
|
|
9
9
|
* @param port - An instance of WebExtensions Runtime.Port. See:
|
|
10
10
|
* {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port}
|
|
11
|
+
* @param streamOptions - stream options passed on to Duplex stream constructor
|
|
11
12
|
*/
|
|
12
|
-
constructor(port: Runtime.Port);
|
|
13
|
+
constructor(port: Runtime.Port, streamOptions?: DuplexOptions);
|
|
13
14
|
/**
|
|
14
15
|
* Callback triggered when a message is received from
|
|
15
16
|
* the remote Port associated with this Stream.
|
|
@@ -41,4 +42,4 @@ export default class PortDuplexStream extends Duplex {
|
|
|
41
42
|
*/
|
|
42
43
|
_setLogger(log: Log): void;
|
|
43
44
|
}
|
|
44
|
-
export {};
|
|
45
|
+
export { PortDuplexStream };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PortDuplexStream = void 0;
|
|
3
4
|
const readable_stream_1 = require("readable-stream");
|
|
4
5
|
class PortDuplexStream extends readable_stream_1.Duplex {
|
|
5
6
|
/**
|
|
6
7
|
* @param port - An instance of WebExtensions Runtime.Port. See:
|
|
7
8
|
* {@link https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port}
|
|
9
|
+
* @param streamOptions - stream options passed on to Duplex stream constructor
|
|
8
10
|
*/
|
|
9
|
-
constructor(port) {
|
|
10
|
-
super({ objectMode: true });
|
|
11
|
+
constructor(port, streamOptions = {}) {
|
|
12
|
+
super(Object.assign({ objectMode: true }, streamOptions));
|
|
11
13
|
this._port = port;
|
|
12
14
|
this._port.onMessage.addListener((msg) => this._onMessage(msg));
|
|
13
15
|
this._port.onDisconnect.addListener(() => this._onDisconnect());
|
|
@@ -78,4 +80,5 @@ class PortDuplexStream extends readable_stream_1.Duplex {
|
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
exports.default = PortDuplexStream;
|
|
83
|
+
exports.PortDuplexStream = PortDuplexStream;
|
|
81
84
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAAwD;AAKxD,MAAqB,gBAAiB,SAAQ,wBAAM;IAKlD;;;;OAIG;IACH,YAAY,IAAkB,EAAE,gBAA+B,EAAE;QAC/D,KAAK,iBACH,UAAU,EAAE,IAAI,IACb,aAAa,EAChB,CAAC;QACH,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,GAAY,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QACzE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC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CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,GAAQ;QACjB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;CACF;AAzFD,mCAyFC;AAEQ,4CAAgB"}
|
package/package.json
CHANGED
package/CHANGELOG.md
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
All notable changes to this project will be documented in this file.
|
|
3
|
-
|
|
4
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
-
|
|
7
|
-
## [Unreleased]
|
|
8
|
-
|
|
9
|
-
## [4.0.0]
|
|
10
|
-
### Fixed
|
|
11
|
-
- **BREAKING**: `webextension-polyfill` is now a peer-dependency rather than a dependency. Users are expected to provide the runtime. ([#54](https://github.com/MetaMask/extension-port-stream/pull/54))
|
|
12
|
-
- `webextension-polyfill` import changed to type-only import ([#54](https://github.com/MetaMask/extension-port-stream/pull/54))
|
|
13
|
-
|
|
14
|
-
## [3.0.0]
|
|
15
|
-
### Changed
|
|
16
|
-
- **BREAKING**: Use portable `readable-stream@^3.6.2` instead of native streams ([#51](https://github.com/MetaMask/extension-port-stream/pull/51))
|
|
17
|
-
|
|
18
|
-
## [2.1.1]
|
|
19
|
-
### Changed
|
|
20
|
-
- deps: replace webextension-polyfill-ts with webextension-polyfill ([#43](https://github.com/MetaMask/extension-port-stream/pull/43))
|
|
21
|
-
|
|
22
|
-
## [2.1.0] - 2023-06-15
|
|
23
|
-
### Added
|
|
24
|
-
- `_setLogger` method can be used to inject custom logger for incoming/outgoing messages ([#46](https://github.com/MetaMask/extension-port-stream/pull/46))
|
|
25
|
-
|
|
26
|
-
### Changed
|
|
27
|
-
- deps: webextension-polyfill-ts@0.22.0->0.26.0 ([#37](https://github.com/MetaMask/extension-port-stream/pull/37))
|
|
28
|
-
- Updates webextension-polyfill from 0.7.0 to 0.8.0
|
|
29
|
-
|
|
30
|
-
### Fixed
|
|
31
|
-
- Fix exporting of types ([#24](https://github.com/MetaMask/extension-port-stream/pull/24))
|
|
32
|
-
- deps: webextension-polyfill-ts@0.22.0->0.26.0 ([#37](https://github.com/MetaMask/extension-port-stream/pull/37))
|
|
33
|
-
- Updates webextension-polyfill from 0.7.0 to 0.8.0
|
|
34
|
-
|
|
35
|
-
## [2.0.1] - 2021-04-29
|
|
36
|
-
### Changed
|
|
37
|
-
- Move `webextension-polyfill-ts` from `devDependencies` to `dependencies` ([#11](https://github.com/MetaMask/extension-port-stream/pull/11))
|
|
38
|
-
|
|
39
|
-
## [2.0.0] - 2020-11-23
|
|
40
|
-
### Added
|
|
41
|
-
- TypeScript typings ([#4](https://github.com/MetaMask/extension-port-stream/pull/4))
|
|
42
|
-
|
|
43
|
-
### Removed
|
|
44
|
-
- **(BREAKING)** Remove `readable-stream` dependency ([#4](https://github.com/MetaMask/extension-port-stream/pull/4))
|
|
45
|
-
- Consumers using this package in browser environments will have to bring their own Node.js stream polyfill.
|
|
46
|
-
|
|
47
|
-
[Unreleased]: https://github.com/MetaMask/extension-port-stream/compare/v4.0.0...HEAD
|
|
48
|
-
[4.0.0]: https://github.com/MetaMask/extension-port-stream/compare/v3.0.0...v4.0.0
|
|
49
|
-
[3.0.0]: https://github.com/MetaMask/extension-port-stream/compare/v2.1.1...v3.0.0
|
|
50
|
-
[2.1.1]: https://github.com/MetaMask/extension-port-stream/compare/v2.1.0...v2.1.1
|
|
51
|
-
[2.1.0]: https://github.com/MetaMask/extension-port-stream/compare/v2.0.1...v2.1.0
|
|
52
|
-
[2.0.1]: https://github.com/MetaMask/extension-port-stream/compare/v2.0.0...v2.0.1
|
|
53
|
-
[2.0.0]: https://github.com/MetaMask/extension-port-stream/releases/tag/v2.0.0
|