Commit graph

1364 commits

Author SHA1 Message Date
Joe Haddad
11d2206c32
v9.0.4-canary.1 2019-08-05 18:48:11 -04:00
Lukáš Huvar
abcaba7f7d
Add warning for API export (#8250) 2019-08-06 00:46:02 +02:00
Joe Haddad
b31c296730
Experimental: Serverless Trace target (#8246)
* Experimental: Serverless Trace target
The Serverless Trace target produces Serverless-handler wrapped entrypoints, but does not bundle all of `node_modules`.

This behavior increases bundling performance to be more akin to `target: 'server'`.

This mode is expected to be used with smart platforms (like [ZEIT Now](https://zeit.co/now) that can trace a program to its minimum dependencies.

* Use more generic variables

* Add asset relocator for production mode of serverless trace

* Verify Firebase compatiblity

* Revert "Add asset relocator for production mode of serverless trace"

This reverts commit 8404f1dcf28b60edab41a56c94b38dcd3fddec20.

* Add serverless trace tests

* Add _isLikeServerless helper

* Make constants

* Fix export

* Update packages/next-server/server/config.ts

Co-Authored-By: JJ Kasper <jj@jjsweb.site>

* Use a global helper for is like serverless

* Update import for isTargetLikeServerless

* Update packages/next/build/index.ts

Co-Authored-By: JJ Kasper <jj@jjsweb.site>
2019-08-05 18:26:20 -04:00
Natalie Marleny
487d62b132 [Enhancement]: Update README buttons (#8235)
* Update CN README for consistency

* Add buttons to README.md

* Center nextjs learn text

* Update CN README for consistency

* fix README link in README-zh-CN.md
2019-08-04 14:33:15 +01:00
Tim Neutkens
48e1d14d30
Update README.md 2019-08-03 23:16:34 +01:00
Joe Haddad
91b06c752a Add Create Next App instructions (#8224) 2019-08-03 12:25:25 +01:00
Joe Haddad
2ab300dd81
Remove Old Prerender Implementation (#8218)
* Remove Prerender Implementation

* Fix PageConfig

* Fix next server

* Fix two more files

* Fix render

* Fix render

* Try to fix up page config

* Correct build file

* Switch back static checker

* Turn stuff back

* Add missing newline

* Revert changes

* Add missing newline

* Fix types
2019-08-02 10:28:03 -04:00
Joe Haddad
6468b6c9bf
Remove useless code block in docs 2019-08-01 18:49:47 -04:00
JJ Kasper
e7d96f77bd
Add test for dynamic routing/webpack HMR bug (#8061)
* Add failing test for dynamic routing/webpack HMR bug

* Remove un-used args from onDemandEntryHandler

* update to latest webpack with escaping
2019-08-01 11:17:42 -05:00
Joe Haddad
ac31f1636e
Add some notes about Now deployment (#8205) 2019-08-01 11:08:21 -04:00
Joe Haddad
3f2027d583
Update TypeScript Instructions (#8200)
* Update TypeScript Instructions

* next dev => npm run dev

* Break line
2019-08-01 09:13:17 -04:00
Joe Haddad
8a74f0ae71
Golf page-loader (#8190) 2019-07-31 16:14:54 -04:00
Joe Haddad
00b56c6ede
v9.0.3 2019-07-31 16:14:36 -04:00
JJ Kasper
858f4eb8ec
v9.0.3-canary.6 2019-07-30 16:35:15 -05:00
Natalie Marleny
b8aee7af77 fix: Add error message for duplicate route param name (#8047)
* Add error message for duplicate slug name within a dynamic path

* Update based on feedback

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>

* WIP - committed with no-verify - progress

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>

* Remove old test placeholder

* Add test for re-used names
2019-07-30 16:21:36 -05:00
Joe Haddad
c61f6c1200
Test environment code should target Node (#8181) 2019-07-30 16:28:48 -04:00
JJ Kasper
4850bd03ef Provide AppTree to getInitialProps for getDataFromTree (#7732)
* Provide AppContainer to getInitialProps for getDataFromTree

* Update to only pass AppTree component instead of AppContainer

* Clean up props and remove extra imports

* Make updates from review

* De-dupe AppTree a bit

* Re-use wrapApp in router

* Remove un-needed change

* revert changes to examples until on stable

* Add test for AppTree
2019-07-30 14:00:19 -04:00
Gabor Ottlik
72098328cf Fix a typo in README (#8177) 2019-07-30 16:17:26 +01:00
Lukáš Huvar
3e03fee278 Fix build only server-side /api/index.js (#8167)
* Build error for index API routes

* Fix server build
2019-07-30 13:52:43 +01:00
Jason Miller
9659b4b555 Optional Server Compression (#8066)
* Add `compress` option to enable gzip compression in `next start`.

* Add compress option, defaulting to true

* Disable compression for serverless target

* Pin compression dep

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Pin compression types

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* lockfile update for locked compression deps

* simplify compression middleware application

* add test for compression
2019-07-29 14:35:09 -04:00
Joe Haddad
df213f7aab
Include scheduler in React bundle (#8164) 2019-07-29 13:42:57 -04:00
JJ Kasper
7b33fbbfe6
v9.0.3-canary.5 2019-07-29 11:54:02 -05:00
Joe Haddad
91f60cdadf
refactor(webpack): extract splitChunksConfig (#8161) 2019-07-29 12:19:31 -04:00
Felix Mosheev
730f9cc472 Update webpack to 4.38.0 (#8147) 2019-07-29 11:01:58 -04:00
Lukáš Huvar
722d5d7703 Improve docs for API (#8155)
* Move API types to API section

* Improve wording
2019-07-29 10:29:17 +01:00
JJ Kasper
4bcf6aabe7 Allow manually setting amphtml and canonical links (#8129) 2019-07-29 08:18:23 +01:00
Piotr Tomasik
78775954f2 fix regex to not match any string with double underscore (#8153)
* fix regex to not match any string with double underscore

* add test for __ in env name and make existing test more descriptive.
2019-07-29 08:17:10 +01:00
Lukáš Huvar
8dc5d22104 Remove next.config.js (#8139) 2019-07-27 19:46:40 +01:00
Youkyoung.Park
c4704fbd9e fix spelling in tsconfig.js of readme.md (#8138) 2019-07-27 16:50:14 +01:00
Tim Neutkens
2b1a5c3eb4 v9.0.3-canary.4 2019-07-27 11:42:02 +01:00
JJ Kasper
13fa2828c2 Add missing key prop for array elements in _document (#8132)
* Add missing keys for array elements

* Add test for missing key prop in app-document
2019-07-27 10:34:29 +02:00
Adam Misiorny
68e3223cd8 Improve type definitions (#8117) 2019-07-26 13:09:16 -05:00
Lukáš Huvar
cc6fe5fdf9 Fixes problem with API and wrong regex (#8126)
* Fixes regex for client bundel. Fixes #8115

* Add test

* Update test/integration/api-support/test/index.test.js

Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>

* Update test/integration/api-support/test/index.test.js

Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>
2019-07-26 17:02:12 +02:00
Olivier Tassinari
71f9288a54 Fix onError prop-type warning in Link (#8021)
The warning

> Warning: Failed prop type: Link: unknown props found: onError

can happen in this case:

```tsx
import * as React from 'react';
import NextLink, { LinkProps as NextLinkProps } from 'next/link';

type NextComposedProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & NextLinkProps;

const NextComposed = React.forwardRef<HTMLAnchorElement, NextComposedProps>((props, ref) => {
  const { as, href, replace, scroll, passHref, shallow, prefetch, onError, ...other } = props;

  return (
    <NextLink
      href={href}
      prefetch={prefetch}
      as={as}
      replace={replace}
      scroll={scroll}
      shallow={shallow}
      passHref={passHref}
      onError={onError}
    >
      <a ref={ref} {...other} />
    </NextLink>
  );
});
```

*Taken from Material-UI Next.js integration example*
2019-07-25 18:52:27 +00:00
Joe Haddad
22b58b1c66
v9.0.3-canary.3 2019-07-25 13:56:34 -04:00
Lukáš Huvar
bbcb448e87 Fix index.js for API routes (#8112)
This fixes the problem with `/pages/api/index.js` not creating serverless function. Fixes #8111
2019-07-25 17:39:29 +00:00
Sergio Garcia Mondaray
eae1f6b749 Dynamic routes clarification (#8110)
As talked in https://github.com/zeit/next.js/issues/8101 dynamic routing documentation could be confusing. This PR tries to clarify it a bit.
2019-07-25 17:07:59 +00:00
Joe Haddad
8b0a93b0ed
Fix extension for module/nomodule 2019-07-25 12:44:56 -04:00
Gerald Monaco
e68307df3a Add next-head-count & remove next-head class (#8020)
Fixes #3494

Removes `class="next-head"` from the children of the `<Head>` component. Instead, a single sentinel meta element named `next-head-count` is appended. The content is the number of contiguous elements immediately preceding the sentinel that _would have had_ the `class="next-head"` attribute.

During an update, instead of searching for `class="next-head"`, the sentinel is located and the N previous elements are considered candidates for `oldTags`. New elements are inserted before the sentinel, and finally the sentinel is updated to reflect the new count.
2019-07-25 16:39:09 +00:00
Lukáš Huvar
3ee5ec4412 Configuration for body parsing size limit (#7896)
This PR introduces the possibility to change the size of the parsed body. This brings features like:
- Adjusting the size of the incoming message
- Better security
2019-07-25 15:43:55 +00:00
Lukáš Huvar
83a3903fc2 HTTP methods docs and REST example (#8108)
* HTTP methods docs and REST example

* Update packages/next/README.md

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Update examples/api-routes-rest/README.md

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Fix standard
2019-07-25 11:18:38 -04:00
Joe Haddad
f8b56da7e1 Revert "Improve type definitions" (#8098)
Reverts zeit/next.js#8097

This PR caused bundle sizes to increase. We need to fix this bug before we continue adding invalid TypeScript exports to our code.
2019-07-25 13:58:24 +00:00
Adam Misiorny
55e87ea50c Improve types (#8097) 2019-07-24 21:48:38 -05:00
Janicklas Ralph
f4e6149d1c Experimental module/nomodule support (#7704)
* Module/nomodule implementation based on RFC 7563

* Remove comment

* Fixing issue with building amp pages

* Fixing test cases for serverless mode

* Adding safari 10 nomodule fix. Preloading modern js by default

* Fixing size-limit integration test

* Bug fix

* Adding testcase for modern build

* Trigger rebuild

* Setting default crossOrigin value

* Moving modern config option inside experimental flag

* Adding nomodule attribute to safari-fix script

* Changing safari10NomoduleFix default value to true

* Removing safari-fix flag

* Changing .es6 to .module

* Disable modern default

* Removing default crossOrigin value. Setting modern flag to false by default. Fixed test cases

* Remove confusing defaults and mark required instead

* Adjust blacklist

* Move behavior of page marking

* Fixing childCompiler errors not being captured

* Tweak names

* Revert

* whoops

* Fixing bug with page-loader.js

* Changing modern babel cache name

* Rename helper

* Iterate over both bundles

* Correctly clamp bundle sizes

* Revert test

* Add modern mode tests

* Fix test

* test

* test2
2019-07-24 22:16:32 -04:00
Joe Haddad
aac5121466
Apply missing formatting (#8079)
* Reapply missing formatting

* Fix lint
2019-07-23 14:33:49 -04:00
Jason Miller
ab57978d18 Modern JS for SSR Bundles (#7961)
* Compile for the current version of Node.js by default when producing server builds.

* Update packages/next/build/babel/preset.ts

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Include server variation in Babel cacheKey
2019-07-22 14:36:55 -04:00
ikeryo1182
6faf0d18fb Fix userAgent type error in README.md (#8048) 2019-07-22 11:17:07 -05:00
Joe Haddad
7eed8380f1 Comment out GIP in Custom <App> (#8055) 2019-07-22 09:54:26 -05:00
Joe Haddad
5a54e8715a
v9.0.3-canary.2 2019-07-19 16:52:53 -04:00
Joe Haddad
104d18c607
Rewrite Create Next App (#8030)
* Completely rewrite Create Next App

* Sort imports

* Show what package manager is being used

* Fix project name suggestion

* Update tests for new implementation

* Use normal prepublish command for on-install

* Upgrade Node version

* Switch to 8.16

* Disable v8 cache

* Swap out update check package and fix CLI boot
2019-07-19 15:55:30 -04:00
JJ Kasper
1cbb5958ec Fix syntax error in ie11 from next-server/amp (#8032) 2019-07-18 22:09:41 -04:00
Joe Haddad
2758060bfc
v9.0.3-canary.1 2019-07-17 23:43:17 -04:00
Joe Haddad
8fb32de0ab
Fix CNA README typo 2019-07-17 23:32:27 -04:00
Joe Haddad
bcd8eb6b78
Update CNA links to examples 2019-07-17 23:27:27 -04:00
Joe Haddad
d486152b98
Remove old media images 2019-07-17 23:23:40 -04:00
Joe Haddad
7f5f981800
Reference correct repository 2019-07-17 23:23:06 -04:00
Joe Haddad
a07f40a5ec
v9.0.3-canary.0 2019-07-17 23:09:09 -04:00
Joe Haddad
4eb8aba692
Add Create Next App package (#8018)
* Add Create Next App package

* Fix Create Next App tests

* Fix company name

* Update package.json
2019-07-17 16:53:56 -04:00
JJ Kasper
3c1355686a Handle windows backslashes when checking ssr-prepass (#8016) 2019-07-17 20:21:24 +02:00
Xinzi Zhou
9609fe453d Replace fs.exists with fs.access (#7742)
* Replace deprecated fs.exists with fs.access.

* Update packages/next/lib/file-exists.ts

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Update packages/next/lib/file-exists.ts

Co-Authored-By: Joe Haddad <timer150@gmail.com>
2019-07-16 23:01:21 -07:00
Lukáš Huvar
fce7e4eaee Avoid sending user errors to client (#8005)
* Avoid sending user error to client Closes #7526

* Small improvments

* Update sending errors
2019-07-16 17:35:13 -07:00
Luis Fernando Alvarez D
34a9cddfe1 Rework dynamic routing <Link> documentation (#8001) 2019-07-16 12:26:01 -07:00
Adam Wathan
0b496a45e8
Import isomorphic-unfetch in data fetching example (#7895)
Following this example confused me at first because it looked like it was using native fetch, and when that didn't work server-side I wasn't sure if that was my mistake or an issue with the docs.
2019-07-16 12:35:32 -04:00
Joe Haddad
becd07402e
v9.0.2 2019-07-16 11:50:20 -04:00
Joe Haddad
2a2ebfae74
v9.0.2-canary.1 2019-07-16 09:32:51 -04:00
Tim Neutkens
5030486a5d
Don’t add loadable if it’s not used (#7995) 2019-07-16 14:52:01 +02:00
Dmitry Vasilev
4347fa4d56 Add babel option to use styled-jsx/babel-test in the preset (#7747)
* Add babel option to use styled-jsx/babel-test in the preset

* Fix the types
2019-07-16 14:23:19 +02:00
Jack Tomaszewski
17773a6203 Correct info about export limitations (#7729)
* Correct info about export limitations

In `next export` `req` and `res` objects are present, but they are empty ( https://github.com/zeit/next.js/blob/master/packages/next/export/worker.js#L42-L43 ).

* Update README.md
2019-07-16 13:38:17 +02:00
Adam Misiorny
90280c864b Add support for 412 Precondition Failed status for static files (#7944)
* Add support for Precondition Failed status for static files

* Add test

* Trigger tests

* Update next-server.ts
2019-07-16 13:30:29 +02:00
JJ Kasper
e5e74dabdc Add warning for experimental config usage (#7985)
* Add warning for experimental config usage

* Update config.ts
2019-07-16 13:07:07 +02:00
Lukáš Huvar
718a36e127 Fix build for API routes conflict pages (#7992)
* Fixes #7991

* Fix tests
2019-07-16 12:59:09 +02:00
Joe Haddad
571eb9817a
v9.0.2-canary.0 2019-07-15 20:13:10 -04:00
JJ Kasper
a10b3dff33 Add default value for pageConfig for custom _error (#7984)
* Add default value for pageConfig for custom _error

* Add serverless mode for custom-error test
2019-07-15 17:06:16 -07:00
Joe Haddad
590a3adefe
Only copy public/ directory if enabled (#7988) 2019-07-15 16:33:20 -07:00
Lukáš Huvar
c6928dcfd8 Fix GIP type in /_error page (#7952) 2019-07-15 16:16:40 -07:00
Joe Haddad
60b4e678b0
Fix client-side hydration with dynamic routes (#7986)
* Add a test for the hash case

* Add a special hydration option to router

* Add additional tests wrt scrolling
2019-07-15 16:07:04 -07:00
JJ Kasper
86b6a4b6fe
Add handling for invalid page config (#7921) 2019-07-15 13:54:35 -07:00
Lukáš Huvar
be3eab2ad7 Example for API routes with middleware (#7958) 2019-07-15 17:39:16 +02:00
Natalie Marleny
e68a5a793a fix: Ensure ergonomic handling of non-page in ./pages/ (#7955)
* Update autoExport wording to automatic static optimization

* Add sufficiently informative error message

- Update other Next error message for consistency

* Implement feedback - add missing character

Co-Authored-By: Lukáš Huvar <lukas@huvar.cz>

* Fix TypeScript errors

* Update test from autoExport to automatic static optimization

- Also reflect new wording of error message for readability

* Add test for handle non-page in pages

- When target: severless
2019-07-15 17:16:35 +02:00
JJ Kasper
fad4ec3958 Don't externalize ssr-prepass if added by user (#7966) 2019-07-15 16:41:53 +02:00
Felix Mosheev
8c5e85d44c Check if dynamicOptions has the deprecated method property, (#7973)
* Check if dynamicOptions has the deprecated `method` property, closes #7972

* Update dynamic.tsx
2019-07-15 16:35:36 +02:00
JJ Kasper
4adef73ab8
Update link ref handling to clean up previous listeners (#7943) 2019-07-14 10:23:13 -07:00
JJ Kasper
10614e8465 Replace windows backslashes with forward (#7942)
slashes for better handling
2019-07-13 22:24:44 +02:00
Anthony Maki
002ddbe1b9 Checks if object is not empty instead of whether the reference (object) is truthy (#7911)
* Checks if object is not empty instead of whether the reference (object) is truthy

* Update publicRuntimeConfig check
2019-07-12 15:16:56 -07:00
not
a4355b0d0f Prevent blocking while hidden (#7930)
Allows clickthrough after indicator has been hidden.
2019-07-12 22:59:26 +02:00
Sudhir Mitharwal
9b7a2f5ab4 Update docs for AMP export behavior (#7940)
In versions prior to ^9, default export with AMP was to create a
`index.html` file for each page. This has changed in ^9.0 with intruduction of a new
configuration options `exportTrailingSlash`. Current docs for AMP
exports are not correct for this behaviour.

Fixes #7931
2019-07-12 12:53:06 -07:00
Joe Haddad
45f80409dc Remove duplicated client code (#7907) 2019-07-11 23:23:07 +02:00
Joe Haddad
47160fb0aa
v9.0.1 2019-07-11 16:31:30 -04:00
Joe Haddad
a7fbd308be
Adjust README to mention Link 2019-07-11 16:25:35 -04:00
Joe Haddad
bbe1e0f8a6
v9.0.1-canary.2 2019-07-11 14:53:10 -04:00
Luis Fernando Alvarez D
7b25e2995e Export types for link props (#7905)
* export LinkProps

* Add test
2019-07-11 14:52:21 -04:00
Luis Fernando Alvarez D
b94123ccc9 Improve exported router types (#7853)
* Added the RouteUrl type and improved router types

* Added more tests for router types

* Add build test for typescript types

* Add next-env.d.ts to the typescript test

* Removed next-env.d.ts

* Added next-env.d.ts to gitignore

* Remove route url re-exports

* renamed PublicRouterInstance to be NextRouter

* export the Url type

* Replaced BaseRouter with NextRouter in server/utils

* Don't export the Url type

* Update tsconfig.json
2019-07-11 13:35:39 -04:00
Joe Haddad
13cf664898
Add support for legacy server npm modules (#7898)
Notably, this PR fixes `faunadb` which relies on `formidable`.

n.b. `formidable` is an unmaintained legacy npm package that uses practices not compatible with the modern ecosystem.
2019-07-11 13:02:43 -04:00
Lukáš Huvar
2450c85e81 exportPathMap dynamic routes params fix (#7846)
* Fix dynamic page export fixes #7829

* Adding handling of unmatched path

* Remove logs

* Fix newline

* Tests

* Fix promise

* Fix amp tests

* Revert test

* Adjust error document

* Remove old argument

* Simplify export test

* Ensure page !== path for this check
2019-07-10 17:13:44 -04:00
JJ Kasper
41cb3b3bc0 Stop PageConfig plugin from running on non-pages (#7884)
* Add test for PageConfig

* Make sure PageConfig plugin is only run for pages
2019-07-10 15:27:11 -04:00
JJ Kasper
268ac93685 Fix placeholder values being added when exporting from serverless (#7883)
* Add testing serverless in dynamic routes suite

* Fix placeholder dynamic values being added
when exporting from serverless
2019-07-10 15:23:28 -04:00
Tim Neutkens
8122d82130 Handle empty directory (#7876)
* Add test for empty directory

* Fix test re-runs

* Handle empty `pages/` directory
2019-07-10 11:45:53 -04:00
JJ Kasper
bf7af1d16b Add default values for runtime config (#7847)
* Add default values for runtime config

* Add test to ensure default values are set
for runtime config

* Only add runtimeConfig if it's not empty

* Only add runtimeConfig if it's not empty

* Simplify default value adding

* Reduce bundle size

* remove comment changes

* Fix typos

* Add test for runtimeConfig in __NEXT_DATA__
2019-07-10 10:43:04 -04:00
Joe Haddad
24fa6b352f
Title may be omitted (#7865)
Fixes https://github.com/zeit/next.js/issues/7854
2019-07-10 01:53:20 -04:00
Joe Haddad
e5fa2beac1
v9.0.1-canary.1 2019-07-10 01:39:48 -04:00
Joe Haddad
b430a4919e
Allow React.Fragment for Document styles (#7863)
* Allow React.Fragment for Document styles

Fixes https://github.com/zeit/next.js/issues/7784
Closes https://github.com/zeit/next.js/pull/7860

* Fix types

* Remove `Without`
2019-07-10 01:39:07 -04:00
Joe Haddad
437140a048
Add UrlObject to router methods (#7859) 2019-07-10 00:10:44 -04:00
Barry
1d8fa3a943 fix terminal links (cmd-click) on VSCode (#7849) 2019-07-09 19:34:20 -05:00
Joe Haddad
ab0b2cf3da
Add a test for module.exports from a page (#7842)
Closes https://github.com/zeit/next.js/issues/7835
2019-07-09 13:23:38 -04:00
Vincent Cordobes
a137447151 Improve NextApiResponse typing (#7841)
* Fix NextApiResponse.status type signature

* Improve NextApiResponse typing
2019-07-09 13:02:46 -04:00
Joe Haddad
ce8956aeda
Miscellaneous doc updates (#7831)
* Runtime config is not compatible w/ prerendering

Closes https://github.com/zeit/next.js/issues/7827

* Add req and res types

* Document using CORS
Closes https://github.com/zeit/next.js/issues/7805

* Add docs about GIP and Prerendering

Closes https://github.com/zeit/next.js/issues/7786

* set => provided

* Note by default

* Ref CORS doc

* Specify empty object
2019-07-09 09:24:29 -04:00
sharils
aac4e21d46 Reduce confusion about passing an object to push (#7818) 2019-07-09 13:34:11 +02:00
JJ Kasper
30da9e075e Update to always require next/config when setting config (#7822) 2019-07-09 13:23:51 +02:00
Praveen Senadheera
432eec2aec Fix small typo in TypeScript documentation (#7820) 2019-07-09 01:18:28 -04:00
Joe Haddad
3f56bc5092
Update docs about Automatic Prerendering (#7816)
* Update docs about Automatic Prerendering
Closes https://github.com/zeit/next.js/issues/7791

* Tweak layout

* Fix review from @ijjk

* Revise wording

* Simplify note since we note this below

* Update packages/next/README.md

Co-Authored-By: JJ Kasper <jj@jjsweb.site>
2019-07-08 23:41:26 -04:00
Admon Sasson
634b138b40 Make recursiveReadDir return sorted array (#7658)
This function is used to return the /pages folder content.
The way it is today is that every run might result in a different order of files, which makes the whole webpack chunks be different.
An ordered list of files will result in a deterministic build, which will improve caching.
2019-07-08 21:06:04 -04:00
JJ Kasper
e56573008b Fix package count being zero in some cases (#7812)
contains ignored package name
2019-07-08 20:49:51 -04:00
Joe Haddad
3208024735
Undocument the public/ folder (#7810)
Closes https://github.com/zeit/next.js/issues/7800
2019-07-08 20:12:40 -04:00
Joe Haddad
7da546a3a5
v9.0.1-canary.0 2019-07-08 19:23:58 -04:00
JJ Kasper
78bba56580 Add API tests to serverless (#7774)
* Add failing API tests to serverless

* Add newline

* Fix failing serverless tests
2019-07-09 00:50:01 +02:00
Joe Haddad
b013e11be3
Upgrade to webpack with latest acorns (#7795)
Closes https://github.com/zeit/next.js/issues/6240
2019-07-08 15:36:55 -04:00
Joe Haddad
6a35b1d302
Set cancelled property on routeChangeError error (#7790)
* Set `cancelled` property on routeChangeError error

* Add route cancellation tests
2019-07-08 15:25:46 -04:00
JJ Kasper
a7171db2ca Remove previous cache logic (#7794)
* Remove previous cache logic

* Remove old test
2019-07-08 14:59:45 -04:00
Delba de Oliveira
4172c894d3 Further clarification that api routes should be inside the page… (#7780) 2019-07-08 16:28:58 +02:00
Tim Neutkens
66bf56ff7e v9.0.0 2019-07-08 08:43:07 +02:00
Joe Haddad
9f65e50b66
v8.1.1-canary.70 2019-07-08 02:23:36 -04:00
Lukáš Huvar
264fc01969 API routes documentation (#7562)
* API routes examples and documentation

* Update examples/api-routes-micro/README.md

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update examples/api-routes/README.md

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Apply suggestions from code review

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update API routes docs

* Improve example to reflect dynamic routes

* Update readme to reflect API routes changes

* Apply suggestions from review
2019-07-07 23:04:04 -07:00
Joe Haddad
b0b1c320a8 Experimentalize public/ (#7771)
* Experimentalize `public/`

* Update tests for publicDirectory config
2019-07-08 07:45:41 +02:00
Lukáš Huvar
f204935251 Fix serverless loader for API routes (#7767)
* Fix serverless loader for API routes

* Only use params with dynamic routes
2019-07-07 17:45:40 -04:00
Alexander Kachkaev
e995c73b2c [typings] Allow getInitialProps to be sync (#7763) 2019-07-07 14:52:59 -04:00
JJ Kasper
cc497568b4
v8.1.1-canary.69 2019-07-05 16:45:09 -07:00
Joe Haddad
270d548d33
Remove old docs (#7760)
* Remove old docs

* Run doctoc
2019-07-05 12:01:21 -04:00
Joe Haddad
6fa17b3f15
Improve automatic prerendering warning (#7759) 2019-07-05 11:57:16 -04:00
JJ Kasper
80b46c1d28 Update to have default pageProps of {} instead of null (#7734)
* Update to have default pageProps of {} instead of null

* Update test

* Test for empty object
2019-07-05 11:00:23 -04:00
Joe Haddad
7f3bdb1bf0
v8.1.1-canary.68 2019-07-05 01:08:29 -04:00
JJ Kasper
7ac8dcbec0 Add deprecation message for next/dynamic modules (#7750) 2019-07-04 23:36:53 -04:00
Joe Haddad
b60985b2be
Revert "fix(Link): Set focus back to the body element (#7693)" (#7753)
This reverts commit defde85e81.
2019-07-04 23:24:14 -04:00
Connor Bär
defde85e81 fix(Link): Set focus back to the body element (#7693)
* fix(Link): Set focus back to the body element

* refactor(Link): Fix typings

* Update blurring logic and add tests
2019-07-04 11:30:22 -04:00
Lukáš Huvar
87acbdb594
Http methods update for static files and pages (#7721)
* Change static method handling and pages revert

* Allow and reflect old behaviour

* Post should return 501

* Add back old test

* Invert logic

* Handle 501 for pages in separate location

* Remove usage of 501 HTTP status code

* Prevent information leak

* Add test

* Only 405 if the page exists -- 404 if it doesn't

* Handle sent responses

* Revert "Handle sent responses"

This reverts commit 5e9012ae29b611c25ed1e090756a25dbe3437182.

* Fix bad test

* Switch back to quiet

* Update test/integration/production/test/index.test.js

Co-Authored-By: JJ Kasper <jj@jjsweb.site>
2019-07-04 10:22:25 +02:00
Junyoung Choi
12f1a63442 Expose next function type (#7726)
* Expose next function type

* Add type testing for typescript custom server

* Move types test to integration folder
2019-07-03 19:38:58 -07:00
JJ Kasper
e00a2c5d64
v8.1.1-canary.67 2019-07-03 15:57:16 -07:00
Lukáš Huvar
a60da57453 Clarify params and query merging (#7744)
* Clarify params and query merging

* Tweak README per @ijjk
2019-07-03 16:08:50 -04:00
Joe Haddad
b2a9670ca4
Make exportTrailingSlash stable (#7746) 2019-07-03 13:25:44 -04:00
Joe Haddad
e36d7b3226
Add example route event code (#7745) 2019-07-03 11:34:41 -04:00
JJ Kasper
f8097e5111 Add next-server/types to package.json files (#7740) 2019-07-03 10:33:34 -04:00
Tim Neutkens
6a507fad1d v8.1.1-canary.66 2019-07-03 14:41:25 +02:00
Tim Neutkens
a785ff7376
Bring down bundle size (#7743) 2019-07-03 14:38:21 +02:00
Tim Neutkens
a88d6b7482 v8.1.1-canary.65 2019-07-03 13:44:09 +02:00
JJ Kasper
7cf132f864
[Refactor] Move context providers to AppContainer (#7737) 2019-07-02 19:16:12 -07:00
Joe Haddad
e798b664a1
Add router event note (#7736)
* Add router event note

* Add line break

* Tweak wording
2019-07-02 21:35:38 -04:00
JJ Kasper
6ce7c06d9c Add initial static indicator (#7682)
* Add initial static indicator

* Update indicator text to pre-rendered

* Update naming from static to prerender

* Update to not re-use nextExport var

* Update positioning of indicator to prevent overlap
2019-07-02 20:42:41 -04:00
Joe Haddad
7439a773b0 Nit: Change Pre-render to Prerender (#7733) 2019-07-02 22:51:12 +02:00
Luis Fernando Alvarez D
c8bd427193 Dynamic routing documentation (#7602)
* Added basic example for dynamic routing

* Added some basic docs for dynamic routing

* Added more docs for dynamic routing

* Used doctoc

* fixed lint issues

* Added useRouter to docs

* Removed getInitialProps examples that are only using router props

* Added useRouter to the navigation

* Small fix

* Updated to the latest dynamic routes implementation

* lint fix

* Update dynamic routing example

* Tweak dynamic routing documentation

* Make basic example basic again

* Adjust dynamic routes section

* Remove query param for dynamic routes example

* Remove old note

* Fix linting
2019-07-02 16:00:58 -04:00
JJ Kasper
def94e6173
v8.1.1-canary.64 2019-07-01 15:23:15 -07:00
Luis Fernando Alvarez D
87610ccff5 Update with-zones example and Multi Zones documentation (#7513)
* Updated with-zones example to Now V2

* Updated Zones docs

* Update packages/next/README.md

Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>
2019-07-01 15:21:00 -07:00
JJ Kasper
0ca8087565
Add prerender PageConfig option (#7699)
* Add prerender PageConfig option

* Update PageConfig type

* Add inlining of data when pre-render is set and add tests

* Update types import

* Add check for props

* Rename prerender to experimentalPrerender for now
2019-07-01 14:13:52 -07:00
Joe Haddad
0faf693ed2
Do not default TypeScript to strict: true (#7717) 2019-07-01 13:13:58 -04:00
Joe Haddad
5493f2e8b3
Remove Next.js debug mode (#7719) 2019-07-01 13:13:06 -04:00
Lukáš Huvar
4ad934c148 Serverless build for API routes (#7649)
* Fixes serverless target in development

* Fix serverless build

* Fix serverless build

* Add manifest test

* Better output

* Fix manifest test

* Update snapshot

* Remove snapshots
2019-07-01 12:47:11 -04:00
Joe Haddad
af94c27a9d
Upgrade watchpack to remove eslint-config-prettier (#7716) 2019-07-01 11:09:20 -04:00
Joe Haddad
c92e8c2a09
Remove "small" wording from runtime config overhead (#7715)
Using runtime configuration can cause you to de-optimize entire classes of optimizations.
These optimizations could make your application an order of magnitude faster (i.e. prerendering).
2019-07-01 11:09:09 -04:00
JJ Kasper
564eac4746
Fix styled-jsx not rendering when used in node_modules (#7697)
* Don't transpile styled-jsx in server mode

* Add test fo styled-jsx-module

* Add styled-jsx as dependency of next-server
2019-06-29 15:42:07 -07:00
Josh Chorlton
15bcdab55c Add path to exportPathMap query missing message (#7708)
* Add path to exportPathMap query missing message

* Path to Url
2019-06-29 15:13:23 -07:00
JJ Kasper
aeeba6b2e8
v8.1.1-canary.63 2019-06-28 18:02:20 -07:00
JJ Kasper
356636c80f Add updated de-duping logic for next/dynamic (#7705) 2019-06-28 20:48:28 -04:00
Joe Haddad
39761e5ce7 Remove withAmp and do not expose isInAmpMode (#7690)
* Remove `withAmp` and do not expose `isInAmpMode`
This pull request removes the `withAmp` higher-order component in favor of the exported configuration object.
Retaining this backwards compatibility isn't worth the extra maintenance burden, given it hasn't been released for very long and the migration is ultra-simple.

I'm 👎 on retaining backwards compatibility just for the sake of it.

Migration example follows. I'm willing to write a codemod if reviewers feel it's necessary.

*Before*
```js
import { withAmp } from 'next/amp'

function Home() {
  return <h1>My AMP Page</h1>
}

export default withAmp(Home)
// or
export default withAmp(Home, { hybrid: true })
```

*After*
```js
export default function Home() {
  return <h1>My AMP Page</h1>
}

export const config = {
  amp: true,
  // or
  amp: 'hybrid',
}
```

* Fix { amp: 'hybrid' }

Co-Authored-By: JJ Kasper <jj@jjsweb.site>
2019-06-28 15:04:24 -07:00
Joe Haddad
808a3bcc66
v8.1.1-canary.62 2019-06-28 17:12:01 -04:00
Luis Fernando Alvarez D
e35053e8c3 Improve prefetch docs (#7692)
* added docs for disabling prefetch

* Update packages/next/README.md

Co-Authored-By: JJ Kasper <jj@jjsweb.site>
2019-06-28 13:57:22 -07:00
JJ Kasper
cf9762e089
Expand automatic pre-rendering docs (#7702)
* Expand automatic pre-rendering docs

* Apply suggestions from code review

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>
2019-06-28 13:47:55 -07:00
Joe Haddad
3aed76fad8
Unflag Automatic Prerendering (#7666)
* Unflag Dynamic Routing

* Unflag Automatic Prerendering

* Ensure pages are lambdas for test

* Fix file check

* Fix tests

* oof

* Use lambda for document middleware test
2019-06-28 16:01:11 -04:00
JJ Kasper
291eb83923 Revert "Remove modules option from dynamic (#7688)" (#7701)
This reverts commit 0fd7e68556.
2019-06-28 13:39:23 -04:00
JJ Kasper
5f40306575 Remove coveralls (#7689) 2019-06-28 09:09:27 -04:00
JJ Kasper
0fd7e68556 Remove modules option from dynamic (#7688)
* Remove modules option from dynamic

* Remove old test
2019-06-28 09:02:33 -04:00
Lukáš Huvar
c156e0c889
Helpers update (#7686)
* Update helper function to invoke only on get

* Tests for body parsing

* Update api-utils.ts

* Update next-server.ts

* Update packages/next-server/server/next-server.ts

Co-Authored-By: JJ Kasper <jj@jjsweb.site>
2019-06-28 11:31:32 +02:00
Taro Shono
ec958a3bd0 refactor: default dynamic loading component to null (#7543) 2019-06-27 18:07:07 -07:00
JJ Kasper
5e70a2f74c Make DefaultLoading return null (#7695) 2019-06-27 19:05:10 -04:00
Lukáš Huvar
bd31c5d1b7 Dynamic routes for API (#7629)
* Dynamic routes for API

* New structure

* Change next config

* Refactoring tests

* Fix newline

* Fix tests

* Remove dynamic from config

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Update index.test.js
2019-06-27 12:01:36 -04:00
JJ Kasper
b4e4bcda9b Clean up AMP logic and naming (#7669)
* Clean up AMP logic

* Tweak AMP logic some more

* Rename hasAmpVersion to hybridAmp
2019-06-27 10:22:24 -04:00
JJ Kasper
44d8c624f4
v8.1.1-canary.61 2019-06-26 14:59:13 -07:00
JJ Kasper
7c30bf97f6
Re-add require cache clearing (#7674) 2019-06-26 12:16:54 -07:00
Joe Haddad
e7110a0347
Asynchronously check for type errors (#7668)
* Asynchronously check for type errors

* Add TODO

* Fix webpack invalidation

* Show TypeScript error in dev client
2019-06-26 14:54:23 -04:00
JJ Kasper
bf04031f9d
v8.1.1-canary.60 2019-06-25 20:53:06 -07:00
JJ Kasper
f9491887fc
Fix maxConcurrentCalls used instead of maxConcurrentWorkers (#7672) 2019-06-25 20:51:40 -07:00
JJ Kasper
ba373d8707
v8.1.1-canary.59 2019-06-25 20:09:20 -07:00
JJ Kasper
9781510839
Parallelize requiring pages for static check (#7671) 2019-06-25 19:54:28 -07:00
JJ Kasper
c773dae48a
v8.1.1-canary.58 2019-06-25 15:57:57 -07:00
JJ Kasper
6a2e8cd81f
Fix memory leak from requiring pages (#7659) 2019-06-25 13:36:21 -07:00
Joe Haddad
19f3c4d77c
Unflag Dynamic Routing (#7663) 2019-06-25 10:28:48 -04:00
JJ Kasper
5a1b32dcf1
v8.1.1-canary.57 2019-06-24 18:12:22 -07:00
JJ Kasper
8c9819200b
Fix missing .test(path) in webpack-config (#7655) 2019-06-24 18:05:15 -07:00
JJ Kasper
9e22f06664
v8.1.1-canary.56 2019-06-24 16:45:18 -07:00
JJ Kasper
e360c105ab
Update prefetch check to prevent re-prefetching (#7654)
* Update page-loader prefetch checking

* Add test for re-prefetching same bundle
2019-06-24 16:13:33 -07:00
Joe Haddad
c03e94bebd
Remove usage of process.browser (#7651) 2019-06-24 16:34:10 -04:00
Joe Haddad
ee2bdb896c
Avoid lambda nomenclature when target != 'serverless' (#7650) 2019-06-24 14:59:51 -04:00
Joe Haddad
353e505172
Fix TypeScript typings (#7648)
* Fix TypeScript typing
This correctly defines `process.browser` instead of `process.env.browser`.

It also removes `process.crossOrigin` because it's not found in our documentation anywhere and is mostly used for internal purposes.

* Make sure `process.browser` doesn't throw a type error

* Split globals from Next.js module

* Allow `test` as a valid NODE_ENV

* Fix type assignment

* Make sure global types get published

* Fix test
2019-06-24 14:26:17 -04:00
Kuba Juszczyk
2debe7fb73 Allow opting out of automatic prefetch for Link (#7532)
* Restoring not working mouse event

* Restoring possibility of conditionally switching off the prefetch
2019-06-24 11:22:27 -07:00
Joe Haddad
0af9d849d3
Compile dependencies for IE11 (#7646)
This PR compiles development-time dependencies that cause invalid syntax errors in IE 11 (ES 5).

Closes #7610
Closes #7612
2019-06-24 11:45:36 -04:00
Joe Haddad
8ddb4a6a95
_document middleware is experimental (#7647)
* `_document` middleware is experimental

Closes https://github.com/zeit/next.js/issues/7580

* Turn on document middleware
2019-06-24 11:31:27 -04:00
Joe Haddad
31b3106a32
Revert "ncc Webpack build redux (#7628)"
This reverts commit e85a517e1a.
2019-06-24 09:48:26 -04:00
JJ Kasper
516325eafc
v8.1.1-canary.55 2019-06-21 11:17:26 -07:00
Guy Bedford
e85a517e1a ncc Webpack build redux (#7628)
* Reimplement ncc webpack build

This reverts commit 6feca310d7.

* Shared webpack build

* ncc workaround pending @zeit/ncc#437

* update ncc

* build tweaks, fixup autodll-import

* possible Node 8 fix

* second possible Node 8 fix

* and update taskfile
2019-06-21 12:28:41 -04:00
Lukáš Huvar
ff040950eb Fixes serverless target in development (#7619) 2019-06-20 19:47:45 -07:00
March Works
7678ee2f2e set __next-build-watcher width and height to 0 (#7618) 2019-06-20 17:11:15 -07:00
Joe Haddad
6c625703ed
Dynamic Routes: Change impl from $param to [param] (#7623)
* Dynamic Routes: Change impl from $param to [param]

* Update expected test snapshot

* Update test to use new syntax

* Update test file

* Test more behavior

* Update route sorter for new param syntax

* Update dynamic routing tests

* Update danging test file

* Tweak test

* Fix dev and update tests
2019-06-20 18:27:04 -04:00
Joe Haddad
eddc852de3
Extract isDynamicRoute helper (#7622) 2019-06-20 14:41:02 -04:00
Joe Haddad
204e5a7171
v8.1.1-canary.54 2019-06-19 13:28:43 -04:00
Joe Haddad
b8a7cd8c0f
Exit process after build (#7614) 2019-06-19 13:28:18 -04:00
JJ Kasper
c39c5d264e Add error handling for _error page (#7608) 2019-06-19 12:26:22 -04:00
Joe Haddad
69150043e4
typeof window is object on the client (#7606) 2019-06-18 22:22:32 -04:00
Joe Haddad
50b5334a70
typeof window will always be undefined on the server (#7605)
This should allow Terser to tree shake code branches.
2019-06-18 20:59:30 -04:00
Joe Haddad
3047e45396
Correctly define NODE_ENV and process.browser (#7604)
* Correctly define NODE_ENV and `process.browser`

* Add crossOrigin property
2019-06-18 20:58:22 -04:00
Joe Haddad
0c8f97b9d6
Ensure Node types are installed (for process types) (#7603) 2019-06-18 19:57:49 -04:00
JJ Kasper
1cad7e8e6a
v8.1.1-canary.53 2019-06-18 14:24:35 -07:00
Joe Haddad
033dd5ed08
Re-require all module information for client-side initializers list (#7571)
* Re-require all module information for client-side initializers list
We really should re-work how our loadable code words, because this passes an excessive number of modules to the client.

In the ideal world, we only pass the entry module id of each chunk, but there's no point in investing the time until we switch to webpack 5 which completely revamps the chunk graph API.

* Get a unique set of ids
2019-06-18 16:27:31 -04:00
Luis Fernando Alvarez D
a71cb644b5 Improve docs (#7564)
* Update getInitialprops docs

* Update docs for prefetch

* Updated prefetch docs

* Removed hotSelfAccept from docs and othr changes

* Prefer /public

* dots dots dots dots

* Added docs for Automatic Pre-rendering

* Added a note to <Link />

* Removed 404 example

* Added references for Automatic pre-rendering

* Added a typescript section for AMP

* Executed doctoc again to add AMP sections

* Properly explain automatic pre-rendering

* Switch back to LF

* Apply corrections

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Minor corrections

* Added back some periods

* Added back some periods
2019-06-14 11:48:57 -07:00
JJ Kasper
090a06bb2c
Add handling for invalid pages during autoExport (#7574)
* Add handling for invalid pages during autoExport

* Add err.sh link for invalid page export

* Fix typo

* Apply suggestions from code review

Co-Authored-By: Tim Neutkens <tim@timneutkens.nl>
2019-06-13 17:08:19 -07:00
JJ Kasper
feb31f4de7
v8.1.1-canary.52 2019-06-13 11:35:23 -07:00
JJ Kasper
fbc20a5401 Strip queries before matching route on client (#7566) 2019-06-13 09:35:47 -04:00
Joe Haddad
7132995a0d
v8.1.1-canary.51 2019-06-11 13:59:09 -04:00
Joe Haddad
92ae28b843
Tune default Terser configuration (#7554)
This adjusts our default terser configuration to not break seemingly valid JavaScript code.

Closes #7178
Closes #7496
2019-06-11 13:34:45 -04:00
Joe Haddad
5e66656d21
Mark whether page is a lambda or static file in build output (#7553) 2019-06-10 14:59:36 -04:00
Joe Haddad
ef903a25ce
Add static page marker to page info (#7552) 2019-06-10 14:46:30 -04:00
Joe Haddad
3b66fd3be5
Remove invalid meta type (#7549) 2019-06-10 12:41:43 -04:00
Joe Haddad
d1b7b82922
v8.1.1-canary.50 2019-06-10 12:30:00 -04:00
Joe Haddad
8e3c5c2be0
Improve TypeScript package install experience (#7548)
This change will prompt the user about missing packages using the same DX instead of two separate code paths.
2019-06-10 10:53:35 -04:00
Lukáš Huvar
5a014bdf75 Adding TypeScript description to next export (#7547)
* Adding Typescript description to next fixes #7529

* Change default export

* Improve typing for next

* Remove dev server typings
2019-06-10 10:20:39 -04:00
Joe Haddad
ac5a1c62de
Don't confuse the user with an eagerly created tsconfig.json (#7546)
* Don't confuse the user with an eagerly created `tsconfig.json`

* Fix errors

* Extra log

* Bail when doing nothing
2019-06-10 09:02:16 -04:00
Joe Haddad
ffba702608
Create file referencing Next.js types (#7545) 2019-06-10 07:25:31 -04:00
JJ Kasper
4b27507be2
v8.1.1-canary.49 2019-06-09 17:21:41 -07:00
JJ Kasper
cb29085707
Fix next start in serverless mode with public directory (#7541)
* Fix next start in serverless mode with public directory

* Add public folder to serverless test suite
2019-06-09 17:18:38 -07:00
JJ Kasper
fa45fa0a60
Add export const config support and make withAmp a no-op (#7525)
* Add export const config support and make withAmp a no-op

* Use babel plugin for PageConfig

* Fix serverless-loader exports

* Add backwards compatibility for withAmp
2019-06-09 17:16:14 -07:00
Tim Neutkens
a4d6d86dc9 v8.1.1-canary.48 2019-06-09 14:17:09 -07:00
Luis Fernando Alvarez D
af89040622 Add Typescript to next-mdx readme (#7540)
I added a link to the MDX docs because to enable Typescript we do exactly the same.
2019-06-09 12:34:42 -07:00
Dmytro
56e740168d TS: don't set page component props to the App's props by default (#7535) 2019-06-08 13:41:50 -05:00
Faris Abusada
890a45616d fixes constants link in readme (#7534) 2019-06-08 17:35:02 +02:00
Kuba Juszczyk
e49f26d644 Restore onMouseEnter event (#7531) 2019-06-07 11:43:27 -04:00
Joe Haddad
a372edae48 Default target in loadConfig instead of next build (#7521)
* Default `target` in `loadConfig` instead of `next build`
We should set the target from the environment variable during `loadConfig` instead of in `next build`. This ensures all other locations in Next.js that rely on `config` can read the correct value to toggle behaviors.

* Use object destructuring

* Add tests for builder target

* Run start with serverless
2019-06-06 15:57:42 +02:00
Tim Neutkens
a3082d672e v8.1.1-canary.47 2019-06-06 15:44:28 +02:00
Tim Neutkens
6c5a573352
Add types for <Html> and <Head> element (#7524)
* Clean up _document documentation

* Add types for `<Html>` and `<Head>` element
2019-06-06 15:41:31 +02:00
Joe Haddad
86d62afaf9
Adjust Flying Shuttle message (#7522)
* Adjust Flying Shuttle message
This adjusts the flying shuttle message for when a shuttle is not found or cannot be reused to reduce confusion to the user opting into the feature.

* Tweak message
2019-06-06 09:19:08 -04:00
Tim Neutkens
e49e442796
Clean up _document documentation (#7523) 2019-06-06 15:09:20 +02:00
Luc
3b5f18495b Replace recursive-copy with own implementation (#7263)
* replace recursive-copy with own implementation

* update yarn.lock

* do not filter out not directories

* do not fail if folder already exists

* replace `\` by `/` when sending pathes to filter

* use fs-extra only in tests

* investigate and test recursive-copy npm module

* improve test by creating fixtures programmatically

* remove recursive-copy npm module test

* add recursive-copy to bench

* add bench:recursive-copy script

* fix Sema import in recursive-copy.ts

* small improvements
2019-06-06 12:33:11 +02:00
JJ Kasper
e3cd31df17
v8.1.1-canary.46 2019-06-05 20:11:06 -07:00
JJ Kasper
be02b881c5
Fix auto export in serverless (#7517)
* Fix nextExport not being set in serverless

* Add test for refreshing query
2019-06-05 19:37:58 -07:00
JJ Kasper
66fd87fc9b
v8.1.1-canary.45 2019-06-05 13:26:13 -07:00
JJ Kasper
2bb2b57395
Fix autoExport on windows and add tests (#7514) 2019-06-05 13:20:08 -07:00
Tim Neutkens
7e7f2c0a6d
Simplify a few parts of the codebase (#7506)
* Move client-side dev JS to dev folder

* Move eventsource polyfill

* Move source-map-support

* Move error boundary

* Deprecate Container in _app

* Make initialRender check better

* Remove unused code

* Only support one subscription as there is only one

* Don’t spread object

* Shorten property name

* Add container in development too

* Simplify query update logic
2019-06-05 20:15:42 +02:00
Lukáš Huvar
c821e83048 API interface extensions (#7363)
* 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: Tim 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: Jan Potoms <potoms.jan@gmail.com>

* Add tests for server compilation

* Add body limit

* Change API to function chaining

* Limit test
2019-06-05 13:22:09 +02:00
JJ Kasper
93aaacd58d Fix serverless dynamic routes (#7505)
* Fix serverDir resolving for autoExporting

* Fix dynamic routes in serverless loader
2019-06-05 13:18:23 +02:00
JJ Kasper
9fa1101c7c
v8.1.1-canary.44 2019-06-04 22:20:05 -07:00
JJ Kasper
7d5556a552
Fix serverDir resolving for autoExporting (#7504) 2019-06-04 22:17:36 -07:00
Kuba Juszczyk
02551d3bc7 Disable <title/> warning when React Helmet is used (#7483) 2019-06-04 22:30:29 +02:00
Dmytro
cc6eecd23f Allow to describe initial props in the NextPage type (#7491) 2019-06-04 09:35:13 -05:00
JJ Kasper
79cf929b25
v8.1.1-canary.43 2019-06-02 02:48:05 -07:00
JJ Kasper
82d5eec7a9
Add identifier for Next.js AMP pages (#7485) 2019-06-02 02:38:47 -07:00
JJ Kasper
3245a57370
Remove .includes from _app for ie compatibility (#7482) 2019-06-01 04:40:56 -07:00
JJ Kasper
875b205b57 Upgrade to latest typescript (#7477) 2019-05-31 04:36:59 -07:00
Joe Haddad
f8e9cbba7b
Consolidate import statements 2019-05-31 02:27:56 -07:00
JJ Kasper
a7a59450a5
v8.1.1-canary.42 2019-05-30 17:36:29 -07:00
JJ Kasper
8a8cde1b39
Refresh query on mount for exported pages (#7462)
* Refresh query on mount for exported pages

* Make sure to only refresh query if it is different

* Only update if search isn't empty

* Merge pre-rendered query values with
current query values

* Remove dynamic restriction for autoExporting

* Update dynamic routing test fo autoExport

* Remove autoExport from client-navigation test

* Remove logs and update trailing slash config

* Update nextExport tests in client-navigation

* Disable autoExport in export suite
2019-05-30 17:34:05 -07:00
JJ Kasper
da6791e1f1
v8.1.1-canary.41 2019-05-30 15:55:09 -07:00
Joe Haddad
7f187b4621
Add new stub file for exports 2019-05-30 15:53:32 -07:00
Joe Haddad
21fae5262f
Reuse router logic instead of duping in client (#7476) 2019-05-30 15:44:27 -07:00
Joe Haddad
06e0befd82
Do not leave Promise unresolved (#7475) 2019-05-30 14:57:10 -07:00
Joe Haddad
c782fa4130
Revise dynamic route generation (mark 3) (#7473)
* 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
2019-05-30 13:42:45 -07:00
JJ Kasper
03d589349a
Render valid optimized AMP by default (#7465)
* Upgrade to latest AMP toolbox optimizer

* Remove amphtml from AMP only and update tests

* Update tests

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <timer150@gmail.com>
2019-05-29 19:53:41 -07:00
JJ Kasper
683a634a1e
Make react-ssr-prepeass external if not enabled (#7466) 2019-05-29 19:40:23 -07:00
Joe Haddad
b3170d2648
Format missed files (#7464)
* Format missed files

* Remove unnecessary rule

* Fix type error
2019-05-29 18:19:32 -07:00
Joe Haddad
ec385e573d
Disable optional param routing code paths (#7459)
* Disable optional param routing code paths

* Fix tests
2019-05-29 14:29:02 -07:00
Tim Neutkens
c8a4682d4a
Remove react-ssr-prepass as it’s only needed for experimental feature (#7455)
* Remove react-ssr-prepass as it’s only needed for experimental feature

* Add react-ssr-prepass to devdeps
2019-05-29 15:19:21 +02:00
Tim Neutkens
3e51ddb8af
Move syntax formatting to prettier (#7454)
* 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
2019-05-29 13:57:26 +02:00
Joe Haddad
5e2e9784e0
Do not force noEmit option into TypeScript configuration (#7451) 2019-05-28 19:01:49 -07:00
JJ Kasper
24034ec957 Add amp.canonicalBase option to set absolute URL (#7262)
* 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
2019-05-28 17:32:17 -07:00
JJ Kasper
26702a8562
v8.1.1-canary.40 2019-05-28 12:49:23 -07:00
Joe Haddad
b6dd463d93 Enable strict export presence in webpack (#7446) 2019-05-28 12:43:07 -07:00
Rafael Almeida
5fa01b15c6 Improvements to build watcher (#7441)
* Remove fragment from _document

* Directly assign id instead of setAttribute

* Remove getElementById call by using the existing reference
2019-05-28 20:16:29 +02:00
Lukáš Huvar
e76529a499 Bundle only server code for API routes (#7443) 2019-05-28 15:48:13 +02:00
keustma
eee19788e5 Fixed typo in README.md (#7438) 2019-05-28 14:01:46 +02:00
JJ Kasper
d103828c8e
v8.1.1-canary.39 2019-05-27 15:03:53 -07:00
JJ Kasper
ca85cc9973
Update styles on build indicator container (#7436) 2019-05-27 15:01:29 -07:00
JJ Kasper
b5a93c9ac5
v8.1.1-canary.38 2019-05-27 14:07:05 -07:00
Rafael Almeida
6f6f40dba7 Implement UI to show building activity (#6526)
* Initial version of build watcher working

* Move build watcher div to Main component

* Add a better design, remove container from DOM when not visible

* Fix flickering when closing and opening too fast

* Add a field on next config file for two styles and completely removal

* Ops, bring back fade-in animation

* Remove unnecessary commas

* Render building text by CSS, remove unnecessary jsx attribute

* Remove React usage

* Add support to IE/Edge

* Fix linter issues

* Set custom property with data attribute

* Use ondemand: 1 to don't override current listeners

* Use more strict rules to avoid outside CSS effects

* Use lighter box shadow

* Fix registering HMR callback

* Move initializing build watcher to client/next-dev

* Remove buildWatcherStyle and only use minimal

* Move build watcher element to render

* Move it to create element on initialize

* Fix type error from canary

* Remove extra log

* Simplify SVG markup
2019-05-27 13:59:25 -07:00
Nat Welch
3f91f80ede
Allow passing of title to default error page (#7381)
* Allow passing of title to default error page

* Update README to include Error#title information

* Change title init location

* Update _error.js
2019-05-27 12:22:14 -07:00
Joe Haddad
e27203f89b Dynamic routing mark 2 (#7432)
* 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: JJ Kasper <jj@jjsweb.site>

* remove example

* Add router tests

* Format code

* Sort routes

* Update to not use posix path methods
2019-05-27 11:20:33 -07:00
XBOY
0ee2bcc962 Fix duplicate dynamic chunks (#7425) 2019-05-26 18:17:08 -07:00
Joe Haddad
51b9eabe40
Refactor server router (#7431)
* Format next server

* Extract findPageComponents logic from renderToHTMLWithComponents

* Apply a little formatting

* Lift up component loading
2019-05-26 14:22:43 -07:00
JJ Kasper
77b23264bb Opt out of cache header if _app has custom getInitialProps (#7409)
* Opt out of cache header if _app has custom
getInitialProps to match autoExport behavior

* Fix wrong component

* Add test for cache header
2019-05-23 20:24:02 -07:00
JJ Kasper
9a50e926e3 Add document middleware (#7209)
* Add document middleware

* Update tests

* Apply suggestions from code review

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>
2019-05-23 19:05:08 -07:00
JJ Kasper
bb46c0673b
v8.1.1-canary.37 2019-05-23 14:59:12 -05:00
JJ Kasper
4ba6447e40
Don't load from serverless in dev mode (#7416) 2019-05-23 14:47:57 -05:00
Lukáš Huvar
bf294ee494
Types description (#7217)
* App, Document, Page, Error types description

* Router description

* Added head changed router

* Additions

* Fix examples

* Push and replace details

* Update packages/next-server/lib/head.tsx

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update packages/next-server/lib/utils.ts

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update packages/next/types/index.d.ts

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update packages/next/pages/_document.tsx

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update packages/next/pages/_document.tsx

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update packages/next/pages/_app.tsx

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>

* Update packages/next/pages/_document.tsx

Co-Authored-By: Luis Fernando Alvarez D. <luis@zeit.co>
2019-05-23 21:31:22 +02:00
Joe Haddad
98bed84688
v8.1.1-canary.36 2019-05-23 00:57:48 -07:00
Joe Haddad
f9f80dffe5
Upgrade dependencies (#7412)
* ⬆️ Upgrade workspace dependencies

* Run new prettier against examples

* Upgrade some next-server packages

* Upgrade Next.js dependencies

* Upgrade webpack deps

* Upgrade async sema

* Fix compilation

* Revert broken plugin
2019-05-23 00:52:36 -07:00
JJ Kasper
3adaafe783
Make sure rendering behavior is only changed when autoExport is enabled (#7408) 2019-05-22 16:16:03 -05:00
Joe Haddad
b6d3c1fd81
v8.1.1-canary.35 2019-05-22 09:47:34 -07:00
JJ Kasper
cdd54afb0d Add auto static/dynamic (#7293)
* 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
2019-05-22 09:36:53 -07:00
JJ Kasper
4718bd675f Document useAmp in readme (#7405) 2019-05-22 09:31:08 -07:00
terry chay
c0e4b56fdb Update to latest webpack-bundle-analyzer (#7389) 2019-05-21 19:12:25 -05:00
JJ Kasper
e6fb48cee8
Fix string type on router.query (#7387) 2019-05-20 10:21:15 -05:00
Joe Haddad
dc1f907cec
v8.1.1-canary.34 2019-05-19 19:09:42 -04:00
Joe Haddad
931cd3d305
Reduce the maximum number of shuttles 2019-05-19 19:07:19 -04:00
Yuki Takemoto
17f6fa96bd Fix broken link (#7378) 2019-05-18 15:06:51 +02:00
JJ Kasper
3c3abcb6d1
v8.1.1-canary.33 2019-05-17 14:49:41 -05:00
JJ Kasper
842a2905fe Disable babel-loader cache in flying shuttle mode (#7365)
* Disable babel-loader cache in flying shuttle mode

* Move cleaning up old babel-loader caches

* Change option name for disabling cache on babel-loader
2019-05-17 15:39:18 -04:00
Tim Neutkens
c77988944e v8.1.1-canary.32 2019-05-17 13:26:42 +02:00
Tim Neutkens
6feca310d7
Revert ncc webpack (#7370)
* Revert "Add retrying to CircleCi and fixes for ncc'ed webpack (#7366)"

This reverts commit 5beb365d12.

* Revert "ncc Webpack build (#7301)"

This reverts commit bd8f3c625f.

# Conflicts:
#	packages/next/package.json
2019-05-17 13:25:46 +02:00
Tim Neutkens
3dea1a5b15 v8.1.1-canary.31 2019-05-17 12:22:46 +02:00
JJ Kasper
5beb365d12 Add retrying to CircleCi and fixes for ncc'ed webpack (#7366)
* Add retrying to CircleCi and run prepublish separately to get better logs in Azure

* Apply workaround for Azure node 10 and ncc

* Update incorrect webpack imports

* Use ncced autodll-webpack-plugin

* Move autodll-webpack-plugin to devDependencies
2019-05-17 10:57:03 +02:00
JJ Kasper
f3b98994c4
v8.1.1-canary.30 2019-05-16 12:01:23 -05:00
Guy Bedford
bd8f3c625f
ncc Webpack build (#7301)
* add back ncc

* fixup ncc build
2019-05-16 11:55:54 -05:00
JJ Kasper
1cf804826f Show helpful warning when @types/react isn't found (#7345)
* Show helpful warning when @types/react isn't found

* Apply suggestions from code review

Co-Authored-By: Resi Respati <resir014@gmail.com>

* Update warning for yarn

* Check earlier so we can log one install command for TypeScript deps
2019-05-16 16:38:27 +02:00
JJ Kasper
7eafe5cb0a Anchor TypeScript check to fix invalid detection (#7349) 2019-05-15 17:25:51 -04:00
JJ Kasper
7612e03a75
v8.1.1-canary.29 2019-05-15 13:48:51 -05:00
Resi Respati
4eb48ce945 Remove allowSyntheticDefaultImports in favor of esModuleInterop (#7338)
As mentioned on previous PRs related to TypeScript, setting `esModuleInterop`
to `true` automatically sets `allowSyntheticDefaultImports` to `true` as
well, so this config validation is not required.

Reference: https://github.com/zeit/next.js/pull/7169#discussion_r280831148
2019-05-15 08:37:17 -04:00
JJ Kasper
577cc7b6af Fix error overlay dismiss after fixing build error (#7335)
* Make sure to dismiss type error after being fixed

* Update test
2019-05-14 20:27:02 -04:00
JJ Kasper
4309c87f2a Fix windows backslashes not being replaced when identifying AMP pages (#7331) 2019-05-14 12:49:41 -04:00
Joe Haddad
5ea721ea56
Redesigned page output (#7324)
* Redesigned page output

* Remove old commented out code

* right align files
2019-05-14 11:11:22 -04:00
Lukáš Huvar
b5e3aac1ec Fix POST and PUT on api routes (#7319)
* Fix POST and PUT

* Fix condition for request and test
2019-05-13 15:40:23 +02:00
Tim Neutkens
1cb6c4088b v8.1.1-canary.28 2019-05-11 15:34:42 +02:00
Tim Neutkens
75ba3db256
Make sure API routes are built in production (#7306)
* Make sure API routes is built correctly

* Don’t create client-side bundle for API routes

* Add tests for production
2019-05-11 15:32:38 +02:00
Tim Neutkens
c73a76b3e9 v8.1.1-canary.27 2019-05-11 13:22:36 +02:00
Lukáš Huvar
fedfbd9d5c Experimental API support (#7296)
* First basic API support

* Change require functionality

* Change 501 to 404

* Change wording

* Fix test
2019-05-11 13:18:56 +02:00
Joe Haddad
c21116ae12
v8.1.1-canary.26 2019-05-10 15:52:23 -04:00
JJ Kasper
28f1ca4f3e
re-add prefetch prop type with deprecated (#7292) 2019-05-10 14:33:40 -05:00
Joe Haddad
f533c5585b
Decommission old flying shuttles (#7299)
* Retire old flying shuttles

* retire => decommissioned
2019-05-10 11:37:54 -04:00
Shu Uesugi
36abf81518 Update readme to use @next/mdx (#7291)
* Update readme to use @next/mdx
2019-05-09 17:15:20 -05:00
Joe Haddad
c79cf23241 Store multiple flying shuttles (#7289) 2019-05-09 11:41:15 -05:00
Joe Haddad
74398d09f5
Separate shared shuttle modules (#7287)
* Separate shared shuttle modules

* Correct types
2019-05-09 10:13:11 -04:00
Joe Haddad
92cbe13b3d
Format chunk graph plugin 2019-05-09 09:28:38 -04:00
Lukáš Huvar
37ebd61b87
Update styling of TypeScript config 2019-05-09 11:53:28 +02:00
JJ Kasper
0eab07b7e8
Add automatic TypeScript setup (#7125)
* replace fkill with tree-kill
2019-05-08 21:51:23 -05:00
JJ Kasper
549b6379d2
v8.1.1-canary.25 2019-05-08 08:33:32 -05:00
Tim Neutkens
150234284c
Add initial docs for TypeScript (#7169)
* Add initial docs for typescript

* Update packages/next/README.md

Co-Authored-By: timneutkens <tim@timneutkens.nl>

* Update docs

* Update packages/next/README.md

* Update packages/next/README.md

* Update README.md
2019-05-08 12:09:02 +02:00
Joe Haddad
9f4904ff10 Integrate type checking into compilation pipeline (#7278) 2019-05-07 20:11:56 -05:00
Lukáš Huvar
e0c3545829 Remove components from client router (#7281) 2019-05-07 16:20:13 -05:00
JJ Kasper
41c6d92d25 Revert migrating babel-loader into Next.js (#7265)
clearing of stale babel cache
2019-05-07 14:24:47 +02:00
Luis Fernando Alvarez D
a7ca031313
Renamed IContext to be NextPageContext (#7272) 2019-05-06 16:42:04 -05:00
JJ Kasper
b97a47d273 Fix attempting to observe non-DOM refs in Link (#7249)
handleRef isn't called with valid DOM node
2019-05-06 15:44:18 +02:00
Luis Fernando Alvarez D
3a5c1ebe04 Add docs to public (#7239)
* New example: public-file-serving

* Updated sitemap-and-robots examples
2019-05-06 15:42:54 +02:00
Joe Haddad
948948f6be Fix application output (#7264) 2019-05-06 15:22:54 +02:00
Lukáš Huvar
5ac54d7afb Remove reload and use only location.reload (#7257) 2019-05-05 15:22:02 -05:00
JJ Kasper
a243bc435c Make sure to update asPath on hashOnlyChange to (#7255)
prevent getInitialProps from firing when it shouldn't
2019-05-05 14:34:33 -05:00
JJ Kasper
c421c259ec Fix webpack fetch error (#7253)
* Add devtool to AutoDllPlugin to prevent
react-error-overlay from attempting to
fetch webpack://

* Fix map file being added as script
2019-05-05 13:03:13 +02:00
JJ Kasper
59039cfc22
Fix default meta tag being added in AMP mode (#7248) 2019-05-04 11:46:50 -05:00
Cory Sherman
e2535575d2 update webpack to 4.30.0 (#7238)
* update webpack to 4.30.0

* update yarn.lock for webpack 4.30.0
2019-05-04 14:11:41 +02:00
JJ Kasper
0c639d94e7
v8.1.1-canary.24 2019-05-03 13:55:33 -05:00
Luis Fernando Alvarez D
74771bc5e4
Add support for /public (#7213) 2019-05-03 11:57:47 -05:00
JJ Kasper
9d936f3ab8
v8.1.1-canary.23 2019-05-03 09:51:40 -05:00
JJ Kasper
adbc1a8857
Remove unnecessary type from LinkProps (#7233) 2019-05-03 09:50:34 -05:00
JJ Kasper
a3ec7ca914
v8.1.1-canary.22 2019-05-02 17:21:49 -05:00
JJ Kasper
75203eb8d2
Fix missing injectCaller (#7223) 2019-05-02 17:20:27 -05:00
Joe Haddad
13c55a19cb
v8.1.1-canary.21 2019-05-02 16:38:51 -04:00
JJ Kasper
8b92b8b7ce Clear stale files from Next.js' babel-loader cache (#7221)
* Move babel-loader into next all the way converting
it to TypeScript and added tracking of babel-loader
cache so we can clear previous files

* Add license from babel-loader

* Apply suggestions from code review

Co-Authored-By: ijjk <jj@jjsweb.site>

* Make sure to catch errors in next-babel-loader
2019-05-02 16:30:41 -04:00
JJ Kasper
064be18039
v8.1.1-canary.20 2019-05-01 15:34:24 -05:00
JJ Kasper
2e8088e447
Add stats to build tree (#7194)
* Copy pretty-bytes instead of installing
2019-05-01 15:31:08 -05:00