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
bc4b72df
Unverified
Commit
bc4b72df
authored
Jun 03, 2025
by
Jiachi Liu
Committed by
GitHub
Jun 03, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[devtool] fix explorer flag consuming and style (#80110)
parent
81ab1ffc
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
9 deletions
+45
-9
app-page.ts
packages/next/src/build/templates/app-page.ts
+2
-0
dev-tools-indicator.tsx
...onents/errors/dev-tools-indicator/dev-tools-indicator.tsx
+1
-1
segment-explorer.tsx
...t-dev-overlay/ui/components/overview/segment-explorer.tsx
+5
-6
create-component-tree.tsx
...ages/next/src/server/app-render/create-component-tree.tsx
+3
-2
segment-explorer.test.ts
...lopment/app-dir/segment-explorer/segment-explorer.test.ts
+34
-0
No files found.
packages/next/src/build/templates/app-page.ts
View file @
bc4b72df
...
@@ -369,6 +369,8 @@ export async function handler(
...
@@ -369,6 +369,8 @@ export async function handler(
enableTainting
:
nextConfig
.
experimental
.
taint
,
enableTainting
:
nextConfig
.
experimental
.
taint
,
// @ts-expect-error fix issue with readonly regex object type
// @ts-expect-error fix issue with readonly regex object type
htmlLimitedBots
:
nextConfig
.
htmlLimitedBots
,
htmlLimitedBots
:
nextConfig
.
htmlLimitedBots
,
devtoolSegmentExplorer
:
nextConfig
.
experimental
.
devtoolSegmentExplorer
,
reactMaxHeadersLength
:
nextConfig
.
reactMaxHeadersLength
,
reactMaxHeadersLength
:
nextConfig
.
reactMaxHeadersLength
,
multiZoneDraftMode
,
multiZoneDraftMode
,
...
...
packages/next/src/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.tsx
View file @
bc4b72df
...
@@ -409,7 +409,7 @@ function DevToolsPopover({
...
@@ -409,7 +409,7 @@ function DevToolsPopover({
/>
/>
{
process
.
env
.
__NEXT_DEVTOOL_SEGMENT_EXPLORER
?
(
{
process
.
env
.
__NEXT_DEVTOOL_SEGMENT_EXPLORER
?
(
<
MenuItem
<
MenuItem
data
-
rendered
-
files
data
-
segment
-
explorer
label=
"Segment Explorer"
label=
"Segment Explorer"
value=
{
<
ChevronRight
/>
}
value=
{
<
ChevronRight
/>
}
onClick=
{
()
=>
setOpen
(
OVERLAYS
.
SegmentExplorer
)
}
onClick=
{
()
=>
setOpen
(
OVERLAYS
.
SegmentExplorer
)
}
...
...
packages/next/src/client/components/react-dev-overlay/ui/components/overview/segment-explorer.tsx
View file @
bc4b72df
...
@@ -54,7 +54,10 @@ function PageSegmentTree({ tree }: { tree: Trie<SegmentNode> | undefined }) {
...
@@ -54,7 +54,10 @@ function PageSegmentTree({ tree }: { tree: Trie<SegmentNode> | undefined }) {
return
null
return
null
}
}
return
(
return
(
<
div
className=
"segment-explorer-content"
>
<
div
className=
"segment-explorer-content"
data
-
nextjs
-
devtool
-
segment
-
explorer
>
<
PageSegmentTreeLayerPresentation
<
PageSegmentTreeLayerPresentation
tree=
{
tree
}
tree=
{
tree
}
node=
{
tree
.
getRoot
()
}
node=
{
tree
.
getRoot
()
}
...
@@ -147,11 +150,6 @@ export const DEV_TOOLS_INFO_RENDER_FILES_STYLES = css`
...
@@ -147,11 +150,6 @@ export const DEV_TOOLS_INFO_RENDER_FILES_STYLES = css`
.segment-explorer-filename-path {
.segment-explorer-filename-path {
display: inline-block;
display: inline-block;
&:hover {
color: var(--color-gray-1000);
text-decoration: none;
}
}
}
.segment-explorer-filename-path a {
.segment-explorer-filename-path a {
...
@@ -161,6 +159,7 @@ export const DEV_TOOLS_INFO_RENDER_FILES_STYLES = css`
...
@@ -161,6 +159,7 @@ export const DEV_TOOLS_INFO_RENDER_FILES_STYLES = css`
.segment-explorer-line {
.segment-explorer-line {
white-space: pre;
white-space: pre;
cursor: default;
}
}
.segment-explorer-line-icon {
.segment-explorer-line-icon {
...
...
packages/next/src/server/app-render/create-component-tree.tsx
View file @
bc4b72df
...
@@ -1014,12 +1014,13 @@ function normalizePageOrLayoutFilePath(
...
@@ -1014,12 +1014,13 @@ function normalizePageOrLayoutFilePath(
projectDir
:
string
,
projectDir
:
string
,
layoutOrPagePath
:
string
|
undefined
layoutOrPagePath
:
string
|
undefined
)
{
)
{
const
dir
=
projectDir
/*ctx.renderOpts.dir*/
||
process
.
cwd
()
const
relativePath
=
(
layoutOrPagePath
||
''
)
const
relativePath
=
(
layoutOrPagePath
||
''
)
// remove turbopack [project] prefix
// remove turbopack [project] prefix
.
replace
(
/^
\[
project
\][\\/]
/
,
''
)
.
replace
(
/^
\[
project
\][\\/]
/
,
''
)
// remove the process.cwd() prefix
.
replace
(
process
.
cwd
()
+
'/'
,
''
)
// remove the project root from the path
// remove the project root from the path
.
replace
(
d
ir
,
''
)
.
replace
(
projectD
ir
,
''
)
// remove /(src/)?app/ dir prefix
// remove /(src/)?app/ dir prefix
.
replace
(
/^
[\\/](
src
[\\/])?
app
[\\/]
/
,
''
)
.
replace
(
/^
[\\/](
src
[\\/])?
app
[\\/]
/
,
''
)
...
...
test/development/app-dir/segment-explorer/segment-explorer.test.ts
0 → 100644
View file @
bc4b72df
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
openDevToolsIndicatorPopover
}
from
'next-test-utils'
describe
(
'segment-explorer'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
files
:
__dirname
,
})
it
(
'should render the segment explorer'
,
async
()
=>
{
const
browser
=
await
next
.
browser
(
'/parallel-routes'
)
// open the devtool button
await
openDevToolsIndicatorPopover
(
browser
)
// open the segment explorer
await
browser
.
elementByCss
(
'[data-segment-explorer]'
).
click
()
// wait for the segment explorer to be visible
await
browser
.
waitForElementByCss
(
'[data-nextjs-devtool-segment-explorer]'
)
const
content
=
await
browser
.
elementByCss
(
'[data-nextjs-devtool-segment-explorer]'
)
expect
(
await
content
.
text
()).
toMatchInlineSnapshot
(
`
"app/parallel-routes/page.tsx
app/parallel-routes/@foo/page.tsx
app/parallel-routes/@foo/layout.tsx
app/parallel-routes/@bar/page.tsx
app/parallel-routes/@bar/layout.tsx
app/parallel-routes/layout.tsx
app/layout.tsx"
`
)
})
})
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