server.js 1005 B

1234567891011121314151617181920212223242526
  1. const serverExports = {
  2. NextRequest: require('next/dist/server/web/spec-extension/request')
  3. .NextRequest,
  4. NextResponse: require('next/dist/server/web/spec-extension/response')
  5. .NextResponse,
  6. userAgentFromString: require('next/dist/server/web/spec-extension/user-agent')
  7. .userAgentFromString,
  8. userAgent: require('next/dist/server/web/spec-extension/user-agent')
  9. .userAgent,
  10. }
  11. if (typeof URLPattern !== 'undefined') {
  12. // eslint-disable-next-line no-undef
  13. serverExports.URLPattern = URLPattern
  14. }
  15. // https://nodejs.org/api/esm.html#commonjs-namespaces
  16. // When importing CommonJS modules, the module.exports object is provided as the default export
  17. module.exports = serverExports
  18. // make import { xxx } from 'next/server' work
  19. exports.NextRequest = serverExports.NextRequest
  20. exports.NextResponse = serverExports.NextResponse
  21. exports.userAgentFromString = serverExports.userAgentFromString
  22. exports.userAgent = serverExports.userAgent
  23. exports.URLPattern = serverExports.URLPattern