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
eb25cf4c
Unverified
Commit
eb25cf4c
authored
May 06, 2018
by
Tim Neutkens
Committed by
GitHub
May 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support Node 6 again. check if async/await is supported (#4283)
parent
aaa15ebd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
index.js
server/index.js
+2
-1
is-async-supported.js
server/lib/is-async-supported.js
+12
-0
No files found.
server/index.js
View file @
eb25cf4c
...
@@ -21,6 +21,7 @@ import pkg from '../../package'
...
@@ -21,6 +21,7 @@ import pkg from '../../package'
import
*
as
asset
from
'../lib/asset'
import
*
as
asset
from
'../lib/asset'
import
*
as
envConfig
from
'../lib/runtime-config'
import
*
as
envConfig
from
'../lib/runtime-config'
import
{
isResSent
}
from
'../lib/utils'
import
{
isResSent
}
from
'../lib/utils'
import
isAsyncSupported
from
'./lib/is-async-supported'
const
access
=
promisify
(
fs
.
access
)
const
access
=
promisify
(
fs
.
access
)
...
@@ -113,7 +114,7 @@ export default class Server {
...
@@ -113,7 +114,7 @@ export default class Server {
}
}
async
prepare
()
{
async
prepare
()
{
if
(
this
.
dev
&&
process
.
stdout
.
isTTY
)
{
if
(
this
.
dev
&&
process
.
stdout
.
isTTY
&&
isAsyncSupported
()
)
{
try
{
try
{
const
checkForUpdate
=
require
(
'update-check'
)
const
checkForUpdate
=
require
(
'update-check'
)
const
update
=
await
checkForUpdate
(
pkg
,
{
const
update
=
await
checkForUpdate
(
pkg
,
{
...
...
server/lib/is-async-supported.js
0 → 100644
View file @
eb25cf4c
// based on https://github.com/timneutkens/is-async-supported
const
vm
=
require
(
'vm'
)
module
.
exports
=
function
isAsyncSupported
()
{
try
{
// eslint-disable-next-line no-new
new
vm
.
Script
(
'(async () => ({}))()'
)
return
true
}
catch
(
e
)
{
return
false
}
}
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