Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
b2706db1
Commit
b2706db1
authored
Dec 10, 2025
by
JJ Kasper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lock binaries
parent
3eaf68b0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
677 additions
and
676 deletions
+677
-676
build_and_deploy.yml
.github/workflows/build_and_deploy.yml
+561
-561
index.ts
packages/next/src/build/swc/index.ts
+2
-1
publish-native.js
scripts/publish-native.js
+114
-114
No files found.
.github/workflows/build_and_deploy.yml
View file @
b2706db1
This diff is collapsed.
Click to expand it.
packages/next/src/build/swc/index.ts
View file @
b2706db1
...
...
@@ -48,7 +48,8 @@ type RawWasmBindings = typeof import('./generated-wasm') & {
default
?():
Promise
<
typeof
import
(
'./generated-wasm'
)
>
}
const
nextVersion
=
process
.
env
.
__NEXT_VERSION
as
string
// locked version as binaries are locked
const
nextVersion
=
'15.5.7'
const
ArchName
=
arch
()
const
PlatformName
=
platform
()
...
...
scripts/publish-native.js
View file @
b2706db1
#!/usr/bin/env node
const
path
=
require
(
'path'
)
const
execa
=
require
(
'execa'
)
const
{
Sema
}
=
require
(
'async-sema'
)
const
{
readFile
,
readdir
,
writeFile
,
cp
}
=
require
(
'fs/promises'
)
//
const execa = require('execa')
//
const { Sema } = require('async-sema')
const
{
readFile
,
readdir
,
writeFile
}
=
require
(
'fs/promises'
)
const
cwd
=
process
.
cwd
()
;(
async
function
()
{
try
{
const
publishSema
=
new
Sema
(
2
)
//
const publishSema = new Sema(2)
let
version
=
require
(
'@next/swc/package.json'
).
version
let
version
=
'15.5.7'
// Copy binaries to package folders, update version, and publish
let
nativePackagesDir
=
path
.
join
(
cwd
,
'crates/napi/npm'
)
...
...
@@ -19,118 +19,118 @@ const cwd = process.cwd()
(
name
)
=>
!
name
.
startsWith
(
'.'
)
)
await
Promise
.
all
(
platforms
.
map
(
async
(
platform
)
=>
{
await
publishSema
.
acquire
()
let
output
=
''
//
await Promise.all(
//
platforms.map(async (platform) => {
//
await publishSema.acquire()
//
let output = ''
try
{
let
binaryName
=
`next-swc.
${
platform
}
.node`
await
cp
(
path
.
join
(
cwd
,
'packages/next-swc/native'
,
binaryName
),
path
.
join
(
nativePackagesDir
,
platform
,
binaryName
)
)
let
pkg
=
JSON
.
parse
(
await
readFile
(
path
.
join
(
nativePackagesDir
,
platform
,
'package.json'
)
)
)
pkg
.
version
=
version
await
writeFile
(
path
.
join
(
nativePackagesDir
,
platform
,
'package.json'
),
JSON
.
stringify
(
pkg
,
null
,
2
)
)
const
child
=
execa
(
`npm`
,
[
`publish`
,
`
${
path
.
join
(
nativePackagesDir
,
platform
)}
`
,
`--access`
,
`public`
,
...(
version
.
includes
(
'canary'
)
?
[
'--tag'
,
'canary'
]
:
[
'--tag'
,
'next-15-5'
]),
],
{
stdio
:
'inherit'
}
)
const
handleData
=
(
type
)
=>
(
chunk
)
=>
{
process
[
type
].
write
(
chunk
)
output
+=
chunk
.
toString
()
}
child
.
stdout
?.
on
(
'data'
,
handleData
(
'stdout'
))
child
.
stderr
?.
on
(
'data'
,
handleData
(
'stderr'
))
await
child
}
catch
(
err
)
{
// don't block publishing other versions on single platform error
console
.
error
(
`Failed to publish`
,
platform
,
err
)
//
try {
//
let binaryName = `next-swc.${platform}.node`
//
await cp(
//
path.join(cwd, 'packages/next-swc/native', binaryName),
//
path.join(nativePackagesDir, platform, binaryName)
//
)
//
let pkg = JSON.parse(
//
await readFile(
//
path.join(nativePackagesDir, platform, 'package.json')
//
)
//
)
//
pkg.version = version
//
await writeFile(
//
path.join(nativePackagesDir, platform, 'package.json'),
//
JSON.stringify(pkg, null, 2)
//
)
//
const child = execa(
//
`npm`,
//
[
//
`publish`,
//
`${path.join(nativePackagesDir, platform)}`,
//
`--access`,
//
`public`,
//
...(version.includes('canary')
//
? ['--tag', 'canary']
//
: ['--tag', 'next-15-5']),
//
],
//
{ stdio: 'inherit' }
//
)
//
const handleData = (type) => (chunk) => {
//
process[type].write(chunk)
//
output += chunk.toString()
//
}
//
child.stdout?.on('data', handleData('stdout'))
//
child.stderr?.on('data', handleData('stderr'))
//
await child
//
} catch (err) {
//
// don't block publishing other versions on single platform error
//
console.error(`Failed to publish`, platform, err)
if
(
output
.
includes
(
'cannot publish over the previously published versions'
)
)
{
console
.
error
(
'Ignoring already published error'
,
platform
,
err
)
}
else
{
// throw err
}
}
finally
{
publishSema
.
release
()
}
})
)
//
if (
//
output.includes(
//
'cannot publish over the previously published versions'
//
)
//
) {
//
console.error('Ignoring already published error', platform, err)
//
} else {
//
// throw err
//
}
//
} finally {
//
publishSema.release()
//
}
//
})
//
)
// Update name/version of wasm packages and publish
const
pkgDirectory
=
'crates/wasm'
let
wasmDir
=
path
.
join
(
cwd
,
pkgDirectory
)
await
Promise
.
all
(
[
'web'
,
'nodejs'
].
map
(
async
(
wasmTarget
)
=>
{
await
publishSema
.
acquire
()
let
wasmPkg
=
JSON
.
parse
(
await
readFile
(
path
.
join
(
wasmDir
,
`pkg-
${
wasmTarget
}
/package.json`
))
)
wasmPkg
.
name
=
`@next/swc-wasm-
${
wasmTarget
}
`
wasmPkg
.
version
=
version
wasmPkg
.
repository
=
{
type
:
'git'
,
url
:
'https://github.com/vercel/next.js'
,
directory
:
pkgDirectory
,
}
await
writeFile
(
path
.
join
(
wasmDir
,
`pkg-
${
wasmTarget
}
/package.json`
),
JSON
.
stringify
(
wasmPkg
,
null
,
2
)
)
try
{
await
execa
(
`npm`
,
[
'publish'
,
`
${
path
.
join
(
wasmDir
,
`pkg-
${
wasmTarget
}
`
)}
`
,
'--access'
,
'public'
,
...(
version
.
includes
(
'canary'
)
?
[
'--tag'
,
'canary'
]
:
[
'--tag'
,
'next-15-5'
]),
],
{
stdio
:
'inherit'
}
)
}
catch
(
err
)
{
// don't block publishing other versions on single platform error
console
.
error
(
`Failed to publish`
,
wasmTarget
,
err
)
if
(
err
.
message
&&
err
.
message
.
includes
(
'You cannot publish over the previously published versions'
)
)
{
console
.
error
(
'Ignoring already published error'
,
wasmTarget
)
}
else
{
// throw err
}
}
finally
{
publishSema
.
release
()
}
})
)
//
//
Update name/version of wasm packages and publish
//
const pkgDirectory = 'crates/wasm'
//
let wasmDir = path.join(cwd, pkgDirectory)
//
await Promise.all(
//
['web', 'nodejs'].map(async (wasmTarget) => {
//
await publishSema.acquire()
//
let wasmPkg = JSON.parse(
//
await readFile(path.join(wasmDir, `pkg-${wasmTarget}/package.json`))
//
)
//
wasmPkg.name = `@next/swc-wasm-${wasmTarget}`
//
wasmPkg.version = version
//
wasmPkg.repository = {
//
type: 'git',
//
url: 'https://github.com/vercel/next.js',
//
directory: pkgDirectory,
//
}
//
await writeFile(
//
path.join(wasmDir, `pkg-${wasmTarget}/package.json`),
//
JSON.stringify(wasmPkg, null, 2)
//
)
//
try {
//
await execa(
//
`npm`,
//
[
//
'publish',
//
`${path.join(wasmDir, `pkg-${wasmTarget}`)}`,
//
'--access',
//
'public',
//
...(version.includes('canary')
//
? ['--tag', 'canary']
//
: ['--tag', 'next-15-5']),
//
],
//
{ stdio: 'inherit' }
//
)
//
} catch (err) {
//
// don't block publishing other versions on single platform error
//
console.error(`Failed to publish`, wasmTarget, err)
//
if (
//
err.message &&
//
err.message.includes(
//
'You cannot publish over the previously published versions'
//
)
//
) {
//
console.error('Ignoring already published error', wasmTarget)
//
} else {
//
// throw err
//
}
//
} finally {
//
publishSema.release()
//
}
//
})
//
)
// Update optional dependencies versions
let
nextPkg
=
JSON
.
parse
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment