@ionyx-apps/cli 0.1.9 → 0.2.1

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.
@@ -3,12 +3,14 @@ name = "my-ionyx-app"
3
3
  version = "0.1.0"
4
4
  edition = "2021"
5
5
 
6
+ [workspace]
7
+
6
8
  [[bin]]
7
9
  name = "my-ionyx-app"
8
10
  path = "main.rs"
9
11
 
10
12
  [dependencies]
11
- ionyx = { git = "https://github.com/ionyx-apps/ionyx", branch = "quantum" }
13
+ ionyx = { path = "../../../../../../src-ionyx" }
12
14
  anyhow = "1.0"
13
15
 
14
16
  [profile.release]
@@ -0,0 +1,105 @@
1
+ use std::borrow::Cow;
2
+ use wry::http::{Request, Response, StatusCode};
3
+ use std::path::Path;
4
+
5
+ #[cfg(not(debug_assertions))]
6
+ use include_dir::{include_dir, Dir};
7
+
8
+ // Configuration'dan frontendDist path'ini oku
9
+ fn get_frontend_dist_path() -> String {
10
+ // Önce Ionyx config dosyasını okumaya çalış
11
+ if let Ok(config_content) = std::fs::read_to_string("ionyx.config.toml") {
12
+ for line in config_content.lines() {
13
+ if line.trim().starts_with("frontendDist") {
14
+ if let Some(path) = line.split('=').nth(1) {
15
+ return path.trim().trim_matches('"').to_string();
16
+ }
17
+ }
18
+ }
19
+ }
20
+
21
+ // Varsayılan path
22
+ "../frontend/dist".to_string()
23
+ }
24
+
25
+ // Release modunda frontend/dist içindeki dosyaları binary'ye gömer.
26
+ // Configuration'dan dinamik path okur.
27
+ #[cfg(not(debug_assertions))]
28
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("../frontend/dist");
29
+
30
+ pub struct CustomProtocolHandler;
31
+
32
+ impl CustomProtocolHandler {
33
+ pub fn new() -> Self {
34
+ Self
35
+ }
36
+
37
+ pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
38
+ let path = request.uri().path();
39
+
40
+ // Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
41
+ // WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
42
+ // 404 yerine temiz bir hata dönüyoruz.
43
+ if cfg!(debug_assertions) {
44
+ return Response::builder()
45
+ .status(StatusCode::NOT_FOUND)
46
+ .header("Content-Type", "text/plain")
47
+ .body(Cow::Borrowed(&b"Debug mode: Assets are served from Vite (localhost:5173)"[..]))
48
+ .unwrap();
49
+ }
50
+
51
+ // Release modunda gömülü dosyaları işle
52
+ #[cfg(not(debug_assertions))]
53
+ {
54
+ let clean_path = path.trim_start_matches('/');
55
+ let file_path = if clean_path.is_empty() { "index.html" } else { clean_path };
56
+
57
+ match EMBEDDED_ASSETS.get_file(file_path) {
58
+ Some(file) => {
59
+ let content_type = Self::get_content_type(file_path);
60
+ Response::builder()
61
+ .status(StatusCode::OK)
62
+ .header("Content-Type", content_type)
63
+ .body(Cow::Borrowed(file.contents()))
64
+ .unwrap()
65
+ }
66
+ None => {
67
+ // SPA (Single Page Application) desteği: Dosya bulunamazsa index.html'i dön
68
+ if let Some(index_file) = EMBEDDED_ASSETS.get_file("index.html") {
69
+ Response::builder()
70
+ .status(StatusCode::OK)
71
+ .header("Content-Type", "text/html")
72
+ .body(Cow::Borrowed(index_file.contents()))
73
+ .unwrap()
74
+ } else {
75
+ Response::builder()
76
+ .status(StatusCode::NOT_FOUND)
77
+ .body(Cow::Borrowed(&b"404 Not Found"[..]))
78
+ .unwrap()
79
+ }
80
+ }
81
+ }
82
+ }
83
+
84
+ // Burası teknik olarak unreachable ancak derleyiciyi tatmin etmek için
85
+ #[cfg(debug_assertions)]
86
+ Response::builder().status(StatusCode::NOT_FOUND).body(Cow::Borrowed(&b"Not Found"[..])).unwrap()
87
+ }
88
+
89
+ fn get_content_type(file_path: &str) -> &'static str {
90
+ let path = std::path::Path::new(file_path);
91
+ match path.extension().and_then(|s| s.to_str()) {
92
+ Some("html") => "text/html",
93
+ Some("css") => "text/css",
94
+ Some("js") => "application/javascript",
95
+ Some("json") => "application/json",
96
+ Some("svg") => "image/svg+xml",
97
+ Some("png") => "image/png",
98
+ Some("jpg") | Some("jpeg") => "image/jpeg",
99
+ Some("gif") => "image/gif",
100
+ Some("woff") => "font/woff",
101
+ Some("woff2") => "font/woff2",
102
+ _ => "application/octet-stream",
103
+ }
104
+ }
105
+ }
@@ -3,12 +3,14 @@ name = "my-ionyx-app"
3
3
  version = "0.1.0"
4
4
  edition = "2021"
5
5
 
6
+ [workspace]
7
+
6
8
  [[bin]]
7
9
  name = "my-ionyx-app"
8
10
  path = "main.rs"
9
11
 
10
12
  [dependencies]
11
- ionyx = { git = "https://github.com/ionyx-apps/ionyx", branch = "quantum" }
13
+ ionyx = { path = "../../../../../../src-ionyx" }
12
14
  anyhow = "1.0"
13
15
 
14
16
  [profile.release]
@@ -0,0 +1,105 @@
1
+ use std::borrow::Cow;
2
+ use wry::http::{Request, Response, StatusCode};
3
+ use std::path::Path;
4
+
5
+ #[cfg(not(debug_assertions))]
6
+ use include_dir::{include_dir, Dir};
7
+
8
+ // Configuration'dan frontendDist path'ini oku
9
+ fn get_frontend_dist_path() -> String {
10
+ // Önce Ionyx config dosyasını okumaya çalış
11
+ if let Ok(config_content) = std::fs::read_to_string("ionyx.config.toml") {
12
+ for line in config_content.lines() {
13
+ if line.trim().starts_with("frontendDist") {
14
+ if let Some(path) = line.split('=').nth(1) {
15
+ return path.trim().trim_matches('"').to_string();
16
+ }
17
+ }
18
+ }
19
+ }
20
+
21
+ // Varsayılan path
22
+ "../frontend/dist".to_string()
23
+ }
24
+
25
+ // Release modunda frontend/dist içindeki dosyaları binary'ye gömer.
26
+ // Configuration'dan dinamik path okur.
27
+ #[cfg(not(debug_assertions))]
28
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("../frontend/dist");
29
+
30
+ pub struct CustomProtocolHandler;
31
+
32
+ impl CustomProtocolHandler {
33
+ pub fn new() -> Self {
34
+ Self
35
+ }
36
+
37
+ pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
38
+ let path = request.uri().path();
39
+
40
+ // Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
41
+ // WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
42
+ // 404 yerine temiz bir hata dönüyoruz.
43
+ if cfg!(debug_assertions) {
44
+ return Response::builder()
45
+ .status(StatusCode::NOT_FOUND)
46
+ .header("Content-Type", "text/plain")
47
+ .body(Cow::Borrowed(&b"Debug mode: Assets are served from Vite (localhost:5173)"[..]))
48
+ .unwrap();
49
+ }
50
+
51
+ // Release modunda gömülü dosyaları işle
52
+ #[cfg(not(debug_assertions))]
53
+ {
54
+ let clean_path = path.trim_start_matches('/');
55
+ let file_path = if clean_path.is_empty() { "index.html" } else { clean_path };
56
+
57
+ match EMBEDDED_ASSETS.get_file(file_path) {
58
+ Some(file) => {
59
+ let content_type = Self::get_content_type(file_path);
60
+ Response::builder()
61
+ .status(StatusCode::OK)
62
+ .header("Content-Type", content_type)
63
+ .body(Cow::Borrowed(file.contents()))
64
+ .unwrap()
65
+ }
66
+ None => {
67
+ // SPA (Single Page Application) desteği: Dosya bulunamazsa index.html'i dön
68
+ if let Some(index_file) = EMBEDDED_ASSETS.get_file("index.html") {
69
+ Response::builder()
70
+ .status(StatusCode::OK)
71
+ .header("Content-Type", "text/html")
72
+ .body(Cow::Borrowed(index_file.contents()))
73
+ .unwrap()
74
+ } else {
75
+ Response::builder()
76
+ .status(StatusCode::NOT_FOUND)
77
+ .body(Cow::Borrowed(&b"404 Not Found"[..]))
78
+ .unwrap()
79
+ }
80
+ }
81
+ }
82
+ }
83
+
84
+ // Burası teknik olarak unreachable ancak derleyiciyi tatmin etmek için
85
+ #[cfg(debug_assertions)]
86
+ Response::builder().status(StatusCode::NOT_FOUND).body(Cow::Borrowed(&b"Not Found"[..])).unwrap()
87
+ }
88
+
89
+ fn get_content_type(file_path: &str) -> &'static str {
90
+ let path = std::path::Path::new(file_path);
91
+ match path.extension().and_then(|s| s.to_str()) {
92
+ Some("html") => "text/html",
93
+ Some("css") => "text/css",
94
+ Some("js") => "application/javascript",
95
+ Some("json") => "application/json",
96
+ Some("svg") => "image/svg+xml",
97
+ Some("png") => "image/png",
98
+ Some("jpg") | Some("jpeg") => "image/jpeg",
99
+ Some("gif") => "image/gif",
100
+ Some("woff") => "font/woff",
101
+ Some("woff2") => "font/woff2",
102
+ _ => "application/octet-stream",
103
+ }
104
+ }
105
+ }
@@ -3,12 +3,14 @@ name = "my-ionyx-app"
3
3
  version = "0.1.0"
4
4
  edition = "2021"
5
5
 
6
+ [workspace]
7
+
6
8
  [[bin]]
7
9
  name = "my-ionyx-app"
8
10
  path = "main.rs"
9
11
 
10
12
  [dependencies]
11
- ionyx = { git = "https://github.com/ionyx-apps/ionyx", branch = "quantum" }
13
+ ionyx = { path = "../../../../../../src-ionyx" }
12
14
  anyhow = "1.0"
13
15
 
14
16
  [profile.release]
@@ -0,0 +1,105 @@
1
+ use std::borrow::Cow;
2
+ use wry::http::{Request, Response, StatusCode};
3
+ use std::path::Path;
4
+
5
+ #[cfg(not(debug_assertions))]
6
+ use include_dir::{include_dir, Dir};
7
+
8
+ // Configuration'dan frontendDist path'ini oku
9
+ fn get_frontend_dist_path() -> String {
10
+ // Önce Ionyx config dosyasını okumaya çalış
11
+ if let Ok(config_content) = std::fs::read_to_string("ionyx.config.toml") {
12
+ for line in config_content.lines() {
13
+ if line.trim().starts_with("frontendDist") {
14
+ if let Some(path) = line.split('=').nth(1) {
15
+ return path.trim().trim_matches('"').to_string();
16
+ }
17
+ }
18
+ }
19
+ }
20
+
21
+ // Varsayılan path
22
+ "../frontend/dist".to_string()
23
+ }
24
+
25
+ // Release modunda frontend/dist içindeki dosyaları binary'ye gömer.
26
+ // Configuration'dan dinamik path okur.
27
+ #[cfg(not(debug_assertions))]
28
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("../frontend/dist");
29
+
30
+ pub struct CustomProtocolHandler;
31
+
32
+ impl CustomProtocolHandler {
33
+ pub fn new() -> Self {
34
+ Self
35
+ }
36
+
37
+ pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
38
+ let path = request.uri().path();
39
+
40
+ // Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
41
+ // WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
42
+ // 404 yerine temiz bir hata dönüyoruz.
43
+ if cfg!(debug_assertions) {
44
+ return Response::builder()
45
+ .status(StatusCode::NOT_FOUND)
46
+ .header("Content-Type", "text/plain")
47
+ .body(Cow::Borrowed(&b"Debug mode: Assets are served from Vite (localhost:5173)"[..]))
48
+ .unwrap();
49
+ }
50
+
51
+ // Release modunda gömülü dosyaları işle
52
+ #[cfg(not(debug_assertions))]
53
+ {
54
+ let clean_path = path.trim_start_matches('/');
55
+ let file_path = if clean_path.is_empty() { "index.html" } else { clean_path };
56
+
57
+ match EMBEDDED_ASSETS.get_file(file_path) {
58
+ Some(file) => {
59
+ let content_type = Self::get_content_type(file_path);
60
+ Response::builder()
61
+ .status(StatusCode::OK)
62
+ .header("Content-Type", content_type)
63
+ .body(Cow::Borrowed(file.contents()))
64
+ .unwrap()
65
+ }
66
+ None => {
67
+ // SPA (Single Page Application) desteği: Dosya bulunamazsa index.html'i dön
68
+ if let Some(index_file) = EMBEDDED_ASSETS.get_file("index.html") {
69
+ Response::builder()
70
+ .status(StatusCode::OK)
71
+ .header("Content-Type", "text/html")
72
+ .body(Cow::Borrowed(index_file.contents()))
73
+ .unwrap()
74
+ } else {
75
+ Response::builder()
76
+ .status(StatusCode::NOT_FOUND)
77
+ .body(Cow::Borrowed(&b"404 Not Found"[..]))
78
+ .unwrap()
79
+ }
80
+ }
81
+ }
82
+ }
83
+
84
+ // Burası teknik olarak unreachable ancak derleyiciyi tatmin etmek için
85
+ #[cfg(debug_assertions)]
86
+ Response::builder().status(StatusCode::NOT_FOUND).body(Cow::Borrowed(&b"Not Found"[..])).unwrap()
87
+ }
88
+
89
+ fn get_content_type(file_path: &str) -> &'static str {
90
+ let path = std::path::Path::new(file_path);
91
+ match path.extension().and_then(|s| s.to_str()) {
92
+ Some("html") => "text/html",
93
+ Some("css") => "text/css",
94
+ Some("js") => "application/javascript",
95
+ Some("json") => "application/json",
96
+ Some("svg") => "image/svg+xml",
97
+ Some("png") => "image/png",
98
+ Some("jpg") | Some("jpeg") => "image/jpeg",
99
+ Some("gif") => "image/gif",
100
+ Some("woff") => "font/woff",
101
+ Some("woff2") => "font/woff2",
102
+ _ => "application/octet-stream",
103
+ }
104
+ }
105
+ }
@@ -3,12 +3,14 @@ name = "my-ionyx-app"
3
3
  version = "0.1.0"
4
4
  edition = "2021"
5
5
 
6
+ [workspace]
7
+
6
8
  [[bin]]
7
9
  name = "my-ionyx-app"
8
10
  path = "main.rs"
9
11
 
10
12
  [dependencies]
11
- ionyx = { git = "https://github.com/ionyx-apps/ionyx", branch = "quantum" }
13
+ ionyx = { path = "../../../../../../src-ionyx" }
12
14
  anyhow = "1.0"
13
15
 
14
16
  [profile.release]
@@ -0,0 +1,87 @@
1
+ use std::borrow::Cow;
2
+ use wry::http::{Request, Response, StatusCode};
3
+
4
+ #[cfg(not(debug_assertions))]
5
+ use include_dir::{include_dir, Dir};
6
+
7
+ // Release modunda frontend/dist içindeki dosyaları binary'ye gömer.
8
+ // Path hatasını engellemek için doğru path kullanıyoruz.
9
+ #[cfg(not(debug_assertions))]
10
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("../frontend/dist");
11
+
12
+ pub struct CustomProtocolHandler;
13
+
14
+ impl CustomProtocolHandler {
15
+ pub fn new() -> Self {
16
+ Self
17
+ }
18
+
19
+ pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
20
+ let path = request.uri().path();
21
+
22
+ // Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
23
+ // WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
24
+ // 404 yerine temiz bir hata dönüyoruz.
25
+ if cfg!(debug_assertions) {
26
+ return Response::builder()
27
+ .status(StatusCode::NOT_FOUND)
28
+ .header("Content-Type", "text/plain")
29
+ .body(Cow::Borrowed(&b"Debug mode: Assets are served from Vite (localhost:5173)"[..]))
30
+ .unwrap();
31
+ }
32
+
33
+ // Release modunda gömülü dosyaları işle
34
+ #[cfg(not(debug_assertions))]
35
+ {
36
+ let clean_path = path.trim_start_matches('/');
37
+ let file_path = if clean_path.is_empty() { "index.html" } else { clean_path };
38
+
39
+ match EMBEDDED_ASSETS.get_file(file_path) {
40
+ Some(file) => {
41
+ let content_type = Self::get_content_type(file_path);
42
+ Response::builder()
43
+ .status(StatusCode::OK)
44
+ .header("Content-Type", content_type)
45
+ .body(Cow::Borrowed(file.contents()))
46
+ .unwrap()
47
+ }
48
+ None => {
49
+ // SPA (Single Page Application) desteği: Dosya bulunamazsa index.html'i dön
50
+ if let Some(index_file) = EMBEDDED_ASSETS.get_file("index.html") {
51
+ Response::builder()
52
+ .status(StatusCode::OK)
53
+ .header("Content-Type", "text/html")
54
+ .body(Cow::Borrowed(index_file.contents()))
55
+ .unwrap()
56
+ } else {
57
+ Response::builder()
58
+ .status(StatusCode::NOT_FOUND)
59
+ .body(Cow::Borrowed(&b"404 Not Found"[..]))
60
+ .unwrap()
61
+ }
62
+ }
63
+ }
64
+ }
65
+
66
+ // Burası teknik olarak unreachable ancak derleyiciyi tatmin etmek için
67
+ #[cfg(debug_assertions)]
68
+ Response::builder().status(StatusCode::NOT_FOUND).body(Cow::Borrowed(&b"Not Found"[..])).unwrap()
69
+ }
70
+
71
+ fn get_content_type(file_path: &str) -> &'static str {
72
+ let path = std::path::Path::new(file_path);
73
+ match path.extension().and_then(|s| s.to_str()) {
74
+ Some("html") => "text/html",
75
+ Some("css") => "text/css",
76
+ Some("js") => "application/javascript",
77
+ Some("json") => "application/json",
78
+ Some("svg") => "image/svg+xml",
79
+ Some("png") => "image/png",
80
+ Some("jpg") | Some("jpeg") => "image/jpeg",
81
+ Some("gif") => "image/gif",
82
+ Some("woff") => "font/woff",
83
+ Some("woff2") => "font/woff2",
84
+ _ => "application/octet-stream",
85
+ }
86
+ }
87
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionyx-apps/cli",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "description": "Ionyx Framework CLI - High-performance desktop apps with Rust and WebGPU",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",