PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
Fix platform-gated imports for Windows and wasm builds
Dylan M. Tayloref894ae6b8ce
diff --git a/crates/automation/src/dispatch.rs b/crates/automation/src/dispatch.rsindex 9ccd18c55..8d8d139d7 100644--- a/crates/automation/src/dispatch.rs+++ b/crates/automation/src/dispatch.rs@@ -1,6 +1,9 @@use super::error::{Result, ToolError, failed};use super::json::{Args, document_attachment_keys, info, one_based, parse_style_ranges, security, summary};use super::paths::{read_input, write_atomic};+// The digital-ID listing tools are macOS (Keychain) and Windows (certificate store) only.+#[cfg(any(target_os = "macos", target_os = "windows"))]+use super::signing;use super::{Arc, Automation, Edit, Value, block_overlapping, comments, json, tools};/// One piece of a tool's result.diff --git a/crates/js/src/formcalc/access.rs b/crates/js/src/formcalc/access.rsindex bffbd8823..bea902c75 100644--- a/crates/js/src/formcalc/access.rs+++ b/crates/js/src/formcalc/access.rs@@ -1,8 +1,10 @@+#[cfg(not(target_arch = "wasm32"))]+use super::CLOCK_EVERY;use super::ast::{Expr, Idx};use super::value::{Val, num_text, parse_num};use super::{- CLOCK_EVERY, HNode, HashSet, Interp, LIST_TOO_LONG, MAX_LIST, MAX_PARSE_DEPTH, MAX_STEPS, R, RAN_TOO_LONG, child_named, descendants_named,- instances, resolve_som,+ HNode, HashSet, Interp, LIST_TOO_LONG, MAX_LIST, MAX_PARSE_DEPTH, MAX_STEPS, R, RAN_TOO_LONG, child_named, descendants_named, instances,+ resolve_som,};impl Interp<'_> {diff --git a/crates/render/src/raster/pool.rs b/crates/render/src/raster/pool.rsindex 66a575eae..6da0c14d4 100644--- a/crates/render/src/raster/pool.rs+++ b/crates/render/src/raster/pool.rs@@ -1,8 +1,10 @@use super::{- Arc, AssertUnwindSafe, AtomicBool, AtomicRenderStats, InterpreterSettings, JoinHandle, Mutex, Ordering, PageRenderer, Pdf, Pixels, Receiver,- RenderCache, RenderConfig, RenderRequest, RenderStats, RenderedPage, RequestFailureKey, RequestKind, ResultReceiver, Stopwatch, SyncSender,- WorkQueue, catch_unwind, finish, panic_message, parse, render_page, sync_channel, take_warnings, warning_settings,+ Arc, AssertUnwindSafe, AtomicRenderStats, InterpreterSettings, JoinHandle, Mutex, Ordering, PageRenderer, Pdf, Pixels, RenderCache, RenderConfig,+ RenderRequest, RenderStats, RenderedPage, RequestFailureKey, RequestKind, ResultReceiver, Stopwatch, SyncSender, WorkQueue, catch_unwind, finish,+ panic_message, parse, render_page, take_warnings, warning_settings,};+#[cfg(not(target_arch = "wasm32"))]+use super::{AtomicBool, Receiver, sync_channel};/// How long one page may render before the pool gives up on it (the watchdog).pub const STUCK_AFTER: std::time::Duration = std::time::Duration::from_secs(20);diff --git a/crates/ui-egui/src/app/input.rs b/crates/ui-egui/src/app/input.rsindex 953eb4a6e..cda282e9e 100644--- a/crates/ui-egui/src/app/input.rs+++ b/crates/ui-egui/src/app/input.rs@@ -1,4 +1,6 @@-use super::{GridDrop, GridFile, OpenRequest, PdfCraftApp, open_worker};+use super::{GridDrop, GridFile, PdfCraftApp};+#[cfg(not(target_arch = "wasm32"))]+use super::{OpenRequest, open_worker};/// Read a file dropped on a page grid (see [`GridFile`]).fn read_grid_file((name, source): GridFile) -> Result<(String, Vec<u8>), (String, String)> {diff --git a/crates/ui-egui/src/workflows/combine_ui/parts.rs b/crates/ui-egui/src/workflows/combine_ui/parts.rsindex 7de66b074..5cba711a0 100644--- a/crates/ui-egui/src/workflows/combine_ui/parts.rs+++ b/crates/ui-egui/src/workflows/combine_ui/parts.rs@@ -1,4 +1,6 @@-use super::{BTreeSet, MAX_FOLDER_DEPTH, MAX_FOLDER_FILES, Ordering, SystemTime};+use super::{BTreeSet, Ordering, SystemTime};+#[cfg(not(target_arch = "wasm32"))]+use super::{MAX_FOLDER_DEPTH, MAX_FOLDER_FILES};/// The PDFs, images and text files in `dir` (and, if `recursive`, the folders inside it, not/// following links), in natural order, at most [`MAX_FOLDER_FILES`]; and whether there were more.diff --git a/crates/ui-egui/src/workflows/combine_ui/session.rs b/crates/ui-egui/src/workflows/combine_ui/session.rsindex ad8d2a402..594b5f745 100644--- a/crates/ui-egui/src/workflows/combine_ui/session.rs+++ b/crates/ui-egui/src/workflows/combine_ui/session.rs@@ -1,8 +1,10 @@+#[cfg(not(target_arch = "wasm32"))]+use super::MAX_FOLDER_FILES;use super::files::{AssessError, Assessed, CombineFile, Incoming, Secret, Snapshot, SortKey, UnlockPrompt, assess};#[cfg(not(target_arch = "wasm32"))]use super::parts::combinable_in;use super::parts::{Part, items_of, moved_order, natural, parts_of, range_of, title_of};-use super::{Arc, BTreeSet, CombineTab, HISTORY, MAX_FOLDER_FILES, Modifiers, PdfCraftApp};+use super::{Arc, BTreeSet, CombineTab, HISTORY, Modifiers, PdfCraftApp};impl PdfCraftApp {/// Show the Combine files tab (File ▸ Combine files…), opening it if needed.