1. 10 6月, 2019 3 次提交
  2. 05 6月, 2019 1 次提交
    • L
      API interface extensions (#7363) · c821e830
      Lukáš Huvar 提交于
      * Cookies and Query parsing for API request
      
      * Adding JSON and SEND
      
      * First body parsing
      
      * Body parsing
      
      * Remove extra try catch
      
      * Fix tests
      
      * Only server bundling for API routes
      
      * Update packages/next-server/server/api-utils.ts
      Co-Authored-By: NTim Neutkens <tim@timneutkens.nl>
      
      * Revert on demand server changes
      
      * Use content-type for parsing
      
      * Update packages/next-server/server/api-utils.ts
      Co-Authored-By: NJan Potoms <potoms.jan@gmail.com>
      
      * Add tests for server compilation
      
      * Add body limit
      
      * Change API to function chaining
      
      * Limit test
      c821e830
  3. 31 5月, 2019 2 次提交
    • J
      Consolidate import statements · f8e9cbba
      Joe Haddad 提交于
      f8e9cbba
    • J
      Revise dynamic route generation (mark 3) (#7473) · c782fa41
      Joe Haddad 提交于
      * Revise dynamic route generation
      This implements a new tree-based route sorting algorithm that uses a Depth-First-Traversal approach to correctly sort the routes.
      
      This provides better clarity over a `.sort()` based approach and will scale well as we add new features in the future.
      
      * Update import
      c782fa41
  4. 29 5月, 2019 2 次提交
    • T
      Move syntax formatting to prettier (#7454) · 3e51ddb8
      Tim Neutkens 提交于
      * Run prettier over packages/**/*.js
      
      * Run prettier over packages/**/*.ts
      
      * Run prettier over examples
      
      * Remove tslint
      
      * Run prettier over examples
      
      * Run prettier over all markdown files
      
      * Run prettier over json files
      3e51ddb8
    • J
      Add amp.canonicalBase option to set absolute URL (#7262) · 24034ec9
      JJ Kasper 提交于
      * Add canonicalBase config to allow setting
      absolute path for canonical link
      
      * Make sure canonicalBase is set for
      export and serverless
      
      * Move canonicalBase to amp.canonicalBase
      
      * Update tests with canonicalBase config
      
      * Update tests
      
      * run lint-fix
      
      * Fix canonicalBase config parsing
      
      * Fix canonicalBase during export
      
      * Update amphtml tests
      24034ec9
  5. 28 5月, 2019 1 次提交
    • J
      Dynamic routing mark 2 (#7432) · e27203f8
      Joe Haddad 提交于
      * Update escape string regexp operators
      
      * temp
      
      * Extract getRouteRegex func
      
      * First iteration of dynamic routing for production only
      
      * Correctly order prod
      
      * Add serverless support
      
      * Single line it
      
      * noop routes
      
      * Format doc
      
      * Fix dynamic routing for dev
      
      * Add flag for dynamic routing
      
      * Update packages/next-server/lib/router/router.ts
      Co-Authored-By: NJJ Kasper <jj@jjsweb.site>
      
      * remove example
      
      * Add router tests
      
      * Format code
      
      * Sort routes
      
      * Update to not use posix path methods
      e27203f8
  6. 27 5月, 2019 1 次提交
    • J
      Refactor server router (#7431) · 51b9eabe
      Joe Haddad 提交于
      * Format next server
      
      * Extract findPageComponents logic from renderToHTMLWithComponents
      
      * Apply a little formatting
      
      * Lift up component loading
      51b9eabe
  7. 24 5月, 2019 1 次提交
  8. 23 5月, 2019 2 次提交
    • J
    • J
      Add auto static/dynamic (#7293) · cdd54afb
      JJ Kasper 提交于
      * Add automatic exporting of pages with no getInitialProps
      
      * Add support for exporting serverless to static
      and serving the html files during next start
      
      * Fix missing runtimeEnv when requiring page, re-add warning
      when trying to export with serverless, and update tests
      
      * Update flying-shuttle test
      
      * revert un-used pagesManifest change
      
      * remove query.amp RegExp test
      
      * Fix windows backslashes not being replaced
      
      * Re-enable serverless support for next start
      
      * bump
      
      * Fix getInitialProps check
      
      * Fix incorrect error check
      
      * Re-add check for reserved pages
      
      * Fix static check
      
      * Update to ignore /api pages and clean up some tests
      
      * Re-add needed next.config for test and correct behavior
      
      * Update RegExp for ignored pages for auto-static
      
      * Add checking for custom getInitialProps in pages/_app
      
      * Update isPageStatic logic to only use default export
      
      * Re-add retrying to CircleCi
      
      * Update query during dev to only have values
      available during export for static pages
      
      * Fix test
      
      * Add warning when page without default export is
      found and make sure to update pages-manifest
      correctly in flying-shuttle mode
      
      * Fix backslashes not being replaced
      
      * Integrate auto-static with flying-shuttle
      and make sure AMP is handled in flying-shuttle
      
      * Add autoExport for opting in
      cdd54afb
  9. 11 5月, 2019 1 次提交
  10. 04 5月, 2019 1 次提交
  11. 24 4月, 2019 1 次提交
    • T
      Add .d.ts for next-server (#7133) · c9d599b6
      Tim Neutkens 提交于
      * Add .d.ts files
      
      * Drop next declarations from index.d.ts
      
      * Bring back number of errors
      
      * Fix more errors
      
      * Fix rewriteUrlForExport
      c9d599b6
  12. 15 4月, 2019 2 次提交
  13. 12 4月, 2019 1 次提交
    • J
      Replace `.amp.js` with `withAmp(Comp)` (#7009) · e5111745
      JJ Kasper 提交于
      * Add WithAmp to enable AMP support for
      pages instead of .amp.js
      
      * Update handling for exporting AMP
      
      * Fix ampPath in export for / path and
      revert isAmp logic to handle right
      
      * Update amphtml test suite
      
      * Add handling for noDirtyAmp during
      export and update amp-export test suite
      
      * Update serverless and export-default-map
      test suites
      
      * Update require-page tests
      e5111745
  14. 06 4月, 2019 1 次提交
  15. 05 4月, 2019 1 次提交
    • J
      Add test for AMP in serverless mode (#6894) · 8e51c78e
      JJ Kasper 提交于
      * Add amp request header and check for amp
      query in serverless mode
      
      * Add serverless test for an AMP page
      
      * Update to handle querystring weirdness
      
      * Update serverless test config
      8e51c78e
  16. 03 4月, 2019 1 次提交
    • J
      Add optimizing AMP pages (#6835) · 6344c5f0
      JJ Kasper 提交于
      * Added amp-toolbox-optimizer and added
      optimizing AMP pages as dirty and clean
      
      * Fix amp-optimizer breaking serverless build
      
      * Exclude amp-toolbox-optimizer from serverless build
      
      * Added check to make sure hybrid AMP pages
      optimize cleanly during export
      
      * Add check to make sure noDirtyAmp is applied
      6344c5f0
  17. 02 4月, 2019 1 次提交
  18. 26 3月, 2019 1 次提交
  19. 20 3月, 2019 1 次提交
  20. 19 3月, 2019 1 次提交
    • J
      Add support for creating AMP pages (#6706) · 12cbb934
      JJ Kasper 提交于
      * Add support for .amp.js pages and
      resolving /page?amp=1 to page.amp.js
      
      * Update amp tests
      
      * Update example and clean up amp page resolving
      
      * Add nested amp test
      
      * page => normalizedPage
      
      * Add type to page options
      
      * Add handling of amp with all pageExtensions
      and normalize page
      
      * Make sure findPageFile only falls back to
      amp if enabled
      12cbb934
  21. 14 3月, 2019 1 次提交
  22. 02 3月, 2019 2 次提交
  23. 18 2月, 2019 1 次提交
  24. 16 2月, 2019 1 次提交
  25. 14 2月, 2019 1 次提交
    • T
      [experimental] Rendering to AMP (#6218) · 4051ffcb
      Tim Neutkens 提交于
      * Add initial AMP implementation
      
      * Implement experimental feature flag
      
      * Implement feedback from sbenz
      
      * Add next/amp and `useAmp` hook
      
      * Use /:path*/amp instead
      
      * Add canonical
      
      * Add amphtml tag
      
      * Add ampEnabled for rel=“amphtml”
      
      * Remove extra type
      4051ffcb
  26. 29 1月, 2019 1 次提交
  27. 26 1月, 2019 1 次提交
  28. 23 1月, 2019 1 次提交
  29. 14 1月, 2019 1 次提交
    • T
      Remove next/asset (#6046) · 02ab7320
      Tim Neutkens 提交于
      * Remove next/asset
      
      Reasoning described in #5970
      
      * Remove next/asset tests
      
      * Bring back asset-page
      02ab7320
  30. 31 12月, 2018 1 次提交
    • A
      Implement tslint for core files (#5952) · 20fe65ce
      Anderson Leite 提交于
      Fixes #5845 
      
      Implement tslint for core files
      
      **What is this?**
      Implements tslint for both next and next-server, but keeps standardjs/eslint for the .js files that are still there, we're gradually migrating to Typescript.
      
      **How does it work?**
      Before every commit (pre-commit) we execute the following `tslint` command:
      `tslint -c tslint.json 'packages/**/*.ts`
      
      **TSLint Rules**
      In order to avoid as much changes as possible I marked some rules as false. This way we can improve the linter but making sure this step will not break things. (see tslint.json)
      
      **Note**
      After merging this PR, you'll need to update your dependencies since it adds tslint to package.json
      20fe65ce
  31. 28 12月, 2018 1 次提交
    • T
      Serverless Next.js (#5927) · 0f23faf8
      Tim Neutkens 提交于
      **This does not change existing behavior.**
      
      building to serverless is completely opt-in.
      
      - Implements `target: 'serverless'` in `next.config.js`
      - Removes `next build --lambdas` (was only available on next@canary so far)
      
      This implements the concept of build targets. Currently there will be 2 build targets:
      
      - server (This is the target that already existed / the default, no changes here)
      - serverless (New target aimed at compiling pages to serverless handlers)
      
      The serverless target will output a single file per `page` in the `pages` directory:
      
      - `pages/index.js` => `.next/serverless/index.js`
      - `pages/about.js` => `.next/serverless/about.js`
      
      So what is inside `.next/serverless/about.js`? All the code needed to render that specific page. It has the Node.js `http.Server` request handler function signature:
      
      ```ts
      (req: http.IncomingMessage, res: http.ServerResponse) => void
      ```
      
      So how do you use it? Generally you **don't** want to use the below example, but for illustration purposes it's shown how the handler is called using a plain `http.Server`:
      
      ```js
      const http = require('http')
      // Note that `.default` is needed because the exported module is an esmodule
      const handler = require('./.next/serverless/about.js').default
      const server = new http.Server((req, res) => handler(req, res))
      server.listen(3000, () => console.log('Listening on http://localhost:3000'))
      ```
      
      Generally you'll upload this handler function to an external service like [Now v2](https://zeit.co/now-2), the `@now/next` builder will be updated to reflect these changes. This means that it'll be no longer neccesary for `@now/next` to do some of the guesswork in creating smaller handler functions. As Next.js will output the smallest possible serverless handler function automatically.
      
      The function has 0 dependencies so no node_modules are required to run it, and is generally very small. 45Kb zipped is the baseline, but I'm sure we can make it even smaller in the future.
      
      One important thing to note is that the function won't try to load `next.config.js`, so `publicRuntimeConfig` / `serverRuntimeConfig` are not supported. Reasons are outlined here: #5846
      
      So to summarize:
      
      - every page becomes a serverless function
      - the serverless function has 0 dependencies (they're all inlined)
      - "just" uses the `req` and `res` coming from Node.js
      - opt-in using `target: 'serverless'` in `next.config.js`
      - Does not load next.config.js when executing the function
      
      TODO:
      
      - [x] Compile next/dynamic / `import()` into the function file, so that no extra files have to be uploaded.
      - [x] Setting `assetPrefix` at build time for serverless target
      - [x] Support custom /_app
      - [x] Support custom /_document
      - [x] Support custom /_error
      - [x] Add `next.config.js` property for `target`
      
      Need discussion:
      - [ ] Since the serverless target won't support `publicRuntimeConfig` / `serverRuntimeConfig` as they're runtime values. I think we should support build-time env var replacement with webpack.DefinePlugin or similar.
      - [ ] Serving static files with the correct cache-control, as there is no static file serving in the serverless target
      0f23faf8
  32. 19 12月, 2018 1 次提交
    • T
      Move out requires from renderToHTML (#5915) · 32451e97
      Tim Neutkens 提交于
      This brings us one step closer to outputting serverless functions as renderToHTML now renders the passed components, which allows us to bundle the renderToHTML function together with statically imported components in webpack.
      32451e97
  33. 14 12月, 2018 1 次提交