@zvenigora/ng-eval-core 0.10.1 → 0.11.1
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/CHANGELOG.md +125 -2
- package/README.md +3 -1
- package/fesm2022/zvenigora-ng-eval-core.mjs +320 -350
- package/fesm2022/zvenigora-ng-eval-core.mjs.map +1 -1
- package/package.json +1 -1
- package/types/zvenigora-ng-eval-core.d.ts +70 -152
package/CHANGELOG.md
CHANGED
|
@@ -14,7 +14,130 @@ Versions 0.1.104–0.1.107 are on npm without entries here.
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
## [0.
|
|
17
|
+
## [0.11.1] - 2026-10-10
|
|
18
|
+
|
|
19
|
+
**Two cache fixes: `CompilerService` no longer returns one AST's compiled function for another, and
|
|
20
|
+
under `caseInsensitive` a member read no longer resolves another object's spelling.** A patch. Both
|
|
21
|
+
caches came in with 0.2.1, so every version since is affected. No exported symbol changes shape: the
|
|
22
|
+
`.d.ts` differs from 0.11.0 in documentation comments only — `compile`'s and `compileAsync`'s, which
|
|
23
|
+
now say an AST is compiled on every call, and the four [A28](../../docs/backlog-retired.md#a28)
|
|
24
|
+
corrected. `eval-signals` 0.4.0–0.5.0 and `eval-forms` 0.4.x admit it: their peer range is
|
|
25
|
+
`>=0.11.0 <0.12.0`.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- `EvalReadEvent.scoped`'s JSDoc no longer says the flag marks a scope pushed during the
|
|
29
|
+
evaluation: it is set when any scope on the context's scope stack binds the name, one the caller
|
|
30
|
+
pushed with `EvalContext.push` before the walk included, and `hasInScopes`', `getFromScopes`'
|
|
31
|
+
and `createDependencyTracker`'s say the same ([A28](../../docs/backlog-retired.md#a28)). So does
|
|
32
|
+
the README's `onRead` example, whose comment said `event.scoped` was true for arrow-function
|
|
33
|
+
parameters. The flag's behaviour is unchanged.
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
- **`CompilerService` no longer returns one AST's compiled function for another —
|
|
37
|
+
[A29](../../docs/backlog-retired.md#a29).** `compile` and `compileAsync` cached an AST under its
|
|
38
|
+
type, start and end and `toString()`, which is `[object Object]` for every node, so two different
|
|
39
|
+
expressions of one shape and span shared a function: `compile(ast('a * b'))` then
|
|
40
|
+
`compile(ast('c * d'))` returned `a * b`'s, which over `{ a: 1, b: 3, c: 3, d: 4 }` answered `3`,
|
|
41
|
+
not `12`, for as long as the cache kept it. An AST is now compiled on every call and never cached.
|
|
42
|
+
Affected 0.2.1–0.11.0, 0.10.1 included. A string input was never affected, and is cached as before.
|
|
43
|
+
- **Under `caseInsensitive`, a member read no longer resolves another object's spelling —
|
|
44
|
+
[A31](../../docs/backlog-retired.md#a31).** The cache of which own key a case variant names was
|
|
45
|
+
keyed by the object's own-key count and its first five key names, once for the whole process, so
|
|
46
|
+
objects that shared their first five key names could resolve each other's spelling: a read could
|
|
47
|
+
return the wrong property or `undefined`, and a case-variant read of a blocked name, such as
|
|
48
|
+
`x.CONSTRUCTOR`, could return `undefined` instead of throwing. No blocked property was ever read.
|
|
49
|
+
The cache is now keyed by the object itself, and a cached key is used only while it is still the
|
|
50
|
+
object's own. Affected 0.2.1–0.11.0, 0.10.1 included, from the same commit as A29; a read without
|
|
51
|
+
`caseInsensitive` never was.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## [0.11.0] - 2026-10-07
|
|
56
|
+
|
|
57
|
+
**A security fix: an expression no longer resolves a name on the prototype-pollution blocklist
|
|
58
|
+
against its context. Also, the member-write policy is asked about built-in methods that write,
|
|
59
|
+
and seventeen unused exports are removed.** A breaking minor, in three ways. An expression that
|
|
60
|
+
names such a key of its context now throws ([B6](../../docs/backlog-retired.md#b6)). An import of
|
|
61
|
+
a removed symbol breaks ([B5](../../docs/backlog-retired.md#b5)). And a context that implements
|
|
62
|
+
`checkMemberWrite` is asked about calls it was not asked about before
|
|
63
|
+
([C4](../../docs/backlog-retired.md#c4)). The one other change to an exported symbol is an
|
|
64
|
+
addition, `EvalMemberWrite.method`. The `.d.ts` loses the seventeen, gains `method`, and changes
|
|
65
|
+
documentation comments: `checkMemberWrite` loses the paragraph that said a method call was outside
|
|
66
|
+
what it sees. `eval-signals` 0.4.0 builds on the change and requires this version.
|
|
67
|
+
|
|
68
|
+
### Security
|
|
69
|
+
- **An expression no longer resolves a name on the prototype-pollution blocklist against its
|
|
70
|
+
context — [B6](../../docs/backlog-retired.md#b6).** An identifier is resolved against the
|
|
71
|
+
context, and for a context built from a plain object or a class instance the lookup was a bare
|
|
72
|
+
property access, so an identifier resolved the members the context inherits from
|
|
73
|
+
`Object.prototype`; so did `this.k` and `this["k"]`. The blocklist guarded member access to the
|
|
74
|
+
objects an expression holds, not resolution against the context, and through `Object`'s own
|
|
75
|
+
static functions an expression could then modify shared prototypes. Every published version
|
|
76
|
+
up to 0.10.0 is affected.
|
|
77
|
+
- **Now refused before any lookup**, with the error the member visitor throws for any other
|
|
78
|
+
object, `Access to dangerous property "constructor" is blocked for security reasons`:
|
|
79
|
+
`__proto__`, `constructor`, `prototype`, the four `__define…` and `__lookup…` accessors,
|
|
80
|
+
`hasOwnProperty`, `isPrototypeOf`, `propertyIsEnumerable`, `toString`, `valueOf` and
|
|
81
|
+
`toLocaleString`, as an identifier, as `this.k` or `this["k"]`, or as a member of an
|
|
82
|
+
`EvalScope` held in the context. This applies over every kind of context: a plain object, a
|
|
83
|
+
`Registry`, a class instance, an `EvalContext`, a prior scope or a signal context. Under
|
|
84
|
+
`caseInsensitive` the key the lookup matched is checked too, so `CONSTRUCTOR` over a context
|
|
85
|
+
that holds `constructor` is refused.
|
|
86
|
+
- **A context key with one of those names can no longer be read by an expression**, even where
|
|
87
|
+
the context holds it as a key of its own, as a `Registry` or a signal context's source can.
|
|
88
|
+
Rename the key. An arrow parameter or a `let` with one of these names was already refused.
|
|
89
|
+
|
|
90
|
+
### Added
|
|
91
|
+
- **`EvalMemberWrite.method`**, optional: the built-in method about to make a write, named as
|
|
92
|
+
the specification names it, `'Array.prototype.push'` or `'Object.assign'`. Undefined for an
|
|
93
|
+
assignment or an update. [C4](../../docs/backlog-retired.md#c4).
|
|
94
|
+
|
|
95
|
+
### Changed
|
|
96
|
+
- **A context that implements `checkMemberWrite` is also asked before a built-in method writes
|
|
97
|
+
into an object it is handed — [C4](../../docs/backlog-retired.md#c4).** The call visitor asks
|
|
98
|
+
before calling `Array`'s `copyWithin`, `fill`, `pop`, `push`, `reverse`, `shift`, `sort`,
|
|
99
|
+
`splice` or `unshift`, the typed arrays' `copyWithin`, `fill`, `reverse`, `set` or `sort`,
|
|
100
|
+
`Map`'s and `WeakMap`'s `set` and `delete`, `Map`'s and `Set`'s `clear`, `Set`'s and
|
|
101
|
+
`WeakSet`'s `add` and `delete`, a `Date` setter, or, when a context supplies `Object`, its
|
|
102
|
+
`assign`, `defineProperty`, `defineProperties`, `setPrototypeOf`, `freeze`, `seal` or
|
|
103
|
+
`preventExtensions`. Each is matched by identity, so a method of your own named `push` is not
|
|
104
|
+
asked about, and `Array.prototype.push` reached under another name is. The target is the object
|
|
105
|
+
the method writes into: its receiver, which is the context itself for a bare call, or, for
|
|
106
|
+
`Object`'s, its first argument. Reached through `Function.prototype.call`, `apply` or `bind`, a
|
|
107
|
+
method is asked about as a direct call of it, with the `this` they pass as its receiver
|
|
108
|
+
([C5](../../docs/backlog-retired.md#c5)); `bind` is asked when it binds, so `[].push.bind(a)`
|
|
109
|
+
is refused before the bound function exists. `createdByEvaluation` comes from the same record
|
|
110
|
+
as for a member write, so `[...a].sort()` on a copy the walk made is allowed; `key` is
|
|
111
|
+
undefined. Throwing refuses the call, and it is not made. A context that does not implement the
|
|
112
|
+
method pays one field read per call, and nothing else changes for it.
|
|
113
|
+
- **Not asked about:** `test` and `exec` on a regex, which advance a global or sticky one's
|
|
114
|
+
`lastIndex`; and a method you wrote.
|
|
115
|
+
- `checkMemberWrite`'s JSDoc no longer says a method call is outside what it sees, and
|
|
116
|
+
`EvalMemberWrite`'s says what `target` and `key` are for a method call.
|
|
117
|
+
|
|
118
|
+
### Removed
|
|
119
|
+
- **Seventeen exports nothing in the library used — [B5](../../docs/backlog-retired.md#b5).**
|
|
120
|
+
No non-spec source in the three packages referenced any of them beyond its own declaration and
|
|
121
|
+
the barrels. Removing an export breaks a consumer that imports it, so this is a breaking minor;
|
|
122
|
+
nothing else about the library changes.
|
|
123
|
+
- **`RecursiveVisitorState`** and **`RecursiveVisitorResult`**, `@deprecated` since 0.3.0. Use
|
|
124
|
+
`EvalHooks` to observe a walk, and `EvalState` and `EvalResult` for its state and result.
|
|
125
|
+
- **`ScopeOptions`**. Use `EvalScopeOptions`, which is what `EvalScope` takes.
|
|
126
|
+
- **`ScopeType`** and **`RegistryOptionType`**, which nothing implemented. No replacement.
|
|
127
|
+
- **`RecursiveVisitorOptions`**, **`RecursiveVisitorContext`**,
|
|
128
|
+
**`RecursiveVisitorResultType`**, **`RecursiveVisitorStackResult`**,
|
|
129
|
+
**`RecursiveVisitorRegistryResult`**, **`RecursiveVisitor`**, **`RecursiveAggregateVisitor`**
|
|
130
|
+
and **`AggregateType`**, the rest of the visitor vocabulary those two belonged to. No
|
|
131
|
+
replacement: the visitors are not public.
|
|
132
|
+
- **`Queue`** and **`QueueType`**. No replacement; an array's `push` and `shift` do the same.
|
|
133
|
+
- **`getContextKey`**. No replacement. `EvalContext.getKey` answers the question for a whole
|
|
134
|
+
context, and unlike this function it answers `undefined` for a key nothing holds.
|
|
135
|
+
- **`isRegistryContext`**. No replacement; `context instanceof Registry` is the test the
|
|
136
|
+
library itself uses.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## [0.10.1] - 2026-10-07
|
|
18
141
|
|
|
19
142
|
**A security fix: an expression no longer resolves a name on the prototype-pollution blocklist
|
|
20
143
|
against its context.** A patch for every version up to 0.10.0, with no exported symbol changed.
|
|
@@ -47,7 +170,7 @@ their peer ranges.
|
|
|
47
170
|
|
|
48
171
|
---
|
|
49
172
|
|
|
50
|
-
## [0.10.0] - 2026-10-
|
|
173
|
+
## [0.10.0] - 2026-10-04
|
|
51
174
|
|
|
52
175
|
**An opt-in member-write policy on `EvalContext`, and three fixes.** Nothing changes for a context
|
|
53
176
|
that does not opt in, and every change to an exported symbol is an addition: `EvalContext` gains
|
package/README.md
CHANGED
|
@@ -205,7 +205,9 @@ state.hooks.onRead((event) => {
|
|
|
205
205
|
event.kind; // 'identifier' | 'member'
|
|
206
206
|
event.key; // the resolved key
|
|
207
207
|
event.path; // 'a.b' when statically reconstructible, else undefined
|
|
208
|
-
event.scoped; // true
|
|
208
|
+
event.scoped; // true when a scope on the context's stack binds the name - an
|
|
209
|
+
// arrow parameter, a let or const, or a scope pushed with
|
|
210
|
+
// EvalContext.push - so not a dependency
|
|
209
211
|
});
|
|
210
212
|
```
|
|
211
213
|
|