@arcgis/arcade-languageservice 5.0.0-next.9 → 5.0.0-next.90
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/index.d.ts +89 -14
- package/dist/index.js +1396 -1355
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ declare interface AssignmentExpression extends NodeBase<typeof NodeTypes.Assignm
|
|
|
68
68
|
/**
|
|
69
69
|
* Arcade assignment operators.
|
|
70
70
|
*/
|
|
71
|
-
declare const AssignmentOperators: readonly
|
|
71
|
+
declare const AssignmentOperators: readonly ["=", "/=", "*=", "%=", "+=", "-="];
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* Arcade assignment operators.
|
|
@@ -103,7 +103,7 @@ declare interface BinaryExpression extends NodeBase<typeof NodeTypes.BinaryExpre
|
|
|
103
103
|
/**
|
|
104
104
|
* Arcade binary operators.
|
|
105
105
|
*/
|
|
106
|
-
declare const BinaryOperators: readonly
|
|
106
|
+
declare const BinaryOperators: readonly ["|", "&", ">>", "<<", ">>>", "^", "==", "!=", "<", "<=", ">", ">=", "+", "-", "*", "/", "%"];
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* Arcade binary operators.
|
|
@@ -152,7 +152,7 @@ declare interface CallExpression extends NodeBase<typeof NodeTypes.CallExpressio
|
|
|
152
152
|
* Example: foo(1, 2, 3)
|
|
153
153
|
* The callee is foo.
|
|
154
154
|
*/
|
|
155
|
-
callee: Identifier | MemberExpression;
|
|
155
|
+
callee: Identifier | MemberExpression | SafeMemberExpression;
|
|
156
156
|
/**
|
|
157
157
|
* The arguments of the call expression.
|
|
158
158
|
* Example: foo(1, 2, 3)
|
|
@@ -237,7 +237,7 @@ export declare interface Diagnostic {
|
|
|
237
237
|
* A data entry field that is preserved between a `textDocument/publishDiagnostics`
|
|
238
238
|
* notification and `textDocument/codeAction` request.
|
|
239
239
|
*/
|
|
240
|
-
data?:
|
|
240
|
+
data?: DiagnosticData | null;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
/**
|
|
@@ -252,7 +252,7 @@ declare class Diagnostic_2 extends Error implements DiagnosticApi {
|
|
|
252
252
|
len: number;
|
|
253
253
|
range: SourceLocation;
|
|
254
254
|
description?: string;
|
|
255
|
-
data?:
|
|
255
|
+
data?: DiagnosticData_2 | null;
|
|
256
256
|
constructor({ code, index, line, column, len, description, data }: DiagnosticApi);
|
|
257
257
|
}
|
|
258
258
|
|
|
@@ -275,7 +275,7 @@ declare interface DiagnosticApi extends Marker {
|
|
|
275
275
|
/**
|
|
276
276
|
* The associated diagnostic data.
|
|
277
277
|
*/
|
|
278
|
-
data?:
|
|
278
|
+
data?: DiagnosticData_2 | null;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
/**
|
|
@@ -327,13 +327,12 @@ declare type DiagnosticCodes_2 = (typeof DiagnosticCodes_2)[keyof typeof Diagnos
|
|
|
327
327
|
* For example in case of an error associated to an identifier,
|
|
328
328
|
* the DiagnosticData will contain a key 'identifier' and its value.
|
|
329
329
|
*/
|
|
330
|
-
declare type
|
|
331
|
-
export { DiagnosticData_2 as DiagnosticData }
|
|
330
|
+
export declare type DiagnosticData = Record<string, number | string>;
|
|
332
331
|
|
|
333
332
|
/**
|
|
334
333
|
* Arcade diagnostic data.
|
|
335
334
|
*/
|
|
336
|
-
declare type
|
|
335
|
+
declare type DiagnosticData_2 = Record<string, number | string>;
|
|
337
336
|
|
|
338
337
|
export declare const DiagnosticMessages: {
|
|
339
338
|
readonly InvalidModuleUri: string;
|
|
@@ -449,7 +448,7 @@ declare interface ExportSpecifier extends NodeBase<typeof NodeTypes.ExportSpecif
|
|
|
449
448
|
/**
|
|
450
449
|
* Define the types of Arcade Expression.
|
|
451
450
|
*/
|
|
452
|
-
declare type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression | Identifier | Literal | LogicalExpression | MemberExpression | ObjectExpression | TemplateLiteral | UnaryExpression | UpdateExpression;
|
|
451
|
+
declare type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression | Identifier | Literal | LogicalExpression | MemberAccessChainExpression | MemberExpression | ObjectExpression | SafeMemberExpression | TemplateLiteral | UnaryExpression | UpdateExpression;
|
|
453
452
|
|
|
454
453
|
/**
|
|
455
454
|
* Define an Arcade expression statement.
|
|
@@ -766,6 +765,11 @@ declare function isLiteral(item: unknown): item is Literal;
|
|
|
766
765
|
*/
|
|
767
766
|
declare function isLogicalExpression(item: unknown): item is LogicalExpression;
|
|
768
767
|
|
|
768
|
+
/**
|
|
769
|
+
* Test if the item is an Arcade MemberAccessChainExpression.
|
|
770
|
+
*/
|
|
771
|
+
declare function isMemberAccessChainExpression(item: unknown): item is MemberAccessChainExpression;
|
|
772
|
+
|
|
769
773
|
/**
|
|
770
774
|
* Test if the item is an Arcade MemberExpression.
|
|
771
775
|
*/
|
|
@@ -791,6 +795,11 @@ declare function isProperty(item: unknown): item is Property;
|
|
|
791
795
|
*/
|
|
792
796
|
declare function isReturnStatement(item: unknown): item is ReturnStatement;
|
|
793
797
|
|
|
798
|
+
/**
|
|
799
|
+
* Test if the item is an Arcade SafeMemberExpression.
|
|
800
|
+
*/
|
|
801
|
+
declare function isSafeMemberExpression(item: unknown): item is SafeMemberExpression;
|
|
802
|
+
|
|
794
803
|
/**
|
|
795
804
|
* Test if the item is an Arcade Statement.
|
|
796
805
|
*/
|
|
@@ -945,7 +954,7 @@ declare interface LogicalExpression extends NodeBase<typeof NodeTypes.LogicalExp
|
|
|
945
954
|
/**
|
|
946
955
|
* Arcade logical operators.
|
|
947
956
|
*/
|
|
948
|
-
declare const LogicalOperators: readonly
|
|
957
|
+
declare const LogicalOperators: readonly ["||", "&&"];
|
|
949
958
|
|
|
950
959
|
/**
|
|
951
960
|
* Arcade logical operators.
|
|
@@ -962,6 +971,15 @@ declare interface Marker extends Position {
|
|
|
962
971
|
index: number;
|
|
963
972
|
}
|
|
964
973
|
|
|
974
|
+
/**
|
|
975
|
+
* The enclosing scope for SafeMemberExpressions. Failed accesses in `expression` (or descendent `callee`/`object` expressions)
|
|
976
|
+
* result in this entire chain evaluating to `null`.
|
|
977
|
+
* Example: `foo?.bar?.["baz"]`, `foo()?.bar`, `foo.bar?.baz`, `foo?.bar.baz`, `foo?.bar()` are all single chains
|
|
978
|
+
*/
|
|
979
|
+
declare interface MemberAccessChainExpression extends NodeBase<typeof NodeTypes.MemberAccessChainExpression> {
|
|
980
|
+
expression: Expression;
|
|
981
|
+
}
|
|
982
|
+
|
|
965
983
|
/**
|
|
966
984
|
* Define an Arcade member expression.
|
|
967
985
|
* Example: foo.bar or foo[1]
|
|
@@ -1015,11 +1033,13 @@ declare const NodeTypes: {
|
|
|
1015
1033
|
readonly LineComment: "LineComment";
|
|
1016
1034
|
readonly Literal: "Literal";
|
|
1017
1035
|
readonly LogicalExpression: "LogicalExpression";
|
|
1036
|
+
readonly MemberAccessChainExpression: "MemberAccessChainExpression";
|
|
1018
1037
|
readonly MemberExpression: "MemberExpression";
|
|
1019
1038
|
readonly ObjectExpression: "ObjectExpression";
|
|
1020
1039
|
readonly Program: "Program";
|
|
1021
1040
|
readonly Property: "Property";
|
|
1022
1041
|
readonly ReturnStatement: "ReturnStatement";
|
|
1042
|
+
readonly SafeMemberExpression: "SafeMemberExpression";
|
|
1023
1043
|
readonly TemplateElement: "TemplateElement";
|
|
1024
1044
|
readonly TemplateLiteral: "TemplateLiteral";
|
|
1025
1045
|
readonly UnaryExpression: "UnaryExpression";
|
|
@@ -1131,6 +1151,8 @@ declare namespace Parser {
|
|
|
1131
1151
|
isObjectExpression,
|
|
1132
1152
|
isTemplateLiteral,
|
|
1133
1153
|
isMemberExpression,
|
|
1154
|
+
isSafeMemberExpression,
|
|
1155
|
+
isMemberAccessChainExpression,
|
|
1134
1156
|
isUnaryExpression,
|
|
1135
1157
|
isUpdateExpression,
|
|
1136
1158
|
isVariableDeclarator,
|
|
@@ -1145,6 +1167,7 @@ declare namespace Parser {
|
|
|
1145
1167
|
AssignmentOperators,
|
|
1146
1168
|
LogicalOperators,
|
|
1147
1169
|
BinaryOperators,
|
|
1170
|
+
SafeAccessOperator,
|
|
1148
1171
|
OperatorPrecedence,
|
|
1149
1172
|
Position,
|
|
1150
1173
|
SourceLocation,
|
|
@@ -1157,7 +1180,7 @@ declare namespace Parser {
|
|
|
1157
1180
|
ParseOptions,
|
|
1158
1181
|
DiagnosticCodes_2 as DiagnosticCodes,
|
|
1159
1182
|
DiagnosticMessages_2 as DiagnosticMessages,
|
|
1160
|
-
|
|
1183
|
+
DiagnosticData_2 as DiagnosticData,
|
|
1161
1184
|
DiagnosticApi,
|
|
1162
1185
|
Diagnostic_2 as Diagnostic,
|
|
1163
1186
|
LineComment,
|
|
@@ -1197,6 +1220,8 @@ declare namespace Parser {
|
|
|
1197
1220
|
LogicalExpression,
|
|
1198
1221
|
ComputedMemberExpression,
|
|
1199
1222
|
MemberExpression,
|
|
1223
|
+
SafeMemberExpression,
|
|
1224
|
+
MemberAccessChainExpression,
|
|
1200
1225
|
ObjectExpression,
|
|
1201
1226
|
Property,
|
|
1202
1227
|
TemplateLiteral,
|
|
@@ -1279,6 +1304,56 @@ declare interface ReturnStatement extends NodeBase<typeof NodeTypes.ReturnStatem
|
|
|
1279
1304
|
argument: Expression | null;
|
|
1280
1305
|
}
|
|
1281
1306
|
|
|
1307
|
+
declare const SafeAccessOperator = "?.";
|
|
1308
|
+
|
|
1309
|
+
declare type SafeAccessOperator = typeof SafeAccessOperator;
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* Define an Arcade safe computed member expression.
|
|
1313
|
+
* Example: foo?.[1]
|
|
1314
|
+
*/
|
|
1315
|
+
declare interface SafeComputedMemberExpression extends NodeBase<typeof NodeTypes.SafeMemberExpression> {
|
|
1316
|
+
readonly computed: true;
|
|
1317
|
+
/**
|
|
1318
|
+
* The object of the member expression.
|
|
1319
|
+
* Example: foo?.[1]
|
|
1320
|
+
* The object is foo.
|
|
1321
|
+
*/
|
|
1322
|
+
object: Expression;
|
|
1323
|
+
/**
|
|
1324
|
+
* The property of the member expression.
|
|
1325
|
+
* Example: foo?.[1]
|
|
1326
|
+
* The property is 1.
|
|
1327
|
+
*/
|
|
1328
|
+
property: Expression;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* Define an Arcade safe member expression.
|
|
1333
|
+
* Example: foo?.bar or foo?.[1]
|
|
1334
|
+
*/
|
|
1335
|
+
declare type SafeMemberExpression = SafeComputedMemberExpression | SafeNonComputedMemberExpression;
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* Define an Arcade safe non-computed member expression.
|
|
1339
|
+
* Example: foo?.bar
|
|
1340
|
+
*/
|
|
1341
|
+
declare interface SafeNonComputedMemberExpression extends NodeBase<typeof NodeTypes.SafeMemberExpression> {
|
|
1342
|
+
readonly computed: false;
|
|
1343
|
+
/**
|
|
1344
|
+
* The object of the member expression.
|
|
1345
|
+
* Example: foo?.bar
|
|
1346
|
+
* The object is foo.
|
|
1347
|
+
*/
|
|
1348
|
+
object: Expression;
|
|
1349
|
+
/**
|
|
1350
|
+
* The property of the member expression.
|
|
1351
|
+
* Example: foo?.bar
|
|
1352
|
+
* The property is bar.
|
|
1353
|
+
*/
|
|
1354
|
+
property: Identifier;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1282
1357
|
/**
|
|
1283
1358
|
* Describe a range in the source code between two positions as [start, end].
|
|
1284
1359
|
* Start is inclusive and end is exclusive.
|
|
@@ -1435,7 +1510,7 @@ declare interface UnaryExpression extends NodeBase<typeof NodeTypes.UnaryExpress
|
|
|
1435
1510
|
/**
|
|
1436
1511
|
* Arcade unary operators.
|
|
1437
1512
|
*/
|
|
1438
|
-
declare const UnaryOperators: readonly
|
|
1513
|
+
declare const UnaryOperators: readonly ["-", "+", "!", "~"];
|
|
1439
1514
|
|
|
1440
1515
|
/**
|
|
1441
1516
|
* Arcade unary operators.
|
|
@@ -1470,7 +1545,7 @@ declare interface UpdateExpression extends NodeBase<typeof NodeTypes.UpdateExpre
|
|
|
1470
1545
|
/**
|
|
1471
1546
|
* Arcade update operators.
|
|
1472
1547
|
*/
|
|
1473
|
-
declare const UpdateOperators: readonly
|
|
1548
|
+
declare const UpdateOperators: readonly ["++", "--"];
|
|
1474
1549
|
|
|
1475
1550
|
/**
|
|
1476
1551
|
* Arcade update operators.
|