Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

## Unreleased

## 2.0.1 - 2026-09-04

### Fixed

- Replaced open-ended Map, Set, and Date native-method dispatch with explicit,
fail-closed member inventories.
- Blocked `Map.prototype.getOrInsert` and `getOrInsertComputed` where available.
- Added readonly modern Set composition and relation operations, including
protected results, set-like operands, iterator cleanup, and aligned types.
- Prevented Date conversion methods from redispatching to source-owned method
overrides with a mutable receiver.
- Added native prototype inventory tests so new platform methods require an
explicit safety classification.

## 2.0.0 - 2026-09-03

### Breaking Changes
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Shadows remain extensible because `preventExtensions` throws, permitting live ke

## Reads and methods

Keys, membership, prototypes, and descriptors delegate to current source state, then object results pass through the membrane. Descriptor values, accessors, iterators, callbacks, collections, and prototypes cannot expose raw objects. Map/Set translate same-membrane view keys privately. Only exact native methods receive valid internal-slot sources; user-defined methods receive readonly `this`. Private fields may fail brand checks.
Keys, membership, prototypes, and descriptors delegate to current source state, then object results pass through the membrane. Descriptor values, accessors, iterators, callbacks, collections, and prototypes cannot expose raw objects. Map/Set translate same-membrane view keys privately. Map, Set, and Date use explicit prototype-member inventories: only reviewed native methods receive valid internal-slot sources, known mutators reject before invocation, and unclassified native members fail closed. Available modern Set composition methods return readonly Set views. User-defined methods receive readonly `this`. Private fields may fail brand checks.

## Memory

Expand Down
299 changes: 187 additions & 112 deletions docs/release-readiness.md

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions docs/supported-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
| Primitive | Full | Returned unchanged |
| Plain/null-prototype object | Full | Live reflection and deep values |
| Array/tuple | Full | `Array.isArray`; mutations reject |
| Map | Full | Wrapped keys, values, iteration |
| Set | Full | Wrapped values and iteration |
| Date | Full | Reads work; every `set*` rejects |
| Map | Full | Inventoried reads wrap keys/values; mutators reject |
| Set | Full | Inventoried reads; available composition/relation methods |
| Date | Full | Inventoried reads work; every standard setter rejects |
| Function | Documented | Readonly `this`; external effects possible |
| Custom class | Documented | Prototype viewed; `instanceof` false; private brands may reject |
| Consumer Proxy | Trust limitation | Source traps bound guarantees |
Expand All @@ -17,3 +17,13 @@
| WeakMap, WeakSet, Promise | Unsupported | Native slots/unsafe exposure |

Unsupported roots and lazily reached values throw `UnsupportedTypeError`.
Unclassified native members on Map, Set, and Date also fail closed instead of
being invoked with the mutable source as their receiver. Where the runtime
provides modern Set composition methods, their fresh Set results and members
remain readonly through the originating membrane.

On TypeScript libraries that include the ES2025 Set methods, a ReadonlyView Set
is intentionally not structurally assignable to the complete built-in
`ReadonlySet<T>` interface. The built-in interface declares composition methods
that return mutable `Set` instances; ReadonlyView returns readonly Set views
instead. Ordinary readonly Set reads remain available.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nipe-solutions/readonly-view",
"version": "2.0.0",
"version": "2.0.1",
"packageManager": "npm@11.19.0",
"description": "A deeply readonly, lazy, live view over mutable JavaScript data.",
"type": "module",
Expand Down
8 changes: 4 additions & 4 deletions scripts/size-budget.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"esmMinified": 7000,
"esmGzip": 2500,
"declarations": 2500,
"packed": 10000
"esmMinified": 10000,
"esmGzip": 3000,
"declarations": 3500,
"packed": 12000
}
Loading