Skip to content

Commit 246cd9e

Browse files
1 parent c70e1e5 commit 246cd9e

45 files changed

Lines changed: 1577 additions & 134 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/Rust

Knowledge.dot

Lines changed: 0 additions & 36 deletions
This file was deleted.

Knowledge.svg

Lines changed: 0 additions & 97 deletions
This file was deleted.

Source/Fn/Binary/Command/Entry.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
/// }
3434
/// ```
3535
pub fn Fn(Option { Exclude, Root, Pattern, Separator, .. }:&Option) -> Return {
36+
3637
WalkDir::new(Root)
3738
.follow_links(true)
3839
.into_iter()

Source/Fn/Binary/Command/Parallel.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
/// This function will log errors if it fails to generate summaries or send
3333
/// results.
3434
pub async fn Fn(Option { Entry, Separator, Pattern, .. }:Option) {
35+
3536
let (Allow, mut Mark) = tokio::sync::mpsc::unbounded_channel();
3637

3738
let Queue = futures::stream::FuturesUnordered::new();
@@ -49,6 +50,7 @@ pub async fn Fn(Option { Entry, Separator, Pattern, .. }:Option) {
4950
})
5051
.collect::<Vec<String>>()
5152
{
53+
5254
let Allow = Allow.clone();
5355

5456
Queue.push(tokio::spawn(async move {
@@ -75,13 +77,15 @@ pub async fn Fn(Option { Entry, Separator, Pattern, .. }:Option) {
7577
let mut Output = Vec::new();
7678

7779
while let Some((Entry, Build)) = Mark.recv().await {
80+
7881
Output.push((Entry, Build));
7982
}
8083

8184
crate::Fn::Build::Group::Fn(Output);
8285
}
8386

8487
use futures::stream::StreamExt;
88+
8589
use rayon::iter::{IntoParallelIterator, ParallelIterator};
8690

8791
use crate::Struct::Binary::Command::Entry::Struct as Option;

Source/Fn/Binary/Command/Sequential.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
/// This function will log errors if it fails to generate summaries or send
3333
/// results.
3434
pub async fn Fn(Option { Entry, Pattern, Separator, .. }:Option) {
35+
3536
let Queue = futures::future::join_all(
3637
Entry
3738
.into_iter()

Source/Fn/Build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub async fn Fn(_Entry:&str) -> Result<DashMap<u64, (String, String)>, Box<dyn s
77
}
88

99
pub mod Group {
10+
1011
pub fn Fn(output:Vec<(String, String)>) {
1112
println!("Processed {} files", output.len());
1213
}

Source/Fn/Bundle/Builder.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ use super::{BundleConfig, BundleEntry, BundleMode, BundleResult};
1313
/// Builds bundles from input files
1414
pub struct BundleBuilder {
1515
config:BundleConfig,
16+
1617
/// Cached module graph
1718
module_graph:HashMap<String, Vec<String>>,
19+
1820
/// Processed files
1921
processed:Vec<String>,
2022
}
@@ -36,8 +38,11 @@ impl BundleBuilder {
3638

3739
match self.config.mode {
3840
BundleMode::SingleFile => self.build_single_file(),
41+
3942
BundleMode::Bundle => self.build_bundle(),
43+
4044
BundleMode::Watch => self.build_watch(),
45+
4146
BundleMode::Esbuild => self.build_with_esbuild(),
4247
}
4348
}
@@ -65,6 +70,7 @@ impl BundleBuilder {
6570
.replace(".ts", ".js");
6671

6772
let output_path = Path::new(&self.config.output_dir).join(&output_filename);
73+
6874
std::fs::write(&output_path, &output)?;
6975

7076
bundled_files.push(output_path.to_string_lossy().to_string());
@@ -81,6 +87,7 @@ impl BundleBuilder {
8187
/// Build a bundle from multiple files
8288
fn build_bundle(&mut self) -> anyhow::Result<BundleResult> {
8389
let mut bundled_files = Vec::new();
90+
8491
let mut all_content = String::new();
8592

8693
// Collect paths first to avoid borrow issues
@@ -95,7 +102,9 @@ impl BundleBuilder {
95102

96103
// Compile and collect content
97104
let content = self.compile_file(source_path)?;
105+
98106
all_content.push_str(&content);
107+
99108
all_content.push_str("\n");
100109

101110
bundled_files.push(entry);
@@ -108,6 +117,7 @@ impl BundleBuilder {
108117

109118
// Generate output filename
110119
let output_filename = self.generate_output_filename();
120+
111121
let output_path = Path::new(&self.config.output_dir).join(&output_filename);
112122

113123
// Write bundle
@@ -117,6 +127,7 @@ impl BundleBuilder {
117127
let source_map_path = if self.config.source_map {
118128
let map_path =
119129
Path::new(&self.config.output_dir).join(format!("{}.map", output_filename.replace(".js", "")));
130+
120131
Some(map_path.to_string_lossy().to_string())
121132
} else {
122133
None
@@ -141,6 +152,7 @@ impl BundleBuilder {
141152
fn build_with_esbuild(&mut self) -> anyhow::Result<BundleResult> {
142153
// Import and use the esbuild wrapper
143154
let wrapper = super::ESBuild::EsbuildWrapper::new();
155+
144156
wrapper.build(&self.config)
145157
}
146158

@@ -162,15 +174,20 @@ impl BundleBuilder {
162174

163175
// Extract imports (simplified)
164176
let mut deps = Vec::new();
177+
165178
for line in content.lines() {
166179
let trimmed = line.trim();
180+
167181
if trimmed.starts_with("import ") {
168182
if let Some(from_idx) = trimmed.find("from") {
169183
let path_part = &trimmed[from_idx + 4..];
184+
170185
if let Some(quote_start) = path_part.find('"') {
171186
let path_end = path_part[quote_start + 1..].find('"');
187+
172188
if let Some(end) = path_end {
173189
let import_path = &path_part[quote_start + 1..quote_start + 1 + end];
190+
174191
deps.push(import_path.to_string());
175192
}
176193
}
@@ -198,6 +215,7 @@ impl BundleBuilder {
198215
}
199216

200217
result.push_str(line);
218+
201219
result.push('\n');
202220
}
203221

@@ -239,16 +257,19 @@ impl BundleBuilder {
239257
/// Convenience function to create and build a bundle
240258
pub fn build_bundle(config:BundleConfig) -> anyhow::Result<BundleResult> {
241259
let mut builder = BundleBuilder::new(config);
260+
242261
builder.build()
243262
}
244263

245264
#[cfg(test)]
246265
mod tests {
266+
247267
use super::*;
248268

249269
#[test]
250270
fn test_builder_creation() {
251271
let config = BundleConfig::single_file();
272+
252273
let builder = BundleBuilder::new(config);
253274

254275
assert!(builder.processed.is_empty());
@@ -257,6 +278,7 @@ mod tests {
257278
#[test]
258279
fn test_add_entry() {
259280
let config = BundleConfig::bundle();
281+
260282
let mut builder = BundleBuilder::new(config);
261283

262284
builder.add_entry(BundleEntry::entry("src/index.ts"));
@@ -269,6 +291,7 @@ mod tests {
269291
let config = BundleConfig::bundle().with_output_file("{name}.bundle.js");
270292

271293
let builder = BundleBuilder::new(config);
294+
272295
let filename = builder.generate_output_filename();
273296

274297
assert_eq!(filename, "index.bundle.js");
@@ -279,6 +302,7 @@ mod tests {
279302
let config = BundleConfig::bundle().add_entry("src/index.ts").add_entry("src/util.ts");
280303

281304
let builder = BundleBuilder::new(config);
305+
282306
let hash = builder.compute_hash();
283307

284308
assert!(!hash.is_empty());

0 commit comments

Comments
 (0)