Commit graph

689 commits

Author SHA1 Message Date
JJ Kasper
a27c235260 Update to share HMR and ondemand SSE connection (#7084)
We also close the connection when the window is in the background and re-connect when it is brought to the foreground. This prevents us from using up too many connections.
2019-04-22 05:51:09 +09:00
Luis Fernando Alvarez D
08937807f6 Remove dynamic-import-node from the preset (#7096)
Related to [this spectrum post](https://spectrum.chat/next-js/general/next-8-minor-update-breaks-dynamic-import-in-jest-tests~1e7b58e7-e301-4ef9-9de4-eef6ed3639d4).

I'm not removing the `babel-plugin-dynamic-import-node` package as it's going to be used by #7016
2019-04-22 05:25:48 +09:00
Fredrik Höglund
54e45eb74d Export 404 even if undefined in exportPathMap (#6912)
This PR adds the `_error`-page as an `404.html`-export, even when it is not explicitly defined in a custom `exportPathMap`.

It also fixes two false negative tests related to this. Previously the tests were matching the fallback 404-page from the test-server, rather than the `404.html`-page from next, which was actually not being generated. The test server is also not set up to serve `/404.html` as `/404` which the tests now reflect.

**Caveat**

In its current state, this PR removes `/404.html` from the `defaultPathMap` passed to the custom `exportPathMap`-functions, since it instead adds it after that function is run. While it is possible that someone is relying on this to exist, it is to my knowledge undocumented and also unlikely to be used for anything but merging it into the custom pathMap.

Since this would now merge `undefined` which would result in it being added later on anyway, I deemed it safe, but would be happy to undo that part of the PR if necessary as it was only cleanup.

**Examples**

As a way to demonstrate what this PR does, this is how examples changed:

* `basic-export` - Behaviour is unchanged, still has a `404.html`
* `with-static-export` - Now has a `404.html`
2019-04-22 05:24:28 +09:00
JJ Kasper
d9a6f1ca77 Move react-ssr-prepass import inside of (#7095)
ampBindInitData check
2019-04-22 03:47:02 +09:00
Connor Davis
f8978cc29c Detect built ins in externals (#7083) 2019-04-20 10:44:39 +09:00
JJ Kasper
7f4147d424 Run optimizer after validating in dirty AMP mode (#7063) 2019-04-20 10:33:20 +09:00
Joe Haddad
35236690c0
Disable Terser loader when debugging (#7079) 2019-04-19 13:26:30 +09:00
JJ Kasper
b00501e632 Add test for /dashboard/index (#7065)
This adds a test to the custom-server suite to make sure we don't regress on this
2019-04-18 12:15:56 +09:00
Joe Haddad
0dbd3b98ec v8.1.0 2019-04-17 10:03:51 +09:00
Connor Davis
588a8f379b
v8.0.5-canary.35 2019-04-16 19:21:04 -05:00
JJ Kasper
fdfbab5d25 Updated handling of AMP page reloading (#7052) 2019-04-16 18:04:41 -05:00
Lucas Machado
abae1734d8 Add a dot to a note in README.md (#7053) 2019-04-16 15:24:13 -05:00
JJ Kasper
75a2c45f6a AMP fix escaped rel (#7045)
if `&amp=1` is used to point to the `amphtml` version of a page it get's escaped causing it to become `&amp=1` this fixes it to stay as `&amp=1`

Closes: #7038
2019-04-16 22:57:17 +09:00
JJ Kasper
59b328b5c3 Remove client bundles for AMP only pages (#7034)
* Remove client bundles for AMP pages
after build since they are not used

* Remove trailing white space

* Use async-sema to limit removing AMP client bundles

* Bring AMP client bundle removing
semaphore concurrency down to 20

* Don't check blocked pages when
deleting AMP client bundles

* Update client bundle removing for AMP pages

* Add error handling for removing client AMP pages

* rethrow error unless ENOENT during
deleting AMP client pages

* Handle error during removing AMP client
pages the same during dev

* Fix throwing instead of rejecting

* Make sure next/config is set before requiring page

* Update error check

* return on reject

* Fix next/config
2019-04-16 22:56:34 +09:00
Tim Neutkens
5054e943d4
Remove experimental flag (#7048) 2019-04-16 22:39:34 +09:00
JJ Kasper
6f9c3aa839 Remove experimental amp config (#7046)
This just removes the need for setting the experimental amp option
2019-04-16 22:09:57 +09:00
Luis Fernando Alvarez D
c48340cd8c
Move next/router to Typescript (#7019)
Added types to next/router
2019-04-15 23:00:48 -05:00
Joe Haddad
8b136a6f9d
Add experimental option to enable terser loader (#7033) 2019-04-15 20:00:01 +09:00
JJ Kasper
cedd9b03f5
v8.0.5-canary.34 2019-04-15 18:50:45 +09:00
JJ Kasper
a79baccadc
Remove noDirtyAmp option (#7032) 2019-04-15 18:49:10 +09:00
JJ Kasper
cf889d6094 Re-add experimental amp config (#7030)
* Update amphtml and canonical rels, put amp behind
experimental flag again, and update checking for amp query

* Fix typescript error

* Re-add flag to next.config.js
2019-04-15 18:26:23 +09:00
JJ Kasper
016c197b7f Add AMP docs to README (#7031)
* Add AMP docs to README

* Update wording

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

* remove extra space

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

* Apply suggestions from code review

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

* Apply suggestions from code review

Co-Authored-By: ijjk <jj@jjsweb.site>
2019-04-15 18:02:59 +09:00
Tim Neutkens
1a53ca7474
Add x-powered-by (#7029)
* Add x-powered-by

* Remove ampEnabled type
2019-04-15 16:48:14 +09:00
Simon Boudrias
01779429ab Set descriptive displayName on withRouter HOC (#7017)
Not sure when it was introduced, but on the latest Next v8.0.4, there's no descriptive name attached to the component returns from `withRouter`.

This makes it harder to debug and write test cases for components wrapped by `withRouter`.
2019-04-13 13:21:28 +02:00
JJ Kasper
a0473e1f2a
v8.0.5-canary.33 2019-04-12 21:18:11 -05:00
JJ Kasper
09a2fe5c38
Amp page level reload (#6971)
* Only refresh the page when the active
page is updated in AMP mode

* Update handling of page reload to make sure it
still refreshes after a change to another page

* Update checking to be more accurate

* Fix amp-dev not being loaded without
experimental.amp and remove next.config from amp example

* Remove old with-amp example and
rename experimental-amp to with-amp

* update example name

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

* Update comment wording

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

* Use document for reload to keep scroll position

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

* fallback to reloading on error

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

* Update with-amp example readme
2019-04-12 20:54:27 -05:00
JJ Kasper
11016221cd
Make sure AmpContext is available in _document (#7021)
* Make sure AmpContext is available during _document
render and update filtering of script tags in AMP mode

* Update amphtml test to make sure
AmpContext is set for _document render

* Fix stray comma in render.tsx
2019-04-12 19:04:52 -05:00
Joe Haddad
dd98bddfb6
v8.0.5-canary.32 2019-04-11 17:11:25 -04:00
Joe Haddad
74cb4f4b7b
Switch to using .next/cache for flying shuttle and terser (#7013) 2019-04-11 17:09:12 -04:00
JJ Kasper
c1eba49289
v8.0.5-canary.31 2019-04-11 14:05:35 -05:00
JJ Kasper
e5111745b5
Replace .amp.js with withAmp(Comp) (#7009)
* 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
2019-04-11 13:59:26 -05:00
Joe Haddad
cc09478a7b Disable terser on .min.js input files (#7008)
This skips re-compressing already minified files.
2019-04-11 17:33:30 +02:00
Joe Haddad
3add5380b6
v8.0.5-canary.30 2019-04-11 10:29:24 -04:00
JJ Kasper
4b9b2fb3a5 Make async-to-promises babel plugin experimental (#7006)
* Make async-to-promises babel plugin experimental

* Move excludes for asyncToPromises behind flag too

* Move other configs behind flag

* Re-add original exclude item
2019-04-11 10:28:57 -04:00
Joe Haddad
b7091104b7
v8.0.5-canary.29 2019-04-10 23:50:44 -04:00
JJ Kasper
9e6708d144 Set custom cacheIdentifier for babel-loader (#6982)
* Set custom cacheIdentifier for babel-
loader that we can increment

* Update to consider external babel config
for cacheIdentifier

* Update to follow babel loader's cacheIdentifier behavior
2019-04-10 23:50:07 -04:00
Joe Haddad
54e9454788
v8.0.5-canary.28 2019-04-10 17:08:51 -04:00
JJ Kasper
711d45b698 Use next.config env and packages to calculate hashes (#7001)
* Use next.config env and packages to calculate
hashes for chunk-graph

* Remove example from testing

* remove left over import

* Tweak behavior
2019-04-10 15:19:50 -04:00
Joe Haddad
c2d0a4ef0e
Add Flying Shuttle v1 (#6991)
* Add Flying Shuttle v1

* Add serverless file restoration

* Add another message

* Update test

* Resolve page version last

* Print number of changed pages

* Remove old tests

* Re-add head build ID writing

* Change syntax appearance

* Start adding test components

* Fix react loadable manifest

* Complicate dynamic testing

* Fix first build missing head build id

* Remove flying shuttle tests
2019-04-10 12:41:59 -04:00
Joe Haddad
65fcf351c3
Add new getFileForPage helper to build utils (#6999) 2019-04-10 12:37:30 -04:00
Joe Haddad
a44788fb26
Disable flying shuttle when building for now dev (#6998) 2019-04-10 12:37:13 -04:00
Joe Haddad
a1598b5285
Disable recordsPath for selective page building (#6997)
We cannot rely on `recordsPath` when using selective page mode. All modules must be identified.
2019-04-10 12:23:16 -04:00
Joe Haddad
59fb471bc6
Correct page search order (#6996)
This fixes a case where a user has a page named `next.js.js` and `next.js`.
2019-04-10 12:22:10 -04:00
Joe Haddad
0e68d3c2d9
Adjust all modules identified plugin output (#6995)
This output clashed with the new output style. This output is more inline with existing behavior.
2019-04-10 12:21:14 -04:00
Joe Haddad
c2c634caa6
Use chunkGroup request over rawRequest for loadable manifest (#6993) 2019-04-10 12:06:16 -04:00
Joe Haddad
a863a720ef
Fix Chunk Graph Plugin hashes type (#6994) 2019-04-10 11:59:46 -04:00
Joe Haddad
94b8bf75e2
Move build utils to their own file (#6990)
* Move build utils to their own file

* Tweak feature detection
2019-04-09 23:15:35 -04:00
Joe Haddad
b543071440
Remove CLI and negative page building (#6986)
* Remove CLI and negative page building

* Remove select all tests

* Update test of getSpecifiedPages

* Prune old tests from snapshot

* Remove old flying shuttle tests
2019-04-09 22:57:46 -04:00
Joe Haddad
1810cf5abe
Add an experimental mode for flyingShuttle (#6985) 2019-04-09 22:05:40 -04:00
Joe Haddad
f301c4f063
Adjust onFinishCallback polyfill (#6984) 2019-04-09 21:49:44 -04:00
Luis Fernando Alvarez D
a5ad06f99b
the externals option is undefined for client builds (#6983) 2019-04-09 19:10:18 -05:00
JJ Kasper
5421274c87
Fix re-rendering on client after navigating back from external (#6652)
* Fix re-rendering on client after navigating
back from external site

* Clean up tagging before unload

* Add check for history.state 1/2

Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>

* Add check for history.state 2/2

Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>

* Add check for options

Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>

* Add test for navigating to external site and back
also added testing in safari and firefox

* Add test for query in url
2019-04-09 16:58:44 -05:00
Mayank Jethva
eeabb52bb1
Update README.md (#6749)
- fix runtime configuration example to use `customKey`
- standardize warning callouts to use a block quote and bold "**Warning:**" text. Previously there were different ways a warning was mentioned on the docs page:
  - A warning emoji. The warning emoji didn't render in the actual site.
    <img width="770" alt="Screen Shot 2019-03-21 at 9 22 21 AM" src="https://user-images.githubusercontent.com/1103708/54759302-c655f380-4bbb-11e9-9116-b0fdc2467bc3.png">
  - Italicized "Warning" text. Imo, does not stand out on the page.
    <img width="663" alt="Screen Shot 2019-03-21 at 9 24 43 AM" src="https://user-images.githubusercontent.com/1103708/54759376-f604fb80-4bbb-11e9-85c6-6589b7738dee.png">
2019-04-09 15:36:58 -04:00
Joe Haddad
ef9c39e249
v8.0.5-canary.27 2019-04-09 15:22:45 -04:00
Joe Haddad
ca565fc6e4
Adjust flying shuttle minify (#6980)
* Disable Terser plugin when using flying shuttle

* Add a new minify loader

* Downgrade terser

* Turn on minify loader

* Only compress source / mangle output
2019-04-09 15:13:25 -04:00
JJ Kasper
f04bd8bf33 Fix getSpecifiedPages on Windows (#6977)
weren't using the right separator
2019-04-09 15:10:08 -04:00
Luis Fernando Alvarez D
653f0a2a88 Disabled the checkWasmTypes config in webpack (#6978)
* Disabled the checkWasmTypes config in webpack

* Typescripted
2019-04-09 15:09:20 -04:00
Luis Fernando Alvarez D
ae5eeb39f4 Brought escape-string-regexp source to next (#6979)
* Brought escape-string-regexp source to next

* Added Copyright comment
2019-04-09 15:06:55 -04:00
Luis Fernando Alvarez D
72a31cb438
Disabled performance config in webpack (#6976) 2019-04-09 12:43:24 -05:00
Joe Haddad
c59218c4d8
Remove use of Promise.finally in polyfill (#6975)
* Remove use of Promise.finally

* Move line for clarity
2019-04-09 12:25:21 -04:00
JJ Kasper
b72396f2a1
v8.0.5-canary.26 2019-04-09 11:03:25 -05:00
Justin Chase
52dd42a6bb Do not clear the console (#6758)
* Do not clear the console

Its rude to clear the console, you may be sharing output with other processes even in tty mode.

* Remove unused dependency

* Dedupe and cleanup dev output without clearing

* use logError

* Remove exit handler

* Add next helper

* Add log helpers

* Switch store to log helpers and a shallow object compare

* Update other files to use new logging utility

* request => build

* Update ready on messages

* Use case insensitive matching
2019-04-09 11:52:03 -04:00
JJ Kasper
1c305ab36e
Add Amp bind error message (#6962) 2019-04-09 10:05:42 -05:00
Luis Fernando Alvarez D
75a6ef0646 Moved NODE_ENV to our config (#6965)
Closes #6943
2019-04-09 15:16:27 +02:00
Luis Fernando Alvarez D
f89bd8237b Replace imurmurhash with string-hash (#6964)
Closes #6939
2019-04-09 12:49:30 +02:00
Joe Haddad
9e4636572d
v8.0.5-canary.25 2019-04-08 11:00:30 -04:00
Joe Haddad
b586dbf5ef
Upgrade Async to Promises (#6958) 2019-04-08 11:00:01 -04:00
Joe Haddad
62462fb18c
v8.0.5-canary.24 2019-04-08 10:46:12 -04:00
Tim Neutkens
35bbe30912
Optimize resolve configuration (#6954)
* Resolve Next.js loaders first

Next.js loaders should be resolved first, then node_modules. There is no need for NEXT_PROJECT_ROOT_NODE_MODULES anymore since all our loaders are internal

* Move wasm to end of array

Since wasm isn’t the main target for Next.js it makes no sense to try and resolve it as the first value, as it would incur a file not found for nearly all files in the compilation
2019-04-08 14:57:21 +02:00
Tim Neutkens
4b7dd25328
Simplify options assignment (#6949) 2019-04-08 14:54:28 +02:00
Tim Neutkens
7b64381151
Disable terser for server build (#6951)
Checking the stats first. But at least until https://github.com/zeit/next.js/issues/6950 is figured out we should disable it for serverless builds as it's also disabled for zeit.co serverless builds.
2019-04-08 14:06:04 +02:00
Tim Neutkens
da02f57054
use var as libraryTarget (#6945)
By using `var` we opt-out of the LibraryTemplatePlugin. Considering we have our own loader for registering pages this makes sense.
2019-04-08 11:14:51 +02:00
Tim Neutkens
c0e6918b8c v8.0.5-canary.23 2019-04-07 21:02:09 +02:00
Tim Neutkens
45c100bc2a
Add babel-plugin-transform-async-to-promises (#6929)
* Add babel-plugin-transform-async-to-promises

* Remove unit test as this is covered by integration tests
2019-04-07 21:00:48 +02:00
Joe Haddad
91fd3a851d
v8.0.5-canary.22 2019-04-06 23:34:47 -04:00
Joe Haddad
444be1cba6
Fix nesting level of client page scripts (#6925) 2019-04-06 23:33:31 -04:00
Joe Haddad
a9648c447e
v8.0.5-canary.21 2019-04-06 22:26:32 -04:00
Joe Haddad
c56e962918
Add lambda version of shared chunks (#6924)
* Add lambda version of shared chunks

* Fix test on Windows
2019-04-06 22:25:38 -04:00
Joe Haddad
31dc4549de
v8.0.5-canary.20 2019-04-06 21:07:57 -04:00
Joe Haddad
33d32eab5a
Make chunk graph more accurate (#6923)
* Make chunk graph more accurate

* Include shared files in every page
2019-04-06 21:07:32 -04:00
Joe Haddad
54f21e984d
v8.0.5-canary.19 2019-04-06 16:23:48 -04:00
JJ Kasper
a34ecc0a4e
Remove route cache key (#6921) 2019-04-06 14:05:55 -05:00
Joe Haddad
a67b6ee117 Fix page resolution (#6920)
Previously this didn't work properly with nested pages.
2019-04-06 20:47:54 +02:00
Joe Haddad
d404879071
v8.0.5-canary.18 2019-04-06 13:13:15 -04:00
Joe Haddad
e89c22a3d3
Add a build all but specified pages mode (#6916)
* Add a build all but specified pages mode

* Always include reserved pages in build

* Add tests for ignore pages
2019-04-06 13:11:38 -04:00
Joe Haddad
1603b202e8
Better debug build message (#6915)
* Output a more correct message for debug builds

* Adjust wording
2019-04-05 22:46:35 -04:00
Joe Haddad
96fe5afe51
v8.0.5-canary.17 2019-04-05 16:35:56 -04:00
Joe Haddad
bbfc0f8207
Add more chunk graph data (#6911)
* Fix nested position

* Drop front commit

* Emit new page chunks key with all involved files for a page
2019-04-05 16:25:24 -04:00
JJ Kasper
54d5d7aae4
v8.0.5-canary.16 2019-04-05 14:44:50 -05:00
JJ Kasper
ac8b15a43e
Add useRequest hook and RequestContext (#6910)
* Add useRequest hook and RequestContext

* Add useRequest hook and RequestContext

* Fix merge conflict duplicate import
2019-04-05 14:43:40 -05:00
JJ Kasper
bc4e58f079 Add query for debugging amp data (#6909)
This adds a query for debugging AMP bind init data
2019-04-05 20:47:25 +02:00
JJ Kasper
0890797277 Only handle on catch in render (#6908)
To prevent slowing down we only handle on catch
2019-04-05 19:43:30 +02:00
Joe Haddad
bb4ecfb639 Revert "Extract styled-jsx (#6901)" (#6907)
This reverts commit 5dc9f55e94.
2019-04-05 17:13:06 +02:00
Tim Neutkens
c34dc14918 v8.0.5-canary.15 2019-04-05 12:36:14 +02:00
Tim Neutkens
84bb620bef
Temporarily only do one pass (#6900)
* Temporarily only do one pass

* Add types
2019-04-05 12:32:00 +02:00
Joe Haddad
d2a994db3c
v8.0.5-canary.14 2019-04-05 00:29:37 -04:00
Joe Haddad
3e5adfee24
Turn off module opts when selective page building (#6903) 2019-04-05 00:29:10 -04:00
Joe Haddad
ed1207f78a
v8.0.5-canary.13 2019-04-04 22:00:18 -04:00
Joe Haddad
5dc9f55e94
Extract styled-jsx (#6901) 2019-04-04 21:59:49 -04:00
Joe Haddad
9ed4467618
v8.0.5-canary.12 2019-04-04 20:50:29 -04:00