@nocobase/plugin-workflow-javascript 2.1.0-beta.11 → 2.1.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/externalVersion.js +4 -4
- package/dist/node_modules/isolated-vm/.clang-tidy +13 -0
- package/dist/node_modules/isolated-vm/.dockerignore +9 -0
- package/dist/node_modules/isolated-vm/Dockerfile.alpine +9 -0
- package/dist/node_modules/isolated-vm/Dockerfile.debian +12 -0
- package/dist/node_modules/isolated-vm/LICENSE +13 -0
- package/dist/node_modules/isolated-vm/binding.gyp +120 -0
- package/dist/node_modules/isolated-vm/include.js +3 -0
- package/dist/node_modules/isolated-vm/inspector-example.js +59 -0
- package/dist/node_modules/isolated-vm/isolated-vm.d.ts +820 -0
- package/dist/node_modules/isolated-vm/isolated-vm.js +1 -0
- package/dist/node_modules/isolated-vm/native-example/binding.gyp +23 -0
- package/dist/node_modules/isolated-vm/native-example/example.cc +61 -0
- package/dist/node_modules/isolated-vm/native-example/package.json +13 -0
- package/dist/node_modules/isolated-vm/native-example/usage.js +35 -0
- package/dist/node_modules/isolated-vm/out/isolated_vm.node +0 -0
- package/dist/node_modules/isolated-vm/package.json +1 -0
- package/dist/node_modules/isolated-vm/src/external_copy/error.h +33 -0
- package/dist/node_modules/isolated-vm/src/external_copy/external_copy.cc +509 -0
- package/dist/node_modules/isolated-vm/src/external_copy/external_copy.h +117 -0
- package/dist/node_modules/isolated-vm/src/external_copy/serializer.cc +85 -0
- package/dist/node_modules/isolated-vm/src/external_copy/serializer.h +136 -0
- package/dist/node_modules/isolated-vm/src/external_copy/serializer_nortti.cc +73 -0
- package/dist/node_modules/isolated-vm/src/external_copy/string.cc +124 -0
- package/dist/node_modules/isolated-vm/src/external_copy/string.h +28 -0
- package/dist/node_modules/isolated-vm/src/isolate/allocator.h +32 -0
- package/dist/node_modules/isolated-vm/src/isolate/allocator_nortti.cc +142 -0
- package/dist/node_modules/isolated-vm/src/isolate/class_handle.h +334 -0
- package/dist/node_modules/isolated-vm/src/isolate/cpu_profile_manager.cc +220 -0
- package/dist/node_modules/isolated-vm/src/isolate/cpu_profile_manager.h +100 -0
- package/dist/node_modules/isolated-vm/src/isolate/environment.cc +626 -0
- package/dist/node_modules/isolated-vm/src/isolate/environment.h +381 -0
- package/dist/node_modules/isolated-vm/src/isolate/executor.cc +198 -0
- package/dist/node_modules/isolated-vm/src/isolate/executor.h +183 -0
- package/dist/node_modules/isolated-vm/src/isolate/external.h +64 -0
- package/dist/node_modules/isolated-vm/src/isolate/functor_runners.h +97 -0
- package/dist/node_modules/isolated-vm/src/isolate/generic/array.h +145 -0
- package/dist/node_modules/isolated-vm/src/isolate/generic/callbacks.h +272 -0
- package/dist/node_modules/isolated-vm/src/isolate/generic/error.h +140 -0
- package/dist/node_modules/isolated-vm/src/isolate/generic/extract_params.h +145 -0
- package/dist/node_modules/isolated-vm/src/isolate/generic/handle_cast.h +257 -0
- package/dist/node_modules/isolated-vm/src/isolate/generic/read_option.h +47 -0
- package/dist/node_modules/isolated-vm/src/isolate/holder.cc +88 -0
- package/dist/node_modules/isolated-vm/src/isolate/holder.h +63 -0
- package/dist/node_modules/isolated-vm/src/isolate/inspector.cc +200 -0
- package/dist/node_modules/isolated-vm/src/isolate/inspector.h +70 -0
- package/dist/node_modules/isolated-vm/src/isolate/node_wrapper.h +15 -0
- package/dist/node_modules/isolated-vm/src/isolate/platform_delegate.cc +22 -0
- package/dist/node_modules/isolated-vm/src/isolate/platform_delegate.h +46 -0
- package/dist/node_modules/isolated-vm/src/isolate/remote_handle.h +164 -0
- package/dist/node_modules/isolated-vm/src/isolate/run_with_timeout.h +171 -0
- package/dist/node_modules/isolated-vm/src/isolate/runnable.h +29 -0
- package/dist/node_modules/isolated-vm/src/isolate/scheduler.cc +191 -0
- package/dist/node_modules/isolated-vm/src/isolate/scheduler.h +165 -0
- package/dist/node_modules/isolated-vm/src/isolate/specific.h +35 -0
- package/dist/node_modules/isolated-vm/src/isolate/stack_trace.cc +219 -0
- package/dist/node_modules/isolated-vm/src/isolate/stack_trace.h +24 -0
- package/dist/node_modules/isolated-vm/src/isolate/strings.h +127 -0
- package/dist/node_modules/isolated-vm/src/isolate/three_phase_task.cc +385 -0
- package/dist/node_modules/isolated-vm/src/isolate/three_phase_task.h +136 -0
- package/dist/node_modules/isolated-vm/src/isolate/transferable.h +15 -0
- package/dist/node_modules/isolated-vm/src/isolate/util.h +45 -0
- package/dist/node_modules/isolated-vm/src/isolate/v8_inspector_wrapper.h +12 -0
- package/dist/node_modules/isolated-vm/src/isolate/v8_version.h +12 -0
- package/dist/node_modules/isolated-vm/src/isolated_vm.h +71 -0
- package/dist/node_modules/isolated-vm/src/lib/covariant.h +50 -0
- package/dist/node_modules/isolated-vm/src/lib/lockable.h +178 -0
- package/dist/node_modules/isolated-vm/src/lib/suspend.h +106 -0
- package/dist/node_modules/isolated-vm/src/lib/thread_pool.cc +98 -0
- package/dist/node_modules/isolated-vm/src/lib/thread_pool.h +45 -0
- package/dist/node_modules/isolated-vm/src/lib/timer.cc +233 -0
- package/dist/node_modules/isolated-vm/src/lib/timer.h +36 -0
- package/dist/node_modules/isolated-vm/src/module/callback.cc +151 -0
- package/dist/node_modules/isolated-vm/src/module/callback.h +64 -0
- package/dist/node_modules/isolated-vm/src/module/context_handle.cc +241 -0
- package/dist/node_modules/isolated-vm/src/module/context_handle.h +35 -0
- package/dist/node_modules/isolated-vm/src/module/evaluation.cc +109 -0
- package/dist/node_modules/isolated-vm/src/module/evaluation.h +99 -0
- package/dist/node_modules/isolated-vm/src/module/external_copy_handle.cc +119 -0
- package/dist/node_modules/isolated-vm/src/module/external_copy_handle.h +64 -0
- package/dist/node_modules/isolated-vm/src/module/isolate.cc +136 -0
- package/dist/node_modules/isolated-vm/src/module/isolate_handle.cc +611 -0
- package/dist/node_modules/isolated-vm/src/module/isolate_handle.h +47 -0
- package/dist/node_modules/isolated-vm/src/module/lib_handle.cc +77 -0
- package/dist/node_modules/isolated-vm/src/module/lib_handle.h +28 -0
- package/dist/node_modules/isolated-vm/src/module/module_handle.cc +475 -0
- package/dist/node_modules/isolated-vm/src/module/module_handle.h +68 -0
- package/dist/node_modules/isolated-vm/src/module/native_module_handle.cc +104 -0
- package/dist/node_modules/isolated-vm/src/module/native_module_handle.h +49 -0
- package/dist/node_modules/isolated-vm/src/module/reference_handle.cc +636 -0
- package/dist/node_modules/isolated-vm/src/module/reference_handle.h +106 -0
- package/dist/node_modules/isolated-vm/src/module/script_handle.cc +107 -0
- package/dist/node_modules/isolated-vm/src/module/script_handle.h +37 -0
- package/dist/node_modules/isolated-vm/src/module/session_handle.cc +173 -0
- package/dist/node_modules/isolated-vm/src/module/session_handle.h +31 -0
- package/dist/node_modules/isolated-vm/src/module/transferable.cc +268 -0
- package/dist/node_modules/isolated-vm/src/module/transferable.h +42 -0
- package/dist/node_modules/isolated-vm/vendor/v8_inspector/nodejs_v18.0.0.h +360 -0
- package/dist/node_modules/isolated-vm/vendor/v8_inspector/nodejs_v18.3.0.h +376 -0
- package/dist/node_modules/isolated-vm/vendor/v8_inspector/nodejs_v20.0.0.h +397 -0
- package/dist/node_modules/isolated-vm/vendor/v8_inspector/nodejs_v22.0.0.h +419 -0
- package/dist/node_modules/winston-transport/package.json +1 -1
- package/dist/server/IsolatedVm.js +75 -0
- package/dist/server/ScriptInstruction.d.ts +6 -0
- package/dist/server/ScriptInstruction.js +11 -1
- package/dist/server/Vm.js +42 -27
- package/package.json +3 -2
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
#include <ratio>
|
|
3
|
+
#include <string>
|
|
4
|
+
#include <thread>
|
|
5
|
+
#include <v8.h>
|
|
6
|
+
|
|
7
|
+
#include "executor.h"
|
|
8
|
+
#include "v8-profiler.h"
|
|
9
|
+
|
|
10
|
+
#include <mutex>
|
|
11
|
+
#include <queue>
|
|
12
|
+
#include <set>
|
|
13
|
+
#include <unordered_map>
|
|
14
|
+
#include <vector>
|
|
15
|
+
#include <list>
|
|
16
|
+
|
|
17
|
+
namespace ivm {
|
|
18
|
+
|
|
19
|
+
class IVMCpuProfile {
|
|
20
|
+
public:
|
|
21
|
+
explicit IVMCpuProfile(const std::shared_ptr<v8::CpuProfile>& cpuProfile);
|
|
22
|
+
~IVMCpuProfile() = default;
|
|
23
|
+
|
|
24
|
+
class CallFrame {
|
|
25
|
+
public:
|
|
26
|
+
explicit CallFrame(const v8::CpuProfileNode* node);
|
|
27
|
+
~CallFrame() = default;
|
|
28
|
+
|
|
29
|
+
auto ToJSObject(v8::Isolate *iso) -> v8::Local<v8::Value>;
|
|
30
|
+
private:
|
|
31
|
+
const char* function_name;
|
|
32
|
+
const char* url;
|
|
33
|
+
int script_id;
|
|
34
|
+
int line_number;
|
|
35
|
+
int column_number;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
class ProfileNode {
|
|
39
|
+
public:
|
|
40
|
+
explicit ProfileNode(const v8::CpuProfileNode* node);
|
|
41
|
+
~ProfileNode() = default;
|
|
42
|
+
|
|
43
|
+
auto ToJSObject(v8::Isolate *iso) -> v8::Local<v8::Value>;
|
|
44
|
+
private:
|
|
45
|
+
unsigned int hit_count;
|
|
46
|
+
unsigned int node_id;
|
|
47
|
+
const char* bailout_reason;
|
|
48
|
+
std::vector<unsigned int> children;
|
|
49
|
+
CallFrame call_frame;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
auto GetStartTime() const -> int64_t { return start_time; }
|
|
53
|
+
|
|
54
|
+
auto ToJSObject(v8::Isolate *iso) -> v8::Local<v8::Value>;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
private:
|
|
58
|
+
std::thread::id profile_thread;
|
|
59
|
+
int64_t start_time;
|
|
60
|
+
int64_t end_time;
|
|
61
|
+
int64_t samples_count;
|
|
62
|
+
std::vector<unsigned int> samples;
|
|
63
|
+
std::vector<int64_t> timestamps;
|
|
64
|
+
std::vector<ProfileNode> profileNodes;
|
|
65
|
+
|
|
66
|
+
auto GetTidValue(v8::Isolate *iso) -> v8::Local<v8::Value>;
|
|
67
|
+
|
|
68
|
+
auto BuildCpuProfile(v8::Isolate *iso) -> v8::Local<v8::Value>;
|
|
69
|
+
|
|
70
|
+
void FlatNodes(const v8::CpuProfileNode* node, std::vector<ProfileNode>* nodes) { // NOLINT(misc-no-recursion)
|
|
71
|
+
nodes->emplace_back(node);
|
|
72
|
+
const int childrenCount = node->GetChildrenCount();
|
|
73
|
+
|
|
74
|
+
for (int index = 0; index < childrenCount; ++index) {
|
|
75
|
+
FlatNodes(node->GetChild(index), nodes);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
class CpuProfileManager {
|
|
82
|
+
public:
|
|
83
|
+
CpuProfileManager();
|
|
84
|
+
void StartProfiling(const char* title);
|
|
85
|
+
auto StopProfiling(const char* title) -> std::vector<IVMCpuProfile>;
|
|
86
|
+
auto IsProfiling() -> bool;
|
|
87
|
+
auto InjestCpuProfile(const std::shared_ptr<v8::CpuProfile>& cpuProfile) -> void;
|
|
88
|
+
|
|
89
|
+
CpuProfileManager(const CpuProfileManager&) = delete;
|
|
90
|
+
auto operator= (const CpuProfileManager) = delete;
|
|
91
|
+
~CpuProfileManager() = default;
|
|
92
|
+
private:
|
|
93
|
+
void CleanProfiles();
|
|
94
|
+
|
|
95
|
+
std::set<std::string> profile_titles{};
|
|
96
|
+
std::list<IVMCpuProfile> profile_items{};
|
|
97
|
+
std::unordered_map<std::string, std::list<IVMCpuProfile>::iterator> profile_begin_ptrs{};
|
|
98
|
+
std::mutex mutex;
|
|
99
|
+
};
|
|
100
|
+
}
|