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
b4db0421
Unverified
Commit
b4db0421
authored
Dec 07, 2019
by
Joe Haddad
Committed by
GitHub
Dec 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite SSG Transform for Recursive Cleanup (#9652)
parent
2a18f036
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
247 additions
and
115 deletions
+247
-115
next-ssg-transform.ts
packages/next/build/babel/plugins/next-ssg-transform.ts
+213
-115
babel-plugin-next-ssg-transform.test.js
test/unit/babel-plugin-next-ssg-transform.test.js
+34
-0
No files found.
packages/next/build/babel/plugins/next-ssg-transform.ts
View file @
b4db0421
This diff is collapsed.
Click to expand it.
test/unit/babel-plugin-next-ssg-transform.test.js
View file @
b4db0421
...
@@ -261,5 +261,39 @@ describe('babel plugin (next-ssg-transform)', () => {
...
@@ -261,5 +261,39 @@ describe('babel plugin (next-ssg-transform)', () => {
`"export class MyClass{}const __NEXT_COMP=function Test(){return __jsx(\\"div\\",null);};__NEXT_COMP.__NEXT_SPR=true export default __NEXT_COMP;"`
`"export class MyClass{}const __NEXT_COMP=function Test(){return __jsx(\\"div\\",null);};__NEXT_COMP.__NEXT_SPR=true export default __NEXT_COMP;"`
)
)
})
})
it
(
`should remove re-exported function declarations' dependents (variables, functions)`
,
()
=>
{
const
output
=
babel
(
trim
`
const inceptionVar = 'hahaa';
var var1 = 1;
let var2 = 2;
const var3 = inceptionVar;
function inception1() {var2;}
function abc() {}
const b = function() {var3;};
const b2 = function apples() {};
const bla = () => {inception1};
function unstable_getStaticProps() {
abc();
b;
b2;
bla();
return { props: {var1} }
}
export { unstable_getStaticProps }
export default function Test() {
return <div />
}
`
)
expect
(
output
).
toMatchInlineSnapshot
(
`"const __NEXT_COMP=function Test(){return __jsx(\\"div\\",null);};__NEXT_COMP.__NEXT_SPR=true export default __NEXT_COMP;"`
)
})
})
})
})
})
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