Commit Graph

240 Commits

Author SHA1 Message Date
Damien Arrachequesne
69d02dd754 chore(release): 5.2.2
Diff: https://github.com/socketio/engine.io-parser/compare/5.2.1...5.2.2
engine.io-parser@5.2.2
2024-02-05 18:35:35 +01:00
Damien Arrachequesne
0305b4a7a5 fix(typescript): properly import the TransformStream type
When compiling with TypeScript with module set to "node16" and
moduleResolution to "node16", the following error would be thrown:

> node_modules/engine.io-parser/build/cjs/index.d.ts:6:54 - error TS2304: Cannot find name 'TransformStream'.
> 6 export declare function createPacketEncoderStream(): TransformStream<Packet, any>;
>                                                        ~~~~~~~~~~~~~~~
> node_modules/engine.io-parser/build/cjs/index.d.ts:7:96 - error TS2304: Cannot find name 'TransformStream'.
> 7 export declare function createPacketDecoderStream(maxPayload: number, binaryType: BinaryType): TransformStream<Uint8Array, any>;
>                                                                                                  ~~~~~~~~~~~~~~~
> Found 2 errors in the same file, starting at: node_modules/engine.io-parser/build/cjs/index.d.ts:6

This is because the TransformStream object is not exposed in the global
scope in the `@types/node` package, even though it is since Node.js
`v18.0.0`.

Reference: https://nodejs.org/api/webstreams.html#class-transformstream

Note: we only import the TransformStream type (not value) because it
isn't defined on older Node.js versions.

Related:

- https://github.com/socketio/engine.io-parser/issues/136
- https://github.com/socketio/socket.io-client/issues/1606
2024-02-05 18:20:49 +01:00
Damien Arrachequesne
08cff77a48 chore: bump prettier to version 3
This change is necessary to be able to write "import type { ... }".
2024-02-05 18:20:30 +01:00
dependabot[bot]
23213858c6 chore: bump browserify-sign from 4.2.1 to 4.2.2 (#138)
Bumps [browserify-sign](https://github.com/crypto-browserify/browserify-sign) from 4.2.1 to 4.2.2.
- [Changelog](https://github.com/browserify/browserify-sign/blob/main/CHANGELOG.md)
- [Commits](https://github.com/crypto-browserify/browserify-sign/compare/v4.2.1...v4.2.2)

---
updated-dependencies:
- dependency-name: browserify-sign
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-10 18:12:46 +01:00
dependabot[bot]
b96f0cb45a chore: bump @babel/traverse from 7.9.5 to 7.23.2 (#137)
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.9.5 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-23 22:19:35 +02:00
Damien Arrachequesne
9efa1d0aec test: add more stream decoding tests 2023-08-05 00:34:20 +02:00
Damien Arrachequesne
58626c7edd chore(release): 5.2.1
Diff: https://github.com/socketio/engine.io-parser/compare/5.2.0...5.2.1
2023-08-02 00:32:16 +02:00
Damien Arrachequesne
0b5e98591e refactor: prepend a header to each WebTransport chunk
This commit updates the format of the header added in [1], in order to
match the format used for a WebSocket frame ([2]).

Two advantages:

- small payloads only need 1 byte instead of 4
- payloads larger than 2^31 bytes are supported

[1]: 6142324fa6
[2]: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#decoding_payload_length
2023-08-02 00:29:45 +02:00
Damien Arrachequesne
aea321cadc chore(release): 5.2.0
Diff: https://github.com/socketio/engine.io-parser/compare/5.1.0...5.2.0
2023-07-31 08:47:00 +02:00
Damien Arrachequesne
6142324fa6 feat: prepend a header to each WebTransport chunk
WebTransport is a stream-based protocol, so chunking boundaries are not
always preserved.

That's why we will now prepend a 4-bytes header to each chunk:

- first bit indicates whether the payload is plain text (0) or binary (1)
- next 31 bits indicate the length of the payload

See also: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#format
2023-07-31 08:09:27 +02:00
Damien Arrachequesne
2d0b75595c chore: bump dev dependencies 2023-07-31 08:08:54 +02:00
Damien Arrachequesne
a779bea9d7 chore(release): 5.1.0
Diff: https://github.com/socketio/engine.io-parser/compare/5.0.7...5.1.0
2023-06-11 07:50:57 +02:00
Damien Arrachequesne
670160d604 ci: add Node.js 20 in the test matrix 2023-06-11 07:45:09 +02:00
Damien Arrachequesne
8039f2e421 ci: upgrade to actions/checkout@3 and actions/setup-node@3
Reference: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/
2023-06-11 07:44:23 +02:00
Damien Arrachequesne
bed70a4f25 feat: implement WebTransport-related encoding/decoding 2023-06-11 07:41:51 +02:00
Damien Arrachequesne
0fc3694a13 chore(release): 5.0.7
Diff: https://github.com/socketio/engine.io-parser/compare/5.0.6...5.0.7
2023-05-24 14:50:09 +02:00
Damien Arrachequesne
e4a1c2b082 refactor: export typescript declarations for the commonjs build
Related:

- https://github.com/socketio/socket.io/issues/4621#issuecomment-1551853243
- https://github.com/socketio/engine.io-parser/issues/129
2023-05-24 14:43:54 +02:00
Damien Arrachequesne
214182b4f0 chore(release): 5.0.6
Diff: https://github.com/socketio/engine.io-parser/compare/5.0.5...5.0.6
2023-01-16 08:35:56 +01:00
Damien Arrachequesne
05ebbad996 ci: temporarily disable browser tests
Until we migrate to webdriver.io.

Related: d882822908
2023-01-06 11:39:30 +01:00
Damien Arrachequesne
ed2b0cbfa3 chore(release): 5.0.5
Diff: https://github.com/socketio/engine.io-parser/compare/5.0.4...5.0.5
2023-01-06 11:38:26 +01:00
Mauricio Narvaez
351ba8245b fix: properly encode empty buffer in base64 encoding (#131)
An empty buffer was encoded into `bundefined` instead of `b`
(reproduced on Chrome v108 / Ubuntu).

Co-authored-by: Mauricio Narvaez <nvz@fb.com>
2023-01-06 11:26:29 +01:00
dependabot[bot]
7fbea714db chore: bump decode-uri-component from 0.2.0 to 0.2.2 (#130)
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-05 21:58:42 +01:00
Damien Arrachequesne
764c99f136 chore(release): 5.0.4
Diff: https://github.com/socketio/engine.io-parser/compare/5.0.3...5.0.4
2022-04-30 14:13:42 +02:00
Damien Arrachequesne
bc7400a5e8 refactor: include base64-arraybuffer in the repository
In order to reduce the number of dependencies and the attack surface in
case of supply chain attacks.
2022-04-30 13:59:34 +02:00
Damien Arrachequesne
da182cba3e chore: point the CI badge towards the main branch 2022-04-30 13:54:19 +02:00
Damien Arrachequesne
a421bbec7b fix: add missing file extension for ESM import
Related: https://github.com/socketio/engine.io-parser/issues/127
2022-04-30 12:42:03 +02:00
Damien Arrachequesne
039b45cc65 fix(typings): update the type of RawData
We could also split the declaration of RawData with the "browser"
field:

```
// for Node.js
export type RawData = string | Buffer | ArrayBuffer | ArrayBufferView; // no Blob
// for the browser
export type RawData = string | ArrayBuffer | ArrayBufferView | Blob; // no Buffer
```

But it does not seem supported by the TypeScript compiler, so we'll
revert to just using "any" for now.

Related: https://github.com/socketio/engine.io-parser/issues/128
2022-04-30 12:36:57 +02:00
dependabot[bot]
4952193c04 chore: bump cached-path-relative from 1.0.2 to 1.1.0 (#125)
Bumps [cached-path-relative](https://github.com/ashaffer/cached-path-relative) from 1.0.2 to 1.1.0.
- [Release notes](https://github.com/ashaffer/cached-path-relative/releases)
- [Commits](https://github.com/ashaffer/cached-path-relative/commits)

---
updated-dependencies:
- dependency-name: cached-path-relative
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-17 07:48:15 +01:00
dependabot[bot]
2b70ceee63 chore: bump ajv from 6.12.2 to 6.12.6 (#126)
Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.12.2 to 6.12.6.
- [Release notes](https://github.com/ajv-validator/ajv/releases)
- [Commits](https://github.com/ajv-validator/ajv/compare/v6.12.2...v6.12.6)

---
updated-dependencies:
- dependency-name: ajv
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-16 21:58:23 +01:00
Damien Arrachequesne
8096c122bb chore(release): 5.0.3
Diff: https://github.com/socketio/engine.io-parser/compare/5.0.2...5.0.3
2022-01-17 10:24:51 +01:00
Damien Arrachequesne
ad5bd7ddf5 refactor: add additional types
Merged from https://github.com/socketio/engine.io/pull/630
2022-01-17 10:23:16 +01:00
Damien Arrachequesne
25a4b2bbf5 chore: replace base64-arraybuffer by @socket.io/base64-arraybuffer
The "base64-arraybuffer" package has been temporarily forked to [1],
until changes are merged upstream.

[1]: https://github.com/socketio/base64-arraybuffer

Related:

- https://github.com/niklasvh/base64-arraybuffer/issues/32
- https://github.com/socketio/socket.io-client/issues/1520
- https://github.com/socketio/socket.io-website/issues/313
- https://github.com/socketio/socket.io/discussions/4209
2022-01-17 10:23:11 +01:00
Damien Arrachequesne
cb26d5cbb6 chore(release): 5.0.2
Diff: https://github.com/socketio/engine.io-parser/compare/5.0.1...5.0.2
2021-11-14 07:26:24 +01:00
Damien Arrachequesne
7e271596c3 fix: add package name in nested package.json
Related: https://github.com/socketio/socket.io-client/issues/1513
2021-11-14 07:23:10 +01:00
Damien Arrachequesne
5f22ed0527 fix: fix vite build for CommonJS users
Related: https://github.com/socketio/socket.io-client/issues/1504
2021-11-14 07:23:10 +01:00
dependabot[bot]
ab84c2d2f3 chore: bump ansi-regex from 5.0.0 to 5.0.1 (#123)
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-08 06:41:27 +01:00
Damien Arrachequesne
fa6d4f6d84 chore(release): 5.0.1
Diff: https://github.com/socketio/engine.io-parser/compare/5.0.0...5.0.1
2021-10-16 01:23:30 +02:00
Damien Arrachequesne
900346ea34 fix: fix vite build
Some bundlers (like vite) do not support having a "browser" field in a
nested package.json.

Related: https://github.com/socketio/socket.io-client/issues/1504
2021-10-16 01:19:51 +02:00
Damien Arrachequesne
965a567ca0 chore(release): 5.0.0
Diff: https://github.com/socketio/engine.io-parser/compare/4.0.3...5.0.0
2021-10-04 11:02:35 +02:00
Damien Arrachequesne
e4d9fce4d8 chore: migrate to TypeScript
This change introduces an ESM build which will allow tree shaking. A
CJS build is also provided for backward compatibility.
2021-10-01 10:39:52 +02:00
Damien Arrachequesne
78cd3bc7b9 test: remove duplicate test 2021-08-29 08:05:05 +02:00
Damien Arrachequesne
412bcc4298 chore(release): 4.0.3
Diff: https://github.com/socketio/engine.io-parser/compare/4.0.2...4.0.3
2021-08-29 07:55:13 +02:00
Damien Arrachequesne
6d7dd76130 fix: respect the offset and length of TypedArray objects
The parser now returns the TypedArray object instead of the underlying
array buffer, so its offset and length are now taken in account (which
is the behavior of the classic WebSocket implementation).

Notes:

- this was already the case for the Node.js implementation

- in v3, the TypedArray object was always converted to an array buffer
because a byte was added at the beginning ("message" type)

- we could also have used "data.slice().buffer", but it would have
resulted in the copy of the buffer

Related:

- https://github.com/socketio/engine.io-parser/issues/122
- https://github.com/socketio/engine.io-client/issues/677
2021-08-29 07:54:03 +02:00
dependabot[bot]
6dfab6970c chore: bump path-parse from 1.0.6 to 1.0.7 (#120)
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-29 07:53:56 +02:00
dependabot[bot]
8b4dcfc04a chore: bump browserslist from 4.12.0 to 4.16.6 (#119)
Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.12.0 to 4.16.6.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/browserslist/browserslist/compare/4.12.0...4.16.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-11 15:39:39 +02:00
dependabot[bot]
6ab8af0e07 chore: bump elliptic from 6.5.3 to 6.5.4 (#117)
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.3...v6.5.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-11 15:39:27 +02:00
dependabot[bot]
129094f7a5 chore: bump y18n from 4.0.0 to 4.0.1 (#118)
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-01 10:41:25 +02:00
Damien Arrachequesne
88799daa22 chore(release): 4.0.2
Diff: https://github.com/socketio/engine.io-parser/compare/4.0.1...4.0.2
2020-12-07 10:13:22 +01:00
Damien Arrachequesne
2ccdeb2779 fix: add base64-arraybuffer as prod dependency
The dependency was previously only listed as dev dependency, so that it
was not included when installing the server (the "engine.io" package,
which does not require it) and was explicitly included by the client
(the "engine.io-client" package, which needs it for the browser build).

But it failed with yarn v2, due to its stricter package boundaries:

> ERROR in ../../../.yarn/cache/engine.io-parser-npm-4.0.1-6bdb879e8a-3b71ef8b5a.zip/node_modules/engine.io-parser/lib/decodePacket.browser.js 7:18-47
> Module not found: Error: engine.io-parser tried to access base64-arraybuffer, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

> Required package: base64-arraybuffer (via "base64-arraybuffer")
> Required by: engine.io-parser@npm:4.0.1 (via xxx/.yarn/cache/engine.io-parser-npm-4.0.1-6bdb879e8a-3b71ef8b5a.zip/node_modules/engine.io-parser/lib/)

Related:

- https://dev.to/arcanis/introducing-yarn-2-4eh1#strict-package-boundaries
- https://github.com/socketio/engine.io-parser/issues/116
2020-12-07 09:53:28 +01:00
Damien Arrachequesne
b26993e51b ci: update configuration for GitHub Actions
The specific cron hour is meant to prevent concurrent usage of the
Sauce Labs account.
2020-12-07 09:50:41 +01:00