Skip to content

Commit 0306e8a

Browse files
committed
js-1.1.3 - fix bug in parsing inline arguments
1 parent fe4a37f commit 0306e8a

File tree

7 files changed

+16
-17
lines changed

7 files changed

+16
-17
lines changed

docs/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@docusaurus/preset-classic": "3.7.0",
2020
"@mdx-js/react": "3.1.0",
2121
"@monaco-editor/react": "4.6.0",
22-
"@nlighten/json-transform": "^1.1.2",
22+
"@nlighten/json-transform": "^1.1.3",
2323
"@nlighten/json-transform-core": "^1.1.1",
2424
"buffer": "^6.0.3",
2525
"clsx": "2.1.0",

docs/src/components/monaco/Monaco.init.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ const initMonaco = (monaco: Monaco) => {
9393
tags,
9494
};
9595
};
96-
const functionSuggestions = functions.getNames().map(x => `$$${x}`);
96+
const functionSuggestions = functions.getNames()
97+
.filter(x => !functions.get(x).deprecated)
98+
.map(x => `$$${x}`);
9799

98100
monaco.languages.registerCompletionItemProvider("json", {
99101
provideCompletionItems: (model, position) => {

docs/src/components/monaco/jsonTransformerTokenizer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ export const tokenizeLine = (line: string, lineNumber: number, ts: TokenizationS
4242
iterResult = iter.next(), match = iterResult.value as RegExpMatchArray | null
4343
) {
4444
if (!match || typeof match.index === "undefined") continue;
45+
const func = functions.get(match[1])
46+
const deprecated = func?.deprecated;
47+
4548
ts.tokens.push({
4649
line: lineNumber,
4750
char: match.index,
4851
length: 2 + match[1].length, // $$ and name
49-
type: TokenType.FUNCTION,
52+
type: deprecated ? TokenType.FUNCTION_DEPRECATED : TokenType.FUNCTION,
5053
modifier: TokenModifier.DECLARATION,
5154
});
5255
}

javascript/json-transform/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@nlighten/json-transform",
33
"description": "JSON transformers JavaScript implementation",
4-
"version": "1.1.2",
4+
"version": "1.1.3",
55
"main": "dist/json-transform.js",
66
"umd:main": "dist/json-transform.umd.js",
77
"module": "dist/json-transform.module.js",

javascript/json-transform/src/JsonHelpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const createPayloadResolver = (payload: any, additionalContext: Record<string, a
169169

170170
const singleQuotedStringJsonParse = (input: string) => {
171171
try {
172-
return JSON.parse(`"${input.slice(1, -1).replace(/"/g, '\\"')}"`);
172+
return JSON.parse(`"${input.slice(1, -1).replace(/"/g, '\\"').replace(/\\'/g, "'")}"`);
173173
} catch (e: any) {
174174
console.error(e);
175175
return null;

test/tests/functions/and.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,8 @@
3232
],
3333
"definition": {
3434
"$$and": [
35-
{
36-
"$$is": "$[0]",
37-
"eq": 2
38-
},
39-
{
40-
"$$is": "$[1]",
41-
"eq": 3
42-
}
35+
"$$is(=,2):$[0]",
36+
"$$is(=,3):$[1]"
4337
]
4438
}
4539
},

0 commit comments

Comments
 (0)