web: Make serde (more-)optional in core
This commit is contained in:
parent
7eef31046b
commit
c9b111996f
|
@ -39,7 +39,7 @@ chrono = { workspace = true, features = ["clock"] }
|
||||||
web-time = "1.1.0"
|
web-time = "1.1.0"
|
||||||
encoding_rs = "0.8.34"
|
encoding_rs = "0.8.34"
|
||||||
rand = { version = "0.8.5", features = ["std", "small_rng"], default-features = false }
|
rand = { version = "0.8.5", features = ["std", "small_rng"], default-features = false }
|
||||||
serde = { workspace = true, features = ["derive"] }
|
serde = { workspace = true }
|
||||||
serde_json = { version = "1.0", features = ["preserve_order"] }
|
serde_json = { version = "1.0", features = ["preserve_order"] }
|
||||||
nellymoser-rs = { git = "https://github.com/ruffle-rs/nellymoser", rev = "754b1184037aa9952a907107284fb73897e26adc", optional = true }
|
nellymoser-rs = { git = "https://github.com/ruffle-rs/nellymoser", rev = "754b1184037aa9952a907107284fb73897e26adc", optional = true }
|
||||||
regress = "0.10"
|
regress = "0.10"
|
||||||
|
@ -83,12 +83,13 @@ timeline_debug = []
|
||||||
mp3 = ["symphonia"]
|
mp3 = ["symphonia"]
|
||||||
nellymoser = ["nellymoser-rs"]
|
nellymoser = ["nellymoser-rs"]
|
||||||
audio = ["dasp"]
|
audio = ["dasp"]
|
||||||
known_stubs = ["linkme"]
|
known_stubs = ["linkme", "serde"]
|
||||||
default_compatibility_rules = []
|
default_compatibility_rules = []
|
||||||
egui = ["dep:egui", "dep:egui_extras", "png"]
|
egui = ["dep:egui", "dep:egui_extras", "png"]
|
||||||
jpegxr = ["dep:jpegxr", "lzma"]
|
jpegxr = ["dep:jpegxr", "lzma"]
|
||||||
default_font = []
|
default_font = []
|
||||||
test_only_as3 = []
|
test_only_as3 = []
|
||||||
|
serde = ["serde/derive"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
build_playerglobal = { path = "build_playerglobal" }
|
build_playerglobal = { path = "build_playerglobal" }
|
||||||
|
|
|
@ -5,7 +5,6 @@ use crate::socket::{ConnectionState, SocketAction, SocketHandle};
|
||||||
use crate::string::WStr;
|
use crate::string::WStr;
|
||||||
use async_channel::{Receiver, Sender};
|
use async_channel::{Receiver, Sender};
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
@ -57,18 +56,19 @@ pub enum SocketMode {
|
||||||
|
|
||||||
/// The handling mode of links opening a new website.
|
/// The handling mode of links opening a new website.
|
||||||
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum OpenURLMode {
|
pub enum OpenURLMode {
|
||||||
/// Allow all links to open a new website.
|
/// Allow all links to open a new website.
|
||||||
#[serde(rename = "allow")]
|
#[cfg_attr(feature = "serde", serde(rename = "allow"))]
|
||||||
Allow,
|
Allow,
|
||||||
|
|
||||||
/// A confirmation dialog opens with every link trying to open a new website.
|
/// A confirmation dialog opens with every link trying to open a new website.
|
||||||
#[serde(rename = "confirm")]
|
#[cfg_attr(feature = "serde", serde(rename = "confirm"))]
|
||||||
Confirm,
|
Confirm,
|
||||||
|
|
||||||
/// Deny all links to open a new website.
|
/// Deny all links to open a new website.
|
||||||
#[serde(rename = "deny")]
|
#[cfg_attr(feature = "serde", serde(rename = "deny"))]
|
||||||
Deny,
|
Deny,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
/// Controls whether the content is letterboxed or pillarboxed when the
|
/// Controls whether the content is letterboxed or pillarboxed when the
|
||||||
|
@ -7,19 +6,23 @@ use std::str::FromStr;
|
||||||
/// When letterboxed, black bars will be rendered around the exterior
|
/// When letterboxed, black bars will be rendered around the exterior
|
||||||
/// margins of the content.
|
/// margins of the content.
|
||||||
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
#[serde(rename = "letterbox")]
|
#[cfg_attr(
|
||||||
|
feature = "serde",
|
||||||
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
|
serde(rename = "letterbox")
|
||||||
|
)]
|
||||||
pub enum Letterbox {
|
pub enum Letterbox {
|
||||||
/// The content will never be letterboxed.
|
/// The content will never be letterboxed.
|
||||||
#[serde(rename = "off")]
|
#[cfg_attr(feature = "serde", serde(rename = "off"))]
|
||||||
Off,
|
Off,
|
||||||
|
|
||||||
/// The content will only be letterboxed if the content is running fullscreen.
|
/// The content will only be letterboxed if the content is running fullscreen.
|
||||||
#[serde(rename = "fullscreen")]
|
#[cfg_attr(feature = "serde", serde(rename = "fullscreen"))]
|
||||||
Fullscreen,
|
Fullscreen,
|
||||||
|
|
||||||
/// The content will always be letterboxed.
|
/// The content will always be letterboxed.
|
||||||
#[serde(rename = "on")]
|
#[cfg_attr(feature = "serde", serde(rename = "on"))]
|
||||||
On,
|
On,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,17 +44,18 @@ impl FromStr for Letterbox {
|
||||||
|
|
||||||
/// The networking API access mode of the Ruffle player.
|
/// The networking API access mode of the Ruffle player.
|
||||||
/// This setting is only used on web.
|
/// This setting is only used on web.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum NetworkingAccessMode {
|
pub enum NetworkingAccessMode {
|
||||||
/// All networking APIs are permitted in the SWF file.
|
/// All networking APIs are permitted in the SWF file.
|
||||||
#[serde(rename = "all")]
|
#[cfg_attr(feature = "serde", serde(rename = "all"))]
|
||||||
All,
|
All,
|
||||||
|
|
||||||
/// The SWF file may not call browser navigation or browser interaction APIs.
|
/// The SWF file may not call browser navigation or browser interaction APIs.
|
||||||
///
|
///
|
||||||
/// The APIs getURL(), navigateToURL(), fscommand() and ExternalInterface.call()
|
/// The APIs getURL(), navigateToURL(), fscommand() and ExternalInterface.call()
|
||||||
/// are prevented in this mode.
|
/// are prevented in this mode.
|
||||||
#[serde(rename = "internal")]
|
#[cfg_attr(feature = "serde", serde(rename = "internal"))]
|
||||||
Internal,
|
Internal,
|
||||||
|
|
||||||
/// The SWF file may not call browser navigation or browser interaction APIs
|
/// The SWF file may not call browser navigation or browser interaction APIs
|
||||||
|
@ -65,6 +69,6 @@ pub enum NetworkingAccessMode {
|
||||||
/// URLStream.load() and XMLSocket.connect() are prevented in this mode.
|
/// URLStream.load() and XMLSocket.connect() are prevented in this mode.
|
||||||
///
|
///
|
||||||
/// This mode is not implemented yet.
|
/// This mode is not implemented yet.
|
||||||
#[serde(rename = "none")]
|
#[cfg_attr(feature = "serde", serde(rename = "none"))]
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ use crate::events::TextControlCode;
|
||||||
use crate::i18n::core_text;
|
use crate::i18n::core_text;
|
||||||
use gc_arena::Collect;
|
use gc_arena::Collect;
|
||||||
use ruffle_render::quality::StageQuality;
|
use ruffle_render::quality::StageQuality;
|
||||||
use serde::Serialize;
|
|
||||||
|
|
||||||
#[derive(Collect, Default)]
|
#[derive(Collect, Default)]
|
||||||
#[collect(no_drop)]
|
#[collect(no_drop)]
|
||||||
|
@ -203,10 +202,11 @@ impl<'gc> ContextMenuState<'gc> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Serialize)]
|
#[derive(Clone)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
|
||||||
pub struct ContextMenuItem {
|
pub struct ContextMenuItem {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
#[serde(rename = "separatorBefore")]
|
#[cfg_attr(feature = "serde", serde(rename = "separatorBefore"))]
|
||||||
pub separator_before: bool,
|
pub separator_before: bool,
|
||||||
pub checked: bool,
|
pub checked: bool,
|
||||||
pub caption: String,
|
pub caption: String,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use crate::display_object::InteractiveObject;
|
use crate::display_object::InteractiveObject;
|
||||||
use serde::Deserialize;
|
|
||||||
use swf::ClipEventFlag;
|
use swf::ClipEventFlag;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
@ -341,7 +340,8 @@ impl<'gc> ClipEvent<'gc> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Control inputs to a text field
|
/// Control inputs to a text field
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
|
||||||
pub enum TextControlCode {
|
pub enum TextControlCode {
|
||||||
MoveLeft,
|
MoveLeft,
|
||||||
MoveLeftWord,
|
MoveLeftWord,
|
||||||
|
|
|
@ -56,7 +56,6 @@ use ruffle_render::commands::CommandList;
|
||||||
use ruffle_render::quality::StageQuality;
|
use ruffle_render::quality::StageQuality;
|
||||||
use ruffle_render::transform::TransformStack;
|
use ruffle_render::transform::TransformStack;
|
||||||
use ruffle_video::backend::VideoBackend;
|
use ruffle_video::backend::VideoBackend;
|
||||||
use serde::Deserialize;
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::{HashMap, VecDeque};
|
use std::collections::{HashMap, VecDeque};
|
||||||
use std::ops::DerefMut;
|
use std::ops::DerefMut;
|
||||||
|
@ -2795,7 +2794,8 @@ fn run_mouse_pick<'gc>(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
|
||||||
#[derive(Default, Clone, Copy, Debug, Eq, PartialEq, Deserialize)]
|
#[derive(Default, Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
|
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
|
||||||
pub enum PlayerRuntime {
|
pub enum PlayerRuntime {
|
||||||
#[default]
|
#[default]
|
||||||
FlashPlayer,
|
FlashPlayer,
|
||||||
|
|
|
@ -11,7 +11,7 @@ version.workspace = true
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ruffle_core = { path = "../../core", features = ["deterministic", "timeline_debug", "avm_debug", "audio", "mp3", "default_font"] }
|
ruffle_core = { path = "../../core", features = ["deterministic", "timeline_debug", "avm_debug", "audio", "mp3", "default_font", "serde"] }
|
||||||
ruffle_render = { path = "../../render", features = ["serde"] }
|
ruffle_render = { path = "../../render", features = ["serde"] }
|
||||||
ruffle_input_format = { path = "../input-format" }
|
ruffle_input_format = { path = "../input-format" }
|
||||||
ruffle_socket_format = { path = "../socket-format" }
|
ruffle_socket_format = { path = "../socket-format" }
|
||||||
|
|
|
@ -63,7 +63,7 @@ zip = { version = "2.1.2", default-features = false}
|
||||||
|
|
||||||
[dependencies.ruffle_core]
|
[dependencies.ruffle_core]
|
||||||
path = "../core"
|
path = "../core"
|
||||||
features = ["audio", "mp3", "nellymoser", "default_compatibility_rules", "default_font"]
|
features = ["audio", "mp3", "nellymoser", "default_compatibility_rules", "default_font", "serde"]
|
||||||
|
|
||||||
[dependencies.web-sys]
|
[dependencies.web-sys]
|
||||||
version = "0.3.69"
|
version = "0.3.69"
|
||||||
|
|
Loading…
Reference in New Issue