From 4f7933d21a560b23063f609d80f4a47b296429b1 Mon Sep 17 00:00:00 2001 From: Martin Karkowski Date: Sun, 17 Jul 2022 22:50:00 +0200 Subject: [PATCH] using js-code for py. --- .gitignore | 1 + py-helpers/02-prepare-js.sh | 2 +- py-helpers/prepare_code/grammar.lark | 13 +++++++++++++ tsconfig.py.json | 7 +++++-- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 927eeb2..27eee59 100644 --- a/.gitignore +++ b/.gitignore @@ -82,6 +82,7 @@ typings/ .nuxt dist-nodejs dist-browser +dist-py temp # Gatsby files diff --git a/py-helpers/02-prepare-js.sh b/py-helpers/02-prepare-js.sh index c90ff52..6f433d3 100755 --- a/py-helpers/02-prepare-js.sh +++ b/py-helpers/02-prepare-js.sh @@ -7,4 +7,4 @@ cd "$( dirname -- "$0"; )" cd .. rm -rf temp -nope-py-prepare-code --input dist-nodejs --output temp --type js \ No newline at end of file +nope-py-prepare-code --input dist-py --output temp --type js \ No newline at end of file diff --git a/py-helpers/prepare_code/grammar.lark b/py-helpers/prepare_code/grammar.lark index 4e30f68..297d710 100644 --- a/py-helpers/prepare_code/grammar.lark +++ b/py-helpers/prepare_code/grammar.lark @@ -2,6 +2,19 @@ %import common.DIGIT %import common.INT +//-------------------------------------------------------------------------- +// JS-Ignorers: +//-------------------------------------------------------------------------- +%ignore /\"use strict\";/ +%ignore /Object.defineProperty(exports, "__esModule", { value: true });/ +%ignore /var __(.|\n)*?};/ +%ignore /\w+ = __decorate(.|\n)*?\], \w+\);/ +%ignore /exports.\w+ = \w+;/ +type_of_function: "void 0" +//-------------------------------------------------------------------------- +//-------------------------------------------------------------------------- + + MULTI_LINE_COMMENT: "/**" /(.|\n)*?/ "*/\n" COMMENT: "//" /.*/ STR: /(`.*?`)|(".*?")|(\'.*?\')/ diff --git a/tsconfig.py.json b/tsconfig.py.json index 7db56ad..cc750d9 100644 --- a/tsconfig.py.json +++ b/tsconfig.py.json @@ -1,11 +1,14 @@ { "compilerOptions": { - "target": "ES5", + "target": "ES2021", + "lib": [ + "ES2021" + ], "allowJs": true, "allowUnusedLabels": true, "charset": "utf-8", "experimentalDecorators": true, - "module": "None", + "module": "ES2022", "noFallthroughCasesInSwitch": false, "noImplicitReturns": true, "outDir": "./dist-py",