astronomical 2.1.1-rc.1 → 3.0.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/lib/{cjs/types/index.d.ts → index.d.mts} +16 -15
- package/lib/{esm/types/index.d.ts → index.d.ts} +16 -15
- package/lib/index.js +1355 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +1325 -0
- package/lib/index.mjs.map +1 -0
- package/package.json +11 -13
- package/lib/cjs/index.js +0 -886
- package/lib/cjs/nodeutils.js +0 -260
- package/lib/cjs/parseQuery.js +0 -340
- package/lib/cjs/types/index.d.ts.map +0 -1
- package/lib/cjs/types/nodeutils.d.ts +0 -21
- package/lib/cjs/types/nodeutils.d.ts.map +0 -1
- package/lib/cjs/types/parseQuery.d.ts +0 -71
- package/lib/cjs/types/parseQuery.d.ts.map +0 -1
- package/lib/cjs/types/utils.d.ts +0 -3
- package/lib/cjs/types/utils.d.ts.map +0 -1
- package/lib/cjs/utils.js +0 -10
- package/lib/esm/index.js +0 -886
- package/lib/esm/nodeutils.js +0 -260
- package/lib/esm/parseQuery.js +0 -340
- package/lib/esm/types/index.d.ts.map +0 -1
- package/lib/esm/types/nodeutils.d.ts +0 -21
- package/lib/esm/types/nodeutils.d.ts.map +0 -1
- package/lib/esm/types/parseQuery.d.ts +0 -71
- package/lib/esm/types/parseQuery.d.ts.map +0 -1
- package/lib/esm/types/utils.d.ts +0 -3
- package/lib/esm/types/utils.d.ts.map +0 -1
- package/lib/esm/utils.js +0 -10
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ESTree } from
|
|
2
|
-
|
|
1
|
+
import { ESTree } from 'meriyah';
|
|
2
|
+
|
|
3
|
+
declare const functions: {
|
|
3
4
|
join: {
|
|
4
5
|
fn: (result: Result[][]) => Result[];
|
|
5
6
|
};
|
|
@@ -13,33 +14,33 @@ export declare const functions: {
|
|
|
13
14
|
fn: (result: Result[][]) => Result[];
|
|
14
15
|
};
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
type AvailableFunction = keyof typeof functions;
|
|
18
|
+
declare function isAvailableFunction(name: string): name is AvailableFunction;
|
|
19
|
+
type PrimitiveValue = string | number | boolean;
|
|
19
20
|
type Result = ASTNode | PrimitiveValue;
|
|
20
|
-
|
|
21
|
+
declare function query(code: string | ASTNode, query: string, returnAST?: boolean): Result[] & {
|
|
21
22
|
__AST?: ASTNode;
|
|
22
23
|
};
|
|
23
|
-
|
|
24
|
+
declare function multiQuery<T extends Record<string, string>>(code: string | ASTNode, namedQueries: T, returnAST?: boolean): Record<keyof T, Result[]> & {
|
|
24
25
|
__AST?: ASTNode;
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
declare function parseSource(source: string, optimize?: boolean): ASTNode;
|
|
28
|
+
type Binding = {
|
|
28
29
|
path: NodePath;
|
|
29
30
|
};
|
|
30
|
-
|
|
31
|
+
type Scope = {
|
|
31
32
|
bindings: Record<string, Binding>;
|
|
32
33
|
parentScopeId?: number;
|
|
33
34
|
id: number;
|
|
34
35
|
};
|
|
35
|
-
|
|
36
|
+
type ASTNode = ESTree.Node & {
|
|
36
37
|
extra?: {
|
|
37
38
|
scopeId?: number;
|
|
38
39
|
functionScopeId?: number;
|
|
39
40
|
nodePath?: NodePath;
|
|
40
41
|
};
|
|
41
42
|
};
|
|
42
|
-
|
|
43
|
+
type NodePath = {
|
|
43
44
|
node: ASTNode;
|
|
44
45
|
key?: string;
|
|
45
46
|
parentPath?: NodePath;
|
|
@@ -51,7 +52,7 @@ type Visitor<T> = {
|
|
|
51
52
|
enter: (path: NodePath, state: T) => void;
|
|
52
53
|
exit: (path: NodePath, state: T) => void;
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
+
declare function createTraverser(): {
|
|
55
56
|
traverse: <T>(node: ASTNode, visitor: Visitor<T>, scopeId: number | undefined, state: T, path?: NodePath) => void;
|
|
56
57
|
createNodePath: (node: ASTNode, key: string | undefined | number, parentKey: string | undefined, scopeId: number | undefined, functionScopeId: number | undefined, nodePath?: NodePath) => NodePath;
|
|
57
58
|
getChildren: (key: string, path: NodePath) => NodePath[];
|
|
@@ -59,5 +60,5 @@ export default function createTraverser(): {
|
|
|
59
60
|
getPrimitiveChildrenOrNodePaths: (key: string, path: NodePath) => Array<PrimitiveValue | NodePath>;
|
|
60
61
|
getBinding: (scopeId: number, name: string) => Binding | undefined;
|
|
61
62
|
};
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
|
|
64
|
+
export { type ASTNode, type AvailableFunction, type Binding, type NodePath, type PrimitiveValue, type Scope, createTraverser as default, functions, isAvailableFunction, multiQuery, parseSource, query };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ESTree } from
|
|
2
|
-
|
|
1
|
+
import { ESTree } from 'meriyah';
|
|
2
|
+
|
|
3
|
+
declare const functions: {
|
|
3
4
|
join: {
|
|
4
5
|
fn: (result: Result[][]) => Result[];
|
|
5
6
|
};
|
|
@@ -13,33 +14,33 @@ export declare const functions: {
|
|
|
13
14
|
fn: (result: Result[][]) => Result[];
|
|
14
15
|
};
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
type AvailableFunction = keyof typeof functions;
|
|
18
|
+
declare function isAvailableFunction(name: string): name is AvailableFunction;
|
|
19
|
+
type PrimitiveValue = string | number | boolean;
|
|
19
20
|
type Result = ASTNode | PrimitiveValue;
|
|
20
|
-
|
|
21
|
+
declare function query(code: string | ASTNode, query: string, returnAST?: boolean): Result[] & {
|
|
21
22
|
__AST?: ASTNode;
|
|
22
23
|
};
|
|
23
|
-
|
|
24
|
+
declare function multiQuery<T extends Record<string, string>>(code: string | ASTNode, namedQueries: T, returnAST?: boolean): Record<keyof T, Result[]> & {
|
|
24
25
|
__AST?: ASTNode;
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
declare function parseSource(source: string, optimize?: boolean): ASTNode;
|
|
28
|
+
type Binding = {
|
|
28
29
|
path: NodePath;
|
|
29
30
|
};
|
|
30
|
-
|
|
31
|
+
type Scope = {
|
|
31
32
|
bindings: Record<string, Binding>;
|
|
32
33
|
parentScopeId?: number;
|
|
33
34
|
id: number;
|
|
34
35
|
};
|
|
35
|
-
|
|
36
|
+
type ASTNode = ESTree.Node & {
|
|
36
37
|
extra?: {
|
|
37
38
|
scopeId?: number;
|
|
38
39
|
functionScopeId?: number;
|
|
39
40
|
nodePath?: NodePath;
|
|
40
41
|
};
|
|
41
42
|
};
|
|
42
|
-
|
|
43
|
+
type NodePath = {
|
|
43
44
|
node: ASTNode;
|
|
44
45
|
key?: string;
|
|
45
46
|
parentPath?: NodePath;
|
|
@@ -51,7 +52,7 @@ type Visitor<T> = {
|
|
|
51
52
|
enter: (path: NodePath, state: T) => void;
|
|
52
53
|
exit: (path: NodePath, state: T) => void;
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
+
declare function createTraverser(): {
|
|
55
56
|
traverse: <T>(node: ASTNode, visitor: Visitor<T>, scopeId: number | undefined, state: T, path?: NodePath) => void;
|
|
56
57
|
createNodePath: (node: ASTNode, key: string | undefined | number, parentKey: string | undefined, scopeId: number | undefined, functionScopeId: number | undefined, nodePath?: NodePath) => NodePath;
|
|
57
58
|
getChildren: (key: string, path: NodePath) => NodePath[];
|
|
@@ -59,5 +60,5 @@ export default function createTraverser(): {
|
|
|
59
60
|
getPrimitiveChildrenOrNodePaths: (key: string, path: NodePath) => Array<PrimitiveValue | NodePath>;
|
|
60
61
|
getBinding: (scopeId: number, name: string) => Binding | undefined;
|
|
61
62
|
};
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
|
|
64
|
+
export { type ASTNode, type AvailableFunction, type Binding, type NodePath, type PrimitiveValue, type Scope, createTraverser as default, functions, isAvailableFunction, multiQuery, parseSource, query };
|