Merge pull request #1807 from ealmloff/assets-optional
Only support manganis in the CLI
This commit is contained in:
20 files changed
+131
-222
No files matched your search
Generated
+37
-40
@@ -64,7 +64,7 @@ version = "0.7.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd"
|
checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.11",
|
"getrandom 0.2.12",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
@@ -77,7 +77,7 @@ checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"const-random",
|
"const-random",
|
||||||
"getrandom 0.2.11",
|
"getrandom 0.2.12",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"version_check",
|
"version_check",
|
||||||
"zerocopy",
|
"zerocopy",
|
||||||
@@ -381,7 +381,7 @@ version = "1.8.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c"
|
checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-lock 3.2.0",
|
"async-lock 3.3.0",
|
||||||
"async-task",
|
"async-task",
|
||||||
"concurrent-queue",
|
"concurrent-queue",
|
||||||
"fastrand 2.0.1",
|
"fastrand 2.0.1",
|
||||||
@@ -427,7 +427,7 @@ version = "2.2.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6afaa937395a620e33dc6a742c593c01aced20aa376ffb0f628121198578ccc7"
|
checksum = "6afaa937395a620e33dc6a742c593c01aced20aa376ffb0f628121198578ccc7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-lock 3.2.0",
|
"async-lock 3.3.0",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"concurrent-queue",
|
"concurrent-queue",
|
||||||
"futures-io",
|
"futures-io",
|
||||||
@@ -451,9 +451,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-lock"
|
name = "async-lock"
|
||||||
version = "3.2.0"
|
version = "3.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c"
|
checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"event-listener 4.0.3",
|
"event-listener 4.0.3",
|
||||||
"event-listener-strategy",
|
"event-listener-strategy",
|
||||||
@@ -1085,7 +1085,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118"
|
checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-channel 2.1.1",
|
"async-channel 2.1.1",
|
||||||
"async-lock 3.2.0",
|
"async-lock 3.3.0",
|
||||||
"async-task",
|
"async-task",
|
||||||
"fastrand 2.0.1",
|
"fastrand 2.0.1",
|
||||||
"futures-io",
|
"futures-io",
|
||||||
@@ -1659,15 +1659,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "console"
|
name = "console"
|
||||||
version = "0.15.7"
|
version = "0.15.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8"
|
checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"encode_unicode",
|
"encode_unicode",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"libc",
|
"libc",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"windows-sys 0.45.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1701,7 +1701,7 @@ version = "0.1.16"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"
|
checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.11",
|
"getrandom 0.2.12",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"tiny-keccak",
|
"tiny-keccak",
|
||||||
]
|
]
|
||||||
@@ -2592,7 +2592,6 @@ dependencies = [
|
|||||||
"futures-util",
|
"futures-util",
|
||||||
"global-hotkey",
|
"global-hotkey",
|
||||||
"infer 0.11.0",
|
"infer 0.11.0",
|
||||||
"manganis-cli-support",
|
|
||||||
"minify-js",
|
"minify-js",
|
||||||
"muda",
|
"muda",
|
||||||
"objc",
|
"objc",
|
||||||
@@ -2672,7 +2671,6 @@ dependencies = [
|
|||||||
"http 0.2.11",
|
"http 0.2.11",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
"hyper 0.14.28",
|
"hyper 0.14.28",
|
||||||
"manganis-cli-support",
|
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"pin-project",
|
"pin-project",
|
||||||
"salvo",
|
"salvo",
|
||||||
@@ -4024,9 +4022,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.2.11"
|
version = "0.2.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
|
checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
@@ -4723,9 +4721,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "h2"
|
name = "h2"
|
||||||
version = "0.3.22"
|
version = "0.3.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178"
|
checksum = "b553656127a00601c8ae5590fcfdc118e4083a7924b6cf4ffc1ea4b99dc429d7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"fnv",
|
"fnv",
|
||||||
@@ -5076,7 +5074,7 @@ dependencies = [
|
|||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"h2 0.3.22",
|
"h2 0.3.23",
|
||||||
"http 0.2.11",
|
"http 0.2.11",
|
||||||
"http-body 0.4.6",
|
"http-body 0.4.6",
|
||||||
"httparse",
|
"httparse",
|
||||||
@@ -5880,9 +5878,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libz-sys"
|
name = "libz-sys"
|
||||||
version = "1.1.13"
|
version = "1.1.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5f526fdd09d99e19742883e43de41e1aa9e36db0c7ab7f935165d611c5cccc66"
|
checksum = "295c17e837573c8c821dbaeb3cceb3d745ad082f7572191409e69cbc1b3fd050"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -6136,7 +6134,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "manganis"
|
name = "manganis"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/DioxusLabs/collect-assets?rev=94ea6f7#94ea6f728b3d135b5160f2c119c6e797049e4b2c"
|
source = "git+https://github.com/DioxusLabs/collect-assets?rev=e0093a4#e0093a47f0fa3bb50c49cd21aee5aa674faa24ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"manganis-macro",
|
"manganis-macro",
|
||||||
]
|
]
|
||||||
@@ -6144,7 +6142,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "manganis-cli-support"
|
name = "manganis-cli-support"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/DioxusLabs/collect-assets?rev=94ea6f7#94ea6f728b3d135b5160f2c119c6e797049e4b2c"
|
source = "git+https://github.com/DioxusLabs/collect-assets?rev=e0093a4#e0093a47f0fa3bb50c49cd21aee5aa674faa24ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cargo-lock 9.0.0",
|
"cargo-lock 9.0.0",
|
||||||
@@ -6170,7 +6168,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "manganis-common"
|
name = "manganis-common"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/DioxusLabs/collect-assets?rev=94ea6f7#94ea6f728b3d135b5160f2c119c6e797049e4b2c"
|
source = "git+https://github.com/DioxusLabs/collect-assets?rev=e0093a4#e0093a47f0fa3bb50c49cd21aee5aa674faa24ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.21.6",
|
"base64 0.21.6",
|
||||||
@@ -6185,7 +6183,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "manganis-macro"
|
name = "manganis-macro"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/DioxusLabs/collect-assets?rev=94ea6f7#94ea6f728b3d135b5160f2c119c6e797049e4b2c"
|
source = "git+https://github.com/DioxusLabs/collect-assets?rev=e0093a4#e0093a47f0fa3bb50c49cd21aee5aa674faa24ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.21.6",
|
"base64 0.21.6",
|
||||||
"manganis-cli-support",
|
"manganis-cli-support",
|
||||||
@@ -6822,7 +6820,7 @@ checksum = "c38841cdd844847e3e7c8d29cef9dcfed8877f8f56f9071f77843ecf3baf937f"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.13.1",
|
"base64 0.13.1",
|
||||||
"chrono",
|
"chrono",
|
||||||
"getrandom 0.2.11",
|
"getrandom 0.2.12",
|
||||||
"http 0.2.11",
|
"http 0.2.11",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
@@ -8014,7 +8012,7 @@ version = "0.6.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.11",
|
"getrandom 0.2.12",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8102,9 +8100,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rav1e"
|
name = "rav1e"
|
||||||
version = "0.7.0"
|
version = "0.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5eb0e0ea87a360ae76a935bd99cd5940006d8e13811e3d1a6994a93823eab5b1"
|
checksum = "cd87ce80a7665b1cce111f8a16c1f3929f6547ce91ade6addf4ec86a8dda5ce9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arbitrary 1.3.2",
|
"arbitrary 1.3.2",
|
||||||
"arg_enum_proc_macro",
|
"arg_enum_proc_macro",
|
||||||
@@ -8130,7 +8128,6 @@ dependencies = [
|
|||||||
"profiling",
|
"profiling",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"rand_chacha 0.3.1",
|
"rand_chacha 0.3.1",
|
||||||
"rustc_version",
|
|
||||||
"simd_helpers",
|
"simd_helpers",
|
||||||
"system-deps",
|
"system-deps",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
@@ -8148,7 +8145,7 @@ dependencies = [
|
|||||||
"loop9",
|
"loop9",
|
||||||
"quick-error 2.0.1",
|
"quick-error 2.0.1",
|
||||||
"rav1e 0.6.6",
|
"rav1e 0.6.6",
|
||||||
"rav1e 0.7.0",
|
"rav1e 0.7.1",
|
||||||
"rayon",
|
"rayon",
|
||||||
"rgb",
|
"rgb",
|
||||||
]
|
]
|
||||||
@@ -8200,7 +8197,7 @@ version = "0.4.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4"
|
checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.11",
|
"getrandom 0.2.12",
|
||||||
"libredox",
|
"libredox",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
@@ -8305,7 +8302,7 @@ dependencies = [
|
|||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"h2 0.3.22",
|
"h2 0.3.23",
|
||||||
"http 0.2.11",
|
"http 0.2.11",
|
||||||
"http-body 0.4.6",
|
"http-body 0.4.6",
|
||||||
"hyper 0.14.28",
|
"hyper 0.14.28",
|
||||||
@@ -8441,7 +8438,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74"
|
checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"getrandom 0.2.11",
|
"getrandom 0.2.12",
|
||||||
"libc",
|
"libc",
|
||||||
"spin 0.9.8",
|
"spin 0.9.8",
|
||||||
"untrusted 0.9.0",
|
"untrusted 0.9.0",
|
||||||
@@ -10327,9 +10324,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "termcolor"
|
name = "termcolor"
|
||||||
version = "1.4.0"
|
version = "1.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449"
|
checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"winapi-util",
|
"winapi-util",
|
||||||
]
|
]
|
||||||
@@ -11165,7 +11162,7 @@ version = "1.6.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560"
|
checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.11",
|
"getrandom 0.2.12",
|
||||||
"serde",
|
"serde",
|
||||||
"sha1_smol",
|
"sha1_smol",
|
||||||
]
|
]
|
||||||
@@ -11191,9 +11188,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "value-bag"
|
name = "value-bag"
|
||||||
version = "1.5.0"
|
version = "1.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dd65ff0de3304a013e6dfeb7324e1cd389a8a000e582e3c9c9fae82ced778e26"
|
checksum = "7cdbaf5e132e593e9fc1de6a15bbec912395b11fb9719e061cf64f804524c503"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vcpkg"
|
name = "vcpkg"
|
||||||
@@ -11992,9 +11989,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "0.5.33"
|
version = "0.5.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b7520bbdec7211caa7c4e682eb1fbe07abe20cee6756b6e00f537c82c11816aa"
|
checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|||||||
+2
-3
@@ -98,12 +98,11 @@ thiserror = "1.0.40"
|
|||||||
prettyplease = { package = "prettier-please", version = "0.2", features = [
|
prettyplease = { package = "prettier-please", version = "0.2", features = [
|
||||||
"verbatim",
|
"verbatim",
|
||||||
] }
|
] }
|
||||||
manganis-cli-support = { git = "https://github.com/DioxusLabs/collect-assets", rev = "94ea6f7", features = [
|
manganis-cli-support = { git = "https://github.com/DioxusLabs/collect-assets", rev = "e0093a4", features = [
|
||||||
"webp",
|
"webp",
|
||||||
"html",
|
"html",
|
||||||
] }
|
] }
|
||||||
manganis = { git = "https://github.com/DioxusLabs/collect-assets", rev = "94ea6f7" }
|
manganis = { git = "https://github.com/DioxusLabs/collect-assets", rev = "e0093a4" }
|
||||||
|
|
||||||
|
|
||||||
# This is a "virtual package"
|
# This is a "virtual package"
|
||||||
# It is not meant to be published, but is used so "cargo run --example XYZ" works properly
|
# It is not meant to be published, but is used so "cargo run --example XYZ" works properly
|
||||||
|
|||||||
@@ -12,17 +12,14 @@ pub fn asset_manifest(crate_config: &CrateConfig) -> AssetManifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Create a head file that contains all of the imports for assets that the user project uses
|
/// Create a head file that contains all of the imports for assets that the user project uses
|
||||||
pub fn create_assets_head(config: &CrateConfig) -> Result<()> {
|
pub fn create_assets_head(config: &CrateConfig, manifest: &AssetManifest) -> Result<()> {
|
||||||
let manifest = asset_manifest(config);
|
|
||||||
let mut file = File::create(config.out_dir.join("__assets_head.html"))?;
|
let mut file = File::create(config.out_dir.join("__assets_head.html"))?;
|
||||||
file.write_all(manifest.head().as_bytes())?;
|
file.write_all(manifest.head().as_bytes())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Process any assets collected from the binary
|
/// Process any assets collected from the binary
|
||||||
pub(crate) fn process_assets(config: &CrateConfig) -> anyhow::Result<()> {
|
pub(crate) fn process_assets(config: &CrateConfig, manifest: &AssetManifest) -> anyhow::Result<()> {
|
||||||
let manifest = asset_manifest(config);
|
|
||||||
|
|
||||||
let static_asset_output_dir = PathBuf::from(
|
let static_asset_output_dir = PathBuf::from(
|
||||||
config
|
config
|
||||||
.dioxus_config
|
.dioxus_config
|
||||||
|
|||||||
+25
-13
@@ -9,7 +9,7 @@ use dioxus_cli_config::CrateConfig;
|
|||||||
use dioxus_cli_config::ExecutableType;
|
use dioxus_cli_config::ExecutableType;
|
||||||
use indicatif::{ProgressBar, ProgressStyle};
|
use indicatif::{ProgressBar, ProgressStyle};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use serde::Serialize;
|
use manganis_cli_support::{AssetManifest, ManganisSupportGuard};
|
||||||
use std::{
|
use std::{
|
||||||
fs::{copy, create_dir_all, File},
|
fs::{copy, create_dir_all, File},
|
||||||
io::Read,
|
io::Read,
|
||||||
@@ -23,10 +23,11 @@ lazy_static! {
|
|||||||
static ref PROGRESS_BARS: indicatif::MultiProgress = indicatif::MultiProgress::new();
|
static ref PROGRESS_BARS: indicatif::MultiProgress = indicatif::MultiProgress::new();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct BuildResult {
|
pub struct BuildResult {
|
||||||
pub warnings: Vec<Diagnostic>,
|
pub warnings: Vec<Diagnostic>,
|
||||||
pub elapsed_time: u128,
|
pub elapsed_time: u128,
|
||||||
|
pub assets: Option<AssetManifest>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build(config: &CrateConfig, _: bool, skip_assets: bool) -> Result<BuildResult> {
|
pub fn build(config: &CrateConfig, _: bool, skip_assets: bool) -> Result<BuildResult> {
|
||||||
@@ -47,7 +48,8 @@ pub fn build(config: &CrateConfig, _: bool, skip_assets: bool) -> Result<BuildRe
|
|||||||
..
|
..
|
||||||
} = config;
|
} = config;
|
||||||
|
|
||||||
let _gaurd = WebAssetConfigDropGuard::new();
|
let _guard = WebAssetConfigDropGuard::new();
|
||||||
|
let _manganis_support = ManganisSupportGuard::default();
|
||||||
|
|
||||||
// start to build the assets
|
// start to build the assets
|
||||||
let ignore_files = build_assets(config)?;
|
let ignore_files = build_assets(config)?;
|
||||||
@@ -261,13 +263,18 @@ pub fn build(config: &CrateConfig, _: bool, skip_assets: bool) -> Result<BuildRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !skip_assets {
|
let assets = if !skip_assets {
|
||||||
process_assets(config)?;
|
let assets = asset_manifest(config);
|
||||||
}
|
process_assets(config, &assets)?;
|
||||||
|
Some(assets)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
Ok(BuildResult {
|
Ok(BuildResult {
|
||||||
warnings: warning_messages,
|
warnings: warning_messages,
|
||||||
elapsed_time: t_start.elapsed().as_millis(),
|
elapsed_time: t_start.elapsed().as_millis(),
|
||||||
|
assets,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,6 +288,7 @@ pub fn build_desktop(
|
|||||||
let t_start = std::time::Instant::now();
|
let t_start = std::time::Instant::now();
|
||||||
let ignore_files = build_assets(config)?;
|
let ignore_files = build_assets(config)?;
|
||||||
let _guard = dioxus_cli_config::__private::save_config(config);
|
let _guard = dioxus_cli_config::__private::save_config(config);
|
||||||
|
let _manganis_support = ManganisSupportGuard::default();
|
||||||
|
|
||||||
let mut cmd = subprocess::Exec::cmd("cargo")
|
let mut cmd = subprocess::Exec::cmd("cargo")
|
||||||
.env("CARGO_TARGET_DIR", &config.target_dir)
|
.env("CARGO_TARGET_DIR", &config.target_dir)
|
||||||
@@ -394,12 +402,16 @@ pub fn build_desktop(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !skip_assets {
|
let assets = if !skip_assets {
|
||||||
|
let assets = asset_manifest(config);
|
||||||
// Collect assets
|
// Collect assets
|
||||||
process_assets(config)?;
|
process_assets(config, &assets)?;
|
||||||
// Create the __assets_head.html file for bundling
|
// Create the __assets_head.html file for bundling
|
||||||
create_assets_head(config)?;
|
create_assets_head(config, &assets)?;
|
||||||
}
|
Some(assets)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
log::info!(
|
log::info!(
|
||||||
"🚩 Build completed: [./{}]",
|
"🚩 Build completed: [./{}]",
|
||||||
@@ -411,6 +423,7 @@ pub fn build_desktop(
|
|||||||
Ok(BuildResult {
|
Ok(BuildResult {
|
||||||
warnings: warning_messages,
|
warnings: warning_messages,
|
||||||
elapsed_time: t_start.elapsed().as_millis(),
|
elapsed_time: t_start.elapsed().as_millis(),
|
||||||
|
assets,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,7 +483,7 @@ fn prettier_build(cmd: subprocess::Exec) -> anyhow::Result<Vec<Diagnostic>> {
|
|||||||
Ok(warning_messages)
|
Ok(warning_messages)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn gen_page(config: &CrateConfig, serve: bool, skip_assets: bool) -> String {
|
pub fn gen_page(config: &CrateConfig, manifest: Option<&AssetManifest>, serve: bool) -> String {
|
||||||
let _gaurd = WebAssetConfigDropGuard::new();
|
let _gaurd = WebAssetConfigDropGuard::new();
|
||||||
|
|
||||||
let crate_root = crate_root().unwrap();
|
let crate_root = crate_root().unwrap();
|
||||||
@@ -515,8 +528,7 @@ pub fn gen_page(config: &CrateConfig, serve: bool, skip_assets: bool) -> String
|
|||||||
{
|
{
|
||||||
style_str.push_str("<link rel=\"stylesheet\" href=\"/{base_path}/tailwind.css\">\n");
|
style_str.push_str("<link rel=\"stylesheet\" href=\"/{base_path}/tailwind.css\">\n");
|
||||||
}
|
}
|
||||||
if !skip_assets {
|
if let Some(manifest) = manifest {
|
||||||
let manifest = asset_manifest(config);
|
|
||||||
style_str.push_str(&manifest.head());
|
style_str.push_str(&manifest.head());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,12 +52,10 @@ impl Build {
|
|||||||
// #[cfg(feature = "plugin")]
|
// #[cfg(feature = "plugin")]
|
||||||
// let _ = PluginManager::on_build_start(&crate_config, &platform);
|
// let _ = PluginManager::on_build_start(&crate_config, &platform);
|
||||||
|
|
||||||
match platform {
|
let build_result = match platform {
|
||||||
Platform::Web => {
|
Platform::Web => crate::builder::build(&crate_config, false, self.build.skip_assets)?,
|
||||||
crate::builder::build(&crate_config, false, self.build.skip_assets)?;
|
|
||||||
}
|
|
||||||
Platform::Desktop => {
|
Platform::Desktop => {
|
||||||
crate::builder::build_desktop(&crate_config, false, self.build.skip_assets)?;
|
crate::builder::build_desktop(&crate_config, false, self.build.skip_assets)?
|
||||||
}
|
}
|
||||||
Platform::Fullstack => {
|
Platform::Fullstack => {
|
||||||
// Fullstack mode must be built with web configs on the desktop (server) binary as well as the web binary
|
// Fullstack mode must be built with web configs on the desktop (server) binary as well as the web binary
|
||||||
@@ -87,12 +85,12 @@ impl Build {
|
|||||||
};
|
};
|
||||||
let _gaurd =
|
let _gaurd =
|
||||||
FullstackServerEnvGuard::new(self.build.force_debug, self.build.release);
|
FullstackServerEnvGuard::new(self.build.force_debug, self.build.release);
|
||||||
crate::builder::build_desktop(&desktop_config, false, self.build.skip_assets)?;
|
crate::builder::build_desktop(&desktop_config, false, self.build.skip_assets)?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
let temp = gen_page(&crate_config, false, self.build.skip_assets);
|
let temp = gen_page(&crate_config, build_result.assets.as_ref(), false);
|
||||||
|
|
||||||
let mut file = std::fs::File::create(
|
let mut file = std::fs::File::create(
|
||||||
crate_config
|
crate_config
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use dioxus_cli_config::Platform;
|
use dioxus_cli_config::Platform;
|
||||||
|
use manganis_cli_support::AssetManifest;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::{fs::create_dir_all, io::Write, path::PathBuf};
|
use std::{fs::create_dir_all, io::Write, path::PathBuf};
|
||||||
@@ -47,9 +48,6 @@ impl Serve {
|
|||||||
|
|
||||||
match platform {
|
match platform {
|
||||||
Platform::Web => {
|
Platform::Web => {
|
||||||
// generate dev-index page
|
|
||||||
Serve::regen_dev_page(&crate_config, self.serve.skip_assets)?;
|
|
||||||
|
|
||||||
// start the develop server
|
// start the develop server
|
||||||
server::web::startup(
|
server::web::startup(
|
||||||
self.serve.port,
|
self.serve.port,
|
||||||
@@ -69,8 +67,11 @@ impl Serve {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn regen_dev_page(crate_config: &CrateConfig, skip_assets: bool) -> Result<()> {
|
pub fn regen_dev_page(
|
||||||
let serve_html = gen_page(crate_config, true, skip_assets);
|
crate_config: &CrateConfig,
|
||||||
|
manifest: Option<&AssetManifest>,
|
||||||
|
) -> anyhow::Result<()> {
|
||||||
|
let serve_html = gen_page(crate_config, manifest, true);
|
||||||
|
|
||||||
let dist_path = crate_config
|
let dist_path = crate_config
|
||||||
.crate_dir
|
.crate_dir
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
let _dioxus_config = DioxusConfig::load(Some(bin.clone()))
|
let _dioxus_config = DioxusConfig::load(Some(bin.clone()))
|
||||||
.map_err(|e| anyhow!("Failed to load Dioxus config because: {e}"))?
|
.map_err(|e| anyhow!("Failed to load Dioxus config because: {e}"))?
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
log::warn!("You appear to be creating a Dioxus project from scratch; we will use the default config");
|
log::info!("You appear to be creating a Dioxus project from scratch; we will use the default config");
|
||||||
DioxusConfig::default()
|
DioxusConfig::default()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,9 @@ pub async fn serve(
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let first_build_result = crate::builder::build(&config, false, skip_assets)?;
|
let first_build_result = crate::builder::build(&config, false, skip_assets)?;
|
||||||
|
|
||||||
|
// generate dev-index page
|
||||||
|
Serve::regen_dev_page(&config, first_build_result.assets.as_ref())?;
|
||||||
|
|
||||||
log::info!("🚀 Starting development server...");
|
log::info!("🚀 Starting development server...");
|
||||||
|
|
||||||
// WS Reload Watching
|
// WS Reload Watching
|
||||||
@@ -448,7 +451,7 @@ fn build(config: &CrateConfig, reload_tx: &Sender<()>, skip_assets: bool) -> Res
|
|||||||
// change the websocket reload state to true;
|
// change the websocket reload state to true;
|
||||||
// the page will auto-reload.
|
// the page will auto-reload.
|
||||||
if config.dioxus_config.web.watcher.reload_html {
|
if config.dioxus_config.web.watcher.reload_html {
|
||||||
let _ = Serve::regen_dev_page(config, skip_assets);
|
let _ = Serve::regen_dev_page(config, result.assets.as_ref());
|
||||||
}
|
}
|
||||||
let _ = reload_tx.send(());
|
let _ = reload_tx.send(());
|
||||||
Ok(result)
|
Ok(result)
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ crossbeam-channel = "0.5.8"
|
|||||||
tao = { version = "0.24.0", features = ["rwh_05"] }
|
tao = { version = "0.24.0", features = ["rwh_05"] }
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "windows",target_os = "macos",target_os = "linux",target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))'.dependencies]
|
[target.'cfg(any(target_os = "windows",target_os = "macos",target_os = "linux",target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))'.dependencies]
|
||||||
# This is only for debug mode, and it appears mobile does not support some packages this uses
|
|
||||||
manganis-cli-support = { workspace = true, optional = true, features = ["webp", "html"] }
|
|
||||||
rfd = "0.12"
|
rfd = "0.12"
|
||||||
global-hotkey = "0.4.1"
|
global-hotkey = "0.4.1"
|
||||||
muda = "0.11.3"
|
muda = "0.11.3"
|
||||||
@@ -73,7 +71,6 @@ fullscreen = ["wry/fullscreen"]
|
|||||||
transparent = ["wry/transparent"]
|
transparent = ["wry/transparent"]
|
||||||
devtools = ["wry/devtools"]
|
devtools = ["wry/devtools"]
|
||||||
hot-reload = ["dioxus-hot-reload"]
|
hot-reload = ["dioxus-hot-reload"]
|
||||||
collect-assets = ["manganis-cli-support"]
|
|
||||||
gnu = []
|
gnu = []
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
|
|||||||
@@ -81,11 +81,6 @@ impl<P: 'static> App<P> {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Copy over any assets we find
|
|
||||||
// todo - re-enable this when we have a faster way of copying assets
|
|
||||||
#[cfg(feature = "collect-assets")]
|
|
||||||
crate::collect_assets::copy_assets();
|
|
||||||
|
|
||||||
// Set the event converter
|
// Set the event converter
|
||||||
dioxus_html::set_event_converter(Box::new(crate::events::SerializedHtmlEventConverter));
|
dioxus_html::set_event_converter(Box::new(crate::events::SerializedHtmlEventConverter));
|
||||||
|
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
pub fn copy_assets() {
|
|
||||||
#[cfg(all(
|
|
||||||
debug_assertions,
|
|
||||||
any(
|
|
||||||
target_os = "windows",
|
|
||||||
target_os = "macos",
|
|
||||||
target_os = "linux",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
target_os = "openbsd"
|
|
||||||
)
|
|
||||||
))]
|
|
||||||
{
|
|
||||||
// The CLI will copy assets to the current working directory
|
|
||||||
if std::env::var_os("DIOXUS_ACTIVE").is_some() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
use manganis_cli_support::AssetManifest;
|
|
||||||
use manganis_cli_support::AssetManifestExt;
|
|
||||||
use manganis_cli_support::Config;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
let config = Config::current();
|
|
||||||
let asset_location = config.assets_serve_location();
|
|
||||||
let asset_location = PathBuf::from(asset_location);
|
|
||||||
let _ = std::fs::remove_dir_all(&asset_location);
|
|
||||||
|
|
||||||
println!("Finding assets... (Note: if you run a dioxus desktop application with the CLI. This process will be significantly faster.)");
|
|
||||||
let manifest = AssetManifest::load();
|
|
||||||
let has_assets = manifest
|
|
||||||
.packages()
|
|
||||||
.iter()
|
|
||||||
.any(|package| !package.assets().is_empty());
|
|
||||||
|
|
||||||
if has_assets {
|
|
||||||
println!("Copying and optimizing assets...");
|
|
||||||
manifest.copy_static_assets_to(&asset_location).unwrap();
|
|
||||||
println!("Copied assets to {}", asset_location.display());
|
|
||||||
} else {
|
|
||||||
println!("No assets found");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[cfg(not(all(
|
|
||||||
debug_assertions,
|
|
||||||
any(
|
|
||||||
target_os = "windows",
|
|
||||||
target_os = "macos",
|
|
||||||
target_os = "linux",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
target_os = "openbsd"
|
|
||||||
)
|
|
||||||
)))]
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Skipping assets in release mode. You compile assets with the dioxus-cli in release mode"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,9 +22,6 @@ mod shortcut;
|
|||||||
mod waker;
|
mod waker;
|
||||||
mod webview;
|
mod webview;
|
||||||
|
|
||||||
#[cfg(feature = "collect-assets")]
|
|
||||||
mod collect_assets;
|
|
||||||
|
|
||||||
// mobile shortcut is only supported on mobile platforms
|
// mobile shortcut is only supported on mobile platforms
|
||||||
#[cfg(any(target_os = "ios", target_os = "android"))]
|
#[cfg(any(target_os = "ios", target_os = "android"))]
|
||||||
mod mobile_shortcut;
|
mod mobile_shortcut;
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ fn module_loader(root_id: &str, headless: bool) -> String {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the assset directory, following tauri/cargo-bundles directory discovery approach
|
/// Get the asset directory, following tauri/cargo-bundles directory discovery approach
|
||||||
///
|
///
|
||||||
/// Defaults to the current directory if no asset directory is found, which is useful for development when the app
|
/// Defaults to the current directory if no asset directory is found, which is useful for development when the app
|
||||||
/// isn't bundled.
|
/// isn't bundled.
|
||||||
|
|||||||
@@ -67,9 +67,6 @@ dioxus-hot-reload = { workspace = true }
|
|||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
web-sys = { version = "0.3.61", features = ["Window", "Document", "Element", "HtmlDocument", "Storage", "console"] }
|
web-sys = { version = "0.3.61", features = ["Window", "Document", "Element", "HtmlDocument", "Storage", "console"] }
|
||||||
|
|
||||||
[target.'cfg(any(target_os = "windows",target_os = "macos",target_os = "linux",target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))'.dependencies]
|
|
||||||
# This is only for debug mode, and it appears mobile does not support some packages this uses
|
|
||||||
manganis-cli-support = { workspace = true, features = ["webp", "html"] }
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["hot-reload"]
|
default = ["hot-reload"]
|
||||||
|
|||||||
Vendored
+47
@@ -0,0 +1,47 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>dioxus | ⛺</title>
|
||||||
|
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="main"></div>
|
||||||
|
<script type="module">
|
||||||
|
import init from "/./assets/dioxus/name.js";
|
||||||
|
init("/./assets/dioxus/name_bg.wasm").then(wasm => {
|
||||||
|
if (wasm.__wbindgen_start == undefined) {
|
||||||
|
wasm.main();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html><script>// Dioxus-CLI
|
||||||
|
// https://github.com/DioxusLabs/dioxus/tree/master/packages/cli
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
var protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||||
|
var url = protocol + '//' + window.location.host + '/_dioxus/ws';
|
||||||
|
var poll_interval = 8080;
|
||||||
|
var reload_upon_connect = () => {
|
||||||
|
window.setTimeout(
|
||||||
|
() => {
|
||||||
|
var ws = new WebSocket(url);
|
||||||
|
ws.onopen = () => window.location.reload();
|
||||||
|
ws.onclose = reload_upon_connect;
|
||||||
|
},
|
||||||
|
poll_interval);
|
||||||
|
};
|
||||||
|
|
||||||
|
var ws = new WebSocket(url);
|
||||||
|
ws.onmessage = (ev) => {
|
||||||
|
if (ev.data == "reload") {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ws.onclose = reload_upon_connect;
|
||||||
|
})()
|
||||||
|
</script>
|
||||||
@@ -276,9 +276,6 @@ where
|
|||||||
fn serve_static_assets(mut self, assets_path: impl Into<std::path::PathBuf>) -> Self {
|
fn serve_static_assets(mut self, assets_path: impl Into<std::path::PathBuf>) -> Self {
|
||||||
use tower_http::services::{ServeDir, ServeFile};
|
use tower_http::services::{ServeDir, ServeFile};
|
||||||
|
|
||||||
// Copy over any assets we find
|
|
||||||
crate::collect_assets::copy_assets();
|
|
||||||
|
|
||||||
let assets_path = assets_path.into();
|
let assets_path = assets_path.into();
|
||||||
|
|
||||||
// Serve all files in dist folder except index.html
|
// Serve all files in dist folder except index.html
|
||||||
|
|||||||
@@ -241,9 +241,6 @@ impl DioxusRouterExt for Router {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn serve_static_assets(mut self, assets_path: impl Into<std::path::PathBuf>) -> Self {
|
fn serve_static_assets(mut self, assets_path: impl Into<std::path::PathBuf>) -> Self {
|
||||||
// Copy over any assets we find
|
|
||||||
crate::collect_assets::copy_assets();
|
|
||||||
|
|
||||||
let assets_path = assets_path.into();
|
let assets_path = assets_path.into();
|
||||||
|
|
||||||
// Serve all files in dist folder except index.html
|
// Serve all files in dist folder except index.html
|
||||||
|
|||||||
@@ -187,9 +187,6 @@ pub fn serve_dioxus_application<P: Clone + serde::Serialize + Send + Sync + 'sta
|
|||||||
// Serve the dist folder and the index.html file
|
// Serve the dist folder and the index.html file
|
||||||
let serve_dir = warp::fs::dir(cfg.assets_path);
|
let serve_dir = warp::fs::dir(cfg.assets_path);
|
||||||
|
|
||||||
// Copy over any assets we find
|
|
||||||
crate::collect_assets::copy_assets();
|
|
||||||
|
|
||||||
connect_hot_reload()
|
connect_hot_reload()
|
||||||
// First register the server functions
|
// First register the server functions
|
||||||
.or(register_server_fns(server_fn_route))
|
.or(register_server_fns(server_fn_route))
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
#[cfg(any(feature = "axum", feature = "warp", feature = "salvo"))]
|
|
||||||
pub fn copy_assets() {
|
|
||||||
#[cfg(all(
|
|
||||||
debug_assertions,
|
|
||||||
any(
|
|
||||||
target_os = "windows",
|
|
||||||
target_os = "macos",
|
|
||||||
target_os = "linux",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
target_os = "openbsd"
|
|
||||||
)
|
|
||||||
))]
|
|
||||||
{
|
|
||||||
// The CLI will copy assets to the current working directory
|
|
||||||
if std::env::var_os("DIOXUS_ACTIVE").is_some() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
use manganis_cli_support::AssetManifest;
|
|
||||||
use manganis_cli_support::AssetManifestExt;
|
|
||||||
use manganis_cli_support::Config;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
let config = Config::current();
|
|
||||||
let asset_location = config.assets_serve_location();
|
|
||||||
let asset_location = PathBuf::from(asset_location);
|
|
||||||
let _ = std::fs::remove_dir_all(&asset_location);
|
|
||||||
|
|
||||||
println!("Finding assets... (Note: if you run a dioxus desktop application with the CLI. This process will be significantly faster.)");
|
|
||||||
let manifest = AssetManifest::load();
|
|
||||||
let has_assets = manifest
|
|
||||||
.packages()
|
|
||||||
.iter()
|
|
||||||
.any(|package| !package.assets().is_empty());
|
|
||||||
|
|
||||||
if has_assets {
|
|
||||||
println!("Copying and optimizing assets...");
|
|
||||||
manifest.copy_static_assets_to(&asset_location).unwrap();
|
|
||||||
println!("Copied assets to {}", asset_location.display());
|
|
||||||
} else {
|
|
||||||
println!("No assets found");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[cfg(not(all(
|
|
||||||
debug_assertions,
|
|
||||||
any(
|
|
||||||
target_os = "windows",
|
|
||||||
target_os = "macos",
|
|
||||||
target_os = "linux",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
target_os = "openbsd"
|
|
||||||
)
|
|
||||||
)))]
|
|
||||||
{
|
|
||||||
println!(
|
|
||||||
"Skipping assets in release mode. You compile assets with the dioxus-cli in release mode"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,6 @@ pub mod router;
|
|||||||
mod adapters;
|
mod adapters;
|
||||||
#[cfg(feature = "ssr")]
|
#[cfg(feature = "ssr")]
|
||||||
pub use adapters::*;
|
pub use adapters::*;
|
||||||
mod collect_assets;
|
|
||||||
mod hooks;
|
mod hooks;
|
||||||
#[cfg(all(debug_assertions, feature = "hot-reload", feature = "ssr"))]
|
#[cfg(all(debug_assertions, feature = "hot-reload", feature = "ssr"))]
|
||||||
mod hot_reload;
|
mod hot_reload;
|
||||||
|
|||||||
Reference in new issue
Block a user