@ibyar/expressions 0.5.4 → 0.6.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.
Files changed (137) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -0
  3. package/api/abstract.d.ts +3 -3
  4. package/api/abstract.js +7 -2
  5. package/api/abstract.js.map +1 -1
  6. package/api/class/class.d.ts +45 -24
  7. package/api/class/class.js +158 -112
  8. package/api/class/class.js.map +1 -1
  9. package/api/computing/debugger.d.ts +15 -0
  10. package/api/computing/debugger.js +35 -0
  11. package/api/computing/debugger.js.map +1 -0
  12. package/api/computing/rest.d.ts +4 -4
  13. package/api/computing/rest.js.map +1 -1
  14. package/api/computing/return.d.ts +4 -0
  15. package/api/computing/return.js +5 -0
  16. package/api/computing/return.js.map +1 -1
  17. package/api/computing/throw.d.ts +4 -0
  18. package/api/computing/throw.js +4 -0
  19. package/api/computing/throw.js.map +1 -1
  20. package/api/definition/array.d.ts +7 -6
  21. package/api/definition/array.js +20 -14
  22. package/api/definition/array.js.map +1 -1
  23. package/api/definition/bind.d.ts +6 -0
  24. package/api/definition/bind.js +6 -0
  25. package/api/definition/bind.js.map +1 -1
  26. package/api/definition/function.d.ts +35 -46
  27. package/api/definition/function.js +282 -299
  28. package/api/definition/function.js.map +1 -1
  29. package/api/definition/member.js.map +1 -1
  30. package/api/definition/object.d.ts +9 -6
  31. package/api/definition/object.js +35 -5
  32. package/api/definition/object.js.map +1 -1
  33. package/api/definition/statement.js +5 -1
  34. package/api/definition/statement.js.map +1 -1
  35. package/api/definition/values.d.ts +43 -50
  36. package/api/definition/values.js +84 -149
  37. package/api/definition/values.js.map +1 -1
  38. package/api/deserialize/deserialize.d.ts +7 -1
  39. package/api/deserialize/deserialize.js +9 -1
  40. package/api/deserialize/deserialize.js.map +1 -1
  41. package/api/deserialize/type-store.d.ts +2 -2
  42. package/api/deserialize/type-store.js.map +1 -1
  43. package/api/expression.d.ts +156 -12
  44. package/api/expression.js.map +1 -1
  45. package/api/index.d.ts +2 -0
  46. package/api/index.js +2 -0
  47. package/api/index.js.map +1 -1
  48. package/api/module/common.d.ts +29 -0
  49. package/api/module/common.js +71 -0
  50. package/api/module/common.js.map +1 -0
  51. package/api/module/export.d.ts +78 -9
  52. package/api/module/export.js +120 -15
  53. package/api/module/export.js.map +1 -1
  54. package/api/module/import.d.ts +56 -8
  55. package/api/module/import.js +62 -19
  56. package/api/module/import.js.map +1 -1
  57. package/api/operators/grouping.d.ts +7 -0
  58. package/api/operators/grouping.js +7 -0
  59. package/api/operators/grouping.js.map +1 -1
  60. package/api/operators/pipeline.d.ts +12 -0
  61. package/api/operators/pipeline.js +12 -0
  62. package/api/operators/pipeline.js.map +1 -1
  63. package/api/operators/unary.js +3 -0
  64. package/api/operators/unary.js.map +1 -1
  65. package/api/{module/app/program.d.ts → program.d.ts} +5 -5
  66. package/api/{module/app/program.js → program.js} +3 -3
  67. package/api/program.js.map +1 -0
  68. package/api/statement/control/block.d.ts +5 -2
  69. package/api/statement/control/block.js +24 -21
  70. package/api/statement/control/block.js.map +1 -1
  71. package/api/statement/control/empty.d.ts +7 -0
  72. package/api/statement/control/empty.js +7 -0
  73. package/api/statement/control/empty.js.map +1 -1
  74. package/api/statement/control/if.d.ts +5 -0
  75. package/api/statement/control/if.js +5 -0
  76. package/api/statement/control/if.js.map +1 -1
  77. package/api/statement/control/switch.d.ts +6 -0
  78. package/api/statement/control/switch.js +17 -3
  79. package/api/statement/control/switch.js.map +1 -1
  80. package/api/statement/control/terminate.d.ts +44 -11
  81. package/api/statement/control/terminate.js +87 -18
  82. package/api/statement/control/terminate.js.map +1 -1
  83. package/api/statement/declarations/declares.d.ts +7 -7
  84. package/api/statement/declarations/declares.js +1 -1
  85. package/api/statement/declarations/declares.js.map +1 -1
  86. package/api/statement/iterations/for.d.ts +5 -0
  87. package/api/statement/iterations/for.js +35 -16
  88. package/api/statement/iterations/for.js.map +1 -1
  89. package/api/statement/iterations/while.d.ts +6 -0
  90. package/api/statement/iterations/while.js +25 -11
  91. package/api/statement/iterations/while.js.map +1 -1
  92. package/api/utils.d.ts +2 -0
  93. package/api/utils.js +3 -1
  94. package/api/utils.js.map +1 -1
  95. package/package.json +7 -5
  96. package/scope/event.d.ts +3 -3
  97. package/scope/event.js +2 -2
  98. package/scope/event.js.map +1 -1
  99. package/scope/pool.d.ts +7 -0
  100. package/scope/pool.js +29 -0
  101. package/scope/pool.js.map +1 -0
  102. package/scope/proxy.d.ts +6 -11
  103. package/scope/proxy.js +23 -52
  104. package/scope/proxy.js.map +1 -1
  105. package/scope/scope.d.ts +161 -38
  106. package/scope/scope.js +260 -106
  107. package/scope/scope.js.map +1 -1
  108. package/scope/stack.d.ts +97 -21
  109. package/scope/stack.js +13 -0
  110. package/scope/stack.js.map +1 -1
  111. package/v8/enums.d.ts +204 -0
  112. package/v8/enums.js +406 -0
  113. package/v8/enums.js.map +1 -0
  114. package/v8/index.d.ts +2 -1
  115. package/v8/index.js +2 -1
  116. package/v8/index.js.map +1 -1
  117. package/v8/inline.d.ts +213 -0
  118. package/v8/inline.js +2375 -0
  119. package/v8/inline.js.map +1 -0
  120. package/v8/nodes.d.ts +8 -7
  121. package/v8/nodes.js +39 -64
  122. package/v8/nodes.js.map +1 -1
  123. package/v8/parser.d.ts +49 -151
  124. package/v8/parser.js +839 -1608
  125. package/v8/parser.js.map +1 -1
  126. package/v8/stream.d.ts +39 -3
  127. package/v8/stream.js +685 -171
  128. package/v8/stream.js.map +1 -1
  129. package/v8/token.d.ts +244 -9
  130. package/v8/token.js +315 -47
  131. package/v8/token.js.map +1 -1
  132. package/visit/visitor.d.ts +3 -0
  133. package/visit/visitor.js.map +1 -1
  134. package/api/module/app/program.js.map +0 -1
  135. package/v8/app.d.ts +0 -0
  136. package/v8/app.js +0 -2
  137. package/v8/app.js.map +0 -1
@@ -1,7 +1,16 @@
1
- var Identifier_1, Literal_1, StringLiteral_1, NumberLiteral_1, BigIntLiteral_1, RegExpLiteral_1;
1
+ var Identifier_1, Literal_1;
2
2
  import { __decorate, __metadata } from "tslib";
3
3
  import { Deserializer } from '../deserialize/deserialize.js';
4
4
  import { AbstractExpressionNode } from '../abstract.js';
5
+ /**
6
+ * An identifier is a sequence of characters in the code that identifies a variable, function, or property.
7
+ * In JavaScript, identifiers are case-sensitive and can contain Unicode letters, $, _, and digits (0-9),
8
+ * but may not start with a digit.
9
+ * An identifier differs from a string in that a string is data,
10
+ * while an identifier is part of the code. In JavaScript,
11
+ * there is no way to convert identifiers to strings,
12
+ * but sometimes it is possible to parse strings into identifiers.
13
+ */
5
14
  let Identifier = Identifier_1 = class Identifier extends AbstractExpressionNode {
6
15
  constructor(name) {
7
16
  super();
@@ -25,10 +34,10 @@ let Identifier = Identifier_1 = class Identifier extends AbstractExpressionNode
25
34
  }
26
35
  findScope(stack, scope) {
27
36
  if (scope) {
28
- return scope.getScope(this.name);
37
+ return scope.getInnerScope(this.name);
29
38
  }
30
39
  scope = stack.findScope(this.name);
31
- return scope.getScope(this.name);
40
+ return scope.getInnerScope(this.name);
32
41
  }
33
42
  declareVariable(stack, propertyValue) {
34
43
  return stack.declareVariable(this.name, propertyValue);
@@ -55,17 +64,48 @@ Identifier = Identifier_1 = __decorate([
55
64
  __metadata("design:paramtypes", [Object])
56
65
  ], Identifier);
57
66
  export { Identifier };
67
+ let ThisExpression = class ThisExpression extends Identifier {
68
+ static fromJSON(node) {
69
+ return ThisNode;
70
+ }
71
+ constructor() {
72
+ super('this');
73
+ }
74
+ };
75
+ ThisExpression = __decorate([
76
+ Deserializer('ThisExpression'),
77
+ __metadata("design:paramtypes", [])
78
+ ], ThisExpression);
79
+ export { ThisExpression };
58
80
  let Literal = Literal_1 = class Literal extends AbstractExpressionNode {
59
- constructor(value) {
81
+ constructor(value, raw, regex, bigint) {
60
82
  super();
61
83
  this.value = value;
84
+ this.raw = raw;
85
+ this.regex = regex;
86
+ this.bigint = bigint;
62
87
  }
63
88
  static fromJSON(node) {
64
- return new Literal_1(node.value);
89
+ if (node.bigint) {
90
+ return new Literal_1(BigInt(node.bigint), node.raw, undefined, node.bigint);
91
+ }
92
+ else if (node.regex) {
93
+ return new Literal_1(RegExp(node.regex.pattern, node.regex.flags), node.raw, node.regex);
94
+ }
95
+ return new Literal_1(node.value, node.raw);
65
96
  }
66
97
  getValue() {
67
98
  return this.value;
68
99
  }
100
+ getRegex() {
101
+ return this.regex;
102
+ }
103
+ getBigint() {
104
+ return this.bigint;
105
+ }
106
+ geRaw() {
107
+ return this.raw;
108
+ }
69
109
  shareVariables(scopeList) { }
70
110
  set() {
71
111
  throw new Error(`${this.constructor.name}#set() has no implementation.`);
@@ -75,10 +115,10 @@ let Literal = Literal_1 = class Literal extends AbstractExpressionNode {
75
115
  }
76
116
  findScope(stack, scope) {
77
117
  if (scope) {
78
- return scope.getScope(this.value);
118
+ return scope.getInnerScope(this.value);
79
119
  }
80
120
  scope = stack.findScope(this.value);
81
- return scope.getScope(this.value);
121
+ return scope.getInnerScope(this.value);
82
122
  }
83
123
  dependency(computed) {
84
124
  return computed ? [this] : [];
@@ -87,55 +127,32 @@ let Literal = Literal_1 = class Literal extends AbstractExpressionNode {
87
127
  return computed ? [{ computed: false, path: this.toString() }] : [];
88
128
  }
89
129
  toString() {
90
- return String(this.value);
130
+ return this.raw ?? String(this.value);
91
131
  }
92
132
  toJson() {
93
- return { value: this.value };
94
- }
95
- };
96
- Literal = Literal_1 = __decorate([
97
- Deserializer('Literal'),
98
- __metadata("design:paramtypes", [Object])
99
- ], Literal);
100
- export { Literal };
101
- let StringLiteral = StringLiteral_1 = class StringLiteral extends Literal {
102
- constructor(value, quote) {
103
- super(value);
104
- const firstChar = value.charAt(0);
105
- if (quote) {
106
- this.quote = quote;
107
- this.value = value;
108
- }
109
- else if (firstChar === '"' || firstChar == `'` || firstChar === '`') {
110
- this.quote = firstChar;
111
- this.value = `"${value.substring(1, value.length - 1)}"`;
133
+ if (this.bigint) {
134
+ return {
135
+ bigint: this.bigint,
136
+ raw: this.raw,
137
+ };
112
138
  }
113
- else {
114
- this.quote = '';
115
- this.value = value;
139
+ else if (this.regex) {
140
+ return {
141
+ regex: { pattern: this.regex?.pattern, flags: this.regex?.flags },
142
+ raw: this.raw,
143
+ };
116
144
  }
117
- }
118
- static fromJSON(node) {
119
- return new StringLiteral_1(node.value, node.quote);
120
- }
121
- getQuote() {
122
- return this.quote;
123
- }
124
- toString() {
125
- return `${this.quote}${this.value}${this.quote}`;
126
- }
127
- toJson() {
128
145
  return {
129
146
  value: this.value,
130
- quote: this.quote
147
+ raw: this.raw,
131
148
  };
132
149
  }
133
150
  };
134
- StringLiteral = StringLiteral_1 = __decorate([
135
- Deserializer('StringLiteral'),
136
- __metadata("design:paramtypes", [String, String])
137
- ], StringLiteral);
138
- export { StringLiteral };
151
+ Literal = Literal_1 = __decorate([
152
+ Deserializer('Literal'),
153
+ __metadata("design:paramtypes", [Object, String, Object, String])
154
+ ], Literal);
155
+ export { Literal };
139
156
  class TemplateArray extends Array {
140
157
  constructor(strings) {
141
158
  super(...strings);
@@ -229,117 +246,32 @@ TaggedTemplateExpression = __decorate([
229
246
  __metadata("design:paramtypes", [Object, Array, Array])
230
247
  ], TaggedTemplateExpression);
231
248
  export { TaggedTemplateExpression };
232
- let NumberLiteral = NumberLiteral_1 = class NumberLiteral extends Literal {
233
- static fromJSON(node) {
234
- return new NumberLiteral_1(node.value);
235
- }
236
- constructor(value) {
237
- super(value);
238
- }
239
- };
240
- NumberLiteral = NumberLiteral_1 = __decorate([
241
- Deserializer('NumberLiteral'),
242
- __metadata("design:paramtypes", [Number])
243
- ], NumberLiteral);
244
- export { NumberLiteral };
245
- let BigIntLiteral = BigIntLiteral_1 = class BigIntLiteral extends Literal {
246
- static fromJSON(node) {
247
- return new BigIntLiteral_1(BigInt(String(node.value)));
248
- }
249
- toString() {
250
- return `${this.value}n`;
251
- }
252
- toJson() {
253
- return { value: this.value.toString() };
254
- }
255
- };
256
- BigIntLiteral = BigIntLiteral_1 = __decorate([
257
- Deserializer('BigIntLiteral')
258
- ], BigIntLiteral);
259
- export { BigIntLiteral };
260
- let RegExpLiteral = RegExpLiteral_1 = class RegExpLiteral extends Literal {
261
- static fromJSON(node) {
262
- return new RegExpLiteral_1(new RegExp(node.regex.pattern, node.regex.flags));
263
- }
264
- toString() {
265
- return `${this.value}n`;
266
- }
267
- toJson() {
268
- return {
269
- regex: {
270
- pattern: this.value.source,
271
- flags: this.value.flags
272
- }
273
- };
274
- ;
275
- }
276
- };
277
- RegExpLiteral = RegExpLiteral_1 = __decorate([
278
- Deserializer('RegExpLiteral')
279
- ], RegExpLiteral);
280
- export { RegExpLiteral };
249
+ // @Deserializer('BigIntLiteral')
250
+ // export class BigIntLiteral extends Literal<bigint> {
251
+ // static fromJSON(node: BigIntLiteral): BigIntLiteral {
252
+ // return new BigIntLiteral(BigInt(String(node.value)));
253
+ // }
254
+ // toString(): string {
255
+ // return `${this.value}n`;
256
+ // }
257
+ // toJson(): object {
258
+ // return { value: this.value.toString() };
259
+ // }
260
+ // }
281
261
  export const TRUE = String(true);
282
262
  export const FALSE = String(false);
283
- let BooleanLiteral = class BooleanLiteral extends Literal {
284
- static fromJSON(node) {
285
- switch (String(node.value)) {
286
- case TRUE: return TrueNode;
287
- case FALSE:
288
- default:
289
- return FalseNode;
290
- }
291
- }
292
- };
293
- BooleanLiteral = __decorate([
294
- Deserializer('BooleanLiteral')
295
- ], BooleanLiteral);
296
- export { BooleanLiteral };
297
263
  export const NULL = String(null);
298
264
  export const UNDEFINED = String(undefined);
299
- let NullishLiteral = class NullishLiteral extends Literal {
300
- static fromJSON(node) {
301
- switch (String(node.value)) {
302
- case NULL: return NullNode;
303
- case UNDEFINED:
304
- default: return UndefinedNode;
305
- }
306
- }
307
- toString() {
308
- if (typeof this.value === 'undefined') {
309
- return UNDEFINED;
310
- }
311
- return NULL;
312
- }
313
- toJson() {
314
- return { value: this.toString() };
315
- }
316
- };
317
- NullishLiteral = __decorate([
318
- Deserializer('NullishLiteral')
319
- ], NullishLiteral);
320
- export { NullishLiteral };
321
- let ThisExpression = class ThisExpression extends Identifier {
322
- static fromJSON(node) {
323
- return ThisNode;
324
- }
325
- constructor() {
326
- super('this');
327
- }
328
- };
329
- ThisExpression = __decorate([
330
- Deserializer('ThisExpression'),
331
- __metadata("design:paramtypes", [])
332
- ], ThisExpression);
333
- export { ThisExpression };
334
- export const NullNode = Object.freeze(new NullishLiteral(null));
335
- export const UndefinedNode = Object.freeze(new NullishLiteral(undefined));
336
- export const TrueNode = Object.freeze(new BooleanLiteral(true));
337
- export const FalseNode = Object.freeze(new BooleanLiteral(false));
265
+ export const NullNode = Object.freeze(new Literal(null));
266
+ export const UndefinedNode = Object.freeze(new Literal(undefined));
267
+ export const TrueNode = Object.freeze(new Literal(true));
268
+ export const FalseNode = Object.freeze(new Literal(false));
338
269
  export const ThisNode = Object.freeze(new ThisExpression());
339
270
  export const GlobalThisNode = Object.freeze(new Identifier('globalThis'));
340
271
  export const SymbolNode = Object.freeze(new Identifier('Symbol'));
341
272
  export const OfNode = Object.freeze(new Identifier('of'));
342
273
  export const AsNode = Object.freeze(new Identifier('as'));
274
+ export const DefaultNode = Object.freeze(new Identifier('default'));
343
275
  export const GetIdentifier = Object.freeze(new Identifier('get'));
344
276
  export const SetIdentifier = Object.freeze(new Identifier('set'));
345
277
  export const AsyncIdentifier = Object.freeze(new Identifier('async'));
@@ -348,4 +280,7 @@ export const ConstructorIdentifier = Object.freeze(new Identifier('constructor')
348
280
  export const NameIdentifier = Object.freeze(new Identifier('name'));
349
281
  export const EvalIdentifier = Object.freeze(new Identifier('eval'));
350
282
  export const ArgumentsIdentifier = Object.freeze(new Identifier('arguments'));
283
+ export const YieldIdentifier = Object.freeze(new Identifier('yield'));
284
+ export const SuperIdentifier = Object.freeze(new Identifier('super'));
285
+ export const LetIdentifier = Object.freeze(new Identifier('let'));
351
286
  //# sourceMappingURL=values.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"values.js","sourceRoot":"","sources":["../../../../src/express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AAM,CAAC,CAAe,CAAC;AAClF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAe,CAAC;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,CAAe,CAAC","sourcesContent":["import type {\n\tCanDeclareExpression, ExpressionNode, NodeDeserializer,\n\tCanFindScope, ExpressionEventPath, VisitNodeType\n} from '../expression.js';\nimport type { Scope } from '../../scope/scope.js';\nimport type { Stack } from '../../scope/stack.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { AbstractExpressionNode } from '../abstract.js';\n\n/**\n * An identifier is a sequence of characters in the code that identifies a variable, function, or property.\n * In JavaScript, identifiers are case-sensitive and can contain Unicode letters, $, _, and digits (0-9),\n * but may not start with a digit.\n * An identifier differs from a string in that a string is data,\n * while an identifier is part of the code. In JavaScript,\n * there is no way to convert identifiers to strings,\n * but sometimes it is possible to parse strings into identifiers.\n */\n@Deserializer('Identifier')\nexport class Identifier extends AbstractExpressionNode implements CanDeclareExpression, CanFindScope {\n\tstatic fromJSON(node: Identifier): Identifier {\n\t\treturn new Identifier(node.name);\n\t}\n\tconstructor(protected name: string | number) {\n\t\tsuper();\n\t}\n\tgetName() {\n\t\treturn this.name;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack, value: any) {\n\t\treturn stack.set(this.name, value) ? value : void 0;\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tif (thisContext) {\n\t\t\treturn thisContext[this.name];\n\t\t}\n\t\treturn stack.get(this.name);\n\t}\n\tfindScope<T extends object>(stack: Stack): Scope<T>;\n\tfindScope<T extends object>(stack: Stack, scope: Scope<any>): Scope<T>;\n\tfindScope<T extends object>(stack: Stack, scope?: Scope<any>): Scope<T> | undefined {\n\t\tif (scope) {\n\t\t\treturn scope.getScope(this.name);\n\t\t}\n\t\tscope = stack.findScope(this.name);\n\t\treturn scope.getScope(this.name);\n\t}\n\tdeclareVariable(stack: Stack, propertyValue: any): any {\n\t\treturn stack.declareVariable(this.name, propertyValue);\n\t}\n\tgetDeclarationName(): string {\n\t\treturn this.toString();\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [this];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\tconst path: ExpressionEventPath[] = [{ computed: false, path: this.toString() }];\n\t\treturn computed ? [{ computed, path: this.toString(), computedPath: [path] }] : path;\n\t}\n\ttoString(): string {\n\t\treturn String(this.name);\n\t}\n\ttoJson(): object {\n\t\treturn { name: this.name };\n\t}\n}\n\n@Deserializer('Literal')\nexport class Literal<T> extends AbstractExpressionNode implements CanFindScope {\n\tstatic fromJSON(node: Literal<any>):\n\t\tLiteral<string>\n\t\t| Literal<number>\n\t\t| Literal<bigint>\n\t\t| Literal<boolean>\n\t\t| Literal<RegExp>\n\t\t| Literal<null | undefined> {\n\t\treturn new Literal(node.value);\n\t}\n\tconstructor(protected value: T) {\n\t\tsuper();\n\t}\n\tgetValue() {\n\t\treturn this.value;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset() {\n\t\tthrow new Error(`${this.constructor.name}#set() has no implementation.`);\n\t}\n\tget(): T {\n\t\treturn this.value;\n\t}\n\tfindScope<V extends object>(stack: Stack): Scope<V>;\n\tfindScope<V extends object>(stack: Stack, scope: Scope<any>): Scope<V>;\n\tfindScope<V extends object>(stack: Stack, scope?: Scope<any>): Scope<V> | undefined {\n\t\tif (scope) {\n\t\t\treturn scope.getScope<V>(this.value as any);\n\t\t}\n\t\tscope = stack.findScope<V>(this.value as any);\n\t\treturn scope.getScope<V>(this.value as any);\n\t}\n\tdependency(computed: true): ExpressionNode[] {\n\t\treturn computed ? [this] : [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn computed ? [{ computed: false, path: this.toString() }] : [];\n\t}\n\ttoString(): string {\n\t\treturn String(this.value);\n\t}\n\ttoJson(): object {\n\t\treturn { value: this.value };\n\t}\n}\n\n@Deserializer('StringLiteral')\nexport class StringLiteral extends Literal<string> {\n\tstatic fromJSON(node: StringLiteral): StringLiteral {\n\t\treturn new StringLiteral(node.value, node.quote);\n\t}\n\tprivate quote: string;\n\tconstructor(value: string, quote?: string) {\n\t\tsuper(value);\n\t\tconst firstChar = value.charAt(0);\n\t\tif (quote) {\n\t\t\tthis.quote = quote;\n\t\t\tthis.value = value;\n\t\t} else if (firstChar === '\"' || firstChar == `'` || firstChar === '`') {\n\t\t\tthis.quote = firstChar;\n\t\t\tthis.value = `\"${value.substring(1, value.length - 1)}\"`;\n\t\t} else {\n\t\t\tthis.quote = '';\n\t\t\tthis.value = value;\n\t\t}\n\t}\n\tgetQuote() {\n\t\treturn this.quote;\n\t}\n\ttoString(): string {\n\t\treturn `${this.quote}${this.value}${this.quote}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tvalue: this.value,\n\t\t\tquote: this.quote\n\t\t};\n\t}\n}\n\nclass TemplateArray extends Array<string> implements TemplateStringsArray {\n\traw: readonly string[];\n\tconstructor(strings: string[]) {\n\t\tsuper(...strings);\n\t\tthis.raw = strings;\n\t}\n}\n\nexport class TemplateLiteralExpressionNode extends AbstractExpressionNode {\n\tstatic fromJSON(node: TemplateLiteralExpressionNode, deserializer: NodeDeserializer): TemplateLiteralExpressionNode {\n\t\treturn new TemplateLiteralExpressionNode(\n\t\t\tnode.quasis,\n\t\t\tnode.expressions.map(deserializer),\n\t\t\tnode.tag ? deserializer(node.tag) : void 0\n\t\t);\n\t}\n\tstatic visit(node: TemplateLiteralExpressionNode, visitNode: VisitNodeType): void {\n\t\tnode.tag && visitNode(node.tag);\n\t\tnode.expressions.forEach(visitNode);\n\t}\n\tconstructor(protected quasis: string[], protected expressions: ExpressionNode[], protected tag?: ExpressionNode,) {\n\t\tsuper();\n\t}\n\tgetTag() {\n\t\treturn this.tag;\n\t}\n\tgetExpressions() {\n\t\treturn this.expressions;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\t\tthis.expressions.forEach(value => value.shareVariables(scopeList));\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error(`TemplateLiteralExpressionNode#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tconst tagged: Function = this.tag?.get(stack) || String.raw;\n\t\tconst templateStringsArray = new TemplateArray(this.quasis);\n\t\ttemplateStringsArray.raw = templateStringsArray;\n\t\tconst values = this.expressions.map(expr => expr.get(stack));\n\t\treturn tagged(templateStringsArray, ...values);\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn this.expressions.flatMap(exp => exp.dependency(computed));\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn this.expressions.flatMap(exp => exp.dependencyPath(computed));\n\t}\n\ttoString(): string {\n\t\tlet str = this.tag?.toString() || '';\n\t\tstr += '`';\n\t\tlet i = 0;\n\t\tfor (; i < this.quasis.length - 1; i++) {\n\t\t\tstr += this.quasis[i];\n\t\t\tstr += '${';\n\t\t\tstr += this.expressions[i].toString();\n\t\t\tstr += '}';\n\t\t}\n\t\tstr += this.quasis[i];\n\t\tstr += '`';\n\t\treturn str;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tquasis: this.quasis,\n\t\t\texpressions: this.expressions.map(expr => expr.toJSON()),\n\t\t\ttag: this.tag?.toJSON(),\n\t\t};\n\t}\n}\n\n@Deserializer('TemplateLiteral')\nexport class TemplateLiteral extends TemplateLiteralExpressionNode {\n\tdeclare protected tag: undefined;\n\tconstructor(quasis: string[], expressions: ExpressionNode[]) {\n\t\tsuper(quasis, expressions);\n\t}\n\toverride getTag(): undefined {\n\t\treturn undefined;\n\t}\n}\n\n@Deserializer('TaggedTemplateExpression')\nexport class TaggedTemplateExpression extends TemplateLiteralExpressionNode {\n\tdeclare protected tag: ExpressionNode;\n\tconstructor(tag: ExpressionNode, quasis: string[], expressions: ExpressionNode[]) {\n\t\tsuper(quasis, expressions, tag);\n\t}\n\toverride getTag(): ExpressionNode {\n\t\treturn super.getTag()!;\n\t}\n}\n\n\n@Deserializer('NumberLiteral')\nexport class NumberLiteral extends Literal<number> {\n\tstatic fromJSON(node: NumberLiteral): NumberLiteral {\n\t\treturn new NumberLiteral(node.value);\n\t}\n\tconstructor(value: number) {\n\t\tsuper(value);\n\t}\n}\n\n@Deserializer('BigIntLiteral')\nexport class BigIntLiteral extends Literal<bigint> {\n\tstatic fromJSON(node: BigIntLiteral): BigIntLiteral {\n\t\treturn new BigIntLiteral(BigInt(String(node.value)));\n\t}\n\ttoString(): string {\n\t\treturn `${this.value}n`;\n\t}\n\ttoJson(): object {\n\t\treturn { value: this.value.toString() };\n\t}\n}\n@Deserializer('RegExpLiteral')\nexport class RegExpLiteral extends Literal<RegExp> {\n\tstatic fromJSON(node: RegExpLiteral & { regex: { pattern: string, flags: string } }): RegExpLiteral {\n\t\treturn new RegExpLiteral(new RegExp(node.regex.pattern, node.regex.flags));\n\t}\n\ttoString(): string {\n\t\treturn `${this.value}n`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tregex: {\n\t\t\t\tpattern: this.value.source,\n\t\t\t\tflags: this.value.flags\n\t\t\t}\n\t\t};;\n\t}\n}\n\nexport const TRUE = String(true);\nexport const FALSE = String(false);\n@Deserializer('BooleanLiteral')\nexport class BooleanLiteral extends Literal<boolean> {\n\tstatic fromJSON(node: BooleanLiteral): BooleanLiteral {\n\t\tswitch (String(node.value)) {\n\t\t\tcase TRUE: return TrueNode;\n\t\t\tcase FALSE:\n\t\t\tdefault:\n\t\t\t\treturn FalseNode;\n\t\t}\n\t}\n}\n\nexport const NULL = String(null);\nexport const UNDEFINED = String(undefined);\n\n@Deserializer('NullishLiteral')\nexport class NullishLiteral extends Literal<null | undefined> {\n\tstatic fromJSON(node: NullishLiteral): NullishLiteral {\n\t\tswitch (String(node.value)) {\n\t\t\tcase NULL: return NullNode;\n\t\t\tcase UNDEFINED:\n\t\t\tdefault: return UndefinedNode;\n\t\t}\n\t}\n\n\ttoString(): string {\n\t\tif (typeof this.value === 'undefined') {\n\t\t\treturn UNDEFINED;\n\t\t}\n\t\treturn NULL;\n\t}\n\ttoJson(): object {\n\t\treturn { value: this.toString() };\n\t}\n}\n\n@Deserializer('ThisExpression')\nexport class ThisExpression extends Identifier {\n\tstatic fromJSON(node: ThisExpression): ThisExpression {\n\t\treturn ThisNode;\n\t}\n\tconstructor() {\n\t\tsuper('this');\n\t}\n}\n\nexport const NullNode = Object.freeze(new NullishLiteral(null)) as NullishLiteral;\nexport const UndefinedNode = Object.freeze(new NullishLiteral(undefined)) as NullishLiteral;\nexport const TrueNode = Object.freeze(new BooleanLiteral(true)) as BooleanLiteral;\nexport const FalseNode = Object.freeze(new BooleanLiteral(false)) as BooleanLiteral;\nexport const ThisNode = Object.freeze(new ThisExpression()) as ThisExpression;\nexport const GlobalThisNode = Object.freeze(new Identifier('globalThis')) as Identifier;\nexport const SymbolNode = Object.freeze(new Identifier('Symbol')) as Identifier;\nexport const OfNode = Object.freeze(new Identifier('of')) as Identifier;\nexport const AsNode = Object.freeze(new Identifier('as')) as Identifier;\nexport const GetIdentifier = Object.freeze(new Identifier('get')) as Identifier;\nexport const SetIdentifier = Object.freeze(new Identifier('set')) as Identifier;\nexport const AsyncIdentifier = Object.freeze(new Identifier('async')) as Identifier;\nexport const AwaitIdentifier = Object.freeze(new Identifier('await')) as Identifier;\nexport const ConstructorIdentifier = Object.freeze(new Identifier('constructor')) as Identifier;\nexport const NameIdentifier = Object.freeze(new Identifier('name')) as Identifier;\nexport const EvalIdentifier = Object.freeze(new Identifier('eval')) as Identifier;\nexport const ArgumentsIdentifier = Object.freeze(new Identifier('arguments')) as Identifier;\n"]}
1
+ {"version":3,"file":"values.js","sourceRoot":"","sources":["../../../../src/expressions/api/definition/values.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,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C,IAAI,UAAU,CAAC,OAAO,CAAC,CAAe,CAAC;AACpF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAe,CAAC;AACpF,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,aAAa,CAAC,CAAe,CAAC;AAChG,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAe,CAAC;AAClF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAe,CAAC;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,CAAe,CAAC;AAC5F,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAe,CAAC;AACpF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAe,CAAC;AACpF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAe,CAAC","sourcesContent":["import type {\n\tDeclarationExpression, ExpressionNode, NodeDeserializer,\n\tCanFindScope, ExpressionEventPath, VisitNodeType\n} from '../expression.js';\nimport type { Context, Scope } from '../../scope/scope.js';\nimport type { Stack } from '../../scope/stack.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { AbstractExpressionNode } from '../abstract.js';\n\n/**\n * An identifier is a sequence of characters in the code that identifies a variable, function, or property.\n * In JavaScript, identifiers are case-sensitive and can contain Unicode letters, $, _, and digits (0-9),\n * but may not start with a digit.\n * An identifier differs from a string in that a string is data,\n * while an identifier is part of the code. In JavaScript,\n * there is no way to convert identifiers to strings,\n * but sometimes it is possible to parse strings into identifiers.\n */\n@Deserializer('Identifier')\nexport class Identifier extends AbstractExpressionNode implements DeclarationExpression, CanFindScope {\n\tstatic fromJSON(node: Identifier): Identifier {\n\t\treturn new Identifier(node.name);\n\t}\n\tconstructor(protected name: string | number) {\n\t\tsuper();\n\t}\n\tgetName() {\n\t\treturn this.name;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack, value: any) {\n\t\treturn stack.set(this.name, value) ? value : void 0;\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tif (thisContext) {\n\t\t\treturn thisContext[this.name];\n\t\t}\n\t\treturn stack.get(this.name);\n\t}\n\tfindScope<T extends object>(stack: Stack): Scope<T>;\n\tfindScope<T extends object>(stack: Stack, scope: Scope<any>): Scope<T>;\n\tfindScope<T extends object>(stack: Stack, scope?: Scope<any>): Scope<T> | undefined {\n\t\tif (scope) {\n\t\t\treturn scope.getInnerScope(this.name);\n\t\t}\n\t\tscope = stack.findScope(this.name);\n\t\treturn scope.getInnerScope(this.name);\n\t}\n\tdeclareVariable(stack: Stack, propertyValue: any): any {\n\t\treturn stack.declareVariable(this.name, propertyValue);\n\t}\n\tgetDeclarationName(): string {\n\t\treturn this.toString();\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [this];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\tconst path: ExpressionEventPath[] = [{ computed: false, path: this.toString() }];\n\t\treturn computed ? [{ computed, path: this.toString(), computedPath: [path] }] : path;\n\t}\n\ttoString(): string {\n\t\treturn String(this.name);\n\t}\n\ttoJson(): object {\n\t\treturn { name: this.name };\n\t}\n}\n\n@Deserializer('ThisExpression')\nexport class ThisExpression extends Identifier {\n\tstatic fromJSON(node: ThisExpression): ThisExpression {\n\t\treturn ThisNode;\n\t}\n\tconstructor() {\n\t\tsuper('this');\n\t}\n}\n\n@Deserializer('Literal')\nexport class Literal<T> extends AbstractExpressionNode implements CanFindScope {\n\tstatic fromJSON(node: Literal<any>):\n\t\tLiteral<string>\n\t\t| Literal<number>\n\t\t| Literal<boolean>\n\t\t| Literal<RegExp>\n\t\t| Literal<bigint>\n\t\t| Literal<null>\n\t\t| Literal<undefined> {\n\t\tif (node.bigint) {\n\t\t\treturn new Literal(BigInt(node.bigint), node.raw, undefined, node.bigint);\n\t\t} else if (node.regex) {\n\t\t\treturn new Literal(RegExp(node.regex.pattern, node.regex.flags), node.raw, node.regex);\n\t\t}\n\t\treturn new Literal(node.value, node.raw);\n\t}\n\tconstructor(protected value: T, protected raw?: string, protected regex?: { pattern: string, flags: string }, protected bigint?: string) {\n\t\tsuper();\n\t}\n\tgetValue() {\n\t\treturn this.value;\n\t}\n\tgetRegex() {\n\t\treturn this.regex;\n\t}\n\tgetBigint() {\n\t\treturn this.bigint;\n\t}\n\tgeRaw() {\n\t\treturn this.raw;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset() {\n\t\tthrow new Error(`${this.constructor.name}#set() has no implementation.`);\n\t}\n\tget(): T {\n\t\treturn this.value;\n\t}\n\tfindScope<V extends Context>(stack: Stack): Scope<V>;\n\tfindScope<V extends Context>(stack: Stack, scope: Scope<Record<PropertyKey, V>>): Scope<V>;\n\tfindScope<V extends Context>(stack: Stack, scope?: Scope<Record<PropertyKey, V>>): Scope<V> | undefined {\n\t\tif (scope) {\n\t\t\treturn scope.getInnerScope(this.value as any);\n\t\t}\n\t\tscope = stack.findScope(this.value as any);\n\t\treturn scope.getInnerScope(this.value as any);\n\t}\n\tdependency(computed: true): ExpressionNode[] {\n\t\treturn computed ? [this] : [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn computed ? [{ computed: false, path: this.toString() }] : [];\n\t}\n\ttoString(): string {\n\t\treturn this.raw ?? String(this.value);\n\t}\n\ttoJson(): object {\n\t\tif (this.bigint) {\n\t\t\treturn {\n\t\t\t\tbigint: this.bigint,\n\t\t\t\traw: this.raw,\n\t\t\t};\n\t\t} else if (this.regex) {\n\t\t\treturn {\n\t\t\t\tregex: { pattern: this.regex?.pattern, flags: this.regex?.flags },\n\t\t\t\traw: this.raw,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tvalue: this.value,\n\t\t\traw: this.raw,\n\t\t};\n\t}\n}\n\nclass TemplateArray extends Array<string> implements TemplateStringsArray {\n\traw: readonly string[];\n\tconstructor(strings: string[]) {\n\t\tsuper(...strings);\n\t\tthis.raw = strings;\n\t}\n}\n\nexport class TemplateLiteralExpressionNode extends AbstractExpressionNode {\n\tstatic fromJSON(node: TemplateLiteralExpressionNode, deserializer: NodeDeserializer): TemplateLiteralExpressionNode {\n\t\treturn new TemplateLiteralExpressionNode(\n\t\t\tnode.quasis,\n\t\t\tnode.expressions.map(deserializer),\n\t\t\tnode.tag ? deserializer(node.tag) : void 0\n\t\t);\n\t}\n\tstatic visit(node: TemplateLiteralExpressionNode, visitNode: VisitNodeType): void {\n\t\tnode.tag && visitNode(node.tag);\n\t\tnode.expressions.forEach(visitNode);\n\t}\n\tconstructor(protected quasis: string[], protected expressions: ExpressionNode[], protected tag?: ExpressionNode,) {\n\t\tsuper();\n\t}\n\tgetTag() {\n\t\treturn this.tag;\n\t}\n\tgetExpressions() {\n\t\treturn this.expressions;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\t\tthis.expressions.forEach(value => value.shareVariables(scopeList));\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error(`TemplateLiteralExpressionNode#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tconst tagged: Function = this.tag?.get(stack) || String.raw;\n\t\tconst templateStringsArray = new TemplateArray(this.quasis);\n\t\ttemplateStringsArray.raw = templateStringsArray;\n\t\tconst values = this.expressions.map(expr => expr.get(stack));\n\t\treturn tagged(templateStringsArray, ...values);\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn this.expressions.flatMap(exp => exp.dependency(computed));\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn this.expressions.flatMap(exp => exp.dependencyPath(computed));\n\t}\n\ttoString(): string {\n\t\tlet str = this.tag?.toString() || '';\n\t\tstr += '`';\n\t\tlet i = 0;\n\t\tfor (; i < this.quasis.length - 1; i++) {\n\t\t\tstr += this.quasis[i];\n\t\t\tstr += '${';\n\t\t\tstr += this.expressions[i].toString();\n\t\t\tstr += '}';\n\t\t}\n\t\tstr += this.quasis[i];\n\t\tstr += '`';\n\t\treturn str;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tquasis: this.quasis,\n\t\t\texpressions: this.expressions.map(expr => expr.toJSON()),\n\t\t\ttag: this.tag?.toJSON(),\n\t\t};\n\t}\n}\n\n@Deserializer('TemplateLiteral')\nexport class TemplateLiteral extends TemplateLiteralExpressionNode {\n\tdeclare protected tag: undefined;\n\tconstructor(quasis: string[], expressions: ExpressionNode[]) {\n\t\tsuper(quasis, expressions);\n\t}\n\toverride getTag(): undefined {\n\t\treturn undefined;\n\t}\n}\n\n@Deserializer('TaggedTemplateExpression')\nexport class TaggedTemplateExpression extends TemplateLiteralExpressionNode {\n\tdeclare protected tag: ExpressionNode;\n\tconstructor(tag: ExpressionNode, quasis: string[], expressions: ExpressionNode[]) {\n\t\tsuper(quasis, expressions, tag);\n\t}\n\toverride getTag(): ExpressionNode {\n\t\treturn super.getTag()!;\n\t}\n}\n\n\n// @Deserializer('BigIntLiteral')\n// export class BigIntLiteral extends Literal<bigint> {\n// \tstatic fromJSON(node: BigIntLiteral): BigIntLiteral {\n// \t\treturn new BigIntLiteral(BigInt(String(node.value)));\n// \t}\n// \ttoString(): string {\n// \t\treturn `${this.value}n`;\n// \t}\n// \ttoJson(): object {\n// \t\treturn { value: this.value.toString() };\n// \t}\n// }\n\n\nexport const TRUE = String(true);\nexport const FALSE = String(false);\n\nexport const NULL = String(null);\nexport const UNDEFINED = String(undefined);\n\nexport const NullNode = Object.freeze(new Literal<null>(null)) as Literal<null>;\nexport const UndefinedNode = Object.freeze(new Literal<undefined>(undefined)) as Literal<undefined>;\nexport const TrueNode = Object.freeze(new Literal<boolean>(true)) as Literal<boolean>;\nexport const FalseNode = Object.freeze(new Literal<boolean>(false)) as Literal<boolean>;\nexport const ThisNode = Object.freeze(new ThisExpression()) as ThisExpression;\nexport const GlobalThisNode = Object.freeze(new Identifier('globalThis')) as Identifier;\nexport const SymbolNode = Object.freeze(new Identifier('Symbol')) as Identifier;\nexport const OfNode = Object.freeze(new Identifier('of')) as Identifier;\nexport const AsNode = Object.freeze(new Identifier('as')) as Identifier;\nexport const DefaultNode = Object.freeze(new Identifier('default')) as Identifier;\nexport const GetIdentifier = Object.freeze(new Identifier('get')) as Identifier;\nexport const SetIdentifier = Object.freeze(new Identifier('set')) as Identifier;\nexport const AsyncIdentifier = Object.freeze(new Identifier('async')) as Identifier;\nexport const AwaitIdentifier = Object.freeze(new Identifier('await')) as Identifier;\nexport const ConstructorIdentifier = Object.freeze(new Identifier('constructor')) as Identifier;\nexport const NameIdentifier = Object.freeze(new Identifier('name')) as Identifier;\nexport const EvalIdentifier = Object.freeze(new Identifier('eval')) as Identifier;\nexport const ArgumentsIdentifier = Object.freeze(new Identifier('arguments')) as Identifier;\nexport const YieldIdentifier = Object.freeze(new Identifier('yield')) as Identifier;\nexport const SuperIdentifier = Object.freeze(new Identifier('super')) as Identifier;\nexport const LetIdentifier = Object.freeze(new Identifier('let')) as Identifier;\n"]}
@@ -1,5 +1,11 @@
1
- import type { ExpressionNode } from '../expression.js';
1
+ import type { ExpressionNode, ExpressionNodConstructor } from '../expression.js';
2
2
  export declare function Deserializer(type: string): Function;
3
+ export declare function getDeserializerType(target: ExpressionNodConstructor<ExpressionNode>): string;
3
4
  export declare function serializeNode(node: ExpressionNode): string;
5
+ /**
6
+ * convert from json expression `JSON.stringify(node)` or `serializeNode` to `ExpressionNode`
7
+ * @param node as type `NodeJsonType`
8
+ * @returns ExpressionNode
9
+ */
4
10
  export declare function deserialize(node: ExpressionNode): ExpressionNode;
5
11
  export declare function deserializeNode(node: string): ExpressionNode;
@@ -1,14 +1,22 @@
1
1
  import { expressionTypes } from './type-store.js';
2
2
  export function Deserializer(type) {
3
3
  return (target) => {
4
- Reflect.set(target, 'type', type);
4
+ target.type = type;
5
5
  expressionTypes.set(type, target);
6
6
  return target;
7
7
  };
8
8
  }
9
+ export function getDeserializerType(target) {
10
+ return target.type;
11
+ }
9
12
  export function serializeNode(node) {
10
13
  return JSON.stringify(node);
11
14
  }
15
+ /**
16
+ * convert from json expression `JSON.stringify(node)` or `serializeNode` to `ExpressionNode`
17
+ * @param node as type `NodeJsonType`
18
+ * @returns ExpressionNode
19
+ */
12
20
  export function deserialize(node) {
13
21
  const fromJSON = expressionTypes.get(node.type)?.fromJSON;
14
22
  if (fromJSON) {
@@ -1 +1 @@
1
- {"version":3,"file":"deserialize.js","sourceRoot":"","sources":["../../../../src/expressions/api/deserialize/deserialize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,UAAU,YAAY,CAAC,IAAY;IACxC,OAAO,CAAC,MAA8C,EAAE,EAAE;QACzD,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QACjC,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAClC,OAAO,MAAM,CAAC;IACf,CAAC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAoB;IACjD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAQD,MAAM,UAAU,WAAW,CAAC,IAAoB;IAC/C,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAO,IAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IACjE,IAAI,QAAQ,EAAE;QACb,OAAO,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;KACnC;SAAM;QACN,MAAM,IAAI,KAAK,CAAC,4CAA4C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACrF;AACF,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC","sourcesContent":["import type { ExpressionNode, NodeExpressionWithType } from '../expression.js';\nimport { expressionTypes } from './type-store.js';\n\n\n\nexport function Deserializer(type: string): Function {\n\treturn (target: NodeExpressionWithType<ExpressionNode>) => {\n\t\tReflect.set(target, 'type', type)\n\t\texpressionTypes.set(type, target);\n\t\treturn target;\n\t};\n}\n\nexport function serializeNode(node: ExpressionNode) {\n\treturn JSON.stringify(node);\n}\n\n\n/**\n * convert from json expression `JSON.stringify(node)` or `serializeNode` to `ExpressionNode`\n * @param node as type `NodeJsonType`\n * @returns ExpressionNode\n */\nexport function deserialize(node: ExpressionNode) {\n\tconst fromJSON = expressionTypes.get((<any>node).type)?.fromJSON;\n\tif (fromJSON) {\n\t\treturn fromJSON(node, deserialize);\n\t} else {\n\t\tthrow new Error(`Couldn't find Expression class for name: ${JSON.stringify(node)}.`);\n\t}\n}\n\nexport function deserializeNode(node: string) {\n\tconst exp = JSON.parse(node);\n\treturn deserialize(exp);\n}\n"]}
1
+ {"version":3,"file":"deserialize.js","sourceRoot":"","sources":["../../../../src/expressions/api/deserialize/deserialize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,UAAU,YAAY,CAAC,IAAY;IACxC,OAAO,CAAC,MAAgD,EAAE,EAAE;QAC3D,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAClC,OAAO,MAAM,CAAC;IACf,CAAC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAgD;IACnF,OAAO,MAAM,CAAC,IAAI,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAoB;IACjD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAGD;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAoB;IAC/C,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAO,IAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IACjE,IAAI,QAAQ,EAAE;QACb,OAAO,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;KACnC;SAAM;QACN,MAAM,IAAI,KAAK,CAAC,4CAA4C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACrF;AACF,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC","sourcesContent":["import type { ExpressionNode, ExpressionNodConstructor } from '../expression.js';\nimport { expressionTypes } from './type-store.js';\n\n\n\nexport function Deserializer(type: string): Function {\n\treturn (target: ExpressionNodConstructor<ExpressionNode>) => {\n\t\ttarget.type = type;\n\t\texpressionTypes.set(type, target);\n\t\treturn target;\n\t};\n}\n\nexport function getDeserializerType(target: ExpressionNodConstructor<ExpressionNode>) {\n\treturn target.type;\n}\n\nexport function serializeNode(node: ExpressionNode) {\n\treturn JSON.stringify(node);\n}\n\n\n/**\n * convert from json expression `JSON.stringify(node)` or `serializeNode` to `ExpressionNode`\n * @param node as type `NodeJsonType`\n * @returns ExpressionNode\n */\nexport function deserialize(node: ExpressionNode) {\n\tconst fromJSON = expressionTypes.get((<any>node).type)?.fromJSON;\n\tif (fromJSON) {\n\t\treturn fromJSON(node, deserialize);\n\t} else {\n\t\tthrow new Error(`Couldn't find Expression class for name: ${JSON.stringify(node)}.`);\n\t}\n}\n\nexport function deserializeNode(node: string) {\n\tconst exp = JSON.parse(node);\n\treturn deserialize(exp);\n}\n"]}
@@ -1,2 +1,2 @@
1
- import type { ExpressionNode, NodeExpressionWithType } from '../expression.js';
2
- export declare const expressionTypes: Map<string, NodeExpressionWithType<ExpressionNode>>;
1
+ import type { ExpressionNode, ExpressionNodConstructor } from '../expression.js';
2
+ export declare const expressionTypes: Map<string, ExpressionNodConstructor<ExpressionNode>>;
@@ -1 +1 @@
1
- {"version":3,"file":"type-store.js","sourceRoot":"","sources":["../../../../src/expressions/api/deserialize/type-store.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,eAAe,GAAwD,IAAI,GAAG,EAAE,CAAC","sourcesContent":["import type { ExpressionNode, NodeExpressionWithType } from '../expression.js';\n\n\nexport const expressionTypes: Map<string, NodeExpressionWithType<ExpressionNode>> = new Map();\n"]}
1
+ {"version":3,"file":"type-store.js","sourceRoot":"","sources":["../../../../src/expressions/api/deserialize/type-store.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,eAAe,GAA0D,IAAI,GAAG,EAAE,CAAC","sourcesContent":["import type { ExpressionNode, ExpressionNodConstructor } from '../expression.js';\n\n\nexport const expressionTypes: Map<string, ExpressionNodConstructor<ExpressionNode>> = new Map();\n"]}