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
2a29bf62
Commit
2a29bf62
authored
Dec 21, 2016
by
Naoyuki Kanezawa
Committed by
Guillermo Rauch
Dec 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display deprecation warning only when method was called (#462)
parent
fe962b12
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
3 deletions
+25
-3
next.js
client/next.js
+1
-1
css.js
lib/css.js
+6
-2
utils.js
lib/utils.js
+18
-0
No files found.
client/next.js
View file @
2a29bf62
...
...
@@ -31,5 +31,5 @@ const headManager = new HeadManager()
const
container
=
document
.
getElementById
(
'__next'
)
const
appProps
=
{
Component
,
props
,
router
,
headManager
}
if
(
ids
)
rehydrate
(
ids
)
if
(
ids
&&
ids
.
length
)
rehydrate
(
ids
)
render
(
createElement
(
App
,
appProps
),
container
)
lib/css.js
View file @
2a29bf62
import
{
warn
}
from
'./utils'
import
{
deprecated
}
from
'./utils'
const
css
=
require
(
'glamor'
)
warn
(
'Warning:
\'
next/css
\'
is deprecated. Please use styled-jsx syntax instead.'
)
for
(
const
[
k
,
v
]
of
Object
.
entries
(
css
))
{
if
(
typeof
v
===
'function'
)
{
css
[
k
]
=
deprecated
(
v
,
'Warning:
\'
next/css
\'
is deprecated. Please use styled-jsx syntax instead.'
)
}
}
/**
* Expose style as default and the whole object as properties
...
...
lib/utils.js
View file @
2a29bf62
...
...
@@ -3,3 +3,21 @@ export function warn (message) {
console
.
error
(
message
)
}
}
export
function
deprecated
(
fn
,
message
)
{
if
(
process
.
env
.
NODE_ENV
===
'production'
)
return
fn
let
warned
=
false
const
newFn
=
function
(...
args
)
{
if
(
!
warned
)
{
warned
=
true
console
.
error
(
message
)
}
return
fn
.
apply
(
this
,
args
)
}
// copy all properties
Object
.
assign
(
newFn
,
fn
)
return
newFn
}
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