@zvenigora/ng-eval-core 0.1.107 → 0.2.2

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.
Files changed (144) hide show
  1. package/fesm2022/zvenigora-ng-eval-core.mjs +1321 -97
  2. package/fesm2022/zvenigora-ng-eval-core.mjs.map +1 -1
  3. package/index.d.ts +1270 -1
  4. package/package.json +3 -5
  5. package/esm2022/index.mjs +0 -2
  6. package/esm2022/lib/actual/services/base-eval.mjs +0 -50
  7. package/esm2022/lib/actual/services/compiler.service.mjs +0 -168
  8. package/esm2022/lib/actual/services/discovery.service.mjs +0 -56
  9. package/esm2022/lib/actual/services/eval.service.mjs +0 -134
  10. package/esm2022/lib/actual/services/index.mjs +0 -2
  11. package/esm2022/lib/actual/services/parser.service.mjs +0 -101
  12. package/esm2022/lib/actual/services/public-api.mjs +0 -5
  13. package/esm2022/lib/internal/classes/common/base-registry.mjs +0 -128
  14. package/esm2022/lib/internal/classes/common/cache.mjs +0 -132
  15. package/esm2022/lib/internal/classes/common/case-insensitive-registry.mjs +0 -147
  16. package/esm2022/lib/internal/classes/common/context.mjs +0 -94
  17. package/esm2022/lib/internal/classes/common/index.mjs +0 -2
  18. package/esm2022/lib/internal/classes/common/public-api.mjs +0 -8
  19. package/esm2022/lib/internal/classes/common/queue.mjs +0 -42
  20. package/esm2022/lib/internal/classes/common/registry.mjs +0 -119
  21. package/esm2022/lib/internal/classes/common/stack.mjs +0 -59
  22. package/esm2022/lib/internal/classes/eval/eval-context.mjs +0 -201
  23. package/esm2022/lib/internal/classes/eval/eval-lookup.mjs +0 -2
  24. package/esm2022/lib/internal/classes/eval/eval-options.mjs +0 -42
  25. package/esm2022/lib/internal/classes/eval/eval-result.mjs +0 -141
  26. package/esm2022/lib/internal/classes/eval/eval-scope.mjs +0 -86
  27. package/esm2022/lib/internal/classes/eval/eval-state.mjs +0 -59
  28. package/esm2022/lib/internal/classes/eval/eval-trace.mjs +0 -22
  29. package/esm2022/lib/internal/classes/eval/index.mjs +0 -2
  30. package/esm2022/lib/internal/classes/eval/parser-options.mjs +0 -8
  31. package/esm2022/lib/internal/classes/eval/public-api.mjs +0 -7
  32. package/esm2022/lib/internal/functions/compile.mjs +0 -41
  33. package/esm2022/lib/internal/functions/evaluate.mjs +0 -42
  34. package/esm2022/lib/internal/functions/extract.mjs +0 -20
  35. package/esm2022/lib/internal/functions/index.mjs +0 -2
  36. package/esm2022/lib/internal/functions/parse.mjs +0 -31
  37. package/esm2022/lib/internal/functions/public-api.mjs +0 -5
  38. package/esm2022/lib/internal/interfaces/cache-type.mjs +0 -2
  39. package/esm2022/lib/internal/interfaces/index.mjs +0 -2
  40. package/esm2022/lib/internal/interfaces/parser-types.mjs +0 -2
  41. package/esm2022/lib/internal/interfaces/public-api.mjs +0 -3
  42. package/esm2022/lib/internal/interfaces/queue-type.mjs +0 -2
  43. package/esm2022/lib/internal/interfaces/recursive-visitors.mjs +0 -6
  44. package/esm2022/lib/internal/interfaces/registry-type.mjs +0 -2
  45. package/esm2022/lib/internal/interfaces/scope-type.mjs +0 -2
  46. package/esm2022/lib/internal/interfaces/stack-type.mjs +0 -2
  47. package/esm2022/lib/internal/public-api.mjs +0 -3
  48. package/esm2022/lib/internal/visitors/after-visitor.mjs +0 -10
  49. package/esm2022/lib/internal/visitors/array-expression.mjs +0 -29
  50. package/esm2022/lib/internal/visitors/arrow-function-expression.mjs +0 -18
  51. package/esm2022/lib/internal/visitors/assignment-expression.mjs +0 -52
  52. package/esm2022/lib/internal/visitors/await-expression.mjs +0 -14
  53. package/esm2022/lib/internal/visitors/before-visitor.mjs +0 -10
  54. package/esm2022/lib/internal/visitors/binary-expression.mjs +0 -37
  55. package/esm2022/lib/internal/visitors/call-expression.mjs +0 -36
  56. package/esm2022/lib/internal/visitors/conditional-expression.mjs +0 -18
  57. package/esm2022/lib/internal/visitors/identifier.mjs +0 -33
  58. package/esm2022/lib/internal/visitors/index.mjs +0 -2
  59. package/esm2022/lib/internal/visitors/literal.mjs +0 -10
  60. package/esm2022/lib/internal/visitors/logical-expression.mjs +0 -26
  61. package/esm2022/lib/internal/visitors/member-expression.mjs +0 -50
  62. package/esm2022/lib/internal/visitors/new-expression.mjs +0 -21
  63. package/esm2022/lib/internal/visitors/object-expression.mjs +0 -53
  64. package/esm2022/lib/internal/visitors/pattern.mjs +0 -132
  65. package/esm2022/lib/internal/visitors/public-api.mjs +0 -25
  66. package/esm2022/lib/internal/visitors/recursive-visitors.mjs +0 -28
  67. package/esm2022/lib/internal/visitors/tagged-template-expression.mjs +0 -20
  68. package/esm2022/lib/internal/visitors/template-literal.mjs +0 -21
  69. package/esm2022/lib/internal/visitors/this-expression.mjs +0 -10
  70. package/esm2022/lib/internal/visitors/unary-expression.mjs +0 -19
  71. package/esm2022/lib/internal/visitors/update-expression.mjs +0 -32
  72. package/esm2022/lib/internal/visitors/utils.mjs +0 -59
  73. package/esm2022/lib/internal/visitors/visitor-result.mjs +0 -23
  74. package/esm2022/public-api.mjs +0 -6
  75. package/esm2022/zvenigora-ng-eval-core.mjs +0 -5
  76. package/lib/actual/services/base-eval.d.ts +0 -35
  77. package/lib/actual/services/compiler.service.d.ts +0 -69
  78. package/lib/actual/services/discovery.service.d.ts +0 -27
  79. package/lib/actual/services/eval.service.d.ts +0 -53
  80. package/lib/actual/services/index.d.ts +0 -1
  81. package/lib/actual/services/parser.service.d.ts +0 -45
  82. package/lib/actual/services/public-api.d.ts +0 -4
  83. package/lib/internal/classes/common/base-registry.d.ts +0 -84
  84. package/lib/internal/classes/common/cache.d.ts +0 -91
  85. package/lib/internal/classes/common/case-insensitive-registry.d.ts +0 -85
  86. package/lib/internal/classes/common/context.d.ts +0 -42
  87. package/lib/internal/classes/common/index.d.ts +0 -1
  88. package/lib/internal/classes/common/public-api.d.ts +0 -7
  89. package/lib/internal/classes/common/queue.d.ts +0 -33
  90. package/lib/internal/classes/common/registry.d.ts +0 -86
  91. package/lib/internal/classes/common/stack.d.ts +0 -43
  92. package/lib/internal/classes/eval/eval-context.d.ts +0 -93
  93. package/lib/internal/classes/eval/eval-lookup.d.ts +0 -2
  94. package/lib/internal/classes/eval/eval-options.d.ts +0 -6
  95. package/lib/internal/classes/eval/eval-result.d.ts +0 -105
  96. package/lib/internal/classes/eval/eval-scope.d.ts +0 -51
  97. package/lib/internal/classes/eval/eval-state.d.ts +0 -46
  98. package/lib/internal/classes/eval/eval-trace.d.ts +0 -20
  99. package/lib/internal/classes/eval/index.d.ts +0 -1
  100. package/lib/internal/classes/eval/parser-options.d.ts +0 -2
  101. package/lib/internal/classes/eval/public-api.d.ts +0 -8
  102. package/lib/internal/functions/compile.d.ts +0 -33
  103. package/lib/internal/functions/evaluate.d.ts +0 -17
  104. package/lib/internal/functions/extract.d.ts +0 -10
  105. package/lib/internal/functions/index.d.ts +0 -1
  106. package/lib/internal/functions/parse.d.ts +0 -15
  107. package/lib/internal/functions/public-api.d.ts +0 -4
  108. package/lib/internal/interfaces/cache-type.d.ts +0 -6
  109. package/lib/internal/interfaces/index.d.ts +0 -1
  110. package/lib/internal/interfaces/parser-types.d.ts +0 -7
  111. package/lib/internal/interfaces/public-api.d.ts +0 -7
  112. package/lib/internal/interfaces/queue-type.d.ts +0 -6
  113. package/lib/internal/interfaces/recursive-visitors.d.ts +0 -43
  114. package/lib/internal/interfaces/registry-type.d.ts +0 -67
  115. package/lib/internal/interfaces/scope-type.d.ts +0 -15
  116. package/lib/internal/interfaces/stack-type.d.ts +0 -6
  117. package/lib/internal/public-api.d.ts +0 -2
  118. package/lib/internal/visitors/after-visitor.d.ts +0 -3
  119. package/lib/internal/visitors/array-expression.d.ts +0 -5
  120. package/lib/internal/visitors/arrow-function-expression.d.ts +0 -4
  121. package/lib/internal/visitors/assignment-expression.d.ts +0 -4
  122. package/lib/internal/visitors/await-expression.d.ts +0 -4
  123. package/lib/internal/visitors/before-visitor.d.ts +0 -3
  124. package/lib/internal/visitors/binary-expression.d.ts +0 -4
  125. package/lib/internal/visitors/call-expression.d.ts +0 -5
  126. package/lib/internal/visitors/conditional-expression.d.ts +0 -4
  127. package/lib/internal/visitors/identifier.d.ts +0 -3
  128. package/lib/internal/visitors/index.d.ts +0 -1
  129. package/lib/internal/visitors/literal.d.ts +0 -3
  130. package/lib/internal/visitors/logical-expression.d.ts +0 -4
  131. package/lib/internal/visitors/member-expression.d.ts +0 -5
  132. package/lib/internal/visitors/new-expression.d.ts +0 -5
  133. package/lib/internal/visitors/object-expression.d.ts +0 -4
  134. package/lib/internal/visitors/pattern.d.ts +0 -6
  135. package/lib/internal/visitors/public-api.d.ts +0 -24
  136. package/lib/internal/visitors/recursive-visitors.d.ts +0 -7
  137. package/lib/internal/visitors/tagged-template-expression.d.ts +0 -4
  138. package/lib/internal/visitors/template-literal.d.ts +0 -4
  139. package/lib/internal/visitors/this-expression.d.ts +0 -3
  140. package/lib/internal/visitors/unary-expression.d.ts +0 -4
  141. package/lib/internal/visitors/update-expression.d.ts +0 -4
  142. package/lib/internal/visitors/utils.d.ts +0 -26
  143. package/lib/internal/visitors/visitor-result.d.ts +0 -6
  144. package/public-api.d.ts +0 -5
@@ -1,46 +0,0 @@
1
- import { EvalContext } from './eval-context';
2
- import { EvalOptions } from './eval-options';
3
- import { EvalResult } from './eval-result';
4
- import { Context } from '../common';
5
- /**
6
- * Represents the evaluation state, which includes the context, result, and options.
7
- */
8
- export declare class EvalState {
9
- private _context;
10
- private _result;
11
- private _options;
12
- private _isAsync;
13
- /**
14
- * Gets the evaluation context.
15
- */
16
- get context(): EvalContext | undefined;
17
- /**
18
- * Gets the evaluation result.
19
- */
20
- get result(): EvalResult;
21
- /**
22
- * Gets the evaluation options.
23
- */
24
- get options(): EvalOptions | undefined;
25
- /**
26
- * Gets whether the evaluation is asynchronous.
27
- */
28
- get isAsync(): boolean | undefined;
29
- /**
30
- * Represents the state of an evaluation.
31
- * @param context The evaluation context.
32
- * @param result The evaluation result.
33
- * @param options The evaluation options.
34
- * @param isAsync Indicates whether the evaluation is asynchronous.
35
- */
36
- constructor(context: EvalContext | undefined, result: EvalResult, options?: EvalOptions, isAsync?: boolean);
37
- /**
38
- * Creates an instance of EvalState from a given context, options, and async flag.
39
- *
40
- * @param context - The evaluation context or context object.
41
- * @param options - The evaluation options.
42
- * @param isAsync - A flag indicating whether the evaluation is asynchronous.
43
- * @returns The created EvalState instance.
44
- */
45
- static fromContext(context?: EvalContext | Context, options?: EvalOptions, isAsync?: boolean): EvalState;
46
- }
@@ -1,20 +0,0 @@
1
- import { AnyNode } from "acorn";
2
- export interface EvalTraceItem {
3
- start?: number;
4
- end?: number;
5
- type: string;
6
- expression?: string;
7
- value: unknown;
8
- }
9
- /**
10
- * Represents a trace of evaluation for a specific code execution.
11
- */
12
- export declare class EvalTrace extends Array<EvalTraceItem> {
13
- /**
14
- * Adds a new trace item to the evaluation trace.
15
- * @param node - The AST node associated with the trace item.
16
- * @param value - The value of the evaluated expression.
17
- * @param expression - The expression being evaluated.
18
- */
19
- add(node: AnyNode, value?: unknown, expression?: string): void;
20
- }
@@ -1 +0,0 @@
1
- export * from './public-api';
@@ -1,2 +0,0 @@
1
- import { ParserOptions } from "../../interfaces";
2
- export declare const defaultParserOptions: ParserOptions;
@@ -1,8 +0,0 @@
1
- export { EvalOptions } from './eval-options';
2
- export { EvalContext } from './eval-context';
3
- export { EvalResult } from './eval-result';
4
- export { EvalState } from './eval-state';
5
- export { EvalLookup } from './eval-lookup';
6
- export { defaultParserOptions } from './parser-options';
7
- export { EvalTraceItem, EvalTrace } from './eval-trace';
8
- export { EvalScope, EvalScopeOptions } from './eval-scope';
@@ -1,33 +0,0 @@
1
- import { AnyNode } from 'acorn';
2
- import { EvalState } from '../classes/eval';
3
- export type stateCallback = (state: EvalState) => unknown;
4
- export type stateCallbackAsync = (state: EvalState) => Promise<unknown | undefined>;
5
- /**
6
- * Compiles the given node and returns a function that can be used to evaluate it.
7
- *
8
- * @param node The node to compile.
9
- * @returns A function that takes an `EvalState` and returns the result of evaluating the node.
10
- */
11
- export declare const compile: (node: AnyNode | undefined) => stateCallback;
12
- /**
13
- * Compiles the given node asynchronously.
14
- *
15
- * @param node - The node to compile.
16
- * @returns A function that takes an `EvalState` object and returns a `Promise` that resolves to the compiled result.
17
- */
18
- export declare const compileAsync: (node: AnyNode | undefined) => stateCallbackAsync;
19
- /**
20
- * Calls the provided function with the given state and returns the result.
21
- *
22
- * @param fn The function to be called.
23
- * @param state The state to be passed to the function.
24
- * @returns The result of calling the function.
25
- */
26
- export declare const call: (fn: stateCallback, state: EvalState) => unknown | undefined;
27
- /**
28
- * Calls an asynchronous function with the given state and returns a promise that resolves to the result.
29
- * @param fn The asynchronous function to call.
30
- * @param state The state to pass to the function.
31
- * @returns A promise that resolves to the result of the function.
32
- */
33
- export declare const callAsync: (fn: stateCallbackAsync, state: EvalState) => Promise<unknown | undefined>;
@@ -1,17 +0,0 @@
1
- import { EvalState } from '../classes/eval';
2
- import { AnyNode } from 'acorn';
3
- /**
4
- * Evaluates the given node and returns the result.
5
- *
6
- * @param node The node to evaluate.
7
- * @param state The evaluation state.
8
- * @returns The result of the evaluation.
9
- */
10
- export declare const evaluate: (node: AnyNode | undefined, state: EvalState) => unknown | undefined;
11
- /**
12
- * Asynchronously evaluates the given abstract syntax tree (AST) using the provided evaluation state.
13
- * @param ast The abstract syntax tree to evaluate.
14
- * @param state The evaluation state.
15
- * @returns A promise that resolves to the evaluated value or undefined.
16
- */
17
- export declare const evaluateAsync: (ast: AnyNode | undefined, state: EvalState) => Promise<unknown | undefined>;
@@ -1,10 +0,0 @@
1
- import { AnyNode } from 'acorn';
2
- import { AnyNodeTypes } from '../interfaces';
3
- /**
4
- * Finds all nodes of a specific type in the given AST.
5
- *
6
- * @param ast The AST to search in.
7
- * @param searchType The type of nodes to search for.
8
- * @returns An array of nodes of the specified type if found, otherwise undefined.
9
- */
10
- export declare const extract: (node: AnyNode | undefined, searchType: AnyNodeTypes) => AnyNode[] | undefined;
@@ -1 +0,0 @@
1
- export * from './public-api';
@@ -1,15 +0,0 @@
1
- import { AnyNode, Expression, Program } from "acorn";
2
- import { ParserOptions } from "../interfaces";
3
- /**
4
- * @description
5
- * Parses expression and returns ES6/ES2020 AST.
6
- * @param expr expression to parse
7
- * @param options parser options
8
- */
9
- export declare const parse: (expr: string, options: ParserOptions) => Program | AnyNode | undefined;
10
- /**
11
- * @description
12
- * Walks through the AST and extracts first expression.
13
- * @param expr expression to parse
14
- */
15
- export declare const extractExpression: (program: Program) => Expression | undefined;
@@ -1,4 +0,0 @@
1
- export { parse, extractExpression } from './parse';
2
- export { evaluate, evaluateAsync } from './evaluate';
3
- export { compile, compileAsync, stateCallback, stateCallbackAsync, call, callAsync } from './compile';
4
- export { extract } from './extract';
@@ -1,6 +0,0 @@
1
- import { RegistryType } from "../public-api";
2
- export interface CacheType<TValue> extends RegistryType<string, TValue> {
3
- type: Readonly<'Cache' | string>;
4
- maxCacheSize: number;
5
- getHashKey: (namespace: string, value: string) => string;
6
- }
@@ -1 +0,0 @@
1
- export * from './public-api';
@@ -1,7 +0,0 @@
1
- import * as acorn from 'acorn';
2
- export type ParserOptions = Partial<acorn.Options> & {
3
- extractExpressions?: boolean;
4
- cacheSize?: number;
5
- ecmaVersion?: acorn.ecmaVersion;
6
- };
7
- export type AnyNodeTypes = acorn.AnyNode['type'];
@@ -1,7 +0,0 @@
1
- export * from './parser-types';
2
- export { RegistryType, RegistryEntries } from './registry-type';
3
- export { StackType } from './stack-type';
4
- export { QueueType } from './queue-type';
5
- export { ScopeType, RegistryOptionType, ScopeOptions } from './scope-type';
6
- export { CacheType } from './cache-type';
7
- export { RecursiveVisitorState, RecursiveVisitorOptions, RecursiveVisitorContext, RecursiveVisitorResultType, RecursiveVisitorResult, RecursiveVisitorStackResult, RecursiveVisitorRegistryResult, RecursiveVisitor, RecursiveAggregateVisitor, AggregateType } from './recursive-visitors';
@@ -1,6 +0,0 @@
1
- export interface QueueType<T> {
2
- length: number;
3
- dequeue(): T | undefined;
4
- enqueue(value: T): number;
5
- peek(): T;
6
- }
@@ -1,43 +0,0 @@
1
- import { WalkerCallback } from 'acorn-walk';
2
- import * as acorn from 'acorn';
3
- import { StackType } from './stack-type';
4
- import { AnyNode } from 'acorn';
5
- import { RegistryType } from './registry-type';
6
- import { AnyNodeTypes } from './parser-types';
7
- import { BaseRegistry, Registry } from '../public-api';
8
- export interface RecursiveVisitorState {
9
- scope: Registry<unknown, unknown>;
10
- result: RecursiveVisitorResult<unknown | undefined>;
11
- option: RecursiveVisitorOptions;
12
- beforeVisitors?: RegistryType<AnyNodeTypes, (node: AnyNode, st: RecursiveVisitorState) => number | undefined>;
13
- afterVisitors?: RegistryType<AnyNodeTypes, (node: AnyNode, st: RecursiveVisitorState) => number | undefined>;
14
- }
15
- export interface RecursiveVisitorOptions {
16
- trackTime?: boolean;
17
- resultType?: 'stack' | 'registry';
18
- }
19
- export interface RecursiveVisitorContext {
20
- }
21
- export declare enum RecursiveVisitorResultType {
22
- Stack = 0,
23
- Registry = 1
24
- }
25
- export type RecursiveVisitorResult<TValue> = RecursiveVisitorStackResult<TValue> | RecursiveVisitorRegistryResult<TValue>;
26
- export interface RecursiveVisitorStackResult<TValue> {
27
- type: 'stack';
28
- stack: StackType<TValue>;
29
- }
30
- export interface RecursiveVisitorRegistryResult<TValue> {
31
- type: 'registry';
32
- registry: BaseRegistry<AnyNode, TValue>;
33
- }
34
- export type AggregateType = {
35
- Expression: acorn.Expression;
36
- Statement: acorn.Statement;
37
- Function: acorn.Function;
38
- Class: acorn.Class;
39
- Pattern: acorn.Pattern;
40
- ForInit: acorn.VariableDeclaration | acorn.Expression;
41
- };
42
- export type RecursiveVisitor<TState> = (node: acorn.AnyNode, state: TState, callback: WalkerCallback<TState>) => void;
43
- export type RecursiveAggregateVisitor<TState> = (node: AggregateType, state: TState, callback: WalkerCallback<TState>) => void;
@@ -1,67 +0,0 @@
1
- /**
2
- * Represents a registry that stores key-value pairs.
3
- * @template TKey - The type of the keys in the registry.
4
- * @template TValue - The type of the values in the registry.
5
- */
6
- export interface RegistryType<TKey, TValue> extends Iterable<[TKey, TValue]> {
7
- type: Readonly<'Registry' | string>;
8
- options: Readonly<{
9
- caseInsensitive: boolean;
10
- } | Record<string, unknown>>;
11
- /**
12
- * Retrieves the value associated with the specified key.
13
- * @param key - The key to retrieve the value for.
14
- * @returns The value associated with the key, or undefined if the key does not exist.
15
- */
16
- get(key: TKey): TValue | undefined;
17
- /**
18
- * Sets the value for the specified key.
19
- * @param key - The key to set the value for.
20
- * @param value - The value to set.
21
- */
22
- set(key: TKey, value: TValue): void;
23
- /**
24
- * Checks if the registry contains the specified key.
25
- * @param key - The key to check.
26
- * @returns True if the registry contains the key, false otherwise.
27
- */
28
- has(key: TKey): boolean;
29
- /**
30
- * Deletes the key-value pair associated with the specified key.
31
- * @param key - The key to delete.
32
- * @returns True if the key-value pair was deleted, false if the key does not exist.
33
- */
34
- delete(key: TKey): boolean;
35
- /**
36
- * Clears all key-value pairs from the registry.
37
- */
38
- clear(): void;
39
- /**
40
- * Gets the number of key-value pairs in the registry.
41
- */
42
- readonly size: number;
43
- /**
44
- * Gets an iterator for the keys in the registry.
45
- */
46
- readonly keys: IterableIterator<TKey>;
47
- /**
48
- * Gets an iterator for the values in the registry.
49
- */
50
- readonly values: IterableIterator<TValue>;
51
- /**
52
- * Gets an iterator for the key-value pairs in the registry.
53
- */
54
- readonly entries: IterableIterator<[TKey, TValue]>;
55
- /**
56
- * Executes a provided function once for each key-value pair in the registry.
57
- * @param callbackfn - The function to execute for each key-value pair.
58
- * @param thisArg - Optional value to use as `this` when executing the callback function.
59
- */
60
- forEach(callbackfn: (value: TValue, key: TKey, map: Map<TKey, TValue>) => void, thisArg?: unknown): void;
61
- /**
62
- * Returns an iterator for the entries of the registry.
63
- * @returns An iterator that yields key-value pairs of type [TKey, unknown].
64
- */
65
- [Symbol.iterator](): IterableIterator<[TKey, TValue]>;
66
- }
67
- export type RegistryEntries<TKey, TValue> = [TKey, TValue][] | Record<string | number | symbol, TValue>;
@@ -1,15 +0,0 @@
1
- import { RegistryType } from "./registry-type";
2
- export interface ScopeOptions {
3
- global?: boolean;
4
- caseInsensitive?: boolean;
5
- namespace?: string;
6
- }
7
- export interface RegistryOptionType<TKey, TValue> {
8
- registry: Readonly<RegistryType<TKey, TValue>>;
9
- options: Readonly<ScopeOptions>;
10
- }
11
- export interface ScopeType<TKey, TValue> {
12
- registries: RegistryOptionType<TKey, TValue>[];
13
- add: (registry: RegistryOptionType<TKey, TValue>) => void;
14
- get: (key: TKey, namespace?: string) => [TKey, TValue] | undefined;
15
- }
@@ -1,6 +0,0 @@
1
- export interface StackType<T> {
2
- peek(): T;
3
- pop(): T | undefined;
4
- push(value: T): number;
5
- swap(): void;
6
- }
@@ -1,2 +0,0 @@
1
- export * from './classes/common';
2
- export * from './interfaces';
@@ -1,3 +0,0 @@
1
- import { AnyNode } from 'acorn';
2
- import { EvalState } from '../classes/eval';
3
- export declare const afterVisitor: (node: AnyNode, st: EvalState) => number | undefined;
@@ -1,5 +0,0 @@
1
- import { AnyNode, ArrayExpression, Expression, SpreadElement } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const arrayExpressionVisitor: (node: ArrayExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
5
- export declare const evaluateArray: (node: AnyNode, items: Array<Expression | SpreadElement | null>, st: EvalState, callback: walk.WalkerCallback<EvalState>) => unknown[];
@@ -1,4 +0,0 @@
1
- import { ArrowFunctionExpression } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const arrowFunctionExpressionVisitor: (node: ArrowFunctionExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
@@ -1,4 +0,0 @@
1
- import { AssignmentExpression } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const assignmentExpressionVisitor: (node: AssignmentExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
@@ -1,4 +0,0 @@
1
- import { AwaitExpression } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const awaitVisitor: (node: AwaitExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
@@ -1,3 +0,0 @@
1
- import { AnyNode } from 'acorn';
2
- import { EvalState } from '../classes/eval';
3
- export declare const beforeVisitor: (node: AnyNode, st: EvalState) => number | undefined;
@@ -1,4 +0,0 @@
1
- import { BinaryExpression } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const binaryExpressionVisitor: (node: BinaryExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
@@ -1,5 +0,0 @@
1
- import { CallExpression } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const callExpressionVisitor: (node: CallExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
5
- export declare const evaluateCall: (node: CallExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => unknown;
@@ -1,4 +0,0 @@
1
- import { ConditionalExpression } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const conditionalExpressionVisitor: (node: ConditionalExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
@@ -1,3 +0,0 @@
1
- import { Identifier } from 'acorn';
2
- import { EvalState } from '../classes/eval';
3
- export declare const identifierVisitor: (node: Identifier, st: EvalState) => void;
@@ -1 +0,0 @@
1
- export * from './public-api';
@@ -1,3 +0,0 @@
1
- import { Literal } from 'acorn';
2
- import { EvalState } from '../classes/eval';
3
- export declare const literalVisitor: (node: Literal, st: EvalState) => void;
@@ -1,4 +0,0 @@
1
- import { LogicalExpression } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const logicalExpressionVisitor: (node: LogicalExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
@@ -1,5 +0,0 @@
1
- import { MemberExpression } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const memberExpressionVisitor: (node: MemberExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
5
- export declare const evaluateMember: (node: MemberExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => unknown[];
@@ -1,5 +0,0 @@
1
- import { NewExpression } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const newExpressionVisitor: (node: NewExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
5
- export declare const newFunc: (constructor: (...a: unknown[]) => unknown, ...args: unknown[]) => any;
@@ -1,4 +0,0 @@
1
- import { ObjectExpression } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const objectExpressionVisitor: (node: ObjectExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
@@ -1,6 +0,0 @@
1
- import { Pattern } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- import { BaseContext } from '../classes/common';
5
- export declare const evaluatePatterns: (patterns: Pattern[], st: EvalState, callback: walk.WalkerCallback<EvalState>, args: unknown[]) => BaseContext;
6
- export declare const evaluatePattern: (pattern: Pattern, st: EvalState, callback: walk.WalkerCallback<EvalState>, arg: unknown) => BaseContext;
@@ -1,24 +0,0 @@
1
- export { pushVisitorResult, popVisitorResult, pushVisitorResultAsync, popVisitorResultAsync } from './visitor-result';
2
- export { beforeVisitor } from './before-visitor';
3
- export { afterVisitor } from './after-visitor';
4
- export { identifierVisitor } from './identifier';
5
- export { literalVisitor } from './literal';
6
- export { binaryExpressionVisitor } from './binary-expression';
7
- export { callExpressionVisitor } from './call-expression';
8
- export { awaitVisitor } from './await-expression';
9
- export { conditionalExpressionVisitor } from './conditional-expression';
10
- export { memberExpressionVisitor, evaluateMember } from './member-expression';
11
- export { arrayExpressionVisitor, evaluateArray } from './array-expression';
12
- export { unaryExpressionVisitor } from './unary-expression';
13
- export { logicalExpressionVisitor } from './logical-expression';
14
- export { thisExpressionVisitor } from './this-expression';
15
- export { newExpressionVisitor } from './new-expression';
16
- export { templateLiteralVisitor } from './template-literal';
17
- export { taggedTemplateExpressionVisitor } from './tagged-template-expression';
18
- export { objectExpressionVisitor } from './object-expression';
19
- export { getDefaultVisitors } from './recursive-visitors';
20
- export { assignmentExpressionVisitor } from './assignment-expression';
21
- export { updateExpressionVisitor } from './update-expression';
22
- export { arrowFunctionExpressionVisitor } from './arrow-function-expression';
23
- export { evaluatePattern, evaluatePatterns } from './pattern';
24
- export { getKeyValue, equalIgnoreCase, getValueIgnoreCase } from './utils';
@@ -1,7 +0,0 @@
1
- import { EvalState } from '../classes/eval';
2
- import * as walk from 'acorn-walk';
3
- /**
4
- * Returns the default visitors for the recursive traversal of an abstract syntax tree.
5
- * @returns The default visitors object.
6
- */
7
- export declare const getDefaultVisitors: () => walk.RecursiveVisitors<EvalState>;
@@ -1,4 +0,0 @@
1
- import { TaggedTemplateExpression } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const taggedTemplateExpressionVisitor: (node: TaggedTemplateExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
@@ -1,4 +0,0 @@
1
- import { TemplateLiteral } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const templateLiteralVisitor: (node: TemplateLiteral, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
@@ -1,3 +0,0 @@
1
- import { ThisExpression } from 'acorn';
2
- import { EvalState } from '../classes/eval';
3
- export declare const thisExpressionVisitor: (node: ThisExpression, st: EvalState) => void;
@@ -1,4 +0,0 @@
1
- import { UnaryExpression } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const unaryExpressionVisitor: (node: UnaryExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
@@ -1,4 +0,0 @@
1
- import { UpdateExpression } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import { EvalState } from '../classes/eval';
4
- export declare const updateExpressionVisitor: (node: UpdateExpression, st: EvalState, callback: walk.WalkerCallback<EvalState>) => void;
@@ -1,26 +0,0 @@
1
- import { BaseContext } from "../classes/common/context";
2
- /**
3
- * Retrieves the key-value pair from an object based on the provided key.
4
- * @param obj - The object to search for the key-value pair.
5
- * @param key - The key to search for in the object.
6
- * @param caseInsesitive - Specifies whether the key comparison should be case-insensitive.
7
- * @returns The key-value pair as an array, or undefined if the key is not found.
8
- */
9
- export declare const getKeyValue: (obj: BaseContext, key: string | number | symbol, caseInsesitive: boolean) => [
10
- string | number | symbol,
11
- unknown
12
- ] | undefined;
13
- /**
14
- * Compares two values for equality, ignoring case sensitivity.
15
- * @param a - The first value to compare.
16
- * @param b - The second value to compare.
17
- * @returns `true` if the values are equal, `false` otherwise.
18
- */
19
- export declare const equalIgnoreCase: (a: string | number | symbol, b: string | number | symbol) => boolean | undefined;
20
- /**
21
- * Retrieves the value from an object, ignoring the case of the key.
22
- * @param obj - The object to retrieve the value from.
23
- * @param key - The key to search for, ignoring the case.
24
- * @returns The value associated with the key, or undefined if the key is not found.
25
- */
26
- export declare const getValueIgnoreCase: (obj: BaseContext, key: string | number | symbol) => unknown | undefined;
@@ -1,6 +0,0 @@
1
- import { AnyNode } from 'acorn';
2
- import { EvalState } from '../classes/eval';
3
- export declare const pushVisitorResult: (node: AnyNode, st: EvalState, value: unknown) => unknown;
4
- export declare const popVisitorResult: (node: AnyNode, st: EvalState) => unknown;
5
- export declare const pushVisitorResultAsync: (node: AnyNode, st: EvalState, value: Promise<unknown>) => Promise<unknown>;
6
- export declare const popVisitorResultAsync: (node: AnyNode, st: EvalState) => Promise<unknown>;
package/public-api.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from './lib/actual/services';
2
- export * from './lib/internal/interfaces';
3
- export * from './lib/internal/functions';
4
- export * from './lib/internal/classes/common';
5
- export * from './lib/internal/classes/eval';