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
eea3f34b
Unverified
Commit
eea3f34b
authored
May 02, 2023
by
lijianan
Committed by
GitHub
May 02, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: use includes replace indexOf (#48901)
use includes replace indexOf
parent
7b2c79d8
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
17 additions
and
17 deletions
+17
-17
preview.ts
examples/cms-agilitycms/lib/preview.ts
+1
-1
cli.ts
packages/next-codemod/bin/cli.ts
+1
-1
maintain--tab-focus.ts
...verlay/internal/components/Overlay/maintain--tab-focus.ts
+1
-1
hot-reloader-client.tsx
...ient/components/react-dev-overlay/hot-reloader-client.tsx
+2
-2
format-webpack-messages.ts
...t/src/client/dev/error-overlay/format-webpack-messages.ts
+1
-1
hot-dev-client.ts
packages/next/src/client/dev/error-overlay/hot-dev-client.ts
+1
-1
on-demand-entries-client.ts
packages/next/src/client/dev/on-demand-entries-client.ts
+1
-1
next-dev.ts
packages/next/src/client/next-dev.ts
+3
-3
loadable.tsx
packages/next/src/shared/lib/loadable.tsx
+1
-1
format-url.ts
packages/next/src/shared/lib/router/utils/format-url.ts
+1
-1
launchEditor.ts
...es/react-dev-overlay/src/internal/helpers/launchEditor.ts
+3
-3
next-webdriver.ts
test/lib/next-webdriver.ts
+1
-1
No files found.
examples/cms-agilitycms/lib/preview.ts
View file @
eea3f34b
...
...
@@ -88,7 +88,7 @@ export async function validatePreview({ agilityPreviewKey, slug, contentID }) {
}
//sanitize incoming key (replace spaces with '+')
if
(
agilityPreviewKey
.
in
dexOf
(
` `
)
>
-
1
)
{
if
(
agilityPreviewKey
.
in
cludes
(
` `
)
)
{
agilityPreviewKey
=
agilityPreviewKey
.
split
(
` `
).
join
(
`+`
)
}
...
...
packages/next-codemod/bin/cli.ts
View file @
eea3f34b
...
...
@@ -27,7 +27,7 @@ export function checkGitStatus(force) {
clean
=
isGitClean
.
sync
(
process
.
cwd
())
errorMessage
=
'Git directory is not clean'
}
catch
(
err
)
{
if
(
err
&&
err
.
stderr
&&
err
.
stderr
.
in
dexOf
(
'Not a git repository'
)
>=
0
)
{
if
(
err
&&
err
.
stderr
&&
err
.
stderr
.
in
cludes
(
'Not a git repository'
)
)
{
clean
=
true
}
}
...
...
packages/next-swc/crates/next-core/js/src/overlay/internal/components/Overlay/maintain--tab-focus.ts
View file @
eea3f34b
...
...
@@ -1136,7 +1136,7 @@ function isUserModifyWritable(style) {
// https://www.w3.org/TR/1999/WD-css3-userint-19990916#user-modify
// https://github.com/medialize/ally.js/issues/17
var
userModify
=
style
.
webkitUserModify
||
''
return
Boolean
(
userModify
&&
userModify
.
in
dexOf
(
'write'
)
!==
-
1
)
return
Boolean
(
userModify
&&
userModify
.
in
cludes
(
'write'
)
)
}
function
hasCssOverflowScroll
(
style
)
{
...
...
packages/next/src/client/components/react-dev-overlay/hot-reloader-client.tsx
View file @
eea3f34b
...
...
@@ -469,9 +469,9 @@ export default function HotReload({
useEffect
(()
=>
{
const
handler
=
(
event
:
MessageEvent
<
PongEvent
>
)
=>
{
if
(
event
.
data
.
indexOf
(
'action'
)
===
-
1
&&
!
event
.
data
.
includes
(
'action'
)
&&
// TODO-APP: clean this up for consistency
event
.
data
.
indexOf
(
'pong'
)
===
-
1
!
event
.
data
.
includes
(
'pong'
)
)
{
return
}
...
...
packages/next/src/client/dev/error-overlay/format-webpack-messages.ts
View file @
eea3f34b
...
...
@@ -31,7 +31,7 @@ const WEBPACK_BREAKING_CHANGE_POLYFILLS =
'
\
n
\
nBREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.'
function
isLikelyASyntaxError
(
message
:
string
)
{
return
stripAnsi
(
message
).
in
dexOf
(
friendlySyntaxErrorLabel
)
!==
-
1
return
stripAnsi
(
message
).
in
cludes
(
friendlySyntaxErrorLabel
)
}
let
hadMissingSassError
=
false
...
...
packages/next/src/client/dev/error-overlay/hot-dev-client.ts
View file @
eea3f34b
...
...
@@ -64,7 +64,7 @@ export default function connect() {
register
()
addMessageListener
((
event
)
=>
{
if
(
event
.
data
.
indexOf
(
'action'
)
===
-
1
)
return
if
(
!
event
.
data
.
includes
(
'action'
)
)
return
try
{
processMessage
(
event
)
...
...
packages/next/src/client/dev/on-demand-entries-client.ts
View file @
eea3f34b
...
...
@@ -27,7 +27,7 @@ export default async (page?: string) => {
}
addMessageListener
((
event
)
=>
{
if
(
event
.
data
.
indexOf
(
'{'
)
===
-
1
)
return
if
(
!
event
.
data
.
includes
(
'{'
)
)
return
try
{
const
payload
=
JSON
.
parse
(
event
.
data
)
// don't attempt fetching the page if we're already showing
...
...
packages/next/src/client/next-dev.ts
View file @
eea3f34b
...
...
@@ -55,7 +55,7 @@ initialize({ webpackHMR })
let
buildIndicatorHandler
:
any
=
()
=>
{}
function
devPagesManifestListener
(
event
:
any
)
{
if
(
event
.
data
.
in
dexOf
(
'devPagesManifest'
)
!==
-
1
)
{
if
(
event
.
data
.
in
cludes
(
'devPagesManifest'
)
)
{
fetch
(
`
${
assetPrefix
}
/_next/static/development/_devPagesManifest.json`
)
...
...
@@ -66,9 +66,9 @@ initialize({ webpackHMR })
.
catch
((
err
)
=>
{
console
.
log
(
`Failed to fetch devPagesManifest`
,
err
)
})
}
else
if
(
event
.
data
.
in
dexOf
(
'middlewareChanges'
)
!==
-
1
)
{
}
else
if
(
event
.
data
.
in
cludes
(
'middlewareChanges'
)
)
{
return
window
.
location
.
reload
()
}
else
if
(
event
.
data
.
in
dexOf
(
'serverOnlyChanges'
)
!==
-
1
)
{
}
else
if
(
event
.
data
.
in
cludes
(
'serverOnlyChanges'
)
)
{
const
{
pages
}
=
JSON
.
parse
(
event
.
data
)
// Make sure to reload when the dev-overlay is showing for an
...
...
packages/next/src/shared/lib/loadable.tsx
View file @
eea3f34b
...
...
@@ -101,7 +101,7 @@ function createLoadableComponent(loadFn: any, options: any) {
if
(
moduleIds
)
{
READY_INITIALIZERS
.
push
((
ids
:
any
)
=>
{
for
(
const
moduleId
of
moduleIds
)
{
if
(
ids
.
in
dexOf
(
moduleId
)
!==
-
1
)
{
if
(
ids
.
in
cludes
(
moduleId
)
)
{
return
init
()
}
}
...
...
packages/next/src/shared/lib/router/utils/format-url.ts
View file @
eea3f34b
...
...
@@ -91,7 +91,7 @@ export function formatWithValidation(url: UrlObject): string {
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
if
(
url
!==
null
&&
typeof
url
===
'object'
)
{
Object
.
keys
(
url
).
forEach
((
key
)
=>
{
if
(
urlObjectKeys
.
indexOf
(
key
)
===
-
1
)
{
if
(
!
urlObjectKeys
.
includes
(
key
)
)
{
console
.
warn
(
`Unknown key passed via urlObject into url.format:
${
key
}
`
)
...
...
packages/react-dev-overlay/src/internal/helpers/launchEditor.ts
View file @
eea3f34b
...
...
@@ -226,7 +226,7 @@ function guessEditor(): string[] {
const
processNames
=
Object
.
keys
(
COMMON_EDITORS_MACOS
)
for
(
let
i
=
0
;
i
<
processNames
.
length
;
i
++
)
{
const
processName
=
processNames
[
i
]
if
(
output
.
in
dexOf
(
processName
)
!==
-
1
)
{
if
(
output
.
in
cludes
(
processName
)
)
{
return
[(
COMMON_EDITORS_MACOS
as
any
)[
processName
]]
}
}
...
...
@@ -242,7 +242,7 @@ function guessEditor(): string[] {
for
(
let
i
=
0
;
i
<
runningProcesses
.
length
;
i
++
)
{
const
processPath
=
runningProcesses
[
i
].
trim
()
const
processName
=
path
.
basename
(
processPath
)
if
(
COMMON_EDITORS_WIN
.
in
dexOf
(
processName
)
!==
-
1
)
{
if
(
COMMON_EDITORS_WIN
.
in
cludes
(
processName
)
)
{
return
[
processPath
]
}
}
...
...
@@ -256,7 +256,7 @@ function guessEditor(): string[] {
const
processNames
=
Object
.
keys
(
COMMON_EDITORS_LINUX
)
for
(
let
i
=
0
;
i
<
processNames
.
length
;
i
++
)
{
const
processName
=
processNames
[
i
]
if
(
output
.
in
dexOf
(
processName
)
!==
-
1
)
{
if
(
output
.
in
cludes
(
processName
)
)
{
return
[(
COMMON_EDITORS_LINUX
as
any
)[
processName
]
as
string
]
}
}
...
...
test/lib/next-webdriver.ts
View file @
eea3f34b
...
...
@@ -120,7 +120,7 @@ export default async function webdriver(
// if it's not a Next.js app return
if
(
document
.
documentElement
.
innerHTML
.
indexOf
(
'__NEXT_DATA__'
)
===
-
1
&&
!
document
.
documentElement
.
innerHTML
.
includes
(
'__NEXT_DATA__'
)
&&
// @ts-ignore next exists on window if it's a Next.js page.
typeof
((
window
as
any
).
next
&&
(
window
as
any
).
next
.
version
)
===
'undefined'
...
...
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