File size: 2,134 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
import { PagesRouteModule } from '../../server/route-modules/pages/module.compiled'
import { RouteKind } from '../../server/route-kind'
import { hoist } from './helpers'
// Import the app and document modules.
import * as document from 'VAR_MODULE_DOCUMENT'
import * as app from 'VAR_MODULE_APP'
// Import the userland code.
import * as userland from 'VAR_USERLAND'
import { getHandler } from '../../server/route-modules/pages/pages-handler'
// Re-export the component (should be the default export).
export default hoist(userland, 'default')
// Re-export methods.
export const getStaticProps = hoist(userland, 'getStaticProps')
export const getStaticPaths = hoist(userland, 'getStaticPaths')
export const getServerSideProps = hoist(userland, 'getServerSideProps')
export const config = hoist(userland, 'config')
export const reportWebVitals = hoist(userland, 'reportWebVitals')
// Re-export legacy methods.
export const unstable_getStaticProps = hoist(
userland,
'unstable_getStaticProps'
)
export const unstable_getStaticPaths = hoist(
userland,
'unstable_getStaticPaths'
)
export const unstable_getStaticParams = hoist(
userland,
'unstable_getStaticParams'
)
export const unstable_getServerProps = hoist(
userland,
'unstable_getServerProps'
)
export const unstable_getServerSideProps = hoist(
userland,
'unstable_getServerSideProps'
)
// Create and export the route module that will be consumed.
export const routeModule = new PagesRouteModule({
definition: {
kind: RouteKind.PAGES,
page: 'VAR_DEFINITION_PAGE',
pathname: 'VAR_DEFINITION_PATHNAME',
// The following aren't used in production.
bundlePath: '',
filename: '',
},
distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',
relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',
components: {
// default export might not exist when optimized for data only
App: app.default,
Document: document.default,
},
userland,
})
export const handler = getHandler({
srcPage: 'VAR_DEFINITION_PAGE',
config,
userland,
routeModule,
getStaticPaths,
getStaticProps,
getServerSideProps,
})
|