Skip to content

Commit

Permalink
Merge 6ab55c0 into 9c95c1b
Browse files Browse the repository at this point in the history
  • Loading branch information
devongovett authored Aug 31, 2024
2 parents 9c95c1b + 6ab55c0 commit 3cd24e5
Show file tree
Hide file tree
Showing 287 changed files with 6,428 additions and 33,635 deletions.
2,217 changes: 46 additions & 2,171 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions crates/json-comments-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
//! # }
//! ```
//!
use std::io::ErrorKind;
use std::io::Read;
use std::io::Result;
use std::slice::IterMut;
use std::{
io::{ErrorKind, Read, Result},
slice::IterMut,
};

#[derive(Eq, PartialEq, Copy, Clone, Debug)]
enum State {
Expand Down Expand Up @@ -215,7 +215,6 @@ fn strip_buf(
/// \n} ");
///
/// ```
#[deprecated]
pub fn strip_comments_in_place(
s: &mut str,
settings: CommentSettings,
Expand Down Expand Up @@ -390,8 +389,7 @@ fn in_line_comment(c: &mut u8) -> State {

#[cfg(test)]
mod tests {
use std::io::ErrorKind;
use std::io::Read;
use std::io::{ErrorKind, Read};

use super::*;

Expand Down
29 changes: 13 additions & 16 deletions crates/macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
#![deny(unused_crate_dependencies)]

use std::collections::HashMap;
use std::collections::HashSet;
use std::sync::Arc;
use std::{
collections::{HashMap, HashSet},
sync::Arc,
};
use swc_core::ecma::utils::stack_size::maybe_grow_default;

use indexmap::IndexMap;
use swc_core::common::util::take::Take;
use swc_core::common::SourceMap;
use swc_core::common::Span;
use swc_core::common::DUMMY_SP;
use swc_core::ecma::ast::*;
use swc_core::ecma::atoms::js_word;
use swc_core::ecma::atoms::JsWord;
use swc_core::ecma::parser::error::Error;
use swc_core::ecma::parser::lexer::Lexer;
use swc_core::ecma::parser::Parser;
use swc_core::ecma::parser::StringInput;
use swc_core::ecma::visit::Fold;
use swc_core::ecma::visit::FoldWith;
use swc_core::{
common::{util::take::Take, SourceMap, Span, DUMMY_SP},
ecma::{
ast::*,
atoms::{js_word, JsWord},
parser::{error::Error, lexer::Lexer, Parser, StringInput},
visit::{Fold, FoldWith},
},
};

#[cfg(feature = "napi")]
pub mod napi;
Expand Down
22 changes: 6 additions & 16 deletions crates/macros/src/napi.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
use std::sync::Arc;

use crossbeam_channel::Receiver;
use crossbeam_channel::Sender;
use crossbeam_channel::{Receiver, Sender};
use indexmap::IndexMap;
use napi::threadsafe_function::ThreadSafeCallContext;
use napi::threadsafe_function::ThreadsafeFunctionCallMode;
use napi::Env;
use napi::JsBoolean;
use napi::JsFunction;
use napi::JsNumber;
use napi::JsObject;
use napi::JsString;
use napi::JsUnknown;
use napi::ValueType;
use napi::{
threadsafe_function::{ThreadSafeCallContext, ThreadsafeFunctionCallMode},
Env, JsBoolean, JsFunction, JsNumber, JsObject, JsString, JsUnknown, ValueType,
};
use napi_derive::napi;
use swc_core::common::DUMMY_SP;

use crate::JsValue;
use crate::Location;
use crate::MacroCallback;
use crate::MacroError;
use crate::{JsValue, Location, MacroCallback, MacroError};

struct CallMacroMessage {
src: String,
Expand Down
47 changes: 8 additions & 39 deletions crates/node-bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,60 +7,29 @@ edition = "2021"
[lib]
crate-type = ["cdylib"]

[features]
canary = ["parcel_monitoring/canary"]

[dependencies]
parcel = { path = "../parcel" }
parcel_core = { path = "../parcel_core" }
napi-derive = "2.16.3"
parcel-js-swc-core = { path = "../../packages/transformers/js/core" }
parcel_monitoring = { path = "../parcel_monitoring" }
parcel-resolver = { path = "../../packages/utils/node-resolver-rs" }
parcel-resolver-old = { path = "../../packages/utils/node-resolver-rs-old" }
parcel_package_manager = { path = "../parcel_package_manager" }
parcel_plugin_transformer_js = { path = "../parcel_plugin_transformer_js" }
parcel_napi_helpers = { path = "../parcel_napi_helpers" }

anyhow = "1.0.82"
dashmap = "5.4.0"
glob = "0.3.1"
log = "0.4.21"
mockall = "0.12.1"
napi-derive = "2.16.3"
num_cpus = "1.16.0"
parking_lot = "0.12"
serde = { version = "1.0.200", features = ["derive"] }
serde_json = "1.0.116"
toml = "0.8.12"
tracing = "0.1.40"
tracing-appender = "0.2.3"
tracing-subscriber = "0.3.18"
xxhash-rust = { version = "0.8.2", features = ["xxh3"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
parcel = { path = "../parcel", features = ["nodejs"] }
napi = { version = "2.16.4", features = ["serde-json", "napi4", "napi5"] }
parcel-dev-dep-resolver = { path = "../../packages/utils/dev-dep-resolver" }
parcel-dev-dep-resolver-old = { path = "../../packages/utils/dev-dep-resolver-old" }
parcel-macros = { path = "../macros", features = ["napi"] }

crossbeam-channel = "0.5.6"
indexmap = "1.9.2"
libc = "0.2"
mozjpeg-sys = "1.0.0"
napi = { version = "2.16.4", features = ["async", "napi4", "napi5", "serde-json"] }
once_cell = { version = "1.19.0" }
oxipng = "8.0.0"
mozjpeg-sys = "2.0.0"
libc = "0.2"
rayon = "1.7.0"

# Crash reporting dependencies
crossbeam-channel = "0.5.6"
indexmap = "1.9.2"

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["custom"], default-features = false }
napi = { version = "2.16.4", features = ["serde-json"] }
getrandom = { version = "0.2", features = ["custom"], default-features = false }

[target.'cfg(all(target_os = "macos", not(feature = "canary")))'.dependencies]
# jemallocator is disabled on canary builds to experiment with its performance
# and reliability
[target.'cfg(target_os = "macos")'.dependencies]
jemallocator = { version = "0.3.2", features = ["disable_initial_exec_tls"] }

[target.'cfg(windows)'.dependencies]
Expand Down
80 changes: 0 additions & 80 deletions crates/node-bindings/src/file_system/file_system_napi.rs

This file was deleted.

2 changes: 0 additions & 2 deletions crates/node-bindings/src/file_system/mod.rs

This file was deleted.

3 changes: 1 addition & 2 deletions crates/node-bindings/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use std::hash::Hasher;

use napi::bindgen_prelude::Buffer;
use napi_derive::napi;
use xxhash_rust::xxh3::xxh3_64;
use xxhash_rust::xxh3::Xxh3;
use xxhash_rust::xxh3::{xxh3_64, Xxh3};

#[napi]
pub fn hash_string(s: String) -> String {
Expand Down
18 changes: 5 additions & 13 deletions crates/node-bindings/src/image.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
use std::mem;
use std::ptr;
use std::slice;
use std::{mem, ptr, slice};

use mozjpeg_sys::*;
use napi::bindgen_prelude::*;
use napi::Env;
use napi::Error;
use napi::JsBuffer;
use napi::Result;
use napi::{bindgen_prelude::*, Env, Error, JsBuffer, Result};
use napi_derive::napi;
use oxipng::optimize_from_memory;
use oxipng::Headers;
use oxipng::Options;
use oxipng::{optimize_from_memory, Headers, Options};

#[napi]
pub fn optimize_image(kind: String, buf: Buffer, env: Env) -> Result<JsBuffer> {
Expand Down Expand Up @@ -121,7 +113,7 @@ unsafe fn create_error_handler() -> jpeg_error_mgr {
err
}

extern "C" fn unwind_error_exit(cinfo: &mut jpeg_common_struct) {
extern "C-unwind" fn unwind_error_exit(cinfo: &mut jpeg_common_struct) {
let message = unsafe {
let err = cinfo.err.as_ref().unwrap();
match err.format_message {
Expand All @@ -137,4 +129,4 @@ extern "C" fn unwind_error_exit(cinfo: &mut jpeg_common_struct) {
std::panic::resume_unwind(Box::new(message))
}

extern "C" fn silence_message(_cinfo: &mut jpeg_common_struct, _level: c_int) {}
extern "C-unwind" fn silence_message(_cinfo: &mut jpeg_common_struct, _level: c_int) {}
7 changes: 0 additions & 7 deletions crates/node-bindings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,13 @@ static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;
#[global_allocator]
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;

#[cfg(not(target_arch = "wasm32"))]
mod file_system;

/// napi versions of `crate::core::requests`
#[cfg(not(target_arch = "wasm32"))]
mod fs_search;
mod hash;
#[cfg(not(target_arch = "wasm32"))]
mod image;

#[cfg(not(target_arch = "wasm32"))]
mod parcel;
mod resolver;
mod resolver_old;
mod transformer;

#[cfg(target_arch = "wasm32")]
Expand Down
4 changes: 0 additions & 4 deletions crates/node-bindings/src/parcel/mod.rs

This file was deleted.

11 changes: 0 additions & 11 deletions crates/node-bindings/src/parcel/monitoring.rs

This file was deleted.

29 changes: 0 additions & 29 deletions crates/node-bindings/src/parcel/package_manager_napi.rs

This file was deleted.

Loading

0 comments on commit 3cd24e5

Please sign in to comment.