Commit graph

966 commits

Author SHA1 Message Date
Borek Bernard
4ab56e8a8a Update custom app example in README (#8320)
The code example now uses simpler and safer approach to call page's `getInitialProps`.
2019-08-12 00:06:45 +02:00
Tim Neutkens
2b62c33f25
Only add flying-shuttle code when enabled (#8330)
Follow-up of #7536, small optimization / code removal when the feature is not enabled.
2019-08-12 00:03:11 +02:00
Tim Neutkens
963726d68e v9.0.4-canary.3 2019-08-11 22:44:23 +02:00
Tim Neutkens
a90a55545b
Deprecate Container usage (#8327)
* Remove Container from examples

* Update readme to reflect Container removal
2019-08-11 22:02:33 +02:00
Steven Sinatra
5b1150352f Add info about removing @zeit/next-typescript on .babelrc (#8321) 2019-08-11 13:09:01 +02:00
Tim Neutkens
da494dbb80 Document poweredByHeader option
Fixes #7657
2019-08-10 15:44:43 +02:00
Houssein Djirdeh
d190f2e112 Adds user timing marks and measures for hydration/render (#8069)
* adds user timing marks for hydration step

* changes measure names and removes window namespaces by adding performance as a global to standard

* separates hydrate and render marks

* Add performance mark to router change instead of link click

* Changes performance mark name at router change

* adds checks for performance

* creates constants utils for performance and user timings
2019-08-09 15:43:29 -04:00
JJ Kasper
1db69188ed Remove cache clearing from static-checker (#8290) 2019-08-08 21:52:24 -04:00
Joe Haddad
43370c1f8a
v9.0.4-canary.2 2019-08-08 14:19:46 -04:00
JJ Kasper
a4889f964e
Update handling of ref in next/link (#8254) 2019-08-08 13:11:17 -05:00
Alex Castle
3e8b36e879 Experimental: Granular build chunking (#7696)
* Refactor SplitChunksPlugin configs and add experimental chunking strategy

* Use typeDefs for SplitChunksConfig

* Modify build manifest plugin to create runtime build manifest

* Add support for granular chunks to page-loader

* Ensure normal behavior if experimental granularChunks flag is false

* Update client build manifest to remove iife & implicit global

* Factor out '/_next/' prepending into getDependencies

* Update packages/next/build/webpack-config.ts filepath regex

Co-Authored-By: Jason Miller <developit@users.noreply.github.com>

* Simplify dependency load ordering in page-loader.js

* Use SHA1 hash to shorten filenames for dependency modules

* Add scheduler to framework cacheGroup in webpack-config

* Update page loader to not duplicate script tags with query parameters

* Ensure no slashes end up in the file hashes

* Add prop-types to framework chunk

* Fix issue with mis-attributed events

* Increase modern build size budget--possibly decrement after consulting with @janicklasralph

* Use module.rawRequest for lib chunks

Co-Authored-By: Daniel Stockman <daniel.stockman@gmail.com>

* Dasherize lib chunk names

Co-Authored-By: Daniel Stockman <daniel.stockman@gmail.com>

* Fix typescript errors, reorganize lib name logic

* Dasherize rawRequest, short circuit name logic when rawRequest found

* Add `scheduler` package to test regex

* Fix a nit

* Adjust build manifest plugin

* Shorten key name

* Extract createPreloadLink helper

* Extract getDependencies helper

* Move method

* Minimize diff

* Minimize diff x2

* Fix Array.from polyfill

* Simplify page loader code

* Remove async=false for script tags

* Code golf `getDependencies` implementation

* Require lib chunks be in node_modules

* Update packages/next/build/webpack-config.ts

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

* Replace remaining missed windows compat regex

* Trim client manifest

* Prevent duplicate link preload tags

* Revert size test changes

* Squash manifest size even further

* Add comment for clarity

* Code golfing 🏌️‍♂️

* Correctly select modern dependencies

* Ship separate modern client manifest when module/module enabled

* Update packages/next/build/webpack/plugins/build-manifest-plugin.ts

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

* Remove unneccessary filter from page-loader

* Add lookbehind to file extension regex in page-loader

* v9.0.3

* Update examples for Apollo with AppTree (#8180)

* Update examples for Apollo with AppTree

* Fix apolloClient being overwritten when rendering AppTree

* Golf page-loader (#8190)

* Remove lookbehind for module replacement

* Wait for build manifest promise before page load or prefetch

* Updating modern-only chunks inside the right entry point

* Fixing ts errors

* Rename variable

* Revert "Wait for build manifest promise before page load or prefetch"

This reverts commit c370528c6888ba7fa71162a0854534ed280224ef.

* Use proper typedef for webpack chunk

* Re-enable promisified client build manifest

* Fix bug in getDependencies map

* Insert check for granularChunks in page-loader

* Increase size limit temporarily for granular chunks

* Add 50ms delay to flaky test

* Set env.__NEXT_GRANULAR_CHUNKS in webpack config

* Reset size limit to 187

* Set process.env.__NEXT_GRANULAR_CHUNKS to false if selectivePageBuilding

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

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

* Do not create promise if not using chunking PR
2019-08-08 13:14:33 -04:00
Jason Miller
fa5be4971a Bugfix: Babel targets value can be a String (#8268)
* Fix modern SSR build when Babel configuration uses a String value for "targets". Fixes #8255.

* Add custom babelrc integration tests
2019-08-08 15:38:51 +02:00
Delba de Oliveira
484f988a3a Update README.md (#8282) 2019-08-08 15:31:28 +02:00
JJ Kasper
61d151ccd7 Handle backslashes in exportedFiles (#8277) 2019-08-07 11:27:01 -04:00
Sebastian Benz
91629a8e72 Migrate amp-toolbox-optimizer to @ampproject/toolbox-optimizer (#8275)
* migrate amp-toolbox-optimizer to @ampproject/toolbox-optimizer

* Add updated yarn.lock
2019-08-07 10:47:46 -04:00
JJ Kasper
8e4509caf2 Add warning for invalid href being passed to router (#8231)
* Add warning for bad href being passed to router

* Apply suggestions from code review

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

* Inline invalidHref for better code elimination
2019-08-07 10:47:13 -04:00
JJ Kasper
ca13752e24
Implement experimentalPrerender option (#7983)
* Revert "Remove Old Prerender Implementation (#8218)"

This reverts commit 2ab300dd81.

* Add contentHandler for page config

* Rename config from contentHandler to re-use
experimentalPrerender

* Remove un-needed changes

* Replace backslashes for manifest

* Update manifest output format

* Make prerender: true enable SPR behavior and update
to merge prerender-manifest for flying-shuttle

* Fix output path for / prerender file

* Add dynamic routes to test suite

* Add generating and previewing of skeletons
for prerendered dynamic routes

* remove inline prerender option

* update to not replace getInitialProps which allows
nested getInitialProps and add query when fetching prerender

* Apply suggestions from code review

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

* Remove legacy prerender option

* Apply suggestions from review

* Apply more suggestions from review

* Apply suggestions from code review

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

* Add handling of error when parsing json

* Update handling of moving exported pages

* Rename nextPreviewSkeleton to _nextPreviewSkeleton

* bump
2019-08-06 15:26:01 -05:00
Luis Fernando Alvarez D
d4d5ad4ba5 Remove propertyFields from the client router (#8219)
* Remove forEach over the components prop

* Remove propertyFields
2019-08-06 15:42:33 +02:00
Lukáš Huvar
beed65be40 Compression documentation (#8247)
* Documentation about gzip

* Update packages/next/README.md

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

* Improve docs

* Update packages/next/README.md

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

* Update packages/next/README.md

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

* Update README.md
2019-08-06 13:49:53 +02:00
Luis Fernando Alvarez D
9b02939c43 Define generic for _app state (#8256) 2019-08-06 13:23:50 +02:00
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
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
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