This commit is contained in:
2026-07-26 21:23:30 +00:00
parent 6fa0e1b9a6
commit 7c262aeb8b
60 changed files with 2359 additions and 582 deletions
+10
View File
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.1.1](https://github.com/ljharb/side-channel/compare/v1.1.0...v1.1.1) - 2026-06-08
### Commits
- [Fix] `assert`: do not observably access object keys when throwing [`fc17361`](https://github.com/ljharb/side-channel/commit/fc173615136e6a6c3194656e6088afbc0bd6f9b8)
- [actions] update workflows [`35b18c0`](https://github.com/ljharb/side-channel/commit/35b18c0bced5769d59226cd44a7e4003ad0aee81)
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/tape`, `auto-changelog`, `eslint`, `npmignore` [`b456a01`](https://github.com/ljharb/side-channel/commit/b456a01396cfdd028e5d39ea84885fe9178a72cf)
- [Deps] update `object-inspect`, `side-channel-list` [`accf1a1`](https://github.com/ljharb/side-channel/commit/accf1a1a2767a22b1f5eeb5769a1db4c35a78090)
- [readme] replace runkit CI badge with shields.io check-runs badge [`7e0c956`](https://github.com/ljharb/side-channel/commit/7e0c956411cc29267197a49a155a3d9bd01bacac)
## [v1.1.0](https://github.com/ljharb/side-channel/compare/v1.0.6...v1.1.0) - 2024-12-11
### Commits
+1 -1
View File
@@ -57,5 +57,5 @@ Clone the repo, `npm install`, and run `npm test`
[downloads-url]: https://npm-stat.com/charts.html?package=side-channel
[codecov-image]: https://codecov.io/gh/ljharb/side-channel/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/side-channel/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/side-channel
[actions-image]: https://img.shields.io/github/check-runs/ljharb/side-channel/main
[actions-url]: https://github.com/ljharb/side-channel/actions
+5 -2
View File
@@ -18,7 +18,10 @@ module.exports = function getSideChannel() {
var channel = {
assert: function (key) {
if (!channel.has(key)) {
throw new $TypeError('Side channel does not contain ' + inspect(key));
var keyDesc = key && Object(key) === key
? 'the given object key'
: inspect(key);
throw new $TypeError('Side channel does not contain ' + keyDesc);
}
},
'delete': function (key) {
@@ -38,6 +41,6 @@ module.exports = function getSideChannel() {
$channelData.set(key, value);
}
};
// @ts-expect-error TODO: figure out why this is erroring
return channel;
};
+10 -10
View File
@@ -1,6 +1,6 @@
{
"name": "side-channel",
"version": "1.1.0",
"version": "1.1.1",
"description": "Store information about any JS value in a side channel. Uses WeakMap if available.",
"main": "index.js",
"exports": {
@@ -44,23 +44,23 @@
"homepage": "https://github.com/ljharb/side-channel#readme",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.3",
"side-channel-list": "^1.0.0",
"object-inspect": "^1.13.4",
"side-channel-list": "^1.0.1",
"side-channel-map": "^1.0.1",
"side-channel-weakmap": "^1.0.2"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.1",
"@ljharb/eslint-config": "^21.1.1",
"@ljharb/tsconfig": "^0.2.2",
"@arethetypeswrong/cli": "^0.18.3",
"@ljharb/eslint-config": "^22.2.3",
"@ljharb/tsconfig": "^0.3.2",
"@types/object-inspect": "^1.13.0",
"@types/tape": "^5.6.5",
"auto-changelog": "^2.5.0",
"@types/tape": "^5.8.1",
"auto-changelog": "^2.6.0",
"eclint": "^2.8.1",
"encoding": "^0.1.13",
"eslint": "=8.8.0",
"eslint": "^8.57.1",
"in-publish": "^2.0.1",
"npmignore": "^0.3.1",
"npmignore": "^0.3.5",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.9.0",
+16
View File
@@ -28,6 +28,22 @@ test('getSideChannel', function (t) {
channel.set(o, 'data');
st.doesNotThrow(function () { channel.assert(o); }, 'existent value noops');
var accessed = false;
var trap = {};
Object.defineProperty(trap, 'foo', {
enumerable: true,
get: function () {
accessed = true;
return 1;
}
});
st['throws'](
function () { channel.assert(trap); },
TypeError,
'missing object key throws'
);
st.equal(accessed, false, 'a missing object key is not observably accessed');
st.end();
});