@aeriajs/compiler 0.0.29 → 0.0.31

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/ast.d.ts CHANGED
@@ -69,6 +69,7 @@ export type CollectionNode = NodeBase<'collection'> & {
69
69
  presets?: DescriptionPreset[];
70
70
  form?: string[];
71
71
  table?: string[];
72
+ tableMeta?: string[];
72
73
  filters?: string[];
73
74
  search?: SearchOptions<any>;
74
75
  layout?: LayoutNode;
package/dist/lexer.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type Token } from './token.js';
2
2
  import { Diagnostic } from './diagnostic.js';
3
- export declare const COLLECTION_KEYWORDS: readonly ["actions", "additionalProperties", "filters", "form", "formLayout", "functions", "icon", "indexes", "individualActions", "layout", "owned", "presets", "properties", "required", "search", "table"];
3
+ export declare const COLLECTION_KEYWORDS: readonly ["actions", "additionalProperties", "filters", "form", "formLayout", "functions", "icon", "indexes", "individualActions", "layout", "owned", "presets", "properties", "required", "search", "table", "tableMeta"];
4
4
  export declare const COLLECTION_ACTIONS_KEYWORDS: readonly ["ask", "button", "clearItem", "effect", "event", "fetchItem", "function", "icon", "label", "params", "query", "requires", "roles", "route", "selection", "setItem", "translate"];
5
5
  export declare const COLLECTION_SEARCH_KEYWORDS: readonly ["indexes", "placeholder", "exactMatches"];
6
6
  export declare const COLLECTION_LAYOUT_KEYWORDS: readonly ["name", "options"];
package/dist/lexer.js CHANGED
@@ -20,6 +20,7 @@ exports.COLLECTION_KEYWORDS = [
20
20
  'required',
21
21
  'search',
22
22
  'table',
23
+ 'tableMeta',
23
24
  ];
24
25
  exports.COLLECTION_ACTIONS_KEYWORDS = [
25
26
  'ask',
@@ -175,11 +176,12 @@ const TOKENS = [
175
176
  type: token_js_1.TokenType.Keyword,
176
177
  matcher: Array.from(keywordsSet),
177
178
  condition: (state, lastToken) => {
178
- if (state.variableScopeStack.at(-1)) {
179
+ if (state.variableScopeStack.at(-1) || state.variableExpressionStack.at(-1)) {
179
180
  return false;
180
181
  }
181
182
  if (lastToken && lastToken.type === token_js_1.TokenType.Keyword) {
182
183
  switch (lastToken.value) {
184
+ case 'if':
183
185
  case 'badge':
184
186
  case 'title': {
185
187
  return false;
@@ -216,6 +218,7 @@ const tokenize = function (rawInput) {
216
218
  const errors = [];
217
219
  const state = {
218
220
  variableScopeStack: [],
221
+ variableExpressionStack: [],
219
222
  };
220
223
  while (index < input.length) {
221
224
  let hasMatch = false;
@@ -292,6 +295,7 @@ const tokenize = function (rawInput) {
292
295
  case 'information':
293
296
  case 'form':
294
297
  case 'table':
298
+ case 'tableMeta':
295
299
  case 'indexes':
296
300
  case 'filters':
297
301
  case 'writable':
@@ -305,12 +309,40 @@ const tokenize = function (rawInput) {
305
309
  state.variableScopeStack.push(variableScope);
306
310
  break;
307
311
  }
312
+ case token_js_1.TokenType.LeftParens: {
313
+ let variableExpression = false;
314
+ if (lastToken) {
315
+ switch (lastToken.type) {
316
+ case token_js_1.TokenType.Keyword: {
317
+ switch (lastToken.value) {
318
+ case 'if': {
319
+ variableExpression = true;
320
+ break;
321
+ }
322
+ }
323
+ break;
324
+ }
325
+ case token_js_1.TokenType.Operator: {
326
+ variableExpression = true;
327
+ break;
328
+ }
329
+ }
330
+ }
331
+ state.variableExpressionStack.push(variableExpression);
332
+ break;
333
+ }
308
334
  case token_js_1.TokenType.RightBracket: {
309
335
  if (state.variableScopeStack.length > 0) {
310
336
  state.variableScopeStack.pop();
311
337
  }
312
338
  break;
313
339
  }
340
+ case token_js_1.TokenType.RightParens: {
341
+ if (state.variableScopeStack.length > 0) {
342
+ state.variableExpressionStack.pop();
343
+ }
344
+ break;
345
+ }
314
346
  }
315
347
  tokens.push(token);
316
348
  }
package/dist/lexer.mjs CHANGED
@@ -17,7 +17,8 @@ export const COLLECTION_KEYWORDS = [
17
17
  "properties",
18
18
  "required",
19
19
  "search",
20
- "table"
20
+ "table",
21
+ "tableMeta"
21
22
  ];
22
23
  export const COLLECTION_ACTIONS_KEYWORDS = [
23
24
  "ask",
@@ -183,11 +184,12 @@ const TOKENS = [
183
184
  type: TokenType.Keyword,
184
185
  matcher: Array.from(keywordsSet),
185
186
  condition: (state, lastToken) => {
186
- if (state.variableScopeStack.at(-1)) {
187
+ if (state.variableScopeStack.at(-1) || state.variableExpressionStack.at(-1)) {
187
188
  return false;
188
189
  }
189
190
  if (lastToken && lastToken.type === TokenType.Keyword) {
190
191
  switch (lastToken.value) {
192
+ case "if":
191
193
  case "badge":
192
194
  case "title": {
193
195
  return false;
@@ -223,7 +225,8 @@ export const tokenize = function(rawInput) {
223
225
  const tokens = [];
224
226
  const errors = [];
225
227
  const state = {
226
- variableScopeStack: []
228
+ variableScopeStack: [],
229
+ variableExpressionStack: []
227
230
  };
228
231
  while (index < input.length) {
229
232
  let hasMatch = false;
@@ -295,6 +298,7 @@ export const tokenize = function(rawInput) {
295
298
  case "information":
296
299
  case "form":
297
300
  case "table":
301
+ case "tableMeta":
298
302
  case "indexes":
299
303
  case "filters":
300
304
  case "writable":
@@ -308,12 +312,40 @@ export const tokenize = function(rawInput) {
308
312
  state.variableScopeStack.push(variableScope);
309
313
  break;
310
314
  }
315
+ case TokenType.LeftParens: {
316
+ let variableExpression = false;
317
+ if (lastToken) {
318
+ switch (lastToken.type) {
319
+ case TokenType.Keyword: {
320
+ switch (lastToken.value) {
321
+ case "if": {
322
+ variableExpression = true;
323
+ break;
324
+ }
325
+ }
326
+ break;
327
+ }
328
+ case TokenType.Operator: {
329
+ variableExpression = true;
330
+ break;
331
+ }
332
+ }
333
+ }
334
+ state.variableExpressionStack.push(variableExpression);
335
+ break;
336
+ }
311
337
  case TokenType.RightBracket: {
312
338
  if (state.variableScopeStack.length > 0) {
313
339
  state.variableScopeStack.pop();
314
340
  }
315
341
  break;
316
342
  }
343
+ case TokenType.RightParens: {
344
+ if (state.variableScopeStack.length > 0) {
345
+ state.variableExpressionStack.pop();
346
+ }
347
+ break;
348
+ }
317
349
  }
318
350
  tokens.push(token);
319
351
  }
package/dist/parser.js CHANGED
@@ -256,6 +256,10 @@ const parse = (tokens) => {
256
256
  property[attributeName] = value;
257
257
  return;
258
258
  }
259
+ case 'translate': {
260
+ property[attributeName] = consumeBoolean();
261
+ return;
262
+ }
259
263
  }
260
264
  if ('$ref' in property) {
261
265
  switch (attributeName) {
@@ -718,6 +722,7 @@ const parse = (tokens) => {
718
722
  case 'indexes':
719
723
  case 'form':
720
724
  case 'table':
725
+ case 'tableMeta':
721
726
  case 'filters': {
722
727
  const { value, symbols } = parseArrayBlock();
723
728
  node[keyword] = value;
package/dist/parser.mjs CHANGED
@@ -215,6 +215,10 @@ export const parse = (tokens) => {
215
215
  property[attributeName] = value;
216
216
  return;
217
217
  }
218
+ case "translate": {
219
+ property[attributeName] = consumeBoolean();
220
+ return;
221
+ }
218
222
  }
219
223
  if ("$ref" in property) {
220
224
  switch (attributeName) {
@@ -663,6 +667,7 @@ export const parse = (tokens) => {
663
667
  case "indexes":
664
668
  case "form":
665
669
  case "table":
670
+ case "tableMeta":
666
671
  case "filters": {
667
672
  const { value, symbols } = parseArrayBlock();
668
673
  node[keyword] = value;
package/dist/semantic.js CHANGED
@@ -135,6 +135,7 @@ const analyze = async (ast, options, errors = []) => {
135
135
  await checkCollectionLocalProperties(node, 'filters');
136
136
  await checkCollectionLocalProperties(node, 'form');
137
137
  await checkCollectionLocalProperties(node, 'table');
138
+ await checkCollectionLocalProperties(node, 'tableMeta');
138
139
  for (const propName in node.properties) {
139
140
  const subNode = node.properties[propName];
140
141
  await recurseProperty(subNode);
package/dist/semantic.mjs CHANGED
@@ -98,6 +98,7 @@ export const analyze = async (ast, options, errors = []) => {
98
98
  await checkCollectionLocalProperties(node, "filters");
99
99
  await checkCollectionLocalProperties(node, "form");
100
100
  await checkCollectionLocalProperties(node, "table");
101
+ await checkCollectionLocalProperties(node, "tableMeta");
101
102
  for (const propName in node.properties) {
102
103
  const subNode = node.properties[propName];
103
104
  await recurseProperty(subNode);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/compiler",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",