astronomical 2.0.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.
@@ -1,260 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VISITOR_KEYS = exports.isBinding = exports.isVariableDeclaration = exports.isVariableDeclarator = exports.isFunctionExpression = exports.isFunctionDeclaration = exports.isIdentifier = exports.isMemberExpression = exports.isAssignmentExpression = exports.isUpdateExpression = exports.isPrimitive = exports.isLiteral = exports.isNodePath = exports.isNode = void 0;
4
- exports.isScope = isScope;
5
- exports.isScopable = isScopable;
6
- exports.isExportSpecifier = isExportSpecifier;
7
- const isNode = (candidate) => {
8
- return typeof candidate === "object" && candidate != null && "type" in candidate;
9
- };
10
- exports.isNode = isNode;
11
- const isNodePath = (candidate) => {
12
- return typeof candidate === "object" && candidate != null && "node" in candidate;
13
- };
14
- exports.isNodePath = isNodePath;
15
- const isLiteral = (candidate) => {
16
- return (0, exports.isNode)(candidate) && candidate.type === "Literal";
17
- };
18
- exports.isLiteral = isLiteral;
19
- const isPrimitive = (value) => {
20
- return typeof value == "string" || typeof value == "number" || typeof value == "boolean";
21
- };
22
- exports.isPrimitive = isPrimitive;
23
- const isUpdateExpression = (value) => {
24
- return (0, exports.isNode)(value) && value.type === "UpdateExpression";
25
- };
26
- exports.isUpdateExpression = isUpdateExpression;
27
- const isAssignmentExpression = (node) => {
28
- return node.type === "AssignmentExpression";
29
- };
30
- exports.isAssignmentExpression = isAssignmentExpression;
31
- const isMemberExpression = (node) => {
32
- return node.type === "MemberExpression";
33
- };
34
- exports.isMemberExpression = isMemberExpression;
35
- const isIdentifier = (node) => {
36
- return node.type === "Identifier";
37
- };
38
- exports.isIdentifier = isIdentifier;
39
- const isFunctionDeclaration = (node) => {
40
- return node.type === "FunctionDeclaration";
41
- };
42
- exports.isFunctionDeclaration = isFunctionDeclaration;
43
- const isFunctionExpression = (node) => {
44
- return node.type === "FunctionExpression";
45
- };
46
- exports.isFunctionExpression = isFunctionExpression;
47
- const isVariableDeclarator = (node) => {
48
- return node.type === "VariableDeclarator";
49
- };
50
- exports.isVariableDeclarator = isVariableDeclarator;
51
- const isVariableDeclaration = (node) => {
52
- return node.type === "VariableDeclaration";
53
- };
54
- exports.isVariableDeclaration = isVariableDeclaration;
55
- const isBinding = (node, parentNode, grandParentNode) => {
56
- if (grandParentNode &&
57
- node.type === "Identifier" &&
58
- parentNode.type === "Property" &&
59
- grandParentNode.type === "ObjectExpression") {
60
- return false;
61
- }
62
- const keys = bindingIdentifiersKeys[parentNode.type] ?? [];
63
- for (let i = 0; i < keys.length; i++) {
64
- const key = keys[i];
65
- const val =
66
- // @ts-expect-error key must present in parent
67
- parentNode[key];
68
- if (Array.isArray(val)) {
69
- if (val.indexOf(node) >= 0)
70
- return true;
71
- }
72
- else {
73
- if (val === node)
74
- return true;
75
- }
76
- }
77
- return false;
78
- };
79
- exports.isBinding = isBinding;
80
- const bindingIdentifiersKeys = {
81
- DeclareClass: ["id"],
82
- DeclareFunction: ["id"],
83
- DeclareModule: ["id"],
84
- DeclareVariable: ["id"],
85
- DeclareInterface: ["id"],
86
- DeclareTypeAlias: ["id"],
87
- DeclareOpaqueType: ["id"],
88
- InterfaceDeclaration: ["id"],
89
- TypeAlias: ["id"],
90
- OpaqueType: ["id"],
91
- CatchClause: ["param"],
92
- LabeledStatement: ["label"],
93
- UnaryExpression: ["argument"],
94
- AssignmentExpression: ["left"],
95
- ImportSpecifier: ["local"],
96
- ImportNamespaceSpecifier: ["local"],
97
- ImportDefaultSpecifier: ["local"],
98
- ImportDeclaration: ["specifiers"],
99
- ExportSpecifier: ["exported"],
100
- ExportNamespaceSpecifier: ["exported"],
101
- ExportDefaultSpecifier: ["exported"],
102
- FunctionDeclaration: ["id", "params"],
103
- FunctionExpression: ["id", "params"],
104
- ArrowFunctionExpression: ["params"],
105
- ObjectMethod: ["params"],
106
- ClassMethod: ["params"],
107
- ClassPrivateMethod: ["params"],
108
- ForInStatement: ["left"],
109
- ForOfStatement: ["left"],
110
- ClassDeclaration: ["id"],
111
- ClassExpression: ["id"],
112
- RestElement: ["argument"],
113
- UpdateExpression: ["argument"],
114
- ObjectProperty: ["value"],
115
- AssignmentPattern: ["left"],
116
- ArrayPattern: ["elements"],
117
- ObjectPattern: ["properties"],
118
- VariableDeclaration: ["declarations"],
119
- VariableDeclarator: ["id"],
120
- };
121
- exports.VISITOR_KEYS = {
122
- ArrayExpression: ["elements"],
123
- ArrayPattern: ["elements"],
124
- ArrowFunctionExpression: ["params", "body"],
125
- AssignmentExpression: ["left", "right"],
126
- AssignmentPattern: ["left", "right"],
127
- AwaitExpression: ["argument"],
128
- BinaryExpression: ["left", "right"],
129
- BlockStatement: ["body"],
130
- BreakStatement: [],
131
- CallExpression: ["callee", "arguments"],
132
- CatchClause: ["param", "body"],
133
- ChainExpression: ["expression"],
134
- ClassBody: ["body"],
135
- ClassDeclaration: ["id", "superClass", "body"],
136
- ClassExpression: ["id", "superClass", "body"],
137
- ConditionalExpression: ["test", "consequent", "alternate"],
138
- ContinueStatement: [],
139
- DebuggerStatement: [],
140
- DoWhileStatement: ["body", "test"],
141
- EmptyStatement: [],
142
- ExportAllDeclaration: ["source"],
143
- ExportDefaultDeclaration: ["declaration"],
144
- ExportNamedDeclaration: ["declaration", "specifiers", "source"],
145
- ExportSpecifier: ["local", "exported"],
146
- ExpressionStatement: ["expression"],
147
- ForInStatement: ["left", "right", "body"],
148
- ForOfStatement: ["left", "right", "body"],
149
- ForStatement: ["init", "test", "update", "body"],
150
- FunctionDeclaration: ["id", "params", "body"],
151
- FunctionExpression: ["id", "params", "body"],
152
- Identifier: [],
153
- IfStatement: ["test", "consequent", "alternate"],
154
- ImportAttribute: ["key", "value"],
155
- ImportDeclaration: ["specifiers", "source"],
156
- ImportDefaultSpecifier: ["local"],
157
- ImportNamespaceSpecifier: ["local"],
158
- ImportSpecifier: ["local", "imported"],
159
- LabeledStatement: ["label", "body"],
160
- Literal: [],
161
- LogicalExpression: ["left", "right"],
162
- MemberExpression: ["object", "property"],
163
- MetaProperty: ["meta", "property"],
164
- MethodDefinition: ["key", "value"],
165
- NewExpression: ["callee", "arguments"],
166
- ObjectExpression: ["properties"],
167
- ObjectPattern: ["properties"],
168
- Program: ["body"],
169
- Property: ["key", "value"],
170
- RestElement: ["argument"],
171
- ReturnStatement: ["argument"],
172
- SequenceExpression: ["expressions"],
173
- SpreadElement: ["argument"],
174
- Super: [],
175
- SwitchCase: ["test", "consequent"],
176
- SwitchStatement: ["discriminant", "cases"],
177
- TaggedTemplateExpression: ["tag", "quasi"],
178
- TemplateElement: [],
179
- TemplateLiteral: ["quasis", "expressions"],
180
- ThisExpression: [],
181
- ThrowStatement: ["argument"],
182
- TryStatement: ["block", "handler", "finalizer"],
183
- UnaryExpression: ["argument"],
184
- UpdateExpression: ["argument"],
185
- VariableDeclaration: ["declarations"],
186
- VariableDeclarator: ["id", "init"],
187
- WhileStatement: ["test", "body"],
188
- WithStatement: ["object", "body"],
189
- YieldExpression: ["argument"],
190
- ImportExpression: ["source"],
191
- Decorator: ["expression"],
192
- PropertyDefinition: ["key", "value"],
193
- Import: ["source"],
194
- JSXAttribute: ["name", "value"],
195
- JSXNamespacedName: ["namespace", "name"],
196
- JSXElement: ["openingElement", "closingElement", "children"],
197
- JSXClosingElement: ["name"],
198
- JSXOpeningElement: ["name", "attributes"],
199
- JSXFragment: ["openingFragment", "closingFragment", "children"],
200
- JSXOpeningFragment: [],
201
- JSXClosingFragment: [],
202
- JSXText: [],
203
- JSXExpressionContainer: ["expression"],
204
- JSXSpreadChild: ["expression"],
205
- JSXEmptyExpression: [],
206
- JSXSpreadAttribute: ["argument"],
207
- JSXIdentifier: [],
208
- PrivateIdentifier: [],
209
- JSXMemberExpression: ["object", "property"],
210
- ParenthesizedExpression: ["expression"],
211
- StaticBlock: ["body"],
212
- };
213
- function isBlockStatement(node) { return node.type === "BlockStatement"; }
214
- function isFunction(node) {
215
- return node.type === "FunctionDeclaration" || node.type === "FunctionExpression";
216
- }
217
- function isCatchClause(node) { return node.type === "CatchClause"; }
218
- function isPattern(node) {
219
- switch (node.type) {
220
- case "AssignmentPattern":
221
- case "ArrayPattern":
222
- case "ObjectPattern":
223
- return true;
224
- }
225
- return false;
226
- }
227
- function isScope(node, parentNode) {
228
- if (isBlockStatement(node) && (isFunction(parentNode) || isCatchClause(parentNode))) {
229
- return false;
230
- }
231
- if (isPattern(node) && (isFunction(parentNode) || isCatchClause(parentNode))) {
232
- return true;
233
- }
234
- return (0, exports.isFunctionDeclaration)(parentNode) || (0, exports.isFunctionExpression)(parentNode) || isScopable(node);
235
- }
236
- function isScopable(node) {
237
- switch (node.type) {
238
- case "BlockStatement":
239
- case "CatchClause":
240
- case "DoWhileStatement":
241
- case "ForInStatement":
242
- case "ForStatement":
243
- case "FunctionDeclaration":
244
- case "FunctionExpression":
245
- case "Program":
246
- case "MethodDefinition":
247
- case "SwitchStatement":
248
- case "WhileStatement":
249
- case "ArrowFunctionExpression":
250
- case "ClassExpression":
251
- case "ClassDeclaration":
252
- case "ForOfStatement":
253
- case "StaticBlock":
254
- return true;
255
- }
256
- return false;
257
- }
258
- function isExportSpecifier(node) {
259
- return node.type === "ExportSpecifier";
260
- }
@@ -1,296 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tokenize = tokenize;
4
- exports.parse = parse;
5
- const _1 = require(".");
6
- const nodeutils_1 = require("./nodeutils");
7
- const debugLogEnabled = false;
8
- const log = debugLogEnabled ? {
9
- debug: (...args) => {
10
- console.debug(...args);
11
- }
12
- } : undefined;
13
- const supportedIdentifiers = Object.fromEntries(Object.keys(nodeutils_1.VISITOR_KEYS).map(k => [k, k]));
14
- function isIdentifierToken(token) {
15
- if (token == undefined)
16
- return false;
17
- if (token.type != "identifier" && token.type != "wildcard")
18
- return false;
19
- if (!token.value)
20
- return false;
21
- if (!(token.value in supportedIdentifiers) && token.value != "*") {
22
- throw new Error("Unsupported identifier: " + token.value);
23
- }
24
- ;
25
- return true;
26
- }
27
- const whitespace = " \n\r\t";
28
- function isCharacter(c) {
29
- const charcode = c.charCodeAt(0);
30
- return (charcode >= 65 && charcode <= 90) || (charcode >= 97 && charcode <= 122);
31
- }
32
- function isInteger(c) {
33
- const charcode = c.charCodeAt(0);
34
- return (charcode >= 48 && charcode <= 57);
35
- }
36
- function tokenize(input) {
37
- let s = 0;
38
- const result = [];
39
- while (s < input.length) {
40
- while (whitespace.includes(input[s]))
41
- s++;
42
- if (s >= input.length)
43
- break;
44
- if (input[s] == "/") {
45
- if (input[s + 1] == "/") {
46
- result.push({ type: "descendant" });
47
- s += 2;
48
- continue;
49
- }
50
- result.push({ type: "child" });
51
- s++;
52
- continue;
53
- }
54
- if (input[s] == ":") {
55
- result.push({ type: "attributeSelector" });
56
- s++;
57
- continue;
58
- }
59
- if (input[s] == "$" && input[s + 1] == "$") {
60
- result.push({ type: "resolveSelector" });
61
- s += 2;
62
- continue;
63
- }
64
- if (input[s] == "$") {
65
- result.push({ type: "bindingSelector" });
66
- s++;
67
- continue;
68
- }
69
- if (input[s] == "[") {
70
- result.push({ type: "filterBegin" });
71
- s++;
72
- continue;
73
- }
74
- if (input[s] == "]") {
75
- result.push({ type: "filterEnd" });
76
- s++;
77
- continue;
78
- }
79
- if (input[s] == ",") {
80
- result.push({ type: "separator" });
81
- s++;
82
- continue;
83
- }
84
- if (input[s] == "(") {
85
- result.push({ type: "parametersBegin" });
86
- s++;
87
- continue;
88
- }
89
- if (input[s] == "f" && input[s + 1] == "n" && input[s + 2] == ":") {
90
- result.push({ type: "function" });
91
- s += 3;
92
- continue;
93
- }
94
- if (input[s] == ")") {
95
- result.push({ type: "parametersEnd" });
96
- s++;
97
- continue;
98
- }
99
- if (input[s] == "&" && input[s + 1] == "&") {
100
- result.push({ type: "and" });
101
- s += 2;
102
- continue;
103
- }
104
- if (input[s] == "|" && input[s + 1] == "|") {
105
- result.push({ type: "or" });
106
- s += 2;
107
- continue;
108
- }
109
- if (input[s] == "=" && input[s + 1] == "=") {
110
- result.push({ type: "eq" });
111
- s += 2;
112
- continue;
113
- }
114
- if (input[s] == "'" || input[s] == '"') {
115
- const begin = input[s];
116
- const start = s;
117
- s++;
118
- while (s < input.length && input[s] != begin)
119
- s++;
120
- result.push({ type: "literal", value: input.slice(start + 1, s) });
121
- s++;
122
- continue;
123
- }
124
- if (input[s] == "." && input[s + 1] == ".") {
125
- result.push({ type: "parent" });
126
- s += 2;
127
- continue;
128
- }
129
- if (input[s] == "*") {
130
- result.push({ type: "wildcard", value: "*" });
131
- s++;
132
- continue;
133
- }
134
- if (isCharacter(input[s])) {
135
- const start = s;
136
- while (s < input.length && isCharacter(input[s]))
137
- s++;
138
- result.push({ type: "identifier", value: input.slice(start, s) });
139
- continue;
140
- }
141
- if (isInteger(input[s])) {
142
- const start = s;
143
- while (s < input.length && isInteger(input[s]))
144
- s++;
145
- result.push({ type: "literal", value: input.slice(start, s) });
146
- continue;
147
- }
148
- throw new Error("Unexpected token: " + input[s]);
149
- }
150
- return result;
151
- }
152
- function buildFilter(tokens) {
153
- log?.debug("BUILD FILTER", tokens);
154
- tokens.shift();
155
- const p = buildTree(tokens);
156
- const next = tokens[0];
157
- if (next.type == "and") {
158
- return {
159
- type: "and",
160
- left: p,
161
- right: buildFilter(tokens)
162
- };
163
- }
164
- if (next.type == "or") {
165
- return {
166
- type: "or",
167
- left: p,
168
- right: buildFilter(tokens)
169
- };
170
- }
171
- if (next.type == "eq") {
172
- const right = buildFilter(tokens);
173
- if (right.type == "or" || right.type == "and") {
174
- return {
175
- type: right.type,
176
- left: {
177
- type: "equals",
178
- left: p,
179
- right: right.left
180
- },
181
- right: right.right
182
- };
183
- }
184
- if (right.type == "equals")
185
- throw new Error("Unexpected equals in equals");
186
- return {
187
- type: "equals",
188
- left: p,
189
- right: right
190
- };
191
- }
192
- if (next.type == "filterEnd") {
193
- tokens.shift();
194
- return p;
195
- }
196
- throw new Error("Unexpected token in filter: " + next?.type);
197
- }
198
- const subNodes = ["child", "descendant"];
199
- function buildTree(tokens) {
200
- log?.debug("BUILD TREE", tokens);
201
- if (tokens.length == 0)
202
- throw new Error("Unexpected end of input");
203
- const token = tokens.shift();
204
- if (token == undefined)
205
- throw new Error("Unexpected end of input");
206
- if (token.type == "parent") {
207
- return {
208
- type: "parent",
209
- child: buildTree(tokens)
210
- };
211
- }
212
- if (subNodes.includes(token.type)) {
213
- let next = tokens.shift();
214
- if (next?.type == "function") {
215
- const name = tokens.shift();
216
- if (name == undefined || name.type != "identifier" || name.value == undefined || typeof (name.value) != "string")
217
- throw new Error("Unexpected token: " + name?.type + ". Expecting function name");
218
- const value = name.value;
219
- if (!(0, _1.isAvailableFunction)(value)) {
220
- throw new Error("Unsupported function: " + name.value);
221
- }
222
- return buildFunctionCall(value, tokens);
223
- }
224
- if (next?.type == "parent") {
225
- return { type: "parent", child: buildTree(tokens) };
226
- }
227
- const modifiers = [];
228
- while (next && (next?.type == "attributeSelector" || next?.type == "bindingSelector" || next?.type == "resolveSelector")) {
229
- modifiers.push(next);
230
- next = tokens.shift();
231
- }
232
- const isAttribute = modifiers.some(m => m.type == "attributeSelector");
233
- const isBinding = modifiers.some(m => m.type == "bindingSelector");
234
- const isResolve = modifiers.some(m => m.type == "resolveSelector");
235
- if (isResolve && isBinding)
236
- throw new Error("Cannot have both resolve and binding");
237
- if (!next || !next.value || (!isAttribute && !isIdentifierToken(next)))
238
- throw new Error("Unexpected or missing token: " + next?.type);
239
- const identifer = next.value;
240
- let filter = undefined;
241
- if (tokens.length > 0 && tokens[0].type == "filterBegin") {
242
- filter = buildFilter(tokens);
243
- log?.debug("FILTER", filter, tokens);
244
- }
245
- let child = undefined;
246
- if (tokens.length > 0 && subNodes.includes(tokens[0].type)) {
247
- child = buildTree(tokens);
248
- }
249
- if (typeof (identifer) != "string")
250
- throw new Error("Identifier must be a string");
251
- return {
252
- type: token.type,
253
- value: identifer,
254
- attribute: isAttribute,
255
- binding: isBinding,
256
- resolve: isResolve,
257
- filter: filter,
258
- child: child
259
- };
260
- }
261
- if (token.type == "literal") {
262
- return {
263
- type: "literal",
264
- value: token.value
265
- };
266
- }
267
- throw new Error("Unexpected token: " + token.type);
268
- }
269
- function buildFunctionCall(name, tokens) {
270
- log?.debug("BUILD FUNCTION", name, tokens);
271
- const parameters = [];
272
- const next = tokens.shift();
273
- if (next?.type != "parametersBegin")
274
- throw new Error("Unexpected token: " + next?.type);
275
- while (tokens.length > 0 && tokens[0].type != "parametersEnd") {
276
- parameters.push(buildTree(tokens));
277
- if (tokens[0].type == "separator")
278
- tokens.shift();
279
- }
280
- if (tokens.length == 0)
281
- throw new Error("Unexpected end of input");
282
- tokens.shift();
283
- return {
284
- type: "function",
285
- function: name,
286
- parameters: parameters
287
- };
288
- }
289
- function parse(input) {
290
- const tokens = tokenize(input);
291
- const result = buildTree(tokens);
292
- log?.debug("RESULT", result);
293
- if (!result)
294
- throw new Error("No root element found");
295
- return result;
296
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"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"}
@@ -1,21 +0,0 @@
1
- import { ESTree } from "meriyah";
2
- import { ASTNode, NodePath } from ".";
3
- import { PrimitiveValue } from ".";
4
- export declare const isNode: (candidate: unknown) => candidate is ASTNode;
5
- export declare const isNodePath: (candidate: unknown) => candidate is NodePath;
6
- export declare const isLiteral: (candidate: unknown) => candidate is ESTree.Literal;
7
- export declare const isPrimitive: (value: unknown) => value is PrimitiveValue;
8
- export declare const isUpdateExpression: (value: unknown) => value is ESTree.UpdateExpression;
9
- export declare const isAssignmentExpression: (node: ESTree.Node) => node is ESTree.AssignmentExpression;
10
- export declare const isMemberExpression: (node: ESTree.Node) => node is ESTree.MemberExpression;
11
- export declare const isIdentifier: (node: ESTree.Node) => node is ESTree.Identifier;
12
- export declare const isFunctionDeclaration: (node: ESTree.Node) => node is ESTree.FunctionDeclaration;
13
- export declare const isFunctionExpression: (node: ESTree.Node) => node is ESTree.FunctionExpression;
14
- export declare const isVariableDeclarator: (node: ESTree.Node) => node is ESTree.VariableDeclarator;
15
- export declare const isVariableDeclaration: (node: ESTree.Node) => node is ESTree.VariableDeclaration;
16
- export declare const isBinding: (node: ESTree.Node, parentNode: ESTree.Node, grandParentNode: ESTree.Node | undefined) => boolean;
17
- export declare const VISITOR_KEYS: Record<ESTree.Node["type"], string[]>;
18
- export declare function isScope(node: ESTree.Node, parentNode: ESTree.Node): boolean;
19
- export declare function isScopable(node: ESTree.Node): boolean;
20
- export declare function isExportSpecifier(node: ESTree.Node): node is ESTree.ExportSpecifier;
21
- //# sourceMappingURL=nodeutils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodeutils.d.ts","sourceRoot":"","sources":["../../../src/nodeutils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC;AAEnC,eAAO,MAAM,MAAM,GAAI,WAAW,OAAO,KAAI,SAAS,IAAI,OAEzD,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,WAAW,OAAO,KAAI,SAAS,IAAI,QAE7D,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,WAAW,OAAO,KAAI,SAAS,IAAI,MAAM,CAAC,OAEnE,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAI,KAAK,IAAI,cAEtD,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAI,KAAK,IAAI,MAAM,CAAC,gBAEpE,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,MAAM,MAAM,CAAC,IAAI,KAAG,IAAI,IAAI,MAAM,CAAC,oBAEzE,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,CAAC,IAAI,KAAG,IAAI,IAAI,MAAM,CAAC,gBAErE,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,CAAC,IAAI,KAAG,IAAI,IAAI,MAAM,CAAC,UAE/D,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,CAAC,IAAI,KAAG,IAAI,IAAI,MAAM,CAAC,mBAExE,CAAA;AACD,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,CAAC,IAAI,KAAG,IAAI,IAAI,MAAM,CAAC,kBAEvE,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,CAAC,IAAI,KAAG,IAAI,IAAI,MAAM,CAAC,kBAEvE,CAAA;AACD,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,CAAC,IAAI,KAAG,IAAI,IAAI,MAAM,CAAC,mBAExE,CAAA;AACD,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,CAAC,IAAI,EAAE,YAAY,MAAM,CAAC,IAAI,EAAE,iBAAiB,MAAM,CAAC,IAAI,GAAG,SAAS,KAAG,OAwBhH,CAAA;AAuDD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CA2F9D,CAAC;AAqBF,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,IAAI,GAAG,OAAO,CAS3E;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG,OAAO,CAqBrD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG,IAAI,IAAI,MAAM,CAAC,eAAe,CAEnF"}
@@ -1,42 +0,0 @@
1
- import { AvailableFunction } from ".";
2
- type Token = {
3
- type: string;
4
- value?: string;
5
- };
6
- export declare function tokenize(input: string): Token[];
7
- type BaseNode = {
8
- type: string;
9
- attribute?: boolean;
10
- binding?: boolean;
11
- resolve?: boolean;
12
- filter?: QNode;
13
- value?: string;
14
- child?: QNode;
15
- };
16
- export type Selector = BaseNode & ({
17
- type: "child" | "descendant";
18
- attribute: boolean;
19
- binding: boolean;
20
- value: string;
21
- resolve: boolean;
22
- } | {
23
- type: "parent";
24
- });
25
- export type Condition = BaseNode & {
26
- type: "and" | "or" | "equals";
27
- left: QNode;
28
- right: QNode;
29
- };
30
- export type Literal = BaseNode & {
31
- type: "literal";
32
- value: string;
33
- };
34
- export type FunctionCall = BaseNode & {
35
- type: "function";
36
- function: AvailableFunction;
37
- parameters: QNode[];
38
- };
39
- export type QNode = Selector | Condition | Literal | FunctionCall;
40
- export declare function parse(input: string): QNode;
41
- export {};
42
- //# sourceMappingURL=parseQuery.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseQuery.d.ts","sourceRoot":"","sources":["../../../src/parseQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAuB,MAAM,GAAG,CAAC;AAa3D,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA;AA2BD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAI,KAAK,EAAE,CA8GhD;AACD,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,CAAC;IACjC,IAAI,EAAE,OAAO,GAAG,YAAY,CAAC;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG;IACF,IAAI,EAAE,QAAQ,CAAA;CACf,CAAC,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG;IACjC,IAAI,EAAE,KAAK,GAAG,IAAI,GAAG,QAAQ,CAAC;IAC9B,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;CACd,CAAA;AACD,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG;IACpC,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,UAAU,EAAE,KAAK,EAAE,CAAC;CACrB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,YAAY,CAAE;AAyInE,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAM1C"}
@@ -1,3 +0,0 @@
1
- export declare function toArray<T>(value: T | T[]): T[];
2
- export declare function isDefined<T>(value: T | undefined | null): value is T;
3
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,GAAI,CAAC,EAAE,CAE/C;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,IAAI,GAAI,KAAK,IAAI,CAAC,CAErE"}
package/lib/esm/utils.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toArray = toArray;
4
- exports.isDefined = isDefined;
5
- function toArray(value) {
6
- return Array.isArray(value) ? value : [value];
7
- }
8
- function isDefined(value) {
9
- return value != undefined && value != null;
10
- }