Unverified Commit 04aa19df authored by Cong-Cong Pan's avatar Cong-Cong Pan Committed by GitHub

chore: release @next/rspack-core 1.0.3 (#94116)

parent 00705147
......@@ -30,7 +30,7 @@ env:
jobs:
build:
name: Build
uses: rspack-contrib/rspack-toolchain/.github/workflows/build.yml@f69dc04fcae6b38d97b87acef448ed7a285b01cc
uses: rstackjs/rspack-toolchain/.github/workflows/build.yml@c0b7f47d0d657adbc4fddb3b3f2b607019004491
with:
package-json-path: rspack/crates/binding/package.json
napi-build-command: pnpm build --release
......@@ -89,12 +89,12 @@ jobs:
- name: Get NAPI info
id: napi-info
uses: rspack-contrib/rspack-toolchain/get-napi-info@f69dc04fcae6b38d97b87acef448ed7a285b01cc
uses: rstackjs/rspack-toolchain/get-napi-info@c0b7f47d0d657adbc4fddb3b3f2b607019004491
with:
package-json-path: rspack/crates/binding/package.json
- name: Download rspack binding
uses: rspack-contrib/rspack-toolchain/download-rspack-binding@f69dc04fcae6b38d97b87acef448ed7a285b01cc
uses: rstackjs/rspack-toolchain/download-rspack-binding@c0b7f47d0d657adbc4fddb3b3f2b607019004491
with:
path: ${{ steps.napi-info.outputs.binding-directory }}/artifacts
......@@ -118,6 +118,7 @@ jobs:
run: |
npm config set access public
npm config set provenance true
npm config set tag "${{ inputs.npm-tag }}"
pnpm napi pre-publish --no-gh-release -t npm ${{ inputs.dry-run && '--dry-run' || '' }}
working-directory: ${{ steps.napi-info.outputs.binding-directory }}
......
# Keep this override scoped to the Rspack workspace. The repository root
# config uses rust-lld for macOS, which Turbopack also depends on, so avoid
# changing the root linker behavior for a Rspack-only release build issue.
#
# Rspack 0.100.4 pulls in build scripts that still emit a standalone `-Wl`
# cdylib link arg on macOS. That flag is meant for clang/cc drivers and is not
# accepted by direct rust-lld. Point Rspack macOS builds at a tiny rust-lld
# wrapper that drops only that unsupported forwarding marker while preserving
# the root config's rust-lld/ICF behavior.
[target.'cfg(target_os = "macos")']
linker = "scripts/rust-lld"
This diff is collapsed.
......@@ -7,33 +7,33 @@ edition = "2024"
crate-type = ["cdylib"]
[dependencies]
rspack_binding_builder = { version = "=0.6.7" }
rspack_binding_builder_macros = { version = "=0.6.7" }
rspack_binding_builder = { version = "=0.100.4" }
rspack_binding_builder_macros = { version = "=0.100.4" }
rspack_core = { version = "=0.6.7" }
rspack_error = { version = "=0.6.7" }
rspack_hook = { version = "=0.6.7" }
rspack_plugin_externals = { version = "=0.6.7" }
rspack_sources = { version = "=0.4.17" }
rspack_core = { version = "=0.100.4" }
rspack_error = { version = "=0.100.4" }
rspack_hook = { version = "=0.100.4" }
rspack_plugin_externals = { version = "=0.100.4" }
rspack_sources = { version = "=0.4.23" }
regex = { version = "1.11.1" }
rspack_regex = { version = "=0.6.7" }
rspack_regex = { version = "=0.100.4" }
rustc-hash = { version = "2.1.1" }
napi = { version = "=3.2.2" }
napi-derive = { version = "=3.2.2" }
napi = { version = "=3.8.6" }
napi-derive = { version = "=3.5.5" }
anyhow = { version = "1.0.95" }
serde_json = { version = "1.0.134" }
anyhow = { version = "1.0.102" }
serde_json = { version = "1.0.149" }
next-taskless = { version = "0.0.1", path = "../../../crates/next-taskless" }
# Enable SWC plugin feature for targets that support it
# Skip: wasm32-wasip1-threads, i686-pc-windows-msvc, aarch64-pc-windows-msvc, armv7-linux-androideabi, armv7-unknown-linux-gnueabihf
[target.'cfg(not(any(target_arch = "wasm32", target_arch = "arm", all(target_os = "windows", target_arch = "x86"), all(target_os = "windows", target_arch = "aarch64"))))'.dependencies]
rspack_binding_builder = { version = "=0.6.7", features = ["plugin"] }
rspack_binding_builder = { version = "=0.100.4", features = ["plugin"] }
[build-dependencies]
rspack_binding_build = { version = "=0.6.7" }
rspack_binding_build = { version = "=0.100.4" }
# Workaround for `cross` builds to resolve parent workspace dependencies.
# When cross-compiling, the build runs in an isolated container and can't find
......@@ -43,4 +43,3 @@ rspack_binding_build = { version = "=0.6.7" }
# See: https://github.com/cross-rs/cross/issues/1181
[package.metadata.cross.build.env]
volumes = ["NEXT-TASKLESS_DEP=../../.."]
fn main() {
#[cfg(not(target_os = "macos"))]
rspack_binding_build::setup();
#[cfg(target_os = "macos")]
{
println!("cargo:rerun-if-env-changed=DEBUG_GENERATED_CODE");
println!("cargo:rerun-if-env-changed=TYPE_DEF_TMP_PATH");
println!("cargo:rerun-if-env-changed=CARGO_CFG_NAPI_RS_CLI_VERSION");
// napi-build emits an extra standalone "-Wl" flag on macOS, which
// breaks when this workspace uses rust-lld as the linker.
println!("cargo:rustc-cdylib-link-arg=-undefined");
println!("cargo:rustc-cdylib-link-arg=dynamic_lookup");
}
}
......@@ -19,3 +19,4 @@ export interface NapiNextExternalsPluginOptions {
}
export declare function registerNextExternalsPlugin(): void
export declare function registerForceCompleteRuntimePlugin(): void
{
"name": "@next/rspack-binding",
"version": "1.0.2",
"version": "1.0.3",
"homepage": "https://nextjs.org",
"bugs": {
"url": "https://github.com/vercel/next.js/issues"
......@@ -27,7 +27,7 @@
"build:debug": "napi build --platform"
},
"devDependencies": {
"@napi-rs/cli": "3.0.1",
"@napi-rs/cli": "3.1.5",
"@types/node": "^24.0.12",
"typescript": "^5.8.3"
},
......
This diff is collapsed.
use rspack_core::{
ApplyContext, ChunkUkey, Compilation, CompilationAdditionalTreeRuntimeRequirements, Plugin,
RuntimeGlobals, RuntimeModule,
};
use rspack_error::Result;
use rspack_hook::{plugin, plugin_hook};
#[derive(Debug)]
#[plugin]
pub struct ForceCompleteRuntimePlugin;
impl ForceCompleteRuntimePlugin {
pub fn new() -> Self {
Self::new_inner()
}
}
#[plugin_hook(
CompilationAdditionalTreeRuntimeRequirements for ForceCompleteRuntimePlugin,
tracing = false
)]
async fn additional_tree_runtime_requirements(
&self,
_compilation: &Compilation,
_chunk_ukey: &ChunkUkey,
runtime_requirements: &mut RuntimeGlobals,
_runtime_modules: &mut Vec<Box<dyn RuntimeModule>>,
) -> Result<()> {
runtime_requirements.insert(RuntimeGlobals::COMPAT_GET_DEFAULT_EXPORT);
Ok(())
}
impl Plugin for ForceCompleteRuntimePlugin {
fn name(&self) -> &'static str {
"ForceCompleteRuntimePlugin"
}
fn apply(&self, ctx: &mut ApplyContext<'_>) -> Result<()> {
ctx.compilation_hooks
.additional_tree_runtime_requirements
.tap(additional_tree_runtime_requirements::new(self));
Ok(())
}
}
#![feature(impl_trait_in_bindings)]
mod config_shared;
mod force_complete_runtime_plugin;
mod handle_externals;
mod next_externals_plugin;
......@@ -13,6 +14,7 @@ use rustc_hash::FxHashMap;
use crate::{
config_shared::{EsmExternalsConfig, ExperimentalConfig, NextConfigComplete},
force_complete_runtime_plugin::ForceCompleteRuntimePlugin,
next_externals_plugin::{NextExternalsPlugin, NextExternalsPluginOptions},
};
......@@ -107,3 +109,10 @@ register_plugin!("NextExternalsPlugin", |env: Env, object: Unknown<'_>| {
unsafe { FromNapiValue::from_napi_value(env.raw(), object.raw())? };
Ok(Box::new(NextExternalsPlugin::new(napi_options.into())) as BoxPlugin)
});
register_plugin!(
"ForceCompleteRuntimePlugin",
|_env: Env, _object: Unknown<'_>| {
Ok(Box::new(ForceCompleteRuntimePlugin::new()) as BoxPlugin)
}
);
......@@ -9,8 +9,14 @@ declare class NextExternalsPlugin {
constructor(options: NapiNextExternalsPluginOptions)
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
declare class ForceCompleteRuntimePlugin {
constructor()
}
declare const core: typeof RspackCore & {
NextExternalsPlugin: typeof NextExternalsPlugin
ForceCompleteRuntimePlugin: typeof ForceCompleteRuntimePlugin
}
export = core
......@@ -4,8 +4,9 @@ process.env.RSPACK_BINDING = require('node:path').dirname(
const binding = require('@next/rspack-binding')
// Register the plugin `NextExternalsPlugin` exported by `crates/binding/src/lib.rs`.
// Register the plugins exported by `crates/binding/src/lib.rs`.
binding.registerNextExternalsPlugin()
binding.registerForceCompleteRuntimePlugin()
const core = require('@rspack/core')
......@@ -16,8 +17,19 @@ const NextExternalsPlugin = core.experiments.createNativePlugin(
}
)
const ForceCompleteRuntimePlugin = core.experiments.createNativePlugin(
'ForceCompleteRuntimePlugin',
function () {
return {}
}
)
Object.defineProperty(core, 'NextExternalsPlugin', {
value: NextExternalsPlugin,
})
Object.defineProperty(core, 'ForceCompleteRuntimePlugin', {
value: ForceCompleteRuntimePlugin,
})
module.exports = core
{
"name": "@next/rspack-core",
"version": "1.0.2",
"version": "1.0.3",
"homepage": "https://nextjs.org",
"bugs": {
"url": "https://github.com/vercel/next.js/issues"
......@@ -28,7 +28,7 @@
"change-npm-name": "node ./change-npm-name.js"
},
"dependencies": {
"@rspack/core": "1.6.7",
"@rspack/core": "2.0.4",
"@next/rspack-binding": "workspace:*"
}
}
This diff is collapsed.
[toolchain]
profile = "default"
channel = "nightly-2025-11-13"
components = ["rust-src"]
# Use nightly for better access to the latest Rust features.
channel = "nightly-2026-04-16"
#!/usr/bin/env bash
set -euo pipefail
filtered_args=()
for arg in "$@"; do
# napi-build emits `-Wl -undefined dynamic_lookup` on macOS. When rustc calls
# rust-lld directly, `-Wl` is not a real linker flag; the following Darwin
# args are already valid for rust-lld and must be preserved.
if [[ "$arg" == "-Wl" ]]; then
continue
fi
filtered_args+=("$arg")
done
sysroot="$(rustc --print sysroot)"
host="$(rustc -vV | sed -n 's/^host: //p')"
rust_lld="$sysroot/lib/rustlib/$host/bin/rust-lld"
exec "$rust_lld" "${filtered_args[@]}"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment