@ja-platform/parser-expressions 0.0.0-dev-20261021194038 → 0.0.0-stage
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/README.md +2 -111
- package/package.json +3 -37
- package/dist/@types/CombinedParser.d.ts +0 -11
- package/dist/@types/ExpressionParser.d.ts +0 -12
- package/dist/@types/code-parsers/CodeParser.d.ts +0 -25
- package/dist/@types/code-parsers/JavaScriptParser.d.ts +0 -18
- package/dist/@types/definitions/ValidationContext.d.ts +0 -8
- package/dist/@types/expressions/AbstractExpression.d.ts +0 -42
- package/dist/@types/expressions/EvaluatedExpression.d.ts +0 -34
- package/dist/@types/expressions/ListExpression.d.ts +0 -26
- package/dist/@types/expressions/constant/ConstantExpression.d.ts +0 -28
- package/dist/@types/expressions/function/FunctionExpression.d.ts +0 -37
- package/dist/@types/expressions/index.d.ts +0 -9
- package/dist/@types/expressions/shorthand/FormatShorthandExpression.d.ts +0 -31
- package/dist/@types/expressions/shorthand/ShorthandExpression.d.ts +0 -42
- package/dist/@types/expressions/text/AbstractFormatExpression.d.ts +0 -43
- package/dist/@types/expressions/text/FormatStringExpression.d.ts +0 -18
- package/dist/@types/index.d.ts +0 -9
- package/dist/@types/tokens/AbstractToken.d.ts +0 -12
- package/dist/@types/tokens/DelimiterToken.d.ts +0 -10
- package/dist/@types/tokens/EnumToken.d.ts +0 -10
- package/dist/@types/tokens/code/CodeToken.d.ts +0 -142
- package/dist/@types/tokens/code/IdentifierToken.d.ts +0 -12
- package/dist/@types/tokens/code/JSToken.d.ts +0 -31
- package/dist/@types/tokens/code/PrefixToken.d.ts +0 -9
- package/dist/@types/tokens/index.d.ts +0 -10
- package/dist/@types/tokens/text/PlaceholderToken.d.ts +0 -12
- package/dist/@types/tokens/text/TextToken.d.ts +0 -12
- package/dist/@types/utils/parserUtils.d.ts +0 -7
- package/dist/@types/utils/tokenUtils.d.ts +0 -11
- package/dist/@types/utils/valueFormatting.d.ts +0 -9
- package/dist/CombinedParser.js +0 -24
- package/dist/CombinedParser.js.map +0 -1
- package/dist/ExpressionParser.js +0 -20
- package/dist/ExpressionParser.js.map +0 -1
- package/dist/code-parsers/CodeParser.js +0 -45
- package/dist/code-parsers/CodeParser.js.map +0 -1
- package/dist/code-parsers/JavaScriptParser.js +0 -56
- package/dist/code-parsers/JavaScriptParser.js.map +0 -1
- package/dist/definitions/ValidationContext.js +0 -3
- package/dist/definitions/ValidationContext.js.map +0 -1
- package/dist/expressions/AbstractExpression.js +0 -47
- package/dist/expressions/AbstractExpression.js.map +0 -1
- package/dist/expressions/EvaluatedExpression.js +0 -102
- package/dist/expressions/EvaluatedExpression.js.map +0 -1
- package/dist/expressions/ListExpression.js +0 -45
- package/dist/expressions/ListExpression.js.map +0 -1
- package/dist/expressions/constant/ConstantExpression.js +0 -53
- package/dist/expressions/constant/ConstantExpression.js.map +0 -1
- package/dist/expressions/function/FunctionExpression.js +0 -79
- package/dist/expressions/function/FunctionExpression.js.map +0 -1
- package/dist/expressions/index.js +0 -26
- package/dist/expressions/index.js.map +0 -1
- package/dist/expressions/shorthand/FormatShorthandExpression.js +0 -60
- package/dist/expressions/shorthand/FormatShorthandExpression.js.map +0 -1
- package/dist/expressions/shorthand/ShorthandExpression.js +0 -90
- package/dist/expressions/shorthand/ShorthandExpression.js.map +0 -1
- package/dist/expressions/text/AbstractFormatExpression.js +0 -178
- package/dist/expressions/text/AbstractFormatExpression.js.map +0 -1
- package/dist/expressions/text/FormatStringExpression.js +0 -44
- package/dist/expressions/text/FormatStringExpression.js.map +0 -1
- package/dist/index.js +0 -29
- package/dist/index.js.map +0 -1
- package/dist/tokens/AbstractToken.js +0 -22
- package/dist/tokens/AbstractToken.js.map +0 -1
- package/dist/tokens/DelimiterToken.js +0 -22
- package/dist/tokens/DelimiterToken.js.map +0 -1
- package/dist/tokens/EnumToken.js +0 -22
- package/dist/tokens/EnumToken.js.map +0 -1
- package/dist/tokens/code/CodeToken.js +0 -33
- package/dist/tokens/code/CodeToken.js.map +0 -1
- package/dist/tokens/code/IdentifierToken.js +0 -28
- package/dist/tokens/code/IdentifierToken.js.map +0 -1
- package/dist/tokens/code/JSToken.js +0 -251
- package/dist/tokens/code/JSToken.js.map +0 -1
- package/dist/tokens/code/PrefixToken.js +0 -24
- package/dist/tokens/code/PrefixToken.js.map +0 -1
- package/dist/tokens/index.js +0 -33
- package/dist/tokens/index.js.map +0 -1
- package/dist/tokens/text/PlaceholderToken.js +0 -25
- package/dist/tokens/text/PlaceholderToken.js.map +0 -1
- package/dist/tokens/text/TextToken.js +0 -28
- package/dist/tokens/text/TextToken.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/utils/parserUtils.js +0 -19
- package/dist/utils/parserUtils.js.map +0 -1
- package/dist/utils/tokenUtils.js +0 -43
- package/dist/utils/tokenUtils.js.map +0 -1
- package/dist/utils/valueFormatting.js +0 -34
- package/dist/utils/valueFormatting.js.map +0 -1
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlaceholderToken = void 0;
|
|
4
|
-
const AbstractToken_1 = require("../AbstractToken");
|
|
5
|
-
/**
|
|
6
|
-
* A format-string delimiter pair containing one expression.
|
|
7
|
-
*/
|
|
8
|
-
class PlaceholderToken extends AbstractToken_1.AbstractToken {
|
|
9
|
-
constructor(expression, start = 0) {
|
|
10
|
-
super(start);
|
|
11
|
-
this.expression = expression;
|
|
12
|
-
Object.freeze(this);
|
|
13
|
-
}
|
|
14
|
-
get children() {
|
|
15
|
-
return this.expression.tokens;
|
|
16
|
-
}
|
|
17
|
-
raw() {
|
|
18
|
-
return `{${this.expression.raw()}}`;
|
|
19
|
-
}
|
|
20
|
-
clone() {
|
|
21
|
-
return new PlaceholderToken(this.expression.clone(), this.start);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.PlaceholderToken = PlaceholderToken;
|
|
25
|
-
//# sourceMappingURL=PlaceholderToken.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlaceholderToken.js","sourceRoot":"","sources":["../../../src/tokens/text/PlaceholderToken.ts"],"names":[],"mappings":";;;AAAA,oDAAiD;AAGjD;;GAEG;AACH,sBAAiF,SAAQ,6BAAa;IACpG,YACW,UAAa,EACtB,KAAK,GAAG,CAAC;QAET,KAAK,CAAC,KAAK,CAAC,CAAC;0BAHJ,UAAU;QAInB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,GAAG;QACD,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;IACtC,CAAC;IAED,KAAK;QACH,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACnE,CAAC;CACF","sourcesContent":["import { AbstractToken } from '../AbstractToken';\nimport type { AbstractExpression } from '../../expressions/AbstractExpression';\n\n/**\n * A format-string delimiter pair containing one expression.\n */\nexport class PlaceholderToken<T extends AbstractExpression = AbstractExpression> extends AbstractToken {\n constructor(\n readonly expression: T,\n start = 0\n ) {\n super(start);\n Object.freeze(this);\n }\n\n get children(): readonly AbstractToken[] {\n return this.expression.tokens;\n }\n\n raw(): string {\n return `{${this.expression.raw()}}`;\n }\n\n clone(): PlaceholderToken<T> {\n return new PlaceholderToken(this.expression.clone(), this.start);\n }\n}\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextToken = void 0;
|
|
4
|
-
const AbstractToken_1 = require("../AbstractToken");
|
|
5
|
-
/**
|
|
6
|
-
* Original text, including any escaped format-string braces.
|
|
7
|
-
*/
|
|
8
|
-
class TextToken extends AbstractToken_1.AbstractToken {
|
|
9
|
-
static fromValue(value, start = 0) {
|
|
10
|
-
return new TextToken(value.replace(/{/g, '{{').replace(/}/g, '}}'), start);
|
|
11
|
-
}
|
|
12
|
-
constructor(source, start = 0) {
|
|
13
|
-
super(start);
|
|
14
|
-
this.source = source;
|
|
15
|
-
Object.freeze(this);
|
|
16
|
-
}
|
|
17
|
-
raw() {
|
|
18
|
-
return this.source;
|
|
19
|
-
}
|
|
20
|
-
clone() {
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
|
-
get decodedText() {
|
|
24
|
-
return this.source.replace(/{{/g, '{').replace(/}}/g, '}');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.TextToken = TextToken;
|
|
28
|
-
//# sourceMappingURL=TextToken.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextToken.js","sourceRoot":"","sources":["../../../src/tokens/text/TextToken.ts"],"names":[],"mappings":";;;AAAA,oDAAiD;AAEjD;;GAEG;AACH,eAAuB,SAAQ,6BAAa;IAC1C,MAAM,CAAC,SAAS,CAAC,KAAa,EAAE,KAAK,GAAG,CAAC;QACvC,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC;IAED,YACW,MAAc,EACvB,KAAK,GAAG,CAAC;QAET,KAAK,CAAC,KAAK,CAAC,CAAC;sBAHJ,MAAM;QAIf,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,GAAG;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC;CACF","sourcesContent":["import { AbstractToken } from '../AbstractToken';\n\n/**\n * Original text, including any escaped format-string braces.\n */\nexport class TextToken extends AbstractToken {\n static fromValue(value: string, start = 0): TextToken {\n return new TextToken(value.replace(/{/g, '{{').replace(/}/g, '}}'), start);\n }\n\n constructor(\n readonly source: string,\n start = 0\n ) {\n super(start);\n Object.freeze(this);\n }\n\n raw(): string {\n return this.source;\n }\n\n clone(): this {\n return this;\n }\n\n get decodedText(): string {\n return this.source.replace(/{{/g, '{').replace(/}}/g, '}');\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":"7.0.2","root":[[89,92],[95,96],[98,101],[113,131]],"packageJsons":["../../../node_modules/.pnpm/@babel+parser@8.0.7/node_modules/@babel/parser/package.json","../../../node_modules/.pnpm/@babel+traverse@8.0.7/node_modules/@babel/traverse/package.json","../../../node_modules/.pnpm/@babel+types@8.0.6/node_modules/@babel/types/package.json","../package.json","../../type-system/package.json"],"missingPackageJsons":["../../../node_modules/.pnpm/@babel+parser@8.0.7/node_modules/@babel/parser/lib/package.json","../../../node_modules/.pnpm/@babel+parser@8.0.7/node_modules/@babel/parser/node_modules/@babel/types/package.json","../../../node_modules/.pnpm/@babel+traverse@8.0.7/node_modules/@babel/traverse/lib/package.json","../../../node_modules/.pnpm/@babel+traverse@8.0.7/node_modules/@babel/traverse/node_modules/@babel/types/package.json","../../../node_modules/.pnpm/@babel+types@8.0.6/node_modules/@babel/types/lib/package.json"],"fileNames":["lib.es5.d.ts","lib.es2015.d.ts","lib.es2016.d.ts","lib.es2017.d.ts","lib.es2018.d.ts","lib.es2019.d.ts","lib.es2020.d.ts","lib.es2021.d.ts","lib.es2022.d.ts","lib.es2023.d.ts","lib.es2024.d.ts","lib.es2025.d.ts","lib.esnext.d.ts","lib.dom.d.ts","lib.es2015.core.d.ts","lib.es2015.collection.d.ts","lib.es2015.generator.d.ts","lib.es2015.iterable.d.ts","lib.es2015.promise.d.ts","lib.es2015.proxy.d.ts","lib.es2015.reflect.d.ts","lib.es2015.symbol.d.ts","lib.es2015.symbol.wellknown.d.ts","lib.es2016.array.include.d.ts","lib.es2016.intl.d.ts","lib.es2017.arraybuffer.d.ts","lib.es2017.date.d.ts","lib.es2017.object.d.ts","lib.es2017.sharedmemory.d.ts","lib.es2017.string.d.ts","lib.es2017.intl.d.ts","lib.es2017.typedarrays.d.ts","lib.es2018.asyncgenerator.d.ts","lib.es2018.asynciterable.d.ts","lib.es2018.intl.d.ts","lib.es2018.promise.d.ts","lib.es2018.regexp.d.ts","lib.es2019.array.d.ts","lib.es2019.object.d.ts","lib.es2019.string.d.ts","lib.es2019.symbol.d.ts","lib.es2019.intl.d.ts","lib.es2020.bigint.d.ts","lib.es2020.date.d.ts","lib.es2020.promise.d.ts","lib.es2020.sharedmemory.d.ts","lib.es2020.string.d.ts","lib.es2020.symbol.wellknown.d.ts","lib.es2020.intl.d.ts","lib.es2020.number.d.ts","lib.es2021.promise.d.ts","lib.es2021.string.d.ts","lib.es2021.weakref.d.ts","lib.es2021.intl.d.ts","lib.es2022.array.d.ts","lib.es2022.error.d.ts","lib.es2022.intl.d.ts","lib.es2022.object.d.ts","lib.es2022.string.d.ts","lib.es2022.regexp.d.ts","lib.es2023.array.d.ts","lib.es2023.collection.d.ts","lib.es2023.intl.d.ts","lib.es2024.arraybuffer.d.ts","lib.es2024.collection.d.ts","lib.es2024.object.d.ts","lib.es2024.promise.d.ts","lib.es2024.regexp.d.ts","lib.es2024.sharedmemory.d.ts","lib.es2024.string.d.ts","lib.es2025.collection.d.ts","lib.es2025.float16.d.ts","lib.es2025.intl.d.ts","lib.es2025.iterator.d.ts","lib.es2025.promise.d.ts","lib.es2025.regexp.d.ts","lib.esnext.array.d.ts","lib.esnext.collection.d.ts","lib.esnext.date.d.ts","lib.esnext.decorators.d.ts","lib.esnext.disposable.d.ts","lib.esnext.error.d.ts","lib.esnext.intl.d.ts","lib.esnext.sharedmemory.d.ts","lib.esnext.temporal.d.ts","lib.esnext.typedarrays.d.ts","lib.decorators.d.ts","lib.decorators.legacy.d.ts","../src/tokens/AbstractToken.ts","../src/tokens/DelimiterToken.ts","../src/tokens/EnumToken.ts","../src/tokens/text/TextToken.ts","../../../node_modules/.pnpm/@babel+types@8.0.6/node_modules/@babel/types/lib/index.d.ts","../../../node_modules/.pnpm/@babel+traverse@8.0.7/node_modules/@babel/traverse/lib/index.d.ts","../src/tokens/code/CodeToken.ts","../src/code-parsers/CodeParser.ts","../../../node_modules/.pnpm/@babel+parser@8.0.7/node_modules/@babel/parser/lib/index.d.ts","../src/code-parsers/JavaScriptParser.ts","../src/tokens/code/JSToken.ts","../src/tokens/code/IdentifierToken.ts","../src/tokens/code/PrefixToken.ts","../../type-system/dist/@types/Formatter.d.ts","../../type-system/dist/@types/Type.d.ts","../../type-system/dist/@types/ObjectType.d.ts","../../type-system/dist/@types/ArrayType.d.ts","../../type-system/dist/@types/UnknownType.d.ts","../../type-system/dist/@types/ScalarType.d.ts","../../type-system/dist/@types/TextType.d.ts","../../type-system/dist/@types/NumberType.d.ts","../../type-system/dist/@types/IntegerType.d.ts","../../type-system/dist/@types/BooleanType.d.ts","../../type-system/dist/@types/index.d.ts","../src/definitions/ValidationContext.ts","../src/expressions/AbstractExpression.ts","../src/tokens/text/PlaceholderToken.ts","../src/utils/tokenUtils.ts","../src/tokens/index.ts","../src/ExpressionParser.ts","../src/CombinedParser.ts","../src/expressions/ListExpression.ts","../src/expressions/EvaluatedExpression.ts","../src/expressions/shorthand/ShorthandExpression.ts","../src/expressions/shorthand/FormatShorthandExpression.ts","../src/expressions/constant/ConstantExpression.ts","../src/expressions/function/FunctionExpression.ts","../src/expressions/text/AbstractFormatExpression.ts","../src/expressions/text/FormatStringExpression.ts","../src/expressions/index.ts","../src/utils/parserUtils.ts","../src/utils/valueFormatting.ts","../src/index.ts"],"fileInfos":[{"version":"16934abaab7026ac114da441aabea1a0","affectsGlobalScope":true,"impliedNodeFormat":1},"d4306fb2e47f74835e8674ffac07d76f","e437c5c1302869326c3bb93da85bbbcf","e4324975a566567b21d350615f1fc6ac","333b1b9a2a9ac3b8497dba5c63b5ba50","6cffacd662b6eb5fa7a36aa2ea366bfa","b4c34f9c23304dbef2d23698637ed638","e5cb86a5fc491796ecd1d2dd348d208f","feb6c6fb19cdb246a5d8acb36a6901c7","9443a7f109277ffaa79d893ed2549995","793cee405385076e27c24f409659dccd","09f69c6610266eaee1ac9e3e30df2c71","62bad718844246b8e17547f37bad6085",{"version":"aae8996e8b5684814785a42cbbefcd79","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"926204c28cd3d073865348473ae28d2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f25e42c801b2cb3cf2b39792006a9beb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6344b55f26a4e81d9608777dbfb877dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3c0ed28e53d3695b363e256ec1c023fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4c2761daba7f17141c25baa0821ac5da","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b87656acabd63e69379ff6ffcfe52fc7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"597469522da047a5af5222cc6989f405","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1708ea4d34dc37fadadc63ca01127e80","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"55d97a8c6fbf34a30450a7b1e5f7a298","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0ee05eb59426d33e374226d8dcfa708b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e347c14030993906efcfbb88915b6a05","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b0231263857c9b6a03641acdc9280ceb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3b15c4a83b598cacb4067676e6f0abed","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b417d97b7934cef63b1889abec0bbfbf","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"09a6cf4032ebba60ce22a501e663f881","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2b056277dd138e8f5650fc04e20eaa8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e22cc07e3f3cc242ba52fa3f8ea1fc58","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2c45da767a1bfbb220848df1bc4029e4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b44c3e0fbaf2130cdcf6ac38b120ffa1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b612fb5cf8e5d964b92063a75207632a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"02705151a5e1551b9162a9ed8ab763f7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"41025e398be9215d32e4337335da8f0b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52684c2b1f353a5538e4f275182a54cd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6dedb6a4f90d1df3a6fbe5693e44886c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ca3f36fe3562c07e0f0d71c2bebd3f6d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"409974d6129befbb8226ddd1c6558568","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4d9cfde2a1ae1b4925f1f9bc10848e5d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7e1daecc66dd564144e3bb1a0266b5fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a8e1d9bb35fd0637f2f9fd2b2a54f2ec","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4f168501772a6543182765bfd5f2fbfe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a19c80aad1b2162103496f5ba293a732","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b69afa63cd5d059851c78adb2856ee09","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ae2fc5d954e9b0f5feee3d481b953c27","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1cfd3091a071d8b6feec15277643bafe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1da2c1f258970fd3cc91184f69e91a9d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a0d87491913d843139e0c993650a3235","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ef72aa378127e7b7abba915b0110b1e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3ec74c6a7d4463f0254db3a74cf75646","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"84c2bdfa470d075526cce6322d81b0b6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0b3844c2b8c73e4e1ab91431411cad11","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4fc71cf4a15b8d99675a31df77f26e07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d1b49564ddaeca3df5b6dbae925d2242","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6a25be566d60ccfc2d6e8b7bfdeefa83","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8a20e27646985dfd58c57ca6566553dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9969f02ad3cdcbf4f709405cda44167f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9c9be4792a7a4f42c15ae7360bf28779","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8cf777fe00349b71ee9c4b6f3fe7fd19","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f96bc192530c9723f572bfff3d3078","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1df91c56b25955c56387426f378173c5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38856f70edcd2115c355d96ec77cc09e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"de8700156c1275465bcd473c28b359aa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d47cfdb6ede40518357bb5a4cd7cd9fb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6e5773860cd9e5b15e683113f642ab47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"30ff5fe1682f7fcd629880476ca3c2e0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"bf23d7d1b40b9015b694ddc2f011752f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2cc585d42e2c548f9f24a30a1989fd33","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"713906ce9d332d2242b7f05ed9304be3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0219894bfe5042c7e1aa2d22e4a91ed0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6009ffff7e43c93318804d2d28e37fe3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"03be89b227587594fbb50509fc1c2e45","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b30df52dc24740c0bad7c55c3511df7d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8d3c9b5ed5c2ab8f383607eef439f0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d950ec671d0a8e07f3c1a31e94abed86","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1abef2ace5eccb02d60dd73cd5a5ee4c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f5f0a3044029d1cc081b5887eb4deb07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d57c697f1446940ec4bfe669c962e2c4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"be41035d7b941482a1e1ae6a5c5dcca5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"10f7d9da7564f27f8ddf4a162b6da6d3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1d0520af549e0c3581f15173cc713ca1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d65083f97fd741cff028472563eddb79","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"da7f24f00653ebac660ac1c0821ed33d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7cb5ae9e65516ea2235f0721f6aac43c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f64453cbf9671f28158677fa5c43967a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"33f317af5428801f944a478d2c1e38e5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1f9398f3eec050714be4f9b1c3a2317d","signature":"510b0b622fafd6eff2bf5d020de046ee","impliedNodeFormat":1},{"version":"416eeb96c107bd2015080f4249d3ee38","signature":"ae63a2414b6a326b93ee65bba693d617","impliedNodeFormat":1},{"version":"09feabedf70ed610ed9ea0425e1f97e4","signature":"57845437bcd4011990eb52478f02c4a0","impliedNodeFormat":1},{"version":"36194741ebb41739843db9a2ee86ca6f","signature":"f25290e9ca5aee09a0210e2a454437f8","impliedNodeFormat":1},{"version":"3575b2b8e50b5a5b3acce219e08900c5","impliedNodeFormat":99},{"version":"ba148a7a8b1b345b82e2255648d7a2a0","impliedNodeFormat":99},{"version":"79de825e280a92f200bf8ab73df74aaa","signature":"968dbf07ccc13a1a84f319c26e9909b3","impliedNodeFormat":1},{"version":"cbe2ad0843a3b4397021171b675d91e2","signature":"e78cf9dc5bca6011a220581f56da19cb","impliedNodeFormat":1},{"version":"436d7d9cea8d7f3e41e2ea50138ad4da","impliedNodeFormat":99},{"version":"6341abc9e164a58cd4faf7db00c2125e","signature":"25aba7d58ecafcf7098f9bcca63ea72a","impliedNodeFormat":1},{"version":"1f637dbc1f68ca19c0568ac3979a5a59","signature":"354fc88481ff608fcbbfaf7851a29043","impliedNodeFormat":1},{"version":"8c8e53d56beef78deb845941070bc387","signature":"3058c9c4ad1200a2ff62094072deed53","impliedNodeFormat":1},{"version":"72d344412c308ce31e59dd6752f5abca","signature":"bf6d579deb9596ec514083ea94789be0","impliedNodeFormat":1},"e5fb7990b84f5089ba92554ea3614810","770ee32ef332fd48bfef508442b30edb","5c1b5931ee0c894699ca56f5b573f88a","822b842ad7efa3485d65fbeb2f919865","89b6053090a8d01f57cb8f521fae777d","26302a8b72d74f944dcf8f6452e54f7c","bc95bdb594a5aece18248fbf4387dd2e","90125a76f2ae701181f7e09dea41f3ad","ac52bb76ccad935a013384d2a71ab267","2c96eeb69afb823580d4e1e5f1b188e0","c06213bcb24cd658dfcd1239777159bd",{"version":"787551f4ccf1ea187c97a6fef4a2b502","signature":"ada7f0921b6eace272ee48028595ff4e","impliedNodeFormat":1},{"version":"67323509d98791c2e9287e7b9c86c8f1","signature":"e518fcc525a72f156f4235f97e942e72","impliedNodeFormat":1},{"version":"2f588b7565009cf660e49f19128363d2","signature":"cf3121ca4479d3afdaceb690d14cf086","impliedNodeFormat":1},{"version":"4b2dcd692e0308ac4cee04202b63a5c0","signature":"d33a7d16b8bb10392237228466f959f8","impliedNodeFormat":1},"e2bb800214278396da6f4dfb9210a507",{"version":"01cb6d1d819779d9823af5890a75765a","signature":"c0cbc64b7a419382086b8d30226b8f0f","impliedNodeFormat":1},{"version":"2e3387bb780ecbc47d2cf0715f0a3d5b","signature":"bb9d86257bed6b06d027b9b561ba2c31","impliedNodeFormat":1},{"version":"e9ceb16586d83746a56dfefc8f72a4e4","signature":"ddac5ec2816a79b75ca0b28b073126c9","impliedNodeFormat":1},{"version":"ca57df7a021dd9e60b50a86359328369","signature":"e62a96adf38e2e5adbeb996a1bbb0ca6","impliedNodeFormat":1},{"version":"89c28146623ca911251a5a7c0aef31da","signature":"358284d17020fff7c8988fe49465ebce","impliedNodeFormat":1},{"version":"8585c59b42a4515d919ae67b1871b611","signature":"788ca99c9132de5f347c0c196085cc16","impliedNodeFormat":1},{"version":"f9b746229b5805be47a5e729cd0882b9","signature":"74a85c95eb3b8b1bd5c7d0822fe65312","impliedNodeFormat":1},{"version":"42149341c32f9a8c00c6c6b7f916c138","signature":"f85883c070822e429d13802a651146bc","impliedNodeFormat":1},{"version":"e5172b410a188df0e6366797579dc23a","signature":"038c82b1bfec7b11761d58241d68970f","impliedNodeFormat":1},{"version":"43287bfa29ccc772782a499966bf000e","signature":"fa4b9cdace3ba0abd1e6547b87390de6","impliedNodeFormat":1},{"version":"6aa5192b4406661ffde74ffdbeaf42c5","signature":"b5fa992ef592b85d4851433a12195162","impliedNodeFormat":1},{"version":"ee144db1b2a390284f2301277a4769d0","signature":"6844f7dcecd5297f9a25fe55fe7aeacc","impliedNodeFormat":1},{"version":"e8e9d0b6b6e01ab0a9a3b771fca4b37b","signature":"90506d77482148f93c56044616613958","impliedNodeFormat":1},{"version":"b0ffa465ccd4d217e0b238fd935d8127","signature":"3a5ea1baf065ad0e1794aeb15153114c","impliedNodeFormat":1}],"fileIdsList":[[93],[114,117,118],[114,117],[93,94,96,97],[112,117],[113,117],[112,114,117,118],[114,117,118,121],[114,120,121,122,123,124,125,126,127],[117,118,122],[112,113,114,117,118],[113,114,117,118],[117,119,121,122,123,125,126],[96,98,113,117,118,119,128,129,130],[89],[89,92,93,94,95,96,98],[89,100],[89,90,91,92,95,99,100,101,115,116],[89,114],[117,119,128],[89,95,99,101],[112],[103],[103,107],[102],[102,103,104,105,106,107,108,109,110,111]],"options":{"composite":true,"declaration":true,"declarationDir":"./@types","inlineSources":true,"module":199,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":false,"stripInternal":true,"sourceMap":true,"target":4,"tsBuildInfoFile":"./tsconfig.tsbuildinfo","esModuleInterop":true},"referencedMap":[[97,1],[94,1],[119,2],[118,3],[98,4],[113,5],[114,6],[121,2],[120,2],[124,7],[125,8],[128,9],[123,10],[122,11],[126,12],[127,13],[131,14],[90,15],[91,15],[95,15],[100,15],[99,16],[101,17],[117,18],[115,19],[92,15],[129,20],[116,21],[130,22],[105,23],[111,24],[110,24],[109,24],[104,23],[107,23],[108,24],[103,25],[106,23],[112,26]],"latestChangedDtsFile":"./@types/index.d.ts"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseExpression = parseExpression;
|
|
4
|
-
const CombinedParser_1 = require("../CombinedParser");
|
|
5
|
-
const expressions_1 = require("../expressions");
|
|
6
|
-
/**
|
|
7
|
-
* Recognize evaluated code and references before preserving remaining input as constant text.
|
|
8
|
-
* Callers can compose their own parser order instead.
|
|
9
|
-
*/
|
|
10
|
-
function parseExpression(source, start = 0) {
|
|
11
|
-
return new CombinedParser_1.CombinedParser([
|
|
12
|
-
new expressions_1.FunctionExpressionParser(),
|
|
13
|
-
new expressions_1.EvaluatedExpressionParser(),
|
|
14
|
-
new expressions_1.FormatShorthandExpressionParser(),
|
|
15
|
-
new expressions_1.ShorthandExpressionParser(),
|
|
16
|
-
new expressions_1.ConstantExpressionParser()
|
|
17
|
-
]).tryParse(source, start);
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=parserUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parserUtils.js","sourceRoot":"","sources":["../../src/utils/parserUtils.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AACnD,gDAOwB;AAGxB;;;GAGG;AACH,yBAAgC,MAAwB,EAAE,KAAK,GAAG,CAAC;IACjE,OAAO,IAAI,+BAAc,CAAqB;QAC5C,IAAI,sCAAwB,EAAE;QAC9B,IAAI,uCAAyB,EAAE;QAC/B,IAAI,6CAA+B,EAAE;QACrC,IAAI,uCAAyB,EAAE;QAC/B,IAAI,sCAAwB,EAAE;KAC/B,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import { CombinedParser } from '../CombinedParser';\nimport {\n AbstractExpression,\n EvaluatedExpressionParser,\n ConstantExpressionParser,\n FormatShorthandExpressionParser,\n FunctionExpressionParser,\n ShorthandExpressionParser\n} from '../expressions';\nimport { ExpressionSource } from '../tokens';\n\n/**\n * Recognize evaluated code and references before preserving remaining input as constant text.\n * Callers can compose their own parser order instead.\n */\nexport function parseExpression(source: ExpressionSource, start = 0): AbstractExpression | null {\n return new CombinedParser<AbstractExpression>([\n new FunctionExpressionParser(),\n new EvaluatedExpressionParser(),\n new FormatShorthandExpressionParser(),\n new ShorthandExpressionParser(),\n new ConstantExpressionParser()\n ]).tryParse(source, start);\n}\n"]}
|
package/dist/utils/tokenUtils.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stringify = stringify;
|
|
4
|
-
exports.codeToken = codeToken;
|
|
5
|
-
exports.javascriptToken = javascriptToken;
|
|
6
|
-
exports.hasFunctionPrefix = hasFunctionPrefix;
|
|
7
|
-
exports.leadingTrivia = leadingTrivia;
|
|
8
|
-
const CodeToken_1 = require("../tokens/code/CodeToken");
|
|
9
|
-
const JSToken_1 = require("../tokens/code/JSToken");
|
|
10
|
-
const PrefixToken_1 = require("../tokens/code/PrefixToken");
|
|
11
|
-
function stringify(source) {
|
|
12
|
-
let text;
|
|
13
|
-
if (typeof source === 'string') {
|
|
14
|
-
text = source;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
text = source.map((token) => token.raw()).join('');
|
|
18
|
-
}
|
|
19
|
-
return text;
|
|
20
|
-
}
|
|
21
|
-
function codeToken(tokens) {
|
|
22
|
-
const code = tokens.filter((token) => token instanceof CodeToken_1.CodeToken);
|
|
23
|
-
if (code.length !== 1)
|
|
24
|
-
throw new SyntaxError('Expected one code token.');
|
|
25
|
-
return code[0];
|
|
26
|
-
}
|
|
27
|
-
function javascriptToken(tokens) {
|
|
28
|
-
const javascript = tokens.filter((token) => token instanceof JSToken_1.JSToken);
|
|
29
|
-
if (javascript.length !== 1) {
|
|
30
|
-
throw new SyntaxError('Expected one JavaScript token.');
|
|
31
|
-
}
|
|
32
|
-
return javascript[0];
|
|
33
|
-
}
|
|
34
|
-
function hasFunctionPrefix(source) {
|
|
35
|
-
return source.slice(leadingTrivia(source).length).startsWith(PrefixToken_1.FUNCTION_PREFIX);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Whitespace and comments before a Journey prefix remain original source text.
|
|
39
|
-
*/
|
|
40
|
-
function leadingTrivia(source) {
|
|
41
|
-
return source.match(/^(?:\s+|\/\*[\s\S]*?\*\/|\/\/[^\r\n]*(?:\r?\n|$))*/)[0];
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=tokenUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tokenUtils.js","sourceRoot":"","sources":["../../src/utils/tokenUtils.ts"],"names":[],"mappings":";;;;;;;AACA,wDAAqD;AACrD,oDAAiD;AACjD,4DAA6D;AAE7D,mBAA0B,MAAwB;IAChD,IAAI,IAAY,CAAC;IACjB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,IAAI,GAAG,MAAM,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,mBAA0B,MAAgC;IACxD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAsB,EAAE,CAAC,KAAK,YAAY,qBAAS,CAAC,CAAC;IACtF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,WAAW,CAAC,0BAA0B,CAAC,CAAC;IACzE,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC;AAED,yBAAgC,MAAgC;IAC9D,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAoB,EAAE,CAAC,KAAK,YAAY,iBAAO,CAAC,CAAC;IACxF,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,WAAW,CAAC,gCAAgC,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC;AAED,2BAAkC,MAAc;IAC9C,OAAO,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,6BAAe,CAAC,CAAC;AAChF,CAAC;AAED;;GAEG;AACH,uBAA8B,MAAc;IAC1C,OAAO,MAAM,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["import { AbstractToken, ExpressionSource } from '../tokens/AbstractToken';\nimport { CodeToken } from '../tokens/code/CodeToken';\nimport { JSToken } from '../tokens/code/JSToken';\nimport { FUNCTION_PREFIX } from '../tokens/code/PrefixToken';\n\nexport function stringify(source: ExpressionSource): string {\n let text: string;\n if (typeof source === 'string') {\n text = source;\n } else {\n text = source.map((token) => token.raw()).join('');\n }\n return text;\n}\n\nexport function codeToken(tokens: readonly AbstractToken[]): CodeToken {\n const code = tokens.filter((token): token is CodeToken => token instanceof CodeToken);\n if (code.length !== 1) throw new SyntaxError('Expected one code token.');\n return code[0];\n}\n\nexport function javascriptToken(tokens: readonly AbstractToken[]): JSToken {\n const javascript = tokens.filter((token): token is JSToken => token instanceof JSToken);\n if (javascript.length !== 1) {\n throw new SyntaxError('Expected one JavaScript token.');\n }\n return javascript[0];\n}\n\nexport function hasFunctionPrefix(source: string): boolean {\n return source.slice(leadingTrivia(source).length).startsWith(FUNCTION_PREFIX);\n}\n\n/**\n * Whitespace and comments before a Journey prefix remain original source text.\n */\nexport function leadingTrivia(source: string): string {\n return source.match(/^(?:\\s+|\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\r\\n]*(?:\\r?\\n|$))*/)[0];\n}\n"]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatValue = formatValue;
|
|
4
|
-
exports.formatValueAsync = formatValueAsync;
|
|
5
|
-
/**
|
|
6
|
-
* Format an expression with a specific format.
|
|
7
|
-
*/
|
|
8
|
-
function formatValue(value, formatter, format) {
|
|
9
|
-
if (value == null) {
|
|
10
|
-
return '';
|
|
11
|
-
}
|
|
12
|
-
else if ((formatter === null || formatter === void 0 ? void 0 : formatter.format) != null) {
|
|
13
|
-
return formatter.format(value, format !== null && format !== void 0 ? format : undefined);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
// This should generally not happen. However, we still try to handle it gracefully.
|
|
17
|
-
// This is useful for tests where we don't want to define the type for every variable.
|
|
18
|
-
return value.toString();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Resolve an object's asynchronous display value before falling back to its type formatter.
|
|
23
|
-
*/
|
|
24
|
-
async function formatValueAsync(value, formatter, format) {
|
|
25
|
-
let formatted;
|
|
26
|
-
if (value != null && typeof value._display === 'function') {
|
|
27
|
-
formatted = await value._display();
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
formatted = formatValue(value, formatter, format);
|
|
31
|
-
}
|
|
32
|
-
return formatted;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=valueFormatting.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"valueFormatting.js","sourceRoot":"","sources":["../../src/utils/valueFormatting.ts"],"names":[],"mappings":";;;;AAEA;;GAEG;AACH,qBAA4B,KAAU,EAAE,SAA2B,EAAE,MAAsB;IACzF,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;SAAM,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,KAAI,IAAI,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,SAAS,CAAC,CAAC;IACtD,CAAC;SAAM,CAAC;QACN,mFAAmF;QACnF,sFAAsF;QACtF,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC;AAED;;GAEG;AACI,KAAK,2BACV,KAAU,EACV,SAA2B,EAC3B,MAAsB;IAEtB,IAAI,SAAiB,CAAC;IACtB,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC1D,SAAS,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC;IACrC,CAAC;SAAM,CAAC;QACN,SAAS,GAAG,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { Formatter } from '@ja-platform/parser-type-system';\n\n/**\n * Format an expression with a specific format.\n */\nexport function formatValue(value: any, formatter: Formatter | null, format?: string | null): string {\n if (value == null) {\n return '';\n } else if (formatter?.format != null) {\n return formatter.format(value, format ?? undefined);\n } else {\n // This should generally not happen. However, we still try to handle it gracefully.\n // This is useful for tests where we don't want to define the type for every variable.\n return value.toString();\n }\n}\n\n/**\n * Resolve an object's asynchronous display value before falling back to its type formatter.\n */\nexport async function formatValueAsync(\n value: any,\n formatter: Formatter | null,\n format?: string | null\n): Promise<string> {\n let formatted: string;\n if (value != null && typeof value._display === 'function') {\n formatted = await value._display();\n } else {\n formatted = formatValue(value, formatter, format);\n }\n return formatted;\n}\n"]}
|