Commit graph

193 commits

Author SHA1 Message Date
Arunoda Susiripala
cc9b1d6ce0 Catch router events errors and print them. (#2663) 2017-07-27 19:20:39 +05:30
Arunoda Susiripala
2f7e459210 Make dynamic import spec compliant. (#2612)
* Make dynamic import spec compliant.
Now we simply return the whole module incl. default field
In 'next/dynamic' we pick the default field if there is.
Since modules with default is mostly used next/dynamic, for the enduser, this change has no effect.

* Rename module into m
Using module could be confusing.
2017-07-20 23:21:04 +05:30
Arunoda Susiripala
61ffc6da7f Change next/link proptypes to support the API. (#2607)
Add propTypes for replace and object support for href and as.
2017-07-20 21:54:04 +05:30
Arunoda Susiripala
c97aca50e5 Show webpack errors in all pages. (#2588)
* Show webpack errors in all pages.
When there's a webpack error that means HMR failed too.
So, showing other pages won't makes sense since user
can't edit them and get changes via HMR.
That's why now we show the error on all pages.

* Remove exact propType checks from the error component.
When there's an error, something this check shows in the console.
That means it could accept more props.
Also this is not a public API. So, we don't want to do propType checks.
2017-07-18 12:30:23 +05:30
Jayden Seric
1a02b0efa4 Added missing as propType to Link. (#2579)
This was causing the error “Failed prop type: Link: unknown props found: as in Link” when used with next-routes.
2017-07-17 10:42:36 +05:30
Tim Neutkens
ee29abb8d1 Add propType check with validation (#2516) 2017-07-09 18:42:20 +05:30
Victor Borges
6e7ac5f0ef fix: Forces Link to expose the href to the child using passHref property. (#2503)
* Forces Link to exposes the href to the child using passHref property.

* tests for passHref prop of the Link

* passHref property Link documentation
2017-07-09 10:39:02 +05:30
Arunoda Susiripala
783ecdefd2 Merge branch 'master' into v3-beta 2017-07-09 09:57:56 +05:30
fridays
9cc8d26a68 fix regex for pages that end with index (#2505) 2017-07-09 09:50:30 +05:30
Arunoda Susiripala
871bc4e06b Add tests for EventEmitter. (#2515) 2017-07-09 09:16:53 +05:30
Arunoda Susiripala
0c7089f856 Remove mitt and use an internal EventEmitter (#2477)
This fixes one of the crucial bug in Next.js
The issue happens when you try to load a page when it's
prefetching.
With mitt, it only fires the first registered event.
2017-07-06 12:19:33 +05:30
Tim Neutkens
a6e069d4f9 Add property to list of deduped tags (#2439) 2017-07-03 11:02:47 +05:30
Arunoda Susiripala
304225d9ea Optimize the bundle size of Next.js core (#2422)
* Try to the slim the webpack output.

* Remove react-hot-loader completely from production.
2017-07-01 12:54:16 +05:30
Andrei Pfeiffer
4c33c6b9fc lint: use const instead of let (#2270) 2017-06-25 12:45:45 +02:00
Arunoda Susiripala
8c6550c504 Fix a potential race condition in router when doing prefetching. (#2317) 2017-06-23 10:46:55 +05:30
Jess Telford
8017bd3774 More informative error for bad routes (#2300) 2017-06-20 21:43:38 +02:00
Arunoda Susiripala
8277d43190 Rewrite url when exporting only if there's a href. (#2316) 2017-06-20 14:07:36 +05:30
Henrik
7b8a4ea234 Create displayName util (#2286) 2017-06-19 18:33:02 +05:30
Arunoda Susiripala
9df59c1176 Dynamic component support with multiple modules (#2235)
* Layout ground works for next/async

* Implement the Dynamic Bundle feature.

* Add some test cases.

* Update README.

* Implement props aware dynamic bundle API.

* Update tests and README.

* Add a test case for React Context support.
2017-06-16 18:49:34 +05:30
Arunoda Susiripala
3898cb53b4 Make sure page-loader doesn't throw errors when registering. (#2282)
Even if it does it, we need to mark it as a page error.
2017-06-16 16:43:55 +05:30
Arunoda Susiripala
a36be58124 Rewrite urls with hashes correct for static export. (#2242)
* Rewrite urls with hashes correct for static export.

* Fix some lint issues inside an example app.
2017-06-13 11:44:31 +05:30
Arunoda Susiripala
4726c4352e Scroll to the hash only if there's one after an error. (#2224) 2017-06-09 23:45:37 +02:00
Arunoda Susiripala
0d4e0e52f7 Implement the correct browser behavior for hash changes. (#2223) 2017-06-10 01:02:28 +05:30
Krisztian Puska
28b40a5d41 Update debug error colors (#2182)
* Update debug error colors

* Soften colors

* Color tweaks, use zeit red w white header
2017-06-10 00:20:58 +05:30
Guillermo Rauch
37be0ab765 filter for null *after* Children is called to make this work with some -compat pollyfills 2017-05-22 12:58:54 -07:00
Kye Hohenberger
4c52ea1f70 Add shallow support to Link (#2012) 2017-05-21 08:24:58 +05:30
Arunoda Susiripala
4d0147385c Merge v3-beta in dynamic-imports 2017-05-15 09:41:42 +05:30
Arunoda Susiripala
e78c2f44dc Introduce proper url routing for next-export which supports query strings. 2017-05-14 06:10:32 +05:30
Arunoda Susiripala
90991f176c Add <page>/index.html url re-writes to next/router. 2017-05-14 05:55:57 +05:30
Arunoda Susiripala
b18ecc925b Implement client side routing as they should work.
Basicaly, now client side routing as they work like
in Next.js including prefetching.
2017-05-11 08:24:27 -07:00
Arunoda Susiripala
98ed666ca6 merge master into next-export 2017-05-10 19:01:01 -07:00
Arunoda Susiripala
450277f294 Make sure next export doesn't break other modes. 2017-05-09 00:42:48 -07:00
Arunoda Susiripala
147a5ce641 Fix server rendering issue for normal apps. 2017-05-08 23:42:37 -07:00
Arunoda Susiripala
311e4ca0ee Make sure the router is aware of the nextExport
Based on the we can change the routing to do SSR always.
Also make sure pageLoader don't download the page via
client side twice.
2017-05-08 18:20:50 -07:00
Arunoda Susiripala
0edee47d07 Fix the page-loader-normalization issue on '/index' page. (#1882) 2017-05-04 13:05:47 -07:00
Arunoda Susiripala
24f3f143a6 Introduce "asPath" into router and getInitialProps (#1857)
* Add asPath to next/router and getInitialProps context.

* Add test cases.

* Update docs.

* Build as-path pages before they use.
2017-05-03 09:40:09 -07:00
Arunoda Susiripala
f578089d05 Fix page loader page normalization issue (#1844)
* Add integration tests for nested componentDidMount

* Fix the page loader normalization issue.

* Fix a typo in the url.
2017-05-01 16:26:18 -07:00
Arunoda Susiripala
d4e047839c Make sure to run the promise logic if only called .then() 2017-04-27 17:12:20 -07:00
Arunoda Susiripala
fc34484e5e Fix a typo. 2017-04-27 13:07:01 -07:00
Arunoda Susiripala
93da57e1f6 Set a proper displayName for the wrapper dynamic component. 2017-04-27 09:05:18 -07:00
Arunoda Susiripala
686dd4c4dd Merge master into dynamic-import. 2017-04-27 08:48:43 -07:00
Kuan
fb0b7534d7 Update isLocal logic to enforce protocol and port (#1737) 2017-04-22 15:07:36 +02:00
Arunoda Susiripala
17329edcc9 Handle require.ensure errors well.
Introduce a new Promise library which runs on the same eventloop.
2017-04-19 23:55:06 +05:30
Arunoda Susiripala
b5a03a3896 Implement ssr=false support. 2017-04-18 22:21:31 +05:30
Arunoda Susiripala
f2bfcd01b0 Add an example with custom loading component. 2017-04-18 22:07:57 +05:30
Arunoda Susiripala
90ea471aa7 Merge master into dynamic-import. 2017-04-18 21:42:21 +05:30
Arunoda Susiripala
dec85fe6c4 Add CDN support with assetPrefix (#1700)
* Introduce script tag based page loading system.

* Call ensurePage only in the dev mode.

* Implement router using the page-loader.

* Fix a typo and remove unwanted code.

* Fix some issues related to rendering.

* Fix production tests.

* Fix ondemand test cases.

* Fix unit tests.

* Get rid of eval completely.

* Remove all the inline code.

* Remove the json-pages plugin.

* Rename NEXT_PAGE_LOADER into __NEXT_PAGE_LOADER__

* Rename NEXT_LOADED_PAGES into __NEXT_LOADED_PAGES__

* Remove some unwanted code.

* Load everything async.

* Remove lib/eval-script.js
We no longer need it.

* Move webpack idle wait code to the page-loader.
Because that's the place to do it.

* Remove pageNotFound key from the error.

* Remove unused error field 'buildError'

* Add much better logic to normalize routes.

* Get rid of mitt.

* Introduce a better way to register pages.

* Came back to the mitt() based page-loader.

* Add link rel=preload support.

* Add assetPrefix support to add support for CDNs.

* Add assetPrefix support for preload links.

* Update readme.md
2017-04-17 21:18:43 -07:00
Arunoda Susiripala
dfa28815a5 Add server side rendering for dynamic imports. 2017-04-18 01:45:50 +05:30
Arunoda Susiripala
6e0e7b4d5a Came back to the mitt() based page-loader. 2017-04-11 22:07:59 +05:30
Arunoda Susiripala
7997c1fd3c Introduce a better way to register pages. 2017-04-11 20:03:18 +05:30