Commit graph

385 commits

Author SHA1 Message Date
JJ Kasper
b210133907 Show dots for non-TTY (#8771) 2019-09-17 13:22:51 -04:00
JJ Kasper
129e32f8ad
Fix windows paths mismatching for type errors (#8766) 2019-09-16 21:30:09 -05:00
JJ Kasper
4e9e51035e Match public files priority in dev (#8641)
* Match public files priority in dev

* Remove un-needed old public file handling

* Run public file priority test for non-dev also

* Make sure to enable publicDirectory

* Add checking for conflicting pages in dev and during build

* Add error for public dir middleware conflict

* Add err.sh for _next conflict

* Move up public dir conflict checking

* Only run _next conflict check in dev when path contains it
2019-09-16 23:06:30 +02:00
JJ Kasper
204028d6ab Update build feedback with dots indicating activity (#8382)
* Add progress for analyzing and auto-prerendering

* Add typing for tty-aware-progress and use stdout

* Add fancier spinners

* Update spinner and add handling for logs while spinning

* Remove un-needed types package

* Remove progress and combine analyzing/prerendering messages
2019-09-16 17:37:00 +02:00
JJ Kasper
fe7c7342c7 Add link to docs for prerender indicator and allow disabling (#8610)
* Add link to docs for prerender indicator and allow disabling

* Fix lint error from example

* Disable by default when electron is detected

* Add button to dismiss indicator for session

* Update disabling indicator in electron
2019-09-15 23:18:11 +02:00
Joe Haddad
d031cf64df
Ensure requests are resolved as directories (#8742)
* Ensure requests are resolved as directories
`resolveRequest` will strip down to baseDir if there's no trailing slash as it assumes you passed a file.

* Disable telemetry for PR Stats
2019-09-14 17:41:05 -04:00
Joe Haddad
cbd427bf3c
Document the intended behavior of our externals (#8741)
This fully annotates our externals code to explain how it should be functioning. This will be useful as tests cases are made to ensure this is working correctly.
2019-09-14 16:58:45 -04:00
Maël Nison
9770d192f2 Prevents externalizing non-hoisted packages (#8739) 2019-09-14 16:12:25 -04:00
Joe Haddad
fb83462713
Externalize experimental package (#8731)
* Add missing dependency

* Ignore prepass for Next.js internal

* Revert "Add missing dependency"

This reverts commit 9ef0030b56255577364ff7cab46f513216a290ae.
2019-09-13 12:38:25 -04:00
Joe Haddad
eb8c11bbda
Organize webpack configuration imports (#8711)
This PR simply organizes the webpack config imports.
2019-09-11 16:41:29 -04:00
Joe Haddad
55369051f5
Warn build on duplicate pages (#8646)
* Fail build on duplicate pages
This will fail the `next build` command when a duplicate page is found.
In development, we'll emit a warning instead of crashing the dev server.

* Add test for warning in development

* Only issue a warning

* Fix production test

* Fix development test

* Remove useless arg

* Warn in development, too
2019-09-11 14:26:10 -04:00
JJ Kasper
5a0dcbc95b Update pages-loader to return one value (#8629)
* Update pages-loader to return one value

* de-dupe page mod update also
2019-09-11 13:21:10 -04:00
Joe Haddad
fcadad9960
TypeScript report on active pages only (#8703)
* TypeScript report on active pages only
The TypeScript integration needs to report on active pages only.
When inactive pages are reported, they block the compilation and prevent the user from fixing the error (because the file isn't watched).

We cannot add the file to the webpack watcher because the compilation has already been sealed.

* Remove TODO message

* Test that inactive pages are not type checked
2019-09-11 13:06:48 -04:00
Maël Nison
9fa8baa03a Uses the PnP API when available (#8668)
* Uses the PnP API when available

* Moves the resolution into an helper

* Update packages/next/lib/resolve-request.ts

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

* Apply Prettier
2019-09-09 11:47:42 -04:00
Joe Haddad
93d6a670fe
Resolve externals using webpack's context (#8669) 2019-09-08 13:53:33 -04:00
Maël Nison
d3c1731c09 Adds the PnP plugin by default (#8653)
* Adds the PnP plugin by default

* Covers loaders

* Fixes linting
2019-09-06 09:49:38 -04:00
Joe Haddad
6e77c071c7
Update Next.js Telemetry Event Shapes (#8628)
* Update Next.js Telemetry Event Shapes

* Force value as-is
2019-09-04 20:31:35 -04:00
Tim Neutkens
2ba352da39 Move next-server back into next package (#8613)
* Initial move

* Make emitting work

* Update paths

* Remove leftover files

* Add correct externals configuration

* Import correct path

* Update path to work with ts-server test

* Update lib directory

* Compile next-server/lib
2019-09-04 10:00:54 -04:00
JJ Kasper
fbf784d76f Add data-ampdevmode attribute for AMP scripts (#8524)
* Add data-ampdevmode attribute

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>
2019-09-03 11:11:22 -04:00
Joe Haddad
ffc205ba8c
Use URL-friendly chunk names (#8609)
* Use URL-friendly chunk names

* Fix example linting
2019-09-03 10:55:48 -04:00
Joe Haddad
67e7753c85
Fix serverless chunking (#8569)
* Fix Serverless Chunking

* Remove old test & environment variable

* Update serverless trace test case
2019-08-30 07:26:30 -04:00
Joe Haddad
1f4e34ca00
Anonymous Telemetry (#8529)
* Add anonymous telemetry

* Fix types

* Remove semver package

* Rename build time variable

* Track CSS-in-JS solutions

* Single retry and 5s timeout
2019-08-29 12:43:06 -04:00
Jason Miller
1b6e455807 Add modern-preset Babel option (#8521)
* Add `modern-preset` Babel option

* fix test failure

* prefix configuration option with "experimental-"

* fix issues noted by @janicklas-ralph
2019-08-27 17:20:07 -04:00
Sebastian Silbermann
bb0ccd9a4d Specify loader paths for PnP support (#8531)
* fix(next): Loader not found using yarn v2

* Use Object.fromKeys pattern instead
2019-08-27 16:37:47 -04:00
JJ Kasper
f81b6d56e0 Replace worker-farm with jest-worker (#8496)
* Replace worker-farm with jest-worker

* Apply suggestions from code review

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

* Remove semaphores on top of jest-worker, unwind
terser worker, and remove extra error log
2019-08-24 14:55:42 -04:00
JJ Kasper
674ba17211
Update prerender-manifest structure (#8497) 2019-08-23 16:17:40 -05:00
Alex Castle
3970a26b92 Tweaks and test for library chunks fixes (#8482)
* Adjust lib chunk naming algorithm and prevent duplicate react-dom

* Remove alias for react-dom and update separator replacement logic

* Add comment to webpack-config

* Add integration test for react-dom duplication

* Switch to using hash for lib chunk names

* remove extra file from PR

* Remove another extraneous change

* Remove test based on lib chunk name

* Update index.test.js
2019-08-23 10:28:48 -04:00
JJ Kasper
56a134409c Debug TypeScript test suite (#8476)
* Tweak typescript test suite

* Revert "Tweak typescript test suite"

This reverts commit 9e0108da7c70e7ae45b412b60c07162383de65f3.

* Make sure HMR connection isn't being closed
while testing

* Update to not re-use NODE_ENV

* Break up/rework TypeScript test suite

* bump
2019-08-22 16:34:24 -04:00
Sojin Park
7c0ac82264 Fix bug in hook destructuring optimization when ignoring array elements (#8455)
* Fix bug in hook destructuring optimization when ignoring array elements

* Add test cases
2019-08-22 11:21:34 -04:00
Alex Castle
3896cbe712 Adjust lib chunk naming algorithm and prevent duplicate react-dom (#8450)
* Adjust lib chunk naming algorithm and prevent duplicate react-dom

* Remove alias for react-dom and update separator replacement logic

* Add comment to webpack-config
2019-08-22 10:46:11 -04:00
Ran Yitzhaki
c3b18fdeaa Fix a broken link in webpack config (#8456)
* Fix a broken link in webpack config

* Update test
2019-08-21 11:58:31 -04:00
JJ Kasper
9c8aaf9d4b Fix build-manifest not removing _app files for modern (#8447) 2019-08-20 15:32:03 -04:00
Jason Miller
8bd2e433de Initial optimizeLibraries experimental flag (#8345)
* Add experimental optimizeLibraries flag, currently prunes Moment.js locales

* expose moment for use in assertion

* try with the same setup as the production integration test

* Apply optimiztaions in dev and on server so they're consistent.

* fix build (oh dear)

* Update index.test.js

* Rename flag to future.excludeDefaultMomentLocales

* Adjust impl
2019-08-20 15:19:45 -04:00
Joe Haddad
5ad0ea8e5b
Remove __NEXT_REPLACE__BUILD_ID__ workaround (#8445)
We no longer need this because we don't run terser on serverless bundles.

---

Closes https://github.com/zeit/next.js/issues/8436
2019-08-20 12:38:14 -04:00
Joe Haddad
847e892d71
Remove Flying Shuttle experiment (#8433)
* Remove Flying Shuttle experiment

* Remove more old tests

* Remove minify loader
2019-08-20 11:07:57 -04:00
Joe Haddad
df4f600291
🗜 Optimize client-side routing manifest (#8429)
* Optimize client-side routing manifest

* Turn on granularChunks for tests

* Add row for build manifest

* Hack it
2019-08-20 02:28:09 -04:00
Maël Nison
a8aa15af11 Adds basic support for PnP (#8427)
* Adds basic support for PnP

* Update preset.ts

* Update next-babel-loader.js
2019-08-19 23:39:07 -04:00
William
ec95927e14 Fix dynamic APIs with query params (#8386)
* Fix dynamic APIs with query params

If you define a dynamic API such as

```
pages/
  api/
    [id].js
```

This api becomes available at `/api/[id]`. If you send a request with
a query parameter the value of `req.query.id` will include the query
string as well as the path parameter.

E.g. the request to `/api/2?test=123` will result in `req.query`
being

```javascript
{
  id: "2?test=123",
  test: "123",
}
```

instead of

```javascript
{
  id: "2",
  test: "123",
}
```

* Fix url parse in serverless loader

* Add serverless test
2019-08-19 13:19:39 -04:00
Tim Neutkens
46c4f20cd3
Add custom profiler / tracer (#8378)
* Add custom profiler / tracer

This captures both client/production builds and everything before and after is cpu profiled, which makes sure that the whole process instead of just webpack is included in the final report.

* Update tests

* Update profiling-plugin.js

* Rename profiling-plugin.js to profiling-plugin.ts

* Update profiling-plugin.ts

* Update and rename profiling-plugin.ts to profiling-plugin.js

* Update webpack-config.ts

* Update profiling-plugin.js

* Add types

* Add missing type

* Add back TypeScript linting

* Remove tracing-js
2019-08-18 21:45:39 +02:00
Jason Miller
d8fe224951 Hook destructuring optimization (#8381)
* Add hook destructuring optimization

* oops, accidentally included loose mode

* inline hook destructuring optimization plugin

* fix test nesting

* fix lockfile

* allow any react hook

* Add page to stats-app with hooks
2019-08-15 18:08:06 -04:00
Jason Miller
cfd6080435 Feature: Add transparent JSX optimization (#8350)
* Add transparent JSX optimization.

* fix duplicate React import

* fix React not being imported when only a single Fragment node is present in a source module

* remove babel-plugin-react-require

* Fix JSX optimization for CommonJS source files.
2019-08-15 17:07:34 -04:00
Joe Haddad
3c611822ab
Create a unique instance of transform-define (#8371) 2019-08-14 14:10:55 -04:00
Joe Haddad
5a8ed815fc
Define typeof window for application code only (#8355) 2019-08-13 22:02:53 -04:00
JJ Kasper
d9abbaded1 Remove experimental async-to-promises code (#8353) 2019-08-13 16:04:17 -04:00
Lukáš Huvar
7e1d54cc09 Add warning for disabled minification during build (#8337)
* Add warning for disabled minification

* Adding err.sh

* Apply suggestions from code review

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

* Remove example

* Update packages/next/build/index.ts

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

* Update index.test.js
2019-08-12 23:13:12 -04:00
Alex Castle
3b31f957a1 Use 'initial' setting for SplitChunksPlugin (#8293)
* Use 'initial' setting for SplitChunksPlugin

* Initial chunking integration test shell

* Create integration tests for granular chunks build output
2019-08-12 20:35:33 -04:00
Joe Haddad
6b516f6c84
Remove accidental support for invalid JavaScript (#8077)
* Remove accidental support for invalid JavaScript
Next.js inadvertently supported users mixing ES Modules and CommonJS due to a Babel bug that was fixed in v7.
This removes the hack in favor of the new Babel `sourceType` feature.

**This will result in broken code for users who relied on this non-standard conforming behavior.**

* Fix comment

* Toggle feature behind modern flag
2019-08-12 00:10:12 -04:00
JJ Kasper
77c5e36ba7 Escape output names for modern bundles to prevent replacing (#8232)
* Escape output names for modern bundles

* Update escaping for modern bundle
2019-08-11 23:32:18 -04:00
JJ Kasper
fc7e235f2c Followup optimizations for new experimentalPrerender (#8287)
* Add checking for hybrid AMP during static check

* Update to always hit server for prerender data

* Add removing of SPR code when not used

* Add checking for hybrid AMP during static check

* Update to always hit server for prerender data

* Add removing of SPR code when not used

* Update dead code elimination
2019-08-11 21:56:57 -04:00
Tim Neutkens
2b62c33f25
Only add flying-shuttle code when enabled (#8330)
Follow-up of #7536, small optimization / code removal when the feature is not enabled.
2019-08-12 00:03:11 +02:00