From 3d246ec3327fbdea4327ed041c3142d24d7a8f55 Mon Sep 17 00:00:00 2001 From: ayecue Date: Thu, 15 Sep 2022 20:58:40 +0200 Subject: [PATCH 01/28] 1.3.7 two minor fixes in intriniscs + fix debugger injection --- CHANGELOG.md | 8 +++++++- package-lock.json | 32 ++++++++++++++++---------------- package.json | 6 +++--- src/execute.ts | 3 +++ 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4332f59b..82dc0291 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -275,4 +275,10 @@ All notable changes to this project will be documented in this file. ## [1.3.6] - 10-09-2022 -- fix share feature in web-ui \ No newline at end of file +- fix share feature in web-ui + +## [1.3.7] - 15-09-2022 + +- minor fix for file.get_content, return empty string instead of undefined, thanks for reporting [@TopRoupi](https://github.com/TopRoupi) +- add sort key logic in sort intrinsic, thanks for reporting [@TopRoupi](https://github.com/TopRoupi) +- deactivate breakpoint for injection during debugging in cli execution \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 434beb91..6a633c1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,19 @@ { "name": "greybel-js", - "version": "1.3.6", + "version": "1.3.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "greybel-js", - "version": "1.3.6", + "version": "1.3.7", "dependencies": { "@babel/runtime": "^7.16.7", "commander": "^7.2.0", "greybel-core": "^0.4.7", - "greybel-gh-mock-intrinsics": "^1.1.8", + "greybel-gh-mock-intrinsics": "^1.1.9", "greybel-interpreter": "^1.2.0", - "greybel-intrinsics": "^1.1.8", + "greybel-intrinsics": "^1.1.9", "greybel-transpiler": "^0.6.0", "greyscript-core": "^0.4.1", "greyscript-meta": "^1.1.5", @@ -4403,9 +4403,9 @@ } }, "node_modules/greybel-gh-mock-intrinsics": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.1.8.tgz", - "integrity": "sha512-hZkBgn4Nl469wICfWqxnwXWoYkefvws4oI3pTUiz8wc0cabtP24hgiGWMjN9OefpjqhaEzYVWexGfjL5+sescQ==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.1.9.tgz", + "integrity": "sha512-4yCEuAs8+t0ZyRZZ9h26VXvZEQ+2ZrHfnmXoB8XCrjJdYBUW4XijrHxZvN8LamsPShPOnjvfYsDcKJ1nPh5n9Q==", "dependencies": { "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", @@ -4424,9 +4424,9 @@ } }, "node_modules/greybel-intrinsics": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.1.8.tgz", - "integrity": "sha512-nnABGlDPfSmk7xMTlgn3Ok9Ox6D3jVULG1yA2kIjBD8jSIdHdsc/AQ1vkUSQwkHdDsPMt7n1ovmM8gLi/Ka5fw==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.1.9.tgz", + "integrity": "sha512-M/JjFJarJTw2MVoS+07q4aRTS9BzEMQipORU8MAVcwRjqQILlvJkxxFW7tmpHQmrTjNYQ/h0qFZCbrIZTHOsig==", "dependencies": { "greybel-interpreter": "^1.2.0" } @@ -10125,9 +10125,9 @@ } }, "greybel-gh-mock-intrinsics": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.1.8.tgz", - "integrity": "sha512-hZkBgn4Nl469wICfWqxnwXWoYkefvws4oI3pTUiz8wc0cabtP24hgiGWMjN9OefpjqhaEzYVWexGfjL5+sescQ==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.1.9.tgz", + "integrity": "sha512-4yCEuAs8+t0ZyRZZ9h26VXvZEQ+2ZrHfnmXoB8XCrjJdYBUW4XijrHxZvN8LamsPShPOnjvfYsDcKJ1nPh5n9Q==", "requires": { "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", @@ -10146,9 +10146,9 @@ } }, "greybel-intrinsics": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.1.8.tgz", - "integrity": "sha512-nnABGlDPfSmk7xMTlgn3Ok9Ox6D3jVULG1yA2kIjBD8jSIdHdsc/AQ1vkUSQwkHdDsPMt7n1ovmM8gLi/Ka5fw==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.1.9.tgz", + "integrity": "sha512-M/JjFJarJTw2MVoS+07q4aRTS9BzEMQipORU8MAVcwRjqQILlvJkxxFW7tmpHQmrTjNYQ/h0qFZCbrIZTHOsig==", "requires": { "greybel-interpreter": "^1.2.0" } diff --git a/package.json b/package.json index 3468cde9..1862a7a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "greybel-js", - "version": "1.3.6", + "version": "1.3.7", "engines": { "node": ">=14.0.0" }, @@ -24,9 +24,9 @@ "@babel/runtime": "^7.16.7", "commander": "^7.2.0", "greybel-core": "^0.4.7", - "greybel-gh-mock-intrinsics": "^1.1.8", + "greybel-gh-mock-intrinsics": "^1.1.9", "greybel-interpreter": "^1.2.0", - "greybel-intrinsics": "^1.1.8", + "greybel-intrinsics": "^1.1.9", "greybel-transpiler": "^0.6.0", "greyscript-core": "^0.4.1", "greyscript-meta": "^1.1.5", diff --git a/src/execute.ts b/src/execute.ts index 1bdbe762..8aa0cc04 100644 --- a/src/execute.ts +++ b/src/execute.ts @@ -51,6 +51,7 @@ class GrebyelPseudoDebugger extends Debugger { } try { + me.interpreter.debugger.setBreakpoint(false); await me.interpreter.injectInLastContext(line); console.log( `Execution of ${line}:${operationContext.target} was successful.` @@ -58,6 +59,8 @@ class GrebyelPseudoDebugger extends Debugger { } catch (err: any) { console.error(`Execution of ${line} failed.`); console.error(err); + } finally { + me.interpreter.debugger.setBreakpoint(true); } await iterate(); From 4e71390c3c5cd89577f19f0d12ace31b7c43668d Mon Sep 17 00:00:00 2001 From: ayecue Date: Thu, 15 Sep 2022 21:21:48 +0200 Subject: [PATCH 02/28] 1.3.7 fix pending state --- CHANGELOG.md | 3 ++- package-lock.json | 50 +++++++++++++++++++++++------------------------ package.json | 6 +++--- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82dc0291..46e8f388 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -281,4 +281,5 @@ All notable changes to this project will be documented in this file. - minor fix for file.get_content, return empty string instead of undefined, thanks for reporting [@TopRoupi](https://github.com/TopRoupi) - add sort key logic in sort intrinsic, thanks for reporting [@TopRoupi](https://github.com/TopRoupi) -- deactivate breakpoint for injection during debugging in cli execution \ No newline at end of file +- deactivate breakpoint for injection during debugging in cli execution +- keep pending state after injection \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 6a633c1a..7373dca5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,9 +11,9 @@ "@babel/runtime": "^7.16.7", "commander": "^7.2.0", "greybel-core": "^0.4.7", - "greybel-gh-mock-intrinsics": "^1.1.9", - "greybel-interpreter": "^1.2.0", - "greybel-intrinsics": "^1.1.9", + "greybel-gh-mock-intrinsics": "^1.2.0", + "greybel-interpreter": "^1.2.1", + "greybel-intrinsics": "^1.2.0", "greybel-transpiler": "^0.6.0", "greyscript-core": "^0.4.1", "greyscript-meta": "^1.1.5", @@ -4403,32 +4403,32 @@ } }, "node_modules/greybel-gh-mock-intrinsics": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.1.9.tgz", - "integrity": "sha512-4yCEuAs8+t0ZyRZZ9h26VXvZEQ+2ZrHfnmXoB8XCrjJdYBUW4XijrHxZvN8LamsPShPOnjvfYsDcKJ1nPh5n9Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.0.tgz", + "integrity": "sha512-17dLpoe6t4pdaBrCj20Ax05lHnTm6Et6759a2XQdtq3yhFKGBs9M6w45Vs/imqsw6Ugasfmyb7gCI7ImncsEiA==", "dependencies": { "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.2.0", + "greybel-interpreter": "^1.2.1", "random-seed": "^0.3.0", "random-username-generator": "^1.0.4" } }, "node_modules/greybel-interpreter": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.2.0.tgz", - "integrity": "sha512-Thnu8CB/zXBNZW+S6aOHqOuXPm6w6t2XhG5HFv9WXi+TQVR6VU+bup3bMZ37LCKFF/6bbKt1ZX4BQXxohHflKA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.2.1.tgz", + "integrity": "sha512-sCssGEoir0ZbJjn8k8iYqPV0mjG58CSPDET3eU06sQixTMU+kyJFFOY4m6r8OB6AA5R4un0KJ6IbKQkGtbw05w==", "dependencies": { "greybel-core": "^0.4.7", "greyscript-core": "^0.4.1" } }, "node_modules/greybel-intrinsics": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.1.9.tgz", - "integrity": "sha512-M/JjFJarJTw2MVoS+07q4aRTS9BzEMQipORU8MAVcwRjqQILlvJkxxFW7tmpHQmrTjNYQ/h0qFZCbrIZTHOsig==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.0.tgz", + "integrity": "sha512-pdvk9tA94n1Yo6q5ZEbh3rdrrbip7TbQyxzzQFR9O+DFteIo4lffGICwVi9KLyAgXCoGJa0xZ3m8qwfc7MtWkQ==", "dependencies": { - "greybel-interpreter": "^1.2.0" + "greybel-interpreter": "^1.2.1" } }, "node_modules/greybel-transpiler": { @@ -10125,32 +10125,32 @@ } }, "greybel-gh-mock-intrinsics": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.1.9.tgz", - "integrity": "sha512-4yCEuAs8+t0ZyRZZ9h26VXvZEQ+2ZrHfnmXoB8XCrjJdYBUW4XijrHxZvN8LamsPShPOnjvfYsDcKJ1nPh5n9Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.0.tgz", + "integrity": "sha512-17dLpoe6t4pdaBrCj20Ax05lHnTm6Et6759a2XQdtq3yhFKGBs9M6w45Vs/imqsw6Ugasfmyb7gCI7ImncsEiA==", "requires": { "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.2.0", + "greybel-interpreter": "^1.2.1", "random-seed": "^0.3.0", "random-username-generator": "^1.0.4" } }, "greybel-interpreter": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.2.0.tgz", - "integrity": "sha512-Thnu8CB/zXBNZW+S6aOHqOuXPm6w6t2XhG5HFv9WXi+TQVR6VU+bup3bMZ37LCKFF/6bbKt1ZX4BQXxohHflKA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.2.1.tgz", + "integrity": "sha512-sCssGEoir0ZbJjn8k8iYqPV0mjG58CSPDET3eU06sQixTMU+kyJFFOY4m6r8OB6AA5R4un0KJ6IbKQkGtbw05w==", "requires": { "greybel-core": "^0.4.7", "greyscript-core": "^0.4.1" } }, "greybel-intrinsics": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.1.9.tgz", - "integrity": "sha512-M/JjFJarJTw2MVoS+07q4aRTS9BzEMQipORU8MAVcwRjqQILlvJkxxFW7tmpHQmrTjNYQ/h0qFZCbrIZTHOsig==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.0.tgz", + "integrity": "sha512-pdvk9tA94n1Yo6q5ZEbh3rdrrbip7TbQyxzzQFR9O+DFteIo4lffGICwVi9KLyAgXCoGJa0xZ3m8qwfc7MtWkQ==", "requires": { - "greybel-interpreter": "^1.2.0" + "greybel-interpreter": "^1.2.1" } }, "greybel-transpiler": { diff --git a/package.json b/package.json index 1862a7a5..b0abfc5a 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ "@babel/runtime": "^7.16.7", "commander": "^7.2.0", "greybel-core": "^0.4.7", - "greybel-gh-mock-intrinsics": "^1.1.9", - "greybel-interpreter": "^1.2.0", - "greybel-intrinsics": "^1.1.9", + "greybel-gh-mock-intrinsics": "^1.2.0", + "greybel-interpreter": "^1.2.1", + "greybel-intrinsics": "^1.2.0", "greybel-transpiler": "^0.6.0", "greyscript-core": "^0.4.1", "greyscript-meta": "^1.1.5", From 5ef998b5ad47091628184743bbd18f900de5aec7 Mon Sep 17 00:00:00 2001 From: ayecue Date: Sun, 18 Sep 2022 21:54:49 +0200 Subject: [PATCH 03/28] 1.3.7 implement updated interpreter + intrinsics --- CHANGELOG.md | 10 +- package-lock.json | 145 +++++++++++++++++++-------- package.json | 10 +- src/execute.ts | 244 +++++++++++++++++++++++++++++++++------------- src/repl.ts | 52 ++-------- 5 files changed, 306 insertions(+), 155 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46e8f388..03d5e76e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -281,5 +281,13 @@ All notable changes to this project will be documented in this file. - minor fix for file.get_content, return empty string instead of undefined, thanks for reporting [@TopRoupi](https://github.com/TopRoupi) - add sort key logic in sort intrinsic, thanks for reporting [@TopRoupi](https://github.com/TopRoupi) +- add missing tan intrinsics +- add same errors in basic intrinsics as in ms +- use asap for nextTick behavior in interpreter +- implement format_columns logic +- improve output handler logic +- user_input supports anyKey now +- loading bars are supported now - deactivate breakpoint for injection during debugging in cli execution -- keep pending state after injection \ No newline at end of file +- keep pending state after injection +- update meta version with a few corrections \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7373dca5..23b068c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,14 +9,15 @@ "version": "1.3.7", "dependencies": { "@babel/runtime": "^7.16.7", + "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.7", - "greybel-gh-mock-intrinsics": "^1.2.0", - "greybel-interpreter": "^1.2.1", - "greybel-intrinsics": "^1.2.0", + "greybel-gh-mock-intrinsics": "^1.2.1", + "greybel-interpreter": "^1.2.9", + "greybel-intrinsics": "^1.2.5", "greybel-transpiler": "^0.6.0", "greyscript-core": "^0.4.1", - "greyscript-meta": "^1.1.5", + "greyscript-meta": "^1.1.8", "inquirer": "^8.1.0", "inquirer-command-prompt": "^0.1.0", "json-formatter-js": "^2.3.4", @@ -42,6 +43,7 @@ "@rollup/plugin-commonjs": "^21.0.1", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.1.3", + "@types/cli-progress": "^3.11.0", "@types/inquirer": "^8.1.3", "@types/mkdirp": "^1.0.2", "@types/node": "^18.7.9", @@ -2157,6 +2159,15 @@ "node": ">= 6" } }, + "node_modules/@types/cli-progress": { + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/@types/cli-progress/-/cli-progress-3.11.0.tgz", + "integrity": "sha512-XhXhBv1R/q2ahF3BM7qT5HLzJNlIL0wbcGyZVjqOTqAybAnsLisd7gy1UCyIqpL+5Iv6XhlSyzjLCnI2sIdbCg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", @@ -2629,6 +2640,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" + }, "node_modules/babel-plugin-dynamic-import-node": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", @@ -2974,6 +2990,17 @@ "node": ">=8" } }, + "node_modules/cli-progress": { + "version": "3.11.2", + "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.11.2.tgz", + "integrity": "sha512-lCPoS6ncgX4+rJu5bS3F/iCz17kZ9MPZ6dpuTtI0KXKABkhyXIdYB3Inby1OpaGti3YlI3EeEkM9AuWpelJrVA==", + "dependencies": { + "string-width": "^4.2.3" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/cli-spinners": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.7.0.tgz", @@ -4403,32 +4430,42 @@ } }, "node_modules/greybel-gh-mock-intrinsics": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.0.tgz", - "integrity": "sha512-17dLpoe6t4pdaBrCj20Ax05lHnTm6Et6759a2XQdtq3yhFKGBs9M6w45Vs/imqsw6Ugasfmyb7gCI7ImncsEiA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.1.tgz", + "integrity": "sha512-/3sL68Ll7apKqpc9H8W11w7Tlstwazf3Zo1qck2uKs3SO2njIEeK2bGPs8BOXU0SMXVNo+fRtMOabitVtmaEGw==", "dependencies": { - "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.2.1", - "random-seed": "^0.3.0", - "random-username-generator": "^1.0.4" + "greybel-interpreter": "^1.2.9", + "greybel-mock-environment": "^1.0.9" } }, "node_modules/greybel-interpreter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.2.1.tgz", - "integrity": "sha512-sCssGEoir0ZbJjn8k8iYqPV0mjG58CSPDET3eU06sQixTMU+kyJFFOY4m6r8OB6AA5R4un0KJ6IbKQkGtbw05w==", + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.2.9.tgz", + "integrity": "sha512-A8vPLuE9dWBHbjGHEgdcrIUEKJJCQORKzu/HVhEVU+sj1C4xKl2L9kKSoSv5abHWG6nD9fo0RAHT+Aj/RyPRTw==", "dependencies": { + "asap": "^2.0.6", "greybel-core": "^0.4.7", "greyscript-core": "^0.4.1" } }, "node_modules/greybel-intrinsics": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.0.tgz", - "integrity": "sha512-pdvk9tA94n1Yo6q5ZEbh3rdrrbip7TbQyxzzQFR9O+DFteIo4lffGICwVi9KLyAgXCoGJa0xZ3m8qwfc7MtWkQ==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.5.tgz", + "integrity": "sha512-2aeOiH3udbaC4c5y+aJ7ANLrklgy+HP75VtqwqXveP1Ol89umAsakK6DcepRyzaFvaCf8N/BUpwOId0qKJGpsQ==", "dependencies": { - "greybel-interpreter": "^1.2.1" + "greybel-interpreter": "^1.2.9" + } + }, + "node_modules/greybel-mock-environment": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.0.9.tgz", + "integrity": "sha512-bMOwLAbWPE3zHyEr1O+5BM+iKpJ96p08b9z78vsGoPnVJ4SSO+xlxnCfkcWKiz8nLk5MYuZ0fiLFcdMOec3BZA==", + "dependencies": { + "@types/random-seed": "^0.3.3", + "blueimp-md5": "^2.19.0", + "random-seed": "^0.3.0", + "random-username-generator": "^1.0.4" } }, "node_modules/greybel-transpiler": { @@ -4450,9 +4487,9 @@ } }, "node_modules/greyscript-meta": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/greyscript-meta/-/greyscript-meta-1.1.5.tgz", - "integrity": "sha512-3wBBlnP+gWwAg9ogyj0iXAk5RZXl6gIwE1XHdCrLYYB9+HVXBZ8AA8fP9QFLVIL5OFk0s0AIg8wqCXvu2H5HdQ==", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/greyscript-meta/-/greyscript-meta-1.1.8.tgz", + "integrity": "sha512-ltVcWNGR4WdkZ8A02GqTPEC1hwpZvxK40VdfD9cbpSvTJ4kiA/8og8gofIDArVMd3NccrnG+BH3YtRQT2So/sQ==", "dependencies": { "react-string-replace": "^1.1.0" }, @@ -8480,6 +8517,15 @@ "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", "dev": true }, + "@types/cli-progress": { + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/@types/cli-progress/-/cli-progress-3.11.0.tgz", + "integrity": "sha512-XhXhBv1R/q2ahF3BM7qT5HLzJNlIL0wbcGyZVjqOTqAybAnsLisd7gy1UCyIqpL+5Iv6XhlSyzjLCnI2sIdbCg==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", @@ -8810,6 +8856,11 @@ "es-shim-unscopables": "^1.0.0" } }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" + }, "babel-plugin-dynamic-import-node": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", @@ -9051,6 +9102,14 @@ "restore-cursor": "^3.1.0" } }, + "cli-progress": { + "version": "3.11.2", + "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.11.2.tgz", + "integrity": "sha512-lCPoS6ncgX4+rJu5bS3F/iCz17kZ9MPZ6dpuTtI0KXKABkhyXIdYB3Inby1OpaGti3YlI3EeEkM9AuWpelJrVA==", + "requires": { + "string-width": "^4.2.3" + } + }, "cli-spinners": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.7.0.tgz", @@ -10125,32 +10184,42 @@ } }, "greybel-gh-mock-intrinsics": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.0.tgz", - "integrity": "sha512-17dLpoe6t4pdaBrCj20Ax05lHnTm6Et6759a2XQdtq3yhFKGBs9M6w45Vs/imqsw6Ugasfmyb7gCI7ImncsEiA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.1.tgz", + "integrity": "sha512-/3sL68Ll7apKqpc9H8W11w7Tlstwazf3Zo1qck2uKs3SO2njIEeK2bGPs8BOXU0SMXVNo+fRtMOabitVtmaEGw==", "requires": { - "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.2.1", - "random-seed": "^0.3.0", - "random-username-generator": "^1.0.4" + "greybel-interpreter": "^1.2.9", + "greybel-mock-environment": "^1.0.9" } }, "greybel-interpreter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.2.1.tgz", - "integrity": "sha512-sCssGEoir0ZbJjn8k8iYqPV0mjG58CSPDET3eU06sQixTMU+kyJFFOY4m6r8OB6AA5R4un0KJ6IbKQkGtbw05w==", + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.2.9.tgz", + "integrity": "sha512-A8vPLuE9dWBHbjGHEgdcrIUEKJJCQORKzu/HVhEVU+sj1C4xKl2L9kKSoSv5abHWG6nD9fo0RAHT+Aj/RyPRTw==", "requires": { + "asap": "^2.0.6", "greybel-core": "^0.4.7", "greyscript-core": "^0.4.1" } }, "greybel-intrinsics": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.0.tgz", - "integrity": "sha512-pdvk9tA94n1Yo6q5ZEbh3rdrrbip7TbQyxzzQFR9O+DFteIo4lffGICwVi9KLyAgXCoGJa0xZ3m8qwfc7MtWkQ==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.5.tgz", + "integrity": "sha512-2aeOiH3udbaC4c5y+aJ7ANLrklgy+HP75VtqwqXveP1Ol89umAsakK6DcepRyzaFvaCf8N/BUpwOId0qKJGpsQ==", "requires": { - "greybel-interpreter": "^1.2.1" + "greybel-interpreter": "^1.2.9" + } + }, + "greybel-mock-environment": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.0.9.tgz", + "integrity": "sha512-bMOwLAbWPE3zHyEr1O+5BM+iKpJ96p08b9z78vsGoPnVJ4SSO+xlxnCfkcWKiz8nLk5MYuZ0fiLFcdMOec3BZA==", + "requires": { + "@types/random-seed": "^0.3.3", + "blueimp-md5": "^2.19.0", + "random-seed": "^0.3.0", + "random-username-generator": "^1.0.4" } }, "greybel-transpiler": { @@ -10172,9 +10241,9 @@ } }, "greyscript-meta": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/greyscript-meta/-/greyscript-meta-1.1.5.tgz", - "integrity": "sha512-3wBBlnP+gWwAg9ogyj0iXAk5RZXl6gIwE1XHdCrLYYB9+HVXBZ8AA8fP9QFLVIL5OFk0s0AIg8wqCXvu2H5HdQ==", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/greyscript-meta/-/greyscript-meta-1.1.8.tgz", + "integrity": "sha512-ltVcWNGR4WdkZ8A02GqTPEC1hwpZvxK40VdfD9cbpSvTJ4kiA/8og8gofIDArVMd3NccrnG+BH3YtRQT2So/sQ==", "requires": { "react-string-replace": "^1.1.0" } diff --git a/package.json b/package.json index b0abfc5a..ab28d1d3 100644 --- a/package.json +++ b/package.json @@ -22,14 +22,15 @@ ], "dependencies": { "@babel/runtime": "^7.16.7", + "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.7", - "greybel-gh-mock-intrinsics": "^1.2.0", - "greybel-interpreter": "^1.2.1", - "greybel-intrinsics": "^1.2.0", + "greybel-gh-mock-intrinsics": "^1.2.1", + "greybel-interpreter": "^1.2.9", + "greybel-intrinsics": "^1.2.5", "greybel-transpiler": "^0.6.0", "greyscript-core": "^0.4.1", - "greyscript-meta": "^1.1.5", + "greyscript-meta": "^1.1.8", "inquirer": "^8.1.0", "inquirer-command-prompt": "^0.1.0", "json-formatter-js": "^2.3.4", @@ -91,6 +92,7 @@ "@rollup/plugin-commonjs": "^21.0.1", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.1.3", + "@types/cli-progress": "^3.11.0", "@types/inquirer": "^8.1.3", "@types/mkdirp": "^1.0.2", "@types/node": "^18.7.9", diff --git a/src/execute.ts b/src/execute.ts index 8aa0cc04..d0887e9f 100644 --- a/src/execute.ts +++ b/src/execute.ts @@ -5,11 +5,16 @@ import { CustomValue, Debugger, Defaults, + HandlerContainer, Interpreter, - OperationContext + KeyEvent, + OperationContext, + OutputHandler } from 'greybel-interpreter'; +import readline from 'readline'; import { init as initIntrinsics } from 'greybel-intrinsics'; import { ASTBase } from 'greyscript-core'; +import cliProgress from 'cli-progress'; import inquirer from 'inquirer'; inquirer.registerPrompt('command', require('inquirer-command-prompt')); @@ -70,6 +75,173 @@ class GrebyelPseudoDebugger extends Debugger { } } +export interface NodeJSKeyEvent { + sequence: string; + name: string; + ctrl: boolean; + meta: boolean; + shift: boolean; + code?: string; +} + +export enum NodeJSKey { + Return = 'return', + Escape = 'escape', + Space = 'space', + Tab = 'tab', + Up = 'up', + Right = 'right', + Left = 'left', + Down = 'down', + Backspace = 'backspace', + Insert = 'insert', + Home = 'home', + End = 'end', + PageDown = 'pagedown', + PageUp = 'pageup', + Delete = 'delete', + F1 = 'f1', + F2 = 'f2', + F3 = 'f3', + F4 = 'f4', + F5 = 'f5', + F6 = 'f6', + F7 = 'f7', + F8 = 'f8', + F9 = 'f9', + F10 = 'f10', + F11 = 'f11', + F12 = 'f12' +} + +export function nodeJSKeyEventToKeyEvent(nodeJSKeyEvent: NodeJSKeyEvent): KeyEvent { + const create = (keyCode: number, code: string): KeyEvent => ({ keyCode, code }); + + switch (nodeJSKeyEvent.name) { + case NodeJSKey.Return: + return create(13, 'Enter'); + case NodeJSKey.Escape: + return create(27, 'Escape'); + case NodeJSKey.Space: + return create(32, 'Space'); + case NodeJSKey.Tab: + return create(9, 'Tab'); + case NodeJSKey.Left: + return create(37, 'ArrowLeft'); + case NodeJSKey.Up: + return create(38, 'ArrowUp'); + case NodeJSKey.Right: + return create(39, 'ArrowRight'); + case NodeJSKey.Down: + return create(40, 'ArrowDown'); + case NodeJSKey.Backspace: + return create(8, 'Backspace'); + case NodeJSKey.Insert: + return create(45, 'Insert'); + case NodeJSKey.Home: + return create(36, 'Home'); + case NodeJSKey.End: + return create(35, 'End'); + case NodeJSKey.PageDown: + return create(34, 'PageDown'); + case NodeJSKey.PageUp: + return create(33, 'PageUp'); + case NodeJSKey.Delete: + return create(46, 'Delete'); + case NodeJSKey.F1: + return create(112, 'F1'); + case NodeJSKey.F2: + return create(113, 'F2'); + case NodeJSKey.F3: + return create(114, 'F3'); + case NodeJSKey.F4: + return create(115, 'F4'); + case NodeJSKey.F5: + return create(116, 'F5'); + case NodeJSKey.F6: + return create(117, 'F6'); + case NodeJSKey.F7: + return create(118, 'F7'); + case NodeJSKey.F8: + return create(119, 'F8'); + case NodeJSKey.F9: + return create(120, 'F9'); + case NodeJSKey.F10: + return create(121, 'F10'); + case NodeJSKey.F11: + return create(122, 'F11'); + case NodeJSKey.F12: + return create(123, 'F12'); + default: { + const char = nodeJSKeyEvent.sequence.toLowerCase(); + const keyCode = char.charCodeAt(0); + const code = nodeJSKeyEvent.name || char; + return create(keyCode, code); + } + } +} + +export class CLIOutputHandler extends OutputHandler { + print(message: string) { + console.log(message); + } + + clear() { + console.clear(); + } + + progress(timeout: number): Promise { + const startTime = Date.now(); + const loadingBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic); + loadingBar.start(timeout, 0); + + return new Promise((resolve, _reject) => { + const interval = setInterval(() => { + const currentTime = Date.now(); + const elapsed = currentTime - startTime; + + if (elapsed > timeout) { + clearInterval(interval); + loadingBar.stop(); + resolve(); + return; + } + + loadingBar.update(elapsed); + }); + }); + } + + waitForInput(isPassword: boolean): Promise { + return inquirer + .prompt({ + name: 'default', + type: isPassword ? 'password' : 'input', + loop: false + }) + .then((inputMap) => { + return inputMap.default; + }) + .catch((err) => { + throw err; + }); + } + + waitForKeyPress(): Promise { + return new Promise((resolve, _reject) => { + readline.emitKeypressEvents(process.stdin); + + process.stdin.resume(); + process.stdin.setRawMode(true); + + process.stdin.once('keypress', (character: string, key: NodeJSKeyEvent) => { + process.stdin.pause(); + resolve(nodeJSKeyEventToKeyEvent(key)); + }); + }); + } +}; + export interface ExecuteOptions { api?: Map; params?: string[]; @@ -79,74 +251,12 @@ export default async function execute( target: string, options: ExecuteOptions = {} ): Promise { - const vsAPI = options.api || new Map(); - - vsAPI.set( - 'print', - CustomFunction.createExternal( - 'print', - ( - _ctx: OperationContext, - _self: CustomValue, - args: Map - ): Promise => { - console.log(args.get('value')?.toString()); - return Promise.resolve(Defaults.Void); - } - ).addArgument('value') - ); - - vsAPI.set( - 'exit', - CustomFunction.createExternal( - 'exit', - ( - _ctx: OperationContext, - _self: CustomValue, - args: Map - ): Promise => { - console.log(args.get('value')?.toString()); - interpreter.exit(); - return Promise.resolve(Defaults.Void); - } - ).addArgument('value') - ); - - vsAPI.set( - 'user_input', - CustomFunction.createExternal( - 'user_input', - async ( - _ctx: OperationContext, - _self: CustomValue, - args: Map - ): Promise => { - const message = args.get('message')?.toString(); - const isPassword = args.get('isPassword')?.toTruthy(); - - return inquirer - .prompt({ - name: 'default', - message, - type: isPassword ? 'password' : 'input', - loop: false - }) - .then(function (inputMap) { - return new CustomString(inputMap.default); - }) - .catch((err) => { - throw err; - }); - } - ) - .addArgument('message') - .addArgument('isPassword') - .addArgument('anyKey') - ); - const interpreter = new Interpreter({ target, - api: initIntrinsics(initGHIntrinsics(vsAPI)) + handler: new HandlerContainer({ + outputHandler: new CLIOutputHandler() + }), + api: initIntrinsics(initGHIntrinsics()) }); interpreter.setDebugger(new GrebyelPseudoDebugger(interpreter)); diff --git a/src/repl.ts b/src/repl.ts index dd5bf33a..aa4a4042 100644 --- a/src/repl.ts +++ b/src/repl.ts @@ -1,15 +1,16 @@ import { init as initGHIntrinsics } from 'greybel-gh-mock-intrinsics'; import { CustomFunction, - CustomString, CustomValue, Debugger, Defaults, + HandlerContainer, Interpreter, OperationContext } from 'greybel-interpreter'; import { init as initIntrinsics } from 'greybel-intrinsics'; import inquirer from 'inquirer'; +import { CLIOutputHandler } from './execute'; inquirer.registerPrompt('command', require('inquirer-command-prompt')); class GrebyelPseudoDebugger extends Debugger { @@ -34,66 +35,27 @@ export default async function repl( const vsAPI = options.api || new Map(); let active = true; - vsAPI.set( - 'print', - CustomFunction.createExternal( - 'print', - ( - _ctx: OperationContext, - _self: CustomValue, - args: Map - ): Promise => { - console.log(args.get('value')?.toString()); - return Promise.resolve(Defaults.Void); - } - ).addArgument('value') - ); - vsAPI.set( 'exit', CustomFunction.createExternal( 'exit', ( - _ctx: OperationContext, + ctx: OperationContext, _self: CustomValue, args: Map ): Promise => { - console.log(args.get('value')?.toString()); + ctx.handler.outputHandler.print(args.get('value')!.toString()); active = false; return Promise.resolve(Defaults.Void); } ).addArgument('value') ); - vsAPI.set( - 'user_input', - CustomFunction.createExternal( - 'user_input', - async ( - _ctx: OperationContext, - _self: CustomValue, - args: Map - ): Promise => { - const message = args.get('message')?.toString(); - const isPassword = args.get('isPassword')?.toTruthy(); - - const result = await inquirer.prompt({ - name: 'default', - message, - type: isPassword ? 'password' : 'input', - loop: false - }); - - return new CustomString(result?.default); - } - ) - .addArgument('message') - .addArgument('isPassword') - .addArgument('anyKey') - ); - const interpreter = new Interpreter({ debugger: new GrebyelPseudoDebugger(), + handler: new HandlerContainer({ + outputHandler: new CLIOutputHandler() + }), api: initIntrinsics(initGHIntrinsics(vsAPI)) }); From 912f130783d23353f851a8c190d3599ffb795ca1 Mon Sep 17 00:00:00 2001 From: ayecue Date: Sun, 18 Sep 2022 22:26:49 +0200 Subject: [PATCH 04/28] 1.3.7 keyCode value for normal buttons --- src/execute.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/execute.ts b/src/execute.ts index d0887e9f..2856018a 100644 --- a/src/execute.ts +++ b/src/execute.ts @@ -173,8 +173,8 @@ export function nodeJSKeyEventToKeyEvent(nodeJSKeyEvent: NodeJSKeyEvent): KeyEve case NodeJSKey.F12: return create(123, 'F12'); default: { - const char = nodeJSKeyEvent.sequence.toLowerCase(); - const keyCode = char.charCodeAt(0); + const char = nodeJSKeyEvent.sequence; + const keyCode = char.toUpperCase().charCodeAt(0); const code = nodeJSKeyEvent.name || char; return create(keyCode, code); } @@ -216,6 +216,7 @@ export class CLIOutputHandler extends OutputHandler { return inquirer .prompt({ name: 'default', + message: 'Input:', type: isPassword ? 'password' : 'input', loop: false }) From 7506d3804fbf0fc7f6d20da24eca385c3cc0de3b Mon Sep 17 00:00:00 2001 From: ayecue Date: Sun, 18 Sep 2022 23:18:46 +0200 Subject: [PATCH 05/28] 1.3.7 implement output handler into web --- package-lock.json | 50 +++++++++---------- package.json | 6 +-- src/web/execute.ts | 121 +++++++++++++++++++++++---------------------- src/web/std.ts | 26 ++++++++-- 4 files changed, 114 insertions(+), 89 deletions(-) diff --git a/package-lock.json b/package-lock.json index 23b068c2..5b667513 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,9 +12,9 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.7", - "greybel-gh-mock-intrinsics": "^1.2.1", - "greybel-interpreter": "^1.2.9", - "greybel-intrinsics": "^1.2.5", + "greybel-gh-mock-intrinsics": "^1.2.2", + "greybel-interpreter": "^1.3.0", + "greybel-intrinsics": "^1.2.6", "greybel-transpiler": "^0.6.0", "greyscript-core": "^0.4.1", "greyscript-meta": "^1.1.8", @@ -4430,19 +4430,19 @@ } }, "node_modules/greybel-gh-mock-intrinsics": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.1.tgz", - "integrity": "sha512-/3sL68Ll7apKqpc9H8W11w7Tlstwazf3Zo1qck2uKs3SO2njIEeK2bGPs8BOXU0SMXVNo+fRtMOabitVtmaEGw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.2.tgz", + "integrity": "sha512-hMhSjWFGUWvX/RY+kWBQrYrajjUvLC/Limf+SbtVMeD8uvbmiDDZQQn4V2kMhY5plQVsK+A2fUk5tRk8ZOWjBA==", "dependencies": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.2.9", + "greybel-interpreter": "^1.3.0", "greybel-mock-environment": "^1.0.9" } }, "node_modules/greybel-interpreter": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.2.9.tgz", - "integrity": "sha512-A8vPLuE9dWBHbjGHEgdcrIUEKJJCQORKzu/HVhEVU+sj1C4xKl2L9kKSoSv5abHWG6nD9fo0RAHT+Aj/RyPRTw==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.0.tgz", + "integrity": "sha512-XQXQZSROTsLy48hX9n0rzcb+xjmZtF85pFtlNX9Q57+w4eCyg4pcjVzmW6OYPNSFosq5QsU1FinVse8tahWEVg==", "dependencies": { "asap": "^2.0.6", "greybel-core": "^0.4.7", @@ -4450,11 +4450,11 @@ } }, "node_modules/greybel-intrinsics": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.5.tgz", - "integrity": "sha512-2aeOiH3udbaC4c5y+aJ7ANLrklgy+HP75VtqwqXveP1Ol89umAsakK6DcepRyzaFvaCf8N/BUpwOId0qKJGpsQ==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.6.tgz", + "integrity": "sha512-t74AQuwo/uq2AhnJfUqGzhNusZvVUp0McQ0v9ogFqgzx2vyrbFQMpwgsbbAIqyF4n0IXVdWvnD/J/nWJbhmp8w==", "dependencies": { - "greybel-interpreter": "^1.2.9" + "greybel-interpreter": "^1.3.0" } }, "node_modules/greybel-mock-environment": { @@ -10184,19 +10184,19 @@ } }, "greybel-gh-mock-intrinsics": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.1.tgz", - "integrity": "sha512-/3sL68Ll7apKqpc9H8W11w7Tlstwazf3Zo1qck2uKs3SO2njIEeK2bGPs8BOXU0SMXVNo+fRtMOabitVtmaEGw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.2.tgz", + "integrity": "sha512-hMhSjWFGUWvX/RY+kWBQrYrajjUvLC/Limf+SbtVMeD8uvbmiDDZQQn4V2kMhY5plQVsK+A2fUk5tRk8ZOWjBA==", "requires": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.2.9", + "greybel-interpreter": "^1.3.0", "greybel-mock-environment": "^1.0.9" } }, "greybel-interpreter": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.2.9.tgz", - "integrity": "sha512-A8vPLuE9dWBHbjGHEgdcrIUEKJJCQORKzu/HVhEVU+sj1C4xKl2L9kKSoSv5abHWG6nD9fo0RAHT+Aj/RyPRTw==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.0.tgz", + "integrity": "sha512-XQXQZSROTsLy48hX9n0rzcb+xjmZtF85pFtlNX9Q57+w4eCyg4pcjVzmW6OYPNSFosq5QsU1FinVse8tahWEVg==", "requires": { "asap": "^2.0.6", "greybel-core": "^0.4.7", @@ -10204,11 +10204,11 @@ } }, "greybel-intrinsics": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.5.tgz", - "integrity": "sha512-2aeOiH3udbaC4c5y+aJ7ANLrklgy+HP75VtqwqXveP1Ol89umAsakK6DcepRyzaFvaCf8N/BUpwOId0qKJGpsQ==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.6.tgz", + "integrity": "sha512-t74AQuwo/uq2AhnJfUqGzhNusZvVUp0McQ0v9ogFqgzx2vyrbFQMpwgsbbAIqyF4n0IXVdWvnD/J/nWJbhmp8w==", "requires": { - "greybel-interpreter": "^1.2.9" + "greybel-interpreter": "^1.3.0" } }, "greybel-mock-environment": { diff --git a/package.json b/package.json index ab28d1d3..c52ff694 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,9 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.7", - "greybel-gh-mock-intrinsics": "^1.2.1", - "greybel-interpreter": "^1.2.9", - "greybel-intrinsics": "^1.2.5", + "greybel-gh-mock-intrinsics": "^1.2.2", + "greybel-interpreter": "^1.3.0", + "greybel-intrinsics": "^1.2.6", "greybel-transpiler": "^0.6.0", "greyscript-core": "^0.4.1", "greyscript-meta": "^1.1.8", diff --git a/src/web/execute.ts b/src/web/execute.ts index 7582dbc4..b9037752 100644 --- a/src/web/execute.ts +++ b/src/web/execute.ts @@ -7,7 +7,9 @@ import { Defaults, HandlerContainer, Interpreter, + KeyEvent, OperationContext, + OutputHandler, ResourceHandler } from 'greybel-interpreter'; import { init as initIntrinsics } from 'greybel-intrinsics'; @@ -69,70 +71,72 @@ export default async function execute( await activeInterpreter.exit(); } - vsAPI.set( - 'print', - CustomFunction.createExternal( - 'print', - ( - _ctx: OperationContext, - _self: CustomValue, - args: Map - ): Promise => { - stdout.write(args.get('value')?.toString()); - return Promise.resolve(Defaults.Void); - } - ).addArgument('value') - ); - - vsAPI.set( - 'exit', - CustomFunction.createExternal( - 'exit', - ( - _ctx: OperationContext, - _self: CustomValue, - args: Map - ): Promise => { - stdout.write(args.get('value')?.toString()); - interpreter.exit(); - return Promise.resolve(Defaults.Void); - } - ).addArgument('value') - ); + const WebOutputHandler = class extends OutputHandler { + print(message: string) { + stdout.write(message); + } - vsAPI.set( - 'user_input', - CustomFunction.createExternal( - 'user_input', - async ( - _ctx: OperationContext, - _self: CustomValue, - args: Map - ): Promise => { - const message = args.get('message')?.toString(); - const isPassword = args.get('isPassword')?.toTruthy(); + clear() { + stdout.clear(); + } - stdout.write(message); + progress(timeout: number): Promise { + const startTime = Date.now(); + const max = 20; + stdout.write(`[${'-'.repeat(max)}]`); + + return new Promise((resolve, _reject) => { + const interval = setInterval(() => { + const currentTime = Date.now(); + const elapsed = currentTime - startTime; + + if (elapsed > timeout) { + stdout.updateLast(`[${'#'.repeat(max)}]`); + clearInterval(interval); + resolve(); + return; + } + + const elapsedPercentage = 100 * elapsed / timeout; + const progress = Math.floor(elapsedPercentage * max / 100); + const right = max - progress; + + stdout.updateLast(`[${'#'.repeat(progress)}${'-'.repeat(right)}]`); + }); + }); + } - stdin.enable(); - stdin.focus(); - stdin.setType(isPassword ? 'password' : 'text'); + async waitForInput(isPassword: boolean): Promise { + stdin.enable(); + stdin.focus(); + stdin.setType(isPassword ? 'password' : 'text'); - await stdin.waitForInput(); + await stdin.waitForInput(); - const value = stdin.getValue(); + const value = stdin.getValue(); - stdin.clear(); - stdin.disable(); - stdin.setType('text'); + stdin.clear(); + stdin.disable(); + stdin.setType('text'); - return new CustomString(value); - } - ) - .addArgument('message') - .addArgument('isPassword') - .addArgument('anyKey') - ); + return value; + } + + async waitForKeyPress(): Promise { + stdin.enable(); + stdin.focus(); + + const keyEvent = await stdin.waitForKeyPress(); + + stdin.clear(); + stdin.disable(); + + return { + keyCode: keyEvent.keyCode, + code: keyEvent.code + }; + } + } class PseudoResourceHandler extends ResourceHandler { getTargetRelativeTo(_source: string, _target: string): Promise { @@ -156,7 +160,8 @@ export default async function execute( target: 'default', debugger: new GrebyelDebugger(options.onInteract), handler: new HandlerContainer({ - resourceHandler: new PseudoResourceHandler() + resourceHandler: new PseudoResourceHandler(), + outputHandler: new WebOutputHandler() }), api: initIntrinsics(initGHIntrinsics(vsAPI)) }); diff --git a/src/web/std.ts b/src/web/std.ts index d763dcf9..4278f598 100644 --- a/src/web/std.ts +++ b/src/web/std.ts @@ -39,15 +39,15 @@ export class Stdin { me.target.type = type; } - waitForInput() { + waitForInput(): Promise { const me = this; const target = me.target; const id = v4(); me.queue.unshift(id); - return new Promise((resolve: any) => { - const handler = (evt: any) => { + return new Promise((resolve) => { + const handler = (evt: KeyboardEvent) => { if (evt.keyCode === 13) { const currentId = me.queue[0]; @@ -63,6 +63,20 @@ export class Stdin { target.addEventListener('keydown', handler); }); } + + waitForKeyPress(): Promise { + const me = this; + const target = me.target; + + return new Promise((resolve) => { + const handler = (evt: KeyboardEvent) => { + target.removeEventListener('keydown', handler); + resolve(evt); + }; + + target.addEventListener('keydown', handler); + }); + } } export class Stdout { @@ -80,6 +94,12 @@ export class Stdout { me.render(); } + updateLast(value: any) { + const me = this; + me.history[me.history.length - 1] = value; + me.render(); + } + render() { const me = this; const target = me.target; From 151ea7a5a4f9a824c91ce3b1fe7f83ace63057d7 Mon Sep 17 00:00:00 2001 From: ayecue Date: Sun, 18 Sep 2022 23:36:11 +0200 Subject: [PATCH 06/28] 1.3.7 bump interpreter --- CHANGELOG.md | 1 - package-lock.json | 62 +++++++++++++++++++---------------------------- package.json | 6 ++--- 3 files changed, 28 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03d5e76e..8c693eb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -283,7 +283,6 @@ All notable changes to this project will be documented in this file. - add sort key logic in sort intrinsic, thanks for reporting [@TopRoupi](https://github.com/TopRoupi) - add missing tan intrinsics - add same errors in basic intrinsics as in ms -- use asap for nextTick behavior in interpreter - implement format_columns logic - improve output handler logic - user_input supports anyKey now diff --git a/package-lock.json b/package-lock.json index 5b667513..7f440841 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,9 +12,9 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.7", - "greybel-gh-mock-intrinsics": "^1.2.2", - "greybel-interpreter": "^1.3.0", - "greybel-intrinsics": "^1.2.6", + "greybel-gh-mock-intrinsics": "^1.2.3", + "greybel-interpreter": "^1.3.1", + "greybel-intrinsics": "^1.2.7", "greybel-transpiler": "^0.6.0", "greyscript-core": "^0.4.1", "greyscript-meta": "^1.1.8", @@ -2640,11 +2640,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" - }, "node_modules/babel-plugin-dynamic-import-node": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", @@ -4430,31 +4425,30 @@ } }, "node_modules/greybel-gh-mock-intrinsics": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.2.tgz", - "integrity": "sha512-hMhSjWFGUWvX/RY+kWBQrYrajjUvLC/Limf+SbtVMeD8uvbmiDDZQQn4V2kMhY5plQVsK+A2fUk5tRk8ZOWjBA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.3.tgz", + "integrity": "sha512-hajGNNycIa/hqfMiQAizVQ8N5jO6UiZUz+8D9kw8YbTEmrsMJ6SwrdOftIorH44ryw0hJosYgbF8tZgAhaQ/qw==", "dependencies": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.0", + "greybel-interpreter": "^1.3.1", "greybel-mock-environment": "^1.0.9" } }, "node_modules/greybel-interpreter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.0.tgz", - "integrity": "sha512-XQXQZSROTsLy48hX9n0rzcb+xjmZtF85pFtlNX9Q57+w4eCyg4pcjVzmW6OYPNSFosq5QsU1FinVse8tahWEVg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.1.tgz", + "integrity": "sha512-Zvdab+c/Mwv9gmfn8AOYm2r9y/sNFCbfvVKkWTd+g+60uN2pRT+vOuCP6D2zFwwVywDBkHcApRfMSDPI+vbyFw==", "dependencies": { - "asap": "^2.0.6", "greybel-core": "^0.4.7", "greyscript-core": "^0.4.1" } }, "node_modules/greybel-intrinsics": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.6.tgz", - "integrity": "sha512-t74AQuwo/uq2AhnJfUqGzhNusZvVUp0McQ0v9ogFqgzx2vyrbFQMpwgsbbAIqyF4n0IXVdWvnD/J/nWJbhmp8w==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.7.tgz", + "integrity": "sha512-VaYCzQTYI0doGKD5iOGefKz4PckCjcgk3t597Hq35F0lkfEGGF+z6bnT2er1iWhDfz8CUTrhJAVKhpuofXD8tQ==", "dependencies": { - "greybel-interpreter": "^1.3.0" + "greybel-interpreter": "^1.3.1" } }, "node_modules/greybel-mock-environment": { @@ -8856,11 +8850,6 @@ "es-shim-unscopables": "^1.0.0" } }, - "asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" - }, "babel-plugin-dynamic-import-node": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", @@ -10184,31 +10173,30 @@ } }, "greybel-gh-mock-intrinsics": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.2.tgz", - "integrity": "sha512-hMhSjWFGUWvX/RY+kWBQrYrajjUvLC/Limf+SbtVMeD8uvbmiDDZQQn4V2kMhY5plQVsK+A2fUk5tRk8ZOWjBA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.3.tgz", + "integrity": "sha512-hajGNNycIa/hqfMiQAizVQ8N5jO6UiZUz+8D9kw8YbTEmrsMJ6SwrdOftIorH44ryw0hJosYgbF8tZgAhaQ/qw==", "requires": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.0", + "greybel-interpreter": "^1.3.1", "greybel-mock-environment": "^1.0.9" } }, "greybel-interpreter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.0.tgz", - "integrity": "sha512-XQXQZSROTsLy48hX9n0rzcb+xjmZtF85pFtlNX9Q57+w4eCyg4pcjVzmW6OYPNSFosq5QsU1FinVse8tahWEVg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.1.tgz", + "integrity": "sha512-Zvdab+c/Mwv9gmfn8AOYm2r9y/sNFCbfvVKkWTd+g+60uN2pRT+vOuCP6D2zFwwVywDBkHcApRfMSDPI+vbyFw==", "requires": { - "asap": "^2.0.6", "greybel-core": "^0.4.7", "greyscript-core": "^0.4.1" } }, "greybel-intrinsics": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.6.tgz", - "integrity": "sha512-t74AQuwo/uq2AhnJfUqGzhNusZvVUp0McQ0v9ogFqgzx2vyrbFQMpwgsbbAIqyF4n0IXVdWvnD/J/nWJbhmp8w==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.7.tgz", + "integrity": "sha512-VaYCzQTYI0doGKD5iOGefKz4PckCjcgk3t597Hq35F0lkfEGGF+z6bnT2er1iWhDfz8CUTrhJAVKhpuofXD8tQ==", "requires": { - "greybel-interpreter": "^1.3.0" + "greybel-interpreter": "^1.3.1" } }, "greybel-mock-environment": { diff --git a/package.json b/package.json index c52ff694..3d007a68 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,9 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.7", - "greybel-gh-mock-intrinsics": "^1.2.2", - "greybel-interpreter": "^1.3.0", - "greybel-intrinsics": "^1.2.6", + "greybel-gh-mock-intrinsics": "^1.2.3", + "greybel-interpreter": "^1.3.1", + "greybel-intrinsics": "^1.2.7", "greybel-transpiler": "^0.6.0", "greyscript-core": "^0.4.1", "greyscript-meta": "^1.1.8", From 97501635e4087a45987b9b507895b05136288f4c Mon Sep 17 00:00:00 2001 From: ayecue Date: Sun, 18 Sep 2022 23:37:32 +0200 Subject: [PATCH 07/28] 1.3.7 apply lint --- .eslintrc | 3 ++- src/web/execute.ts | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.eslintrc b/.eslintrc index c57f4976..95838e8a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -15,7 +15,8 @@ "NodeJS": true, "Element": true, "localStorage": true, - "location": true + "location": true, + "KeyboardEvent": true }, "settings": { "import/resolver": { diff --git a/src/web/execute.ts b/src/web/execute.ts index b9037752..5c77fb9a 100644 --- a/src/web/execute.ts +++ b/src/web/execute.ts @@ -1,7 +1,6 @@ import { init as initGHIntrinsics } from 'greybel-gh-mock-intrinsics'; import { CustomFunction, - CustomString, CustomValue, Debugger, Defaults, @@ -97,8 +96,8 @@ export default async function execute( return; } - const elapsedPercentage = 100 * elapsed / timeout; - const progress = Math.floor(elapsedPercentage * max / 100); + const elapsedPercentage = (100 * elapsed) / timeout; + const progress = Math.floor((elapsedPercentage * max) / 100); const right = max - progress; stdout.updateLast(`[${'#'.repeat(progress)}${'-'.repeat(right)}]`); @@ -136,7 +135,7 @@ export default async function execute( code: keyEvent.code }; } - } + }; class PseudoResourceHandler extends ResourceHandler { getTargetRelativeTo(_source: string, _target: string): Promise { From e13a8156157f00af50ec1b9e21971e7fce814560 Mon Sep 17 00:00:00 2001 From: ayecue Date: Mon, 19 Sep 2022 18:55:48 +0200 Subject: [PATCH 08/28] 1.3.7 bump packages --- package-lock.json | 94 +++++++++++++++++++++++------------------------ package.json | 10 ++--- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7f440841..6dafcfc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,12 +11,12 @@ "@babel/runtime": "^7.16.7", "cli-progress": "^3.11.2", "commander": "^7.2.0", - "greybel-core": "^0.4.7", - "greybel-gh-mock-intrinsics": "^1.2.3", - "greybel-interpreter": "^1.3.1", - "greybel-intrinsics": "^1.2.7", + "greybel-core": "^0.4.8", + "greybel-gh-mock-intrinsics": "^1.2.4", + "greybel-interpreter": "^1.3.2", + "greybel-intrinsics": "^1.2.8", "greybel-transpiler": "^0.6.0", - "greyscript-core": "^0.4.1", + "greyscript-core": "^0.4.3", "greyscript-meta": "^1.1.8", "inquirer": "^8.1.0", "inquirer-command-prompt": "^0.1.0", @@ -4417,38 +4417,38 @@ "dev": true }, "node_modules/greybel-core": { - "version": "0.4.7", - "resolved": "https://registry.npmjs.org/greybel-core/-/greybel-core-0.4.7.tgz", - "integrity": "sha512-LR5xirYRtWA7s+pFbFcX+2fcjexHBaAng2ADuxqu2JlN9hEAhyBqU0Ang25GXOSc0p81MZQBgu2YgXoLKIFVaA==", + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/greybel-core/-/greybel-core-0.4.8.tgz", + "integrity": "sha512-98SFeA5vJEfwumTfoYW5SFN8TXGoqyWhqnyEbjZuPsKbY0Yhz8PtZJGwyOx4enMG4u9KjuwrJDo7OY/W6Jzzjw==", "dependencies": { - "greyscript-core": "^0.4.1" + "greyscript-core": "^0.4.3" } }, "node_modules/greybel-gh-mock-intrinsics": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.3.tgz", - "integrity": "sha512-hajGNNycIa/hqfMiQAizVQ8N5jO6UiZUz+8D9kw8YbTEmrsMJ6SwrdOftIorH44ryw0hJosYgbF8tZgAhaQ/qw==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.4.tgz", + "integrity": "sha512-Wx/k53+YuK9UlqOr7Tp3mQm+2dbwvA2PWb6dgkjwDpieeUz+WQdsqPBy8dqxymMUMx1jlNPVHHLy7JC0P+J6Lg==", "dependencies": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.1", + "greybel-interpreter": "^1.3.2", "greybel-mock-environment": "^1.0.9" } }, "node_modules/greybel-interpreter": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.1.tgz", - "integrity": "sha512-Zvdab+c/Mwv9gmfn8AOYm2r9y/sNFCbfvVKkWTd+g+60uN2pRT+vOuCP6D2zFwwVywDBkHcApRfMSDPI+vbyFw==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.2.tgz", + "integrity": "sha512-C5QqyW2O2Wy/EoxAn9Beg399/gh4P/tpVjgx6rZrCoT2NflGi+2Jhhc1YlBGS2fhl6qaDjoOHUynXfeRplmVdg==", "dependencies": { - "greybel-core": "^0.4.7", - "greyscript-core": "^0.4.1" + "greybel-core": "^0.4.8", + "greyscript-core": "^0.4.3" } }, "node_modules/greybel-intrinsics": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.7.tgz", - "integrity": "sha512-VaYCzQTYI0doGKD5iOGefKz4PckCjcgk3t597Hq35F0lkfEGGF+z6bnT2er1iWhDfz8CUTrhJAVKhpuofXD8tQ==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.8.tgz", + "integrity": "sha512-mcAJHcgPr1d0R3LbKcpLa8rXMCZsht+j9w6wgo3CmtiZQB/SsNRtGB4+9PIN9CeZnusj3TN8R+w6niUOdJFrPQ==", "dependencies": { - "greybel-interpreter": "^1.3.1" + "greybel-interpreter": "^1.3.2" } }, "node_modules/greybel-mock-environment": { @@ -4473,11 +4473,11 @@ } }, "node_modules/greyscript-core": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/greyscript-core/-/greyscript-core-0.4.1.tgz", - "integrity": "sha512-eF0GChvsxLlk8wdWON46IypJVPBif/oQyP7LES9giQQm/BF1De+ey9r9M+xrEvzxgzw8fzPXkUUl69ykBjgSZw==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/greyscript-core/-/greyscript-core-0.4.3.tgz", + "integrity": "sha512-tX2H8Hif/lVazLXerjKycvVpw/Cty2HVaKHVWVBYZ2SlVTKca/TEt45yy/3gflaUIjc0WITLU1dw1nMmnLmkZw==", "dependencies": { - "greyscript-meta": "^1.1.5" + "greyscript-meta": "^1.1.8" } }, "node_modules/greyscript-meta": { @@ -10165,38 +10165,38 @@ "dev": true }, "greybel-core": { - "version": "0.4.7", - "resolved": "https://registry.npmjs.org/greybel-core/-/greybel-core-0.4.7.tgz", - "integrity": "sha512-LR5xirYRtWA7s+pFbFcX+2fcjexHBaAng2ADuxqu2JlN9hEAhyBqU0Ang25GXOSc0p81MZQBgu2YgXoLKIFVaA==", + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/greybel-core/-/greybel-core-0.4.8.tgz", + "integrity": "sha512-98SFeA5vJEfwumTfoYW5SFN8TXGoqyWhqnyEbjZuPsKbY0Yhz8PtZJGwyOx4enMG4u9KjuwrJDo7OY/W6Jzzjw==", "requires": { - "greyscript-core": "^0.4.1" + "greyscript-core": "^0.4.3" } }, "greybel-gh-mock-intrinsics": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.3.tgz", - "integrity": "sha512-hajGNNycIa/hqfMiQAizVQ8N5jO6UiZUz+8D9kw8YbTEmrsMJ6SwrdOftIorH44ryw0hJosYgbF8tZgAhaQ/qw==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.4.tgz", + "integrity": "sha512-Wx/k53+YuK9UlqOr7Tp3mQm+2dbwvA2PWb6dgkjwDpieeUz+WQdsqPBy8dqxymMUMx1jlNPVHHLy7JC0P+J6Lg==", "requires": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.1", + "greybel-interpreter": "^1.3.2", "greybel-mock-environment": "^1.0.9" } }, "greybel-interpreter": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.1.tgz", - "integrity": "sha512-Zvdab+c/Mwv9gmfn8AOYm2r9y/sNFCbfvVKkWTd+g+60uN2pRT+vOuCP6D2zFwwVywDBkHcApRfMSDPI+vbyFw==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.2.tgz", + "integrity": "sha512-C5QqyW2O2Wy/EoxAn9Beg399/gh4P/tpVjgx6rZrCoT2NflGi+2Jhhc1YlBGS2fhl6qaDjoOHUynXfeRplmVdg==", "requires": { - "greybel-core": "^0.4.7", - "greyscript-core": "^0.4.1" + "greybel-core": "^0.4.8", + "greyscript-core": "^0.4.3" } }, "greybel-intrinsics": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.7.tgz", - "integrity": "sha512-VaYCzQTYI0doGKD5iOGefKz4PckCjcgk3t597Hq35F0lkfEGGF+z6bnT2er1iWhDfz8CUTrhJAVKhpuofXD8tQ==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.8.tgz", + "integrity": "sha512-mcAJHcgPr1d0R3LbKcpLa8rXMCZsht+j9w6wgo3CmtiZQB/SsNRtGB4+9PIN9CeZnusj3TN8R+w6niUOdJFrPQ==", "requires": { - "greybel-interpreter": "^1.3.1" + "greybel-interpreter": "^1.3.2" } }, "greybel-mock-environment": { @@ -10221,11 +10221,11 @@ } }, "greyscript-core": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/greyscript-core/-/greyscript-core-0.4.1.tgz", - "integrity": "sha512-eF0GChvsxLlk8wdWON46IypJVPBif/oQyP7LES9giQQm/BF1De+ey9r9M+xrEvzxgzw8fzPXkUUl69ykBjgSZw==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/greyscript-core/-/greyscript-core-0.4.3.tgz", + "integrity": "sha512-tX2H8Hif/lVazLXerjKycvVpw/Cty2HVaKHVWVBYZ2SlVTKca/TEt45yy/3gflaUIjc0WITLU1dw1nMmnLmkZw==", "requires": { - "greyscript-meta": "^1.1.5" + "greyscript-meta": "^1.1.8" } }, "greyscript-meta": { diff --git a/package.json b/package.json index 3d007a68..57483e1a 100644 --- a/package.json +++ b/package.json @@ -24,12 +24,12 @@ "@babel/runtime": "^7.16.7", "cli-progress": "^3.11.2", "commander": "^7.2.0", - "greybel-core": "^0.4.7", - "greybel-gh-mock-intrinsics": "^1.2.3", - "greybel-interpreter": "^1.3.1", - "greybel-intrinsics": "^1.2.7", + "greybel-core": "^0.4.8", + "greybel-gh-mock-intrinsics": "^1.2.4", + "greybel-interpreter": "^1.3.2", + "greybel-intrinsics": "^1.2.8", "greybel-transpiler": "^0.6.0", - "greyscript-core": "^0.4.1", + "greyscript-core": "^0.4.3", "greyscript-meta": "^1.1.8", "inquirer": "^8.1.0", "inquirer-command-prompt": "^0.1.0", From 51ba802ab3edff4ce0e3bde467fa7a94ccefd2a2 Mon Sep 17 00:00:00 2001 From: ayecue Date: Tue, 20 Sep 2022 12:15:03 +0200 Subject: [PATCH 09/28] 1.3.7 support imports using .. --- package-lock.json | 22 +++++++++++----------- package.json | 2 +- src/build.ts | 21 +++++++++++++++++++-- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6dafcfc0..fe44182a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "greybel-gh-mock-intrinsics": "^1.2.4", "greybel-interpreter": "^1.3.2", "greybel-intrinsics": "^1.2.8", - "greybel-transpiler": "^0.6.0", + "greybel-transpiler": "^0.6.1", "greyscript-core": "^0.4.3", "greyscript-meta": "^1.1.8", "inquirer": "^8.1.0", @@ -4463,13 +4463,13 @@ } }, "node_modules/greybel-transpiler": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/greybel-transpiler/-/greybel-transpiler-0.6.0.tgz", - "integrity": "sha512-c9Rzzw28e8uI8nMdL3scWwYUSGewkZyzzekuF4u80oVN7HwJEttNcZxEMjxRltNI4Yrq9vVhNvyAzIx3HHH2iA==", + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/greybel-transpiler/-/greybel-transpiler-0.6.1.tgz", + "integrity": "sha512-+MkOufd4nZXFD7pS4dmZPp3i4lVp658Hj1FOzT2WsN3hrYw4Pcr5y3/m1uP912Z9uc4yeM56EFSXWWOeDjZrSQ==", "dependencies": { "blueimp-md5": "^2.19.0", - "greybel-core": "^0.4.7", - "greyscript-core": "^0.4.1" + "greybel-core": "^0.4.8", + "greyscript-core": "^0.4.3" } }, "node_modules/greyscript-core": { @@ -10211,13 +10211,13 @@ } }, "greybel-transpiler": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/greybel-transpiler/-/greybel-transpiler-0.6.0.tgz", - "integrity": "sha512-c9Rzzw28e8uI8nMdL3scWwYUSGewkZyzzekuF4u80oVN7HwJEttNcZxEMjxRltNI4Yrq9vVhNvyAzIx3HHH2iA==", + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/greybel-transpiler/-/greybel-transpiler-0.6.1.tgz", + "integrity": "sha512-+MkOufd4nZXFD7pS4dmZPp3i4lVp658Hj1FOzT2WsN3hrYw4Pcr5y3/m1uP912Z9uc4yeM56EFSXWWOeDjZrSQ==", "requires": { "blueimp-md5": "^2.19.0", - "greybel-core": "^0.4.7", - "greyscript-core": "^0.4.1" + "greybel-core": "^0.4.8", + "greyscript-core": "^0.4.3" } }, "greyscript-core": { diff --git a/package.json b/package.json index 57483e1a..ee5e7535 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "greybel-gh-mock-intrinsics": "^1.2.4", "greybel-interpreter": "^1.3.2", "greybel-intrinsics": "^1.2.8", - "greybel-transpiler": "^0.6.0", + "greybel-transpiler": "^0.6.1", "greyscript-core": "^0.4.3", "greyscript-meta": "^1.1.8", "inquirer": "^8.1.0", diff --git a/src/build.ts b/src/build.ts index 6fa60c3c..5529dba7 100644 --- a/src/build.ts +++ b/src/build.ts @@ -252,7 +252,7 @@ export default async function build( }).parse(); const buildPath = path.resolve(output, './build'); - const targetRoot = path.dirname(target); + const targetRootSegments = path.dirname(target).split(path.sep); try { await fs.rm(buildPath, { @@ -262,9 +262,26 @@ export default async function build( await mkdirp(buildPath); + const getRelativePath = (filePath: string) => { + const pathSegments = filePath.split(path.sep); + const filtered = []; + + for (const segment of targetRootSegments) { + const current = pathSegments.shift(); + + if (current !== segment) { + break; + } + + filtered.push(current); + } + + return filePath.replace(`${path.sep}${path.join(...filtered)}`, '.'); + }; + await Promise.all( Object.entries(result).map(async ([file, code]) => { - const relativePath = file.replace(targetRoot, '.'); + const relativePath = getRelativePath(file); const fullPath = path.resolve(buildPath, relativePath); await mkdirp(path.dirname(fullPath)); await fs.writeFile(fullPath, code, { encoding: 'utf-8' }); From ca67f4d20966a5dad278af7f544e6af78109ef3b Mon Sep 17 00:00:00 2001 From: ayecue Date: Tue, 20 Sep 2022 14:00:35 +0200 Subject: [PATCH 10/28] 1.3.7 update packages --- CHANGELOG.md | 5 ++- package-lock.json | 112 +++++++++++++++++++++++----------------------- package.json | 12 ++--- 3 files changed, 66 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c693eb9..d53a849c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -289,4 +289,7 @@ All notable changes to this project will be documented in this file. - loading bars are supported now - deactivate breakpoint for injection during debugging in cli execution - keep pending state after injection -- update meta version with a few corrections \ No newline at end of file +- update meta version with a few corrections +- update parser with removed ";" checks +- support nested import_code +- support outer imports using ".." \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index fe44182a..db1150e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,12 +11,12 @@ "@babel/runtime": "^7.16.7", "cli-progress": "^3.11.2", "commander": "^7.2.0", - "greybel-core": "^0.4.8", - "greybel-gh-mock-intrinsics": "^1.2.4", - "greybel-interpreter": "^1.3.2", - "greybel-intrinsics": "^1.2.8", - "greybel-transpiler": "^0.6.1", - "greyscript-core": "^0.4.3", + "greybel-core": "^0.4.9", + "greybel-gh-mock-intrinsics": "^1.2.5", + "greybel-interpreter": "^1.3.3", + "greybel-intrinsics": "^1.2.9", + "greybel-transpiler": "^0.6.2", + "greyscript-core": "^0.4.4", "greyscript-meta": "^1.1.8", "inquirer": "^8.1.0", "inquirer-command-prompt": "^0.1.0", @@ -4417,38 +4417,38 @@ "dev": true }, "node_modules/greybel-core": { - "version": "0.4.8", - "resolved": "https://registry.npmjs.org/greybel-core/-/greybel-core-0.4.8.tgz", - "integrity": "sha512-98SFeA5vJEfwumTfoYW5SFN8TXGoqyWhqnyEbjZuPsKbY0Yhz8PtZJGwyOx4enMG4u9KjuwrJDo7OY/W6Jzzjw==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/greybel-core/-/greybel-core-0.4.9.tgz", + "integrity": "sha512-u3mKjmTSIO7O62KVs9alH0Cs2kZnVfXoqXWklx5m/3dw1LlEnSu28355dtixyozd48KG4T/h2cwSkmOthvi4LA==", "dependencies": { - "greyscript-core": "^0.4.3" + "greyscript-core": "^0.4.4" } }, "node_modules/greybel-gh-mock-intrinsics": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.4.tgz", - "integrity": "sha512-Wx/k53+YuK9UlqOr7Tp3mQm+2dbwvA2PWb6dgkjwDpieeUz+WQdsqPBy8dqxymMUMx1jlNPVHHLy7JC0P+J6Lg==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.5.tgz", + "integrity": "sha512-vUD603utqxd1Aj8hnXd5lUcAMhMuN/hJ1DmTV7MaIcHzG4XstWu6EUcGuG+IkZClqcrRDSX1wKruLPF4AhQp0g==", "dependencies": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.2", + "greybel-interpreter": "^1.3.3", "greybel-mock-environment": "^1.0.9" } }, "node_modules/greybel-interpreter": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.2.tgz", - "integrity": "sha512-C5QqyW2O2Wy/EoxAn9Beg399/gh4P/tpVjgx6rZrCoT2NflGi+2Jhhc1YlBGS2fhl6qaDjoOHUynXfeRplmVdg==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.3.tgz", + "integrity": "sha512-DgIXM1sHflZO032W7okLaesEwWpkT6luI/UopD58zK2O9SvLq4EJNyDNqCxPujKwTjubvJitkGodSWO1q5ECMA==", "dependencies": { - "greybel-core": "^0.4.8", - "greyscript-core": "^0.4.3" + "greybel-core": "^0.4.9", + "greyscript-core": "^0.4.4" } }, "node_modules/greybel-intrinsics": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.8.tgz", - "integrity": "sha512-mcAJHcgPr1d0R3LbKcpLa8rXMCZsht+j9w6wgo3CmtiZQB/SsNRtGB4+9PIN9CeZnusj3TN8R+w6niUOdJFrPQ==", + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.9.tgz", + "integrity": "sha512-po20Zv8QQZ29ggDdqugXhj3bodyEtZLb+L+xa+XKFaC+ojHTgoet0OWL8nuuPZUjXTb4OEwMvbpQOuD43Er+2w==", "dependencies": { - "greybel-interpreter": "^1.3.2" + "greybel-interpreter": "^1.3.3" } }, "node_modules/greybel-mock-environment": { @@ -4463,19 +4463,19 @@ } }, "node_modules/greybel-transpiler": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/greybel-transpiler/-/greybel-transpiler-0.6.1.tgz", - "integrity": "sha512-+MkOufd4nZXFD7pS4dmZPp3i4lVp658Hj1FOzT2WsN3hrYw4Pcr5y3/m1uP912Z9uc4yeM56EFSXWWOeDjZrSQ==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/greybel-transpiler/-/greybel-transpiler-0.6.2.tgz", + "integrity": "sha512-zWSX4cfWKNo0Tu0T8wDyIBpMDtGtW4sxPT9CkAi3rcTjQKe+pxpXH7btDxzzwBt/zwvrRaZ4aumHz0+Sboe1Mw==", "dependencies": { "blueimp-md5": "^2.19.0", - "greybel-core": "^0.4.8", - "greyscript-core": "^0.4.3" + "greybel-core": "^0.4.9", + "greyscript-core": "^0.4.4" } }, "node_modules/greyscript-core": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/greyscript-core/-/greyscript-core-0.4.3.tgz", - "integrity": "sha512-tX2H8Hif/lVazLXerjKycvVpw/Cty2HVaKHVWVBYZ2SlVTKca/TEt45yy/3gflaUIjc0WITLU1dw1nMmnLmkZw==", + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/greyscript-core/-/greyscript-core-0.4.4.tgz", + "integrity": "sha512-vlCLKTuYo6+qfJfMxcmj/sw2cw+bDxcDQp1Av5IYV8v4ZjSz4tUfYXCbZIwdpn3PPpy6kqkBdLso6t/66iqZ7w==", "dependencies": { "greyscript-meta": "^1.1.8" } @@ -10165,38 +10165,38 @@ "dev": true }, "greybel-core": { - "version": "0.4.8", - "resolved": "https://registry.npmjs.org/greybel-core/-/greybel-core-0.4.8.tgz", - "integrity": "sha512-98SFeA5vJEfwumTfoYW5SFN8TXGoqyWhqnyEbjZuPsKbY0Yhz8PtZJGwyOx4enMG4u9KjuwrJDo7OY/W6Jzzjw==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/greybel-core/-/greybel-core-0.4.9.tgz", + "integrity": "sha512-u3mKjmTSIO7O62KVs9alH0Cs2kZnVfXoqXWklx5m/3dw1LlEnSu28355dtixyozd48KG4T/h2cwSkmOthvi4LA==", "requires": { - "greyscript-core": "^0.4.3" + "greyscript-core": "^0.4.4" } }, "greybel-gh-mock-intrinsics": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.4.tgz", - "integrity": "sha512-Wx/k53+YuK9UlqOr7Tp3mQm+2dbwvA2PWb6dgkjwDpieeUz+WQdsqPBy8dqxymMUMx1jlNPVHHLy7JC0P+J6Lg==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.5.tgz", + "integrity": "sha512-vUD603utqxd1Aj8hnXd5lUcAMhMuN/hJ1DmTV7MaIcHzG4XstWu6EUcGuG+IkZClqcrRDSX1wKruLPF4AhQp0g==", "requires": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.2", + "greybel-interpreter": "^1.3.3", "greybel-mock-environment": "^1.0.9" } }, "greybel-interpreter": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.2.tgz", - "integrity": "sha512-C5QqyW2O2Wy/EoxAn9Beg399/gh4P/tpVjgx6rZrCoT2NflGi+2Jhhc1YlBGS2fhl6qaDjoOHUynXfeRplmVdg==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.3.tgz", + "integrity": "sha512-DgIXM1sHflZO032W7okLaesEwWpkT6luI/UopD58zK2O9SvLq4EJNyDNqCxPujKwTjubvJitkGodSWO1q5ECMA==", "requires": { - "greybel-core": "^0.4.8", - "greyscript-core": "^0.4.3" + "greybel-core": "^0.4.9", + "greyscript-core": "^0.4.4" } }, "greybel-intrinsics": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.8.tgz", - "integrity": "sha512-mcAJHcgPr1d0R3LbKcpLa8rXMCZsht+j9w6wgo3CmtiZQB/SsNRtGB4+9PIN9CeZnusj3TN8R+w6niUOdJFrPQ==", + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.9.tgz", + "integrity": "sha512-po20Zv8QQZ29ggDdqugXhj3bodyEtZLb+L+xa+XKFaC+ojHTgoet0OWL8nuuPZUjXTb4OEwMvbpQOuD43Er+2w==", "requires": { - "greybel-interpreter": "^1.3.2" + "greybel-interpreter": "^1.3.3" } }, "greybel-mock-environment": { @@ -10211,19 +10211,19 @@ } }, "greybel-transpiler": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/greybel-transpiler/-/greybel-transpiler-0.6.1.tgz", - "integrity": "sha512-+MkOufd4nZXFD7pS4dmZPp3i4lVp658Hj1FOzT2WsN3hrYw4Pcr5y3/m1uP912Z9uc4yeM56EFSXWWOeDjZrSQ==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/greybel-transpiler/-/greybel-transpiler-0.6.2.tgz", + "integrity": "sha512-zWSX4cfWKNo0Tu0T8wDyIBpMDtGtW4sxPT9CkAi3rcTjQKe+pxpXH7btDxzzwBt/zwvrRaZ4aumHz0+Sboe1Mw==", "requires": { "blueimp-md5": "^2.19.0", - "greybel-core": "^0.4.8", - "greyscript-core": "^0.4.3" + "greybel-core": "^0.4.9", + "greyscript-core": "^0.4.4" } }, "greyscript-core": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/greyscript-core/-/greyscript-core-0.4.3.tgz", - "integrity": "sha512-tX2H8Hif/lVazLXerjKycvVpw/Cty2HVaKHVWVBYZ2SlVTKca/TEt45yy/3gflaUIjc0WITLU1dw1nMmnLmkZw==", + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/greyscript-core/-/greyscript-core-0.4.4.tgz", + "integrity": "sha512-vlCLKTuYo6+qfJfMxcmj/sw2cw+bDxcDQp1Av5IYV8v4ZjSz4tUfYXCbZIwdpn3PPpy6kqkBdLso6t/66iqZ7w==", "requires": { "greyscript-meta": "^1.1.8" } diff --git a/package.json b/package.json index ee5e7535..7004602a 100644 --- a/package.json +++ b/package.json @@ -24,12 +24,12 @@ "@babel/runtime": "^7.16.7", "cli-progress": "^3.11.2", "commander": "^7.2.0", - "greybel-core": "^0.4.8", - "greybel-gh-mock-intrinsics": "^1.2.4", - "greybel-interpreter": "^1.3.2", - "greybel-intrinsics": "^1.2.8", - "greybel-transpiler": "^0.6.1", - "greyscript-core": "^0.4.3", + "greybel-core": "^0.4.9", + "greybel-gh-mock-intrinsics": "^1.2.5", + "greybel-interpreter": "^1.3.3", + "greybel-intrinsics": "^1.2.9", + "greybel-transpiler": "^0.6.2", + "greyscript-core": "^0.4.4", "greyscript-meta": "^1.1.8", "inquirer": "^8.1.0", "inquirer-command-prompt": "^0.1.0", From 3c3765d28c343e4a2e06a2e88c9c2e25f3e9a675 Mon Sep 17 00:00:00 2001 From: ayecue Date: Tue, 20 Sep 2022 21:08:05 +0200 Subject: [PATCH 11/28] 1.3.7 bump interpreter + mock env --- CHANGELOG.md | 3 ++- package-lock.json | 68 ++++++++++++++++++++++++----------------------- package.json | 6 ++--- 3 files changed, 40 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d53a849c..84c83c1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -292,4 +292,5 @@ All notable changes to this project will be documented in this file. - update meta version with a few corrections - update parser with removed ";" checks - support nested import_code -- support outer imports using ".." \ No newline at end of file +- support outer imports using ".." +- fix [List can be different even if the same](https://github.com/ayecue/greybel-js/issues/32), thanks for reporting [@brahermoon](https://github.com/brahermoon) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index db1150e8..eeb18341 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,9 +12,9 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.9", - "greybel-gh-mock-intrinsics": "^1.2.5", - "greybel-interpreter": "^1.3.3", - "greybel-intrinsics": "^1.2.9", + "greybel-gh-mock-intrinsics": "^1.2.6", + "greybel-interpreter": "^1.3.4", + "greybel-intrinsics": "^1.3.0", "greybel-transpiler": "^0.6.2", "greyscript-core": "^0.4.4", "greyscript-meta": "^1.1.8", @@ -4425,39 +4425,40 @@ } }, "node_modules/greybel-gh-mock-intrinsics": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.5.tgz", - "integrity": "sha512-vUD603utqxd1Aj8hnXd5lUcAMhMuN/hJ1DmTV7MaIcHzG4XstWu6EUcGuG+IkZClqcrRDSX1wKruLPF4AhQp0g==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.6.tgz", + "integrity": "sha512-o8JzHMUadulpBgpvq3JaI5j7R+CgKuRWsr5MKRpRZ9fA/dBJIpn9IpHkEjgVqGqhvCDXLtR937EkEXJm3ODxaA==", "dependencies": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.3", - "greybel-mock-environment": "^1.0.9" + "greybel-interpreter": "^1.3.4", + "greybel-mock-environment": "^1.1.6" } }, "node_modules/greybel-interpreter": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.3.tgz", - "integrity": "sha512-DgIXM1sHflZO032W7okLaesEwWpkT6luI/UopD58zK2O9SvLq4EJNyDNqCxPujKwTjubvJitkGodSWO1q5ECMA==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.4.tgz", + "integrity": "sha512-x7G6VNJbdoF8hzikojb48VP+qvlGwJ0WKUgnC/xVrAbVThZ253dBheGinKUewK3Z839f5va1pX9vOQnOHPBwUg==", "dependencies": { "greybel-core": "^0.4.9", "greyscript-core": "^0.4.4" } }, "node_modules/greybel-intrinsics": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.9.tgz", - "integrity": "sha512-po20Zv8QQZ29ggDdqugXhj3bodyEtZLb+L+xa+XKFaC+ojHTgoet0OWL8nuuPZUjXTb4OEwMvbpQOuD43Er+2w==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.0.tgz", + "integrity": "sha512-qOyNGfvg0g7zGuiAQxD8JCfFaCFP2jt4Ge3sz7cGG05DJUE2Tm5RvT8TPnBx+hpjfT6T4FSqeNhpDrcHk9MrSw==", "dependencies": { - "greybel-interpreter": "^1.3.3" + "greybel-interpreter": "^1.3.4" } }, "node_modules/greybel-mock-environment": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.0.9.tgz", - "integrity": "sha512-bMOwLAbWPE3zHyEr1O+5BM+iKpJ96p08b9z78vsGoPnVJ4SSO+xlxnCfkcWKiz8nLk5MYuZ0fiLFcdMOec3BZA==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.1.6.tgz", + "integrity": "sha512-jqpuChEdE7WEeLouVqZRfPECErGyEg8XWEV0SPaEBXf/tBeDtRMwrrrIiyj9AktbOSFTz23lwqlfeG9dP7lakQ==", "dependencies": { "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", + "greyscript-core": "^0.4.4", "random-seed": "^0.3.0", "random-username-generator": "^1.0.4" } @@ -10173,39 +10174,40 @@ } }, "greybel-gh-mock-intrinsics": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.5.tgz", - "integrity": "sha512-vUD603utqxd1Aj8hnXd5lUcAMhMuN/hJ1DmTV7MaIcHzG4XstWu6EUcGuG+IkZClqcrRDSX1wKruLPF4AhQp0g==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.6.tgz", + "integrity": "sha512-o8JzHMUadulpBgpvq3JaI5j7R+CgKuRWsr5MKRpRZ9fA/dBJIpn9IpHkEjgVqGqhvCDXLtR937EkEXJm3ODxaA==", "requires": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.3", - "greybel-mock-environment": "^1.0.9" + "greybel-interpreter": "^1.3.4", + "greybel-mock-environment": "^1.1.6" } }, "greybel-interpreter": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.3.tgz", - "integrity": "sha512-DgIXM1sHflZO032W7okLaesEwWpkT6luI/UopD58zK2O9SvLq4EJNyDNqCxPujKwTjubvJitkGodSWO1q5ECMA==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.4.tgz", + "integrity": "sha512-x7G6VNJbdoF8hzikojb48VP+qvlGwJ0WKUgnC/xVrAbVThZ253dBheGinKUewK3Z839f5va1pX9vOQnOHPBwUg==", "requires": { "greybel-core": "^0.4.9", "greyscript-core": "^0.4.4" } }, "greybel-intrinsics": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.2.9.tgz", - "integrity": "sha512-po20Zv8QQZ29ggDdqugXhj3bodyEtZLb+L+xa+XKFaC+ojHTgoet0OWL8nuuPZUjXTb4OEwMvbpQOuD43Er+2w==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.0.tgz", + "integrity": "sha512-qOyNGfvg0g7zGuiAQxD8JCfFaCFP2jt4Ge3sz7cGG05DJUE2Tm5RvT8TPnBx+hpjfT6T4FSqeNhpDrcHk9MrSw==", "requires": { - "greybel-interpreter": "^1.3.3" + "greybel-interpreter": "^1.3.4" } }, "greybel-mock-environment": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.0.9.tgz", - "integrity": "sha512-bMOwLAbWPE3zHyEr1O+5BM+iKpJ96p08b9z78vsGoPnVJ4SSO+xlxnCfkcWKiz8nLk5MYuZ0fiLFcdMOec3BZA==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.1.6.tgz", + "integrity": "sha512-jqpuChEdE7WEeLouVqZRfPECErGyEg8XWEV0SPaEBXf/tBeDtRMwrrrIiyj9AktbOSFTz23lwqlfeG9dP7lakQ==", "requires": { "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", + "greyscript-core": "^0.4.4", "random-seed": "^0.3.0", "random-username-generator": "^1.0.4" } diff --git a/package.json b/package.json index 7004602a..23a1d954 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,9 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.9", - "greybel-gh-mock-intrinsics": "^1.2.5", - "greybel-interpreter": "^1.3.3", - "greybel-intrinsics": "^1.2.9", + "greybel-gh-mock-intrinsics": "^1.2.6", + "greybel-interpreter": "^1.3.4", + "greybel-intrinsics": "^1.3.0", "greybel-transpiler": "^0.6.2", "greyscript-core": "^0.4.4", "greyscript-meta": "^1.1.8", From 992e42d678cc82b2bdb99c227d60ac5c5d8f2802 Mon Sep 17 00:00:00 2001 From: ayecue Date: Tue, 20 Sep 2022 22:54:42 +0200 Subject: [PATCH 12/28] 1.3.7 fix circular deps --- package-lock.json | 66 +++++++++++++++++++++++------------------------ package.json | 6 ++--- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/package-lock.json b/package-lock.json index eeb18341..c2f4e247 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,9 +12,9 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.9", - "greybel-gh-mock-intrinsics": "^1.2.6", - "greybel-interpreter": "^1.3.4", - "greybel-intrinsics": "^1.3.0", + "greybel-gh-mock-intrinsics": "^1.2.7", + "greybel-interpreter": "^1.3.5", + "greybel-intrinsics": "^1.3.1", "greybel-transpiler": "^0.6.2", "greyscript-core": "^0.4.4", "greyscript-meta": "^1.1.8", @@ -4425,36 +4425,36 @@ } }, "node_modules/greybel-gh-mock-intrinsics": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.6.tgz", - "integrity": "sha512-o8JzHMUadulpBgpvq3JaI5j7R+CgKuRWsr5MKRpRZ9fA/dBJIpn9IpHkEjgVqGqhvCDXLtR937EkEXJm3ODxaA==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.7.tgz", + "integrity": "sha512-yNmwz2fDwQC32NEakp1+7R/u6XBlzHRCC4nN+LnCc9WcT2rHuN48IIX0GccE8CsuEjwqkR2Nzhu7epqhJ+Q+pg==", "dependencies": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.4", - "greybel-mock-environment": "^1.1.6" + "greybel-interpreter": "^1.3.5", + "greybel-mock-environment": "^1.1.8" } }, "node_modules/greybel-interpreter": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.4.tgz", - "integrity": "sha512-x7G6VNJbdoF8hzikojb48VP+qvlGwJ0WKUgnC/xVrAbVThZ253dBheGinKUewK3Z839f5va1pX9vOQnOHPBwUg==", + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.5.tgz", + "integrity": "sha512-4cmobTcExRDiLf8ZN0L6oYNNY/gzLImNubHTjwkyBf+PNwG5vGJuuHCEJSdRjE7fNTvEP7v1VF2UbaqjB7bA6g==", "dependencies": { "greybel-core": "^0.4.9", "greyscript-core": "^0.4.4" } }, "node_modules/greybel-intrinsics": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.0.tgz", - "integrity": "sha512-qOyNGfvg0g7zGuiAQxD8JCfFaCFP2jt4Ge3sz7cGG05DJUE2Tm5RvT8TPnBx+hpjfT6T4FSqeNhpDrcHk9MrSw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.1.tgz", + "integrity": "sha512-n69QwUOt+6FbxKjTr4IRb2aOtSdLN8rMRQM9S6XGLGB/80HkKO0H7+TBMkQV7fzQxyFFCR2nRQTGkWUKQFOd2A==", "dependencies": { - "greybel-interpreter": "^1.3.4" + "greybel-interpreter": "^1.3.5" } }, "node_modules/greybel-mock-environment": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.1.6.tgz", - "integrity": "sha512-jqpuChEdE7WEeLouVqZRfPECErGyEg8XWEV0SPaEBXf/tBeDtRMwrrrIiyj9AktbOSFTz23lwqlfeG9dP7lakQ==", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.1.8.tgz", + "integrity": "sha512-c4DzI7ruWeMCfHnvkiMSA9dhoziOoVOgV96ouyt/xEjxkXo1aWYOE6CfRDMJB5vVS9OG1/mNg4nT6inZDl/5BQ==", "dependencies": { "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", @@ -10174,36 +10174,36 @@ } }, "greybel-gh-mock-intrinsics": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.6.tgz", - "integrity": "sha512-o8JzHMUadulpBgpvq3JaI5j7R+CgKuRWsr5MKRpRZ9fA/dBJIpn9IpHkEjgVqGqhvCDXLtR937EkEXJm3ODxaA==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.7.tgz", + "integrity": "sha512-yNmwz2fDwQC32NEakp1+7R/u6XBlzHRCC4nN+LnCc9WcT2rHuN48IIX0GccE8CsuEjwqkR2Nzhu7epqhJ+Q+pg==", "requires": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.4", - "greybel-mock-environment": "^1.1.6" + "greybel-interpreter": "^1.3.5", + "greybel-mock-environment": "^1.1.8" } }, "greybel-interpreter": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.4.tgz", - "integrity": "sha512-x7G6VNJbdoF8hzikojb48VP+qvlGwJ0WKUgnC/xVrAbVThZ253dBheGinKUewK3Z839f5va1pX9vOQnOHPBwUg==", + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.5.tgz", + "integrity": "sha512-4cmobTcExRDiLf8ZN0L6oYNNY/gzLImNubHTjwkyBf+PNwG5vGJuuHCEJSdRjE7fNTvEP7v1VF2UbaqjB7bA6g==", "requires": { "greybel-core": "^0.4.9", "greyscript-core": "^0.4.4" } }, "greybel-intrinsics": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.0.tgz", - "integrity": "sha512-qOyNGfvg0g7zGuiAQxD8JCfFaCFP2jt4Ge3sz7cGG05DJUE2Tm5RvT8TPnBx+hpjfT6T4FSqeNhpDrcHk9MrSw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.1.tgz", + "integrity": "sha512-n69QwUOt+6FbxKjTr4IRb2aOtSdLN8rMRQM9S6XGLGB/80HkKO0H7+TBMkQV7fzQxyFFCR2nRQTGkWUKQFOd2A==", "requires": { - "greybel-interpreter": "^1.3.4" + "greybel-interpreter": "^1.3.5" } }, "greybel-mock-environment": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.1.6.tgz", - "integrity": "sha512-jqpuChEdE7WEeLouVqZRfPECErGyEg8XWEV0SPaEBXf/tBeDtRMwrrrIiyj9AktbOSFTz23lwqlfeG9dP7lakQ==", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.1.8.tgz", + "integrity": "sha512-c4DzI7ruWeMCfHnvkiMSA9dhoziOoVOgV96ouyt/xEjxkXo1aWYOE6CfRDMJB5vVS9OG1/mNg4nT6inZDl/5BQ==", "requires": { "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", diff --git a/package.json b/package.json index 23a1d954..fe748734 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,9 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.9", - "greybel-gh-mock-intrinsics": "^1.2.6", - "greybel-interpreter": "^1.3.4", - "greybel-intrinsics": "^1.3.0", + "greybel-gh-mock-intrinsics": "^1.2.7", + "greybel-interpreter": "^1.3.5", + "greybel-intrinsics": "^1.3.1", "greybel-transpiler": "^0.6.2", "greyscript-core": "^0.4.4", "greyscript-meta": "^1.1.8", From 2271bd26c853b6e517022ba9c7d140374e055104 Mon Sep 17 00:00:00 2001 From: ayecue Date: Sat, 24 Sep 2022 00:15:40 +0200 Subject: [PATCH 13/28] 1.3.7 update packages --- CHANGELOG.md | 12 +++++++++++- package-lock.json | 46 +++++++++++++++++++++++----------------------- package.json | 6 +++--- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84c83c1a..a9e925f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -286,6 +286,15 @@ All notable changes to this project will be documented in this file. - implement format_columns logic - improve output handler logic - user_input supports anyKey now +- add proper router intrinsics +- rework shell intriniscs for connect_service + scp +- add shell intriniscs for launch + build + ping +- add ftpShell intrinsics for put +- add computer intrinsics for connect eth + connect wifi +- update computer intrinsics for touch + create_folder +- update file intrinsics for move + copy + chmod + set_content + get_content + set_owner +- add groups to mock env +- update crypo intrinsics - loading bars are supported now - deactivate breakpoint for injection during debugging in cli execution - keep pending state after injection @@ -293,4 +302,5 @@ All notable changes to this project will be documented in this file. - update parser with removed ";" checks - support nested import_code - support outer imports using ".." -- fix [List can be different even if the same](https://github.com/ayecue/greybel-js/issues/32), thanks for reporting [@brahermoon](https://github.com/brahermoon) \ No newline at end of file +- fix [List can be different even if the same](https://github.com/ayecue/greybel-js/issues/32), thanks for reporting [@brahermoon](https://github.com/brahermoon) +- add __isa logic for maps \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c2f4e247..4456f544 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.9", - "greybel-gh-mock-intrinsics": "^1.2.7", + "greybel-gh-mock-intrinsics": "^1.2.8", "greybel-interpreter": "^1.3.5", "greybel-intrinsics": "^1.3.1", "greybel-transpiler": "^0.6.2", @@ -4425,19 +4425,19 @@ } }, "node_modules/greybel-gh-mock-intrinsics": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.7.tgz", - "integrity": "sha512-yNmwz2fDwQC32NEakp1+7R/u6XBlzHRCC4nN+LnCc9WcT2rHuN48IIX0GccE8CsuEjwqkR2Nzhu7epqhJ+Q+pg==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.8.tgz", + "integrity": "sha512-u+NNgY261KZgofYslMD02FWy159pFQHQELOLAWwMBy+L7GjBWQ7Qq/I6/i5qurmfHH2rx7kNbJFQ9kakFUKijQ==", "dependencies": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.5", - "greybel-mock-environment": "^1.1.8" + "greybel-interpreter": "^1.3.7", + "greybel-mock-environment": "^1.2.7" } }, "node_modules/greybel-interpreter": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.5.tgz", - "integrity": "sha512-4cmobTcExRDiLf8ZN0L6oYNNY/gzLImNubHTjwkyBf+PNwG5vGJuuHCEJSdRjE7fNTvEP7v1VF2UbaqjB7bA6g==", + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.7.tgz", + "integrity": "sha512-UeBN464J/Ft7m5m+pSUwjcURQfXGc/V5NfCtU/cuxA6yj38Vt+nyxqWg92FSomVQY1Wud85Hx8qTRnmgP/ZuUw==", "dependencies": { "greybel-core": "^0.4.9", "greyscript-core": "^0.4.4" @@ -4452,9 +4452,9 @@ } }, "node_modules/greybel-mock-environment": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.1.8.tgz", - "integrity": "sha512-c4DzI7ruWeMCfHnvkiMSA9dhoziOoVOgV96ouyt/xEjxkXo1aWYOE6CfRDMJB5vVS9OG1/mNg4nT6inZDl/5BQ==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.2.7.tgz", + "integrity": "sha512-m1a/40Omp72UBWcwOv3qmbtOfjLM1syNLMKnx9X/7/kjCSs4iGOZjBOftKShaFsON5lvpsvHLihh3oZJWBtNRw==", "dependencies": { "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", @@ -10174,19 +10174,19 @@ } }, "greybel-gh-mock-intrinsics": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.7.tgz", - "integrity": "sha512-yNmwz2fDwQC32NEakp1+7R/u6XBlzHRCC4nN+LnCc9WcT2rHuN48IIX0GccE8CsuEjwqkR2Nzhu7epqhJ+Q+pg==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.8.tgz", + "integrity": "sha512-u+NNgY261KZgofYslMD02FWy159pFQHQELOLAWwMBy+L7GjBWQ7Qq/I6/i5qurmfHH2rx7kNbJFQ9kakFUKijQ==", "requires": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.5", - "greybel-mock-environment": "^1.1.8" + "greybel-interpreter": "^1.3.7", + "greybel-mock-environment": "^1.2.7" } }, "greybel-interpreter": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.5.tgz", - "integrity": "sha512-4cmobTcExRDiLf8ZN0L6oYNNY/gzLImNubHTjwkyBf+PNwG5vGJuuHCEJSdRjE7fNTvEP7v1VF2UbaqjB7bA6g==", + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.7.tgz", + "integrity": "sha512-UeBN464J/Ft7m5m+pSUwjcURQfXGc/V5NfCtU/cuxA6yj38Vt+nyxqWg92FSomVQY1Wud85Hx8qTRnmgP/ZuUw==", "requires": { "greybel-core": "^0.4.9", "greyscript-core": "^0.4.4" @@ -10201,9 +10201,9 @@ } }, "greybel-mock-environment": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.1.8.tgz", - "integrity": "sha512-c4DzI7ruWeMCfHnvkiMSA9dhoziOoVOgV96ouyt/xEjxkXo1aWYOE6CfRDMJB5vVS9OG1/mNg4nT6inZDl/5BQ==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.2.7.tgz", + "integrity": "sha512-m1a/40Omp72UBWcwOv3qmbtOfjLM1syNLMKnx9X/7/kjCSs4iGOZjBOftKShaFsON5lvpsvHLihh3oZJWBtNRw==", "requires": { "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", diff --git a/package.json b/package.json index fe748734..88eda5a9 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,9 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.9", - "greybel-gh-mock-intrinsics": "^1.2.7", - "greybel-interpreter": "^1.3.5", - "greybel-intrinsics": "^1.3.1", + "greybel-gh-mock-intrinsics": "^1.2.8", + "greybel-interpreter": "^1.3.7", + "greybel-intrinsics": "^1.3.3", "greybel-transpiler": "^0.6.2", "greyscript-core": "^0.4.4", "greyscript-meta": "^1.1.8", From 82f352ec97d80e3ec84c0dbcf0aedcb6f47f3da9 Mon Sep 17 00:00:00 2001 From: ayecue Date: Wed, 28 Sep 2022 01:45:37 +0200 Subject: [PATCH 14/28] 1.3.7 update mock intrinsics --- CHANGELOG.md | 5 ++++- package-lock.json | 50 +++++++++++++++++++++++------------------------ package.json | 2 +- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9e925f8..987cac19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -277,7 +277,7 @@ All notable changes to this project will be documented in this file. - fix share feature in web-ui -## [1.3.7] - 15-09-2022 +## [1.3.7] - 28-09-2022 - minor fix for file.get_content, return empty string instead of undefined, thanks for reporting [@TopRoupi](https://github.com/TopRoupi) - add sort key logic in sort intrinsic, thanks for reporting [@TopRoupi](https://github.com/TopRoupi) @@ -295,6 +295,9 @@ All notable changes to this project will be documented in this file. - update file intrinsics for move + copy + chmod + set_content + get_content + set_owner - add groups to mock env - update crypo intrinsics +- update metaxploit intrinsics +- update metalib intrinsics +- update netsession intrinsics - loading bars are supported now - deactivate breakpoint for injection during debugging in cli execution - keep pending state after injection diff --git a/package-lock.json b/package-lock.json index 4456f544..dab1bc0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,9 +12,9 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.9", - "greybel-gh-mock-intrinsics": "^1.2.8", - "greybel-interpreter": "^1.3.5", - "greybel-intrinsics": "^1.3.1", + "greybel-gh-mock-intrinsics": "^1.2.9", + "greybel-interpreter": "^1.3.7", + "greybel-intrinsics": "^1.3.3", "greybel-transpiler": "^0.6.2", "greyscript-core": "^0.4.4", "greyscript-meta": "^1.1.8", @@ -4425,13 +4425,13 @@ } }, "node_modules/greybel-gh-mock-intrinsics": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.8.tgz", - "integrity": "sha512-u+NNgY261KZgofYslMD02FWy159pFQHQELOLAWwMBy+L7GjBWQ7Qq/I6/i5qurmfHH2rx7kNbJFQ9kakFUKijQ==", + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.9.tgz", + "integrity": "sha512-GPaqxCJiQ593L2RBY6F3a65iikmUpowGC+E8DjmEytX5CBSm23H4N2EpaR3EXUDlpIsq+5BvXeMZaMN6MLiSAQ==", "dependencies": { "blueimp-md5": "^2.19.0", "greybel-interpreter": "^1.3.7", - "greybel-mock-environment": "^1.2.7" + "greybel-mock-environment": "^1.2.8" } }, "node_modules/greybel-interpreter": { @@ -4444,17 +4444,17 @@ } }, "node_modules/greybel-intrinsics": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.1.tgz", - "integrity": "sha512-n69QwUOt+6FbxKjTr4IRb2aOtSdLN8rMRQM9S6XGLGB/80HkKO0H7+TBMkQV7fzQxyFFCR2nRQTGkWUKQFOd2A==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.3.tgz", + "integrity": "sha512-oWqx8kmquPgKyANFTaVq65Pgg53cygdbMYC+9bVmQd0SK+KZCanKi54ERM6JQyDOXuYJ+DndEM5Z2msrI0kTjg==", "dependencies": { - "greybel-interpreter": "^1.3.5" + "greybel-interpreter": "^1.3.7" } }, "node_modules/greybel-mock-environment": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.2.7.tgz", - "integrity": "sha512-m1a/40Omp72UBWcwOv3qmbtOfjLM1syNLMKnx9X/7/kjCSs4iGOZjBOftKShaFsON5lvpsvHLihh3oZJWBtNRw==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.2.8.tgz", + "integrity": "sha512-Qvc56hmBVB24l5miNHWqoS9lN+og52vJIHvKBQUhJM+eUgHrjwJ3XWJ3+hx2NdXkcTz81yfltxl2C4cCWm95lQ==", "dependencies": { "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", @@ -10174,13 +10174,13 @@ } }, "greybel-gh-mock-intrinsics": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.8.tgz", - "integrity": "sha512-u+NNgY261KZgofYslMD02FWy159pFQHQELOLAWwMBy+L7GjBWQ7Qq/I6/i5qurmfHH2rx7kNbJFQ9kakFUKijQ==", + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.9.tgz", + "integrity": "sha512-GPaqxCJiQ593L2RBY6F3a65iikmUpowGC+E8DjmEytX5CBSm23H4N2EpaR3EXUDlpIsq+5BvXeMZaMN6MLiSAQ==", "requires": { "blueimp-md5": "^2.19.0", "greybel-interpreter": "^1.3.7", - "greybel-mock-environment": "^1.2.7" + "greybel-mock-environment": "^1.2.8" } }, "greybel-interpreter": { @@ -10193,17 +10193,17 @@ } }, "greybel-intrinsics": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.1.tgz", - "integrity": "sha512-n69QwUOt+6FbxKjTr4IRb2aOtSdLN8rMRQM9S6XGLGB/80HkKO0H7+TBMkQV7fzQxyFFCR2nRQTGkWUKQFOd2A==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.3.tgz", + "integrity": "sha512-oWqx8kmquPgKyANFTaVq65Pgg53cygdbMYC+9bVmQd0SK+KZCanKi54ERM6JQyDOXuYJ+DndEM5Z2msrI0kTjg==", "requires": { - "greybel-interpreter": "^1.3.5" + "greybel-interpreter": "^1.3.7" } }, "greybel-mock-environment": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.2.7.tgz", - "integrity": "sha512-m1a/40Omp72UBWcwOv3qmbtOfjLM1syNLMKnx9X/7/kjCSs4iGOZjBOftKShaFsON5lvpsvHLihh3oZJWBtNRw==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/greybel-mock-environment/-/greybel-mock-environment-1.2.8.tgz", + "integrity": "sha512-Qvc56hmBVB24l5miNHWqoS9lN+og52vJIHvKBQUhJM+eUgHrjwJ3XWJ3+hx2NdXkcTz81yfltxl2C4cCWm95lQ==", "requires": { "@types/random-seed": "^0.3.3", "blueimp-md5": "^2.19.0", diff --git a/package.json b/package.json index 88eda5a9..1469e7b2 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.9", - "greybel-gh-mock-intrinsics": "^1.2.8", + "greybel-gh-mock-intrinsics": "^1.2.9", "greybel-interpreter": "^1.3.7", "greybel-intrinsics": "^1.3.3", "greybel-transpiler": "^0.6.2", From ab42d61f334b7b7991800856a657fe2dd6662717 Mon Sep 17 00:00:00 2001 From: ayecue Date: Wed, 28 Sep 2022 02:02:09 +0200 Subject: [PATCH 15/28] 1.3.7 update mock intrinisics --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index dab1bc0f..451dd8ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.9", - "greybel-gh-mock-intrinsics": "^1.2.9", + "greybel-gh-mock-intrinsics": "^1.3.0", "greybel-interpreter": "^1.3.7", "greybel-intrinsics": "^1.3.3", "greybel-transpiler": "^0.6.2", @@ -4425,9 +4425,9 @@ } }, "node_modules/greybel-gh-mock-intrinsics": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.9.tgz", - "integrity": "sha512-GPaqxCJiQ593L2RBY6F3a65iikmUpowGC+E8DjmEytX5CBSm23H4N2EpaR3EXUDlpIsq+5BvXeMZaMN6MLiSAQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.3.0.tgz", + "integrity": "sha512-FNmj2vArTqjfidWK+P8299Syma7Snj6X8MZj63P7Z6laEtgTExOZrLxGpK+rLB/XpIUzyxGEq1pDVXKmk32OKg==", "dependencies": { "blueimp-md5": "^2.19.0", "greybel-interpreter": "^1.3.7", @@ -10174,9 +10174,9 @@ } }, "greybel-gh-mock-intrinsics": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.2.9.tgz", - "integrity": "sha512-GPaqxCJiQ593L2RBY6F3a65iikmUpowGC+E8DjmEytX5CBSm23H4N2EpaR3EXUDlpIsq+5BvXeMZaMN6MLiSAQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.3.0.tgz", + "integrity": "sha512-FNmj2vArTqjfidWK+P8299Syma7Snj6X8MZj63P7Z6laEtgTExOZrLxGpK+rLB/XpIUzyxGEq1pDVXKmk32OKg==", "requires": { "blueimp-md5": "^2.19.0", "greybel-interpreter": "^1.3.7", diff --git a/package.json b/package.json index 1469e7b2..f2dc399a 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "cli-progress": "^3.11.2", "commander": "^7.2.0", "greybel-core": "^0.4.9", - "greybel-gh-mock-intrinsics": "^1.2.9", + "greybel-gh-mock-intrinsics": "^1.3.0", "greybel-interpreter": "^1.3.7", "greybel-intrinsics": "^1.3.3", "greybel-transpiler": "^0.6.2", From 07f26ecf385560d2f871caea54372fa7f93da266 Mon Sep 17 00:00:00 2001 From: ayecue Date: Wed, 28 Sep 2022 09:32:18 +0200 Subject: [PATCH 16/28] 1.3.7 update changelog + readme --- CHANGELOG.md | 2 +- README.md | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 987cac19..05df76eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -300,7 +300,7 @@ All notable changes to this project will be documented in this file. - update netsession intrinsics - loading bars are supported now - deactivate breakpoint for injection during debugging in cli execution -- keep pending state after injection +- keep pending state after injection in interpreter - update meta version with a few corrections - update parser with removed ";" checks - support nested import_code diff --git a/README.md b/README.md index 70bd47ce..0264ff96 100644 --- a/README.md +++ b/README.md @@ -136,12 +136,6 @@ Not yet supported: - `Wallet` - only pollyfill which "returns not yet supported" - `SubWallet` - only pollyfill which "returns not yet supported" - `Coin` - only pollyfill which "returns not yet supported" -- `Service` - only pollyfill which "returns not yet supported" -- `Metaxploit.aireplay` maxAcks are not yet supported -- `File.set_group` -- `Shell.build` -- `Shell.launch` -- `FtpShell.put` ## Debugger Pauses execution and enables you to inspect/debug your code. @@ -245,6 +239,9 @@ This going to be very useful if you want to use the new feature but still want y Together with the `--installer` flag in the CLI it will bundle your files for you which makes it easier to copy/paste code from your file system into the game. +### Nested import_code +Nested `import_code` is supported now as well. Each nested `import_code` will be moved to the entry file when transpiling/building. + ## Import Import will use the relative path from the file it imports to. ``` From 3818ef095f82dcbdf72d99702421dc54e9eee807 Mon Sep 17 00:00:00 2001 From: ayecue Date: Wed, 28 Sep 2022 15:09:03 +0200 Subject: [PATCH 17/28] 1.3.7 support text-mesh-transformer --- CHANGELOG.md | 4 ++- package-lock.json | 58 +++++++++++++++++++------------- package.json | 2 ++ src/execute.ts | 83 +++++++++++++++++++++++++++++++++++++++++++++- src/web/app.tsx | 7 ++-- src/web/execute.ts | 50 +++++++++++++++++++++++++++- src/web/std.ts | 4 +-- web/index.css | 7 +++- 8 files changed, 182 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05df76eb..302447c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -298,6 +298,7 @@ All notable changes to this project will be documented in this file. - update metaxploit intrinsics - update metalib intrinsics - update netsession intrinsics +- more realistic usernames, passwords, vulnerability zone names - loading bars are supported now - deactivate breakpoint for injection during debugging in cli execution - keep pending state after injection in interpreter @@ -306,4 +307,5 @@ All notable changes to this project will be documented in this file. - support nested import_code - support outer imports using ".." - fix [List can be different even if the same](https://github.com/ayecue/greybel-js/issues/32), thanks for reporting [@brahermoon](https://github.com/brahermoon) -- add __isa logic for maps \ No newline at end of file +- add __isa logic for maps +- minor TextMesh Pro support for output \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 451dd8ea..cc3adbb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,9 @@ "localstoragedb": "git+https://github.com/ayecue/localStorageDB.git", "mkdirp": "^1.0.4", "open": "^8.2.1", + "picocolors": "^1.0.0", "semver": "^5.3.0", + "text-mesh-transformer": "^1.0.2", "uuid": "^8.3.2" }, "bin": { @@ -2577,17 +2579,6 @@ "node": ">=8" } }, - "node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -2969,6 +2960,17 @@ "node": ">=4" } }, + "node_modules/chalk/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/chardet": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", @@ -5840,8 +5842,7 @@ "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -6625,6 +6626,11 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, + "node_modules/text-mesh-transformer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/text-mesh-transformer/-/text-mesh-transformer-1.0.2.tgz", + "integrity": "sha512-gQEWhyLu2hSqklUzFF6c+VYJRx36+mCK7r6vbPVO9o7UUHlzpn0w0ebMFdHUaZwfP0b5KheS/KotBNj3SFW0Ug==" + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -8806,14 +8812,6 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, "argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -9077,6 +9075,16 @@ "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + } } }, "chardet": { @@ -11206,8 +11214,7 @@ "picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" }, "picomatch": { "version": "2.3.1", @@ -11792,6 +11799,11 @@ } } }, + "text-mesh-transformer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/text-mesh-transformer/-/text-mesh-transformer-1.0.2.tgz", + "integrity": "sha512-gQEWhyLu2hSqklUzFF6c+VYJRx36+mCK7r6vbPVO9o7UUHlzpn0w0ebMFdHUaZwfP0b5KheS/KotBNj3SFW0Ug==" + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", diff --git a/package.json b/package.json index f2dc399a..ef5cfcab 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,9 @@ "localstoragedb": "git+https://github.com/ayecue/localStorageDB.git", "mkdirp": "^1.0.4", "open": "^8.2.1", + "picocolors": "^1.0.0", "semver": "^5.3.0", + "text-mesh-transformer": "^1.0.2", "uuid": "^8.3.2" }, "peerDependencies": { diff --git a/src/execute.ts b/src/execute.ts index 2856018a..f5431429 100644 --- a/src/execute.ts +++ b/src/execute.ts @@ -16,6 +16,8 @@ import { init as initIntrinsics } from 'greybel-intrinsics'; import { ASTBase } from 'greyscript-core'; import cliProgress from 'cli-progress'; import inquirer from 'inquirer'; +import transform, { TagRecord, Tag } from 'text-mesh-transformer'; +import picocolors from 'picocolors'; inquirer.registerPrompt('command', require('inquirer-command-prompt')); class GrebyelPseudoDebugger extends Debugger { @@ -181,9 +183,88 @@ export function nodeJSKeyEventToKeyEvent(nodeJSKeyEvent: NodeJSKeyEvent): KeyEve } } +function picoColor(color: string | undefined, content: string): string { + switch (color) { + case 'black': + return picocolors.black(content); + case 'red': + return picocolors.red(content); + case 'green': + return picocolors.green(content); + case 'yellow': + return picocolors.yellow(content); + case 'blue': + return picocolors.blue(content); + case 'magenta': + return picocolors.magenta(content); + case 'cyan': + return picocolors.cyan(content); + case 'white': + return picocolors.white(content); + case 'gray': + return picocolors.gray(content); + } + + return content; +} + +function picoBgColor(color: string | undefined, content: string): string { + switch (color) { + case 'black': + return picocolors.bgBlack(content); + case 'red': + return picocolors.bgRed(content); + case 'green': + return picocolors.bgGreen(content); + case 'yellow': + return picocolors.bgYellow(content); + case 'blue': + return picocolors.bgBlue(content); + case 'magenta': + return picocolors.bgMagenta(content); + case 'cyan': + return picocolors.bgCyan(content); + case 'white': + return picocolors.bgWhite(content); + } + + return content; +} + +function wrapWithTag(openTag: TagRecord, content: string): string { + switch (openTag.tag) { + case Tag.Color: + return picoColor(openTag.value, content); + case Tag.Underline: + return picocolors.underline(content); + case Tag.Italic: + return picocolors.italic(content); + case Tag.Bold: + return picocolors.bold(content); + case Tag.Strikethrough: + return picocolors.strikethrough(content); + case Tag.Mark: + return picoBgColor(openTag.value, content); + case Tag.Lowercase: + return content.toLowerCase(); + case Tag.Uppercase: + return content.toLowerCase(); + } + + if (openTag.value) { + return `<${openTag.tag}=${openTag.value}>${content}`; + } + + return `<${openTag.tag}>${content}`; +} + export class CLIOutputHandler extends OutputHandler { print(message: string) { - console.log(message); + const transformed = transform(message, (openTag: TagRecord, content: string): string => { + return wrapWithTag(openTag, content); + }); + + console.log(transformed); } clear() { diff --git a/src/web/app.tsx b/src/web/app.tsx index a286073e..0fabc72f 100644 --- a/src/web/app.tsx +++ b/src/web/app.tsx @@ -140,7 +140,7 @@ interface ExecuteOptions { } function Execute({ model, showError, instance, setDebug }: ExecuteOptions) { - const stdoutRef = useRef(null); + const stdoutRef = useRef(null); const stdinRef = useRef(null); const [stdout, setStdout] = useState(undefined); const [stdin, setStdin] = useState(undefined); @@ -262,13 +262,12 @@ function Execute({ model, showError, instance, setDebug }: ExecuteOptions) { - + > Promise; } +function wrapWithTag(openTag: TagRecord, content: string): string { + switch (openTag.tag) { + case Tag.Color: + return `${content}`; + case Tag.Underline: + return `${content}`; + case Tag.Italic: + return `${content}`; + case Tag.Bold: + return `${content}`; + case Tag.Strikethrough: + return `${content}`; + case Tag.Mark: + return `${content}`; + case Tag.Lowercase: + return `${content}`; + case Tag.Uppercase: + return `${content}`; + case Tag.Align: + return `${content}`; + case Tag.CSpace: + return `${content}`; + case Tag.LineHeight: + return `${content}`; + case Tag.Margin: + return `${content}`; + case Tag.NoBR: + return `${content}`; + case Tag.Pos: + return `${content}`; + case Tag.Size: + return `${content}`; + case Tag.VOffset: + return `${content}`; + } + + if (openTag.value) { + return `<${openTag.tag}=${openTag.value}>${content}</${openTag.tag}>`; + } + + return `<${openTag.tag}>${content}</${openTag.tag}>`; +} + export default async function execute( model: Monaco.editor.IModel, options: ExecuteOptions @@ -72,7 +116,11 @@ export default async function execute( const WebOutputHandler = class extends OutputHandler { print(message: string) { - stdout.write(message); + const transformed = transform(message, (openTag: TagRecord, content: string): string => { + return wrapWithTag(openTag, content); + }); + + stdout.write(transformed); } clear() { diff --git a/src/web/std.ts b/src/web/std.ts index 4278f598..bf180601 100644 --- a/src/web/std.ts +++ b/src/web/std.ts @@ -103,7 +103,7 @@ export class Stdout { render() { const me = this; const target = me.target; - target.value = me.history.join('\n'); + target.innerHTML = me.history.join('
'); target.scrollTop = target.scrollHeight; } @@ -111,7 +111,7 @@ export class Stdout { const me = this; const target = me.target; me.history = []; - target.value = ''; + target.innerHTML = ''; target.scrollTop = target.scrollHeight; } } diff --git a/web/index.css b/web/index.css index 6bb8061e..0b6d936a 100644 --- a/web/index.css +++ b/web/index.css @@ -134,8 +134,13 @@ body { } .editor-console-stdout { - width: 100%; height: 200px; + background: #000; + color: green; + padding: 5px 5px 0; + overflow: auto; + border: 1px solid #FFF; + position: relative; } .debugger-popup-bg { From ad44375d449170366d60311cd6e104ed3e36e523 Mon Sep 17 00:00:00 2001 From: ayecue Date: Wed, 28 Sep 2022 15:10:27 +0200 Subject: [PATCH 18/28] 1.3.7 apply lint --- src/execute.ts | 64 ++++++++++++++++++++++---------------- src/repl.ts | 1 + src/web.ts | 2 +- src/web/execute.ts | 11 ++++--- src/web/extension/hover.ts | 4 ++- 5 files changed, 50 insertions(+), 32 deletions(-) diff --git a/src/execute.ts b/src/execute.ts index f5431429..498b251d 100644 --- a/src/execute.ts +++ b/src/execute.ts @@ -1,8 +1,7 @@ +import cliProgress from 'cli-progress'; import { init as initGHIntrinsics } from 'greybel-gh-mock-intrinsics'; import { CustomFunction, - CustomString, - CustomValue, Debugger, Defaults, HandlerContainer, @@ -11,13 +10,12 @@ import { OperationContext, OutputHandler } from 'greybel-interpreter'; -import readline from 'readline'; import { init as initIntrinsics } from 'greybel-intrinsics'; import { ASTBase } from 'greyscript-core'; -import cliProgress from 'cli-progress'; import inquirer from 'inquirer'; -import transform, { TagRecord, Tag } from 'text-mesh-transformer'; import picocolors from 'picocolors'; +import readline from 'readline'; +import transform, { Tag, TagRecord } from 'text-mesh-transformer'; inquirer.registerPrompt('command', require('inquirer-command-prompt')); class GrebyelPseudoDebugger extends Debugger { @@ -116,8 +114,13 @@ export enum NodeJSKey { F12 = 'f12' } -export function nodeJSKeyEventToKeyEvent(nodeJSKeyEvent: NodeJSKeyEvent): KeyEvent { - const create = (keyCode: number, code: string): KeyEvent => ({ keyCode, code }); +export function nodeJSKeyEventToKeyEvent( + nodeJSKeyEvent: NodeJSKeyEvent +): KeyEvent { + const create = (keyCode: number, code: string): KeyEvent => ({ + keyCode, + code + }); switch (nodeJSKeyEvent.name) { case NodeJSKey.Return: @@ -260,9 +263,12 @@ function wrapWithTag(openTag: TagRecord, content: string): string { export class CLIOutputHandler extends OutputHandler { print(message: string) { - const transformed = transform(message, (openTag: TagRecord, content: string): string => { - return wrapWithTag(openTag, content); - }); + const transformed = transform( + message, + (openTag: TagRecord, content: string): string => { + return wrapWithTag(openTag, content); + } + ); console.log(transformed); } @@ -273,7 +279,10 @@ export class CLIOutputHandler extends OutputHandler { progress(timeout: number): Promise { const startTime = Date.now(); - const loadingBar = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic); + const loadingBar = new cliProgress.SingleBar( + {}, + cliProgress.Presets.shades_classic + ); loadingBar.start(timeout, 0); return new Promise((resolve, _reject) => { @@ -295,18 +304,18 @@ export class CLIOutputHandler extends OutputHandler { waitForInput(isPassword: boolean): Promise { return inquirer - .prompt({ - name: 'default', - message: 'Input:', - type: isPassword ? 'password' : 'input', - loop: false - }) - .then((inputMap) => { - return inputMap.default; - }) - .catch((err) => { - throw err; - }); + .prompt({ + name: 'default', + message: 'Input:', + type: isPassword ? 'password' : 'input', + loop: false + }) + .then((inputMap) => { + return inputMap.default; + }) + .catch((err) => { + throw err; + }); } waitForKeyPress(): Promise { @@ -316,13 +325,16 @@ export class CLIOutputHandler extends OutputHandler { process.stdin.resume(); process.stdin.setRawMode(true); - process.stdin.once('keypress', (character: string, key: NodeJSKeyEvent) => { + process.stdin.once( + 'keypress', + (character: string, key: NodeJSKeyEvent) => { process.stdin.pause(); resolve(nodeJSKeyEventToKeyEvent(key)); - }); + } + ); }); } -}; +} export interface ExecuteOptions { api?: Map; diff --git a/src/repl.ts b/src/repl.ts index aa4a4042..bd9a11cd 100644 --- a/src/repl.ts +++ b/src/repl.ts @@ -10,6 +10,7 @@ import { } from 'greybel-interpreter'; import { init as initIntrinsics } from 'greybel-intrinsics'; import inquirer from 'inquirer'; + import { CLIOutputHandler } from './execute'; inquirer.registerPrompt('command', require('inquirer-command-prompt')); diff --git a/src/web.ts b/src/web.ts index 0ad0d393..6a75f46e 100644 --- a/src/web.ts +++ b/src/web.ts @@ -21,4 +21,4 @@ root.render( React.createElement(App, { initContent: content }) -); \ No newline at end of file +); diff --git a/src/web/execute.ts b/src/web/execute.ts index c625b4bb..42277967 100644 --- a/src/web/execute.ts +++ b/src/web/execute.ts @@ -14,7 +14,7 @@ import { import { init as initIntrinsics } from 'greybel-intrinsics'; import Monaco from 'monaco-editor/esm/vs/editor/editor.api'; import process from 'process'; -import transform, { TagRecord, Tag } from 'text-mesh-transformer'; +import transform, { Tag, TagRecord } from 'text-mesh-transformer'; import { Stdin, Stdout } from './std'; @@ -116,9 +116,12 @@ export default async function execute( const WebOutputHandler = class extends OutputHandler { print(message: string) { - const transformed = transform(message, (openTag: TagRecord, content: string): string => { - return wrapWithTag(openTag, content); - }); + const transformed = transform( + message, + (openTag: TagRecord, content: string): string => { + return wrapWithTag(openTag, content); + } + ); stdout.write(transformed); } diff --git a/src/web/extension/hover.ts b/src/web/extension/hover.ts index 8160701d..aa99d639 100644 --- a/src/web/extension/hover.ts +++ b/src/web/extension/hover.ts @@ -56,7 +56,9 @@ export function activate(monaco: typeof Monaco) { const argValues = args .map( (item: SignatureDefinitionArg) => - `${item.label}${item.opt ? '?' : ''}: ${formatType(item.type)}${item.default ? ` = ${item.default}` : ''}` + `${item.label}${item.opt ? '?' : ''}: ${formatType(item.type)}${ + item.default ? ` = ${item.default}` : '' + }` ) .join(', '); From c29df9f522d8446f2c79d5e93b0b1ef6547d6495 Mon Sep 17 00:00:00 2001 From: ayecue Date: Wed, 28 Sep 2022 15:18:32 +0200 Subject: [PATCH 19/28] 1.3.7 add support description for textmesh rich text --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index 0264ff96..f25f640d 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,40 @@ debugger ![Debugger UI](/assets/debugger-ui-preview.png?raw=true "Debugger UI") +## TextMesh Pro Rich Text support +[TextMesh Pro Rich Text](http://digitalnativestudios.com/textmeshpro/docs/rich-text/) is partially supported. + +### CLI +Supports: + - color: `black, red, green, yellow, blue, magenta, cyan, white, gray` + - mark: `black, red, green, yellow, blue, magenta, cyan, white` + - underline + - italic + - bold + - strikethrough + - lowercase + - uppercase + +### UI +Supports: + - color + - mark + - underline + - italic + - bold + - strikethrough + - lowercase + - uppercase + - align + - cspace + - lineheight + - margin + - nobr + - pos + - size + - voffset + + # REPL ``` Emulator CLI From 97c4a20c7eaecdfce5fff3f2207bfce898c9ea10 Mon Sep 17 00:00:00 2001 From: ayecue Date: Wed, 28 Sep 2022 15:20:01 +0200 Subject: [PATCH 20/28] 1.3.7 add support description for textmesh rich text --- README.md | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index f25f640d..424c7052 100644 --- a/README.md +++ b/README.md @@ -153,33 +153,33 @@ debugger ### CLI Supports: - - color: `black, red, green, yellow, blue, magenta, cyan, white, gray` - - mark: `black, red, green, yellow, blue, magenta, cyan, white` - - underline - - italic - - bold - - strikethrough - - lowercase - - uppercase +* color: `black, red, green, yellow, blue, magenta, cyan, white, gray` +* mark: `black, red, green, yellow, blue, magenta, cyan, white` +* underline +* italic +* bold +* strikethrough +* lowercase +* uppercase ### UI Supports: - - color - - mark - - underline - - italic - - bold - - strikethrough - - lowercase - - uppercase - - align - - cspace - - lineheight - - margin - - nobr - - pos - - size - - voffset +* color +* mark +* underline +* italic +* bold +* strikethrough +* lowercase +* uppercase +* align +* cspace +* lineheight +* margin +* nobr +* pos +* size +* voffset # REPL From 12fa6b269fc2ab350085605dca12d487ace85cf9 Mon Sep 17 00:00:00 2001 From: ayecue Date: Wed, 28 Sep 2022 19:38:25 +0200 Subject: [PATCH 21/28] 1.3.7 add padding to terminal output --- web/index.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/index.css b/web/index.css index 0b6d936a..552704bd 100644 --- a/web/index.css +++ b/web/index.css @@ -137,7 +137,7 @@ body { height: 200px; background: #000; color: green; - padding: 5px 5px 0; + padding: 5px; overflow: auto; border: 1px solid #FFF; position: relative; From 6477446e4a2c09407dff483d6666b8dd075941e0 Mon Sep 17 00:00:00 2001 From: ayecue Date: Wed, 28 Sep 2022 21:44:20 +0200 Subject: [PATCH 22/28] 1.3.7 use ansis for better color support + add check for TTY --- README.md | 4 +-- bin/compile | 2 -- package-lock.json | 39 +++++++++++++++++++-- package.json | 3 +- src/execute.ts | 87 +++++++++++++++++++++-------------------------- 5 files changed, 79 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 424c7052..59b00818 100644 --- a/README.md +++ b/README.md @@ -153,8 +153,8 @@ debugger ### CLI Supports: -* color: `black, red, green, yellow, blue, magenta, cyan, white, gray` -* mark: `black, red, green, yellow, blue, magenta, cyan, white` +* color +* mark * underline * italic * bold diff --git a/bin/compile b/bin/compile index ad64ae05..c53f9034 100755 --- a/bin/compile +++ b/bin/compile @@ -10,8 +10,6 @@ if (!semver.satisfies(process.version, engineVersion)) { } const build = require('../out/build').default; -const path = require('path'); -const fs = require('fs'); const program = require('commander').program; const version = require('../package.json').version; let options = {}; diff --git a/package-lock.json b/package-lock.json index cc3adbb6..910ba0c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,10 @@ "version": "1.3.7", "dependencies": { "@babel/runtime": "^7.16.7", + "ansis": "^1.5.5", "cli-progress": "^3.11.2", "commander": "^7.2.0", + "css-color-names": "^1.0.1", "greybel-core": "^0.4.9", "greybel-gh-mock-intrinsics": "^1.3.0", "greybel-interpreter": "^1.3.7", @@ -24,7 +26,6 @@ "localstoragedb": "git+https://github.com/ayecue/localStorageDB.git", "mkdirp": "^1.0.4", "open": "^8.2.1", - "picocolors": "^1.0.0", "semver": "^5.3.0", "text-mesh-transformer": "^1.0.2", "uuid": "^8.3.2" @@ -2579,6 +2580,18 @@ "node": ">=8" } }, + "node_modules/ansis": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/ansis/-/ansis-1.5.5.tgz", + "integrity": "sha512-DNctovTacxs/NfZpGo6bIGWgLd2oZsDO7RJbiYX6Ttj40LPZM1XKv9WtesH13ieOEm1GajjD+Vik2n9YnSTPdA==", + "engines": { + "node": ">=12.13" + }, + "funding": { + "type": "patreon", + "url": "https://patreon.com/biodiscus" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -3110,6 +3123,14 @@ "node": ">= 8" } }, + "node_modules/css-color-names": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-1.0.1.tgz", + "integrity": "sha512-/loXYOch1qU1biStIFsHH8SxTmOseh1IJqFvy8IujXOm1h+QjUdDhkzOrR5HG8K8mlxREj0yfi8ewCHx0eMxzA==", + "engines": { + "node": "*" + } + }, "node_modules/csstype": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.0.tgz", @@ -5842,7 +5863,8 @@ "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true }, "node_modules/picomatch": { "version": "2.3.1", @@ -8812,6 +8834,11 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, + "ansis": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/ansis/-/ansis-1.5.5.tgz", + "integrity": "sha512-DNctovTacxs/NfZpGo6bIGWgLd2oZsDO7RJbiYX6Ttj40LPZM1XKv9WtesH13ieOEm1GajjD+Vik2n9YnSTPdA==" + }, "argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -9197,6 +9224,11 @@ "which": "^2.0.1" } }, + "css-color-names": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-1.0.1.tgz", + "integrity": "sha512-/loXYOch1qU1biStIFsHH8SxTmOseh1IJqFvy8IujXOm1h+QjUdDhkzOrR5HG8K8mlxREj0yfi8ewCHx0eMxzA==" + }, "csstype": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.0.tgz", @@ -11214,7 +11246,8 @@ "picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true }, "picomatch": { "version": "2.3.1", diff --git a/package.json b/package.json index ef5cfcab..643529e5 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,10 @@ ], "dependencies": { "@babel/runtime": "^7.16.7", + "ansis": "^1.5.5", "cli-progress": "^3.11.2", "commander": "^7.2.0", + "css-color-names": "^1.0.1", "greybel-core": "^0.4.9", "greybel-gh-mock-intrinsics": "^1.3.0", "greybel-interpreter": "^1.3.7", @@ -37,7 +39,6 @@ "localstoragedb": "git+https://github.com/ayecue/localStorageDB.git", "mkdirp": "^1.0.4", "open": "^8.2.1", - "picocolors": "^1.0.0", "semver": "^5.3.0", "text-mesh-transformer": "^1.0.2", "uuid": "^8.3.2" diff --git a/src/execute.ts b/src/execute.ts index 498b251d..3474c869 100644 --- a/src/execute.ts +++ b/src/execute.ts @@ -13,11 +13,14 @@ import { import { init as initIntrinsics } from 'greybel-intrinsics'; import { ASTBase } from 'greyscript-core'; import inquirer from 'inquirer'; -import picocolors from 'picocolors'; import readline from 'readline'; import transform, { Tag, TagRecord } from 'text-mesh-transformer'; +import cssColorNames from 'css-color-names'; +import ansis from 'ansis'; inquirer.registerPrompt('command', require('inquirer-command-prompt')); +const hasOwnProperty = Object.prototype.hasOwnProperty; + class GrebyelPseudoDebugger extends Debugger { interpreter: Interpreter; @@ -186,68 +189,46 @@ export function nodeJSKeyEventToKeyEvent( } } -function picoColor(color: string | undefined, content: string): string { - switch (color) { - case 'black': - return picocolors.black(content); - case 'red': - return picocolors.red(content); - case 'green': - return picocolors.green(content); - case 'yellow': - return picocolors.yellow(content); - case 'blue': - return picocolors.blue(content); - case 'magenta': - return picocolors.magenta(content); - case 'cyan': - return picocolors.cyan(content); - case 'white': - return picocolors.white(content); - case 'gray': - return picocolors.gray(content); +function useColor(color: string | undefined, content: string): string { + if (!color) return content; + + const cssColorMap = cssColorNames as { [key: string]: string }; + + if (hasOwnProperty.call(cssColorMap, color)) { + const item = cssColorMap[color]; + color = item; } - return content; + return ansis.bgHex(color)(content); } -function picoBgColor(color: string | undefined, content: string): string { - switch (color) { - case 'black': - return picocolors.bgBlack(content); - case 'red': - return picocolors.bgRed(content); - case 'green': - return picocolors.bgGreen(content); - case 'yellow': - return picocolors.bgYellow(content); - case 'blue': - return picocolors.bgBlue(content); - case 'magenta': - return picocolors.bgMagenta(content); - case 'cyan': - return picocolors.bgCyan(content); - case 'white': - return picocolors.bgWhite(content); +function useBgColor(color: string | undefined, content: string): string { + if (!color) return content; + + const cssColorMap = cssColorNames as { [key: string]: string }; + + if (hasOwnProperty.call(cssColorMap, color)) { + const item = cssColorMap[color]; + color = item; } - return content; + return ansis.hex(color)(content); } function wrapWithTag(openTag: TagRecord, content: string): string { switch (openTag.tag) { case Tag.Color: - return picoColor(openTag.value, content); + return useColor(openTag.value, content); case Tag.Underline: - return picocolors.underline(content); + return ansis.underline(content); case Tag.Italic: - return picocolors.italic(content); + return ansis.italic(content); case Tag.Bold: - return picocolors.bold(content); + return ansis.bold(content); case Tag.Strikethrough: - return picocolors.strikethrough(content); + return ansis.strikethrough(content); case Tag.Mark: - return picoBgColor(openTag.value, content); + return useBgColor(openTag.value, content); case Tag.Lowercase: return content.toLowerCase(); case Tag.Uppercase: @@ -285,12 +266,17 @@ export class CLIOutputHandler extends OutputHandler { ); loadingBar.start(timeout, 0); + if (!process.stdin.isTTY) { + console.warn('Stdin TTY is false. Therefore the progress bar cannot be shown.'); + } + return new Promise((resolve, _reject) => { const interval = setInterval(() => { const currentTime = Date.now(); const elapsed = currentTime - startTime; if (elapsed > timeout) { + loadingBar.update(timeout); clearInterval(interval); loadingBar.stop(); resolve(); @@ -323,7 +309,12 @@ export class CLIOutputHandler extends OutputHandler { readline.emitKeypressEvents(process.stdin); process.stdin.resume(); - process.stdin.setRawMode(true); + + if (process.stdin.isTTY) { + process.stdin.setRawMode(true); + } else { + console.warn('Stdin TTY is false. Therefore anyKey isn\'t able to detect any input. Press enter to continue.'); + } process.stdin.once( 'keypress', From d7c968809b37e9759346906181223453573f101f Mon Sep 17 00:00:00 2001 From: ayecue Date: Wed, 28 Sep 2022 23:34:05 +0200 Subject: [PATCH 23/28] 1.3.7 proper hex codes + update interpreter + intrinsics --- package-lock.json | 50 +++++++++++++++++++++++------------------------ package.json | 6 +++--- src/execute.ts | 4 ++-- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/package-lock.json b/package-lock.json index 910ba0c2..4f62947b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,9 +14,9 @@ "commander": "^7.2.0", "css-color-names": "^1.0.1", "greybel-core": "^0.4.9", - "greybel-gh-mock-intrinsics": "^1.3.0", - "greybel-interpreter": "^1.3.7", - "greybel-intrinsics": "^1.3.3", + "greybel-gh-mock-intrinsics": "^1.3.2", + "greybel-interpreter": "^1.4.0", + "greybel-intrinsics": "^1.3.7", "greybel-transpiler": "^0.6.2", "greyscript-core": "^0.4.4", "greyscript-meta": "^1.1.8", @@ -4448,30 +4448,30 @@ } }, "node_modules/greybel-gh-mock-intrinsics": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.3.0.tgz", - "integrity": "sha512-FNmj2vArTqjfidWK+P8299Syma7Snj6X8MZj63P7Z6laEtgTExOZrLxGpK+rLB/XpIUzyxGEq1pDVXKmk32OKg==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.3.2.tgz", + "integrity": "sha512-mRXukmashl0pAtNptPBILWEk02A/iKqg7Z6ZGZmtN9Cb4DVZFpHTARKmDBjLwce6mP2rsIFPz5xhBY3j+TkBRQ==", "dependencies": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.7", + "greybel-interpreter": "^1.4.0", "greybel-mock-environment": "^1.2.8" } }, "node_modules/greybel-interpreter": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.7.tgz", - "integrity": "sha512-UeBN464J/Ft7m5m+pSUwjcURQfXGc/V5NfCtU/cuxA6yj38Vt+nyxqWg92FSomVQY1Wud85Hx8qTRnmgP/ZuUw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.4.0.tgz", + "integrity": "sha512-0FIA8gmAOCvYI/HamCST98/QkrVNxDxFujnIk7gQ7aWArXLGKEUaGisXW3KmzVToZVeP7cMPG0P5rv4NARpJBg==", "dependencies": { "greybel-core": "^0.4.9", "greyscript-core": "^0.4.4" } }, "node_modules/greybel-intrinsics": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.3.tgz", - "integrity": "sha512-oWqx8kmquPgKyANFTaVq65Pgg53cygdbMYC+9bVmQd0SK+KZCanKi54ERM6JQyDOXuYJ+DndEM5Z2msrI0kTjg==", + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.7.tgz", + "integrity": "sha512-Xrvh+VjBNYScWpINnKx5v5wlCwsw1RsfFE8EZunCbgYeAV0d3rZSYtrx+z1L6dxLNYoPsYjV+YbL6qlCDq1ueQ==", "dependencies": { - "greybel-interpreter": "^1.3.7" + "greybel-interpreter": "^1.4.0" } }, "node_modules/greybel-mock-environment": { @@ -10214,30 +10214,30 @@ } }, "greybel-gh-mock-intrinsics": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.3.0.tgz", - "integrity": "sha512-FNmj2vArTqjfidWK+P8299Syma7Snj6X8MZj63P7Z6laEtgTExOZrLxGpK+rLB/XpIUzyxGEq1pDVXKmk32OKg==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/greybel-gh-mock-intrinsics/-/greybel-gh-mock-intrinsics-1.3.2.tgz", + "integrity": "sha512-mRXukmashl0pAtNptPBILWEk02A/iKqg7Z6ZGZmtN9Cb4DVZFpHTARKmDBjLwce6mP2rsIFPz5xhBY3j+TkBRQ==", "requires": { "blueimp-md5": "^2.19.0", - "greybel-interpreter": "^1.3.7", + "greybel-interpreter": "^1.4.0", "greybel-mock-environment": "^1.2.8" } }, "greybel-interpreter": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.3.7.tgz", - "integrity": "sha512-UeBN464J/Ft7m5m+pSUwjcURQfXGc/V5NfCtU/cuxA6yj38Vt+nyxqWg92FSomVQY1Wud85Hx8qTRnmgP/ZuUw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/greybel-interpreter/-/greybel-interpreter-1.4.0.tgz", + "integrity": "sha512-0FIA8gmAOCvYI/HamCST98/QkrVNxDxFujnIk7gQ7aWArXLGKEUaGisXW3KmzVToZVeP7cMPG0P5rv4NARpJBg==", "requires": { "greybel-core": "^0.4.9", "greyscript-core": "^0.4.4" } }, "greybel-intrinsics": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.3.tgz", - "integrity": "sha512-oWqx8kmquPgKyANFTaVq65Pgg53cygdbMYC+9bVmQd0SK+KZCanKi54ERM6JQyDOXuYJ+DndEM5Z2msrI0kTjg==", + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/greybel-intrinsics/-/greybel-intrinsics-1.3.7.tgz", + "integrity": "sha512-Xrvh+VjBNYScWpINnKx5v5wlCwsw1RsfFE8EZunCbgYeAV0d3rZSYtrx+z1L6dxLNYoPsYjV+YbL6qlCDq1ueQ==", "requires": { - "greybel-interpreter": "^1.3.7" + "greybel-interpreter": "^1.4.0" } }, "greybel-mock-environment": { diff --git a/package.json b/package.json index 643529e5..84fdbe34 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,9 @@ "commander": "^7.2.0", "css-color-names": "^1.0.1", "greybel-core": "^0.4.9", - "greybel-gh-mock-intrinsics": "^1.3.0", - "greybel-interpreter": "^1.3.7", - "greybel-intrinsics": "^1.3.3", + "greybel-gh-mock-intrinsics": "^1.3.2", + "greybel-interpreter": "^1.4.0", + "greybel-intrinsics": "^1.3.7", "greybel-transpiler": "^0.6.2", "greyscript-core": "^0.4.4", "greyscript-meta": "^1.1.8", diff --git a/src/execute.ts b/src/execute.ts index 3474c869..4f57ad0c 100644 --- a/src/execute.ts +++ b/src/execute.ts @@ -199,7 +199,7 @@ function useColor(color: string | undefined, content: string): string { color = item; } - return ansis.bgHex(color)(content); + return ansis.hex(color)(content); } function useBgColor(color: string | undefined, content: string): string { @@ -212,7 +212,7 @@ function useBgColor(color: string | undefined, content: string): string { color = item; } - return ansis.hex(color)(content); + return ansis.bgHex(color)(content); } function wrapWithTag(openTag: TagRecord, content: string): string { From e912896f8a1976d903db366caa11d14025d61ac1 Mon Sep 17 00:00:00 2001 From: ayecue Date: Thu, 29 Sep 2022 00:08:57 +0200 Subject: [PATCH 24/28] 1.3.7 fix build path resolve --- src/build.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build.ts b/src/build.ts index 5529dba7..784e6492 100644 --- a/src/build.ts +++ b/src/build.ts @@ -276,7 +276,7 @@ export default async function build( filtered.push(current); } - return filePath.replace(`${path.sep}${path.join(...filtered)}`, '.'); + return filePath.replace(`${path.join(...filtered)}`, '.'); }; await Promise.all( From 00a5a64ae5fc3cf837ed0bf97411fd181f44de1e Mon Sep 17 00:00:00 2001 From: ayecue Date: Thu, 29 Sep 2022 00:34:31 +0200 Subject: [PATCH 25/28] 1.3.7 update transpier + fix build for mac --- package-lock.json | 14 +++++++------- package.json | 2 +- src/build.ts | 8 +++++++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4f62947b..a55ed0da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "greybel-gh-mock-intrinsics": "^1.3.2", "greybel-interpreter": "^1.4.0", "greybel-intrinsics": "^1.3.7", - "greybel-transpiler": "^0.6.2", + "greybel-transpiler": "^0.6.3", "greyscript-core": "^0.4.4", "greyscript-meta": "^1.1.8", "inquirer": "^8.1.0", @@ -4487,9 +4487,9 @@ } }, "node_modules/greybel-transpiler": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/greybel-transpiler/-/greybel-transpiler-0.6.2.tgz", - "integrity": "sha512-zWSX4cfWKNo0Tu0T8wDyIBpMDtGtW4sxPT9CkAi3rcTjQKe+pxpXH7btDxzzwBt/zwvrRaZ4aumHz0+Sboe1Mw==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/greybel-transpiler/-/greybel-transpiler-0.6.3.tgz", + "integrity": "sha512-nxanzCOAGR5nxDNDXbJGDACG47R8rr8cjhSj4KCju0+YhHA9NosiS/67a7ouv7rO2YkjdJfHRldl96S9/mx0EA==", "dependencies": { "blueimp-md5": "^2.19.0", "greybel-core": "^0.4.9", @@ -10253,9 +10253,9 @@ } }, "greybel-transpiler": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/greybel-transpiler/-/greybel-transpiler-0.6.2.tgz", - "integrity": "sha512-zWSX4cfWKNo0Tu0T8wDyIBpMDtGtW4sxPT9CkAi3rcTjQKe+pxpXH7btDxzzwBt/zwvrRaZ4aumHz0+Sboe1Mw==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/greybel-transpiler/-/greybel-transpiler-0.6.3.tgz", + "integrity": "sha512-nxanzCOAGR5nxDNDXbJGDACG47R8rr8cjhSj4KCju0+YhHA9NosiS/67a7ouv7rO2YkjdJfHRldl96S9/mx0EA==", "requires": { "blueimp-md5": "^2.19.0", "greybel-core": "^0.4.9", diff --git a/package.json b/package.json index 84fdbe34..d22ac9e2 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "greybel-gh-mock-intrinsics": "^1.3.2", "greybel-interpreter": "^1.4.0", "greybel-intrinsics": "^1.3.7", - "greybel-transpiler": "^0.6.2", + "greybel-transpiler": "^0.6.3", "greyscript-core": "^0.4.4", "greyscript-meta": "^1.1.8", "inquirer": "^8.1.0", diff --git a/src/build.ts b/src/build.ts index 784e6492..047780df 100644 --- a/src/build.ts +++ b/src/build.ts @@ -276,7 +276,13 @@ export default async function build( filtered.push(current); } - return filePath.replace(`${path.join(...filtered)}`, '.'); + let relativePath = filePath.replace(`${path.join(...filtered)}`, '.'); + + if (relativePath.startsWith(path.sep)) { + relativePath = relativePath.slice(1); + } + + return relativePath; }; await Promise.all( From 62b813b0f308a4e5f706cf71173f90ab56742915 Mon Sep 17 00:00:00 2001 From: ayecue Date: Thu, 29 Sep 2022 02:07:31 +0200 Subject: [PATCH 26/28] 1.3.7 add interactive flag for parameters --- README.md | 3 ++- bin/execute | 20 +++++++++++++++++++- src/build.ts | 9 +-------- src/execute.ts | 12 ++++++++---- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 59b00818..f66c7050 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,8 @@ Interpreter CLI Example: greybel-execute Options: - -p, --params Execution parameters + -p, --params Execution parameters + -i, --interactive Interactive parameters ``` For Windows you can use something like [gitbash](https://gitforwindows.org/). Or just use the UI. diff --git a/bin/execute b/bin/execute index f0158d98..64476aeb 100755 --- a/bin/execute +++ b/bin/execute @@ -1,4 +1,5 @@ #! /usr/bin/env node +const inquirer = require('inquirer'); const semver = require('semver'); const package = require('../package.json'); @@ -23,13 +24,30 @@ program .action(function (filepath, output) { options.filepath = filepath; }) - .option('-params, --params ', 'Execution parameters'); + .option('-params, --params ', 'Execution parameters') + .option('-i, --interactive', 'Interactive parameters'); program.parse(process.argv); (async function() { options = Object.assign(options, program.opts()); + if (options.interactive) { + options.params = await inquirer + .prompt({ + name: 'default', + message: 'Params:', + type: 'input', + loop: false + }) + .then((inputMap) => { + return inputMap.default.split(' '); + }) + .catch((err) => { + throw err; + }); + } + const success = await execute(options.filepath, { params: options.params }); diff --git a/src/build.ts b/src/build.ts index 047780df..cbd477c1 100644 --- a/src/build.ts +++ b/src/build.ts @@ -110,13 +110,6 @@ function createImportList( mainTarget: string ): any[] { const pseudoRoot = path.dirname(mainTarget) || ''; - const list = [ - { - filepath: mainTarget, - pseudoFilepath: path.basename(mainTarget), - content: parseResult[mainTarget] - } - ]; const imports = Object.entries(parseResult).map(([target, code]) => { return { filepath: target, @@ -125,7 +118,7 @@ function createImportList( }; }); - return list.concat(imports); + return imports; } async function createInstaller( diff --git a/src/execute.ts b/src/execute.ts index 4f57ad0c..e19d2127 100644 --- a/src/execute.ts +++ b/src/execute.ts @@ -1,4 +1,6 @@ +import ansis from 'ansis'; import cliProgress from 'cli-progress'; +import cssColorNames from 'css-color-names'; import { init as initGHIntrinsics } from 'greybel-gh-mock-intrinsics'; import { CustomFunction, @@ -15,8 +17,6 @@ import { ASTBase } from 'greyscript-core'; import inquirer from 'inquirer'; import readline from 'readline'; import transform, { Tag, TagRecord } from 'text-mesh-transformer'; -import cssColorNames from 'css-color-names'; -import ansis from 'ansis'; inquirer.registerPrompt('command', require('inquirer-command-prompt')); const hasOwnProperty = Object.prototype.hasOwnProperty; @@ -267,7 +267,9 @@ export class CLIOutputHandler extends OutputHandler { loadingBar.start(timeout, 0); if (!process.stdin.isTTY) { - console.warn('Stdin TTY is false. Therefore the progress bar cannot be shown.'); + console.warn( + 'Stdin TTY is false. Therefore the progress bar cannot be shown.' + ); } return new Promise((resolve, _reject) => { @@ -313,7 +315,9 @@ export class CLIOutputHandler extends OutputHandler { if (process.stdin.isTTY) { process.stdin.setRawMode(true); } else { - console.warn('Stdin TTY is false. Therefore anyKey isn\'t able to detect any input. Press enter to continue.'); + console.warn( + "Stdin TTY is false. Therefore anyKey isn't able to detect any input. Press enter to continue." + ); } process.stdin.once( From 6533aab91452a426ca2ae5326cb44fff4b576c56 Mon Sep 17 00:00:00 2001 From: ayecue Date: Thu, 29 Sep 2022 02:21:57 +0200 Subject: [PATCH 27/28] 1.3.7 update changelog date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 302447c7..43254798 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -277,7 +277,7 @@ All notable changes to this project will be documented in this file. - fix share feature in web-ui -## [1.3.7] - 28-09-2022 +## [1.3.7] - 29-09-2022 - minor fix for file.get_content, return empty string instead of undefined, thanks for reporting [@TopRoupi](https://github.com/TopRoupi) - add sort key logic in sort intrinsic, thanks for reporting [@TopRoupi](https://github.com/TopRoupi) From 36c0cbc7541c4c98c7a299ff2a59078e0fd58ca1 Mon Sep 17 00:00:00 2001 From: ayecue Date: Thu, 29 Sep 2022 02:26:23 +0200 Subject: [PATCH 28/28] 1.3.7 remove uneccessary newline in readme --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index f66c7050..76a1700d 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,6 @@ Supports: * size * voffset - # REPL ``` Emulator CLI