@tachybase/module-cloud-component 0.23.20 → 0.23.35

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 (48) hide show
  1. package/dist/client/index.js +1 -1
  2. package/dist/externalVersion.js +7 -7
  3. package/dist/node_modules/@babel/core/lib/index.js +76 -76
  4. package/dist/node_modules/@babel/core/node_modules/.bin/parser +4 -4
  5. package/dist/node_modules/@babel/core/package.json +1 -1
  6. package/dist/node_modules/@babel/parser/LICENSE +19 -0
  7. package/dist/node_modules/@babel/parser/bin/babel-parser.js +15 -0
  8. package/dist/node_modules/@babel/parser/index.cjs +5 -0
  9. package/dist/node_modules/@babel/parser/lib/index.js +1 -0
  10. package/dist/node_modules/@babel/parser/package.json +1 -0
  11. package/dist/node_modules/@babel/parser/typings/babel-parser.d.ts +267 -0
  12. package/dist/node_modules/@babel/traverse/LICENSE +22 -0
  13. package/dist/node_modules/@babel/traverse/lib/cache.js +44 -0
  14. package/dist/node_modules/@babel/traverse/lib/context.js +119 -0
  15. package/dist/node_modules/@babel/traverse/lib/hub.js +19 -0
  16. package/dist/node_modules/@babel/traverse/lib/index.js +13 -0
  17. package/dist/node_modules/@babel/traverse/lib/path/ancestry.js +141 -0
  18. package/dist/node_modules/@babel/traverse/lib/path/comments.js +52 -0
  19. package/dist/node_modules/@babel/traverse/lib/path/context.js +242 -0
  20. package/dist/node_modules/@babel/traverse/lib/path/conversion.js +609 -0
  21. package/dist/node_modules/@babel/traverse/lib/path/evaluation.js +347 -0
  22. package/dist/node_modules/@babel/traverse/lib/path/family.js +340 -0
  23. package/dist/node_modules/@babel/traverse/lib/path/index.js +292 -0
  24. package/dist/node_modules/@babel/traverse/lib/path/inference/index.js +149 -0
  25. package/dist/node_modules/@babel/traverse/lib/path/inference/inferer-reference.js +151 -0
  26. package/dist/node_modules/@babel/traverse/lib/path/inference/inferers.js +207 -0
  27. package/dist/node_modules/@babel/traverse/lib/path/inference/util.js +30 -0
  28. package/dist/node_modules/@babel/traverse/lib/path/introspection.js +398 -0
  29. package/dist/node_modules/@babel/traverse/lib/path/lib/hoister.js +171 -0
  30. package/dist/node_modules/@babel/traverse/lib/path/lib/removal-hooks.js +37 -0
  31. package/dist/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js +163 -0
  32. package/dist/node_modules/@babel/traverse/lib/path/lib/virtual-types.js +26 -0
  33. package/dist/node_modules/@babel/traverse/lib/path/modification.js +229 -0
  34. package/dist/node_modules/@babel/traverse/lib/path/removal.js +69 -0
  35. package/dist/node_modules/@babel/traverse/lib/path/replacement.js +263 -0
  36. package/dist/node_modules/@babel/traverse/lib/scope/binding.js +83 -0
  37. package/dist/node_modules/@babel/traverse/lib/scope/index.js +981 -0
  38. package/dist/node_modules/@babel/traverse/lib/scope/lib/renamer.js +131 -0
  39. package/dist/node_modules/@babel/traverse/lib/traverse-node.js +29 -0
  40. package/dist/node_modules/@babel/traverse/lib/types.js +3 -0
  41. package/dist/node_modules/@babel/traverse/lib/visitors.js +258 -0
  42. package/dist/node_modules/@babel/traverse/node_modules/.bin/parser +17 -0
  43. package/dist/node_modules/@babel/traverse/package.json +1 -0
  44. package/dist/node_modules/@hapi/topo/lib/index.d.ts +60 -0
  45. package/dist/node_modules/@hapi/topo/lib/index.js +1 -0
  46. package/dist/node_modules/@hapi/topo/package.json +1 -0
  47. package/dist/server/services/cloud-libraries-service.js +36 -1
  48. package/package.json +13 -9
@@ -0,0 +1,347 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.evaluate = evaluate;
7
+ exports.evaluateTruthy = evaluateTruthy;
8
+ const VALID_OBJECT_CALLEES = ["Number", "String", "Math"];
9
+ const VALID_IDENTIFIER_CALLEES = ["isFinite", "isNaN", "parseFloat", "parseInt", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", null, null];
10
+ const INVALID_METHODS = ["random"];
11
+ function isValidObjectCallee(val) {
12
+ return VALID_OBJECT_CALLEES.includes(val);
13
+ }
14
+ function isValidIdentifierCallee(val) {
15
+ return VALID_IDENTIFIER_CALLEES.includes(val);
16
+ }
17
+ function isInvalidMethod(val) {
18
+ return INVALID_METHODS.includes(val);
19
+ }
20
+ function evaluateTruthy() {
21
+ const res = this.evaluate();
22
+ if (res.confident) return !!res.value;
23
+ }
24
+ function deopt(path, state) {
25
+ if (!state.confident) return;
26
+ state.deoptPath = path;
27
+ state.confident = false;
28
+ }
29
+ const Globals = new Map([["undefined", undefined], ["Infinity", Infinity], ["NaN", NaN]]);
30
+ function evaluateCached(path, state) {
31
+ const {
32
+ node
33
+ } = path;
34
+ const {
35
+ seen
36
+ } = state;
37
+ if (seen.has(node)) {
38
+ const existing = seen.get(node);
39
+ if (existing.resolved) {
40
+ return existing.value;
41
+ } else {
42
+ deopt(path, state);
43
+ return;
44
+ }
45
+ } else {
46
+ const item = {
47
+ resolved: false
48
+ };
49
+ seen.set(node, item);
50
+ const val = _evaluate(path, state);
51
+ if (state.confident) {
52
+ item.resolved = true;
53
+ item.value = val;
54
+ }
55
+ return val;
56
+ }
57
+ }
58
+ function _evaluate(path, state) {
59
+ if (!state.confident) return;
60
+ if (path.isSequenceExpression()) {
61
+ const exprs = path.get("expressions");
62
+ return evaluateCached(exprs[exprs.length - 1], state);
63
+ }
64
+ if (path.isStringLiteral() || path.isNumericLiteral() || path.isBooleanLiteral()) {
65
+ return path.node.value;
66
+ }
67
+ if (path.isNullLiteral()) {
68
+ return null;
69
+ }
70
+ if (path.isTemplateLiteral()) {
71
+ return evaluateQuasis(path, path.node.quasis, state);
72
+ }
73
+ if (path.isTaggedTemplateExpression() && path.get("tag").isMemberExpression()) {
74
+ const object = path.get("tag.object");
75
+ const {
76
+ node: {
77
+ name
78
+ }
79
+ } = object;
80
+ const property = path.get("tag.property");
81
+ if (object.isIdentifier() && name === "String" && !path.scope.getBinding(name) && property.isIdentifier() && property.node.name === "raw") {
82
+ return evaluateQuasis(path, path.node.quasi.quasis, state, true);
83
+ }
84
+ }
85
+ if (path.isConditionalExpression()) {
86
+ const testResult = evaluateCached(path.get("test"), state);
87
+ if (!state.confident) return;
88
+ if (testResult) {
89
+ return evaluateCached(path.get("consequent"), state);
90
+ } else {
91
+ return evaluateCached(path.get("alternate"), state);
92
+ }
93
+ }
94
+ if (path.isExpressionWrapper()) {
95
+ return evaluateCached(path.get("expression"), state);
96
+ }
97
+ if (path.isMemberExpression() && !path.parentPath.isCallExpression({
98
+ callee: path.node
99
+ })) {
100
+ const property = path.get("property");
101
+ const object = path.get("object");
102
+ if (object.isLiteral()) {
103
+ const value = object.node.value;
104
+ const type = typeof value;
105
+ let key = null;
106
+ if (path.node.computed) {
107
+ key = evaluateCached(property, state);
108
+ if (!state.confident) return;
109
+ } else if (property.isIdentifier()) {
110
+ key = property.node.name;
111
+ }
112
+ if ((type === "number" || type === "string") && key != null && (typeof key === "number" || typeof key === "string")) {
113
+ return value[key];
114
+ }
115
+ }
116
+ }
117
+ if (path.isReferencedIdentifier()) {
118
+ const binding = path.scope.getBinding(path.node.name);
119
+ if (binding) {
120
+ if (binding.constantViolations.length > 0 || path.node.start < binding.path.node.end) {
121
+ deopt(binding.path, state);
122
+ return;
123
+ }
124
+ if (binding.hasValue) {
125
+ return binding.value;
126
+ }
127
+ }
128
+ const name = path.node.name;
129
+ if (Globals.has(name)) {
130
+ if (!binding) {
131
+ return Globals.get(name);
132
+ }
133
+ deopt(binding.path, state);
134
+ return;
135
+ }
136
+ const resolved = path.resolve();
137
+ if (resolved === path) {
138
+ deopt(path, state);
139
+ return;
140
+ } else {
141
+ return evaluateCached(resolved, state);
142
+ }
143
+ }
144
+ if (path.isUnaryExpression({
145
+ prefix: true
146
+ })) {
147
+ if (path.node.operator === "void") {
148
+ return undefined;
149
+ }
150
+ const argument = path.get("argument");
151
+ if (path.node.operator === "typeof" && (argument.isFunction() || argument.isClass())) {
152
+ return "function";
153
+ }
154
+ const arg = evaluateCached(argument, state);
155
+ if (!state.confident) return;
156
+ switch (path.node.operator) {
157
+ case "!":
158
+ return !arg;
159
+ case "+":
160
+ return +arg;
161
+ case "-":
162
+ return -arg;
163
+ case "~":
164
+ return ~arg;
165
+ case "typeof":
166
+ return typeof arg;
167
+ }
168
+ }
169
+ if (path.isArrayExpression()) {
170
+ const arr = [];
171
+ const elems = path.get("elements");
172
+ for (const elem of elems) {
173
+ const elemValue = elem.evaluate();
174
+ if (elemValue.confident) {
175
+ arr.push(elemValue.value);
176
+ } else {
177
+ deopt(elemValue.deopt, state);
178
+ return;
179
+ }
180
+ }
181
+ return arr;
182
+ }
183
+ if (path.isObjectExpression()) {
184
+ const obj = {};
185
+ const props = path.get("properties");
186
+ for (const prop of props) {
187
+ if (prop.isObjectMethod() || prop.isSpreadElement()) {
188
+ deopt(prop, state);
189
+ return;
190
+ }
191
+ const keyPath = prop.get("key");
192
+ let key;
193
+ if (prop.node.computed) {
194
+ key = keyPath.evaluate();
195
+ if (!key.confident) {
196
+ deopt(key.deopt, state);
197
+ return;
198
+ }
199
+ key = key.value;
200
+ } else if (keyPath.isIdentifier()) {
201
+ key = keyPath.node.name;
202
+ } else {
203
+ key = keyPath.node.value;
204
+ }
205
+ const valuePath = prop.get("value");
206
+ let value = valuePath.evaluate();
207
+ if (!value.confident) {
208
+ deopt(value.deopt, state);
209
+ return;
210
+ }
211
+ value = value.value;
212
+ obj[key] = value;
213
+ }
214
+ return obj;
215
+ }
216
+ if (path.isLogicalExpression()) {
217
+ const wasConfident = state.confident;
218
+ const left = evaluateCached(path.get("left"), state);
219
+ const leftConfident = state.confident;
220
+ state.confident = wasConfident;
221
+ const right = evaluateCached(path.get("right"), state);
222
+ const rightConfident = state.confident;
223
+ switch (path.node.operator) {
224
+ case "||":
225
+ state.confident = leftConfident && (!!left || rightConfident);
226
+ if (!state.confident) return;
227
+ return left || right;
228
+ case "&&":
229
+ state.confident = leftConfident && (!left || rightConfident);
230
+ if (!state.confident) return;
231
+ return left && right;
232
+ case "??":
233
+ state.confident = leftConfident && (left != null || rightConfident);
234
+ if (!state.confident) return;
235
+ return left != null ? left : right;
236
+ }
237
+ }
238
+ if (path.isBinaryExpression()) {
239
+ const left = evaluateCached(path.get("left"), state);
240
+ if (!state.confident) return;
241
+ const right = evaluateCached(path.get("right"), state);
242
+ if (!state.confident) return;
243
+ switch (path.node.operator) {
244
+ case "-":
245
+ return left - right;
246
+ case "+":
247
+ return left + right;
248
+ case "/":
249
+ return left / right;
250
+ case "*":
251
+ return left * right;
252
+ case "%":
253
+ return left % right;
254
+ case "**":
255
+ return Math.pow(left, right);
256
+ case "<":
257
+ return left < right;
258
+ case ">":
259
+ return left > right;
260
+ case "<=":
261
+ return left <= right;
262
+ case ">=":
263
+ return left >= right;
264
+ case "==":
265
+ return left == right;
266
+ case "!=":
267
+ return left != right;
268
+ case "===":
269
+ return left === right;
270
+ case "!==":
271
+ return left !== right;
272
+ case "|":
273
+ return left | right;
274
+ case "&":
275
+ return left & right;
276
+ case "^":
277
+ return left ^ right;
278
+ case "<<":
279
+ return left << right;
280
+ case ">>":
281
+ return left >> right;
282
+ case ">>>":
283
+ return left >>> right;
284
+ }
285
+ }
286
+ if (path.isCallExpression()) {
287
+ const callee = path.get("callee");
288
+ let context;
289
+ let func;
290
+ if (callee.isIdentifier() && !path.scope.getBinding(callee.node.name) && (isValidObjectCallee(callee.node.name) || isValidIdentifierCallee(callee.node.name))) {
291
+ func = global[callee.node.name];
292
+ }
293
+ if (callee.isMemberExpression()) {
294
+ const object = callee.get("object");
295
+ const property = callee.get("property");
296
+ if (object.isIdentifier() && property.isIdentifier() && isValidObjectCallee(object.node.name) && !isInvalidMethod(property.node.name)) {
297
+ context = global[object.node.name];
298
+ const key = property.node.name;
299
+ if (hasOwnProperty.call(context, key)) {
300
+ func = context[key];
301
+ }
302
+ }
303
+ if (object.isLiteral() && property.isIdentifier()) {
304
+ const type = typeof object.node.value;
305
+ if (type === "string" || type === "number") {
306
+ context = object.node.value;
307
+ func = context[property.node.name];
308
+ }
309
+ }
310
+ }
311
+ if (func) {
312
+ const args = path.get("arguments").map(arg => evaluateCached(arg, state));
313
+ if (!state.confident) return;
314
+ return func.apply(context, args);
315
+ }
316
+ }
317
+ deopt(path, state);
318
+ }
319
+ function evaluateQuasis(path, quasis, state, raw = false) {
320
+ let str = "";
321
+ let i = 0;
322
+ const exprs = path.isTemplateLiteral() ? path.get("expressions") : path.get("quasi.expressions");
323
+ for (const elem of quasis) {
324
+ if (!state.confident) break;
325
+ str += raw ? elem.value.raw : elem.value.cooked;
326
+ const expr = exprs[i++];
327
+ if (expr) str += String(evaluateCached(expr, state));
328
+ }
329
+ if (!state.confident) return;
330
+ return str;
331
+ }
332
+ function evaluate() {
333
+ const state = {
334
+ confident: true,
335
+ deoptPath: null,
336
+ seen: new Map()
337
+ };
338
+ let value = evaluateCached(this, state);
339
+ if (!state.confident) value = undefined;
340
+ return {
341
+ confident: state.confident,
342
+ deopt: state.deoptPath,
343
+ value: value
344
+ };
345
+ }
346
+
347
+ //# sourceMappingURL=evaluation.js.map
@@ -0,0 +1,340 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports._getKey = _getKey;
7
+ exports._getPattern = _getPattern;
8
+ exports.get = get;
9
+ exports.getAllNextSiblings = getAllNextSiblings;
10
+ exports.getAllPrevSiblings = getAllPrevSiblings;
11
+ exports.getAssignmentIdentifiers = getAssignmentIdentifiers;
12
+ exports.getBindingIdentifierPaths = getBindingIdentifierPaths;
13
+ exports.getBindingIdentifiers = getBindingIdentifiers;
14
+ exports.getCompletionRecords = getCompletionRecords;
15
+ exports.getNextSibling = getNextSibling;
16
+ exports.getOpposite = getOpposite;
17
+ exports.getOuterBindingIdentifierPaths = getOuterBindingIdentifierPaths;
18
+ exports.getOuterBindingIdentifiers = getOuterBindingIdentifiers;
19
+ exports.getPrevSibling = getPrevSibling;
20
+ exports.getSibling = getSibling;
21
+ var _index = require("./index.js");
22
+ var _t = require("@babel/types");
23
+ const {
24
+ getAssignmentIdentifiers: _getAssignmentIdentifiers,
25
+ getBindingIdentifiers: _getBindingIdentifiers,
26
+ getOuterBindingIdentifiers: _getOuterBindingIdentifiers,
27
+ numericLiteral,
28
+ unaryExpression
29
+ } = _t;
30
+ const NORMAL_COMPLETION = 0;
31
+ const BREAK_COMPLETION = 1;
32
+ function NormalCompletion(path) {
33
+ return {
34
+ type: NORMAL_COMPLETION,
35
+ path
36
+ };
37
+ }
38
+ function BreakCompletion(path) {
39
+ return {
40
+ type: BREAK_COMPLETION,
41
+ path
42
+ };
43
+ }
44
+ function getOpposite() {
45
+ if (this.key === "left") {
46
+ return this.getSibling("right");
47
+ } else if (this.key === "right") {
48
+ return this.getSibling("left");
49
+ }
50
+ return null;
51
+ }
52
+ function addCompletionRecords(path, records, context) {
53
+ if (path) {
54
+ records.push(..._getCompletionRecords(path, context));
55
+ }
56
+ return records;
57
+ }
58
+ function completionRecordForSwitch(cases, records, context) {
59
+ let lastNormalCompletions = [];
60
+ for (let i = 0; i < cases.length; i++) {
61
+ const casePath = cases[i];
62
+ const caseCompletions = _getCompletionRecords(casePath, context);
63
+ const normalCompletions = [];
64
+ const breakCompletions = [];
65
+ for (const c of caseCompletions) {
66
+ if (c.type === NORMAL_COMPLETION) {
67
+ normalCompletions.push(c);
68
+ }
69
+ if (c.type === BREAK_COMPLETION) {
70
+ breakCompletions.push(c);
71
+ }
72
+ }
73
+ if (normalCompletions.length) {
74
+ lastNormalCompletions = normalCompletions;
75
+ }
76
+ records.push(...breakCompletions);
77
+ }
78
+ records.push(...lastNormalCompletions);
79
+ return records;
80
+ }
81
+ function normalCompletionToBreak(completions) {
82
+ completions.forEach(c => {
83
+ c.type = BREAK_COMPLETION;
84
+ });
85
+ }
86
+ function replaceBreakStatementInBreakCompletion(completions, reachable) {
87
+ completions.forEach(c => {
88
+ if (c.path.isBreakStatement({
89
+ label: null
90
+ })) {
91
+ if (reachable) {
92
+ c.path.replaceWith(unaryExpression("void", numericLiteral(0)));
93
+ } else {
94
+ c.path.remove();
95
+ }
96
+ }
97
+ });
98
+ }
99
+ function getStatementListCompletion(paths, context) {
100
+ const completions = [];
101
+ if (context.canHaveBreak) {
102
+ let lastNormalCompletions = [];
103
+ for (let i = 0; i < paths.length; i++) {
104
+ const path = paths[i];
105
+ const newContext = Object.assign({}, context, {
106
+ inCaseClause: false
107
+ });
108
+ if (path.isBlockStatement() && (context.inCaseClause || context.shouldPopulateBreak)) {
109
+ newContext.shouldPopulateBreak = true;
110
+ } else {
111
+ newContext.shouldPopulateBreak = false;
112
+ }
113
+ const statementCompletions = _getCompletionRecords(path, newContext);
114
+ if (statementCompletions.length > 0 && statementCompletions.every(c => c.type === BREAK_COMPLETION)) {
115
+ if (lastNormalCompletions.length > 0 && statementCompletions.every(c => c.path.isBreakStatement({
116
+ label: null
117
+ }))) {
118
+ normalCompletionToBreak(lastNormalCompletions);
119
+ completions.push(...lastNormalCompletions);
120
+ if (lastNormalCompletions.some(c => c.path.isDeclaration())) {
121
+ completions.push(...statementCompletions);
122
+ replaceBreakStatementInBreakCompletion(statementCompletions, true);
123
+ }
124
+ replaceBreakStatementInBreakCompletion(statementCompletions, false);
125
+ } else {
126
+ completions.push(...statementCompletions);
127
+ if (!context.shouldPopulateBreak) {
128
+ replaceBreakStatementInBreakCompletion(statementCompletions, true);
129
+ }
130
+ }
131
+ break;
132
+ }
133
+ if (i === paths.length - 1) {
134
+ completions.push(...statementCompletions);
135
+ } else {
136
+ lastNormalCompletions = [];
137
+ for (let i = 0; i < statementCompletions.length; i++) {
138
+ const c = statementCompletions[i];
139
+ if (c.type === BREAK_COMPLETION) {
140
+ completions.push(c);
141
+ }
142
+ if (c.type === NORMAL_COMPLETION) {
143
+ lastNormalCompletions.push(c);
144
+ }
145
+ }
146
+ }
147
+ }
148
+ } else if (paths.length) {
149
+ for (let i = paths.length - 1; i >= 0; i--) {
150
+ const pathCompletions = _getCompletionRecords(paths[i], context);
151
+ if (pathCompletions.length > 1 || pathCompletions.length === 1 && !pathCompletions[0].path.isVariableDeclaration()) {
152
+ completions.push(...pathCompletions);
153
+ break;
154
+ }
155
+ }
156
+ }
157
+ return completions;
158
+ }
159
+ function _getCompletionRecords(path, context) {
160
+ let records = [];
161
+ if (path.isIfStatement()) {
162
+ records = addCompletionRecords(path.get("consequent"), records, context);
163
+ records = addCompletionRecords(path.get("alternate"), records, context);
164
+ } else if (path.isDoExpression() || path.isFor() || path.isWhile() || path.isLabeledStatement()) {
165
+ return addCompletionRecords(path.get("body"), records, context);
166
+ } else if (path.isProgram() || path.isBlockStatement()) {
167
+ return getStatementListCompletion(path.get("body"), context);
168
+ } else if (path.isFunction()) {
169
+ return _getCompletionRecords(path.get("body"), context);
170
+ } else if (path.isTryStatement()) {
171
+ records = addCompletionRecords(path.get("block"), records, context);
172
+ records = addCompletionRecords(path.get("handler"), records, context);
173
+ } else if (path.isCatchClause()) {
174
+ return addCompletionRecords(path.get("body"), records, context);
175
+ } else if (path.isSwitchStatement()) {
176
+ return completionRecordForSwitch(path.get("cases"), records, context);
177
+ } else if (path.isSwitchCase()) {
178
+ return getStatementListCompletion(path.get("consequent"), {
179
+ canHaveBreak: true,
180
+ shouldPopulateBreak: false,
181
+ inCaseClause: true
182
+ });
183
+ } else if (path.isBreakStatement()) {
184
+ records.push(BreakCompletion(path));
185
+ } else {
186
+ records.push(NormalCompletion(path));
187
+ }
188
+ return records;
189
+ }
190
+ function getCompletionRecords() {
191
+ const records = _getCompletionRecords(this, {
192
+ canHaveBreak: false,
193
+ shouldPopulateBreak: false,
194
+ inCaseClause: false
195
+ });
196
+ return records.map(r => r.path);
197
+ }
198
+ function getSibling(key) {
199
+ return _index.default.get({
200
+ parentPath: this.parentPath,
201
+ parent: this.parent,
202
+ container: this.container,
203
+ listKey: this.listKey,
204
+ key: key
205
+ }).setContext(this.context);
206
+ }
207
+ function getPrevSibling() {
208
+ return this.getSibling(this.key - 1);
209
+ }
210
+ function getNextSibling() {
211
+ return this.getSibling(this.key + 1);
212
+ }
213
+ function getAllNextSiblings() {
214
+ let _key = this.key;
215
+ let sibling = this.getSibling(++_key);
216
+ const siblings = [];
217
+ while (sibling.node) {
218
+ siblings.push(sibling);
219
+ sibling = this.getSibling(++_key);
220
+ }
221
+ return siblings;
222
+ }
223
+ function getAllPrevSiblings() {
224
+ let _key = this.key;
225
+ let sibling = this.getSibling(--_key);
226
+ const siblings = [];
227
+ while (sibling.node) {
228
+ siblings.push(sibling);
229
+ sibling = this.getSibling(--_key);
230
+ }
231
+ return siblings;
232
+ }
233
+ function get(key, context = true) {
234
+ if (context === true) context = this.context;
235
+ const parts = key.split(".");
236
+ if (parts.length === 1) {
237
+ return _getKey.call(this, key, context);
238
+ } else {
239
+ return _getPattern.call(this, parts, context);
240
+ }
241
+ }
242
+ function _getKey(key, context) {
243
+ const node = this.node;
244
+ const container = node[key];
245
+ if (Array.isArray(container)) {
246
+ return container.map((_, i) => {
247
+ return _index.default.get({
248
+ listKey: key,
249
+ parentPath: this,
250
+ parent: node,
251
+ container: container,
252
+ key: i
253
+ }).setContext(context);
254
+ });
255
+ } else {
256
+ return _index.default.get({
257
+ parentPath: this,
258
+ parent: node,
259
+ container: node,
260
+ key: key
261
+ }).setContext(context);
262
+ }
263
+ }
264
+ function _getPattern(parts, context) {
265
+ let path = this;
266
+ for (const part of parts) {
267
+ if (part === ".") {
268
+ path = path.parentPath;
269
+ } else {
270
+ if (Array.isArray(path)) {
271
+ path = path[part];
272
+ } else {
273
+ path = path.get(part, context);
274
+ }
275
+ }
276
+ }
277
+ return path;
278
+ }
279
+ function getAssignmentIdentifiers() {
280
+ return _getAssignmentIdentifiers(this.node);
281
+ }
282
+ function getBindingIdentifiers(duplicates) {
283
+ return _getBindingIdentifiers(this.node, duplicates);
284
+ }
285
+ function getOuterBindingIdentifiers(duplicates) {
286
+ return _getOuterBindingIdentifiers(this.node, duplicates);
287
+ }
288
+ function getBindingIdentifierPaths(duplicates = false, outerOnly = false) {
289
+ const path = this;
290
+ const search = [path];
291
+ const ids = Object.create(null);
292
+ while (search.length) {
293
+ const id = search.shift();
294
+ if (!id) continue;
295
+ if (!id.node) continue;
296
+ const keys = _getBindingIdentifiers.keys[id.node.type];
297
+ if (id.isIdentifier()) {
298
+ if (duplicates) {
299
+ const _ids = ids[id.node.name] = ids[id.node.name] || [];
300
+ _ids.push(id);
301
+ } else {
302
+ ids[id.node.name] = id;
303
+ }
304
+ continue;
305
+ }
306
+ if (id.isExportDeclaration()) {
307
+ const declaration = id.get("declaration");
308
+ if (declaration.isDeclaration()) {
309
+ search.push(declaration);
310
+ }
311
+ continue;
312
+ }
313
+ if (outerOnly) {
314
+ if (id.isFunctionDeclaration()) {
315
+ search.push(id.get("id"));
316
+ continue;
317
+ }
318
+ if (id.isFunctionExpression()) {
319
+ continue;
320
+ }
321
+ }
322
+ if (keys) {
323
+ for (let i = 0; i < keys.length; i++) {
324
+ const key = keys[i];
325
+ const child = id.get(key);
326
+ if (Array.isArray(child)) {
327
+ search.push(...child);
328
+ } else if (child.node) {
329
+ search.push(child);
330
+ }
331
+ }
332
+ }
333
+ }
334
+ return ids;
335
+ }
336
+ function getOuterBindingIdentifierPaths(duplicates = false) {
337
+ return this.getBindingIdentifierPaths(duplicates, true);
338
+ }
339
+
340
+ //# sourceMappingURL=family.js.map