@ionyx-apps/cli 0.1.9 → 0.2.0

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,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 senin yapılandırdığın "../dist" yolunu kullanıyoruz.
9
+ #[cfg(not(debug_assertions))]
10
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("$CARGO_MANIFEST_DIR/../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
+ }
@@ -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 senin yapılandırdığın "../dist" yolunu kullanıyoruz.
9
+ #[cfg(not(debug_assertions))]
10
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("$CARGO_MANIFEST_DIR/../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
+ }
@@ -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 senin yapılandırdığın "../dist" yolunu kullanıyoruz.
9
+ #[cfg(not(debug_assertions))]
10
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("$CARGO_MANIFEST_DIR/../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
+ }
@@ -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 senin yapılandırdığın "../dist" yolunu kullanıyoruz.
9
+ #[cfg(not(debug_assertions))]
10
+ static EMBEDDED_ASSETS: Dir<'static> = include_dir!("$CARGO_MANIFEST_DIR/../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.0",
4
4
  "description": "Ionyx Framework CLI - High-performance desktop apps with Rust and WebGPU",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",