Skip to content

Commit

Permalink
build(cargo): adjust features
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Sep 15, 2023
1 parent 7f6e2d3 commit c1a01b3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ jobs:
build: >-
set -e &&
apt update &&
apt install -y pkg-config xz-utils &&
apt install -y pkg-config xz-utils dav1d libdav1d-dev &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add x86_64-unknown-linux-gnu &&
Expand All @@ -177,7 +177,7 @@ jobs:
build: >-
set -e &&
apk update &&
apk add --no-cache libc6-compat pkgconfig &&
apk add --no-cache libc6-compat pkgconfig dav1d libdav1d dav1d-dev &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
rustup target add x86_64-unknown-linux-musl &&
Expand All @@ -196,7 +196,7 @@ jobs:
build: >-
set -e &&
apt update &&
apt install -y pkg-config xz-utils &&
apt install -y pkg-config xz-utils dav1d libdav1d-dev &&
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
rustup default "${RUST_TOOLCHAIN}" &&
Expand All @@ -218,7 +218,7 @@ jobs:
build: >-
set -e &&
apk update &&
apk add --no-cache libc6-compat pkgconfig &&
apk add --no-cache libc6-compat pkgconfig dav1d libdav1d dav1d-dev &&
export JEMALLOC_SYS_WITH_LG_PAGE=16 &&
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" &&
rustup toolchain install "${RUST_TOOLCHAIN}" &&
Expand Down
7 changes: 7 additions & 0 deletions packages/next-swc/crates/napi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ native-tls = ["next-dev/native-tls"]
rustls-tls = ["next-dev/rustls-tls"]
serializable = ["next-dev/serializable"]
image-webp = ["next-core/image-webp"]
image-avif = ["next-core/image-avif"]
# Enable all the available image codec support.
# Currently this is identical to `image-webp`, as we are not able to build
# other codecs easily yet.
image-extended = [
"image-webp",
]

# Enable dhat profiling allocator for heap profiling.
__internal_dhat-heap = ["dhat"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ pub fn get_next_image_rule() -> ModuleRule {
];

#[cfg(feature = "image-webp")]
resources.push(ModuleRuleCondition::ResourcePathEndsWith(".webp".to_string()));
resources.push(ModuleRuleCondition::ResourcePathEndsWith(
".webp".to_string(),
));

#[cfg(feature = "image-avif")]
resources.push(ModuleRuleCondition::ResourcePathEndsWith(".avif".to_string()));
resources.push(ModuleRuleCondition::ResourcePathEndsWith(
".avif".to_string(),
));

ModuleRule::new(
ModuleRuleCondition::any(resources),
Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"scripts": {
"clean": "node ../../scripts/rm.mjs native",
"build-native": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --features plugin,rustls-tls,image-webp --js false native",
"build-native-release": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --release --features plugin,rustls-tls,image-webp,tracing/release_max_level_info --js false native",
"build-native": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --features plugin,rustls-tls,image-extended --js false native",
"build-native-release": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --release --features plugin,rustls-tls,image-extended,tracing/release_max_level_info --js false native",
"build-native-no-plugin": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --features image-webp --js false native",
"build-native-no-plugin-woa": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --cargo-flags=--no-default-features --features native-tls,image-webp --js false native",
"build-native-no-plugin-woa-release": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --release --cargo-flags=--no-default-features --features native-tls,image-webp,tracing/release_max_level_info --js false native",
Expand Down

0 comments on commit c1a01b3

Please sign in to comment.