@journeyapps/evaluator
Advanced tools
Comparing version 0.0.0-dev.7aafced to 0.0.0-dev.7fb6064
@@ -44,4 +44,8 @@ import { AttributeValidationError } from '@journeyapps/core-xml'; | ||
}; | ||
/** | ||
* Removes one set of curly braces from the string. | ||
* Example {{foo}} -> {foo} | ||
*/ | ||
static unescape(s: string): string; | ||
} | ||
export declare const parseEnclosingBraces: typeof FormatString.parseEnclosingBraces; |
@@ -8,3 +8,3 @@ export * from './parsers'; | ||
export * from './definitions/FormatStringScope'; | ||
export * from './scope/VariableFormatStringScope'; | ||
export * from './definitions/VariableFormatStringScope'; | ||
export * from './tools'; |
import { Node, Aliases } from '@babel/types'; | ||
import { TokenExpression } from '../token-expressions'; | ||
import { ParseNodeEvent } from '../TokenExpressionParser'; | ||
export type NodeType = Node['type'] | keyof Aliases; | ||
export interface ExpressionNodeEvent<N extends Node = Node> { | ||
source: string; | ||
node: N; | ||
parseNode(node: Node, source: string): TokenExpression | null; | ||
export interface ExpressionNodeParseEvent<N extends Node = Node> extends ParseNodeEvent<N> { | ||
parseNode(event: ParseNodeEvent): TokenExpression | null; | ||
} | ||
export interface AbstractExpressionParserOptions { | ||
} | ||
export declare abstract class AbstractExpressionParser<N extends Node = Node, T extends TokenExpression = TokenExpression, O extends AbstractExpressionParserOptions = AbstractExpressionParserOptions, E extends ExpressionNodeEvent<N> = ExpressionNodeEvent<N>> { | ||
export declare abstract class AbstractExpressionParser<N extends Node = Node, T extends TokenExpression = TokenExpression, O extends AbstractExpressionParserOptions = AbstractExpressionParserOptions, E extends ExpressionNodeParseEvent<N> = ExpressionNodeParseEvent<N>> { | ||
options: O; | ||
@@ -13,0 +12,0 @@ constructor(options?: O); |
@@ -1,6 +0,5 @@ | ||
import { BlockStatement, Statement } from '@babel/types'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeEvent } from './AbstractExpressionParser'; | ||
import { BlockStatement } from '@babel/types'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeParseEvent } from './AbstractExpressionParser'; | ||
export declare class BlockStatementParser extends AbstractExpressionParser<BlockStatement> { | ||
parse(event: ExpressionNodeEvent<BlockStatement>): import("../token-expressions").TokenExpression<import("../token-expressions").TokenExpressionOptions, any>; | ||
getFormatSpecifier(stm: Statement | null): string; | ||
parse(event: ExpressionNodeParseEvent<BlockStatement>): import("../token-expressions").TokenExpression<import("../token-expressions").TokenExpressionOptions, any>; | ||
} | ||
@@ -7,0 +6,0 @@ export declare class BlockStatementParserFactory extends ExpressionParserFactory<BlockStatementParser> { |
import { CallExpression } from '@babel/types'; | ||
import { FunctionTokenExpression } from '../token-expressions'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeEvent } from './AbstractExpressionParser'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeParseEvent } from './AbstractExpressionParser'; | ||
export declare class CallExpressionParser extends AbstractExpressionParser<CallExpression, FunctionTokenExpression> { | ||
parse(event: ExpressionNodeEvent<CallExpression>): FunctionTokenExpression; | ||
parse(event: ExpressionNodeParseEvent<CallExpression>): FunctionTokenExpression; | ||
} | ||
@@ -7,0 +7,0 @@ export declare class CallExpressionParserFactory extends ExpressionParserFactory<CallExpressionParser> { |
import { ConditionalExpression } from '@babel/types'; | ||
import { FunctionTokenExpression } from '../token-expressions'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeEvent } from './AbstractExpressionParser'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeParseEvent } from './AbstractExpressionParser'; | ||
export declare class ConditionalExpressionParser extends AbstractExpressionParser<ConditionalExpression, FunctionTokenExpression> { | ||
parse(event: ExpressionNodeEvent<ConditionalExpression>): FunctionTokenExpression; | ||
parse(event: ExpressionNodeParseEvent<ConditionalExpression>): FunctionTokenExpression; | ||
} | ||
@@ -7,0 +7,0 @@ export declare class ConditionalExpressionParserFactory extends ExpressionParserFactory<ConditionalExpressionParser> { |
import { Directive, ExpressionStatement, LabeledStatement } from '@babel/types'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeEvent } from './AbstractExpressionParser'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeParseEvent } from './AbstractExpressionParser'; | ||
export type ExpressionType = ExpressionStatement | Directive | LabeledStatement; | ||
export declare class ExpressionNodeParser extends AbstractExpressionParser<ExpressionType> { | ||
parse(event: ExpressionNodeEvent<ExpressionType>): import("..").TokenExpression<import("..").TokenExpressionOptions, any>; | ||
parse(event: ExpressionNodeParseEvent<ExpressionType>): import("..").TokenExpression<import("..").TokenExpressionOptions, any>; | ||
} | ||
@@ -7,0 +7,0 @@ export declare class ExpressionNodeParserFactory extends ExpressionParserFactory<ExpressionNodeParser> { |
import { Identifier } from '@babel/types'; | ||
import { FormatShorthandTokenExpression, FunctionTokenExpression, ShorthandTokenExpression } from '../token-expressions'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeEvent } from './AbstractExpressionParser'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeParseEvent } from './AbstractExpressionParser'; | ||
export type IdentifierExpressionParsedType = FunctionTokenExpression | ShorthandTokenExpression | FormatShorthandTokenExpression; | ||
export declare class IdentifierExpressionParser extends AbstractExpressionParser<Identifier, IdentifierExpressionParsedType> { | ||
parse(event: ExpressionNodeEvent<Identifier>): FunctionTokenExpression | ShorthandTokenExpression<{ | ||
parse(event: ExpressionNodeParseEvent<Identifier>): FunctionTokenExpression | ShorthandTokenExpression<{ | ||
expression: string; | ||
@@ -8,0 +8,0 @@ }>; |
import { DirectiveLiteral, Literal } from '@babel/types'; | ||
import { ConstantTokenExpression } from '../token-expressions'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeEvent } from './AbstractExpressionParser'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeParseEvent } from './AbstractExpressionParser'; | ||
export type LiteralExpression = Literal | DirectiveLiteral; | ||
export declare class LiteralExpressionParser extends AbstractExpressionParser<LiteralExpression, ConstantTokenExpression> { | ||
parse(event: ExpressionNodeEvent<LiteralExpression>): ConstantTokenExpression; | ||
parse(event: ExpressionNodeParseEvent<LiteralExpression>): ConstantTokenExpression; | ||
} | ||
@@ -8,0 +8,0 @@ export declare class LiteralExpressionParserFactory extends ExpressionParserFactory<LiteralExpressionParser> { |
import { MemberExpression } from '@babel/types'; | ||
import { FormatShorthandTokenExpression, FunctionTokenExpression, ShorthandTokenExpression } from '../token-expressions'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeEvent } from './AbstractExpressionParser'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeParseEvent } from './AbstractExpressionParser'; | ||
export type MemberExpressionParsedType = FunctionTokenExpression | ShorthandTokenExpression | FormatShorthandTokenExpression; | ||
export declare class MemberExpressionParser extends AbstractExpressionParser<MemberExpression, MemberExpressionParsedType> { | ||
parse(event: ExpressionNodeEvent<MemberExpression>): FunctionTokenExpression | ShorthandTokenExpression<{ | ||
parse(event: ExpressionNodeParseEvent<MemberExpression>): FunctionTokenExpression | ShorthandTokenExpression<{ | ||
expression: string; | ||
@@ -8,0 +8,0 @@ }>; |
import { ObjectExpression } from '@babel/types'; | ||
import { ObjectTokenExpression } from '../token-expressions'; | ||
import { AbstractExpressionParser, ExpressionNodeEvent, ExpressionParserFactory } from './AbstractExpressionParser'; | ||
import { AbstractExpressionParser, ExpressionNodeParseEvent, ExpressionParserFactory } from './AbstractExpressionParser'; | ||
export declare class ObjectExpressionParser extends AbstractExpressionParser<ObjectExpression, ObjectTokenExpression> { | ||
parse(event: ExpressionNodeEvent<ObjectExpression>): ObjectTokenExpression; | ||
parse(event: ExpressionNodeParseEvent<ObjectExpression>): ObjectTokenExpression; | ||
} | ||
@@ -7,0 +7,0 @@ export declare class ObjectExpressionParserFactory extends ExpressionParserFactory<ObjectExpressionParser> { |
@@ -14,2 +14,3 @@ /** | ||
concat(token: ConstantTokenExpression): ConstantTokenExpression; | ||
tokenEvaluatePromise(scope: FormatStringScope): Promise<string>; | ||
/** | ||
@@ -19,3 +20,3 @@ * Get the value of the constant token expression. | ||
valueOf(): string; | ||
tokenEvaluatePromise(scope: FormatStringScope): Promise<string>; | ||
stringify(): string; | ||
} |
@@ -17,2 +17,3 @@ /** | ||
concat(token: ConstantTokenExpression): ConstantTokenExpression; | ||
stringify(): string; | ||
} |
export * from './TokenExpression'; | ||
export * from './ObjectTokenExpression'; | ||
export * from './ShorthandTokenExpression'; | ||
export * from './FormatShorthandTokenExpression'; | ||
export * from './shorthand/ShorthandTokenExpression'; | ||
export * from './shorthand/FormatShorthandTokenExpression'; | ||
export * from './constant/PrimitiveConstantTokenExpression'; | ||
export * from './constant/ConstantTokenExpression'; | ||
export * from './function-token/FunctionTokenExpression'; | ||
export * from './function-token/LegacyFunctionTokenExpression'; | ||
export * from './function/FunctionTokenExpression'; | ||
export * from './function/LegacyFunctionTokenExpression'; |
/// <reference types="lodash" /> | ||
import { Node } from '@babel/types'; | ||
import { ExpressionParserFactory, NodeType, AbstractExpressionParser } from './parsers'; | ||
import LRUCache from 'lru-cache'; | ||
import { ParseContext, ParseContextFactory } from './context/ParseContext'; | ||
import { AbstractExpressionParser, ExpressionParserFactory, NodeType } from './parsers'; | ||
import { TokenExpression } from './token-expressions'; | ||
export interface TokenExpressionParseEvent { | ||
source: string; | ||
context?: ParseContext; | ||
} | ||
export interface ParseNodeEvent<N extends Node = Node> extends TokenExpressionParseEvent { | ||
node: N; | ||
} | ||
export declare class TokenExpressionParser { | ||
factories: ExpressionParserFactory[]; | ||
static FORMAT_SPECIFIER_IDENTIFIER: string; | ||
cache: LRUCache<string, TokenExpression>; | ||
parserFactories: ExpressionParserFactory[]; | ||
contextFactories: ParseContextFactory[]; | ||
static instance: TokenExpressionParser; | ||
static get(): TokenExpressionParser; | ||
constructor(); | ||
parse<T extends TokenExpression = TokenExpression>(source: string): T | null; | ||
parseNode(node: Node, source: string): TokenExpression | null; | ||
registerFactory(factory: ExpressionParserFactory): void; | ||
parse<T extends TokenExpression = TokenExpression>(event: TokenExpressionParseEvent): T | null; | ||
parseNode(event: ParseNodeEvent): TokenExpression | null; | ||
registerParserFactory(factory: ExpressionParserFactory): void; | ||
registerContextFactory(factory: ParseContextFactory): void; | ||
transformSource(event: TokenExpressionParseEvent): string; | ||
getParser: ((nodeType: NodeType) => AbstractExpressionParser) & import("lodash").MemoizedFunction; | ||
private preprocess; | ||
inferContext(source: string): ParseContext | null; | ||
} |
@@ -24,4 +24,4 @@ "use strict"; | ||
__exportStar(require("./definitions/FormatStringScope"), exports); | ||
__exportStar(require("./scope/VariableFormatStringScope"), exports); | ||
__exportStar(require("./definitions/VariableFormatStringScope"), exports); | ||
__exportStar(require("./tools"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@journeyapps/evaluator", | ||
"version": "0.0.0-dev.7aafced", | ||
"version": "0.0.0-dev.7fb6064", | ||
"description": "Journey Evaluator library", | ||
@@ -8,4 +8,3 @@ "main": "./dist/index.js", | ||
"files": [ | ||
"dist/src", | ||
"dist/@types" | ||
"dist" | ||
], | ||
@@ -15,4 +14,5 @@ "dependencies": { | ||
"@babel/parser": "^7.24.5", | ||
"lru-cache": "^7.18.3", | ||
"lodash": "^4.17.21", | ||
"@journeyapps/core-xml": "0.0.0-dev.7aafced" | ||
"@journeyapps/core-xml": "0.0.0-dev.7fb6064" | ||
}, | ||
@@ -19,0 +19,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
250563
105
2025
5
+ Addedlru-cache@^7.18.3
+ Added@journeyapps/core-xml@0.0.0-dev.7fb6064(transitive)
+ Addedlru-cache@7.18.3(transitive)
- Removed@journeyapps/core-xml@0.0.0-dev.7aafced(transitive)