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
6e3ef5b0
Unverified
Commit
6e3ef5b0
authored
Sep 08, 2023
by
Leah
Committed by
GitHub
Sep 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support expanding urls in nexturbo (and fix static files) (#55147)
Closes WEB-1525
parent
d61c6ba4
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
10 deletions
+31
-10
project.rs
packages/next-swc/crates/napi/src/next_api/project.rs
+4
-0
project.rs
packages/next-swc/crates/next-api/src/project.rs
+16
-8
context.rs
...ages/next-swc/crates/next-core/src/next_server/context.rs
+1
-1
index.ts
packages/next/src/build/swc/index.ts
+6
-1
router-server.ts
packages/next/src/server/lib/router-server.ts
+1
-0
setup-dev.ts
packages/next/src/server/lib/router-utils/setup-dev.ts
+2
-0
next-rs-api.test.ts
test/development/basic/next-rs-api.test.ts
+1
-0
No files found.
packages/next-swc/crates/napi/src/next_api/project.rs
View file @
6e3ef5b0
...
@@ -69,6 +69,9 @@ pub struct NapiProjectOptions {
...
@@ -69,6 +69,9 @@ pub struct NapiProjectOptions {
/// A map of environment variables to use when compiling code.
/// A map of environment variables to use when compiling code.
pub
env
:
Vec
<
NapiEnvVar
>
,
pub
env
:
Vec
<
NapiEnvVar
>
,
/// The address of the dev server.
pub
server_addr
:
String
,
}
}
#[napi(object)]
#[napi(object)]
...
@@ -90,6 +93,7 @@ impl From<NapiProjectOptions> for ProjectOptions {
...
@@ -90,6 +93,7 @@ impl From<NapiProjectOptions> for ProjectOptions {
.into_iter
()
.into_iter
()
.map
(|
NapiEnvVar
{
name
,
value
}|
(
name
,
value
))
.map
(|
NapiEnvVar
{
name
,
value
}|
(
name
,
value
))
.collect
(),
.collect
(),
server_addr
:
val
.server_addr
,
}
}
}
}
}
}
...
...
packages/next-swc/crates/next-api/src/project.rs
View file @
6e3ef5b0
use
std
::
path
::
MAIN_SEPARATOR
;
use
std
::
{
net
::
SocketAddr
,
path
::
MAIN_SEPARATOR
}
;
use
anyhow
::
Result
;
use
anyhow
::
Result
;
use
indexmap
::{
map
::
Entry
,
IndexMap
};
use
indexmap
::{
map
::
Entry
,
IndexMap
};
...
@@ -81,6 +81,9 @@ pub struct ProjectOptions {
...
@@ -81,6 +81,9 @@ pub struct ProjectOptions {
/// Whether to watch the filesystem for file changes.
/// Whether to watch the filesystem for file changes.
pub
watch
:
bool
,
pub
watch
:
bool
,
/// The address of the dev server.
pub
server_addr
:
String
,
}
}
#[derive(Serialize,
Deserialize,
TraceRawVcs,
PartialEq,
Eq,
ValueDebugFormat)]
#[derive(Serialize,
Deserialize,
TraceRawVcs,
PartialEq,
Eq,
ValueDebugFormat)]
...
@@ -122,6 +125,7 @@ impl ProjectContainer {
...
@@ -122,6 +125,7 @@ impl ProjectContainer {
root_path
:
options
.root_path
.clone
(),
root_path
:
options
.root_path
.clone
(),
project_path
:
options
.project_path
.clone
(),
project_path
:
options
.project_path
.clone
(),
watch
:
options
.watch
,
watch
:
options
.watch
,
server_addr
:
options
.server_addr
.parse
()
?
,
next_config
,
next_config
,
js_config
,
js_config
,
env
:
Vc
::
upcast
(
env
),
env
:
Vc
::
upcast
(
env
),
...
@@ -159,6 +163,10 @@ pub struct Project {
...
@@ -159,6 +163,10 @@ pub struct Project {
/// Whether to watch the filesystem for file changes.
/// Whether to watch the filesystem for file changes.
watch
:
bool
,
watch
:
bool
,
/// The address of the dev server.
#[turbo_tasks(trace_ignore)]
server_addr
:
SocketAddr
,
/// Next config.
/// Next config.
next_config
:
Vc
<
NextConfig
>
,
next_config
:
Vc
<
NextConfig
>
,
...
@@ -222,6 +230,11 @@ impl Project {
...
@@ -222,6 +230,11 @@ impl Project {
Ok
(
Vc
::
upcast
(
disk_fs
))
Ok
(
Vc
::
upcast
(
disk_fs
))
}
}
#[turbo_tasks
::
function]
fn
server_addr
(
&
self
)
->
Vc
<
ServerAddr
>
{
ServerAddr
::
new
(
self
.server_addr
)
.cell
()
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
pub
(
super
)
fn
node_root
(
self
:
Vc
<
Self
>
)
->
Vc
<
FileSystemPath
>
{
pub
(
super
)
fn
node_root
(
self
:
Vc
<
Self
>
)
->
Vc
<
FileSystemPath
>
{
self
.node_fs
()
.root
()
.join
(
".next"
.to_string
())
self
.node_fs
()
.root
()
.join
(
".next"
.to_string
())
...
@@ -302,18 +315,13 @@ impl Project {
...
@@ -302,18 +315,13 @@ impl Project {
Ok
(
get_server_compile_time_info
(
Ok
(
get_server_compile_time_info
(
this
.mode
,
this
.mode
,
self
.env
(),
self
.env
(),
// TODO(alexkirsz) Fill this out.
self
.server_addr
(),
ServerAddr
::
empty
(),
))
))
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
pub
(
super
)
fn
edge_compile_time_info
(
self
:
Vc
<
Self
>
)
->
Vc
<
CompileTimeInfo
>
{
pub
(
super
)
fn
edge_compile_time_info
(
self
:
Vc
<
Self
>
)
->
Vc
<
CompileTimeInfo
>
{
get_edge_compile_time_info
(
get_edge_compile_time_info
(
self
.project_path
(),
self
.server_addr
())
self
.project_path
(),
// TODO(alexkirsz) Fill this out.
ServerAddr
::
empty
(),
)
}
}
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
...
...
packages/next-swc/crates/next-core/src/next_server/context.rs
View file @
6e3ef5b0
...
@@ -604,7 +604,7 @@ pub fn get_server_chunking_context(
...
@@ -604,7 +604,7 @@ pub fn get_server_chunking_context(
project_path
,
project_path
,
node_root
,
node_root
,
node_root
.join
(
"server/chunks"
.to_string
()),
node_root
.join
(
"server/chunks"
.to_string
()),
client_root
.join
(
"static/media"
.to_string
()),
client_root
.join
(
"
_next/
static/media"
.to_string
()),
environment
,
environment
,
)
)
.minify_type
(
MinifyType
::
NoMinify
)
.minify_type
(
MinifyType
::
NoMinify
)
...
...
packages/next/src/build/swc/index.ts
View file @
6e3ef5b0
...
@@ -399,9 +399,14 @@ interface ProjectOptions {
...
@@ -399,9 +399,14 @@ interface ProjectOptions {
env
:
Record
<
string
,
string
>
env
:
Record
<
string
,
string
>
/**
/**
* Whether to watch he filesystem for file changes.
* Whether to watch
t
he filesystem for file changes.
*/
*/
watch
:
boolean
watch
:
boolean
/**
* The address of the dev server.
*/
serverAddr
:
string
}
}
interface
TurboEngineOptions
{
interface
TurboEngineOptions
{
...
...
packages/next/src/server/lib/router-server.ts
View file @
6e3ef5b0
...
@@ -124,6 +124,7 @@ export async function initialize(opts: {
...
@@ -124,6 +124,7 @@ export async function initialize(opts: {
nextConfig
:
config
,
nextConfig
:
config
,
isCustomServer
:
opts
.
customServer
,
isCustomServer
:
opts
.
customServer
,
turbo
:
!!
process
.
env
.
TURBOPACK
,
turbo
:
!!
process
.
env
.
TURBOPACK
,
port
:
opts
.
port
,
})
})
}
}
...
...
packages/next/src/server/lib/router-utils/setup-dev.ts
View file @
6e3ef5b0
...
@@ -119,6 +119,7 @@ type SetupOpts = {
...
@@ -119,6 +119,7 @@ type SetupOpts = {
ReturnType
<
typeof
import
(
'./filesystem'
).
setupFsCheck
>
ReturnType
<
typeof
import
(
'./filesystem'
).
setupFsCheck
>
>
>
nextConfig
:
NextConfigComplete
nextConfig
:
NextConfigComplete
port
:
number
}
}
async
function
verifyTypeScript
(
opts
:
SetupOpts
)
{
async
function
verifyTypeScript
(
opts
:
SetupOpts
)
{
...
@@ -203,6 +204,7 @@ async function startWatcher(opts: SetupOpts) {
...
@@ -203,6 +204,7 @@ async function startWatcher(opts: SetupOpts) {
jsConfig
,
jsConfig
,
watch
:
true
,
watch
:
true
,
env
:
process
.
env
as
Record
<
string
,
string
>
,
env
:
process
.
env
as
Record
<
string
,
string
>
,
serverAddr
:
`127.0.0.1:
${
opts
.
port
}
`
,
})
})
const
iter
=
project
.
entrypointsSubscribe
()
const
iter
=
project
.
entrypointsSubscribe
()
const
curEntries
:
Map
<
string
,
Route
>
=
new
Map
()
const
curEntries
:
Map
<
string
,
Route
>
=
new
Map
()
...
...
test/development/basic/next-rs-api.test.ts
View file @
6e3ef5b0
...
@@ -172,6 +172,7 @@ describe('next.rs api', () => {
...
@@ -172,6 +172,7 @@ describe('next.rs api', () => {
?
path
.
resolve
(
__dirname
,
'../../..'
)
?
path
.
resolve
(
__dirname
,
'../../..'
)
:
next
.
testDir
,
:
next
.
testDir
,
watch
:
true
,
watch
:
true
,
serverAddr
:
`127.0.0.1:3000`
,
})
})
projectUpdateSubscription
=
project
.
updateInfoSubscribe
()
projectUpdateSubscription
=
project
.
updateInfoSubscribe
()
})
})
...
...
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