Commit graph

878 commits

Author SHA1 Message Date
JJ Kasper
0648c35508
Update auto export opt-out warning and err.sh (#11801) 2020-04-10 12:31:19 +02:00
Joe Haddad
2704387d2e
Add New Provider (#11757) 2020-04-08 16:20:28 -04:00
JJ Kasper
cad2a75649
Make sure to handle "next" import gracefully (#11733)
* Make sure to handle "next" import gracefully

* Update test file
2020-04-07 15:13:01 -04:00
Aaron Reisman
8f4e265f76
Fix Utility Types (#11077) 2020-04-06 17:59:44 +02:00
Aaron Reisman
7a61fb7fdf
Cleanup Build Output Types (#11076) 2020-04-06 17:59:36 +02:00
Aaron Reisman
bddd1ce53e
Update compiler.ts Improve TypeScript typings (#11074)
Improve TypeScript typings
2020-04-06 17:58:35 +02:00
matamatanot
6821d1f8f7
import from compiled (#11684)
Co-authored-by: “kosuke_matano” <kosuke_matano@cyberagent.co.jp>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-04-06 10:24:37 -04:00
JJ Kasper
1cdc607968
Warn when user has pages/_error but no pages/404 (#11603)
* Warn when user has pages/_error but no pages/404

* Update test

* Update custom-error-no-custom-404.md

* Apply suggestions from code review

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

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-04-05 13:19:14 +02:00
JJ Kasper
56118439b7
Update to make sure to respond with 400 for invalid URLs (#11561)
* Update to make sure to respond with 400 for invalid URLs

* Update response text for 400 API error
2020-04-02 09:24:32 +02:00
JJ Kasper
3f6bd47dfb
Update build output with renamed column (#11401)
* Update build output with renamed column

* Update build output test

* Update naming of column

Co-authored-by: Tim Neutkens <timneutkens@me.com>
2020-04-01 11:39:25 +02:00
JJ Kasper
d61eced9a6
Update to make sure AMP only bundles are always removed in pro… (#11527) 2020-04-01 10:24:44 +02:00
Tim Neutkens
b8d075ef0e
Update environment support (#11524)
* Remove req.env

* Rename NEXT_APP_ to NEXT_PUBLIC_

* Remove key exposing env config

* Update tests

* Update NEXT_APP_ test to NEXT_PUBLIC_
2020-03-31 17:53:50 +02:00
Guy Bedford
755dc40969 postcss loaders 2020-03-30 16:26:25 -04:00
Guy Bedford
a3ec26d30a ignore-loader 2020-03-30 16:26:25 -04:00
Guy Bedford
8dad5abd66 file-loader 2020-03-30 16:26:25 -04:00
Guy Bedford
c855a3828e babel-loader, cache-loader 2020-03-30 16:26:25 -04:00
Guy Bedford
84a46dfb8c thread-loader 2020-03-30 16:26:25 -04:00
Guy Bedford
40f6bdef32 autodll-webpack-plugin 2020-03-30 16:26:25 -04:00
Guy Bedford
35a6710cdb babel revert 2020-03-30 16:26:25 -04:00
Guy Bedford
c16f60067b path-to-regexp 2020-03-30 16:26:25 -04:00
Guy Bedford
9c2e43a382 find-up 2020-03-30 16:26:25 -04:00
Guy Bedford
202fcbff7a terser 2020-03-30 16:26:25 -04:00
Guy Bedford
7194bfc6a6 string-hash, strip-ansi 2020-03-30 16:26:25 -04:00
Guy Bedford
caa5da7c41 source-map, manifest type fix 2020-03-30 16:26:25 -04:00
Guy Bedford
9615bbd83d recast, babel core sharing 2020-03-30 16:26:25 -04:00
Guy Bedford
26dca225d6 node-fetch, ora 2020-03-30 16:26:25 -04:00
Guy Bedford
4adf4b3300 lodash.curry 2020-03-30 16:26:25 -04:00
Guy Bedford
3b36a3711c json5 2020-03-30 16:26:25 -04:00
Guy Bedford
a34766ab62 gzip-size 2020-03-30 16:26:25 -04:00
Guy Bedford
6a8455e713 escape-string-regexp 2020-03-30 16:26:25 -04:00
Guy Bedford
a9a704e727 devalue 2020-03-30 16:26:25 -04:00
Guy Bedford
af40b5b2f8 chalk, ci-info 2020-03-30 16:26:25 -04:00
Guy Bedford
90a0cef87e browserslist 2020-03-30 16:26:25 -04:00
Guy Bedford
5619f990cf refactor ncc optimization, babel optimization 2020-03-30 16:26:25 -04:00
Tim Neutkens
e7ea27645d Add support for comments in tsconfig.json
Fixes #11390
2020-03-27 11:20:13 +01:00
JJ Kasper
d8155b22ff
Add initial support for new env handling (#10525)
* Add initial support for new env config file

* Fix serverless processEnv call when no env is provided

* Add missing await for test method

* Update env config to .env.json and add dotenv loading

* ncc dotenv package

* Update type

* Update with new discussed behavior removing .env.json

* Update hot-reloader createEntrypoints

* Make sure .env is loaded before next.config.js

* Add tests for all separate .env files

* Remove comments

* Add override tests

* Add test for overriding env vars based on local environment

* Add support for .env.test

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

* Use chalk for env loaded message

* Remove constant as it’s not needed

* Update test

* Update errsh, taskr, and CNA template ignores

* Make sure to only consider undefined missing

* Remove old .env ignore

* Update to not populate process.env with loaded env

* Add experimental flag and add loading of global env values

Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-03-26 13:32:41 +01:00
Tim Neutkens
7774101ad1
Skip paths that are routed to a .d.ts file (#11322) 2020-03-24 12:25:58 +01:00
Joe Haddad
f19dcf9b6e
Add Numeric Separator Support for TypeScript (#11308)
* Add Numeric Separator Support for TypeScript

* Check for number in render
2020-03-23 17:41:35 -05:00
Tim Neutkens
7fce52b905
Add support for paths in tsconfig.json and jsconfig.json (#11293)
* Add support for tsconfig/json `paths` option

* Add tests for paths in tsconfig.json

* Don't apply aliases when paths is empty

* Clean up unused methods and link to TypeScript license

* Add tests for jsconfig

* Put feature under an experimental flag

* Enable to see if tests pass

* Update types

* Add feature under an experimental flag
2020-03-23 10:45:51 -04:00
Dulmandakh
d3fb262958
remove mkdirp, bump fs-extra to 9.0.0 (#11251)
* bump mkdirp to 1.0.3, which support promise

* fix mkdirp in spr-cache.ts

* bump fs-extra to 9.0.0

* remove mkdirp
2020-03-21 17:02:05 +01:00
JJ Kasper
c14d983d54
Ensure hybrid AMP works correctly with SSG (#11205)
* Ensure hybrid AMP works correctly with SSG

* Strip AMP from query when not needed
2020-03-20 09:46:52 +01:00
Tim Neutkens
38e42cd4bb
Add support for baseUrl option in tsconfig and jsconfig (#11203)
* Add support for baseUrl option in tsconfig and jsconfig

* Move jsconfigPath

* Remove filter
2020-03-19 17:34:24 +01:00
JJ Kasper
e28e8ada98
Group CSS files in shared build output separate from JS files (#11184)
* Group CSS files in shared build output separate from JS files

* Fix buildId not being replaced in shared by all
2020-03-19 09:25:10 +01:00
JJ Kasper
836f68aa67
Add CSS file to build output (#11145)
* Remove filtering CSS from build output

* Add displaying page specific CSS files and including them in page size
2020-03-18 09:47:39 +01:00
JJ Kasper
ea7c1e1dcf
Add support for SCSS options (#11063)
* Add support for SCSS includePaths

* Support sassOptions instead of just includePaths

Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-03-16 10:55:16 +01:00
Aaron Reisman
85e9ce1b0b
Update preset.ts: Remove any and use updated Node.js types (#11075)
Remove any and use updated Node.js types
2020-03-15 12:22:53 +01:00
JJ Kasper
71f97198d1
Add support for static 404 when _error does not have custom GIP (#11062)
* Add support for static 404 when _error does not have custom GIP

* Update tests
2020-03-14 09:58:20 +01:00
Joe Haddad
18036d4e51
Correct Cache-Control Behavior for GS(S)P (#11022)
* Correct Cache-Control Behavior for GS(S)P

* remove old line

* fix test
2020-03-13 10:40:10 +01:00
JJ Kasper
ccb6ce7ed4
Add support for getStaticProps in pages/404 (#10984)
* Make sure to not show pages/404 GIP error from _app having GIP

* Add error for getStaticProps in pages/404 too

* Add support for getStaticProps in pages/404

* Update test
2020-03-12 10:48:14 +01:00
JJ Kasper
fde1ce2924
Add warning when built-in CSS/SCSS support is disabled (#10942) 2020-03-10 14:29:40 -04:00
Joe Haddad
8443a809f3
Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability

* Add support for cyclic refs

* Add unit tests

* Test for error in development mode

* Fix prerender preview tests

* Fix gssp preview tests

* fix 2x test cases

* Add desired test

* fix some more tests

* Fix route manifest expect

* Fix test expects

* Test that `getServerSideProps` does not error in production

* Test that getStaticProps is not checked in production

* Test serialization check during build

* Fix export detection for serverless

* Update test/unit/is-serializable-props.test.js

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

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-03-09 13:30:44 -04:00
JJ Kasper
b274fe39d3
Update method for attaching GS(S)P identifier to page (#10859)
* Update to use separate export instead of attaching to Component to identify GS(S)P pages

* Handle initialProps being undefined
2020-03-05 23:15:10 -05:00
Joe Haddad
a5d0cb9d80
Measure getStaticProps, getServerSideProps (#10800)
* Measure `getStaticProps`, `getServerSideProps`

* Test new fields
2020-03-02 19:01:12 -05:00
Prateek Bhatnagar
16672a4353
Adding conformance checks (#10314)
* adding tests  for rect sync conformance check

* adding test for react sync script conformance check

* reverting yarn lock changes

* adding duplicate polyfill conformance

* bug fixes in dulpicate polyfill conformance check

* adding settings capability to conformance plugin

* removing minification check from server build

* bug fix

* settings for react sync script check
2020-03-02 22:53:18 +01:00
JJ Kasper
9ec3dae607
Fix next/config module mismatch in new serverless mode (#10792)
* Add failing test case

* Update serverless-loader require to fix config module mismatch

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-03-02 12:38:16 -05:00
Joe Haddad
990eda2c88
Prefetch SSG Data (#10127)
* Prefetch SSG Data

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

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

* Revert router.ts

* Revert link.tsx

* undo change

* mimmic existing

* simplify

* Prefetch href and asPath

* fix load

* dedupe prefetchAs

* Inject script tag on hover

* comment prefetchAs

* minify code

* introduce lazy files

* Add some breathing room

* correct default type

* Prefetch non-dynamic data

* Prefetch dynamic route data

* Fix size test

* Humanize code

* add tests

* Disable code

* Only generate modern version in modern mode

* Extract function helper

* add comments

* Filter out dynamic route to simplify manifest size

* add test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-03-02 12:14:40 -05:00
Joe Haddad
e608c86b59
Separate Low Priority Files from Main Files (#10756)
* Separate Low Priority Files from Main Files

* Fix tests
2020-02-29 17:09:42 -05:00
Janicklas Ralph
7848615bd6
Fix url-polyfill dep and re-enable native-url (#10726)
* Adding native-url package

* Bumping native-url version

* Upgrading native-url

* Logging stats object for debugging

* Logging stats object for debugging

* Adding try catch to the error lines

* Experimenting with regex

* Experimenting with regex

* Experimenting with regex

* Testing regex changes

* Fixing defer-script test case to not include polyfill.js

* Meging changes with existing polyfill work

* Bumping version

* adjust webpack config

* Reduce size in size test

* Remove 1kb from legacy

* Bumping native-url version, includes fix for IE11

* Update lock file

* Updating native-url, fixes issue on IE11

* Fix sourcemap being added in document

* Adding Router as an app level dep. Fixes Router not being added as a dep to pages without Link when granularChunks is enabled

* Fix typescript error

* Fix modern + granularChunks hydration failing

* Fix TS error

* Update native-url version

* Adding native-url with safari fix

* Update url-polyfill in polyfill-nomodule package

* Remove url-polyfill from next package.json

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-27 22:08:58 -05:00
JJ Kasper
c9d9f1131c
Remove unstable_ prefix from new methods (#10723)
* Rename getServerProps to getServerSideProps

* Remove unstable_ prefix from new methods

* Add error when legacy methods are detected

* Add legacy methods for babel transform

* Add unstable_getServerSideProps also

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

* Update types import

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-27 11:57:39 -06:00
JJ Kasper
2789e7e0c2
Rename getServerProps to getServerSideProps (#10722) 2020-02-27 11:04:30 -06:00
Joe Haddad
663f5c4b6e
Fix Error Message 2020-02-27 09:25:17 -05:00
Joe Haddad
47ff1eb95a
Ability to Disable SSG Fallback (#10701)
* Ability to Disable SSG Fallback

* Throw error when value is missing

* Fix existing tests

* Adjust error message

* Do not render fallback at build time for `fallback: false` page

* Fix existing fallback behavior

* fix build

* fix version

* fix some tests

* Fix last test

* Add docs for get static paths

* Add explicit mode tests

* test for fallback error message
2020-02-27 13:23:28 +01:00
JJ Kasper
6dea45bdc9
Add dataRoutes field to routes-manifest for SSG and serverProps routes (#10622)
* Add dataRoutes field to routes-manifest for SSG and serverProps routes

* Update routes-manifest test
2020-02-26 14:35:02 -05:00
JJ Kasper
395714a475
Update url prop handling for pages with new data methods (#10653)
* Make sure to show error when url prop is returned for a page

* Update test and handle undefined pageProps

* Handle empty props

* Apply suggestions from code review

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

* Update tests

* Update to not add url prop for SSG/SSP pages

* Update errsh for reserved prop

* Update errsh wording some more

* Update tests and to warn instead of error

* Update reserved prop warning

* Include page in url prop warning

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-26 13:26:55 -05:00
JJ Kasper
364b4fe797
Make sure rewrites are handled in serverless mode correctly (#10697)
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-26 13:14:34 -05:00
JJ Kasper
40abd708e1
Show better error when non-array is returned from custom-routes (#10670)
* Show better error when non-array is returned from custom-routes

* bump

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-24 17:01:02 -05:00
JJ Kasper
f17e170c3d
Add calling getStaticPaths in development before showing fallback (#10611)
* Add calling getStaticPaths in development before showing fallback

* Move staticPathsWorker to next-dev-server

* Make sure to clear require cache in worker process

* bump

* Remove staticPathsCache member

* Update numWorkers for staticPathsWorker
2020-02-24 16:36:59 -05:00
Joe Haddad
c3d914919a
Fix Double URL Encoding for Serverless (#10663) 2020-02-24 13:06:11 -05:00
Joe Haddad
89c792f67f
Preview Mode Should Not Cache (#10636)
* Preview Mode Should Not Cache

* add import

* fix import

* add tests

* Add real serverless mode tests
2020-02-22 10:26:39 +01:00
Joe Haddad
40217b75b9
Revert "Re-Enable Native url Module (#10530)" (#10623)
This reverts commit b329f6a2d6.
2020-02-21 01:16:07 -05:00
JJ Kasper
f5cb1a69d7
Add error messages for dynamic SSG page without getStaticPaths (#10620)
* Add error messages for dynamic SSG page without getStaticPaths

* Update error check

* Update test file

* Update another test file

* Adjust

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-21 00:57:10 -05:00
Janicklas Ralph
b329f6a2d6
Re-Enable Native url Module (#10530)
* Adding native-url package

* Bumping native-url version

* Upgrading native-url

* Logging stats object for debugging

* Logging stats object for debugging

* Adding try catch to the error lines

* Experimenting with regex

* Experimenting with regex

* Experimenting with regex

* Testing regex changes

* Fixing defer-script test case to not include polyfill.js

* Meging changes with existing polyfill work

* Bumping version

* adjust webpack config

* Reduce size in size test

* Remove 1kb from legacy

* Bumping native-url version, includes fix for IE11

* Update lock file

* Updating native-url, fixes issue on IE11

* Fix sourcemap being added in document

* Adding Router as an app level dep. Fixes Router not being added as a dep to pages without Link when granularChunks is enabled

* Fix typescript error

* Fix modern + granularChunks hydration failing

* Fix TS error

* Update native-url version

* Adding native-url with safari fix

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-21 00:25:49 -05:00
Tim Neutkens
e9e1a2b900
Disable setImmediate polyfill (#10612)
* Disable setImmediate polyfill

* Update size-limit

Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-02-20 12:52:28 -05:00
JJ Kasper
db445db790
Add err.sh for invalid getStaticPaths return value (#10605)
* Add err.sh for invalid getStaticPaths return value

* Update error link

* Apply suggestions from code review

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-02-20 10:05:49 +01:00
Tim Neutkens
9a0d82b4d9
Clean up landed experimental flags (#10593)
* Clean up landed experimental flags

* Remove check for experimental flags from build too

* Remove /_errors/404 in favor of /404

* Remove unneeded check for pathname

* Update test paths

* Fix test

* Update test

* Remove test for disabled config

* Set pages404 always to true

Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-02-19 14:54:38 -05:00
Joe Haddad
5e12e5f56a
Emit ES5 Friendly Code in Program#exit Visitor (#10591)
* Emit ES5 Friendly Code in Program#exit Visitor

* Document reasoning

* updt

* Update next-ssg-transform.ts
2020-02-19 11:29:30 -05:00
JJ Kasper
2a0843349c
Update error message for invalid return value from getStaticPaths (#10580) 2020-02-19 00:20:45 -06:00
Tim Neutkens
0222a09cd0
Enable polyfillsOptimization (#10574)
* Enable polyfillsOptimization

* Update sizes

* Commons is no longer there

* Update test
2020-02-18 19:26:55 +01:00
Jan Potoms
3f691eaa45
Remove ts-ignore where possible (#10541)
* Remove ts-ignore where possible

And replace by typecasts

* More accurate types

* bend cliententries in a correct shape earlier on

* comment becomes unnecessary

* add webpack overload to allow for the next.js use case

* Avoid changing public interface

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-17 16:16:19 -05:00
Joe Haddad
1c247b5cf1
Check next.config.js settings (#10425)
* Check next.config.js settings

* Add tests

* test package.json case too
2020-02-14 15:42:44 -05:00
Joe Haddad
71019e70d3
Remove native-url Again (#10526)
* Remove `native-url` Again

* update comment

* update sizes
2020-02-13 17:54:25 -05:00
JJ Kasper
4617950457
Add handling for default as named export in SSG transform (#10486)
* Add failing SSG syntax

* Add handling for default as named export in SSG transform

* Revert [comment].js

* Revert index.js

* adjust

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-13 00:25:44 -05:00
Jan Potoms
0b12e2e859
Improve error for invalid page configurations (#10441)
* Remove any type and fix edge cases

Removed the "as any" and use the @babel/types typeguards instead. This revealed some edge cases that would just error.

* Remove ts-ignore

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-12 23:39:51 -05:00
Joe Haddad
e38e3dd55a
Adjust SSG Loading Behavior (#10510)
* Adjust SSG Loading Behavior

* Update expected preview behavior

* Rename two corrections

* Only use skeleton in production for now

* Fix "should SSR SPR page correctly" test

* fix tests

* fix trailing comment letter

* disable test for now
2020-02-12 20:06:07 -05:00
Joe Haddad
3cb3498324
SSG Preview Mode (#10459)
* checkpoint: api impl

* Add support for tryGetPreviewData

* snapshot: server(less) support

* Add X-Prerender-Bypass-Mode header support

* Pass preview data to getStaticProps call

* add TODO

* setPreviewData

* 100k iterations

* Handle jwt error

* Write out preview values

* forgot file

* set preview props

* Send preview props

* add preview props

* Pass around more data

* update yarn lock

* Fail on Invalid Prerender Manifest

* Make Missing Prerender Manifest Fatal

* fix ts errors

* fix test

* Fix setting cookies + maxage

* Secure is not needed as we encrypt necessary data

* Set on domain root

* Set cookie max ages

* Render a fallback on-demand for non-dynamic pages

* Test preview mode

* remove old build

* remove snapshots

* Add serverless tests

* use afterAll

* Remove object assigns

* fix cookie spread

* add comment
2020-02-11 20:16:42 -05:00
Joe Haddad
79fb13e587
Builds with Warnings Still Complete (#10498) 2020-02-11 17:09:00 -05:00
Joe Haddad
14f33dd54f
Make Missing Prerender Manifest Fatal (#10485)
* Fail on Invalid Prerender Manifest

* Make Missing Prerender Manifest Fatal

* fix test
2020-02-10 17:43:34 -05:00
JJ Kasper
f6e7a38101
Add paths field for unstable_getStaticPaths (#10454)
* Add paths field for unstable_getStaticPaths

* Make sure to specify page in getStaticPaths errors
2020-02-07 22:09:54 -05:00
JJ Kasper
9dc0afd9b9
Redesign custom-routes output and show headers in output (#10444) 2020-02-07 16:06:02 +01:00
JJ Kasper
3099f0881a
Add initial SSG fallback handling (#10424)
* Add initial SSG fallback handling

* Remove extra changes and update fallback handling

* Remove extra timeout for testing

* Update SSG tests in dynamic-routing suite

* Add racing to decide between rendering fallback and data

* Update size-limit test

* Update comment

* Make sure to follow correct route change order

* Make comment more verbose for racing

* Revert getStaticData to only return Promise

* Make sure to update URL on fallback

* Add retrying for data, de-dupe initial fallback request, and merge fallback replace

* Update to add preload for fallback pages data

* Add test for data preload link

* Use pre-built fallback in production mode

* Remove preload link for fallback from _document

* Update to make sure fallback is rendered correctly for serverless
2020-02-07 14:09:06 +01:00
JJ Kasper
238202ec11
Make missing param error message more specific (#10433) 2020-02-05 15:27:22 -06:00
JJ Kasper
a4c507d5b4
Update to use existing util to de-dupe path check (#10431)
* Update to use existing util to de-dupe path check

* Update error message for requested/resolved mismatch

* Use correct dataRoute value for prerender manifest

* Fix pageUrl having double slash on Windows
2020-02-05 22:10:39 +01:00
JJ Kasper
5ae7fe534e
De-dupe paths returned in getStaticPaths (#10423)
* De-dupe paths returned in getStaticPaths

* Remove warning
2020-02-04 21:55:11 -05:00
JJ Kasper
ec39aa46dc
Update optimize event with static 404 status (#10420)
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-04 15:10:40 -05:00
Joe Haddad
ecd628b7e0
Re-enable native-url (#10419)
* Re-enable `native-url`

* update sizes
2020-02-04 14:58:22 -05:00
Alex Castle
21fea2ce61
Modify splitChunksPlugin to give shared CSS chunks different names (#10408)
* Modify splitChunksPlugin to give shared CSS chunks different names

* fix lint

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-04 14:22:26 -05:00
Joe Haddad
bc81379618
Detect Invalid Pages Before Optimize (#10418) 2020-02-04 13:55:43 -05:00
Luis Alvarez D
909ab3b179
Check for invalid pages (#10403)
* Updated event

* adjust regex

* adjust regexp more

* Better test file regex

* add tests

* Update index.test.js

* Rename test file

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-04 10:46:22 -05:00
Joe Haddad
3d507abe0c
Remove Old Records (#10398) 2020-02-03 11:41:43 -05:00
JJ Kasper
c01534c92e
Make sure runtime config is set before any imports for serverless (#10386)
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-02 22:33:53 -05:00
Luis Durão
a433b9be6a
Fix bug in catch-all routes with SSG (#10379)
* Fix bug in catch-all routes with SSG

* fix slash

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-02 22:07:45 -05:00
JJ Kasper
db90ffe1ea
Implement experimental pages/404.js for custom 404 page (#10329)
* Implement experimental pages/404.js for custom 404 page

* Make sure to show error for getInitialProps in pages/404 in dev mode also

* Update routes-manifest tests for new value

* Make sure page404 is boolean in routes-manifest

* Rename variables for consistency

* Make sure to only use 404 page for 404 error
2020-02-01 15:47:42 +01:00
JJ Kasper
afc278f567
Add support for runtimeConfigs in serverless mode (#10365)
* Add support for runtimeConfigs in serverless mode

* Update test
2020-02-01 14:24:22 +01:00
Tim Neutkens
e35005c214
[Experimental] Nomodule polyfills chunk (#10212)
* Polyfill Promise in polyfills chunk

* Override promise polyfill to use built-in

* Update sizes

* Update polyfills

* Test

* Add dep

* Use iife

* Unscope

* Revert "Unscope"

This reverts commit ab26bcefd551c544d5b3c577b7ce91e5ecfb9bb9.

* trigger

* Remove unused code

* Set helpers to true

* Update yarn.lock

* Fix test

* Update polyfills size

* Add comment

* Add back comment

* Put polyfills optimization under experimental flag

* Fix filename

* bring back promise for backwards compat until experimental feature is landed

* fix resolve alias check

* correct loader

* fix logic branches

* adjust !!

* adjust cache key

* Conditionally branch polyfill

* fix promise polyfill branching

* Re-add runtime

* fix base object

* fix yarn lock

* Add cache key

* correctly set caller

* add basic test

* Increment h=>i

* increment to j just in case

Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-01-30 01:04:29 -05:00
Alexander Dreith
bd3662b52b Fix preprocessor loader error (#10235)
* Run resolve-url-loader after sass-loader

* Add regression test

* Update test to match

* Revert global.ts

* Make `preProcessors` readonly

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-28 16:31:38 -05:00
JJ Kasper
c24daa2172 Add initial support for unstable_getServerProps (#10077)
* Add support for unstable_getServerProps

* Apply suggestions from review

* Add no-cache header and update types

* Revert sharing of load-components type

* Add catchall test and update routes-manifest field

* Update header check

* Update to pass query for getServerProps data requests

* Update to not cache getServerProps requests

* Rename server side props identifier

* Update to nest props for getServerProps

* Add no-cache header in serverless-loader also

* Update to throw error for mixed SSG/serverProps earlier

* Add comment explaining params chosing in serverless-loader

* Update invalidKeysMsg to return a string and inline throwing

* Inline throwing mixed SSG/serverProps error

* Update setting cache header in serverless-loader

* Add separate getServerData method in router

* Update checkIsSSG -> isDataIdentifier

* Refactor router getData back to ternary

* Apply suggestions to build/index.ts

* drop return

* De-dupe extra escape regex

* Add param test
2020-01-27 17:50:59 -05:00
Joe Haddad
abd69ec4be
Fix Experimental Modern Mode with CSS (#10289) 2020-01-27 15:32:45 -05:00
James Mosier
c9dc17b852 Added support for BigInt to API routes (#10215)
* Added support for bigint to API routes

Closes #7980

* added BigInt test to get result

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-27 08:19:49 -05:00
JJ Kasper
2ff2e9e12c Update _next/data URL handling in serverless-loader (#10261)
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-24 23:34:00 -05:00
JJ Kasper
f143ca63be Update SSG types and clean up RenderOpts type (#10259)
* Update SSG types and clean up RenderOpts type

* Move SSG types back to internal module
2020-01-24 23:25:11 -05:00
JJ Kasper
e079cce41c
Update static check vars and fix types (#10260)
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-24 17:41:00 -06:00
JJ Kasper
8579888cec De-dupe escape-regex with escape-string-regexp (#10257)
* De-dupe escape-regex with escape-string-regex

* Un de-dupe for client-side file
2020-01-24 18:27:39 -05:00
Joe Haddad
3f9b930815
Error on Invalid PostCSS Shape (#10244)
* Error on Invalid PostCSS Shape

* Add link to docs
2020-01-23 16:27:07 -05:00
Prateek Bhatnagar
0edd6a031a Adding conformance webpack plugin (#9716)
* adding Conformance Plugin behind a flag

* fixing compiler ts error

* fixing spelling errors 🤦🏻‍♂️

* addressing comments

* bug fix

* making it const enum

* reverting const enum

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-23 16:09:12 -05:00
Joe Haddad
32ded0539e
PostCSS Error When Exporting Function (#10242)
* PostCSS Error When Exporting Function

* Update postcss-function.md
2020-01-23 15:39:50 -05:00
Joe Haddad
c713741f51
Explain Ignored PostCSS Plugin (#10240) 2020-01-23 15:28:37 -05:00
Joe Haddad
3c3186efb5
Revert "feat(build): Transpile assuming higher version of runt… (#10233)
This reverts commit 6b87b2b541.
2020-01-23 09:04:46 -05:00
Alexander Dreith
8449ebc221 [Experimental] Add built-in Sass support (#10133)
* Add built-in Sass support

* Add copy of CSS tests for SCSS

* Fix failing tests

* Fix url-loader tests

* Remove css file generated by tests

* Fix nprogress import for css file

* Fix SCSS modules (still 2 tests that need investigating)

* Update documentation for Sass support

* Fix plain CSS import test

* Fix formatting with prettier fix

* Update test output to reflect scss usage

* Revert "Fix plain CSS import test"

This reverts commit 380319d9d0c4bfb19e28c210262ccd82d19f3556.

# Conflicts:
#	test/integration/scss-modules/test/index.test.js

* Update loader structure

* Resolve loaders before passing to compile function

* Remove dead filter  code

* Arrange loaders in order and push to array

* Fix loader order bug

* Fix global Sass loader and make module prepocessor optional

* Adjust Sass Modules Implementation

* Fix typo

* Adjust regexps

* Use regexes

* Simplify global setup

* Adjust comments

* fix regex

* Simplify identifier file

* Update Sass Instructions

* Remove unneeded fixtures

* Adjust global tests

* Remove wrapper

* Update source maps

* Flag scss behavior

* Fix css property value

* Update fixtures with Sass vars

* Turn on Scss support

* fix HMR test

* Fix snapshots

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-22 15:26:51 -05:00
Joe Haddad
f67f99a295 Extract CSS Loaders into Separate Files (#10210) 2020-01-22 09:50:27 -06:00
Joe Haddad
4a2236dac3
Dedupe CSS Regexes (#10206) 2020-01-22 09:50:30 -05:00
Joe Haddad
a3f1d65eba
Fix ESLint Ignores and Extract Fn (#10205) 2020-01-22 09:32:51 -05:00
Tim Neutkens
fa65442cad Disable core-js for server-side build (#10189)
* Disable core-js in server-side build

* Update cache-key

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-21 09:47:20 -05:00
JJ Kasper
5f5c5e4e9e Add support for catch-all routes with SSG (#10175)
* Add support for catchall routes with SSG

* Add test for invalid catchall param in getStaticPaths
2020-01-20 16:44:50 -05:00
Sebastian Silbermann
6b87b2b541 feat(build): Transpile assuming higher version of runtime (#9511)
* feat(build): Transpile assuming higher version of runtime

* Use runtime version from manifest

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-20 21:40:59 +01:00
Joe Haddad
2e668e6b31
Remove native-url (#10176)
* Remove `native-url`

* Increase sizes
2020-01-20 14:47:42 -05:00
JJ Kasper
e04e5a5c15 Add initial support for static 404 page (#10113)
* Add initial support for static 404 page

* Apply suggestions from code review

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

* Simplify custom error page check

* Add comment explaining reason for custom app check

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2020-01-20 15:10:24 +01:00
JJ Kasper
5a9a478cc8
Fix hydration with custom _app and granular chunks (#10144)
* Add failing hydration test

* Add importing of next/router to _app

* Fix type

* Update _app check for windows

* Remove babel fix

* Update to use webpack to require next/router
2020-01-17 14:13:51 -06:00
JJ Kasper
22e015f7b6 Support unnamed parameters in custom-routes correctly (#9920)
* Support unnamed parameters in custom-routes correctly

* Update unnamed params checking to be strict

* Removed un-used regexKeys

* Update test routes

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-16 17:38:38 -05:00
Josh Larson
80ed74bcae Add specific warning for require() PostCSS plugin (#10121) 2020-01-16 00:09:56 -05:00
Joe Haddad
57ec121d48
Rename Build SPR to SSG (#10114) 2020-01-15 15:57:07 -05:00
Joe Haddad
41195b69e1
Fix Legacy CSS with Granular Chunks (#10101) 2020-01-14 23:02:49 -05:00
JJ Kasper
fff897d766 Apply some renames for SSG related code (#10099)
* Rename some spr related stuff to ssg

* Update packages/next/lib/constants.ts

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-14 20:22:15 -05:00
Joe Haddad
d9d9545f30
Error on CSS in Custom Document (#10091) 2020-01-14 14:53:42 -05:00
Joe Haddad
2d76c4a9bb
Replace __NEXT_SPR with __N_SSG Identifier (#10090) 2020-01-14 14:40:20 -05:00
JJ Kasper
84264f8179 Add required permanent: boolean field to redirect (#10044)
* Add permanent field for redirects

* Update printing redirect status code

* Don't add permanent to routes-manifest

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-14 13:28:48 -05:00
Janicklas Ralph
415a9b6d1e Fix modern + granularChunk hydration failing (#9727)
* Adding native-url package

* Bumping native-url version

* Upgrading native-url

* Logging stats object for debugging

* Logging stats object for debugging

* Adding try catch to the error lines

* Experimenting with regex

* Experimenting with regex

* Experimenting with regex

* Testing regex changes

* Fixing defer-script test case to not include polyfill.js

* Meging changes with existing polyfill work

* Bumping version

* adjust webpack config

* Reduce size in size test

* Remove 1kb from legacy

* Bumping native-url version, includes fix for IE11

* Update lock file

* Updating native-url, fixes issue on IE11

* Fix sourcemap being added in document

* Adding Router as an app level dep. Fixes Router not being added as a dep to pages without Link when granularChunks is enabled

* Fix typescript error

* Fix modern + granularChunks hydration failing

* Fix TS error

* Update native-url version

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-14 13:10:16 -05:00
James George
7f25fb6cf6 chore: Minor code refactor to eliminate redundant code (#10051) 2020-01-14 10:40:45 +01:00
Joe Haddad
9f6fdb95f2
Ignore CSS Ordering Warnings (#10068) 2020-01-13 07:48:24 -05:00
Joe Haddad
a7a924f2a4 Disable New CSS For Sass, Less, and Stylus (#10043) 2020-01-10 15:07:06 -06:00
Joe Haddad
243c038222
docs(errors): CSS Modules Imported by a Dependency (#10034) 2020-01-10 11:45:01 -05:00
Joe Haddad
dd020fb888
docs(errors): CSS Imported by a Dependency (#10032) 2020-01-10 10:40:28 -05:00
Joe Haddad
fa81a4df83 Add Links to Global CSS Error (#10031)
* Add Links to Global CSS Error

* Add Example
2020-01-10 09:31:38 -06:00
Joe Haddad
5d3303f50a
Ensure Build Output Does Not Contain <buildId> (#10021)
* Ensure Build Output Does Not Contain `<buildId>`

* use posix join for common file
2020-01-09 17:31:03 -05:00
Joe Haddad
345efa3ea8 Keep Chunk Hash in Build Output (#10020) 2020-01-09 15:44:47 -06:00
Joe Haddad
0fd15ad6ba
Separate Self Size and First Load Size (#10014)
* Separate Self Size and First Load Size

* Tweak tests
2020-01-09 13:49:52 -05:00
Afzal Sayed
58b2d9e208 Use optional chaining syntax (#9975)
* Use optional chaining syntax

* Changes as per review

* Bug fix
2020-01-08 11:30:53 -05:00
Joe Haddad
1c6f0874ce Test That Custom Properties Are Not Compiled (#9984)
* Fix Browserslist Loading

* Fix Browserslist Integration for CSS

* Add missing file

* Test That Custom Properties Are Not Compiled

* Disable custom properties transform
2020-01-08 12:06:16 +01:00
Joe Haddad
8686fca6a4
Fix Browserslist Integration for CSS (#9985)
* Fix Browserslist Loading

* Fix Browserslist Integration for CSS

* Add missing file
2020-01-07 16:59:58 -05:00
Joe Haddad
2757826cf7
Use <script defer> by default, matching <script type=module> (#9966)
* Use `<script defer>` by default, matching `<script module>` behavior

* remove old test
2020-01-06 14:55:08 -05:00
Felix Mosheev
dea80b8565 Allow libs that ends with next/dist such as i18next, next-i18next, react-i18next to be external (#9956)
fixes #9022

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-06 14:27:36 -05:00
Tim Neutkens
1fd57d22d5
Remove experiment (#9945)
* Remove experiment

* Add back ssr-prepass for serverless test

* Update size as they both decreased

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-01-04 17:40:18 +01:00
Joe Haddad
878ee56bb9
Fix New CSS Support Media Paths (#9916)
* Fix CSS Media Paths

* update test

* Use absolute path

* Add new tests

* fix import
2020-01-03 12:45:04 -05:00
Tim Neutkens
c8799f9e7d
Enable catchAllRouting by default (#9922) 2020-01-03 16:51:26 +01:00
JJ Kasper
ad7bb4e352 Add headers support to custom-routes (#9879)
* Add headers support to custom-routes

* Update manifest version test

* Add headers field for dynamic routes test

* Update test
2020-01-01 13:47:58 +01:00
JJ Kasper
8132524d24
Revert version bump for routes-manifest (#9896) 2019-12-31 16:06:09 -06:00
Joe Haddad
8247f19f10 Defer Loading CSS Configuration (#9889) 2019-12-30 17:53:35 -06:00
JJ Kasper
148084006a Add basePath to routes-manifest (#9875)
* Add basePath to routes-manifest

* Bump routes-manifest version

* Update tests for version bump
2019-12-30 11:23:26 +01:00
Tim Neutkens
86808bbce2
Add basePath support (#9872)
* Add basePath support

* Add tests including copy of HMR tests

* Add production tests

* Add tests for serverless target

* Add missing quotes
2019-12-29 20:03:12 +01:00
Joe Haddad
be3b5b7c5f Register Created Bindings (#9864) 2019-12-28 16:01:01 -06:00
Joe Haddad
edf63e597d Expose CSS Issuer When Error (#9850)
* Expose CSS Issuer When Error
This introduces a friendlier error for invalid CSS imports by telling you the offending file.

---

Fixes #9847

* fix test matches
2019-12-27 13:56:33 -06:00
Joe Haddad
14b18da055
Special Global CSS Error within node_modules (#9849) 2019-12-27 13:35:37 -05:00
Joe Haddad
a56d9a918c Do Not Run File Loader on Server (#9843) 2019-12-26 16:17:37 -06:00
Jason Miller
93c745c2b7 [Experimental] Move Babel transpile into a cached thread pool (#9331)
* Add cached off-thread babel transpile

* Update webpack-config.ts

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2019-12-24 16:58:50 +01:00
Joe Haddad
632e40f266
Optimize Prefetching (#9818)
* Optimize Prefetching

* fix css client nav test

* fix preload viewport test

* fix production test

* patch tests more

* Make page loader wait on prefetch

* no unhandled rejection

* Save some bytes
2019-12-24 10:07:44 -05:00
JJ Kasper
b9865ba32e Add checking filesystem after each rewrite (#9568)
* Add check: true behavior to custom routes

* Update adding dev routes

* Add checking of pages and dynamic routes for check: true

* Fix hasPage binding

* Add tests for check: true behavior

* Update regex checking

* Make changes based on review

* Update to handle rewrites in serverless loader

* Update to not change req.url

* Make sure to always parse dynamic route params

* Export all of pathToRegexp from path-match

Co-authored-by: Joe Haddad <timer150@gmail.com>
2019-12-23 16:20:17 -05:00
Joe Haddad
5c3f9ba745 Add Specific Error for Function in PostCSS Config (#9815) 2019-12-23 14:43:38 -06:00
Lachlan Campbell
8e1046d94a Fix error message typo: "Keys that need moved" (#9772) 2019-12-17 14:25:02 -10:00
JJ Kasper
fd95d6c8bc
Fix AMP HMR for child components (#9736) 2019-12-16 11:45:48 -06:00
JJ Kasper
a32af59e93 Fix Shared Sizes Missing Commons (#9752)
* Fix shared sizes missing commons

* Add tests
2019-12-14 12:23:04 -07:00
Tim Neutkens
950d67b721
Add experiment for prefetching (#9747) 2019-12-14 11:21:48 +01:00
Joe Haddad
845dc0827d Compute Gzip Sizes of Files (#9745) 2019-12-14 00:39:59 -06:00
JJ Kasper
6fcb6230d2 Add support for exporting from serverless build (#9744)
* Add support for exporting from serverless build

* Add more tests

* Update syntax

* Dont add dynamic params in worker

* Update amphtml rel for serverless tests

* Update tests again

* Update dynamic params populating

* Fix params parsing

* Pass params separately
2019-12-14 01:31:48 -05:00
Joe Haddad
32cb5e105a Disable CSS Support When Manually Configured (#9735)
* Disable CSS Support When Manually Configured

* upgrade TS

* adjust yarn lock

* Remove another version of TypeScript

* Remove possibly leftover loader

* Revert "Remove possibly leftover loader"

This reverts commit 7ce2d1a8854f3d7a833867f8ac3be7923a6cb1d8.

* Update to use no-op loader
2019-12-13 14:23:28 -06:00
Joe Haddad
62a6ece4b9 Emit Static Export Intent (#9737)
* Emit Static Export Intent

* Remove the old export detail on rebuild

* Add test cases

* fix export

* Add a resolve return
2019-12-13 13:30:22 -06:00
Joe Haddad
88de2328e5 Enable Page Symbol For /_error (#9730) 2019-12-13 14:45:15 +01:00
Joe Haddad
1a0a76c011 New File Size Output (#9726)
* New File Size Output

* fix test
2019-12-12 20:44:34 +01:00
Joe Haddad
a133f850fa Refine Pages Output (#9725) 2019-12-12 17:20:24 +01:00
Joe Haddad
5b57a7527d Improve Build Output for SSG (#9719)
* Improve Build Output for SSG

* Swap out symbols and reasons

* adjust text more

* Add test

* Expect more output lines

* fix test case
2019-12-12 10:45:45 +01:00
Joe Haddad
c4c3173297
Fix CSS Modules Relative Path on Windows (#9709) 2019-12-11 14:21:40 -05:00
Joe Haddad
179e627a36
Redesign PostCSS Configuration Loading (#9704)
* Redesign PostCSS Configuration Loading

* Test array configuration

* Test new configuration handling

* Remove unnecessary async
2019-12-11 11:51:10 -05:00
Joe Haddad
a6dc0e1603 Adjust postcss-modules Message (#9703) 2019-12-11 09:23:06 -06:00
Joe Haddad
734989d836 [Experimental] CSS Module Support (#9686)
* CSS Module Support

* Fix Server-Side Render of CSS Modules

* Fix Jest Snapshots
https://github.com/facebook/jest/pull/8492

* Fix snapshots

* Add test for CSS module edit without remounting

* Add tests for dev and production style being applied

* Add missing TODOs

* Include/exclude should only be applied to issuer, not the CSS file itself

* Add CSS modules + node_modules tests

* Test that content is correct

* Create Multi Module Suite

* Add client-side navigation support for CSS

* Add tests for client-side nav

* Add some delays

* Try another fix

* Increase timeout to 3 minutes

* Fix test

* Give all unique directories
2019-12-11 11:46:12 +01:00
JJ Kasper
83eeda085b Fix not detecting legacy getStaticParams in serverless mode (#9685)
* Fix not detecting legacy getStaticParams in serverless mode

* Update test/integration/prerender-legacy/test/index.test.js
2019-12-10 14:30:22 -05:00
JJ Kasper
6c103ef5a6 Add checking of custom routes for invalid fields (#9434)
* Add checking of custom routes for invalid fields

* Remove un-used test imports

* Mentioned statusCode can be undefined in error message

* Update test

* Update invalid routes output

* Add checking to make sure source/destination start with slash

* Update import
2019-12-10 09:54:56 -05:00
Joe Haddad
9b6ea9d466 Refactor Webpack Configuration (#9651)
* WIP

* Move data experiment

* Do not throw away rules

* Remove test code

* Correct next data behavior

* Add support for async composing

* Remove unnecessary workaround

* Rename Field
2019-12-09 14:08:15 -06:00
JJ Kasper
963d598dc1
Add tests for optional chaining and nullish coalescing (#9665)
* Add tests for optional chaining and nullish coalescing

* Add integration tests
2019-12-08 12:38:22 -06:00
Sayuti Daniel
26a6a37316 feat: optional chaining and nullish coalescing (#9615) 2019-12-08 12:46:44 +01:00
Joe Haddad
ed1a9450f0 Disable SSG Transform on Non-SSG Pages (#9657)
* Disable SSG Transform on Non-SSG Pages

* correct test
2019-12-07 00:03:29 -06:00
Joe Haddad
04b2f0ebe1
Use Real Identifier for SSG Transform (#9656) 2019-12-07 00:52:24 -05:00
Joe Haddad
cbf8e0b2c4
Bump Babel Cache Key (#9655) 2019-12-06 23:30:58 -05:00
Joe Haddad
bbc62a07be
Only Remove Server-Side Imports (#9653)
* Only Remove Server-Side Imports

* Cleanup imports
2019-12-06 22:57:14 -05:00
Joe Haddad
b4db0421ff
Rewrite SSG Transform for Recursive Cleanup (#9652) 2019-12-06 22:03:55 -05:00
Joe Haddad
cb4c08c02b
Fix SSG Named Export Transform (#9649) 2019-12-06 11:50:50 -05:00
Joe Haddad
10b2eb5b31
Fix Import Shaking for Namespaces (#9650) 2019-12-06 11:46:00 -05:00
Joe Haddad
e76fc18675
Remove Scope Bindings for SSG (#9642) 2019-12-05 18:05:50 -05:00
Joe Haddad
7a51b888c5 Add SSG Support for VariableDeclarations (#9641) 2019-12-05 16:43:18 -06:00
Joe Haddad
a718df5f56
Rewrite SSG Transform (#9640)
* Rewrite SSG Transform

* Add Named Declaration Support

* more adjustments

* Re-crawl scope
2019-12-05 17:22:41 -05:00
Joe Haddad
b4d0740c62
Separate SSG Transform from Config (#9639)
* Separate SSG Transform from Config

* update fn name

* fix
2019-12-05 16:43:11 -05:00
Joe Haddad
30ff9a339f Remove Extraneous Imports in Pages (#9627)
* Remove Extraneous Imports in Pages

* Add test

* bump cache key
2019-12-05 11:04:00 -06:00
Joe Haddad
21e1db7bc1
Aggressively Replace Constants (#9610)
* Aggressively Replace Constants

* Test both windows

* add other switch
2019-12-03 16:08:49 -05:00
Joe Haddad
063e174076
Add Support for Event Flushing (#9606)
* Add Support for Event Flushing

* Update packages/next/export/index.ts

Co-Authored-By: JJ Kasper <jj@jjsweb.site>
2019-12-03 11:18:58 -05:00
JJ Kasper
bf1d872f89 Fix extra prerender error for invalid getStaticProps usage (#9593)
* Fix extra prerender error for invalid getStaticProps usage

* Add error for getStaticProps usage in _error

* Revert erroring for SSG in _error
2019-12-02 17:12:10 -05:00
Joe Haddad
69b7538dce
Simplify getRouteRegex Callsites (#9597) 2019-12-02 16:43:30 -05:00
Joe Haddad
dd1f610f8d
Add SSG Tests with Catch All Routing (#9594)
* Add SSG Tests with Catch All Routing

* fix node version compat

* Remove unneeded query
2019-12-02 16:04:25 -05:00
JJ Kasper
89b22d2994 Fix missing getStaticProps error in serverless mode (#9532)
* Make sure to show missing getStaticProps error in serverless mode

* Update test
2019-11-27 23:23:32 -05:00
Joe Haddad
ca3f881a42 s/getStaticParams/getStaticPaths/ (#9565)
* WIP: rename get static paths

* Adjust logic

* Add warning

* rename constant

* Check for error when using old method

* Add friendly error message

* Test for message of invalid keys

* replace index with dots
2019-11-27 21:46:16 -06:00
Joe Haddad
a6656a0b84
Upgrade path-to-regexp (#9553)
* Upgrade `path-to-regexp`

* Correct import

* Update delimiter

* Fix path match

* Fix hot loader

* Fix params.path usage and pathToRegexp import

* Revert changes for params.path

* Fix lint

* Simplify path match function

* Delimiter should always be `/`

* Fix passed in params

* Add new regex wrapping

* Wrap another route

* Fix error message match
2019-11-27 16:48:28 -05:00
Kristoffer K
63886b36a2 fix: resolve preset-modules (#9538)
* fix: require preset-modules

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

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

* fix formatting
2019-11-26 14:56:08 -05:00
Jason Miller
1f15746176 [modern] preset-modules & fix custom babelrc (#9489)
* Modernize additional common Babel configurations.

* Add @babel/preset-modules dependency

* code quality

* Use modern terser ecma mode for .module.js bundles.
2019-11-26 11:27:26 +01:00
JJ Kasper
cd8e72d5e3 Add custom routes to build output (#9517)
* Add custom routes to build output

* De-dupe code a bit
2019-11-26 10:33:47 +01:00
Janicklas Ralph
04a7f1e85d Replace url polyfill with self.URL (#9200)
* Adding native-url package

* Bumping native-url version

* Upgrading native-url

* Logging stats object for debugging

* Logging stats object for debugging

* Adding try catch to the error lines

* Experimenting with regex

* Experimenting with regex

* Experimenting with regex

* Testing regex changes

* Fixing defer-script test case to not include polyfill.js

* Meging changes with existing polyfill work

* Bumping version

* adjust webpack config

* Reduce size in size test

* Remove 1kb from legacy
2019-11-25 23:10:02 -05:00
Joe Haddad
4656f52d15
CSS Support Customization (#9502)
* CSS Support Customization

* Sort imports

* Correct PostCSS plugin loading

* Add css customization test

* Test "bad" css configuration

* Add load config test

* adjust spacing

* adjust spacing 2x

* Only allow config through JSON

* Support excluding false plugins

* Test tailwind css behavior

* Test plugin exclusion

* Fix unit test

* Fix config file

* Remove more variants

* Update test cases
2019-11-25 16:52:29 -05:00
Joe Haddad
caa5347873
Remove Legacy Code (#9515)
The `sprStatus` module state is no longer used (and shouldn't be!). We can safely remove this code.

I also renamed the drop bundle identifier while I was here.
2019-11-25 14:32:25 -05:00
Joe Haddad
0a86b149fa
Purge Babel Cache (#9514)
* Bust Babel Cache

* Increase e
2019-11-25 14:16:04 -05:00
Joe Haddad
b80d4d6893
Drop Re-Exported iSSG Imports (#9512)
* Drop Re-Exported iSSG Imports
This pull request adds loader support for the following export form:
```js
export { getStaticParams as unstable_getStaticParams } from '../../lib/docs/page';
export { getStaticProps as unstable_getStaticProps } from '../../lib/docs/page';
```

This will now result in correct detection and removal.

* Add unit tests for next page config behavior

* Test extra function is not dropped
2019-11-25 11:44:24 -05:00
Joe Haddad
61f4e70135
Upgrade Babel Dependencies (#9478)
* Upgrade Babel Dependencies

* Update test for new size
2019-11-20 21:53:12 -05:00
JJ Kasper
09cab2df5e Fix typo in serverless loader (#9431)
* Fix typo in serverless loader

* Add test for top level error in API route

* Fix type error
2019-11-15 18:00:24 -08:00
Joe Haddad
ba5e6943fa
[Experimental] Catch-all Route Support (#9416)
* Catch-all Route Support

* Add SSR tests

* Add additional test

* Add unit tests

* Put the feature behind a flag

* Apply suggestions from code review

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

* Fix test
2019-11-14 23:19:41 -08:00
Janicklas Ralph
332852bf01 Integration test case for fetch alias (#9391)
* Polyfilling fetch and object-assign

* Polyfilling corejs object-assign

* Adding object-assign in polyfills.js. IE11 does not support Object.assign

* Fixing failing test

* Updating object.assign polyfill to fix aliasing

* Updating test case value to match new build stats

* Increasing the size of default build to 225kb

* Fixing defer-script test case to not include polyfill.js

* Revert README.md

* Re-design the polyfill approach based on PR feedback

* Adding comment and fixing test case

* Rename polyfills chunk

* Extract aliases into helper

* Remove extra new line

* Fix TypeScript typings

* Adding _internal_fetch alias

* Adjust build manifest plugin

* Build manifest plugin changes - adding a separate entry for polyfills

* Rename polyfills entry in build-manifest.json

* Remove old comment

* Fix TS

* Set key

* Polyfills already added

* Filtring polyfill.module.js

* Fix test

* Add __internal_fetch to alias rule

* Adjust name

* bump size

* ignore polyfills

* sigh

* Aliasing Object.assign

* Mergin latest changes

* Integration test for polyfilling fetch

* Remove comment

* Fix prettier error

* Fix review comments

* Fix review comments

* Update fetch.js

* Fix tests
2019-11-14 22:47:08 -08:00
Joe Haddad
7bb7d70650
Polyfill Object.assign by Default (#9369)
* Polyfill `Object.assign` by Default

* fix formatting
2019-11-10 20:48:11 -08:00
Mathieu Triay
be86ab00e1 Update webpack config to also take next-stylus into account (#9277) 2019-11-10 19:56:29 -08:00
Joe Haddad
18a9c7e371
Improve linting rules to catch more errors (#9374)
* Update `packages/`

* Update examples

* Update tests

* Update bench

* Update top level files

* Fix build

* trigger
2019-11-10 19:24:53 -08:00
Joe Haddad
8107533b21
Bind fetch to self instead of window (#9368) 2019-11-10 12:54:29 -08:00
Joe Haddad
8dcec04bd1
Fix window.fetch Polyfill (#9364) 2019-11-09 21:25:32 -08:00
JJ Kasper
4e3b5ae20c
Update routes-manifest and add tests (#9361)
* Test custom-routes serverless

* Make sure we add default statusCode to routes-manifest

* Update routes-manifest

* Add DEFAULT_REDIRECT_STATUS constant
2019-11-09 20:00:54 -08:00
JJ Kasper
d19e825daa Implement custom routes RFC (#9157)
* add initial custom-routes handling

* Add tests for custom-routes

* Handle chained redirects, separate dev custom
routes reading, and add version to routes manifest

* Handle no routes manifest

* Swap build custom routes calling

* Add flatten-routes

* Add flattening of custom routes

* Re-work implementation to follow routes top-down

* Add regex field to routes-manifest

* Fix path-to-regexp match breaking after upgrade

* Fix duplicate const from merge

* Add some changes from review

* Don't make path-match strict

* add default custom route values

* Update routes-manifest

* Update options for path-match

* Remove todo

* Add test for rewrite with params

* Only use strict mode for custom routes

* Update dynamic-routing test

* Move getCustomRoutes to prepare

* Remove extra change

* Update handling for error-in-error test

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

* Apply suggestions from review

* Update slice change

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

* Apply suggestions from review

* Fix TypeScript error

* Fix getCustomRoutes in dev mode

* Apply suggestions from code review

* Update slice

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

* Delete un-used test page

* Add test for param overwriting

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

* Add extra check to param test
2019-11-09 14:34:52 -08:00
JJ Kasper
820a9790ba Add a routes manifest with the dynamic routes (#9347)
* Add a routes manifest with the dynamic routes

* Update to use pageKeys for windows compat

* Update routes-manifest test
2019-11-08 16:51:19 -08:00
Tim Neutkens
0499316650 Add check for now.json and custom server (#9346)
* Check if the user has a now.json

* Check for now.json

* Add check for custom server
2019-11-08 09:03:50 -08:00
Joe Haddad
dee2888404
Allow TypeScript Namespaces (#9308) 2019-11-04 15:26:31 -05:00
Joe Haddad
8e62c9b688
Enforce the framework Chunk (#9250) 2019-11-04 11:25:14 -05:00
Joe Haddad
bbf705f262
Simplify Build Output (#9281)
* Simplify Build Output

* Remove noop tests

* Drop 

* Remove bolding
2019-11-04 11:14:04 -05:00
JJ Kasper
739322d06b Handle backslashes for plugins (#9282) 2019-11-01 23:06:34 -04:00
Janicklas Ralph
ff2d3fd87d Polyfill window.fetch by Default (#9168)
* Polyfilling fetch and object-assign

* Polyfilling corejs object-assign

* Adding object-assign in polyfills.js. IE11 does not support Object.assign

* Fixing failing test

* Updating object.assign polyfill to fix aliasing

* Updating test case value to match new build stats

* Increasing the size of default build to 225kb

* Fixing defer-script test case to not include polyfill.js

* Revert README.md

* Re-design the polyfill approach based on PR feedback

* Adding comment and fixing test case

* Rename polyfills chunk

* Extract aliases into helper

* Remove extra new line

* Fix TypeScript typings

* Adding _internal_fetch alias

* Adjust build manifest plugin

* Build manifest plugin changes - adding a separate entry for polyfills

* Rename polyfills entry in build-manifest.json

* Remove old comment

* Fix TS

* Set key

* Polyfills already added

* Filtring polyfill.module.js

* Fix test

* Add __internal_fetch to alias rule

* Adjust name

* bump size

* ignore polyfills

* sigh
2019-11-01 21:00:56 -04:00
Tim Neutkens
7c80febcf7 Initial plugins implementation (#9139)
* Add initial bit for plugins

* Add checks for needed metadata values

* Add test

* Initial plugins changes

* Add handling for _app middleware

* Add loading of _document middleware and
handling of multiple default export syntaxes

* Fix insert order for middleware member expression

* Remove early return from middleware plugin from testing

* Add tests for current plugin middlewares

* Update test plugin package.json

* Update handling for class default export

* Update to use webpack loader instead of babel
plugin, remove redundant middleware naming, and add field for required env for plugins

* Add middleware to support material-ui use case
and example material-ui plugin

* Update tests and remove tests stuff from google analytics plugin

* Remove old plugin suite

* Add init-server middleware

* Exit hard without stack trace when error in collecting plugins

* Add on-error-client and on-error-server and update
to run init-server with next-start in serverless mode

* Update init-client for google analytics plugin

* Add example Sentry plugin and update with-sentry-simple

* Remove middleware field/folder and use src dir for plugins

* Add post-hydration middleware and update
material-ui plugin

* Put plugins code behind flag

* Update chromedriver

* Revert "Update chromedriver"

This reverts commit 1461e978e677f7da05e29e0415ec614a04bf65f9.

* Update lock file

* Remove un-needed _app for sentry example

* Add auto loading of scoped packages, add plugins
config for manually listing plugins, and update
to only collect plugins once

* Update example plugins

* Expose plugins' config

* Rename plugin lifecycles and add babel-preset-build

* Rename other methods with unstable

* Update log when plugin config overrides auto-detecting
2019-11-01 14:13:13 -05:00
JJ Kasper
aafbd53cbf Remove dead code elimination for when iSSG isn't used (#9267)
* Don't rely on page-config plugin to detect iSSG usage

* Make sure to only update sprStatus if page file

* Remove dead-code elimination for iSSG code

* Revert next-page-config.ts

* Update index.js

* Update index.test.js
2019-10-31 16:07:35 -04:00
JJ Kasper
fa5fb97ce8 Make sure to pipe output from staticCheckWorkers (#9256) 2019-10-31 12:38:09 +01:00
Jason Miller
c966900768 Bugfix/Performance: Start the modern child compiler earlier (#9257)
* Start the modern Child Compiler earlier during builds

* fix child compiler errors not bubbling
2019-10-31 12:37:07 +01:00
Gerald Monaco
f632567bcf Add experimental config for React Mode (#9207)
* Add experimental config for React Mode

* Use latest types

* Use latest types
2019-10-30 09:39:58 -04:00
Joe Haddad
6b54e9ed66 Fix Prettier Commit Hook (#9245)
* Apply format to webpack config

* hit all files
2019-10-30 12:35:51 +01:00
Jan Karres
3b3d20f729 Check if 'formatAmpMessages' returns a none empty string in Next.js build process (#8924) 2019-10-29 23:49:40 -04:00
Jason Miller
5f203b8342 Improve serverless build performance (#9155)
* Improve serverless build performance

Next's serverless build uses a custom resolver, injected the via Webpack's `externals` option that delegates out to `resolve-request` to more aggressively pull node modules into the serverless bundles.

When profiling a large Next.js application, I noticed an excessive number of filesystem calls near the end of the build. I narrowed this down to the serverless compiler pass, and eventually the custom resolver function that is the subject of this PR.  As it turns out, around half of the calls to the `externals` custom resolver function are for a `request` path that is a relative import. Next doesn't have any specific logic to apply to relative imports - it only needs to special-case bare module resolution.

Adding a simple bypass for relative module resolution reduces the number of blocking filesystem-bound `resolveRequest()` calls by 50% on a certain well-known Next.js website. This also results in a 30% reduction in production build times for incremental builds.

* Explain more in the comment
2019-10-29 23:36:22 -04:00
Janicklas Ralph
d3293f7cd6 Dynamic granular chunking (#9090)
* Enable granular chunks config for all chunk types

Adding comment

Bug fix

* Update index.test.js

* Update index.test.js

* Fix test cases. Adding next/link to not trigger a different bug

* Removing obsolete comment
2019-10-29 21:27:41 -04:00
Christoph Tavan
14ed867537 Disable worker_threads by default for firebase compatibility (#9199)
* Pass config.experimental.cpus to export during build

Currently, there is no way of specifying the number of worker threads of
`next export` when run as part of `next build`.

I suggest a sane default should be to just use the same amount of
workers that were used during the build process which currently seems to
be configured through `config.experimental.cpus`.

This setting is already respected in the two other places where
jest-workers are in use: The TerserPlugin and the staticCheckWorkers in
`next build`.

* Only enable worker threads if there is more than 1 worker

Multiple worker threads can cause problems when certain dependencies are
being used, see e.g. https://github.com/zeit/next.js/issues/7894

This patch allows disabling of worker threads by setting
`config.experimental.cpus = 1`.

The benefit of spawning 1 worker thread, if there is any at all, should
very limited anyways, so the workload can just as well be processed in
the main thread.

* Disable parallel build for firebase authentication example

* Add integration test to cover #7894

* Rename test suite and add worker_threads config

* Disable worker_threads by default

* Update index.test.js

* Use workerThreads config for TerserPlugin

* Update to use workerThreads config in
TerserPlugin for consistency

* Disable node 12 specific test
2019-10-28 20:01:24 -04:00
Alexander Kachkaev
ad2a3d65fd Add configuration flags to disable integrated type checker (#9138)
* Add a configuration flag to disable integrated type checker

* Add tests for typescript-transpileonly

* Restore removed argument

* Make output more coherent

* Split transpileOnly into ignoreDevErrors and ignoreBuildErrors

* Minor stylistic change
2019-10-28 11:02:03 -07:00
htbvo
211c84e1c9 allow NextScript to optionally defer javascript (#8980)
* allow NextScript to optionally defer javascript

* move defer options to experimental feature

* combine defer flags into a single option

* Update deferScripts to work with serverless target

* Add test for defer and async property

* Read the async property

* Check versions of chrome and chromedriver

* Update to chromedriver 76

* Fix test
2019-10-26 19:27:22 +02:00
Gerald Monaco
4421448f03 Add StrictMode toggle (#9161)
* Add StrictMode toggle

* Rename option to reactStrictMode

* Default to false initially
2019-10-26 00:20:38 +02:00
JJ Kasper
d38da874cf Record src directory usage with version (#9023)
* Add tracking src dir usage to telemetry

* Move isSrcDir back to eventVersion

* Move spinner back

* Add test for isSrcDir telemetry

* Add test for dev mode
2019-10-22 22:42:16 -04:00
Alex Castle
a82b5aed9b Update granular chunks to produce up to 25 chunks per entrypoint on high-complexity apps (#9129) 2019-10-18 13:36:03 -04:00
Joe Haddad
4d3cca3382
Warn on No Cache in CI (#9116)
* Warn on No Cache in CI

* Bold the note lead

* Add custom clarification for netlify

* Reorder

* Add tests

* Fix detection
2019-10-18 12:40:47 -04:00
Gerald Monaco
d28e46ac15 Support Concurrent Mode in Loadable (#9026) 2019-10-18 17:23:06 +02:00