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
57535b5a
Unverified
Commit
57535b5a
authored
May 21, 2020
by
Maxi Gimenez
Committed by
GitHub
May 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(next/build/babel): missing types (#13189)
parent
da5a05dc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
amp-attributes.ts
packages/next/build/babel/plugins/amp-attributes.ts
+1
-1
next-page-config.ts
packages/next/build/babel/plugins/next-page-config.ts
+2
-2
next-ssg-transform.ts
packages/next/build/babel/plugins/next-ssg-transform.ts
+6
-6
preset.ts
packages/next/build/babel/preset.ts
+1
-1
No files found.
packages/next/build/babel/plugins/amp-attributes.ts
View file @
57535b5a
import
{
NodePath
,
PluginObj
,
types
}
from
'@babel/core'
import
{
NodePath
,
PluginObj
,
types
}
from
'@babel/core'
export
default
function
AmpAttributePatcher
(
...
args
:
any
):
PluginObj
{
export
default
function
AmpAttributePatcher
():
PluginObj
{
return
{
return
{
visitor
:
{
visitor
:
{
JSXOpeningElement
(
path
:
NodePath
<
types
.
JSXOpeningElement
>
)
{
JSXOpeningElement
(
path
:
NodePath
<
types
.
JSXOpeningElement
>
)
{
...
...
packages/next/build/babel/plugins/next-page-config.ts
View file @
57535b5a
...
@@ -4,7 +4,7 @@ import { PageConfig } from 'next/types'
...
@@ -4,7 +4,7 @@ import { PageConfig } from 'next/types'
const
STRING_LITERAL_DROP_BUNDLE
=
'__NEXT_DROP_CLIENT_FILE__'
const
STRING_LITERAL_DROP_BUNDLE
=
'__NEXT_DROP_CLIENT_FILE__'
// replace program path with just a variable with the drop identifier
// replace program path with just a variable with the drop identifier
function
replaceBundle
(
path
:
any
,
t
:
typeof
BabelTypes
)
{
function
replaceBundle
(
path
:
any
,
t
:
typeof
BabelTypes
)
:
void
{
path
.
parentPath
.
replaceWith
(
path
.
parentPath
.
replaceWith
(
t
.
program
(
t
.
program
(
[
[
...
@@ -24,7 +24,7 @@ function replaceBundle(path: any, t: typeof BabelTypes) {
...
@@ -24,7 +24,7 @@ function replaceBundle(path: any, t: typeof BabelTypes) {
)
)
}
}
function
errorMessage
(
state
:
any
,
details
:
string
)
{
function
errorMessage
(
state
:
any
,
details
:
string
)
:
string
{
const
pageName
=
const
pageName
=
(
state
.
filename
||
''
).
split
(
state
.
cwd
||
''
).
pop
()
||
'unknown'
(
state
.
filename
||
''
).
split
(
state
.
cwd
||
''
).
pop
()
||
'unknown'
return
`Invalid page config export found.
${
details
}
in file
${
pageName
}
. See: https://err.sh/zeit/next.js/invalid-page-config`
return
`Invalid page config export found.
${
details
}
in file
${
pageName
}
. See: https://err.sh/zeit/next.js/invalid-page-config`
...
...
packages/next/build/babel/plugins/next-ssg-transform.ts
View file @
57535b5a
...
@@ -33,7 +33,7 @@ function decorateSsgExport(
...
@@ -33,7 +33,7 @@ function decorateSsgExport(
t
:
typeof
BabelTypes
,
t
:
typeof
BabelTypes
,
path
:
NodePath
<
BabelTypes
.
Program
>
,
path
:
NodePath
<
BabelTypes
.
Program
>
,
state
:
PluginState
state
:
PluginState
)
{
)
:
void
{
const
gsspName
=
state
.
isPrerender
?
STATIC_PROPS_ID
:
SERVER_PROPS_ID
const
gsspName
=
state
.
isPrerender
?
STATIC_PROPS_ID
:
SERVER_PROPS_ID
const
gsspId
=
t
.
identifier
(
gsspName
)
const
gsspId
=
t
.
identifier
(
gsspName
)
...
@@ -41,7 +41,7 @@ function decorateSsgExport(
...
@@ -41,7 +41,7 @@ function decorateSsgExport(
path
:
NodePath
<
path
:
NodePath
<
BabelTypes
.
ExportDefaultDeclaration
|
BabelTypes
.
ExportNamedDeclaration
BabelTypes
.
ExportDefaultDeclaration
|
BabelTypes
.
ExportNamedDeclaration
>
>
)
=>
{
)
:
void
=>
{
if
(
state
.
done
)
{
if
(
state
.
done
)
{
return
return
}
}
...
@@ -156,7 +156,7 @@ export default function nextTransformSsg({
...
@@ -156,7 +156,7 @@ export default function nextTransformSsg({
|
BabelTypes
.
ArrowFunctionExpression
|
BabelTypes
.
ArrowFunctionExpression
>
,
>
,
state
:
PluginState
state
:
PluginState
)
{
)
:
void
{
const
ident
=
getIdentifier
(
path
)
const
ident
=
getIdentifier
(
path
)
if
(
ident
?.
node
&&
isIdentifierReferenced
(
ident
))
{
if
(
ident
?.
node
&&
isIdentifierReferenced
(
ident
))
{
state
.
refs
.
add
(
ident
)
state
.
refs
.
add
(
ident
)
...
@@ -170,7 +170,7 @@ export default function nextTransformSsg({
...
@@ -170,7 +170,7 @@ export default function nextTransformSsg({
|
BabelTypes
.
ImportNamespaceSpecifier
|
BabelTypes
.
ImportNamespaceSpecifier
>
,
>
,
state
:
PluginState
state
:
PluginState
)
{
)
:
void
{
const
local
=
path
.
get
(
'local'
)
const
local
=
path
.
get
(
'local'
)
if
(
isIdentifierReferenced
(
local
))
{
if
(
isIdentifierReferenced
(
local
))
{
state
.
refs
.
add
(
local
)
state
.
refs
.
add
(
local
)
...
@@ -314,7 +314,7 @@ export default function nextTransformSsg({
...
@@ -314,7 +314,7 @@ export default function nextTransformSsg({
|
BabelTypes
.
FunctionExpression
|
BabelTypes
.
FunctionExpression
|
BabelTypes
.
ArrowFunctionExpression
|
BabelTypes
.
ArrowFunctionExpression
>
>
)
{
)
:
void
{
const
ident
=
getIdentifier
(
path
)
const
ident
=
getIdentifier
(
path
)
if
(
if
(
ident
?.
node
&&
ident
?.
node
&&
...
@@ -340,7 +340,7 @@ export default function nextTransformSsg({
...
@@ -340,7 +340,7 @@ export default function nextTransformSsg({
|
BabelTypes
.
ImportDefaultSpecifier
|
BabelTypes
.
ImportDefaultSpecifier
|
BabelTypes
.
ImportNamespaceSpecifier
|
BabelTypes
.
ImportNamespaceSpecifier
>
>
)
{
)
:
void
{
const
local
=
path
.
get
(
'local'
)
const
local
=
path
.
get
(
'local'
)
if
(
refs
.
has
(
local
)
&&
!
isIdentifierReferenced
(
local
))
{
if
(
refs
.
has
(
local
)
&&
!
isIdentifierReferenced
(
local
))
{
++
count
++
count
...
...
packages/next/build/babel/preset.ts
View file @
57535b5a
...
@@ -54,7 +54,7 @@ type BabelPreset = {
...
@@ -54,7 +54,7 @@ type BabelPreset = {
}
}
// Taken from https://github.com/babel/babel/commit/d60c5e1736543a6eac4b549553e107a9ba967051#diff-b4beead8ad9195361b4537601cc22532R158
// Taken from https://github.com/babel/babel/commit/d60c5e1736543a6eac4b549553e107a9ba967051#diff-b4beead8ad9195361b4537601cc22532R158
function
supportsStaticESM
(
caller
:
any
)
{
function
supportsStaticESM
(
caller
:
any
)
:
boolean
{
return
!!
caller
?.
supportsStaticESM
return
!!
caller
?.
supportsStaticESM
}
}
...
...
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