@zvenigora/ng-eval-core 0.6.0 → 0.7.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/CHANGELOG.md +594 -0
- package/LICENSE +21 -0
- package/README.md +14 -7
- package/fesm2022/zvenigora-ng-eval-core.mjs +271 -314
- package/fesm2022/zvenigora-ng-eval-core.mjs.map +1 -1
- package/package.json +2 -2
- package/types/zvenigora-ng-eval-core.d.ts +30 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zvenigora/ng-eval-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "An expression evaluator for Angular",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@angular/core": ">=19.0.0",
|
|
18
18
|
"acorn": "^8.11.2",
|
|
19
19
|
"acorn-walk": "^8.3.0",
|
|
20
|
-
"js-sha256": "^0.10.1"
|
|
20
|
+
"js-sha256": "^0.10.1 || ^0.11.0 || ^0.12.0 || ^1.0.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"tslib": "^2.3.0"
|
|
@@ -554,6 +554,11 @@ interface EvalScopeOptions {
|
|
|
554
554
|
global?: boolean;
|
|
555
555
|
caseInsensitive?: boolean;
|
|
556
556
|
namespace?: string;
|
|
557
|
+
/**
|
|
558
|
+
* The `this` for a method called on the scope's own object (`ns.fn()`), or
|
|
559
|
+
* for `this.fn()` when this scope supplies `fn`. Unset, `ns.fn()` receives
|
|
560
|
+
* the scope's object. Applied since 0.7.0; accepted and ignored before.
|
|
561
|
+
*/
|
|
557
562
|
thisArg?: unknown;
|
|
558
563
|
}
|
|
559
564
|
/**
|
|
@@ -738,10 +743,22 @@ declare class EvalContext {
|
|
|
738
743
|
*/
|
|
739
744
|
hasInScopes(key: unknown): boolean;
|
|
740
745
|
/**
|
|
741
|
-
* Retrieves the `this` value of the specified key
|
|
742
|
-
*
|
|
746
|
+
* Retrieves the `this` value a call of the specified key receives through
|
|
747
|
+
* `this.key()`.
|
|
748
|
+
*
|
|
749
|
+
* - A key the original context holds: the original context.
|
|
750
|
+
* - A key a prior scope resolves: that scope's `thisArg`, or undefined when
|
|
751
|
+
* it sets none. The first scope that resolves the key answers, as in
|
|
752
|
+
* {@link get}.
|
|
753
|
+
* - A key only a lookup resolves, or none: undefined. A lookup is a resolver,
|
|
754
|
+
* not an object that holds the key.
|
|
755
|
+
*
|
|
756
|
+
* Undefined means "no receiver of its own", and the member visitor then falls
|
|
757
|
+
* back to the object it was evaluating. Up to 0.6.x the prior-scope step
|
|
758
|
+
* re-tested the original context and could never answer, and the lookup step
|
|
759
|
+
* returned the lookup function itself (`docs/backlog-retired.md` A7).
|
|
743
760
|
* @param key - The key to retrieve the value for.
|
|
744
|
-
* @returns The `this` value associated with the key, or undefined
|
|
761
|
+
* @returns The `this` value associated with the key, or undefined.
|
|
745
762
|
*/
|
|
746
763
|
getThis(key: unknown): unknown | undefined;
|
|
747
764
|
/**
|
|
@@ -1640,10 +1657,12 @@ declare class EvalHooks {
|
|
|
1640
1657
|
* reaching the scan.
|
|
1641
1658
|
*
|
|
1642
1659
|
* Popping positionally instead would be correct only if every visitor
|
|
1643
|
-
* bracketed its body exactly. `await-expression.ts`
|
|
1644
|
-
* child's synchronous throw and
|
|
1645
|
-
* positional pop
|
|
1646
|
-
* child's `after` entirely, and
|
|
1660
|
+
* bracketed its body exactly. Up to 0.6.x `await-expression.ts` did not - it
|
|
1661
|
+
* caught a child's synchronous throw and continued to its own
|
|
1662
|
+
* `afterVisitor` - so a positional pop closed the child's frame under the
|
|
1663
|
+
* parent's name, dropped the child's `after` entirely, and leaked one frame
|
|
1664
|
+
* onto the state for good. Since 0.7.0 no built-in visitor does that, and the
|
|
1665
|
+
* identity match stays as the guard against the next one.
|
|
1647
1666
|
*
|
|
1648
1667
|
* The synthesised events carry no `value` (the node never pushed one) and no
|
|
1649
1668
|
* `error` (nothing threw; the frames are being closed because an enclosing
|
|
@@ -2164,7 +2183,7 @@ declare class ParserService implements OnDestroy {
|
|
|
2164
2183
|
parse(expr: string, options?: ParserOptions): Program | AnyNode | Expression | undefined;
|
|
2165
2184
|
private fromCacheOrParse;
|
|
2166
2185
|
static ɵfac: i0.ɵɵFactoryDeclaration<ParserService, never>;
|
|
2167
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<
|
|
2186
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2168
2187
|
}
|
|
2169
2188
|
|
|
2170
2189
|
/**
|
|
@@ -2263,7 +2282,7 @@ declare class EvalService extends BaseEval implements OnDestroy {
|
|
|
2263
2282
|
*/
|
|
2264
2283
|
evalAsync(expression: string | AnyNode | undefined, state: EvalState): Promise<unknown | undefined>;
|
|
2265
2284
|
static ɵfac: i0.ɵɵFactoryDeclaration<EvalService, never>;
|
|
2266
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<
|
|
2285
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2267
2286
|
}
|
|
2268
2287
|
|
|
2269
2288
|
/**
|
|
@@ -2422,7 +2441,7 @@ declare class CompilerService extends BaseEval implements OnDestroy {
|
|
|
2422
2441
|
*/
|
|
2423
2442
|
callAsync(fn: stateCallbackAsync | undefined, state: EvalState): Promise<unknown>;
|
|
2424
2443
|
static ɵfac: i0.ɵɵFactoryDeclaration<CompilerService, never>;
|
|
2425
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<
|
|
2444
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2426
2445
|
}
|
|
2427
2446
|
|
|
2428
2447
|
/**
|
|
@@ -2444,7 +2463,7 @@ declare class DiscoveryService extends BaseEval {
|
|
|
2444
2463
|
*/
|
|
2445
2464
|
extract(expression: string | AnyNode | undefined, searchType: AnyNodeTypes): AnyNode[] | undefined;
|
|
2446
2465
|
static ɵfac: i0.ɵɵFactoryDeclaration<DiscoveryService, never>;
|
|
2447
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<
|
|
2466
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2448
2467
|
}
|
|
2449
2468
|
|
|
2450
2469
|
export { ASYNC_HOOK_MESSAGE, BaseRegistry, Cache, CaseInsensitiveRegistry, CompilerService, DiscoveryService, EMPTY_COMPLETION, EvalContext, EvalHooks, EvalResult, EvalScope, EvalService, EvalState, EvalTrace, ParserService, Queue, RecursiveVisitorResultType, Registry, Stack, call, callAsync, compile, compileAsync, createDependencyTracker, createTimingHook, defaultParserOptions, evaluate, evaluateAsync, extract, extractExpression, fromContext, getContextKey, getContextValue, isRegistryContext, parse };
|