@aurelia/expression-parser
Advanced tools
Comparing version 2.0.1-dev.202411141142 to 2.0.1-dev.202501261023
@@ -6,2 +6,17 @@ # Change Log | ||
<a name="2.0.0-beta.23"></a> | ||
# 2.0.0-beta.23 (2025-01-26) | ||
### Features: | ||
* **tooling:** type-checking for templates - Phase1 (#2066) ([ebc1d0c](https://github.com/aurelia/aurelia/commit/ebc1d0c)) | ||
* **templating:** support exponentiation operator (#2070) ([373a656](https://github.com/aurelia/aurelia/commit/373a656)) | ||
* **expression-parser:** NewExpression (#2068) ([ae15ed8](https://github.com/aurelia/aurelia/commit/ae15ed8)) | ||
* **expression-parser:** impl NewExpression ([ae15ed8](https://github.com/aurelia/aurelia/commit/ae15ed8)) | ||
### Refactorings: | ||
* **ast.eval:** remove loose mode ([ae15ed8](https://github.com/aurelia/aurelia/commit/ae15ed8)) | ||
<a name="2.0.0-beta.22"></a> | ||
@@ -8,0 +23,0 @@ # 2.0.0-beta.22 (2024-09-30) |
import type { IVisitor } from './ast.visitor'; | ||
export type ExpressionKind = 'AccessThis' | 'AccessGlobal' | 'AccessBoundary' | 'AccessScope' | 'ArrayLiteral' | 'ObjectLiteral' | 'PrimitiveLiteral' | 'Template' | 'Unary' | 'CallScope' | 'CallMember' | 'CallFunction' | 'CallGlobal' | 'AccessMember' | 'AccessKeyed' | 'TaggedTemplate' | 'Binary' | 'Conditional' | 'Assign' | 'ArrowFunction' | 'ValueConverter' | 'BindingBehavior' | 'ArrayBindingPattern' | 'ObjectBindingPattern' | 'BindingIdentifier' | 'ForOfStatement' | 'Interpolation' | 'ArrayDestructuring' | 'ObjectDestructuring' | 'DestructuringAssignmentLeaf' | 'Custom'; | ||
export type ExpressionKind = 'AccessThis' | 'AccessGlobal' | 'AccessBoundary' | 'AccessScope' | 'ArrayLiteral' | 'ObjectLiteral' | 'PrimitiveLiteral' | 'New' | 'Template' | 'Unary' | 'CallScope' | 'CallMember' | 'CallFunction' | 'CallGlobal' | 'AccessMember' | 'AccessKeyed' | 'TaggedTemplate' | 'Binary' | 'Conditional' | 'Assign' | 'ArrowFunction' | 'ValueConverter' | 'BindingBehavior' | 'ArrayBindingPattern' | 'ObjectBindingPattern' | 'BindingIdentifier' | 'ForOfStatement' | 'Interpolation' | 'ArrayDestructuring' | 'ObjectDestructuring' | 'DestructuringAssignmentLeaf' | 'Custom'; | ||
export type UnaryOperator = 'void' | 'typeof' | '!' | '-' | '+' | '++' | '--'; | ||
export type BinaryOperator = '??' | '&&' | '||' | '==' | '===' | '!=' | '!==' | 'instanceof' | 'in' | '+' | '-' | '*' | '/' | '%' | '<' | '>' | '<=' | '>='; | ||
export type BinaryOperator = '??' | '&&' | '||' | '==' | '===' | '!=' | '!==' | 'instanceof' | 'in' | '+' | '-' | '*' | '/' | '%' | '**' | '<' | '>' | '<=' | '>='; | ||
export type AssignmentOperator = '=' | '/=' | '*=' | '+=' | '-='; | ||
export type IsPrimary = AccessThisExpression | AccessBoundaryExpression | AccessScopeExpression | AccessGlobalExpression | ArrayLiteralExpression | ObjectLiteralExpression | PrimitiveLiteralExpression | TemplateExpression; | ||
export type IsPrimary = AccessThisExpression | AccessBoundaryExpression | AccessScopeExpression | AccessGlobalExpression | ArrayLiteralExpression | ObjectLiteralExpression | PrimitiveLiteralExpression | TemplateExpression | NewExpression; | ||
export type IsLiteral = ArrayLiteralExpression | ObjectLiteralExpression | PrimitiveLiteralExpression | TemplateExpression; | ||
@@ -97,2 +97,8 @@ export type IsLeftHandSide = IsPrimary | CallGlobalExpression | CallFunctionExpression | CallMemberExpression | CallScopeExpression | AccessMemberExpression | AccessKeyedExpression | TaggedTemplateExpression; | ||
} | ||
export declare class NewExpression { | ||
readonly func: IsLeftHandSide; | ||
readonly args: readonly IsAssign[]; | ||
readonly $kind = "New"; | ||
constructor(func: IsLeftHandSide, args: readonly IsAssign[]); | ||
} | ||
export declare class CallScopeExpression { | ||
@@ -99,0 +105,0 @@ readonly name: string; |
@@ -31,6 +31,8 @@ import { CustomExpression, ForOfStatement, Interpolation, AnyBindingExpression, IsBindingBehavior } from './ast'; | ||
Multiplicative = 512, | ||
Binary = 513, | ||
LeftHandSide = 514, | ||
Primary = 515, | ||
Unary = 516 | ||
Exponentiation = 576, | ||
Binary = 577, | ||
Member = 578, | ||
LeftHandSide = 579, | ||
Primary = 580, | ||
Unary = 581 | ||
} | ||
@@ -37,0 +39,0 @@ export type ExpressionType = 'None' | 'Interpolation' | 'IsIterator' | 'IsChainable' | 'IsFunction' | 'IsProperty' | 'IsCustom'; |
@@ -1,4 +0,4 @@ | ||
export { type ExpressionKind, CallFunctionExpression, CallGlobalExpression, CustomExpression, BindingBehaviorExpression, ValueConverterExpression, AssignExpression, ConditionalExpression, AccessThisExpression, AccessGlobalExpression, AccessScopeExpression, AccessBoundaryExpression, AccessMemberExpression, AccessKeyedExpression, CallScopeExpression, CallMemberExpression, BinaryExpression, UnaryExpression, PrimitiveLiteralExpression, ArrayLiteralExpression, ObjectLiteralExpression, TemplateExpression, TaggedTemplateExpression, ArrayBindingPattern, ObjectBindingPattern, BindingIdentifier, ForOfStatement, Interpolation, DestructuringAssignmentExpression, DestructuringAssignmentSingleExpression, DestructuringAssignmentRestExpression, ArrowFunction, type AnyBindingExpression, type IsPrimary, type IsLiteral, type IsLeftHandSide, type IsUnary, type IsBinary, type IsConditional, type IsAssign, type IsValueConverter, type IsBindingBehavior, type IsAssignable, type IsExpression, type IsExpressionOrStatement, type BinaryOperator, type AssignmentOperator, type BindingIdentifierOrPattern, type UnaryOperator, } from './ast'; | ||
export { type ExpressionKind, CallFunctionExpression, CallGlobalExpression, CustomExpression, BindingBehaviorExpression, ValueConverterExpression, AssignExpression, ConditionalExpression, AccessThisExpression, AccessGlobalExpression, AccessScopeExpression, AccessBoundaryExpression, AccessMemberExpression, AccessKeyedExpression, CallScopeExpression, CallMemberExpression, BinaryExpression, UnaryExpression, PrimitiveLiteralExpression, ArrayLiteralExpression, ObjectLiteralExpression, TemplateExpression, TaggedTemplateExpression, ArrayBindingPattern, ObjectBindingPattern, BindingIdentifier, ForOfStatement, Interpolation, DestructuringAssignmentExpression, DestructuringAssignmentSingleExpression, DestructuringAssignmentRestExpression, ArrowFunction, NewExpression, type AnyBindingExpression, type IsPrimary, type IsLiteral, type IsLeftHandSide, type IsUnary, type IsBinary, type IsConditional, type IsAssign, type IsValueConverter, type IsBindingBehavior, type IsAssignable, type IsExpression, type IsExpressionOrStatement, type BinaryOperator, type AssignmentOperator, type BindingIdentifierOrPattern, type UnaryOperator, } from './ast'; | ||
export { astVisit, type IVisitor, Unparser } from './ast.visitor'; | ||
export { IExpressionParser, ExpressionParser, type ExpressionType, parseExpression, } from './expression-parser'; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@aurelia/expression-parser", | ||
"version": "2.0.1-dev.202411141142", | ||
"version": "2.0.1-dev.202501261023", | ||
"main": "dist/cjs/index.cjs", | ||
@@ -56,3 +56,3 @@ "module": "dist/esm/index.mjs", | ||
"dependencies": { | ||
"@aurelia/kernel": "2.0.1-dev.202411141142" | ||
"@aurelia/kernel": "2.0.1-dev.202501261023" | ||
}, | ||
@@ -63,4 +63,4 @@ "devDependencies": { | ||
"engines": { | ||
"node": ">=14.17.0" | ||
"node": ">=20.16.0" | ||
} | ||
} |
@@ -12,2 +12,3 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
/** @internal */ export const ekPrimitiveLiteral = 'PrimitiveLiteral'; | ||
/** @internal */ export const ekNew = 'New'; | ||
/** @internal */ export const ekTemplate = 'Template'; | ||
@@ -46,2 +47,3 @@ /** @internal */ export const ekUnary = 'Unary'; | ||
| 'PrimitiveLiteral' | ||
| 'New' | ||
| 'Template' | ||
@@ -74,5 +76,5 @@ | 'Unary' | ||
export type BinaryOperator = '??' | '&&' | '||' | '==' | '===' | '!=' | '!==' | 'instanceof' | 'in' | '+' | '-' | '*' | '/' | '%' | '<' | '>' | '<=' | '>='; | ||
export type BinaryOperator = '??' | '&&' | '||' | '==' | '===' | '!=' | '!==' | 'instanceof' | 'in' | '+' | '-' | '*' | '/' | '%' | '**' | '<' | '>' | '<=' | '>='; | ||
export type AssignmentOperator = '=' | '/=' | '*=' | '+=' | '-='; | ||
export type IsPrimary = AccessThisExpression | AccessBoundaryExpression | AccessScopeExpression | AccessGlobalExpression | ArrayLiteralExpression | ObjectLiteralExpression | PrimitiveLiteralExpression | TemplateExpression; | ||
export type IsPrimary = AccessThisExpression | AccessBoundaryExpression | AccessScopeExpression | AccessGlobalExpression | ArrayLiteralExpression | ObjectLiteralExpression | PrimitiveLiteralExpression | TemplateExpression | NewExpression; | ||
export type IsLiteral = ArrayLiteralExpression | ObjectLiteralExpression | PrimitiveLiteralExpression | TemplateExpression; | ||
@@ -224,2 +226,10 @@ export type IsLeftHandSide = IsPrimary | CallGlobalExpression | CallFunctionExpression | CallMemberExpression | CallScopeExpression | AccessMemberExpression | AccessKeyedExpression | TaggedTemplateExpression; | ||
export class NewExpression { | ||
public readonly $kind = ekNew; | ||
public constructor( | ||
public readonly func: IsLeftHandSide, | ||
public readonly args: readonly IsAssign[], | ||
) {} | ||
} | ||
export class CallScopeExpression { | ||
@@ -226,0 +236,0 @@ public readonly $kind = ekCallScope; |
@@ -253,11 +253,8 @@ import { | ||
public visitCallMember(expr: CallMemberExpression): void { | ||
this.text += '('; | ||
astVisit(expr.object, this); | ||
this.text += `${expr.optionalMember ? '?.' : ''}.${expr.name}${expr.optionalCall ? '?.' : ''}`; | ||
this.writeArgs(expr.args); | ||
this.text += ')'; | ||
} | ||
public visitCallScope(expr: CallScopeExpression): void { | ||
this.text += '('; | ||
let i = expr.ancestor; | ||
@@ -269,3 +266,2 @@ while (i--) { | ||
this.writeArgs(expr.args); | ||
this.text += ')'; | ||
} | ||
@@ -272,0 +268,0 @@ |
@@ -35,2 +35,3 @@ export { | ||
ArrowFunction, | ||
NewExpression, | ||
@@ -37,0 +38,0 @@ // ast typing helpers |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
16057
774040
+ Added@aurelia/kernel@2.0.1-dev.202501261023(transitive)
+ Added@aurelia/metadata@2.0.1-dev.202501261023(transitive)
+ Added@aurelia/platform@2.0.1-dev.202501261023(transitive)
- Removed@aurelia/kernel@2.0.1-dev.202411141142(transitive)
- Removed@aurelia/metadata@2.0.1-dev.202411141142(transitive)
- Removed@aurelia/platform@2.0.1-dev.202411141142(transitive)