@devaloop/devalang 0.0.1-alpha.16-hotfix.1 → 0.0.1-alpha.17
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/.cargo/config.toml +2 -0
- package/.devalang +6 -10
- package/.github/workflows/ci.yml +19 -8
- package/Cargo.toml +18 -2
- package/README.md +80 -33
- package/docs/CHANGELOG.md +56 -0
- package/docs/ROADMAP.md +6 -3
- package/examples/index.deva +52 -35
- package/out-tsc/bin/index.d.ts +2 -0
- package/out-tsc/core/functions/index.d.ts +37 -0
- package/out-tsc/core/functions/index.js +76 -0
- package/out-tsc/core/index.d.ts +6 -0
- package/out-tsc/core/index.js +22 -0
- package/out-tsc/core/types/index.d.ts +4 -0
- package/out-tsc/core/types/index.js +20 -0
- package/out-tsc/core/types/plugin.d.ts +18 -0
- package/out-tsc/core/types/plugin.js +2 -0
- package/out-tsc/core/types/result.d.ts +27 -0
- package/out-tsc/core/types/result.js +2 -0
- package/out-tsc/core/types/statement.d.ts +106 -0
- package/out-tsc/core/types/statement.js +2 -0
- package/out-tsc/core/types/value.d.ts +43 -0
- package/out-tsc/core/types/value.js +2 -0
- package/out-tsc/index.d.ts +7 -0
- package/out-tsc/index.js +41 -2
- package/out-tsc/pkg/devalang_core.d.ts +7 -0
- package/out-tsc/pkg/devalang_core_bg.wasm.d.ts +33 -0
- package/out-tsc/scripts/copy-wasm-dts.d.ts +1 -0
- package/out-tsc/scripts/copy-wasm-dts.js +73 -0
- package/out-tsc/scripts/postinstall.d.ts +1 -0
- package/out-tsc/scripts/postinstall.js +33 -23
- package/out-tsc/scripts/version/bump.d.ts +1 -0
- package/out-tsc/scripts/version/fetch.d.ts +1 -0
- package/out-tsc/scripts/version/index.d.ts +1 -0
- package/out-tsc/scripts/version/sync.d.ts +1 -0
- package/package.json +16 -4
- package/project-version.json +3 -3
- package/rust/cli/bank/api.rs +122 -0
- package/rust/cli/bank/commands.rs +275 -0
- package/rust/cli/bank/mod.rs +29 -0
- package/rust/cli/build/commands.rs +97 -0
- package/rust/cli/build/mod.rs +2 -0
- package/rust/cli/build/process.rs +146 -0
- package/rust/cli/{check.rs → check/mod.rs} +18 -31
- package/rust/cli/discover/commands.rs +253 -0
- package/rust/cli/discover/config.rs +111 -0
- package/rust/cli/discover/fs.rs +19 -0
- package/rust/cli/discover/install.rs +103 -0
- package/rust/cli/discover/metadata.rs +48 -0
- package/rust/cli/discover/mod.rs +5 -0
- package/rust/cli/{init.rs → init/commands.rs} +88 -87
- package/rust/cli/init/mod.rs +1 -0
- package/rust/{installer → cli/install}/addon.rs +5 -9
- package/rust/cli/install/bank.rs +53 -0
- package/rust/cli/{install.rs → install/commands.rs} +9 -9
- package/rust/{installer → cli/install}/mod.rs +2 -3
- package/rust/cli/install/plugin.rs +61 -0
- package/rust/cli/{login.rs → login/commands.rs} +8 -11
- package/rust/cli/login/mod.rs +1 -0
- package/rust/cli/mod.rs +2 -3
- package/rust/cli/{driver.rs → parser.rs} +19 -2
- package/rust/cli/play/commands.rs +324 -0
- package/rust/cli/play/io.rs +17 -0
- package/rust/cli/play/mod.rs +5 -0
- package/rust/cli/play/process.rs +150 -0
- package/rust/cli/play/realtime.rs +91 -0
- package/rust/cli/play/utils.rs +23 -0
- package/rust/cli/telemetry/commands.rs +22 -0
- package/rust/cli/telemetry/event_creator.rs +80 -0
- package/rust/cli/telemetry/mod.rs +3 -0
- package/rust/cli/telemetry/send.rs +51 -0
- package/rust/cli/{template.rs → template/commands.rs} +1 -1
- package/rust/cli/template/mod.rs +1 -0
- package/rust/cli/{update.rs → update/commands.rs} +6 -6
- package/rust/cli/update/mod.rs +1 -0
- package/rust/config/driver.rs +57 -72
- package/rust/config/mod.rs +1 -2
- package/rust/config/ops.rs +26 -0
- package/rust/config/settings.rs +60 -50
- package/rust/core/audio/engine/helpers.rs +146 -0
- package/rust/core/audio/engine/mod.rs +7 -0
- package/rust/core/audio/engine/sample.rs +298 -0
- package/rust/core/audio/engine/synth.rs +310 -0
- package/rust/core/audio/evaluator.rs +15 -12
- package/rust/core/audio/interpreter/arrow_call.rs +99 -24
- package/rust/core/audio/interpreter/call.rs +81 -60
- package/rust/core/audio/interpreter/condition.rs +3 -2
- package/rust/core/audio/interpreter/driver.rs +206 -151
- package/rust/core/audio/interpreter/let_.rs +1 -1
- package/rust/core/audio/interpreter/load.rs +2 -1
- package/rust/core/audio/interpreter/loop_.rs +7 -6
- package/rust/core/audio/interpreter/sleep.rs +2 -1
- package/rust/core/audio/interpreter/spawn.rs +45 -57
- package/rust/core/audio/interpreter/tempo.rs +31 -10
- package/rust/core/audio/interpreter/trigger.rs +2 -2
- package/rust/core/audio/loader/trigger.rs +4 -7
- package/rust/core/audio/player.rs +6 -0
- package/rust/core/audio/renderer.rs +5 -7
- package/rust/core/audio/special/env.rs +3 -1
- package/rust/core/audio/special/math.rs +4 -4
- package/rust/core/audio/special/modulator.rs +2 -2
- package/rust/core/builder/mod.rs +9 -3
- package/rust/core/debugger/lexer.rs +1 -1
- package/rust/core/debugger/mod.rs +6 -0
- package/rust/core/debugger/module.rs +4 -4
- package/rust/core/debugger/preprocessor.rs +1 -1
- package/rust/core/debugger/store.rs +2 -2
- package/rust/core/error/mod.rs +189 -0
- package/rust/core/lexer/handler/arrow.rs +1 -1
- package/rust/core/lexer/handler/at.rs +1 -1
- package/rust/core/lexer/handler/brace.rs +2 -2
- package/rust/core/lexer/handler/colon.rs +1 -1
- package/rust/core/lexer/handler/comment.rs +1 -1
- package/rust/core/lexer/handler/dot.rs +1 -1
- package/rust/core/lexer/handler/driver.rs +1 -1
- package/rust/core/lexer/handler/identifier.rs +1 -1
- package/rust/core/lexer/handler/mod.rs +1 -2
- package/rust/core/lexer/handler/number.rs +1 -1
- package/rust/core/lexer/handler/operator.rs +1 -1
- package/rust/core/lexer/handler/parenthesis.rs +2 -2
- package/rust/core/lexer/handler/slash.rs +1 -1
- package/rust/core/lexer/handler/string.rs +1 -1
- package/rust/core/lexer/mod.rs +22 -12
- package/rust/core/lexer/token.rs +90 -97
- package/rust/core/mod.rs +0 -1
- package/rust/core/parser/driver.rs +66 -13
- package/rust/core/parser/handler/arrow_call.rs +28 -8
- package/rust/core/parser/handler/at.rs +55 -21
- package/rust/core/parser/handler/bank.rs +14 -4
- package/rust/core/parser/handler/condition.rs +6 -3
- package/rust/core/parser/handler/dot.rs +2 -1
- package/rust/core/parser/handler/identifier/automate.rs +13 -16
- package/rust/core/parser/handler/identifier/call.rs +4 -4
- package/rust/core/parser/handler/identifier/emit.rs +9 -5
- package/rust/core/parser/handler/identifier/function.rs +20 -7
- package/rust/core/parser/handler/identifier/group.rs +11 -7
- package/rust/core/parser/handler/identifier/let_.rs +24 -9
- package/rust/core/parser/handler/identifier/mod.rs +6 -5
- package/rust/core/parser/handler/identifier/on.rs +16 -7
- package/rust/core/parser/handler/identifier/print.rs +6 -9
- package/rust/core/parser/handler/identifier/sleep.rs +12 -5
- package/rust/core/parser/handler/identifier/spawn.rs +4 -4
- package/rust/core/parser/handler/identifier/synth.rs +79 -9
- package/rust/core/parser/handler/loop_.rs +39 -14
- package/rust/core/parser/handler/tempo.rs +9 -5
- package/rust/core/parser/mod.rs +0 -1
- package/rust/core/parser/statement.rs +6 -137
- package/rust/core/plugin/loader.rs +41 -27
- package/rust/core/plugin/runner.rs +68 -17
- package/rust/core/preprocessor/loader.rs +155 -33
- package/rust/core/preprocessor/processor.rs +2 -2
- package/rust/core/preprocessor/resolver/bank.rs +6 -8
- package/rust/core/preprocessor/resolver/call.rs +20 -24
- package/rust/core/preprocessor/resolver/condition.rs +6 -8
- package/rust/core/preprocessor/resolver/driver.rs +14 -16
- package/rust/core/preprocessor/resolver/function.rs +6 -6
- package/rust/core/preprocessor/resolver/group.rs +6 -8
- package/rust/core/preprocessor/resolver/loop_.rs +8 -10
- package/rust/core/preprocessor/resolver/spawn.rs +19 -23
- package/rust/core/preprocessor/resolver/synth.rs +6 -8
- package/rust/core/preprocessor/resolver/tempo.rs +6 -8
- package/rust/core/preprocessor/resolver/trigger.rs +22 -19
- package/rust/core/preprocessor/resolver/value.rs +99 -4
- package/rust/core/store/export.rs +28 -28
- package/rust/core/store/function.rs +6 -0
- package/rust/core/store/global.rs +7 -1
- package/rust/core/store/import.rs +28 -28
- package/rust/core/store/variable.rs +1 -1
- package/rust/core/utils/mod.rs +0 -1
- package/rust/lib.rs +102 -9
- package/rust/main.rs +156 -45
- package/rust/types/Cargo.toml +8 -0
- package/rust/types/src/addons.rs +55 -0
- package/rust/types/src/ast.rs +198 -0
- package/rust/types/src/config.rs +74 -0
- package/rust/types/src/lib.rs +12 -0
- package/rust/types/src/telemetry.rs +85 -0
- package/rust/utils/Cargo.toml +23 -0
- package/rust/utils/{error.rs → src/error.rs} +186 -200
- package/rust/utils/src/file.rs +94 -0
- package/rust/utils/src/first_usage.rs +97 -0
- package/rust/utils/{mod.rs → src/lib.rs} +1 -1
- package/rust/utils/{logger.rs → src/logger.rs} +17 -12
- package/rust/utils/src/path.rs +88 -0
- package/rust/utils/src/signature.rs +41 -0
- package/rust/utils/{spinner.rs → src/spinner.rs} +3 -5
- package/rust/utils/src/version.rs +27 -0
- package/rust/utils/{watcher.rs → src/watcher.rs} +13 -1
- package/rust/web/api.rs +5 -0
- package/rust/web/cdn.rs +34 -0
- package/templates/minimal/README.md +98 -54
- package/templates/welcome/README.md +98 -54
- package/templates/welcome/src/index.deva +56 -8
- package/templates/welcome/src/variables.deva +2 -4
- package/tests/rust/TODO.md +0 -0
- package/tests/typescript/index.spec.ts +136 -0
- package/tests/typescript/playhead.spec.ts +36 -0
- package/tests/typescript/render_e2e.spec.ts +77 -0
- package/tsconfig.json +1 -1
- package/typescript/core/functions/index.ts +83 -0
- package/typescript/core/index.ts +6 -0
- package/typescript/core/types/index.ts +4 -0
- package/typescript/core/types/plugin.ts +19 -0
- package/typescript/core/types/result.ts +29 -0
- package/typescript/core/types/statement.ts +47 -0
- package/typescript/core/types/value.ts +29 -0
- package/typescript/index.ts +7 -2
- package/typescript/pkg/devalang_core.d.ts +4 -0
- package/typescript/scripts/copy-wasm-dts.ts +41 -0
- package/typescript/scripts/postinstall.ts +45 -32
- package/rust/cli/bank.rs +0 -462
- package/rust/cli/build.rs +0 -252
- package/rust/cli/generator.rs +0 -1
- package/rust/cli/play.rs +0 -1123
- package/rust/cli/telemetry.rs +0 -19
- package/rust/common/api.rs +0 -5
- package/rust/common/cdn.rs +0 -5
- package/rust/config/loader.rs +0 -165
- package/rust/config/stats.rs +0 -257
- package/rust/core/audio/engine.rs +0 -696
- package/rust/core/shared/bank.rs +0 -21
- package/rust/core/shared/duration.rs +0 -9
- package/rust/core/shared/mod.rs +0 -3
- package/rust/core/shared/value.rs +0 -35
- package/rust/core/utils/validation.rs +0 -35
- package/rust/installer/bank.rs +0 -62
- package/rust/installer/plugin.rs +0 -54
- package/rust/installer/utils.rs +0 -56
- package/rust/utils/file.rs +0 -38
- package/rust/utils/first_usage.rs +0 -76
- package/rust/utils/signature.rs +0 -19
- package/rust/utils/telemetry.rs +0 -292
- package/rust/utils/version.rs +0 -15
- /package/rust/{common → web}/mod.rs +0 -0
- /package/rust/{common → web}/sso.rs +0 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
use serde::{Deserialize, Serialize};
|
|
2
|
+
use std::collections::HashMap;
|
|
3
|
+
|
|
4
|
+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
|
5
|
+
pub enum Duration {
|
|
6
|
+
Number(f32),
|
|
7
|
+
Identifier(String),
|
|
8
|
+
Beat(String),
|
|
9
|
+
Auto,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
|
13
|
+
pub enum Severity {
|
|
14
|
+
Warning,
|
|
15
|
+
Critical,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)]
|
|
19
|
+
pub struct StackFrame {
|
|
20
|
+
pub module: Option<String>,
|
|
21
|
+
pub context: Option<String>,
|
|
22
|
+
pub line: usize,
|
|
23
|
+
pub column: usize,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
|
27
|
+
pub struct ErrorResult {
|
|
28
|
+
pub message: String,
|
|
29
|
+
pub line: usize,
|
|
30
|
+
pub column: usize,
|
|
31
|
+
pub severity: Severity,
|
|
32
|
+
pub stack: Vec<StackFrame>,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
|
36
|
+
pub enum StatementKind {
|
|
37
|
+
// ───── Core Instructions ─────
|
|
38
|
+
Tempo,
|
|
39
|
+
Bank {
|
|
40
|
+
alias: Option<String>,
|
|
41
|
+
},
|
|
42
|
+
Print,
|
|
43
|
+
Load {
|
|
44
|
+
source: String,
|
|
45
|
+
alias: String,
|
|
46
|
+
},
|
|
47
|
+
Use {
|
|
48
|
+
name: String,
|
|
49
|
+
alias: Option<String>,
|
|
50
|
+
},
|
|
51
|
+
Let {
|
|
52
|
+
name: String,
|
|
53
|
+
},
|
|
54
|
+
Automate {
|
|
55
|
+
target: String,
|
|
56
|
+
},
|
|
57
|
+
ArrowCall {
|
|
58
|
+
target: String,
|
|
59
|
+
method: String,
|
|
60
|
+
args: Vec<Value>,
|
|
61
|
+
},
|
|
62
|
+
Function {
|
|
63
|
+
name: String,
|
|
64
|
+
parameters: Vec<String>,
|
|
65
|
+
body: Vec<Statement>,
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
// ───── Instruments ─────
|
|
69
|
+
Synth,
|
|
70
|
+
|
|
71
|
+
// ───── Playback / Scheduling ─────
|
|
72
|
+
Trigger {
|
|
73
|
+
entity: String,
|
|
74
|
+
duration: Duration,
|
|
75
|
+
effects: Option<Value>,
|
|
76
|
+
},
|
|
77
|
+
Sleep,
|
|
78
|
+
Call {
|
|
79
|
+
name: String,
|
|
80
|
+
args: Vec<Value>,
|
|
81
|
+
},
|
|
82
|
+
Spawn {
|
|
83
|
+
name: String,
|
|
84
|
+
args: Vec<Value>,
|
|
85
|
+
},
|
|
86
|
+
Loop,
|
|
87
|
+
|
|
88
|
+
// ───── Structure & Logic ─────
|
|
89
|
+
Group,
|
|
90
|
+
|
|
91
|
+
// ───── Module System ─────
|
|
92
|
+
Include(String),
|
|
93
|
+
Export {
|
|
94
|
+
names: Vec<String>,
|
|
95
|
+
source: String,
|
|
96
|
+
},
|
|
97
|
+
Import {
|
|
98
|
+
names: Vec<String>,
|
|
99
|
+
source: String,
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
// ───── Conditions ─────
|
|
103
|
+
If,
|
|
104
|
+
Else,
|
|
105
|
+
ElseIf,
|
|
106
|
+
|
|
107
|
+
// ───── Internal / Utility ─────
|
|
108
|
+
Comment,
|
|
109
|
+
Indent,
|
|
110
|
+
Dedent,
|
|
111
|
+
NewLine,
|
|
112
|
+
|
|
113
|
+
// ───── Events / Live coding ─────
|
|
114
|
+
On {
|
|
115
|
+
event: String,
|
|
116
|
+
args: Option<Vec<Value>>,
|
|
117
|
+
body: Vec<Statement>,
|
|
118
|
+
},
|
|
119
|
+
Emit {
|
|
120
|
+
event: String,
|
|
121
|
+
payload: Option<Value>,
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
// ───── Error Handling ─────
|
|
125
|
+
Unknown,
|
|
126
|
+
Error {
|
|
127
|
+
message: String,
|
|
128
|
+
},
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
|
132
|
+
pub enum Value {
|
|
133
|
+
Boolean(bool),
|
|
134
|
+
Number(f32),
|
|
135
|
+
Duration(Duration),
|
|
136
|
+
Identifier(String),
|
|
137
|
+
String(String),
|
|
138
|
+
Array(Vec<Value>),
|
|
139
|
+
Map(HashMap<String, Value>),
|
|
140
|
+
Block(Vec<Statement>),
|
|
141
|
+
Sample(String),
|
|
142
|
+
Beat(String),
|
|
143
|
+
Statement(Box<Statement>),
|
|
144
|
+
StatementKind(Box<StatementKind>),
|
|
145
|
+
Unknown,
|
|
146
|
+
Null,
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
impl Value {
|
|
150
|
+
pub fn get(&self, key: &str) -> Option<&Value> {
|
|
151
|
+
if let Value::Map(map) = self {
|
|
152
|
+
map.get(key)
|
|
153
|
+
} else {
|
|
154
|
+
None
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
|
160
|
+
pub struct Statement {
|
|
161
|
+
pub kind: StatementKind,
|
|
162
|
+
pub value: Value,
|
|
163
|
+
pub indent: usize,
|
|
164
|
+
pub line: usize,
|
|
165
|
+
pub column: usize,
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
impl Statement {
|
|
169
|
+
pub fn unknown() -> Self {
|
|
170
|
+
Statement {
|
|
171
|
+
kind: StatementKind::Unknown,
|
|
172
|
+
value: Value::Null,
|
|
173
|
+
indent: 0,
|
|
174
|
+
line: 0,
|
|
175
|
+
column: 0,
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
pub fn unknown_with_pos(indent: usize, line: usize, column: usize) -> Self {
|
|
180
|
+
Statement {
|
|
181
|
+
kind: StatementKind::Unknown,
|
|
182
|
+
value: Value::Null,
|
|
183
|
+
indent,
|
|
184
|
+
line,
|
|
185
|
+
column,
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
pub fn error_with_pos(indent: usize, line: usize, column: usize, message: String) -> Self {
|
|
190
|
+
Statement {
|
|
191
|
+
kind: StatementKind::Error { message },
|
|
192
|
+
value: Value::Null,
|
|
193
|
+
indent,
|
|
194
|
+
line,
|
|
195
|
+
column,
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
use serde::{Deserialize, Serialize};
|
|
2
|
+
use toml::Value as TomlValue;
|
|
3
|
+
|
|
4
|
+
use crate::TelemetrySettings;
|
|
5
|
+
|
|
6
|
+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
|
7
|
+
pub struct PluginExport {
|
|
8
|
+
pub name: String,
|
|
9
|
+
pub kind: String,
|
|
10
|
+
/// Optional default value provided by the plugin manifest (keeps toml::Value to preserve types)
|
|
11
|
+
#[serde(default)]
|
|
12
|
+
pub default: Option<TomlValue>,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
|
16
|
+
pub struct PluginInfo {
|
|
17
|
+
pub author: String,
|
|
18
|
+
pub name: String,
|
|
19
|
+
/// Optional version string when available from a plugin file
|
|
20
|
+
#[serde(default)]
|
|
21
|
+
pub version: Option<String>,
|
|
22
|
+
/// Optional human-friendly description
|
|
23
|
+
#[serde(default)]
|
|
24
|
+
pub description: Option<String>,
|
|
25
|
+
pub exports: Vec<PluginExport>,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// --- Config types (centralised) ------------------------------------------
|
|
29
|
+
|
|
30
|
+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
|
|
31
|
+
pub struct ProjectConfig {
|
|
32
|
+
pub defaults: ProjectConfigDefaults,
|
|
33
|
+
pub banks: Option<Vec<ProjectConfigBankEntry>>,
|
|
34
|
+
pub plugins: Option<Vec<ProjectConfigPluginEntry>>,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
|
|
38
|
+
pub struct ProjectConfigDefaults {
|
|
39
|
+
pub entry: Option<String>,
|
|
40
|
+
pub output: Option<String>,
|
|
41
|
+
pub watch: Option<bool>,
|
|
42
|
+
pub repeat: Option<bool>,
|
|
43
|
+
pub debug: Option<bool>,
|
|
44
|
+
pub compress: Option<bool>,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
|
|
48
|
+
pub struct ProjectConfigBankEntry {
|
|
49
|
+
pub path: String,
|
|
50
|
+
pub version: Option<String>,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
|
|
54
|
+
pub struct ProjectConfigPluginEntry {
|
|
55
|
+
pub path: String,
|
|
56
|
+
pub version: Option<String>,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
|
|
60
|
+
pub struct PluginEntry {
|
|
61
|
+
pub path: String,
|
|
62
|
+
#[serde(default)]
|
|
63
|
+
pub version: String,
|
|
64
|
+
#[serde(default)]
|
|
65
|
+
pub author: String,
|
|
66
|
+
#[serde(default)]
|
|
67
|
+
pub access: String,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#[derive(Serialize, Deserialize, Default, Debug)]
|
|
71
|
+
pub struct UserSettings {
|
|
72
|
+
pub session: String,
|
|
73
|
+
pub telemetry: TelemetrySettings,
|
|
74
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
use serde::{Deserialize, Serialize};
|
|
2
|
+
|
|
3
|
+
#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
|
|
4
|
+
pub enum TelemetryErrorLevel {
|
|
5
|
+
#[default]
|
|
6
|
+
None,
|
|
7
|
+
Warning,
|
|
8
|
+
Critical,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#[derive(Debug)]
|
|
12
|
+
pub enum TelemetrySendError {
|
|
13
|
+
Http(String),
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
|
|
17
|
+
pub struct TelemetryProjectInfo {
|
|
18
|
+
pub config: Option<TelemetryProjectInfoConfig>,
|
|
19
|
+
pub stats: Option<TelemetryProjectInfoStats>,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
|
|
23
|
+
pub struct TelemetryProjectInfoStats {
|
|
24
|
+
pub counts: TelemetryProjectInfoStatsCounts,
|
|
25
|
+
pub features: TelemetryProjectInfoStatsFeatures,
|
|
26
|
+
pub audio: TelemetryProjectInfoStatsAudio,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
|
|
30
|
+
pub struct TelemetryProjectInfoStatsCounts {
|
|
31
|
+
pub nb_files: usize,
|
|
32
|
+
pub nb_modules: usize,
|
|
33
|
+
pub nb_lines: usize,
|
|
34
|
+
pub nb_banks: usize,
|
|
35
|
+
pub nb_plugins: usize,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
|
|
39
|
+
pub struct TelemetryProjectInfoStatsFeatures {
|
|
40
|
+
pub uses_imports: bool,
|
|
41
|
+
pub uses_functions: bool,
|
|
42
|
+
pub uses_groups: bool,
|
|
43
|
+
pub uses_automations: bool,
|
|
44
|
+
pub uses_loops: bool,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
|
|
48
|
+
pub struct TelemetryProjectInfoStatsAudio {
|
|
49
|
+
pub avg_bpm: Option<u32>,
|
|
50
|
+
pub has_synths: bool,
|
|
51
|
+
pub has_samples: bool,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
|
|
55
|
+
pub struct TelemetryProjectInfoConfig {
|
|
56
|
+
pub entry_defined: bool,
|
|
57
|
+
pub output_defined: bool,
|
|
58
|
+
pub watch_defined: bool,
|
|
59
|
+
pub repeat_defined: bool,
|
|
60
|
+
pub debug_defined: bool,
|
|
61
|
+
pub compress_defined: bool,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq)]
|
|
65
|
+
pub struct TelemetryEvent {
|
|
66
|
+
pub uuid: String,
|
|
67
|
+
pub cli_version: String,
|
|
68
|
+
pub os: String,
|
|
69
|
+
pub command: Vec<String>,
|
|
70
|
+
pub project_info: Option<TelemetryProjectInfo>,
|
|
71
|
+
pub error_level: TelemetryErrorLevel,
|
|
72
|
+
pub error_message: Option<String>,
|
|
73
|
+
pub exit_code: Option<i32>,
|
|
74
|
+
pub timestamp: String,
|
|
75
|
+
pub duration: u64,
|
|
76
|
+
pub success: bool,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
#[derive(Serialize, Deserialize, Default, Debug)]
|
|
80
|
+
pub struct TelemetrySettings {
|
|
81
|
+
pub uuid: String,
|
|
82
|
+
pub stats: bool,
|
|
83
|
+
pub level: String,
|
|
84
|
+
pub enabled: bool,
|
|
85
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "devalang_utils"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
|
|
6
|
+
[dependencies]
|
|
7
|
+
devalang_types = { path = "../types" }
|
|
8
|
+
serde = { version = "1.0", features = ["derive"] }
|
|
9
|
+
serde_json = "1.0"
|
|
10
|
+
include_dir = "0.7"
|
|
11
|
+
notify = "6.1"
|
|
12
|
+
zip = "4.3.0"
|
|
13
|
+
|
|
14
|
+
[dependencies.crossterm]
|
|
15
|
+
version = "0.27"
|
|
16
|
+
optional = true
|
|
17
|
+
|
|
18
|
+
[dependencies.indicatif]
|
|
19
|
+
version = "0.17"
|
|
20
|
+
optional = true
|
|
21
|
+
|
|
22
|
+
[features]
|
|
23
|
+
cli = ["crossterm", "indicatif"]
|