Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Legacy Code #9515

Merged
merged 2 commits into from
Nov 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions packages/next/build/babel/plugins/next-page-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ import * as BabelTypes from '@babel/types'

import { PageConfig } from '../../../types'

export const dropBundleIdentifier = '__NEXT_DROP_CLIENT_FILE__'
export const sprStatus = { used: false }

const configKeys = new Set(['amp'])
const pageComponentVar = '__NEXT_COMP'
// this value can't be optimized by terser so the shorter the better
const prerenderId = '__NEXT_SPR'
const EXPORT_NAME_GET_STATIC_PROPS = 'unstable_getStaticProps'
const EXPORT_NAME_GET_STATIC_PARAMS = 'unstable_getStaticParams'
const STRING_LITERAL_DROP_BUNDLE = '__NEXT_DROP_CLIENT_FILE__'

// replace program path with just a variable with the drop identifier
function replaceBundle(path: any, t: typeof BabelTypes) {
Expand All @@ -23,8 +21,8 @@ function replaceBundle(path: any, t: typeof BabelTypes) {
t.identifier('config'),
t.assignmentExpression(
'=',
t.identifier(dropBundleIdentifier),
t.stringLiteral(`${dropBundleIdentifier} ${Date.now()}`)
t.identifier(STRING_LITERAL_DROP_BUNDLE),
t.stringLiteral(`${STRING_LITERAL_DROP_BUNDLE} ${Date.now()}`)
)
),
]),
Expand Down Expand Up @@ -79,7 +77,6 @@ export default function nextPageConfig({
specifier.exported.name === EXPORT_NAME_GET_STATIC_PROPS
) {
state.isPrerender = true
sprStatus.used = true
}
path.node.specifiers = path.node.specifiers.filter(
s => s !== specifier
Expand All @@ -104,7 +101,6 @@ export default function nextPageConfig({
) {
if (id.name === EXPORT_NAME_GET_STATIC_PROPS) {
state.isPrerender = true
sprStatus.used = true
}
path.remove()
return
Expand Down