@next-core/cook 2.2.18 → 2.3.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/dist/cjs/ExecutionContext.js +6 -3
- package/dist/cjs/ExecutionContext.js.map +1 -1
- package/dist/cjs/context-free.js.map +1 -1
- package/dist/cjs/cook.js +304 -168
- package/dist/cjs/cook.js.map +1 -1
- package/dist/cjs/interfaces.js.map +1 -1
- package/dist/esm/ExecutionContext.js +5 -2
- package/dist/esm/ExecutionContext.js.map +1 -1
- package/dist/esm/context-free.js.map +1 -1
- package/dist/esm/cook.js +305 -169
- package/dist/esm/cook.js.map +1 -1
- package/dist/esm/interfaces.js.map +1 -1
- package/dist/types/ExecutionContext.d.ts +10 -3
- package/dist/types/context-free.d.ts +1 -1
- package/dist/types/cook.d.ts +4 -3
- package/dist/types/interfaces.d.ts +3 -1
- package/package.json +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ArrowFunctionExpression, Expression, FunctionDeclaration, FunctionExpression, Statement } from "@babel/types";
|
|
1
|
+
import type { ArrowFunctionExpression, Expression, FunctionDeclaration, FunctionExpression, Statement } from "@babel/types";
|
|
2
|
+
import type { EstreeNode } from "./interfaces.js";
|
|
2
3
|
export declare class ExecutionContext {
|
|
3
4
|
VariableEnvironment?: EnvironmentRecord;
|
|
4
5
|
LexicalEnvironment?: EnvironmentRecord;
|
|
@@ -28,8 +29,8 @@ export declare class EnvironmentRecord {
|
|
|
28
29
|
* @param strict - For functions, strict is always false, otherwise it depends on strict-mode.
|
|
29
30
|
* @returns
|
|
30
31
|
*/
|
|
31
|
-
SetMutableBinding(name: string, value: unknown,
|
|
32
|
-
GetBindingValue(name: string,
|
|
32
|
+
SetMutableBinding(name: string, value: unknown, _strict?: boolean): CompletionRecord;
|
|
33
|
+
GetBindingValue(name: string, _strict?: boolean): unknown;
|
|
33
34
|
}
|
|
34
35
|
export declare class DeclarativeEnvironment extends EnvironmentRecord {
|
|
35
36
|
}
|
|
@@ -53,6 +54,9 @@ export declare const FormalParameters: unique symbol;
|
|
|
53
54
|
export declare const ECMAScriptCode: unique symbol;
|
|
54
55
|
export declare const Environment: unique symbol;
|
|
55
56
|
export declare const IsConstructor: unique symbol;
|
|
57
|
+
export declare const DebuggerCall: unique symbol;
|
|
58
|
+
export declare const DebuggerScope: unique symbol;
|
|
59
|
+
export declare const DebuggerNode: unique symbol;
|
|
56
60
|
export interface FunctionObject {
|
|
57
61
|
(...args: unknown[]): unknown;
|
|
58
62
|
[SourceNode]: FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
|
|
@@ -60,6 +64,9 @@ export interface FunctionObject {
|
|
|
60
64
|
[ECMAScriptCode]: Statement[] | Expression;
|
|
61
65
|
[Environment]: EnvironmentRecord;
|
|
62
66
|
[IsConstructor]: boolean;
|
|
67
|
+
[DebuggerCall]?: (...args: unknown[]) => IterableIterator<unknown>;
|
|
68
|
+
[DebuggerScope]?: () => EnvironmentRecord | null | undefined;
|
|
69
|
+
[DebuggerNode]?: () => EstreeNode | undefined;
|
|
63
70
|
}
|
|
64
71
|
export declare class ReferenceRecord {
|
|
65
72
|
readonly Base: Record<PropertyKey, unknown> | EnvironmentRecord | "unresolvable";
|
|
@@ -6,7 +6,7 @@ export declare function CopyDataProperties(target: Record<PropertyKey, unknown>,
|
|
|
6
6
|
export declare function ForDeclarationBindingInstantiation(forDeclaration: VariableDeclaration, env: EnvironmentRecord): void;
|
|
7
7
|
export declare function LoopContinues(completion: CompletionRecord): boolean;
|
|
8
8
|
export declare function UpdateEmpty(completion: CompletionRecord, value: unknown): CompletionRecord;
|
|
9
|
-
export declare function GetValue(V: unknown): unknown;
|
|
9
|
+
export declare function GetValue(V: CompletionRecord | ReferenceRecord | unknown): unknown;
|
|
10
10
|
export declare function ToPropertyKey(arg: unknown): string | symbol;
|
|
11
11
|
export declare function GetV(V: unknown, P: PropertyKey): unknown;
|
|
12
12
|
export declare function PutValue(V: ReferenceRecord, W: unknown): CompletionRecord;
|
package/dist/types/cook.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Expression, FunctionDeclaration } from "@babel/types";
|
|
2
|
-
import { EstreeNode, CookRules } from "./interfaces.js";
|
|
1
|
+
import type { Expression, FunctionDeclaration } from "@babel/types";
|
|
2
|
+
import type { EstreeNode, CookRules } from "./interfaces.js";
|
|
3
3
|
export interface CookOptions {
|
|
4
4
|
rules?: CookRules;
|
|
5
5
|
globalVariables?: Record<string, unknown>;
|
|
6
6
|
hooks?: CookHooks;
|
|
7
|
+
debug?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export interface CookHooks {
|
|
9
10
|
beforeEvaluate?(node: EstreeNode): void;
|
|
@@ -11,4 +12,4 @@ export interface CookHooks {
|
|
|
11
12
|
beforeBranch?(node: EstreeNode, branch: "if" | "else"): void;
|
|
12
13
|
}
|
|
13
14
|
/** For next-core internal usage only. */
|
|
14
|
-
export declare function cook(rootAst: FunctionDeclaration | Expression, codeSource: string, { rules, globalVariables, hooks }?: CookOptions): unknown;
|
|
15
|
+
export declare function cook(rootAst: FunctionDeclaration | Expression, codeSource: string, { rules, debug, globalVariables, hooks }?: CookOptions): unknown;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parse } from "@babel/parser";
|
|
2
|
-
import { Expression, FunctionDeclaration, LVal, Node, ObjectExpression, ObjectPattern, ObjectProperty, RestElement, SourceLocation, SpreadElement, VariableDeclaration } from "@babel/types";
|
|
2
|
+
import { Expression, FunctionDeclaration, LVal, Node, ObjectExpression, ObjectPattern, ObjectProperty, RestElement, SourceLocation, SpreadElement, VariableDeclaration, type ArrowFunctionExpression, type FunctionExpression } from "@babel/types";
|
|
3
3
|
export type EstreeNode = Node | EstreeObjectExpression | EstreeObjectPattern | EstreeProperty | EstreeChainExpression | EstreeLiteral;
|
|
4
4
|
export type EstreeLVal = LVal | EstreeObjectPattern;
|
|
5
5
|
export type EstreeObjectExpression = Omit<ObjectExpression, "properties"> & {
|
|
@@ -11,6 +11,7 @@ export type EstreeObjectPattern = Omit<ObjectPattern, "properties"> & {
|
|
|
11
11
|
export type EstreeProperty = Omit<ObjectProperty, "type"> & {
|
|
12
12
|
type: "Property";
|
|
13
13
|
kind: "init" | "get" | "set";
|
|
14
|
+
method?: boolean;
|
|
14
15
|
};
|
|
15
16
|
export interface EstreeChainExpression {
|
|
16
17
|
type: "ChainExpression";
|
|
@@ -26,6 +27,7 @@ export interface EstreeLiteral {
|
|
|
26
27
|
};
|
|
27
28
|
loc: SourceLocation;
|
|
28
29
|
}
|
|
30
|
+
export type FunctionDefinition = FunctionExpression | ArrowFunctionExpression;
|
|
29
31
|
export type NodeWithBoundNames = LVal | VariableDeclaration | FunctionDeclaration;
|
|
30
32
|
export type EstreeVisitors = Record<string, EstreeVisitorFn>;
|
|
31
33
|
export type EstreeVisitorFn = (node: any) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/cook",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Cook expressions and storyboard functions",
|
|
5
5
|
"homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/cook",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@next-core/build-next-libs": "^1.0.17",
|
|
56
|
-
"@next-core/supply": "^2.1.
|
|
56
|
+
"@next-core/supply": "^2.1.18",
|
|
57
57
|
"@next-core/test-next": "^1.1.3",
|
|
58
58
|
"lodash": "^4.17.21"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "a143984961ebb50532250cad45a7dbdfd23d8728"
|
|
61
61
|
}
|