Commit graph

1155 commits

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

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

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

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

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

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

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

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

* Fix { amp: 'hybrid' }

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

* Update packages/next/README.md

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

* Apply suggestions from code review

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

* Unflag Automatic Prerendering

* Ensure pages are lambdas for test

* Fix file check

* Fix tests

* oof

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

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

* Tests for body parsing

* Update api-utils.ts

* Update next-server.ts

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

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

* New structure

* Change next config

* Refactoring tests

* Fix newline

* Fix tests

* Remove dynamic from config

* Apply suggestions from code review

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

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

* Tweak AMP logic some more

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

* Add TODO

* Fix webpack invalidation

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

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

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

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

* Split globals from Next.js module

* Allow `test` as a valid NODE_ENV

* Fix type assignment

* Make sure global types get published

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

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

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

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

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

This reverts commit 6feca310d7.

* Shared webpack build

* ncc workaround pending @zeit/ncc#437

* update ncc

* build tweaks, fixup autodll-import

* possible Node 8 fix

* second possible Node 8 fix

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

* Update expected test snapshot

* Update test to use new syntax

* Update test file

* Test more behavior

* Update route sorter for new param syntax

* Update dynamic routing tests

* Update danging test file

* Tweak test

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

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

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

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

* Update docs for prefetch

* Updated prefetch docs

* Removed hotSelfAccept from docs and othr changes

* Prefer /public

* dots dots dots dots

* Added docs for Automatic Pre-rendering

* Added a note to <Link />

* Removed 404 example

* Added references for Automatic pre-rendering

* Added a typescript section for AMP

* Executed doctoc again to add AMP sections

* Properly explain automatic pre-rendering

* Switch back to LF

* Apply corrections

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

* Minor corrections

* Added back some periods

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

* Add err.sh link for invalid page export

* Fix typo

* Apply suggestions from code review

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

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

* Change default export

* Improve typing for next

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

* Fix errors

* Extra log

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

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

* Use babel plugin for PageConfig

* Fix serverless-loader exports

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

* Use object destructuring

* Add tests for builder target

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

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

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

* update yarn.lock

* do not filter out not directories

* do not fail if folder already exists

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

* use fs-extra only in tests

* investigate and test recursive-copy npm module

* improve test by creating fixtures programmatically

* remove recursive-copy npm module test

* add recursive-copy to bench

* add bench:recursive-copy script

* fix Sema import in recursive-copy.ts

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

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

* Move eventsource polyfill

* Move source-map-support

* Move error boundary

* Deprecate Container in _app

* Make initialRender check better

* Remove unused code

* Only support one subscription as there is only one

* Don’t spread object

* Shorten property name

* Add container in development too

* Simplify query update logic
2019-06-05 20:15:42 +02:00
Lukáš Huvar
c821e83048 API interface extensions (#7363)
* Cookies and Query parsing for API request

* Adding JSON and SEND

* First body parsing

* Body parsing

* Remove extra try catch

* Fix tests

* Only server bundling for API routes

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

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

* Revert on demand server changes

* Use content-type for parsing

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

Co-Authored-By: Jan Potoms <potoms.jan@gmail.com>

* Add tests for server compilation

* Add body limit

* Change API to function chaining

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

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

* Make sure to only refresh query if it is different

* Only update if search isn't empty

* Merge pre-rendered query values with
current query values

* Remove dynamic restriction for autoExporting

* Update dynamic routing test fo autoExport

* Remove autoExport from client-navigation test

* Remove logs and update trailing slash config

* Update nextExport tests in client-navigation

* Disable autoExport in export suite
2019-05-30 17:34:05 -07:00
JJ Kasper
da6791e1f1
v8.1.1-canary.41 2019-05-30 15:55:09 -07:00
Joe Haddad
7f187b4621
Add new stub file for exports 2019-05-30 15:53:32 -07:00
Joe Haddad
21fae5262f
Reuse router logic instead of duping in client (#7476) 2019-05-30 15:44:27 -07:00
Joe Haddad
06e0befd82
Do not leave Promise unresolved (#7475) 2019-05-30 14:57:10 -07:00
Joe Haddad
c782fa4130
Revise dynamic route generation (mark 3) (#7473)
* Revise dynamic route generation
This implements a new tree-based route sorting algorithm that uses a Depth-First-Traversal approach to correctly sort the routes.

This provides better clarity over a `.sort()` based approach and will scale well as we add new features in the future.

* Update import
2019-05-30 13:42:45 -07:00
JJ Kasper
03d589349a
Render valid optimized AMP by default (#7465)
* Upgrade to latest AMP toolbox optimizer

* Remove amphtml from AMP only and update tests

* Update tests

* Apply suggestions from code review

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

* Remove unnecessary rule

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

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

* Add react-ssr-prepass to devdeps
2019-05-29 15:19:21 +02:00
Tim Neutkens
3e51ddb8af
Move syntax formatting to prettier (#7454)
* Run prettier over packages/**/*.js

* Run prettier over packages/**/*.ts

* Run prettier over examples

* Remove tslint

* Run prettier over examples

* Run prettier over all markdown files

* Run prettier over json files
2019-05-29 13:57:26 +02:00
Joe Haddad
5e2e9784e0
Do not force noEmit option into TypeScript configuration (#7451) 2019-05-28 19:01:49 -07:00
JJ Kasper
24034ec957 Add amp.canonicalBase option to set absolute URL (#7262)
* Add canonicalBase config to allow setting
absolute path for canonical link

* Make sure canonicalBase is set for
export and serverless

* Move canonicalBase to amp.canonicalBase

* Update tests with canonicalBase config

* Update tests

* run lint-fix

* Fix canonicalBase config parsing

* Fix canonicalBase during export

* Update amphtml tests
2019-05-28 17:32:17 -07:00
JJ Kasper
26702a8562
v8.1.1-canary.40 2019-05-28 12:49:23 -07:00
Joe Haddad
b6dd463d93 Enable strict export presence in webpack (#7446) 2019-05-28 12:43:07 -07:00
Rafael Almeida
5fa01b15c6 Improvements to build watcher (#7441)
* Remove fragment from _document

* Directly assign id instead of setAttribute

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

* Move build watcher div to Main component

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

* Fix flickering when closing and opening too fast

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

* Ops, bring back fade-in animation

* Remove unnecessary commas

* Render building text by CSS, remove unnecessary jsx attribute

* Remove React usage

* Add support to IE/Edge

* Fix linter issues

* Set custom property with data attribute

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

* Use more strict rules to avoid outside CSS effects

* Use lighter box shadow

* Fix registering HMR callback

* Move initializing build watcher to client/next-dev

* Remove buildWatcherStyle and only use minimal

* Move build watcher element to render

* Move it to create element on initialize

* Fix type error from canary

* Remove extra log

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

* Update README to include Error#title information

* Change title init location

* Update _error.js
2019-05-27 12:22:14 -07:00
Joe Haddad
e27203f89b Dynamic routing mark 2 (#7432)
* Update escape string regexp operators

* temp

* Extract getRouteRegex func

* First iteration of dynamic routing for production only

* Correctly order prod

* Add serverless support

* Single line it

* noop routes

* Format doc

* Fix dynamic routing for dev

* Add flag for dynamic routing

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

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

* remove example

* Add router tests

* Format code

* Sort routes

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

* Extract findPageComponents logic from renderToHTMLWithComponents

* Apply a little formatting

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

* Fix wrong component

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

* Update tests

* Apply suggestions from code review

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

* Router description

* Added head changed router

* Additions

* Fix examples

* Push and replace details

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

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

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

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

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

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

* Update packages/next/pages/_document.tsx

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

* Update packages/next/pages/_document.tsx

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

* Update packages/next/pages/_app.tsx

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

* Update packages/next/pages/_document.tsx

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

* Run new prettier against examples

* Upgrade some next-server packages

* Upgrade Next.js dependencies

* Upgrade webpack deps

* Upgrade async sema

* Fix compilation

* Revert broken plugin
2019-05-23 00:52:36 -07:00
JJ Kasper
3adaafe783
Make sure rendering behavior is only changed when autoExport is enabled (#7408) 2019-05-22 16:16:03 -05:00
Joe Haddad
b6d3c1fd81
v8.1.1-canary.35 2019-05-22 09:47:34 -07:00
JJ Kasper
cdd54afb0d Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps

* Add support for exporting serverless to static
and serving the html files during next start

* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests

* Update flying-shuttle test

* revert un-used pagesManifest change

* remove query.amp RegExp test

* Fix windows backslashes not being replaced

* Re-enable serverless support for next start

* bump

* Fix getInitialProps check

* Fix incorrect error check

* Re-add check for reserved pages

* Fix static check

* Update to ignore /api pages and clean up some tests

* Re-add needed next.config for test and correct behavior

* Update RegExp for ignored pages for auto-static

* Add checking for custom getInitialProps in pages/_app

* Update isPageStatic logic to only use default export

* Re-add retrying to CircleCi

* Update query during dev to only have values
available during export for static pages

* Fix test

* Add warning when page without default export is
found and make sure to update pages-manifest
correctly in flying-shuttle mode

* Fix backslashes not being replaced

* Integrate auto-static with flying-shuttle
and make sure AMP is handled in flying-shuttle

* Add autoExport for opting in
2019-05-22 09:36:53 -07:00
JJ Kasper
4718bd675f Document useAmp in readme (#7405) 2019-05-22 09:31:08 -07:00
terry chay
c0e4b56fdb Update to latest webpack-bundle-analyzer (#7389) 2019-05-21 19:12:25 -05:00
JJ Kasper
e6fb48cee8
Fix string type on router.query (#7387) 2019-05-20 10:21:15 -05:00
Joe Haddad
dc1f907cec
v8.1.1-canary.34 2019-05-19 19:09:42 -04:00
Joe Haddad
931cd3d305
Reduce the maximum number of shuttles 2019-05-19 19:07:19 -04:00
Yuki Takemoto
17f6fa96bd Fix broken link (#7378) 2019-05-18 15:06:51 +02:00
JJ Kasper
3c3abcb6d1
v8.1.1-canary.33 2019-05-17 14:49:41 -05:00
JJ Kasper
842a2905fe Disable babel-loader cache in flying shuttle mode (#7365)
* Disable babel-loader cache in flying shuttle mode

* Move cleaning up old babel-loader caches

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

This reverts commit 5beb365d12.

* Revert "ncc Webpack build (#7301)"

This reverts commit bd8f3c625f.

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

* Apply workaround for Azure node 10 and ncc

* Update incorrect webpack imports

* Use ncced autodll-webpack-plugin

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

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

* Apply suggestions from code review

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

* Update warning for yarn

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

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

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

* Remove old commented out code

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

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

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

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

* Change require functionality

* Change 501 to 404

* Change wording

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

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

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

* Update packages/next/README.md

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

* Update docs

* Update packages/next/README.md

* Update packages/next/README.md

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

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

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

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

* Add license from babel-loader

* Apply suggestions from code review

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

* Make sure to catch errors in next-babel-loader
2019-05-02 16:30:41 -04:00
JJ Kasper
064be18039
v8.1.1-canary.20 2019-05-01 15:34:24 -05:00
JJ Kasper
2e8088e447
Add stats to build tree (#7194)
* Copy pretty-bytes instead of installing
2019-05-01 15:31:08 -05:00
JJ Kasper
445d3f0a33 Make sure next-head class isn't added to title (#7214)
* Prevent next-head class from being added to title

* Add test for title updating when navigating with next/link
2019-05-01 21:36:24 +02:00
Keanu Lee
d0ca9c9eb5 Clean up code/testing artifacts from #7014 (#7211) 2019-05-01 13:56:35 -05:00
Keanu Lee
d120f14d1c Use modern syntax in Next client code (e.g. async await) (#7014)
* Use async/await in build output

* Run next client libraries through plugin-transform-modules-commonjs

* Fix missing includes
2019-05-01 19:16:52 +02:00
JJ Kasper
2776dc731c Use intersection observer to preload in viewport (#7196)
* Use intersection observer to preload
links that are in viewport

* Clean up names

* Check for window before returning observer

* update check for IntersectionObserver

* Remove duplicate IntersectionObserver checks

* Add test for prefetching links in viewport
2019-05-01 15:14:27 +02:00
JJ Kasper
a7d3be61ed Fix wrong task name on watch for next/export files (#7204) 2019-05-01 14:27:50 +02:00
JJ Kasper
808f18cd75
Fix firefox bug with detecting instanceof Promise in dynamic (#7203) 2019-04-30 17:03:57 -05:00
JJ Kasper
e3f0236887 Make sure Cache-Control header is set when no getInitialProps (#7202)
* Remove loadGetInitialProps from _app and fix
cache-control header not being

* Update to still use loadGetInitialProps
in _app since it's simpler

* Add test for cache-control header with custom _app
2019-04-30 23:28:25 +02:00
JJ Kasper
f861e0da75
Make sure not to require react before NODE_ENV has been set (#7200)
* Make sure not to require react before
NODE_ENV has been set

* Update to use force kill to make windows happy
2019-04-30 13:11:19 -05:00
Luis Fernando Alvarez D
ab22b58818
Allow _app and _document to be extended with other props (#7184) 2019-04-29 11:47:40 -05:00
JJ Kasper
6a5c39deaa
v8.1.1-canary.19 2019-04-28 15:47:26 -05:00
JJ Kasper
ceb60b650a
revert nccing webpack (#7189) 2019-04-28 15:35:40 -05:00
JJ Kasper
ab8620d6d6
v8.1.1-canary.18 2019-04-28 14:23:42 -05:00
JJ Kasper
1f39d41bd2
Fix missing webpack buildin (#7187) 2019-04-28 14:05:39 -05:00
JJ Kasper
353a08de16
v8.1.1-canary.17 2019-04-28 13:30:37 -05:00
JJ Kasper
84afda6bd1
Update cache-control header when no getInitialProps (#7185) 2019-04-28 13:28:59 -05:00
JJ Kasper
dc47c607d7
Make sure to 404 for AMP client bundles in dev mode (#7183)
* Make sure to 404 for AMP bundle in dev mode

* Add test for non-AMP to AMP navigating in dev mode
2019-04-28 13:08:38 -05:00
Luis Fernando Alvarez D
2eee876630
Add types for getInitialProps (#7162)
* Added types for pages
2019-04-27 19:00:31 -05:00
Connor Davis
f66546f950
Use ncc to bundle webpack (#6347) 2019-04-26 17:24:30 -05:00
Joe Haddad
13f6804503
Don't resolve ts|tsx for non-TypeScript users (#7173)
* Don't resolve ts|tsx for non-TypeScript users

* Add missing prettier file

* Add tsconfig.json file
2019-04-27 01:12:40 +09:00
Joe Haddad
5cc8079946
Run Prettier on webpack configuration (#7172) 2019-04-27 00:23:32 +09:00
Joe Haddad
9e8505f0ca
v8.1.1-canary.16 2019-04-26 09:22:15 -04:00
Joe Haddad
265b02f2a9 Purge Terser Cache When Using Flying Shuttle (#7170) 2019-04-26 15:08:37 +02:00
Joe Haddad
3daa473e6d
Disable Terser Cache When Using Flying Shuttle (#7168) 2019-04-26 21:47:57 +09:00
Tim Neutkens
6f0e795f9b v8.1.1-canary.15 2019-04-26 09:41:20 +02:00
Luis Fernando Alvarez D
b963863106 Prefer type over interface (#7164) 2019-04-26 09:37:57 +02:00
JJ Kasper
5aba5e62fe
Add warning for @zeit/next-typescript (#7163) 2019-04-25 15:49:39 -05:00
Luis Fernando Alvarez D
92a58c1a6b
Add missing .d.ts for next/dynamic (#7158) 2019-04-25 15:36:04 -05:00
Tim Neutkens
f8eb392fa5
Add types for next/link (#7160)
* Add types for next/link

* Fix link type errors

* fix router type error
2019-04-25 21:31:53 +02:00
Luis Alvarez
cd0eb34752 v8.1.1-canary.14 2019-04-25 10:56:40 -05:00
Luis Fernando Alvarez D
7dee8d1280 Add types for next/dynamic (#7157)
* Add types for next/dynamic

* Updated types

* .d.ts files are now included by the taskfile of next-server
2019-04-25 17:51:36 +02:00
Joe Haddad
3d28f7fe1e
v8.1.1-canary.13 2019-04-25 11:21:14 -04:00
Joe Haddad
072bdfbf21
Extra chunks shouldn't deopt Flying Shuttle (#7156) 2019-04-26 00:09:57 +09:00
Tim Neutkens
fb14d32701 v8.1.1-canary.12 2019-04-25 14:11:18 +02:00
Tim Neutkens
9ce177f987
Add missing property types for styled-jsx (#7154) 2019-04-25 13:51:06 +02:00
Tim Neutkens
78a959bde4 v8.1.1-canary.11 2019-04-25 11:14:51 +02:00
Tim Neutkens
047bcca4bf
Add support for .ts / .tsx import without extension (#7152) 2019-04-25 11:14:12 +02:00
JJ Kasper
60af68f782 Update to render directly to body in AMP mode (#7151) 2019-04-25 10:14:52 +02:00
JJ Kasper
4fefa2e4f2 Add stale-while-revalidate when no getInitialProps (#7149)
* Add stale-while-revalidate when no getInitialProps

* Make sure setHeader exists
2019-04-25 10:11:05 +02:00
JJ Kasper
644e958d83
v8.1.1-canary.10 2019-04-24 17:08:40 -05:00
JJ Kasper
3666843e68
Remove type defs for non-ts files and fix wrong import for router in _app (#7150) 2019-04-24 17:06:41 -05:00
JJ Kasper
70942050b7
v8.1.1-canary.9 2019-04-24 16:05:58 -05:00
JJ Kasper
d80aea45ae
v8.1.1-canary.8 2019-04-24 15:44:26 -05:00
JJ Kasper
c0ee49b4fb
Move type generating (#7147)
* Move types to run on prepublish in each package

* Update circleci to list dist
2019-04-24 15:43:04 -05:00
Connor Davis
463c8435c5
v8.1.1-canary.7 2019-04-24 15:03:21 -05:00
Connor Davis
ef7c22385a
Replace --target serverless with env var (#7146) 2019-04-25 04:16:30 +09:00
Connor Davis
8582366aa5 Add --target serverless flag (#7141) 2019-04-24 20:32:15 +02:00
Joe Haddad
0c3018c6ce
A webpack bug is preventing us from hashing chunks (#7142) 2019-04-25 01:50:29 +09:00
Joe Haddad
0138ef090a
Remove old debugging logs (#7139) 2019-04-25 01:01:56 +09:00
Joe Haddad
ba0a28ff3f
v8.1.1-canary.6 2019-04-24 11:20:24 -04:00
Joe Haddad
477bdb9299
TypeScript preset should always be enabled (#7137)
The preset handles file toggling itself, and actually changes behavior between `.ts` and `.tsx`.
2019-04-25 00:10:27 +09:00
Martin Šťovíček
05e525443b Always use AllModulesIdentifiedPlugin after HashedModuleIdsPlugin (#7138)
Remove selectivePageBuilding check during build.

Fixes #7109
2019-04-25 00:09:39 +09:00
Tim Neutkens
8f8e7cfb1c v8.1.1-canary.5 2019-04-24 16:51:16 +02:00
Tim Neutkens
c9d599b698
Add .d.ts for next-server (#7133)
* Add .d.ts files

* Drop next declarations from index.d.ts

* Bring back number of errors

* Fix more errors

* Fix rewriteUrlForExport
2019-04-24 16:47:50 +02:00
Sebastian Benz
7a16379435 Upgrade amp-optimizer to 0.5.3 (#7134) 2019-04-24 08:46:16 -05:00
Tim Neutkens
09717e0456 v8.1.1-canary.4 2019-04-24 11:35:30 +02:00
Joe Haddad
8cd21a6368 Server file inclusive Flying Shuttle (#7128)
* Add Flying Shuttle plugin to server compilation

* Ignore build artifacts in flying shuttle manifest

* Add comments explaining what's going on

* Emit Shuttle manifest after both compilations
2019-04-24 11:04:36 +02:00
JJ Kasper
a320dc10f6 Add AMP label to AMP only pages in build tree (#7123) 2019-04-24 10:48:43 +02:00
Luis Fernando Alvarez D
254b23eb07
Add declaration files to /dist (#7118) 2019-04-23 16:12:33 -05:00
Tim Neutkens
498ec618cb v8.1.1-canary.3 2019-04-23 11:54:52 +02:00
Tim Neutkens
c79558328e
Add Typescript compilation (#7110) 2019-04-23 11:54:08 +02:00
chuck
78783477e0 More Specific Info on Script Loading Error (#7108)
* add url info on script loading error message

* Update packages/next/client/page-loader.js

shorten error message for smaller bundle size

Co-Authored-By: chuck0523 <chuckinthestar@gmail.com>
2019-04-23 11:29:52 +02:00
Tim Neutkens
4d8a9fd8bb v8.1.1-canary.2 2019-04-23 09:40:24 +02:00
Joe Haddad
2b7ca40622 Revert "Detect built ins in externals (#7083)" (#7107)
This reverts commit f8978cc29c.
2019-04-23 09:09:48 +02:00
Luis Fernando Alvarez D
08a6066681 Replace the typescript compiler with @babel/preset-typescript (#7016)
* Added babel typescript for the core files

* Add __NEXT_VERSION

* Added noop.js to the babel taskfile

* Only include dynamic-import-node for the bin task

* Added babel-plugin-dynamic-import-node

* Use loose option to prevent Object.defineProperty

* Enable loose in preset and enable compact mode

* Disable compact and loose to compare

* Re-enable compact and loose
2019-04-23 09:05:49 +02:00
Luis Fernando Alvarez D
db5b3dc8e3
Update types for with-router (#7106)
* Updated declarations for with-router
2019-04-22 17:32:10 -05:00
Rhys Arkins
baabfbd777 fix: add repository to next-server package.json (#7105) 2019-04-22 21:33:28 +02:00
Tim Neutkens
c0a10b9960
Wait for entry to resolve in production build (#7104)
* Wait for entry to resolve in production build

* Return promise
2019-04-22 20:57:02 +02:00
Luis Fernando Alvarez D
29f71bfcba Add more TypeScript types (#7054)
* Moved server/lib/utils.js to Typescript

* moved _app.js to Typescript

* Moved _error.js to Typescript

* Added argument for custom props in _app and _error

* Moved _document.js to Typescript

* updated one test

* Updated types and added a validation for _document props

* Improved types

* Fixed some types

* Updated AppType

* Fixed some tests

* Added missing import

* Removed a not very useful type

* Fix missing type

* Move @types/styled-jsx

* Fix typescript errors
2019-04-22 19:55:03 +02:00
Pierre de la Martinière
be4026f48f Make next export respect experimental.exportTrailingSlash (#6752)
* Add --no-subfolders argument to next export

* Use experimental.exportTrailingSlash instead of a cli flag

* Add experimental.exportTrailingSlash documentation

* Add tests for export with experimental.exportTrailingSlash

* Remove docs

* Remove comment
2019-04-23 01:55:03 +09:00
Joe Haddad
87f60f56dd
v8.1.1-canary.1 2019-04-22 12:26:26 -04:00
Joe Haddad
597138f359
Cache Babel and AutoDll plugin in dirDir/cache (#7102)
* Cache Babel and AutoDll plugin in `dirDir/cache`

* Extract code
2019-04-23 01:16:42 +09:00
JJ Kasper
bc1e088b73 Make styles compatible in AMP mode (#7060)
* Make styles compatible in AMP mode

* bump

* Update to parse styles from fragment for
backwards compat in AMP mode

* Add test for AMP styles fragment support
2019-04-23 00:32:46 +09:00
JJ Kasper
80210bc31a Update removing AMP pages to not require during build (#7081)
* Update to use babel plugin with webpack plugin to
remove AMP client bundles since they are not used

* Remove acorn dependency since it isn't used
2019-04-22 06:25:17 +09:00
Tim Neutkens
bcf6918bc3 v8.1.1-canary.0 2019-04-21 23:22:30 +02:00
Joe Haddad
f5be84e4ff Upgrade Terser (#6981)
The new version of Terser seems to be significantly slower than the previous.  I wanted to see what our stats PR says.
2019-04-22 06:03:57 +09:00
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;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