From 35c8510ab6d607fe59056a4aa1d8d148e194d12c Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Thu, 4 May 2023 20:00:00 +0200 Subject: [PATCH] feat(Code Node): Add Python support (#4295) --- packages/editor-ui/package.json | 1 + .../CodeNodeEditor/CodeNodeEditor.vue | 78 +-- .../components/CodeNodeEditor/completer.ts | 10 +- .../completions/base.completions.ts | 46 +- .../completions/itemField.completions.ts | 15 +- .../completions/require.completions.ts | 4 +- .../components/CodeNodeEditor/constants.ts | 40 +- .../src/components/CodeNodeEditor/linter.ts | 17 +- .../src/components/CodeNodeEditor/types.ts | 9 +- .../src/components/ParameterInput.vue | 2 +- packages/editor-ui/src/views/NodeView.vue | 12 +- packages/nodes-base/nodes/Code/Code.node.json | 2 +- packages/nodes-base/nodes/Code/Code.node.ts | 108 ++-- .../nodes/Code/JavaScriptSandbox.ts | 115 ++++ packages/nodes-base/nodes/Code/Pyodide.ts | 28 + .../nodes-base/nodes/Code/PythonSandbox.ts | 119 ++++ packages/nodes-base/nodes/Code/Sandbox.ts | 236 ++++---- .../descriptions/JavascriptCodeDescription.ts | 76 +++ .../descriptions/PythonCodeDescription.ts | 63 +++ .../nodes/Code/test/Code.node.test.ts | 28 +- packages/nodes-base/nodes/Code/utils.ts | 4 - packages/nodes-base/package.json | 1 + packages/workflow/src/Constants.ts | 3 + packages/workflow/src/Interfaces.ts | 10 +- pnpm-lock.yaml | 526 ++++++++---------- 25 files changed, 962 insertions(+), 591 deletions(-) create mode 100644 packages/nodes-base/nodes/Code/JavaScriptSandbox.ts create mode 100644 packages/nodes-base/nodes/Code/Pyodide.ts create mode 100644 packages/nodes-base/nodes/Code/PythonSandbox.ts create mode 100644 packages/nodes-base/nodes/Code/descriptions/JavascriptCodeDescription.ts create mode 100644 packages/nodes-base/nodes/Code/descriptions/PythonCodeDescription.ts diff --git a/packages/editor-ui/package.json b/packages/editor-ui/package.json index de946ffa6e6c8..a2ce0bd8ecca1 100644 --- a/packages/editor-ui/package.json +++ b/packages/editor-ui/package.json @@ -30,6 +30,7 @@ "@codemirror/commands": "^6.1.0", "@codemirror/lang-javascript": "^6.1.2", "@codemirror/lang-json": "^6.0.1", + "@codemirror/lang-python": "^6.1.2", "@codemirror/lang-sql": "^6.4.1", "@codemirror/language": "^6.2.1", "@codemirror/lint": "^6.0.0", diff --git a/packages/editor-ui/src/components/CodeNodeEditor/CodeNodeEditor.vue b/packages/editor-ui/src/components/CodeNodeEditor/CodeNodeEditor.vue index c775580dddebc..63ebcdec60efb 100644 --- a/packages/editor-ui/src/components/CodeNodeEditor/CodeNodeEditor.vue +++ b/packages/editor-ui/src/components/CodeNodeEditor/CodeNodeEditor.vue @@ -1,6 +1,6 @@