-
Notifications
You must be signed in to change notification settings - Fork 29.3k
feat: next-rspack-binding #82811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: next-rspack-binding #82811
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
57b7654
init next-rspack-binding
SyMind 7841dc3
chore: take next-rspack out crago workspace
SyMind 3d4f6df
can build rspack package
SyMind e3083fb
share NEVER_EXTERNAL_RE
SyMind 8ef6aae
reuse EDGE_NODE_EXTERNALS
SyMind 4aff8fc
refactor get_edge_polyfilled_modules
SyMind 36f687b
use std::async::OnceLock
SyMind 5d22a7b
cargo fmt
SyMind e09194d
refactor code
SyMind 132f0ef
reuse NODE_EXTERNALS and BUN_EXTERNALS
SyMind 0d2b27d
rm BARREL_OPTIMIZATION_PREFIX
SyMind 5867752
fix: rm dead code
SyMind 69d9435
fix
SyMind 9869699
fix ast-grep
SyMind 0bbfa5b
prettier
SyMind c617f9c
change dir
SyMind d2b39c7
change package json
SyMind 635c8dd
rename workflow
SyMind d3624ef
fix: crago exclude
SyMind 01b6266
fix ci
SyMind 291e1ea
prettier
SyMind 7bfce07
fix: the github ci
SyMind 1890645
change @next-rspack scope
SyMind bcbcfd2
Merge branch 'canary' into next-rspack-binding
SyMind f905042
Merge branch 'canary' into next-rspack-binding
SyMind ae782d2
update uses action
SyMind 0cbedf7
fix: working-directory
SyMind 5295b0a
update dependency
SyMind 2badb46
fix: workflow
SyMind ebc7f9b
add rust-toolchain
SyMind 6878c02
cargo update
SyMind 7950121
update workflow
SyMind 87fbd17
fix cargo lock
SyMind 6b6a225
ApplyContext
SyMind db1975e
use patch.crates-io for next-taskless
SyMind 0bfc98a
cargo fmt
SyMind 53f60cc
fix build failed
SyMind bc65d09
fix: cross bug
SyMind 8afa6dc
update rspack-toolchain
SyMind f38d5b5
chore: update rspack-contrib
SyMind acd807e
Merge branch 'canary' into next-rspack-binding
SyMind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: Release next-rspack bindings | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dry-run: | ||
description: 'Run in dry-run mode (no actual publishing)' | ||
required: false | ||
default: false | ||
type: boolean | ||
npm-tag: | ||
description: 'NPM tag for publishing' | ||
required: false | ||
default: 'latest' | ||
type: choice | ||
options: | ||
- latest | ||
- alpha | ||
- beta | ||
- canary | ||
|
||
env: | ||
DEBUG: napi:* | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
uses: rspack-contrib/rspack-toolchain/.github/workflows/build.yml@f69dc04fcae6b38d97b87acef448ed7a285b01cc | ||
with: | ||
package-json-path: rspack/crates/binding/package.json | ||
napi-build-command: pnpm build --release | ||
working-directory: rspack | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
environment: npm | ||
name: Release | ||
permissions: | ||
contents: write | ||
id-token: write | ||
needs: [build] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Display release mode | ||
run: | | ||
echo "🚀 Release Configuration:" | ||
echo " - Dry-run mode: ${{ inputs.dry-run }}" | ||
echo " - NPM tag: ${{ inputs.npm-tag || 'latest' }}" | ||
if [ "${{ inputs.dry-run }}" == "true" ]; then | ||
echo " - ⚠️ This is a DRY RUN - no packages will be published" | ||
else | ||
echo " - 📦 This will PUBLISH packages to npm" | ||
fi | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '22' | ||
|
||
- name: Enable corepack | ||
run: corepack enable | ||
|
||
- name: Setup pnpm | ||
run: corepack prepare | ||
|
||
- name: Cache pnpm dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ runner.arch }}-pnpm- | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
working-directory: ./rspack | ||
|
||
- name: Get NAPI info | ||
id: napi-info | ||
uses: rspack-contrib/rspack-toolchain/get-napi-info@f69dc04fcae6b38d97b87acef448ed7a285b01cc | ||
with: | ||
package-json-path: rspack/crates/binding/package.json | ||
|
||
- name: Download rspack binding | ||
uses: rspack-contrib/rspack-toolchain/download-rspack-binding@f69dc04fcae6b38d97b87acef448ed7a285b01cc | ||
with: | ||
path: ${{ steps.napi-info.outputs.binding-directory }}/artifacts | ||
|
||
- name: List artifacts | ||
run: ls -R artifacts | ||
working-directory: ${{ steps.napi-info.outputs.binding-directory }} | ||
|
||
- name: Create npm dirs | ||
run: pnpm napi create-npm-dirs | ||
working-directory: ${{ steps.napi-info.outputs.binding-directory }} | ||
|
||
- name: Move artifacts | ||
run: pnpm napi artifacts | ||
working-directory: ${{ steps.napi-info.outputs.binding-directory }} | ||
|
||
- name: List npm dirs | ||
run: ls -R npm | ||
working-directory: ${{ steps.napi-info.outputs.binding-directory }} | ||
|
||
- name: Create npm token | ||
run: | | ||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Release npm binding packages | ||
run: | | ||
npm config set access public | ||
npm config set provenance true | ||
pnpm napi pre-publish --no-gh-release -t npm ${{ inputs.dry-run && '--dry-run' || '' }} | ||
working-directory: ${{ steps.napi-info.outputs.binding-directory }} | ||
|
||
- name: Release npm packages | ||
run: | | ||
pnpm publish -r --tag ${{ inputs.npm-tag }} --no-git-checks --provenance --access public ${{ inputs.dry-run && '--dry-run' || '' }} | ||
working-directory: ./rspack |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
pub const NODE_EXTERNALS: [&str; 64] = [ | ||
"assert", | ||
"assert/strict", | ||
"async_hooks", | ||
"buffer", | ||
"child_process", | ||
"cluster", | ||
"console", | ||
"constants", | ||
"crypto", | ||
"dgram", | ||
"diagnostics_channel", | ||
"dns", | ||
"dns/promises", | ||
"domain", | ||
"events", | ||
"fs", | ||
"fs/promises", | ||
"http", | ||
"http2", | ||
"https", | ||
"inspector", | ||
"module", | ||
"net", | ||
"os", | ||
"path", | ||
"path/posix", | ||
"path/win32", | ||
"perf_hooks", | ||
"process", | ||
"punycode", | ||
"querystring", | ||
"readline", | ||
"repl", | ||
"stream", | ||
"stream/promises", | ||
"stream/web", | ||
"string_decoder", | ||
"sys", | ||
"timers", | ||
"timers/promises", | ||
"tls", | ||
"trace_events", | ||
"tty", | ||
"url", | ||
"util", | ||
"util/types", | ||
"v8", | ||
"vm", | ||
"wasi", | ||
"worker_threads", | ||
"zlib", | ||
"pnpapi", | ||
"_http_agent", | ||
"_http_client", | ||
"_http_common", | ||
"_http_incoming", | ||
"_http_outgoing", | ||
"_http_server", | ||
"_stream_duplex", | ||
"_stream_passthrough", | ||
"_stream_readable", | ||
"_stream_transform", | ||
"_stream_wrap", | ||
"_stream_writable", | ||
]; | ||
|
||
pub const EDGE_NODE_EXTERNALS: [&str; 5] = ["buffer", "events", "assert", "util", "async_hooks"]; | ||
|
||
pub const BUN_EXTERNALS: [&str; 6] = [ | ||
"bun:ffi", | ||
"bun:jsc", | ||
"bun:sqlite", | ||
"bun:test", | ||
"bun:wrap", | ||
"bun", | ||
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use std::sync::LazyLock; | ||
|
||
use regex::Regex; | ||
|
||
// from https://github.com/vercel/next.js/blob/8d1c619ad650f5d147207f267441caf12acd91d1/packages/next/src/build/handle-externals.ts#L188 | ||
pub static NEVER_EXTERNAL_RE: LazyLock<Regex> = LazyLock::new(|| { | ||
Regex::new("^(?:private-next-pages\\/|next\\/(?:dist\\/pages\\/|(?:app|cache|document|link|form|head|image|legacy\\/image|constants|dynamic|script|navigation|headers|router|compat\\/router|server)$)|string-hash|private-next-rsc-action-validate|private-next-rsc-action-client-wrapper|private-next-rsc-server-reference|private-next-rsc-cache-wrapper|private-next-rsc-track-dynamic-import$)").unwrap() | ||
vercel[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
max_width = 100 | ||
|
||
comment_width = 100 | ||
wrap_comments = true | ||
|
||
tab_spaces = 4 | ||
hard_tabs = false | ||
|
||
format_strings = true | ||
use_field_init_shorthand = true | ||
|
||
imports_granularity = "Crate" | ||
group_imports = "StdExternalCrate" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.