mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Turbopack: Rename crates/napi to crates/next-napi-bindings and update crate name (#89314)
Disclaimer: This PR is entirely claude+opencode generated. - Crate name said `next-swc-napi`, which was confusing, because this has a lot more than swc bindings nowdays. - The crate name didn't match the directory name, which often confused agents. This does not change the npm package name, as that would likely have a much larger blast radius, and could break more things, to a point where it may not be worth it.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
"examples": ["examples/**"],
|
||||
"Font (next/font)": ["**/*font*"],
|
||||
"tests": ["test/**", "bench/**"],
|
||||
"Turbopack": ["crates/next-*/**", "crates/napi/**", "turbopack/**"],
|
||||
"Turbopack": ["crates/next-*/**", "turbopack/**"],
|
||||
"Rspack": [
|
||||
{ "type": "user", "pattern": "9aoy" },
|
||||
{ "type": "user", "pattern": "ahabhgk" },
|
||||
|
||||
@@ -318,7 +318,7 @@ jobs:
|
||||
# it can fail to restore in different OS'
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# crates/napi/build.rs uses git-describe to find the most recent git tag. It's okay if
|
||||
# crates/next-napi-bindings/build.rs uses git-describe to find the most recent git tag. It's okay if
|
||||
# this fails, but fetch with enough depth that we're likely to find a recent tag.
|
||||
fetch-depth: 100
|
||||
|
||||
|
||||
@@ -523,7 +523,7 @@ jobs:
|
||||
secrets: inherit
|
||||
|
||||
#[NOTE] currently this only checks building wasi target
|
||||
test-next-swc-napi-wasi:
|
||||
test-next-napi-bindings-wasi:
|
||||
name: test next-swc wasi
|
||||
needs: ['optimize-ci', 'changes', 'build-next']
|
||||
# TODO: Re-enable this when https://github.com/napi-rs/napi-rs/issues/2009 is addressed.
|
||||
@@ -539,7 +539,7 @@ jobs:
|
||||
afterBuild: |
|
||||
rustup target add wasm32-wasip1-threads
|
||||
pnpm dlx turbo@${TURBO_VERSION} run build-native-wasi
|
||||
stepName: 'test-next-swc-napi-wasi'
|
||||
stepName: 'test-next-napi-bindings-wasi'
|
||||
secrets: inherit
|
||||
|
||||
test-unit:
|
||||
|
||||
@@ -49,12 +49,12 @@ jobs:
|
||||
- name: Build benchmarks for tests
|
||||
timeout-minutes: 120
|
||||
run: |
|
||||
cargo test --benches --workspace --release --no-fail-fast --exclude turbopack-bench --exclude next-swc-napi --no-run
|
||||
cargo test --benches --workspace --release --no-fail-fast --exclude turbopack-bench --exclude next-napi-bindings --no-run
|
||||
|
||||
- name: Run cargo test on benchmarks
|
||||
timeout-minutes: 120
|
||||
run: |
|
||||
cargo test --benches --workspace --release --no-fail-fast --exclude turbopack-bench --exclude next-swc-napi
|
||||
cargo test --benches --workspace --release --no-fail-fast --exclude turbopack-bench --exclude next-napi-bindings
|
||||
|
||||
- name: Build benchmarks for tests for other bundlers
|
||||
if: inputs.all
|
||||
|
||||
Generated
+1
-1
@@ -4485,7 +4485,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "next-swc-napi"
|
||||
name = "next-napi-bindings"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ resolver = "2"
|
||||
|
||||
members = [
|
||||
"scripts/send-trace-to-jaeger",
|
||||
"crates/napi",
|
||||
"crates/next-napi-bindings",
|
||||
"crates/wasm",
|
||||
"crates/next-api",
|
||||
"crates/next-build-test",
|
||||
|
||||
@@ -7,7 +7,7 @@ pub static TRACING_NEXT_OVERVIEW_TARGETS: Lazy<Vec<&str>> = Lazy::new(|| {
|
||||
[
|
||||
&TRACING_OVERVIEW_TARGETS[..],
|
||||
&[
|
||||
"next_swc_napi=info",
|
||||
"next_napi_bindings=info",
|
||||
"next_swc=info",
|
||||
"next_api=info",
|
||||
"next_dev=info",
|
||||
@@ -23,7 +23,7 @@ pub static TRACING_NEXT_TARGETS: Lazy<Vec<&str>> = Lazy::new(|| {
|
||||
[
|
||||
&TRACING_NEXT_OVERVIEW_TARGETS[..],
|
||||
&[
|
||||
"next_swc_napi=trace",
|
||||
"next_napi_bindings=trace",
|
||||
"next_swc=trace",
|
||||
"next_api=trace",
|
||||
"next_dev=trace",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
edition = "2024"
|
||||
name = "next-swc-napi"
|
||||
name = "next-napi-bindings"
|
||||
version = "0.0.0"
|
||||
publish = false
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vercel/next.js",
|
||||
"directory": "crates/napi/npm/darwin-arm64"
|
||||
"directory": "crates/next-napi-bindings/npm/darwin-arm64"
|
||||
},
|
||||
"os": [
|
||||
"darwin"
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vercel/next.js",
|
||||
"directory": "crates/napi/npm/darwin-x64"
|
||||
"directory": "crates/next-napi-bindings/npm/darwin-x64"
|
||||
},
|
||||
"os": [
|
||||
"darwin"
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vercel/next.js",
|
||||
"directory": "crates/napi/npm/linux-arm64-gnu"
|
||||
"directory": "crates/next-napi-bindings/npm/linux-arm64-gnu"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vercel/next.js",
|
||||
"directory": "crates/napi/npm/linux-arm64-musl"
|
||||
"directory": "crates/next-napi-bindings/npm/linux-arm64-musl"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vercel/next.js",
|
||||
"directory": "crates/napi/npm/linux-x64-gnu"
|
||||
"directory": "crates/next-napi-bindings/npm/linux-x64-gnu"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vercel/next.js",
|
||||
"directory": "crates/napi/npm/linux-x64-musl"
|
||||
"directory": "crates/next-napi-bindings/npm/linux-x64-musl"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vercel/next.js",
|
||||
"directory": "crates/napi/npm/win32-arm64-msvc"
|
||||
"directory": "crates/next-napi-bindings/npm/win32-arm64-msvc"
|
||||
},
|
||||
"os": [
|
||||
"win32"
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vercel/next.js",
|
||||
"directory": "crates/napi/npm/win32-x64-msvc"
|
||||
"directory": "crates/next-napi-bindings/npm/win32-x64-msvc"
|
||||
},
|
||||
"os": [
|
||||
"win32"
|
||||
@@ -7,18 +7,18 @@
|
||||
],
|
||||
"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,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,image-extended,tracing/release_max_level_trace --js false native",
|
||||
"build-native-release-with-assertions": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --profile release-with-assertions --features plugin,image-extended,tracing/release_max_level_trace --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-release": "napi build --platform -p next-swc-napi --cargo-cwd ../../ --cargo-name next_swc_napi --release --features image-webp,tracing/release_max_level_trace --js false native",
|
||||
"build-native-wasi": "npx --package=@napi-rs/[email protected] napi build --platform --target wasm32-wasip1-threads -p next-swc-napi --cwd ../../ --output-dir packages/next-swc/native --no-default-features",
|
||||
"build-native": "napi build --platform -p next-napi-bindings --cargo-cwd ../../ --cargo-name next_napi_bindings --features plugin,image-extended --js false native",
|
||||
"build-native-release": "napi build --platform -p next-napi-bindings --cargo-cwd ../../ --cargo-name next_napi_bindings --release --features plugin,image-extended,tracing/release_max_level_trace --js false native",
|
||||
"build-native-release-with-assertions": "napi build --platform -p next-napi-bindings --cargo-cwd ../../ --cargo-name next_napi_bindings --profile release-with-assertions --features plugin,image-extended,tracing/release_max_level_trace --js false native",
|
||||
"build-native-no-plugin": "napi build --platform -p next-napi-bindings --cargo-cwd ../../ --cargo-name next_napi_bindings --features image-webp --js false native",
|
||||
"build-native-no-plugin-release": "napi build --platform -p next-napi-bindings --cargo-cwd ../../ --cargo-name next_napi_bindings --release --features image-webp,tracing/release_max_level_trace --js false native",
|
||||
"build-native-wasi": "npx --package=@napi-rs/[email protected] napi build --platform --target wasm32-wasip1-threads -p next-napi-bindings --cwd ../../ --output-dir packages/next-swc/native --no-default-features",
|
||||
"build-wasm": "wasm-pack build ../../crates/wasm --scope=next",
|
||||
"cache-build-native": "[ -d native ] && echo $(ls native)",
|
||||
"rust-check-fmt": "cd ../..; cargo fmt -- --check",
|
||||
"rust-check-clippy": "cargo clippy --workspace --all-targets -- -D warnings -A deprecated",
|
||||
"rust-check-napi": "cargo check -p next-swc-napi",
|
||||
"test-cargo-unit": "cargo nextest run --workspace --exclude next-swc-napi --exclude turbo-tasks-macros --cargo-profile release-with-assertions --no-fail-fast"
|
||||
"rust-check-napi": "cargo check -p next-napi-bindings",
|
||||
"test-cargo-unit": "cargo nextest run --workspace --exclude next-napi-bindings --exclude turbo-tasks-macros --cargo-profile release-with-assertions --no-fail-fast"
|
||||
},
|
||||
"napi": {
|
||||
"name": "next-swc",
|
||||
|
||||
@@ -199,7 +199,7 @@ export interface HmrIdentifiers {
|
||||
identifiers: string[]
|
||||
}
|
||||
|
||||
/** @see https://github.com/vercel/next.js/blob/415cd74b9a220b6f50da64da68c13043e9b02995/packages/next-swc/crates/napi/src/next_api/project.rs#L824-L833 */
|
||||
/** @see https://github.com/vercel/next.js/blob/415cd74b9a220b6f50da64da68c13043e9b02995/crates/next-napi-bindings/src/next_api/project.rs#L824-L833 */
|
||||
export interface TurbopackStackFrame {
|
||||
isServer: boolean
|
||||
isInternal?: boolean
|
||||
|
||||
@@ -1232,7 +1232,7 @@ export default async function getBaseWebpackConfig(
|
||||
isRspack
|
||||
? new (getRspackCore().SwcJsMinimizerRspackPlugin)({
|
||||
// JS minimizer configuration
|
||||
// options should align with crates/napi/src/minify.rs#patch_opts
|
||||
// options should align with crates/next-napi-bindings/src/minify.rs#patch_opts
|
||||
minimizerOptions: {
|
||||
compress: {
|
||||
inline: 2,
|
||||
|
||||
@@ -37,7 +37,7 @@ async function main() {
|
||||
const version = `${semverStableVersion}-preview-${shortSha}-${dateString}`
|
||||
console.info(`Designated version: ${version}`)
|
||||
|
||||
const nativePackagesDir = path.join(repoRoot, 'crates/napi/npm')
|
||||
const nativePackagesDir = path.join(repoRoot, 'crates/next-napi-bindings/npm')
|
||||
const platforms = (await fs.readdir(nativePackagesDir)).filter(
|
||||
(name) => !name.startsWith('.')
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PACKAGES="-p next-swc-napi -p next-api -p next-build -p next-core -p next-custom-transforms"
|
||||
PACKAGES="-p next-napi-bindings -p next-api -p next-build -p next-core -p next-custom-transforms"
|
||||
RUSTDOCFLAGS="-Z unstable-options --enable-index-page" cargo doc $PACKAGES --no-deps
|
||||
@@ -14,7 +14,7 @@ const cwd = process.cwd()
|
||||
let version = require('@next/swc/package.json').version
|
||||
|
||||
// Copy binaries to package folders, update version, and publish
|
||||
let nativePackagesDir = path.join(cwd, 'crates/napi/npm')
|
||||
let nativePackagesDir = path.join(cwd, 'crates/next-napi-bindings/npm')
|
||||
let platforms = (await readdir(nativePackagesDir)).filter(
|
||||
(name) => !name.startsWith('.')
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ use anyhow::Result;
|
||||
/// information must be computed in the top-level crate for cargo incremental compilation to work
|
||||
/// correctly.
|
||||
///
|
||||
/// See `crates/napi/build.rs` for details.
|
||||
/// See `crates/next-napi-bindings/build.rs` for details.
|
||||
pub struct GitVersionInfo<'a> {
|
||||
/// Output of `git describe --match 'v[0-9]' --dirty`.
|
||||
pub describe: &'a str,
|
||||
|
||||
Reference in New Issue
Block a user