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
34ed0088
Commit
34ed0088
authored
Jun 09, 2023
by
Tobias Koppers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert ReferenceType to input type
parent
056ab791
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
48 additions
and
58 deletions
+48
-58
app_source.rs
packages/next-swc/crates/next-core/src/app_source.rs
+15
-15
bootstrap.rs
packages/next-swc/crates/next-core/src/bootstrap.rs
+4
-4
transition.rs
...s/next-swc/crates/next-core/src/next_client/transition.rs
+2
-3
server_to_client_transition.rs
.../src/next_client_component/server_to_client_transition.rs
+5
-10
next_config.rs
packages/next-swc/crates/next-core/src/next_config.rs
+3
-3
mod.rs
...ges/next-swc/crates/next-core/src/next_font/google/mod.rs
+1
-1
module.rs
packages/next-swc/crates/next-core/src/next_image/module.rs
+2
-2
page_loader.rs
packages/next-swc/crates/next-core/src/page_loader.rs
+4
-4
page_source.rs
packages/next-swc/crates/next-core/src/page_source.rs
+5
-5
router.rs
packages/next-swc/crates/next-core/src/router.rs
+5
-7
util.rs
packages/next-swc/crates/next-core/src/util.rs
+1
-3
web_entry_source.rs
packages/next-swc/crates/next-core/src/web_entry_source.rs
+1
-1
No files found.
packages/next-swc/crates/next-core/src/app_source.rs
View file @
34ed0088
...
...
@@ -878,9 +878,9 @@ import {}, {{ chunks as {} }} from "COMPONENT_{}";
format!
(
"COMPONENT_{i}"
),
state
.context
.with_transition
(
state
.rsc_transition
)
.process
(
SourceAssetVc
::
new
(
component
)
.into
(),
Value
::
new
(
ReferenceType
::
EcmaScriptModules
(
ReferenceType
::
EcmaScriptModules
(
EcmaScriptModulesReferenceSubType
::
Undefined
,
)
)
,
),
),
);
}
...
...
@@ -1004,7 +1004,7 @@ import {}, {{ chunks as {} }} from "COMPONENT_{}";
state
.context
.process
(
TextContentSourceAssetVc
::
new
(
SourceAssetVc
::
new
(
*
alt_path
)
.into
())
.into
(),
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
()
)),
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
(
)),
),
);
writeln!
(
state
.loader_tree_code
,
"{s} alt: {identifier},"
)
?
;
...
...
@@ -1122,28 +1122,28 @@ import {}, {{ chunks as {} }} from "COMPONENT_{}";
let
renderer_module
=
match
runtime
{
Some
(
NextRuntime
::
NodeJs
)
|
None
=>
context
.process
(
SourceAssetVc
::
new
(
next_js_file_path
(
"entry/app-renderer.tsx"
))
.into
(),
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
indexmap!
{
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
indexmap!
{
"APP_ENTRY"
.to_string
()
=>
context
.with_transition
(
rsc_transition
)
.process
(
asset
.into
(),
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
inner_assets
)
)),
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
inner_assets
)),
),
"APP_BOOTSTRAP"
.to_string
()
=>
context
.with_transition
(
"next-client"
)
.process
(
SourceAssetVc
::
new
(
next_js_file_path
(
"entry/app/hydrate.tsx"
))
.into
(),
Value
::
new
(
ReferenceType
::
EcmaScriptModules
(
ReferenceType
::
EcmaScriptModules
(
EcmaScriptModulesReferenceSubType
::
Undefined
,
)
)
,
),
),
}))
)
,
})),
),
Some
(
NextRuntime
::
Edge
)
=>
context
.process
(
SourceAssetVc
::
new
(
next_js_file_path
(
"entry/app-edge-renderer.tsx"
))
.into
(),
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
indexmap!
{
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
indexmap!
{
"INNER_EDGE_CHUNK_GROUP"
.to_string
()
=>
context
.with_transition
(
"next-edge-page"
)
.process
(
asset
.into
(),
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
inner_assets
)
)),
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
inner_assets
)),
),
}))
)
,
})),
)
};
...
...
@@ -1222,7 +1222,7 @@ impl AppRouteVc {
let
entry_source_asset
=
SourceAssetVc
::
new
(
this
.entry_path
);
let
entry_asset
=
this
.context
.process
(
entry_source_asset
.into
(),
Value
::
new
(
ReferenceType
::
Entry
(
EntryReferenceSubType
::
AppRoute
)
),
ReferenceType
::
Entry
(
EntryReferenceSubType
::
AppRoute
),
);
let
config
=
parse_segment_config_from_source
(
entry_asset
);
...
...
@@ -1243,14 +1243,14 @@ impl AppRouteVc {
let
entry
=
this
.context
.with_transition
(
"next-edge-route"
)
.process
(
entry_source_asset
.into
(),
Value
::
new
(
ReferenceType
::
Entry
(
EntryReferenceSubType
::
AppRoute
)
),
ReferenceType
::
Entry
(
EntryReferenceSubType
::
AppRoute
),
);
let
module
=
this
.context
.process
(
internal_asset
,
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
indexmap!
{
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
indexmap!
{
"ROUTE_CHUNK_GROUP"
.to_string
()
=>
entry
}))
)
,
})),
);
let
Some
(
module
)
=
EvaluatableAssetVc
::
resolve_from
(
module
)
.await
?
else
{
...
...
packages/next-swc/crates/next-core/src/bootstrap.rs
View file @
34ed0088
use
anyhow
::{
bail
,
Result
};
use
indexmap
::{
indexmap
,
IndexMap
};
use
turbo_tasks
::
{
Value
,
ValueToString
}
;
use
turbo_tasks
::
ValueToString
;
use
turbo_tasks_fs
::{
File
,
FileSystemPathVc
};
use
turbopack_binding
::
turbopack
::{
core
::{
...
...
@@ -38,7 +38,7 @@ pub async fn route_bootstrap(
"next/dist/server/future/route-modules/{}/module"
,
route_module_kind
)),
Value
::
new
(
EcmaScriptModulesReferenceSubType
::
Undefined
)
,
EcmaScriptModulesReferenceSubType
::
Undefined
,
OptionIssueSourceVc
::
none
(),
IssueSeverity
::
Error
.cell
(),
);
...
...
@@ -117,7 +117,7 @@ pub async fn bootstrap(
.into
(),
)
.as_asset
(),
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
()
)),
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
(
)),
);
let
mut
inner_assets
=
inner_assets
.await
?
.clone_value
();
...
...
@@ -126,7 +126,7 @@ pub async fn bootstrap(
let
asset
=
context
.process
(
bootstrap_asset
,
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
inner_assets
)
)),
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
inner_assets
)),
);
let
Some
(
asset
)
=
EvaluatableAssetVc
::
resolve_from
(
asset
)
.await
?
else
{
...
...
packages/next-swc/crates/next-core/src/next_client/transition.rs
View file @
34ed0088
use
anyhow
::{
bail
,
Result
};
use
indexmap
::
indexmap
;
use
turbo_tasks
::
Value
;
use
turbopack_binding
::
turbopack
::{
core
::{
asset
::
AssetVc
,
...
...
@@ -74,9 +73,9 @@ impl Transition for NextClientTransition {
context
.process
(
internal_asset
,
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
indexmap!
{
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
indexmap!
{
"PAGE"
.to_string
()
=>
asset
}))
)
,
})),
)
}
else
{
asset
...
...
packages/next-swc/crates/next-core/src/next_client_component/server_to_client_transition.rs
View file @
34ed0088
use
anyhow
::
Result
;
use
indexmap
::
indexmap
;
use
turbo_tasks
::
Value
;
use
turbopack_binding
::
turbopack
::{
core
::{
asset
::
AssetVc
,
...
...
@@ -27,7 +26,7 @@ impl Transition for NextServerToClientTransition {
self_vc
:
NextServerToClientTransitionVc
,
asset
:
AssetVc
,
context
:
ModuleAssetContextVc
,
_reference_type
:
Value
<
ReferenceType
>
,
_reference_type
:
ReferenceType
,
)
->
Result
<
AssetVc
>
{
let
internal_asset
=
next_asset
(
if
self_vc
.await
?
.ssr
{
"entry/app/server-to-client-ssr.tsx"
...
...
@@ -37,22 +36,18 @@ impl Transition for NextServerToClientTransition {
let
context
=
self_vc
.process_context
(
context
);
let
client_chunks
=
context
.with_transition
(
"next-client-chunks"
)
.process
(
asset
,
Value
::
new
(
ReferenceType
::
Entry
(
EntryReferenceSubType
::
AppClientComponent
,
)),
ReferenceType
::
Entry
(
EntryReferenceSubType
::
AppClientComponent
),
);
let
client_module
=
context
.with_transition
(
"next-ssr-client-module"
)
.process
(
asset
,
Value
::
new
(
ReferenceType
::
Entry
(
EntryReferenceSubType
::
AppClientComponent
,
)),
ReferenceType
::
Entry
(
EntryReferenceSubType
::
AppClientComponent
),
);
Ok
(
context
.process
(
internal_asset
,
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
indexmap!
{
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
indexmap!
{
"CLIENT_MODULE"
.to_string
()
=>
client_module
,
"CLIENT_CHUNKS"
.to_string
()
=>
client_chunks
,
}))
)
,
})),
))
}
}
packages/next-swc/crates/next-core/src/next_config.rs
View file @
34ed0088
...
...
@@ -5,7 +5,7 @@ use serde_json::Value as JsonValue;
use
turbo_tasks
::{
primitives
::{
BoolVc
,
JsonValueVc
,
StringVc
,
StringsVc
},
trace
::
TraceRawVcs
,
CompletionVc
,
Value
,
CompletionVc
,
};
use
turbo_tasks_fs
::
json
::
parse_json_with_source_context
;
use
turbopack_binding
::{
...
...
@@ -670,13 +670,13 @@ pub async fn load_next_config_internal(
// changes
let
config_asset
=
context
.process
(
config_asset
.into
(),
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
()
)),
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
(
)),
);
any_content_changed
(
config_asset
)
});
let
load_next_config_asset
=
context
.process
(
next_asset
(
"entry/config/next.js"
),
Value
::
new
(
ReferenceType
::
Entry
(
EntryReferenceSubType
::
Undefined
)
),
ReferenceType
::
Entry
(
EntryReferenceSubType
::
Undefined
),
);
let
config_value
=
evaluate
(
...
...
packages/next-swc/crates/next-core/src/next_font/google/mod.rs
View file @
34ed0088
...
...
@@ -451,7 +451,7 @@ async fn get_mock_stylesheet(
.into
(),
)
.into
(),
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
()
)),
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
(
)),
);
let
root
=
mock_fs
.root
();
...
...
packages/next-swc/crates/next-core/src/next_image/module.rs
View file @
34ed0088
...
...
@@ -53,9 +53,9 @@ impl StructuredImageModuleType {
}
.cell
()
.into
(),
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
indexmap!
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
indexmap!
(
"IMAGE"
.to_string
()
=>
static_asset
.into
()
)))
)
,
))),
)
}
}
...
...
packages/next-swc/crates/next-core/src/page_loader.rs
View file @
34ed0088
...
...
@@ -2,7 +2,7 @@ use std::io::Write;
use
anyhow
::{
bail
,
Result
};
use
indexmap
::
indexmap
;
use
turbo_tasks
::{
primitives
::
StringVc
,
TryJoinIterExt
,
Value
};
use
turbo_tasks
::{
primitives
::
StringVc
,
TryJoinIterExt
};
use
turbopack_binding
::{
turbo
::
tasks_fs
::{
rope
::
RopeBuilder
,
File
,
FileContent
,
FileSystemPathVc
},
turbopack
::{
...
...
@@ -88,11 +88,11 @@ impl PageLoaderAssetVc {
let
module
=
this
.client_context
.process
(
loader_entry_asset
,
Value
::
new
(
ReferenceType
::
Internal
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
indexmap!
{
"PAGE"
.to_string
()
=>
this
.client_context
.process
(
this
.entry_asset
,
Value
::
new
(
ReferenceType
::
Entry
(
EntryReferenceSubType
::
Page
)
))
"PAGE"
.to_string
()
=>
this
.client_context
.process
(
this
.entry_asset
,
ReferenceType
::
Entry
(
EntryReferenceSubType
::
Page
))
})
)
)
,
),
);
let
Some
(
module
)
=
EvaluatableAssetVc
::
resolve_from
(
module
)
.await
?
else
{
...
...
packages/next-swc/crates/next-core/src/page_source.rs
View file @
34ed0088
...
...
@@ -560,7 +560,7 @@ async fn create_not_found_page_source(
let
entry_asset
=
server_context
.process
(
page_asset
,
Value
::
new
(
ReferenceType
::
Entry
(
EntryReferenceSubType
::
Page
)
),
ReferenceType
::
Entry
(
EntryReferenceSubType
::
Page
),
);
let
ssr_entry
=
SsrEntry
{
...
...
@@ -779,7 +779,7 @@ impl SsrEntryVc {
let
this
=
self
.await
?
;
let
entry_asset_page
=
this
.context
.process
(
this
.entry_asset
,
Value
::
new
(
ReferenceType
::
Entry
(
EntryReferenceSubType
::
Page
)
),
ReferenceType
::
Entry
(
EntryReferenceSubType
::
Page
),
);
let
ty
=
if
this
.ty
==
SsrType
::
AutoApi
{
let
page_config
=
parse_config_from_source
(
entry_asset_page
);
...
...
@@ -803,7 +803,7 @@ impl SsrEntryVc {
let
entry_asset_edge_chunk_group
=
this
.context
.with_transition
(
"next-edge"
)
.process
(
this
.entry_asset
,
Value
::
new
(
ReferenceType
::
Entry
(
EntryReferenceSubType
::
PagesApi
)
),
ReferenceType
::
Entry
(
EntryReferenceSubType
::
PagesApi
),
);
(
next_asset
(
"entry/server-edge-api.tsx"
),
...
...
@@ -822,7 +822,7 @@ impl SsrEntryVc {
let
entry_asset_client_chunk_group
=
this
.context
.with_transition
(
"next-client"
)
.process
(
this
.entry_asset
,
Value
::
new
(
ReferenceType
::
Entry
(
EntryReferenceSubType
::
Page
)
),
ReferenceType
::
Entry
(
EntryReferenceSubType
::
Page
),
);
(
next_asset
(
"entry/server-renderer.tsx"
),
...
...
@@ -836,7 +836,7 @@ impl SsrEntryVc {
let
module
=
this
.context
.process
(
internal_asset
,
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
inner_assets
)
)),
ReferenceType
::
Internal
(
InnerAssetsVc
::
cell
(
inner_assets
)),
);
let
Some
(
module
)
=
EvaluatableAssetVc
::
resolve_from
(
module
)
.await
?
else
{
bail!
(
"internal module must be evaluatable"
);
...
...
packages/next-swc/crates/next-core/src/router.rs
View file @
34ed0088
...
...
@@ -147,7 +147,7 @@ async fn get_config(
let
config_asset
=
match
&*
find_config_result
.await
?
{
FindContextFileResult
::
Found
(
config_path
,
_
)
=>
Some
(
context
.process
(
SourceAssetVc
::
new
(
*
config_path
)
.as_asset
(),
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
()
)),
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
(
)),
)),
FindContextFileResult
::
NotFound
(
_
)
=>
None
,
};
...
...
@@ -184,9 +184,7 @@ async fn config_assets(
Some
(
c
)
=>
{
let
manifest
=
context
.with_transition
(
"next-edge"
)
.process
(
*
c
,
Value
::
new
(
ReferenceType
::
EcmaScriptModules
(
EcmaScriptModulesReferenceSubType
::
Undefined
,
)),
ReferenceType
::
EcmaScriptModules
(
EcmaScriptModulesReferenceSubType
::
Undefined
),
);
let
config
=
parse_config_from_source
(
*
c
);
(
manifest
,
config
)
...
...
@@ -198,7 +196,7 @@ async fn config_assets(
File
::
from
(
"export default [];"
)
.into
(),
)
.as_asset
(),
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
()
)),
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
(
)),
);
let
config
=
NextSourceConfigVc
::
default
();
(
manifest
,
config
)
...
...
@@ -215,7 +213,7 @@ async fn config_assets(
.into
(),
)
.as_asset
(),
Value
::
new
(
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
()
)),
ReferenceType
::
Internal
(
InnerAssetsVc
::
empty
(
)),
);
Ok
(
InnerAssetsVc
::
cell
(
indexmap!
{
...
...
@@ -228,7 +226,7 @@ async fn config_assets(
fn
route_executor
(
context
:
AssetContextVc
,
configs
:
InnerAssetsVc
)
->
AssetVc
{
context
.process
(
next_asset
(
"entry/router.ts"
),
Value
::
new
(
ReferenceType
::
Internal
(
configs
)
),
ReferenceType
::
Internal
(
configs
),
)
}
...
...
packages/next-swc/crates/next-core/src/util.rs
View file @
34ed0088
...
...
@@ -324,9 +324,7 @@ pub async fn load_next_json<T: DeserializeOwned>(
let
resolve_result
=
handle_resolve_error
(
resolve
::
resolve
(
context
,
request
,
resolve_options
),
Value
::
new
(
ReferenceType
::
EcmaScriptModules
(
EcmaScriptModulesReferenceSubType
::
Undefined
,
)),
ReferenceType
::
EcmaScriptModules
(
EcmaScriptModulesReferenceSubType
::
Undefined
),
context
,
request
,
resolve_options
,
...
...
packages/next-swc/crates/next-core/src/web_entry_source.rs
View file @
34ed0088
...
...
@@ -146,7 +146,7 @@ pub async fn create_web_entry_source(
let
entries
=
entry_requests
.into_iter
()
.map
(|
request
|
async
move
{
let
ty
=
Value
::
new
(
ReferenceType
::
Entry
(
EntryReferenceSubType
::
Web
)
);
let
ty
=
ReferenceType
::
Entry
(
EntryReferenceSubType
::
Web
);
Ok
(
origin
.resolve_asset
(
request
,
origin
.resolve_options
(
ty
.clone
()),
ty
)
.primary_assets
()
...
...
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