Commit graph

361 commits

Author SHA1 Message Date
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
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
Joe Haddad
b6dd463d93 Enable strict export presence in webpack (#7446) 2019-05-28 12:43:07 -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
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
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
Joe Haddad
931cd3d305
Reduce the maximum number of shuttles 2019-05-19 19:07:19 -04: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
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
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
Guy Bedford
bd8f3c625f
ncc Webpack build (#7301)
* add back ncc

* fixup ncc build
2019-05-16 11:55:54 -05: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
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
Joe Haddad
f533c5585b
Decommission old flying shuttles (#7299)
* Retire old flying shuttles

* retire => decommissioned
2019-05-10 11:37:54 -04: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
JJ Kasper
0eab07b7e8
Add automatic TypeScript setup (#7125)
* replace fkill with tree-kill
2019-05-08 21:51:23 -05:00
Joe Haddad
9f4904ff10 Integrate type checking into compilation pipeline (#7278) 2019-05-07 20:11:56 -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
Joe Haddad
948948f6be Fix application output (#7264) 2019-05-06 15:22:54 +02: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
75203eb8d2
Fix missing injectCaller (#7223) 2019-05-02 17:20:27 -05: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
2e8088e447
Add stats to build tree (#7194)
* Copy pretty-bytes instead of installing
2019-05-01 15:31:08 -05: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
ceb60b650a
revert nccing webpack (#7189) 2019-04-28 15:35:40 -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
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
JJ Kasper
5aba5e62fe
Add warning for @zeit/next-typescript (#7163) 2019-04-25 15:49:39 -05:00
Joe Haddad
072bdfbf21
Extra chunks shouldn't deopt Flying Shuttle (#7156) 2019-04-26 00:09:57 +09:00
Tim Neutkens
047bcca4bf
Add support for .ts / .tsx import without extension (#7152) 2019-04-25 11:14:12 +02: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
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
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
c79558328e
Add Typescript compilation (#7110) 2019-04-23 11:54:08 +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
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
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
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
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
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
Connor Davis
f8978cc29c Detect built ins in externals (#7083) 2019-04-20 10:44:39 +09:00
Joe Haddad
35236690c0
Disable Terser loader when debugging (#7079) 2019-04-19 13:26:30 +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
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
Joe Haddad
8b136a6f9d
Add experimental option to enable terser loader (#7033) 2019-04-15 20:00:01 +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
Joe Haddad
74cb4f4b7b
Switch to using .next/cache for flying shuttle and terser (#7013) 2019-04-11 17:09:12 -04: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
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
JJ Kasper
9e6708d144 Set custom cacheIdentifier for babel-loader (#6982)
* Set custom cacheIdentifier for babel-
loader that we can increment

* Update to consider external babel config
for cacheIdentifier

* Update to follow babel loader's cacheIdentifier behavior
2019-04-10 23:50:07 -04:00
JJ Kasper
711d45b698 Use next.config env and packages to calculate hashes (#7001)
* Use next.config env and packages to calculate
hashes for chunk-graph

* Remove example from testing

* remove left over import

* Tweak behavior
2019-04-10 15:19:50 -04:00
Joe Haddad
c2d0a4ef0e
Add Flying Shuttle v1 (#6991)
* Add Flying Shuttle v1

* Add serverless file restoration

* Add another message

* Update test

* Resolve page version last

* Print number of changed pages

* Remove old tests

* Re-add head build ID writing

* Change syntax appearance

* Start adding test components

* Fix react loadable manifest

* Complicate dynamic testing

* Fix first build missing head build id

* Remove flying shuttle tests
2019-04-10 12:41:59 -04:00
Joe Haddad
65fcf351c3
Add new getFileForPage helper to build utils (#6999) 2019-04-10 12:37:30 -04:00
Joe Haddad
a44788fb26
Disable flying shuttle when building for now dev (#6998) 2019-04-10 12:37:13 -04:00
Joe Haddad
a1598b5285
Disable recordsPath for selective page building (#6997)
We cannot rely on `recordsPath` when using selective page mode. All modules must be identified.
2019-04-10 12:23:16 -04:00
Joe Haddad
59fb471bc6
Correct page search order (#6996)
This fixes a case where a user has a page named `next.js.js` and `next.js`.
2019-04-10 12:22:10 -04:00
Joe Haddad
0e68d3c2d9
Adjust all modules identified plugin output (#6995)
This output clashed with the new output style. This output is more inline with existing behavior.
2019-04-10 12:21:14 -04:00
Joe Haddad
c2c634caa6
Use chunkGroup request over rawRequest for loadable manifest (#6993) 2019-04-10 12:06:16 -04:00
Joe Haddad
a863a720ef
Fix Chunk Graph Plugin hashes type (#6994) 2019-04-10 11:59:46 -04:00
Joe Haddad
94b8bf75e2
Move build utils to their own file (#6990)
* Move build utils to their own file

* Tweak feature detection
2019-04-09 23:15:35 -04:00
Joe Haddad
b543071440
Remove CLI and negative page building (#6986)
* Remove CLI and negative page building

* Remove select all tests

* Update test of getSpecifiedPages

* Prune old tests from snapshot

* Remove old flying shuttle tests
2019-04-09 22:57:46 -04:00
Joe Haddad
1810cf5abe
Add an experimental mode for flyingShuttle (#6985) 2019-04-09 22:05:40 -04:00
Luis Fernando Alvarez D
a5ad06f99b
the externals option is undefined for client builds (#6983) 2019-04-09 19:10:18 -05:00
Joe Haddad
ca565fc6e4
Adjust flying shuttle minify (#6980)
* Disable Terser plugin when using flying shuttle

* Add a new minify loader

* Downgrade terser

* Turn on minify loader

* Only compress source / mangle output
2019-04-09 15:13:25 -04:00
JJ Kasper
f04bd8bf33 Fix getSpecifiedPages on Windows (#6977)
weren't using the right separator
2019-04-09 15:10:08 -04:00
Luis Fernando Alvarez D
653f0a2a88 Disabled the checkWasmTypes config in webpack (#6978)
* Disabled the checkWasmTypes config in webpack

* Typescripted
2019-04-09 15:09:20 -04:00
Luis Fernando Alvarez D
ae5eeb39f4 Brought escape-string-regexp source to next (#6979)
* Brought escape-string-regexp source to next

* Added Copyright comment
2019-04-09 15:06:55 -04:00
Luis Fernando Alvarez D
72a31cb438
Disabled performance config in webpack (#6976) 2019-04-09 12:43:24 -05:00
Justin Chase
52dd42a6bb Do not clear the console (#6758)
* Do not clear the console

Its rude to clear the console, you may be sharing output with other processes even in tty mode.

* Remove unused dependency

* Dedupe and cleanup dev output without clearing

* use logError

* Remove exit handler

* Add next helper

* Add log helpers

* Switch store to log helpers and a shallow object compare

* Update other files to use new logging utility

* request => build

* Update ready on messages

* Use case insensitive matching
2019-04-09 11:52:03 -04:00
Luis Fernando Alvarez D
75a6ef0646 Moved NODE_ENV to our config (#6965)
Closes #6943
2019-04-09 15:16:27 +02:00
Luis Fernando Alvarez D
f89bd8237b Replace imurmurhash with string-hash (#6964)
Closes #6939
2019-04-09 12:49:30 +02:00
Tim Neutkens
35bbe30912
Optimize resolve configuration (#6954)
* Resolve Next.js loaders first

Next.js loaders should be resolved first, then node_modules. There is no need for NEXT_PROJECT_ROOT_NODE_MODULES anymore since all our loaders are internal

* Move wasm to end of array

Since wasm isn’t the main target for Next.js it makes no sense to try and resolve it as the first value, as it would incur a file not found for nearly all files in the compilation
2019-04-08 14:57:21 +02:00
Tim Neutkens
4b7dd25328
Simplify options assignment (#6949) 2019-04-08 14:54:28 +02:00
Tim Neutkens
7b64381151
Disable terser for server build (#6951)
Checking the stats first. But at least until https://github.com/zeit/next.js/issues/6950 is figured out we should disable it for serverless builds as it's also disabled for zeit.co serverless builds.
2019-04-08 14:06:04 +02:00
Tim Neutkens
da02f57054
use var as libraryTarget (#6945)
By using `var` we opt-out of the LibraryTemplatePlugin. Considering we have our own loader for registering pages this makes sense.
2019-04-08 11:14:51 +02:00
Tim Neutkens
45c100bc2a
Add babel-plugin-transform-async-to-promises (#6929)
* Add babel-plugin-transform-async-to-promises

* Remove unit test as this is covered by integration tests
2019-04-07 21:00:48 +02:00
Joe Haddad
444be1cba6
Fix nesting level of client page scripts (#6925) 2019-04-06 23:33:31 -04:00
Joe Haddad
c56e962918
Add lambda version of shared chunks (#6924)
* Add lambda version of shared chunks

* Fix test on Windows
2019-04-06 22:25:38 -04:00
Joe Haddad
33d32eab5a
Make chunk graph more accurate (#6923)
* Make chunk graph more accurate

* Include shared files in every page
2019-04-06 21:07:32 -04:00
Joe Haddad
a67b6ee117 Fix page resolution (#6920)
Previously this didn't work properly with nested pages.
2019-04-06 20:47:54 +02:00
Joe Haddad
e89c22a3d3
Add a build all but specified pages mode (#6916)
* Add a build all but specified pages mode

* Always include reserved pages in build

* Add tests for ignore pages
2019-04-06 13:11:38 -04:00
Joe Haddad
1603b202e8
Better debug build message (#6915)
* Output a more correct message for debug builds

* Adjust wording
2019-04-05 22:46:35 -04:00
Joe Haddad
bbfc0f8207
Add more chunk graph data (#6911)
* Fix nested position

* Drop front commit

* Emit new page chunks key with all involved files for a page
2019-04-05 16:25:24 -04:00
Joe Haddad
bb4ecfb639 Revert "Extract styled-jsx (#6901)" (#6907)
This reverts commit 5dc9f55e94.
2019-04-05 17:13:06 +02:00
Joe Haddad
3e5adfee24
Turn off module opts when selective page building (#6903) 2019-04-05 00:29:10 -04:00
Joe Haddad
5dc9f55e94
Extract styled-jsx (#6901) 2019-04-04 21:59:49 -04:00
Joe Haddad
e7ca6aa45e
Correctly compute unknown module ids (#6898) 2019-04-04 20:41:07 -04:00
Joe Haddad
cd9a108551
Add ** experimental page globbing support (#6899)
* Add ** page globbing support

* Update check
2019-04-04 20:19:58 -04:00
Joe Haddad
30fe5fc16d
Compute Chunk Graph file hashes on emit (#6897)
* Compute hashes of files during emit

* Fix tests

* Remove test from old location

* Correct the target
2019-04-04 18:00:04 -04:00
Joe Haddad
19c635175b
Make Client request BUILD_ID from the Server (#6891)
* Generate two versions of pages

* Add code VSCode deleted

* Add dynamicBuildId option to __NEXT_DATA__

* Reduce amount of diff

* Make getPageFile code easier to read

* Minimize diff

* minimize diff

* Fix default value for dynamicBuildId

* Fix weird bug

* Fetch the head build id on client

* Move __selectivePageBuilding

* Add tests

* Remove _this

* Add console warning
2019-04-04 17:54:01 -04:00
Connor Davis
899f21ff9b
Dont prefetch with debug mode (#6895) 2019-04-04 15:17:00 -05:00
JJ Kasper
8e51c78ed5
Add test for AMP in serverless mode (#6894)
* Add amp request header and check for amp
query in serverless mode

* Add serverless test for an AMP page

* Update to handle querystring weirdness

* Update serverless test config
2019-04-04 14:55:47 -05:00
JJ Kasper
7f096d0f46
Add check for data in serverless-loader (#6893) 2019-04-04 12:48:05 -05:00
Joe Haddad
ba09c5948e
Set buildId to a fixed value during debug build (#6886)
* Set buildId to a fixed value during debug build

* __debug => debug
2019-04-03 19:43:48 -04:00
JJ Kasper
a361a6a4a2
Fix serverless options (#6884) 2019-04-03 16:42:12 -05:00
Joe Haddad
d653216208
Add an experimental debug mode to builds (#6870)
* Add a debug mode to webpack configuration

* Undo debug change for dist dir
2019-04-02 21:19:08 -04:00
Joe Haddad
a63a493346
Refine selective page building (#6866) 2019-04-02 20:22:04 -04:00
JJ Kasper
aac50e4501
Add error message for AMP bind syntax (#6865)
* Add error message for AMP bind syntax

* Fix custom AMP scripts getting dropped

* Add data.js to package.json to include it
in releases
2019-04-02 17:32:07 -05:00
Joe Haddad
4201fb957d
Emit manifest of all page files (#6853)
* Get all modules included in build

* Add tests

* Get all modules contained per entry chunk

* Sort files

* Add specialized page entry to manifest

* Split manifest into pages and chunks key

* Update test

* Use relative paths to build directory

* Update test
2019-04-02 15:48:05 -04:00
JJ Kasper
6344c5f0c1
Add optimizing AMP pages (#6835)
* Added amp-toolbox-optimizer and added
optimizing AMP pages as dirty and clean

* Fix amp-optimizer breaking serverless build

* Exclude amp-toolbox-optimizer from serverless build

* Added check to make sure hybrid AMP pages
optimize cleanly during export

* Add check to make sure noDirtyAmp is applied
2019-04-02 13:01:34 -05:00
Tim Neutkens
b1fdffec75
amp-bind data injection (#6840) 2019-04-02 16:09:34 +02:00
Dylan Brookes
035890f9cd Fix adblock comment (#6859) 2019-04-02 04:37:04 -04:00
Shahzeb K
25deefbba7 Avoid "ad" anywhere in the buildId (#6854)
* Added a check for ad_ in the buildId

* ad_ > ad

Co-Authored-By: lfades <luis@zeit.co>

* Update the `ad` comment

Co-Authored-By: lfades <luis@zeit.co>

* Avoid all buildId's that contain "ad"

Looking through the uBlock Origin filter list, it uses regex wildcards to avoid various things with "ad" anywhere in the string. It's a safe bet to just avoid "ad" all together (as opposed to just at the start).

* Use regex (case incensitive) to check for "ad" 

The following cases will set this regex to true:

```
/ad/i.test("somead")
/ad/i.test("someADlksdjf")
/ad/i.test("adlksdjf")
/ad/i.test("ADlksdjf")
```
2019-04-01 20:40:43 -04:00
Luis Fernando Alvarez D
742f29fba5 buildId is not an ad (#6851)
* Added a check for ad_ in the buildId

* ad_ > ad

Co-Authored-By: lfades <luis@zeit.co>

* Update the `ad` comment

Co-Authored-By: lfades <luis@zeit.co>
2019-04-01 15:22:21 -04:00
Luis Fernando Alvarez D
c864ab9324 Added useBuiltIns to babel object-rest-spread (#6805)
Use `Object.assign` for the rest-spread transform.
2019-03-31 17:30:25 +02:00
Luis Fernando Alvarez D
6bb83272a3 Exclude transform-typeof-symbol (#6812)
Related to [create-react-app#5278](https://github.com/facebook/create-react-app/pull/5278#issue-220142150)
2019-03-30 01:54:05 +01:00
Luis Fernando Alvarez D
f81e5f4cad Added babel-plugin-dynamic-import-node (#6811)
Replaces `import()` with `require` only for the testing environment.
2019-03-30 01:50:24 +01:00
Joe Haddad
b871e43601
Add a leading slash to passed pages (#6808) 2019-03-27 15:21:30 -04:00
Joe Haddad
b835e2589d
Specified page builds (#6796)
* [wip] individual page builds

* Make flag experimental and remove from main bin

* Do not split chunks when using shared runtime
2019-03-27 11:51:05 -04:00
Luis Fernando Alvarez D
da9472246c Remove prop-types import in the build (#6798)
Tests don't catch this change because `isProduction &&` is always false so I tested it with a local build
2019-03-27 12:26:01 +01:00
JJ Kasper
244b0e700e
Add AMP validation on export (#6794)
* Add err.sh link and pool validation results
to wait to show error until export is finished

* Fix wording in amp-export-validation err.sh

* Update validation error message

Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>

* Update ways to fix text

Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>

* Update why the error occurred wording

Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>

* Update wording some more

Co-Authored-By: ijjk <22380829+ijjk@users.noreply.github.com>
2019-03-26 16:21:27 -05:00
Joe Haddad
0249b331c2
Use a shared module cache (#6791)
* [WIP] Use a shared module cache

* ID modules in development

* Revert "ID modules in development"

This reverts commit 0613d92fa2c8c7fa11a5ff5b7770d784af1cec63.

* Remove context replacement

* Only enable shared runtime in prod

* Sort settings

* Add shared runtime experimental setting

* only enable shared runtime in serverless
2019-03-26 12:30:31 -04:00
Joe Haddad
8c175e5daa Replace buildId well known string during output (#6782)
* Replace buildId well known string during output

* Fix linting
2019-03-25 17:06:00 +01:00
Tim Neutkens
907dd27a88
Make main.js override work correctly (#6781) 2019-03-25 15:08:02 +01:00
Connor Davis
a79c004de0 Remove magic-string (#6772)
* Remove magic-string

* Add back input

* change if statement back

* Fix typo

* remomve useless import
2019-03-24 23:50:58 -04:00
Tim Neutkens
3e7b932b2b
ncc resolve and arg (#6771)
More modules to follow.
2019-03-24 23:38:03 +01:00
Tim Neutkens
f639becf88
Don't use array for main chunk (#6767)
* Simplify getDisplayName

* Don’t use array for single file

* Add aliases, drop htmlescape as it’s not longer in the codebase

* Add correct path

* Use the correct router

* Remove dynamic for now

* Mark as external as the modules are directly called

* Add comment explaining what this does
2019-03-24 14:33:10 +01:00
Tim Neutkens
a8d08d3920
ncc nanoid (#6768) 2019-03-24 14:21:30 +01:00
Tim Neutkens
eb28d4cdcf
Remove hoist-non-react-statics from with-router (#6765)
* Remove hoist-non-react-statics from with-router

* Drop hoist-non-react-statics from package.json
2019-03-23 21:31:44 +01:00
Tim Neutkens
6716bcbf87
Remove error-debug.js checks as the chunk is removed (#6761)
This code is obsolete as the chunk was removed.
2019-03-23 16:55:44 +01:00
Tim Neutkens
d24af62140
Make pages-manifest-plugin compatible with webpack 5 (#6760)
Apparently `entries` is removed in webpack 5, using `chunks` instead which holds the same result.
2019-03-23 15:33:13 +01:00
Joe Haddad
78bcfa07b2 Skip console clearing when not in a TTY (#6726) 2019-03-19 23:16:02 +01:00
Joe Haddad
ff5c8465de
First pass of runtime amp validator (#6708) 2019-03-18 19:21:18 -04:00
Tim Neutkens
6104a71afb Make react-loadable-manifest only have modules that are part of dynamic chunks (#6622)
* Make react-loadable-manifest only have modules that are part of dynamic chunks

* Add manifest sorting
2019-03-17 14:19:26 -04:00
JJ Kasper
11a161f296 Add possible explanation for webpack resolve error (#6682)
When overriding `config.resolve.alias` incorrectly webpack will throw an error because private-next-pages is not defined. This adds a more descriptive error explaining the error better.

Fixes: #6681
2019-03-17 13:13:29 +01:00
JJ Kasper
a6ddaefe22 Add experimental exportTrailingSlash config (#6664)
By default when `next export`ing a Next.js application we will automatically append a `/` to all urls to be fully compatible with the directory structure being output.

However since most platforms support directory indexes it makes sense to change this default in the future.

This PR adds `exportTrailingSlash` as experimental flag. We'll try this out for a bit on nextjs.org / zeit.co/docs before introducing it as new option.

The default value is `true` as this is the current behavior in stable Next.js.

```
{
  experimental: {
    exportTrailingSlash: false
  }
}
```

⚠️ as with all experimental flags being added this is subject to breaking between canary/stable versions.
2019-03-17 00:54:58 +01:00
JJ Kasper
c81bd27587 Fix relative next path not working in webpack config (#6667)
* Fix relative next path not working in
webpack config

* Also add relative fix to amp path
2019-03-15 00:09:00 -04:00
Joe Haddad
d7ab018f31
Hash module IDs to save on bundle size (#6660) 2019-03-15 00:08:22 -04:00
Joe Haddad
0ae34c9a9d
Use relative instead of absolute for entry paths (#6659) 2019-03-14 21:45:50 -04:00
Joe Haddad
6902afbd3f
Stabilize Chunk ID generation (#6663)
* Add a new field to webpack types

* Revert "Add a new field to webpack types"

This reverts commit d35fa02207fbfd0085da0fc56aac42c4ff7c34c9.

* Add HashedChunkIdsPlugin to make consistent chunk ids

* Revert "Revert "Add a new field to webpack types""

This reverts commit 338219049e1432038f90c91928b010bbb1267999.

* Make it optional

* Remove record ids

* Revert "Remove record ids"

This reverts commit 15c22dbcda72466c382397c91d02295620f62326.
2019-03-14 21:38:57 -04:00
Connor Davis
b73abc0a4b Delete using realpath in HMR cache (#6635)
This will allow symlinked assets to be removed from the cache as well

Fixes: #5620
2019-03-15 00:22:57 +01:00
Joe Haddad
1fb1b75216
Ensure all modules are identified (#6656)
* Ensure all modules are identified

* Extend a webpack Plugin

Co-Authored-By: Timer <timer150@gmail.com>
2019-03-14 11:04:08 -04:00
Joe Haddad
e5636dcdb0
Inject the build ID after webpack runs (#6618)
* Inject the build ID after webpack runs

* add webpack sources types

* use webpack plugin instead

* reset file

* Skip source maps if none were provided

Co-Authored-By: Timer <timer150@gmail.com>
2019-03-12 16:39:44 -04:00
Tim Neutkens
8cf6ef58f0
Remove unused dev option from babel-loader (#6624) 2019-03-12 15:19:08 +01:00
Joe Haddad
2e32aa8630
Ensure correct key order (#6616)
* Ensure correct key order

* Fix bug

* Format this document while we're at it
2019-03-12 00:01:50 -04:00
JJ Kasper
179d09e8e0
Remove cacheKeys in favor of simply a cacheKey (#6613) 2019-03-11 22:32:26 -05:00