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
c0864d92
Commit
c0864d92
authored
May 21, 2025
by
강동윤 (Donny)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JsEvaluator
parent
718ae832
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
project.rs
crates/napi/src/next_api/project.rs
+9
-6
project.rs
crates/next-api/src/project.rs
+10
-1
No files found.
crates/napi/src/next_api/project.rs
View file @
c0864d92
...
...
@@ -15,7 +15,7 @@ use next_api::{
RouteOperation
,
},
project
::{
DefineEnv
,
DraftModeOptions
,
PartialProjectOptions
,
Project
,
ProjectContainer
,
DefineEnv
,
DraftModeOptions
,
JsEvaluator
,
PartialProjectOptions
,
Project
,
ProjectContainer
,
ProjectOptions
,
WatchOptions
,
},
route
::
Endpoint
,
...
...
@@ -310,7 +310,6 @@ pub struct ProjectInstance {
turbo_tasks
:
NextTurboTasks
,
container
:
ResolvedVc
<
ProjectContainer
>
,
exit_receiver
:
tokio
::
sync
::
Mutex
<
Option
<
ExitReceiver
>>
,
worker
:
ThreadsafeFunction
<
String
>
,
}
#[napi(ts_return_type
=
"Promise<{ __napiType:
\
"
Project
\
" }>"
)]
...
...
@@ -429,10 +428,13 @@ pub async fn project_new(
.unwrap
();
});
}
let
worker
=
worker
.as_ref
()
.clone
()
.cell
();
let
options
:
ProjectOptions
=
options
.into
();
let
container
=
turbo_tasks
.run_once
(
async
move
{
let
project
=
ProjectContainer
::
new
(
"next.js"
.into
(),
options
.dev
);
let
project
=
ProjectContainer
::
new
(
"next.js"
.into
(),
options
.dev
,
Vc
::
upcast
(
worker
)
);
let
project
=
project
.to_resolved
()
.await
?
;
project
.initialize
(
options
)
.await
?
;
Ok
(
project
)
...
...
@@ -447,14 +449,11 @@ pub async fn project_new(
.inspect_err
(|
err
|
tracing
::
warn!
(
%
err
,
"failed to benchmark file IO"
))
});
let
worker
=
worker
.as_ref
()
.worker
.clone
();
Ok
(
External
::
new_with_size_hint
(
ProjectInstance
{
turbo_tasks
,
container
,
exit_receiver
:
tokio
::
sync
::
Mutex
::
new
(
Some
(
exit_receiver
)),
worker
,
},
100
,
))
...
...
@@ -1584,6 +1583,7 @@ pub fn project_get_source_map_sync(
}
#[turbo_tasks
::
value(serialization
=
"none"
,
eq
=
"manual"
)]
#[derive(Clone)]
pub
struct
JsWorker
{
#[turbo_tasks(debug_ignore,
trace_ignore)]
worker
:
ThreadsafeFunction
<
String
>
,
...
...
@@ -1595,6 +1595,9 @@ impl PartialEq for JsWorker {
}
}
#[turbo_tasks
::
value_impl]
impl
JsEvaluator
for
JsWorker
{}
#[js_function(
1
)]
pub
fn
new_js_worker
(
ctx
:
napi
::
CallContext
)
->
napi
::
Result
<
External
<
JsWorker
>>
{
let
worker
=
ctx
.get
::
<
JsFunction
>
(
0
)
?
;
...
...
crates/next-api/src/project.rs
View file @
c0864d92
...
...
@@ -261,12 +261,17 @@ pub struct ProjectContainer {
name
:
RcStr
,
options_state
:
State
<
Option
<
ProjectOptions
>>
,
versioned_content_map
:
Option
<
ResolvedVc
<
VersionedContentMap
>>
,
worker
:
ResolvedVc
<
Box
<
dyn
JsEvaluator
>>
,
}
#[turbo_tasks
::
value_impl]
impl
ProjectContainer
{
#[turbo_tasks
::
function]
pub
async
fn
new
(
name
:
RcStr
,
dev
:
bool
)
->
Result
<
Vc
<
Self
>>
{
pub
async
fn
new
(
name
:
RcStr
,
dev
:
bool
,
worker
:
ResolvedVc
<
Box
<
dyn
JsEvaluator
>>
,
)
->
Result
<
Vc
<
Self
>>
{
Ok
(
ProjectContainer
{
name
,
// we only need to enable versioning in dev mode, since build
...
...
@@ -277,6 +282,7 @@ impl ProjectContainer {
None
},
options_state
:
State
::
new
(
None
),
worker
,
}
.cell
())
}
...
...
@@ -1838,3 +1844,6 @@ async fn all_assets_from_entries_operation(
fn
stable_endpoint
(
endpoint
:
Vc
<
Box
<
dyn
Endpoint
>>
)
->
Vc
<
Box
<
dyn
Endpoint
>>
{
endpoint
}
#[turbo_tasks
::
value_trait]
pub
trait
JsEvaluator
{}
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