Commit graph

1643 commits

Author SHA1 Message Date
Tim Neutkens
f177ce4291 v8.0.4-canary.8 2019-03-06 13:10:21 +01:00
Tim Neutkens
0088083f52
Check if esmodules is supported before enabling useESModules (#6534)
* Check if esmodules is supported before enabling useESModules

* Remove console.log
2019-03-05 16:57:07 +01:00
Tim Neutkens
e10096cd0c
Add preload notice (#6532)
Fixes #6517
2019-03-05 14:55:05 +01:00
Connor Davis
861edad459 Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib

Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
recursive delete 3
149.798316
recursive delete 4
182.184688
recursive delete 5
130.346207
--- Average: 142.83ms
```
`recursiveDelete` finishes in ~30% of the time it takes `rimraf` (3.3 times faster)
2019-03-05 14:01:42 +01:00
JJ Kasper
491f9a2c49 Move next-mdx from zeit/next-plugins to zeit/next.js (#6443)
At request of @timneutkens I moved the `next-mdx` plugin from the next-plugins repo into Next.js. Also fixed small typo in README under setup.
2019-03-04 18:02:45 +01:00
Tim Neutkens
8f25bc6871 v8.0.4-canary.7 2019-03-03 20:47:05 +01:00
JJ Kasper
c3b1f31ed5 Fix /index/index.js route not emitting the right route in production (#6516)
Also added integration test in production for this

Fixes: #6285
2019-03-03 19:36:32 +01:00
JJ Kasper
4c35b7e704
Add warning on stalled page load possibly from too many tabs open (#6514)
* Add warning on stalled page load possibly from too many tabs open

* Add test for stalled warning

* Update onDemand pinging to close on routeChangeStart and added
warning when onDemand handler detects multiple tabs from the same
browser
2019-03-02 16:51:14 -06:00
JJ Kasper
5034e4e1de
Updated entries to not output _app and _document in serverless (#6512)
* Updated entries to not output _app and _document in serverless

* Add test
2019-03-02 13:53:13 -06:00
Joe Haddad
494889acd8
Format a few documents (#6505) 2019-03-01 14:51:13 -05:00
JJ Kasper
a9c398854a
Add console.error before exit on uncaughtException (#6504) 2019-03-01 13:18:33 -06:00
Tim Neutkens
a169017c87
Add docs for named exports using dynamic (#6502) 2019-03-01 17:28:29 +01:00
Anton Egorov
5db0bef98e update webpack-dev-middleware to fix querystring in file names (#6498)
Fixes #6481
2019-03-01 17:28:09 +01:00
Tim Neutkens
8eb813a640
await config (#6488)
* await config

* update config-promise-error test

* Actually update test
2019-03-01 01:09:07 +01:00
Joe Haddad
330bedacc7 Add Babel plugin that fixes className for Amp elements (#6486)
This is a simple Babel plugin that overwrites certain attributes for `amp-` elements.
2019-02-28 23:04:29 +01:00
Joe Haddad
a8d7a6ce42 v8.0.4-canary.6 2019-02-28 15:38:12 -05:00
Joe Haddad
68123d8b8d v8.0.4-canary.5 2019-02-28 14:35:21 -05:00
Joe Haddad
cc2b7bc8fa
Setup on-demand-entries ping to prevent AMP page disposal (#6484)
* refactor(on-demand-entries): extract method: setupPing

* Setup ping for amp pages

* Missed a call
2019-02-28 12:52:13 -05:00
Joe Haddad
c904126057
refactor(on-demand-entries): extract method: setupPing (#6483)
* refactor(on-demand-entries): extract method: setupPing

* Missed a call
2019-02-28 12:31:31 -05:00
JJ Kasper
8ae1cd35bd Fix dynamic require breaking after updating to v8 (#6475)
* Fix dynamic require breaking after updating to v8

* Add test for dynamic require
2019-02-28 14:41:54 +01:00
JJ Kasper
1c1d5d01f8 Throw error when Promise is returned in next.config (#6476)
After discussion, it was decided we should throw an error when a promise is returned in `next.config.js` as this isn't supported

Fixes: #6416
2019-02-28 14:39:51 +01:00
Joe Haddad
227ea5756d
Change ncc taskr function name (#6471) 2019-02-27 09:22:18 -05:00
Joe Haddad
41eaa9cf5a
Run ncc on unistore to fix install warning (#6459)
ncc unistore to fix install warning
2019-02-27 09:12:40 -05:00
Tim Neutkens
88388f79b4 v8.0.4-canary.4 2019-02-27 13:20:30 +01:00
JJ Kasper
256970ac75 Remove next-to-next-server babel plugin (#6458)
After discussion it was decided instead of rewriting `next/config` and `next/head` imports to `next-server/config` and `next-server/head` we should just allow importing them as `next/config` and `next/head`
 
Fixes: #6187
2019-02-27 11:00:02 +01:00
Connor Davis
b8d3b7e69e
v8.0.4-canary.3 2019-02-26 16:07:42 -06:00
Connor Davis
2fd397ff5a
Add error for exporting when target is not server (#6455) 2019-02-26 15:48:30 -06:00
Connor Davis
7dc50f3867
Remove cross-spawn (#6450) 2019-02-26 14:57:32 -06:00
Jan Potoms
5f70c23465 Fix for index.js pages inside a folder named 'index' (#6423)
* Add failing test

Test case for
https://github.com/zeit/next.js/issues/6285
and
https://github.com/zeit/next.js/issues/6380

* WIP

* refactor and fix test

* not problem

* refactor back

* rename variables

like https://github.com/zeit/next.js/blob/canary/packages/next/server/on-demand-entry-handler.js#L163

* Update usage and add comment
2019-02-26 15:57:45 +01:00
Joe Haddad
6ffc2ffc2a v8.0.4-canary.2 2019-02-25 17:55:33 -05:00
Joe Haddad
f15cfeba0a
AMP automatic page refreshing in dev (#6392)
* AMP page reload

* Fix comment

* Skip dev files in production

* Polyfill event source

* Add HMR test for AMP

* Use webdriver

* Use a dynamic server for HMR test

* ffs
2019-02-25 17:00:14 -05:00
Jesse Hoffman
a971d295ab Remove jsonPageRes Documentation Reference (#6440)
Next.js no longer uses `jsonPageRes`.

This PR removes it from `en-us` and `zh-cn` documentation (formatting picked up some changes on zh-cn readme).

Also updated the Flow type def for `getInitialProps`.

Resolves #6363
2019-02-25 16:49:11 +01:00
Connor Davis
5514949df0 Remove glob package (#6415)
We don't use a lot of the features of `glob`, so let's remove it in favor of a leaner approach using regex.

It's failing on windows and I have no idea why and don't own a windows machine 🤦🏼‍♂️

(Ignore some of the commits in here, I forgot to create the new branch before I started working)
2019-02-24 22:08:35 +01:00
Tim Neutkens
f7ee137f9c v8.0.4-canary.1 2019-02-23 12:25:34 +01:00
Tim Neutkens
297f1a3fc0 Remove event-source-polyfill dependency 2019-02-23 11:51:54 +01:00
Tim Neutkens
41ed6803ac v8.0.4-canary.0 2019-02-23 11:21:29 +01:00
Connor Davis
b146eb5200
Replace del with rimraf package (#6411) 2019-02-22 13:49:30 -06:00
Tim Neutkens
bfb5224ce4
Remove schema-utils dependency (#6413) 2019-02-22 20:05:34 +01:00
Tim Neutkens
6d17a93b63
Upgrade async-sema (#6410) 2019-02-22 19:14:38 +01:00
Connor Davis
597c7d447a Add taskfile for ncc (#6409)
* Add ncc taskfile

* Add ncc dep and pass options

* dev dep
2019-02-22 17:33:53 +01:00
Tim Neutkens
e60a7cf529
Remove mkdirp-then in favor of promisify (#6408) 2019-02-22 17:33:28 +01:00
Tim Neutkens
9247c90177
Remove http-status dependency (#6405) 2019-02-22 16:25:11 +01:00
Tim Neutkens
b88addfcd5
Remove event-source-polyfill dependency (#6407) 2019-02-22 16:23:58 +01:00
Tim Neutkens
a99323cbc0 v8.0.3 2019-02-22 13:35:24 +01:00
Tim Neutkens
ca7b77292b v8.0.3-canary.0 2019-02-22 10:39:39 +01:00
Tim Neutkens
d0e90d05a0 Don’t hide parse error from on-demand-entries 2019-02-22 10:38:40 +01:00
Tim Neutkens
299eeb4f4f Merge branch 'master' into canary 2019-02-22 10:37:20 +01:00
JJ Kasper
71ae456a7c Fix invalid ping response throwing error in client (#6397) 2019-02-22 10:22:23 +01:00
Tim Neutkens
016d41f2a8 v8.0.2 2019-02-22 00:17:13 +01:00
Tim Neutkens
d14d1704cb
Remove ansi-html dep (#6394)
It's not needed since we use react-error-overlay for webpack errors.
2019-02-22 00:12:47 +01:00
Tim Neutkens
ce7dcaeadb v8.0.2-canary.7 2019-02-21 15:43:00 +01:00
Joe Haddad
1757ad022c Drop cli-cursor dependency (#6387) 2019-02-21 15:34:35 +01:00
Tim Neutkens
faf69b45c2 v8.0.2-canary.6 2019-02-21 01:09:43 +01:00
Joe Haddad
3ba18117f3 Pass all <Html> props to <html> (#6378)
* Pass along props to html

* Check for html props to be passed

* Switch ordering of html tag props

* Remove children from this.props
2019-02-21 00:42:53 +01:00
Joe Haddad
8b784766f1 Remove alternate screen usage (#6377)
* Make console output well behaved

* Fix bad rebase
2019-02-21 00:42:27 +01:00
Isaac Hinman
6e23b75c90 feat: Validate url.format calls (#6379) 2019-02-20 17:01:45 -05:00
Connor Davis
61de215e04
Move webpack config to TypeScript (#6348) 2019-02-20 13:24:02 -06:00
Tim Neutkens
0bf5041ef4 v8.0.2-canary.5 2019-02-20 17:05:55 +01:00
Joe Haddad
5ff2deabf7 Add Html tag for custom Document (#6372)
This introduces a new `<Html>` tag for a custom `Document` so that we can correctly toggle the `amp` flag (among other things in the future ... maybe).

This is already "tested" through every other test & the AMP validator -- but let me know if we want explicit tests.
2019-02-20 15:46:29 +01:00
Tim Neutkens
b0a9b99b7f v8.0.2-canary.4 2019-02-20 13:30:27 +01:00
Joe Haddad
90f9c64b74
Use alternate screen buffer if terminal supports it (#6364) 2019-02-20 07:20:09 -05:00
wtgtybhertgeghgtwtg
ddd01df4ec Make getBaseWebpackConfig synchronous. (#6356)
Currently, `getBaseWebpackConfig` is marked async, but it doesn't await anything or otherwise return a Promise.  Please correct me if I am wrong, but it looks like it can be made synchronous.
2019-02-20 00:05:46 +01:00
Connor Davis
fcf1167cd4 Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12
2019-02-19 22:45:07 +01:00
JJ Kasper
bf69357f27 Remove onDemandEntries WebSocket server in favor of EventSource connection (#6354)
After talking with @timneutkens it was decided it'd be more streamlined to replace the onDemandEntries WebSocket with an alternative. Using the EventSource connection gives us these benefits over the WebSocket one:

- less code needed
- no extra server running
- no extra config for onDemandEntries
2019-02-19 21:58:47 +01:00
Timothy
3db5361047 Update readme with ZEIT Now deployment guide link (#6341)
* Update readme with ZEIT Now deployment guide link

* Update links to ZEIT Now deployment guide

* Fix missing word
2019-02-19 17:37:00 +01:00
Joe Haddad
a2f37ba4cc Join merged style tags (#6345) 2019-02-19 14:45:26 +01:00
Kenneth Luján Rosas
fb672478c1 fix: pass full path to launch-editor (#6302)
* fix(launch-editor): resolve filename including current working directory

* refactor: handle when fileName is already absolute

* feat: use Next.js dir instead of process.cwd()
2019-02-18 10:16:28 -05:00
Joe Haddad
6dfcacb7bf
Use a query parameter for AMP pages instead of new route (#6336)
Per consensus in a mixed-application scenario, we'll use the `amp` query parameter convention.
2019-02-18 09:44:21 -05:00
Tim Neutkens
9f2eb85de3 v8.0.2-canary.3 2019-02-17 20:48:43 +01:00
Tim Neutkens
a1ccc19a1f
Pass through arguments of the next cli correctly (#6327)
Arguments that held the same name as one of the default commands were filtered out, causing issues.

For example `next build build` would get rid of the second `build` parameter.

Fixes #6263
2019-02-17 20:13:10 +01:00
Tim Neutkens
774af7fa0b v8.0.2-canary.2 2019-02-17 13:15:42 +01:00
Joshua Scott
46d870ab8a Fix url in docs (#6323) 2019-02-17 12:57:17 +01:00
Joe Haddad
7078f6567d Make build output friendlier (#6320)
Success:
![image](https://user-images.githubusercontent.com/616428/52907314-5e636480-322d-11e9-9420-b348663a3a7a.png)

Error:
![image](https://user-images.githubusercontent.com/616428/52907318-6c18ea00-322d-11e9-848d-e615d6af747d.png)

Warnings:
![image](https://user-images.githubusercontent.com/616428/52907353-2d376400-322e-11e9-9778-370f36912491.png)

---

We can still make build error output friendlier, but this is a good start.
2019-02-17 12:56:48 +01:00
Tim Neutkens
3882979236 v8.0.2-canary.1 2019-02-16 17:12:27 +01:00
Joe Haddad
56b1f81ace Fix development mode output (#6312)
* Remove usage of WebpackBar and Friendly Errors

* Add new clearConsole helper

* Add new simplified output for development mode

* Add an explicit bootstrapping mode

* Add missing returns

* Use existing output style

* Adjust first output to say Waiting on

* Only print URL if present
2019-02-16 17:09:49 +01:00
Tim Neutkens
036f5bf11b v8.0.2-canary.0 2019-02-16 16:41:30 +01:00
Tim Neutkens
708c537fc6 Merge branch 'master' into canary 2019-02-16 16:38:42 +01:00
JJ Kasper
5d779a0289 Add falling back to fetch based pinging for onDemandEntries (#6310)
After discussion, I added falling back to fetch based pinging when the WebSocket fails to connect. I also added an example of how to proxy the onDemandEntries WebSocket when using a custom server. Fixes: #6296
2019-02-15 22:22:21 +01:00
Connor Davis
1e5d0908d0 Block Certain Env Keys That Are Used Internally (#6260)
Closes: #6244 

This will block the following keys:
```
NODE_.+
__.+
```

There doesn't seem to be a way to simulate a failed build or else I'd add tests for it.
2019-02-15 17:49:40 +01:00
Joe Haddad
9bb8fbf535
Update webpack message formatter (#6299) 2019-02-14 11:13:35 -05:00
Tim Neutkens
4051ffcb01 [experimental] Rendering to AMP (#6218)
* 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
2019-02-14 10:22:57 -05:00
Gary Meehan
126eb49867 Fix README links (#6284) 2019-02-13 10:53:04 -05:00
Tim Neutkens
7fd9cb440d v8.0.1 2019-02-13 09:31:49 +01:00
Tim Neutkens
77a5a6f91a v8.0.1-canary.0 2019-02-13 07:20:54 +01:00
Tim Neutkens
4fea345f5d Merge branch 'master' into canary
# Conflicts:
#	lerna.json
#	packages/next-server/package.json
#	packages/next/package.json
2019-02-13 07:19:58 +01:00
Truong Hoang Dung
10f41f5d47 Fix Docs (#6270)
Add options to customize webpack config section.
2019-02-13 07:08:41 +01:00
Joe Haddad
f43e1a95f1
Set default Error status code to 404 (#6276)
* Set default `Error` status code to 404

This is an appropriate default behavior because:

1. When the server encounters an error, the `err` property is set.
2. When the client-side application crashes, the `err` property is set.

This means the "only" way to render the `/_error` page without an error
is when a page is not found (special condition).

Fixes #6243
Closes #5437

* Add new integration test for client side 404

* single quotes

* Remove unused variable

* Standard needs to go away

* Whoops

* Check for null status code in res and err

* Only check response for valid statusCode
2019-02-12 21:32:25 -05:00
Connor Davis
68db0992b6
v8.0.0-canary.24 2019-02-11 19:29:58 -06:00
Connor Davis
bd249180c6
Fix Runtime Config in next export (#6258) 2019-02-11 19:28:47 -06:00
Joe Haddad
33b9ebc783 Add module as server fallback main field (#6256)
* Add `module` as server fallback main field

* Test that a module only package can be imported
2019-02-12 01:39:57 +01:00
Juan Olvera
23c9c0d624 Change anynymous functions to named functions on examples in the README.md file (#6255)
* convert export default anonymous functions into named functions

* change examples to function declaration and split export in classes

* change NextHead name to Head and rename component
2019-02-12 00:04:05 +01:00
Jason Miller
734513b9be Apply babel to .mjs files (#6253) 2019-02-11 18:59:24 +01:00
Tim Neutkens
e4f96e65d3 v8.0.0 2019-02-11 09:02:37 +01:00
Tim Neutkens
8ddf9c7f27 v8.0.0-canary.23 2019-02-11 08:28:49 +01:00
Tim Neutkens
100b733960 v8.0.0-canary.22 2019-02-11 08:17:22 +01:00
Giuseppe
ac0976affe Update styled-jsx (#6236)
Changelog https://github.com/zeit/styled-jsx/releases/tag/v3.2.1
2019-02-10 22:19:38 +01:00
Akram
63c25a9c60 update preset.ts to use isProduction variable (#6234) 2019-02-10 18:45:51 +01:00
Tim Neutkens
bfd2d08ff2 v8.0.0-canary.21 2019-02-10 05:10:24 +01:00
Tim Neutkens
2ecb2489ce v8.0.0-canary.20 2019-02-10 04:56:14 +01:00
Tim Neutkens
45f5663558
Bring in terser-webpack-plugin (#6231)
* Bring in terser-webpack-plugin

* Ignore terser from linting
2019-02-10 04:55:09 +01:00
Kris Luminar
693ab43663 Fix typo (#6230) 2019-02-10 04:45:33 +01:00
Tim Neutkens
c0701e948f v8.0.0-canary.19 2019-02-08 16:04:44 +01:00
Connor Davis
6f162b94e1 Add Error when using publicRuntimeConfig with target serverless and add buildVars (#6212)
Introduce env to next.config.js for build-time configuration
2019-02-08 14:38:18 +01:00
Tim Neutkens
815f2e9138
Only compile /_error when /_error is needed (#6192)
Followup to removing the /_error in the initial markup we can now compile it using on-demand-entries only when it's needed.
2019-02-03 15:34:28 +01:00
Konstantin Grushetsky
2f304bd10e Remove 'acorn' dependency (#6193) 2019-02-03 14:36:29 +01:00
Guilherme Augusto Henschel
ed2aa607d5 Updated readme with improved info about next/link and next/router (#6197) 2019-02-03 14:34:27 +01:00
Giuseppe
5a4176cffe Invalidate cache for link[preload] in DEV (#6183)
Fixes #5860
2019-02-03 00:12:49 +00:00
Tim Neutkens
b2b2041e39 v8.0.0-canary.18 2019-02-01 13:23:56 +00:00
Sultan Tarimo
1a416b688e Load ErrorComponent dynamically (#6171)
Closes #6152.

- Only dynamically load /_error.js when an exception occurs.
- Fix websocket “/_error.js” ping oddity.
2019-01-31 20:45:36 +00:00
Dovydas Navickas
f4f3649de3 Update README.md (#6106)
* Update README.md

I know I'm a moron for not understanding what's written in black on white, but... Maybe this will save someone an hour or two 😄

* Apply proposed changed
2019-01-29 15:50:01 +01:00
Tim Neutkens
0e21615245 v8.0.0-canary.17 2019-01-27 22:03:13 +01:00
Tim Neutkens
59280f7747
Compile all next module files (#6155) 2019-01-27 21:56:02 +01:00
Tim Neutkens
136c37eca9 v8.0.0-canary.16 2019-01-27 17:20:24 +01:00
Tim Neutkens
b3045cc7a9
Implement circular JSON err.sh link (#6149)
* Implement circular JSON err.sh link

* Add test for getInitialProps returning circular json

* Make test warn less

* Fix tests

* Add reference to original tests
2019-01-27 16:12:17 +01:00
Luis Fernando Alvarez D
125aaf8834 Small fix in serverless docs (#6146) 2019-01-27 00:24:11 +01:00
Tim Neutkens
c6d3484a21
Handle SIGTERM with status code 0 (#6143)
Fixes #6140
2019-01-26 22:51:08 +01:00
Connor Davis
e46fdd6546 Add arcorn to fix webpack/npm bug (#6137) 2019-01-26 02:28:44 +01:00
Tim Neutkens
f05d339dcf v8.0.0-canary.15 2019-01-26 02:02:48 +01:00
Tim Neutkens
b4ade0a3cd Revert "Move phases back to next/constants (#6104)"
This reverts commit 9112f63eba.
2019-01-26 02:01:49 +01:00
Tim Neutkens
024323b6d8 v8.0.0-canary.14 2019-01-25 19:14:11 +01:00
Luc
14604450cb Print list of pages when building (#6125)
* show pages created when building

* fix types
2019-01-25 18:36:29 +01:00
Tim Neutkens
7ecf675834
Remove resolve rule (#6133)
Fixes #6117

I'm not entirely sure why we had this rule in the first place. I think for some tests related things when we didn't have a monorepo yet. However it could also be related to bundle sizes. I'll compare that when the build finishes.

The reason for #6117 is that we added `react-is` to the dependency tree of Next.js to check valid elements. react-redux uses hoist-non-react-statics which ships a different version of react-is in this case, one that has `ReactIs.isMemo`
2019-01-25 18:33:58 +01:00
Tim Neutkens
6c49bee959
Make side-effect.js smaller (#6118)
Start at making side-effect.js / head.js smaller.
2019-01-25 01:39:15 +01:00
Connor Davis
97bf2679aa
v8.0.0-canary.13 2019-01-24 16:27:05 -06:00
Tim Neutkens
243cd65c1d
Drop assetSizePlugin (#6122)
Fixes #6121
2019-01-24 23:04:20 +01:00
Tim Neutkens
1191843e17 v8.0.0-canary.12 2019-01-24 10:51:13 +01:00
Connor Davis
f28833c594 Upgrade Webpack to 4.29.0 with FutureEmitAssets for Massive Memory Optimizations (#6114)
We want our new memory optimizations (https://github.com/webpack/webpack/pull/8609)
2019-01-24 10:25:58 +01:00
Tim Neutkens
9112f63eba
Move phases back to next/constants (#6104)
* Move phases back to next/constants

* Fix typescript error
2019-01-23 14:10:12 +01:00
Tim Neutkens
c5d5148bad v8.0.0-canary.11 2019-01-22 13:12:50 +01:00
Tim Neutkens
2a50c176cf
Make HMR still apply updates when there is a webpack warning (#6099)
Fixes #5363

I noticed this happening when making some changes on the nextjs.org/learn app. Basically we didn't apply updates when a warning was emitted from webpack. This would cause issues for users using eslint-loader or similar too.
2019-01-21 22:39:39 +01:00
Connor Davis
43b0b95e1d
v8.0.0-canary.10 2019-01-21 09:13:26 -06:00
Tim Neutkens
862e0a39b9 Update package.json description 2019-01-21 13:46:01 +01:00
Tim Neutkens
0949b4dd1a Make lerna always use exact version when updating packages 2019-01-21 12:20:05 +01:00
Tim Neutkens
0714300b8c v8.0.0-canary.9 2019-01-19 13:40:53 +01:00
Jason Aslakson
00003193df Additional config options for hot reloader web socket connection (#6083)
* Additional config options for hot reloader web socket connection

* Apply suggestions from code review

Accepting suggested code changes

Co-Authored-By: jaslakson <jason.aslakson@americastestkitchen.com>

* updated README with websocket proxy options

* Fix test / cleanup port setting

* Always set proxy_path
2019-01-19 13:39:09 +01:00
Tim Neutkens
bbc346869e
Remove Typescript helpers in favor of babel helpers (#6087)
There's still a few Typescript helpers in use, but regenerator is added by Babel after this change, as it was already in the bundle it'll drop bundle sizes by quite a bit, eg _app.js becomes half the size.
2019-01-18 22:00:15 +01:00
Tim Neutkens
b52c416713 v8.0.0-canary.8 2019-01-18 12:15:56 +01:00
Tim Neutkens
5ba7dba951 Fall back to showing localhost when no hostname is provided 2019-01-18 12:15:15 +01:00
Connor Davis
8065130343 Use webpack IgnorePlugin to exclude 'react-is' from production build (#6084)
`react-is` isn't used in production, so we shouldn't bundle it.

Note: most of those plugins are using the `dev` variable, but in case someone runs `NODE_ENV=development next build`, they would need a copy of `react-is` because the conditional use of `react-is` checks `NODE_ENV` — not whether or not HMR is being used (what what the `dev` variable is based on).
2019-01-18 12:12:29 +01:00
Tejas Kumar
f960091997 Improve Serverless section in a minor way (#6081)
I just added a paragraph and some links to the serverless section.
2019-01-17 19:04:01 +01:00
Jerome Fitzgerald
bfbc23d710 📝️ README: Serverless Bullet Point (#6078)
Adds a Bullet Point under "Production deployment"
 for the Table of Contens / Link Section.

Wanted to add this as a comment in #6070.

Great work as always!
2019-01-17 16:38:37 +01:00
Tim Neutkens
c46cd3c5bf
Add docs for Serverless target (#6070)
I need feedback on if this is clear enough for users.
2019-01-17 16:18:06 +01:00
Giuseppe
b4e6ded289 Upgrade styled-jsx (#6069)
Introduces full support for Babel 7 including JSX Fragments shorthand. 
Switched to visiting the `Program` path and then start a traversal manually to solve conflicts with other Babel plugins.
2019-01-16 11:37:01 +01:00
fabb
6c5152538f added warning to readme about nesting of meta tags inside of <Head> (#6068) 2019-01-16 10:57:37 +01:00
Telegin Evgeniy
aa474017d7 Add iOS 10 support for TerserPlugin (#6067)
Resolves #5630
2019-01-16 10:32:47 +01:00
Tim Neutkens
da3c3aded1
Use Object.assign instead of object spread for serverless loader (#6056)
Fixes https://github.com/zeit/now-builders/issues/168

For some reason with a certain mix of deps `...` is not supported in webpack's parsing.
By default it is supported as all our tests passed before and we have deployed Next.js apps on v2 already.
2019-01-15 02:20:20 +01:00
Tim Neutkens
9ab8714f38 v8.0.0-canary.7 2019-01-14 16:19:20 +01:00
Alexander Nanberg
7e7be0e2e8 Revert #6030 (#6052)
* Revert #6030

* Fix _app childContextTypes
2019-01-14 15:41:09 +01:00
Alexander Nanberg
ff5cf6d4de Migrate next/head to use React.createContext (#6038)
Continuation of #5945
2019-01-14 01:59:26 +01:00
Tim Neutkens
02ab732096
Remove next/asset (#6046)
* Remove next/asset

Reasoning described in #5970

* Remove next/asset tests

* Bring back asset-page
2019-01-14 01:32:20 +01:00
Tim Neutkens
4939583c65 Move @types to devDependencies 2019-01-12 15:22:15 +01:00
Tim Neutkens
f94d24bffc v8.0.0-canary.6 2019-01-12 00:45:34 +01:00
Connor Davis
1edd872f54
Only Minify Whitespace on Serverless Builds (#6037) 2019-01-11 17:15:12 -06:00
Tim Neutkens
2f22fbf8c2 Replace comment with import() for webpack dynamic entries compat 2019-01-11 22:55:14 +01:00
Tim Neutkens
0607638e8f v8.0.0-canary.5 2019-01-11 22:29:15 +01:00
Tim Neutkens
2e9ff91372
Compile next/client and next/pages (#6019)
Because next-routes requires APIs outside of compilation we have to compile these

Fixes https://github.com/fridays/next-routes/issues/274
Fixes #6017
2019-01-11 22:26:27 +01:00
Alexander Nanberg
25fb3f9c2e Migrate next/router to use React.createContext (#6030)
Fixes parts of #5716. I had some issues with the test suite but I'm fairly certain that I got it working correctly.
2019-01-11 16:04:56 +01:00
Tim Neutkens
3299db9758 Remove router property from _app docs
It’s an inconsistent result, users should use ctx instead. At a later time we’ll normalize the properties passed into _app.js its getInitialprops to be consistent with pages.
2019-01-11 12:03:56 +01:00
Isaac Hinman
3c4e690d1f Add displayName to error page (#6029)
Fixes #6026
2019-01-11 00:30:01 +01:00
Tim Neutkens
2a9b733715 v8.0.0-canary.4 2019-01-10 23:03:25 +01:00
Tim Neutkens
ce3d1914fa
Disable assetSizePlugin in serverless target (#6028) 2019-01-10 23:01:30 +01:00
Tim Neutkens
b547d300d9
Show clear error when client build fails in serverless target (#6027) 2019-01-10 22:10:50 +01:00
Tim Neutkens
a9f71e449d v8.0.0-canary.3 2019-01-09 00:09:15 +01:00
Tim Neutkens
9ffd23eeef
Replace pages-plugin with loader (#5994)
* Remove unused argument

* Replace pages-plugin with loader

* Add loader-utils types

* Remove logs

* Bring back previous deposal behavior

* Remove console.log

* Remove webpack/utils as it’s no longer in use

* Remove hot-self-accept-loader

* Error Recovery tests

* Make hotSelfAccept a noop default loader

* Fix windows deleted/added

* Remove logging

* Remove unused variables

* Remove log

* Simplify entrypoint generation

* Don’t return the function

* Fix _app test

* Remove code that’s always true

* Move aliases to constants

* Use alias

* Join pages alias in reduce

* Default pages differently

* Loop over pages instead of manually defining

* Move entry generation into common function

* Update packages/next/build/webpack/loaders/next-client-pages-loader.ts

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

* Update packages/next/build/webpack/loaders/next-client-pages-loader.ts
2019-01-08 23:10:32 +01:00
Luc
ba95f7541c Improve assets size (#5999)
It looks like :

```
Pages sizes after gzip:

┌ / (196 B)
├ /_app (11.5 kB)
├ /_error (4.44 kB)
├ /blog (196 B)
└ /blog/page (195 B)
```

(style inspired from now-cli : https://github.com/zeit/now-cli/blob/canary/src/util/output/builds.js)

I'll add dynamic chunks in a separate PR.

@timneutkens Do you want to keep `_app` and `_error` or filter them out ? I think it's a good idea to keep them, because `_app` can get pretty large and it would encourage code splitting in that case.
2019-01-06 16:42:09 +01:00
Luc
fc19b233eb Replace event-emitter.js by mitt (#5987)
This PR aims at replacing next-server/lib/event-emitter.js by mitt.

Fix https://github.com/zeit/next.js/issues/4908

event-emitter.js is ~400 bytes gzipped vs mitt is 200 bytes
2019-01-04 21:49:21 +01:00
Tim Neutkens
7d080760a8 v8.0.0-canary.2 2019-01-02 16:29:19 +01:00
Tim Neutkens
fd3cb2a190 v8.0.0-canary.1 2019-01-02 15:07:33 +01:00
Tim Neutkens
07c6e2852f
Export render instead of default for serverless target (#5979)
Extends on #5927, instead of `.default` we'll expose `.render` which is semantically more correct / mirrors the naming of the custom server API.

I've updated the spec in #5927 to reflect this change.

(copied from #5927):

```js
const http = require('http')
const page = require('./.next/serverless/about.js')
const server = new http.Server((req, res) => page.render(req, res))
server.listen(3000, () => console.log('Listening on http://localhost:3000'))
```
2019-01-02 14:59:28 +01:00
Tim Neutkens
672a87d981 v8.0.0-canary.0 2019-01-02 13:59:52 +01:00
JJ Kasper
ba8cb31a40 Added WebSocket arg to allow manually setting port (#5963)
Saw a reply on the original pull request that the WebSocket using a random port broke their set up so I added a `--websocket` or `-w` argument similar to the `-p` argument to allow manually setting this port also.
2019-01-01 01:07:10 +01:00
Tim Neutkens
662dfd4271
Drop module.hot from production bundles (#5967) 2018-12-31 19:06:36 +01:00
Tim Neutkens
18cb2c03df
Simplify default title (#5968) 2018-12-31 19:06:03 +01:00
Tim Neutkens
b0cad3370d
Use less code to detect replace instead of push (#5969) 2018-12-31 19:05:49 +01:00
Tim Neutkens
36164ead80
Don’t bundle next/asset if it’s not used (#5971) 2018-12-31 19:05:34 +01:00
Anderson Leite
20fe65ce41 Implement tslint for core files (#5952)
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
2018-12-31 14:44:27 +01:00
Tim Neutkens
aabc72015c v7.0.2-canary.50 2018-12-28 11:41:47 +01:00
Tim Neutkens
0f23faf81f
Serverless Next.js (#5927)
**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
2018-12-28 11:39:12 +01:00
Giuseppe
56744253c6 Upgrade styled-jsx (#5953)
The latest version includes a fix to resolve conflicts with other libraries that use the `css` prop. Details https://github.com/zeit/styled-jsx/releases/tag/v3.1.3
2018-12-27 11:50:19 +01:00
Jeroen Knoops
46c9deb064 Upgrades webpack related libraries (#5949)
Upgrades webpack from 4.26.0 -> 4.28.2

Adds webpackbar for build. Fixes #5777
2018-12-26 12:06:58 +01:00
Florian Hämmerle
401495bcd5 fix custom document example (#5928) 2018-12-21 03:20:12 +01:00
Tim Neutkens
32451e979e
Move out requires from renderToHTML (#5915)
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.
2018-12-18 17:12:49 +01:00
Erik Nguyen
cd0a1767f4 change errorCode prop name for clearer explanation of code example (#5914) 2018-12-18 09:45:36 +01:00
Tim Neutkens
bd2dee21d4 v7.0.2-canary.49 2018-12-17 19:30:35 +01:00
Tim Neutkens
9a7ebb1cc5
Remove node-args in favor of NODE_OPTIONS environment variable (#5910) 2018-12-17 19:17:29 +01:00
Tim Neutkens
6e2cbfaff3 v7.0.2-canary.48 2018-12-17 16:13:05 +01:00
Kyle Holmberg
72e7929242 Change page export validity check on client and server in development (#5857)
Resolves #4055 

Credit: https://github.com/zeit/next.js/pull/5095

I didn't use the ignore webpack plugin from the original PR and tested bundle size with https://github.com/zeit/next.js/pull/5339 - seems to be safe on that front.

Was able to get tests to pass locally, unsure of what goes wrong in CI 🤷‍♂️ 

**Questions**
1) The initial PR didn't include changes to `next-server/lib/router` in `getRouteInfo()`. Should the same changes be made within?

2) Should we add a test for rendering a component created via `forwardRef()`?

`component-with-forwardedRef`:
```javascript
export default React.forwardRef((props, ref) => <span {...props} forwardedRef={ref}>This is a component with a forwarded ref</span>);
```

some test:
```javascript
test('renders from forwardRef', async () => {
  const $ = await get$('/component-with-forwardedRef')
  const span = $('span')
  expect(span.text()).toMatch(/This is a component with a forwarded ref/)
})
```
2018-12-17 16:09:23 +01:00
Brian Beck
b91a960182 Improve dev experience by listening faster (#5902)
As I detailed in [this thread on Spectrum](https://spectrum.chat/?t=3df7b1fb-7331-4ca4-af35-d9a8b1cacb2c), the dev experience would be a lot nicer if the server started listening as soon as possible, before the slow initialization steps. That way, instead of manually polling the dev URL until the server's up (this can take a long time!), I can open it right away and the responses will be delivered when the dev server is done initializing.

This makes a few changes to the dev server:

* Move `HotReloader` creation to `prepare`. Ideally, more things (from the non-dev `Server`) would be moved to a later point as well, because creating `next({ ... })` is quite slow.
* In `run`, wait for a promise to resolve before doing anything. This promise automatically gets resolved whenever `prepare` finishes successfully.

And the `next dev` and `next start` scripts:

* Since we want to log that the server is ready/listening before the intensive build process kicks off, we return the app instance from `startServer` and the scripts call `app.prepare()`.

This should all be backwards compatible, including with all existing custom server recommendations that essentially say `app.prepare().then(listen)`. But now, we could make an even better recommendation: start listening right away, then call `app.prepare()` in the `listen` callback. Users would be free to make that change and get better DX.

Try it and I doubt you'll want to go back to the old way. :)
2018-12-17 12:09:44 +01:00
Tim Neutkens
346915eb9d v7.0.2-canary.47 2018-12-16 16:37:17 +01:00
Tim Neutkens
059dd309c5
Make browser side resolve prefer mjs files (#5898) 2018-12-16 16:26:45 +01:00
Tim Neutkens
be24aaa0d2 v7.0.2-canary.46 2018-12-16 14:30:50 +01:00
Tim Neutkens
b5b0c743b3 Add ws dependency 2018-12-16 14:28:11 +01:00
Tim Neutkens
e96d694445 v7.0.2-canary.45 2018-12-16 02:01:21 +01:00
Tim Neutkens
6795f681ef
Make sure WebSocket server port is always detected (#5894) 2018-12-16 01:56:27 +01:00
Tim Neutkens
f4a2cbb403 v7.0.2-canary.44 2018-12-15 23:45:34 +01:00
DevSide
ebf217cb16 add --node-args option (#5858)
This message is from @timneutkens after making changes:
- Convert executables to Typescript
- Remove `minimist` in favor of `arg` 
- Implement `--node-args` usage: `--node-args="--throw-deprecation"`
- Adds tests for usage of the `next` cli
2018-12-15 22:55:59 +01:00
JJ Kasper
af07611a63 Implement websockets based on-demand-entries ping (#4508)
Fixes #4495

Here's my approach for replacing the XHR on-demand-entries pinger #1364 #4495. I'm not sure if this is the way everyone wants to accomplish this since I saw mention of using a separate server and port for the dynamic entries websocket, but thought this would be a fairly clean solution since it doesn't need that.

With this method the only change when using a custom server is you have to listen for the upgrade event and pass it to next.getRequestHandler(). Example: 
```
const server = app.listen(port)
const handleRequest = next.getRequestHandler()

if(dev) {
  server.on('upgrade', handleRequest)
}
```
2018-12-14 12:25:59 +01:00
Tim Neutkens
1464d932eb
Disable webpack cache option in prod (#5877)
* Disable webpack cache option in prod

* Remove cache option as it’s added by mode === ‘development’
2018-12-14 11:34:05 +01:00
Tim Neutkens
00a14d696d v7.0.2-canary.43 2018-12-13 19:47:10 +01:00
Tim Neutkens
1016b71011
Don’t prefetch on slow network / when datasaver is enabled (#5876)
Inspired by https://twitter.com/addyosmani/status/1073118564423356416

I've made the checking function slightly smaller (including both conditions on one line makes Terser optimize the condition).

cc @addyosmani
2018-12-13 19:08:23 +01:00
Tim Neutkens
620b426903
Remove baseurl/paths option (#5878)
For some reason the canary branch is failing on Typescript while the PR was not.
2018-12-13 16:56:48 +01:00
Connor Davis
419bec0b9b Fix #5674 Append crossOrigin on the client side too, add config option for crossOrigin (#5873)
# Fixes https://github.com/zeit/next.js/issues/5674

This adds config option
```js
// next.config.js
module.exports = {
  crossOrigin: 'anonymous'
}
```
This config option is defined in the webpack Define Plugin at build.
`Head` and `NextScript` now use the config option, if it's not explicitly set on the element.
This value is now passed to Webpack so it can add it to scripts that it loads.
The value is now used in `PageLoader` (on the client) so it can add it to the scripts and links that it loads.
Using `<Head crossOrigin>` or `<NextScript crossOrigin>` is now deprecated.
2018-12-13 01:05:21 +01:00
Tim Neutkens
5e3bf6e537
Convert render.js to typescript (#5869)
* Convert render.js to typescript

* Compile tsx files too

* Remove internal renderErrorToHTML function

* Interopt component result

* requirePage doesn’t need async

* Move out enhancing logic into it’s own function

* Remove buildManifest from renderPage

* Move render into it’s own function

* Change let to const

* Move renderDocument into it’s own function
2018-12-13 01:00:46 +01:00
Benjamin Kniffler
e6c3686629 multi-threaded export with nice progress indication (#5870)
This PR will

- allow nextjs export to use all available CPU cores for rendering & writing pages by using child_process
- make use of async-sema to allow each thread to concurrently write multiple paths
- show a fancy progress bar while processing pages (with non-TTY fallback for CI web consoles)

The performance gain for my MacBook with 4 CPU cores went from ~25 pages per second to ~75 pages per second. Beefy CI machines with lots of cores should profit even more.
2018-12-12 13:59:11 +01:00
Tim Neutkens
2dec1fcd63 v7.0.2-canary.42 2018-12-11 21:59:30 +01:00
Tim Neutkens
5708e99eca
Run compilers sequentially when in lambdas mode (#5862) 2018-12-11 21:46:23 +01:00
Tim Neutkens
1c8b09d7ea
Make <Head> children render first, then next/head children, then script preloads/styles (#5852) 2018-12-10 23:40:42 +01:00
Kenneth Luján Rosas
616c3d7ac8 docs(readme): add documentation for renderPage customization on _document.js (#5723)
Per @timneutkens suggestion [here](https://github.com/zeit/next.js/pull/5631#issuecomment-440588455) I went ahead and gave a shot at trying to document `renderPage` usage.

This PR:
- Documents `renderPage` legacy and current usage.
2018-12-10 17:01:59 +01:00
Oscar Busk
27c0b199d0 Fix paths when built on windows (#5795)
This PR Fixes #4920

So the problem is that when a next.js application is built on windows, the `pages-manifest.json` file is created with backslashes. If this built application is deployed to a linux hosting enviroment, the server will fail when trying to load the modules.

```
Error: Cannot find module '/user_code/next/server/bundles\pages\index.js
```

My simple solution is to modify the `pages-manifest.json` to always use linux separator (`/`), then also
modify `server/require.js` to, when requiring page, replace any separator (`\` or `/`) with current platform-specific file separator (`require('path').sep`).

The fix in `server/require.js` would be sufficient, but my opinion is that having some cross-platform consistency is nice.

This change was tested by bulding an application in windows and running it in linux and windows, aswell as building an application in linux and running it in linux and windows. The related tests was also run.
# Conflicts:
#	test/integration/production/test/index.test.js
2018-12-10 14:48:06 +01:00
Tim Neutkens
8b6173917a
Convert next-server.js to typescript (#5844) 2018-12-09 22:46:45 +01:00
Tim Neutkens
0e6d190706
Move sendHTML and rewrite in ts (#5839)
* Move send-html function and rewrite in typescript

* Move getPageFiles and convert to ts

* Move getPageFiles and convert to ts (#5841)

* Move getPageFiles and convert to ts

# Conflicts:
#	packages/next-server/server/render.js

* Fix unit tests
2018-12-07 15:52:29 +01:00
Tim Neutkens
5d2250ac27
Remove unused functions (#5832)
Couldn't find a reference to these functions as next-server uses the renderToHTML directly.
2018-12-06 16:47:10 +01:00
Tim Neutkens
902c5244f3 v7.0.2-canary.41 2018-12-05 22:41:26 +01:00
Tim Neutkens
6729fa4580 Mark react/react-dom as external when in lambdas mode (#5828) 2018-12-05 13:40:17 -08:00
Tim Neutkens
dd556bf90b
Add tsc type checking (#5826)
* Add tsc type checking

* Add linting on circle

* Add node-fetch types

* Use strict mode
2018-12-05 21:45:50 +01:00
Tim Neutkens
7098501547 v7.0.2-canary.40 2018-12-05 15:05:59 +01:00
Tim Neutkens
1a5fc941ce Remove console.log after verifying the correct files are ignored 2018-12-05 15:05:14 +01:00
Tim Neutkens
a62a6276c7 v7.0.2-canary.39 2018-12-05 14:45:14 +01:00
Tim Neutkens
6542750e12
Fix edge case where file had module.export in the content (#5823)
We ran into this eg on hyper-site, which has `module.exports` in the content.
2018-12-05 14:37:26 +01:00
Tim Neutkens
84223d39e7 v7.0.2-canary.38 2018-12-04 20:10:53 +01:00
Tim Neutkens
2d5b56a181 Disable usage of esmodules when commonjs is enabled on the preset 2018-12-04 20:10:22 +01:00
Tim Neutkens
29ed67b020
Add test for generateBuildId (#5816)
* Add docs for returning `null` from generateBuildId

* Add test for setting custom buildid

* Fix linting
2018-12-04 16:42:25 +01:00
Tim Neutkens
dada692bd6 v7.0.2-canary.37 2018-12-04 15:28:36 +01:00
Tim Neutkens
bd2ad412d3
Bring back module.exports because of backwards compat (#5815) 2018-12-04 15:26:20 +01:00
Tim Neutkens
dd3b5bf81d v7.0.2-canary.36 2018-12-04 11:04:21 +01:00
Tim Neutkens
d11a3aa34e
Add tests for isomorphic-unfetch bundling issue (#5805)
* Add tests for isomorphic-unfetch bundling issue

* Remove unneeded extra option

* Remove isomorphic-fetch
2018-12-04 10:59:12 +01:00
Matheus Fernandes
977bf8d9eb Zeit -> ZEIT (#5804) 2018-12-03 23:01:23 +01:00
Tim Neutkens
082db2877d v7.0.2-canary.35 2018-12-03 19:50:59 +01:00
Tim Neutkens
f79230db33
Change module resolution extensions (#5801)
Same as https://github.com/zeit/ncc/pull/80
2018-12-03 19:36:24 +01:00
Tim Neutkens
58f5dd297a
Add Typescript types for builds functions (#5791) 2018-12-03 14:18:52 +01:00
Tim Neutkens
a9cf735f50
Convert babel plugins to typescript (#5789)
Slowly moving files over 💯
2018-12-02 18:30:00 +01:00
Luc
e43d21fdf0 remove occurence of deprecated url prop in readme (#5786) 2018-12-01 21:11:06 +01:00
Tim Neutkens
a66e1c0d7c v7.0.2-canary.34 2018-11-30 19:51:54 +01:00
Tim Neutkens
e5002234d0
Transpile imports if module has module.exports (#5780)
Fixes #5778
Fixes #3650
2018-11-30 17:56:07 +01:00
Tim Neutkens
4322bb13dd
Build / watch .ts core files (#5776) 2018-11-30 13:10:30 +01:00
Tim Neutkens
f1fe237ba8 v7.0.2-canary.33 2018-11-29 19:33:20 +01:00
Tim Neutkens
1c64e59564 v7.0.2-canary.32 2018-11-29 12:36:48 +01:00
Tim Neutkens
55e89e759a
Fix polyfill for ie11 (#5763)
* Fix polyfill for ie11

* Use esmodules only when using webpack
2018-11-29 12:36:03 +01:00
Tim Neutkens
c1037949fd v7.0.2-canary.31 2018-11-28 17:55:37 +01:00
Tim Neutkens
fb92fdef54
Make sure const/async is transpiled (#5760)
* Make sure const/async is transpiled

* Use babel common compilation instead
2018-11-28 17:53:49 +01:00
Ståle Pettersen
4594b7cb07 Remove secret from 'publicRuntimeConfig' example (#5759) 2018-11-28 15:29:41 +01:00
Tim Neutkens
af893bf740 v7.0.2-canary.30 2018-11-28 15:12:43 +01:00
Tim Neutkens
15bb1c5e79
Use Typescript to transpile Next.js core files instead of Babel (#5747)
- Replaces taskr-babel with taskr-typescript for the `next` package
- Makes sure Node 8+ is used, no unneeded transpilation
- Compile Next.js client side files through babel the same way pages are
- Compile Next.js client side files to esmodules, not commonjs, so that tree shaking works.
- Move error-debug.js out of next-server as it's only used/require in development
- Drop ansi-html as dependency from next-server
- Make next/link esmodule (for tree-shaking)
- Make next/router esmodule (for tree-shaking)
- add typescript compilation to next-server
- Remove last remains of Flow
- Move hoist-non-react-statics to next, out of next-server
- Move htmlescape to next, out of next-server
- Remove runtime-corejs2 from next-server
2018-11-28 15:03:02 +01:00
Tim Neutkens
c801a96631 v7.0.2-canary.29 2018-11-27 22:21:00 +01:00
Tim Neutkens
08e3396574
Fix graphql issue with lambdas flag (#5755)
Fixes https://spectrum.chat/?t=604f6aa6-23f2-4358-8b0b-14e5810178dc
2018-11-27 22:20:13 +01:00
Tim Neutkens
818cf8e77a v7.0.2-canary.28 2018-11-27 12:39:07 +01:00
Tim Neutkens
9d30e411b5
Fallback to <script> loading behavior when preload is not supported (#5744)
Based on https://github.com/zeit/next.js/pull/5737#discussion_r236059295

This will cause a warning in chrome/safari after 3s
2018-11-26 23:58:40 +01:00
Tim Neutkens
9f03fad5e9 v7.0.2-canary.27 2018-11-25 00:57:02 +01:00
Tim Neutkens
cad19c808c
Use <link rel=“prefetch”> for prefetching (#5737)
* Use <link rel=“prefetch”> for prefetching

Fixes #5734

* Fix unit tests for router

* Add test for prefetch

* Rename test

* Check all logs for message
2018-11-25 00:47:39 +01:00
Hozefa
401594ed36 remove glamorous example since its no longer maintained (#5738)
Since glamorous is [no longer maintained](https://github.com/paypal/glamorous#status-unmaintained) removing it from readme.
2018-11-23 21:18:13 +01:00
Richard Park
44d661af67 Upgrade to webpack@4.26 (#5729)
* Upgrade terser-webpack-plugin

* Upgrade webpack

* Extract common terserPluginConfig
2018-11-22 10:14:14 +01:00
Tim Neutkens
9b2782a6d0
Add engines to next and next-server (#5724) 2018-11-21 21:56:24 +01:00
Tim Neutkens
c2eaf26ea9
Remove flow types (#5704)
* Remove flow-typed

* Remove flow types

* Remove the last types

* Bring back taskr dependency

* Revert "Bring back taskr dependency"

This reverts commit 38cb95d7274d63fe63c6ac3c95ca358a28c17895.

* Bring back preset-flow as it’s used for tests

* Revert "Revert "Bring back taskr dependency""

This reverts commit b4c933ef133f4039f544fb10bf31d5c95d3b27a2.
2018-11-21 16:04:37 +01:00
Curran Kelleher
19db04f302 Iterate wording in documentation (#5718)
I came across **Possible spelling mistakes** #5496 and noticed that the current wording could be improved both in terms of accuracy and succinctness.
2018-11-21 01:57:51 +01:00
Tim Neutkens
76202f2fb2 v7.0.2-canary.26 2018-11-20 12:17:23 +01:00
Tim Neutkens
70cae4b2ea
Disable mjs support when in lambdas mode (#5712) 2018-11-20 12:13:31 +01:00
Tim Neutkens
9547e77820
use native http instead of micro (#5706) 2018-11-19 16:36:18 +01:00
Giuseppe
e1f6f34f86 Update styled-jsx (#5617) 2018-11-18 23:33:23 +01:00
Sean Connolly
a9092c7c7d Update README.md (#5670) 2018-11-18 23:33:07 +01:00
Alexander Kachkaev
233a6042d9 Bump bump-babel-plugin-react-require to 3.0.1 (#5693) 2018-11-18 20:40:18 +01:00
Tim Neutkens
cfd46acde5 v7.0.2-canary.25 2018-11-18 13:53:45 +01:00
Tim Neutkens
7d78c3b641 Add node_modules bundling under the --lambdas flag for next build (#5690)
* Add node_modules bundling under the —lambdas flag for next build

* Run minifier when lambdas mode is enabled

* Add lambdas option to next.config.js

* Add test for lambdas option
2018-11-17 11:15:33 -08:00
Tim Neutkens
e930d1e821 v7.0.2-canary.24 2018-11-13 22:58:21 +01:00
Tim Neutkens
a7c440d88e v7.0.2-canary.23 2018-11-13 21:58:33 +01:00
Adam Lane
4ce095df89 Add crossOrigin via props to _document Head and NextScript (#5646)
This alternative implementation of https://github.com/zeit/next.js/pull/5150 follows @timneutkens suggestion of using props.

Fixes #5150 
Fixes #3630
2018-11-13 21:36:09 +01:00
Luc
add5879cc2 Print assets sizes after build (#5664)
It looks like this : 

![capture d ecran 2018-11-13 a 00 47 12](https://user-images.githubusercontent.com/6616955/48361936-7cc13d80-e6dd-11e8-8aa8-c5a73beae966.png)

I'm not sure about the License part, can you check @timneutkens ?
2018-11-13 10:46:26 +01:00
Tim Neutkens
d0dd1bc28d
Trim buildId returned from generateBuildId (#5634)
* Trim buildId returned from generateBuildId

* Pass dir to function
2018-11-12 15:57:48 +01:00
Callum Locke
c4cec5b7d9 Fix link to constants (for phases) in next readme (#5643) 2018-11-09 15:03:27 +01:00
Tim Neutkens
2776caacde v7.0.2-canary.22 2018-11-09 14:10:24 +01:00
Jerónimo Carrizo
3bc415d8b5 canary - just updating to the latest stable version of webpack (#5623)
In order to trying to resolve the bug [#5480](https://github.com/zeit/next.js/issues/5480), I create this PR which update the webpack version.
2018-11-09 14:09:12 +01:00
Tim Neutkens
a0137d4fd8 Rename class to NextJsRequireCacheHotReloader 2018-11-07 18:56:53 +01:00
Tim Neutkens
5ffbb34841 v7.0.2-canary.21 2018-11-07 18:46:35 +01:00
Tim Neutkens
d6284f171b
Don’t fail build on webpack warning (#5622) 2018-11-07 18:38:37 +01:00
Tim Neutkens
b46d7e8f6f v7.0.2-canary.20 2018-11-07 15:39:23 +01:00
Tim Neutkens
2e14b4491b
Bundle @babel/runtime into server bundle (#5619) 2018-11-07 15:38:35 +01:00
Tim Neutkens
a82a2d8d1b v7.0.2-canary.19 2018-11-07 14:42:00 +01:00
Tim Neutkens
88f2c1716a
Clean up dependencies between next and next-server (#5615) 2018-11-07 14:41:00 +01:00
Pieter De Decker
a09ca535c3 Fix typos (#5599) 2018-11-05 22:14:17 +01:00
Tim Neutkens
43dc610196 v7.0.2-canary.18 2018-11-05 17:53:12 +01:00
Tim Neutkens
f01457e8fc
Take full advantage of caching between builds (#5597)
Takes advantage of caching between builds for Terser, also makes writing caches for babel-loader faster by disabling compression.

Results for zeit.co (350 pages):

Without cache:
[4:16:22 PM] Compiled server in 1m
[4:16:57 PM] Compiled client in 2m
  Done in 125.83s.

With cache:
[4:19:38 PM] Compiled client in 17s
[4:19:50 PM] Compiled server in 29s
  Done in 31.79s.

Note: these results are from my multi-core Macbook Pro 2017, exact specs:
MacBook Pro (13-inch, 2017, Four Thunderbolt 3 Ports)
- 3,3 GHz Intel Core i5
- 16 GB 2133 MHz LPDDR3
- Intel Iris Plus Graphics 650 1536 MB

The `without cache` build runs uglify in parallel, so without cache is likely to take longer on environments where you have only 1 core available.

The `with cache` build however runs in a single thread, so the results should be similar.
2018-11-05 17:51:56 +01:00
Tim Neutkens
3c1c972b33 v7.0.2-canary.17 2018-11-05 01:49:35 +01:00
Tim Neutkens
1aaa288759 Remove console.log 2018-11-05 01:49:12 +01:00
Tim Neutkens
ed56d69155 v7.0.2-canary.16 2018-11-05 00:03:16 +01:00
Tim Neutkens
4945740ac7 Add dir and distDir to resolve log 2018-11-05 00:02:21 +01:00
Tim Neutkens
7876406723 v7.0.2-canary.15 2018-11-04 23:44:14 +01:00
Tim Neutkens
1388c6897e Add resolve_config log 2018-11-04 23:42:46 +01:00
Tim Neutkens
0136db7a00 v7.0.2-canary.14 2018-11-04 23:05:54 +01:00
Tim Neutkens
d5caafb86e Log original error 2018-11-04 23:04:54 +01:00
Tim Neutkens
a97c15d399 v7.0.2-canary.13 2018-11-04 22:17:07 +01:00
Tim Neutkens
771e494a88 Log out stats.errors and err object when build fails 2018-11-04 22:16:24 +01:00
Tim Neutkens
cb6fc6b8a8 v7.0.2-canary.12 2018-11-04 03:33:08 +01:00
Tim Neutkens
b04923775b Add string-hash to compilation for styled-jsx 2018-11-04 03:26:52 +01:00
Tim Neutkens
ef2995d1fa v7.0.2-canary.11 2018-11-04 01:23:14 +01:00
Tim Neutkens
54b9df535d
Handle decoding errors correctly (#5589)
Fixes #4887
Fixes #3612

Also removes http-errors dependency from next-server, leaving a smaller install size
2018-11-04 01:22:33 +01:00
Tim Neutkens
15854f515b
Transpile styled-jsx into server bundle (#5588)
Drops an additional 6MB from the next-server node_modules size as there's no lodash
2018-11-04 01:11:40 +01:00
Tim Neutkens
745b2da006 v7.0.2-canary.10 2018-11-03 19:52:45 +01:00
Tim Neutkens
b65c464d60
Move __NEXT_DATA__ into an application/json script tag (#5584)
* Move __NEXT_DATA__ into a application/json script tag

As outlined by @dav-is here https://github.com/zeit/next.js/pull/4943

* Set __NEXT_DATA__ for backwards compatability
2018-11-03 19:49:09 +01:00
Tim Neutkens
a2553bb46e
Remove registration code from initial markup (#5583)
Clears the way a bit for #4943, also makes _document.js less complex, and will allow us to move `__NEXT_DATA__` to a `application/json` script tag.

Also this causes a slightly smaller bundle size 😌
2018-11-03 01:59:54 +01:00
Tim Neutkens
a1bdbad2cf
Move ensurePage to DevServer (#5582)
It's no longer needed inside the `render()` function since we have a separate devServer
2018-11-03 01:24:43 +01:00
Corentin.Andre
1496ad6299 fix: update correct path to use when exporting 404 page (#5470)
When exporting error page, next defaults it to 404/index.html which is not recognized as a default 404 page.

This should fix https://github.com/zeit/next.js/issues/5035
2018-11-03 01:19:41 +01:00
Robert Sköld
123b46634a Moved nanoid use from next-server to next/build (#5441) 2018-11-02 23:19:48 +01:00
Henrik Wenz
b33f5e8ad2 Add Azure build status badge (#5399) 2018-11-02 19:49:00 +01:00
Radovan Šmitala
bf157015fb Remove WriteFilePlugin (#5541)
It is native by webpack-dev-middleware 3.1.0 up
2018-11-02 19:47:56 +01:00
Homer Chen
ad84d23a02 Add a space on README (#5574)
Hi
Just add a space on README. That line should be same as [here](https://github.com/zeit/next.js/blob/canary/examples/using-with-router/components/ActiveLink.js#L10)
2018-11-02 12:21:34 +01:00
Giuseppe
c95abc209b Add with style-sheet example (#5572)
* Remove pathname (#5428)

Same as #5424

* fix typo (#5451)

* Add with style-sheet example

* Fix readme

* Fix typo
2018-11-01 14:05:39 +01:00
Kosuke Yoshimura
2728dbe633 Edit custom error hundling readme (#5571)
* add description of importing _error.js

* fix description of importing _error.js

* delete .idea folder
2018-11-01 11:39:50 +01:00
Max Fierro
2c343baeba Fix issue with HMR not working (#5544)
Change the ignore patterns to ignore `.git/` folder.
Add Windows pattern matching for `.next/` and `.git/` folders.

Fixes #5429
2018-10-28 23:01:45 +01:00
Dmitriy
e382be655c Fix readme (#5513)
* Fix readme

* Fix spelling mistake

Co-Authored-By: dipiash <dmitriytemn@gmail.com>
2018-10-26 13:42:23 -07:00
Olivier Tassinari
e02c0d000a Make IE 11 happy (#5499)
https://sentry.io/share/issue/3bc66ffadcad46a9aae703d5eba1e342/

![capture d ecran 2018-10-22 a 12 04 16](https://user-images.githubusercontent.com/3165635/47287491-b1683a80-d5f2-11e8-8c3f-e409340b880f.png)
2018-10-22 22:31:50 +02:00
Timmy Willison
1b8f56556b Output warnings and errors from webpack individually (#5442)
- Shows warnings even when resolving, to facilitate hints set to 'warning'
- Fixes #876 : Set performance.hints to 'warning' or 'error' in next.config.js
2018-10-20 17:02:20 +02:00
Henrik Wenz
18488f47b0 Fix linter (#5350)
* Fix linter

* Add test env

* Fix lint errors
2018-10-20 17:00:01 +02:00
Vasyl Berezovyy
9a09de2feb Remove ignore plugin from webpack build flow (#5394) 2018-10-20 16:59:43 +02:00
Alexandre Cisneiros
398dcd4281 Fix typo on README.md (#5484)
Just a quick typo fix on Multi Zones documentation :)
2018-10-20 16:56:59 +02:00
Tim Neutkens
384fbdc3aa v7.0.2-canary.9 2018-10-11 11:42:53 +02:00
Tim Neutkens
965f50beb2
Remove pathname (#5424) 2018-10-10 21:58:15 +02:00
Adam Stankiewicz
299cc65d21 Show that <Head /> is needed for custom document (#5376)
* Show that <Head /> is needed for custom document

* Add comment explaining required Document fields

* Update README.md
2018-10-10 12:00:02 +02:00
Shu Ding
409cf71a4d Move styled-jsx to external modules (#5403) 2018-10-08 16:26:05 +02:00
Henrik Wenz
8ac4561745 Remove AppVeyor artefacts (#5398) 2018-10-08 14:06:09 +02:00
Henrik Wenz
ef01f13e5d Improve test setup (#5388)
* Update jest

* Let jest start chromedriver

This makes sure chromedriver always ends even if the test was canceled by the user.

* Properly close browser in production-config test

* Properly close browser in production/security test

* Properly close browser in export test

* Properly close browser in app-aspath test

* Remove taskr from project root

This isn’t needed anymore

* Readd taskr to project root (temporary)

* Improve global setup/teardown

* Properly close browser in basic/client-navigation test

Clicking an target=_blank link will open a second browser window. We can only close this by using broser.quit()
2018-10-07 15:04:43 +02:00
Tim Neutkens
14fad91084 Use correct link to contributing.md 2018-10-06 07:35:27 +02:00
Tim Neutkens
4e73c12341 Move contributing.md to the top level 2018-10-06 07:34:09 +02:00
Tim Neutkens
51577eac1a Update contributing.md with the new way of running build 2018-10-06 07:32:50 +02:00
Tim Neutkens
ae4c1bc5d0 Link image to nextjs.org 2018-10-06 06:18:50 +02:00
Tim Neutkens
ee696683ca v7.0.2-canary.8 2018-10-05 23:41:38 +02:00
Tim Neutkens
0f6cff88bc Add next-to-next-server 2018-10-05 23:40:36 +02:00
Tim Neutkens
93586573e8 v7.0.2-canary.7 2018-10-03 02:38:07 +02:00
Tim Neutkens
85c3ac94b8 v7.0.2-canary.6 2018-10-03 00:10:59 +02:00
Tim Neutkens
785377d3c3
Add missing dependencies to server (#5369)
- compile default pages correctly into `.next`
- add missing runtime dependencies
2018-10-03 00:08:57 +02:00
Tim Neutkens
de6d394d73 Use correct server path since main was changed 2018-10-02 23:11:01 +02:00
Tim Neutkens
e3ef917077 v7.0.2-canary.5 2018-10-02 17:11:00 +02:00
Tim Neutkens
3246c32f63 v7.0.2-canary.4 2018-10-02 16:55:08 +02:00
Tim Neutkens
b1d8d775ee v7.0.2-canary.3 2018-10-02 16:16:22 +02:00
Tim Neutkens
85b1c1a6b6 v7.0.2-canary.2 2018-10-02 16:02:57 +02:00
Tim Neutkens
41a570f59a v7.0.2-canary.1 2018-10-02 15:38:22 +02:00
Tim Neutkens
1643165e9d v7.0.2-canary.0 2018-10-02 14:27:19 +02:00
Andy
b041fa4782 Support for wasm (#5316)
* Set a default path for wasm modules

* Added the mimetype "application/wasm" for wasm files

* Upgrade write-file-webpack-plugin to 4.4.1

* Made dynamic(import()) in test to dynamic(() => import())
2018-10-02 13:10:07 +02:00
Tim Neutkens
82d56e063a
next-server (#5357) 2018-10-02 00:55:31 +02:00
Martin Beierling-Mutz
532351ebcf Replace all relative links with absolute links in README (#5356)
fixes #5355
2018-10-02 00:41:35 +02:00
Tim Neutkens
3d94ae0a7d
Drop prepare requirement from production server (#5351)
As prepare is only needed to boot up the hot reloader + exportPathMap routes in development, it's not longer a requirement in the production server.
2018-10-01 16:31:47 +02:00
Tim Neutkens
b9461824ec
Remove unused prefetch.js (#5344) 2018-10-01 11:15:52 +02:00
Evil Rabbit
9c287f3c32
Update repo banner 2018-09-30 23:32:43 -03:00
Tim Neutkens
b18840b0ea
Update homepage (#5345) 2018-10-01 01:34:54 +02:00
Tim Neutkens
b1c4f3aec4
Monorepo (#5341)
- Implements Lerna
- Moves all source code into `packages/next`
- Keeps integration tests in the root directory
2018-10-01 01:02:10 +02:00