1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
Commit graph

411 commits

Author SHA1 Message Date
Maciej Kasprzyk a3aa870b74 feat: error when exported path has no backslash (#3456) 2017-12-14 13:22:04 -08:00
Tyll Weiß 702dd5d3f4 Resolve the next.config.js up the tree to avoid it not being loaded when a source dir was specified via the CLI - solves #3379 (#3380) 2017-12-13 18:49:26 -08:00
Tim Neutkens 52ccc14059 Merge branch 'canary'
# Conflicts:
#	examples/with-markdown/readme.md
#	lib/page-loader.js
#	package.json
#	server/build/plugins/pages-plugin.js
2017-12-08 15:11:37 -08:00
Tim Neutkens 66e3a6c5ea Remove webpack-stats.json 2017-12-08 14:42:39 -08:00
PrudviGali bd20deb9ba dynamic imports fix for non-webpack environments. (#3414)
* Added condition to check whether method exists or not

* Conditional loop based on feature detection

* Added code comments as requested by the author
2017-12-07 17:50:38 -08:00
Patryk 732696e840 Add a charset to the default Content-Type (#3333) 2017-12-05 16:00:58 -08:00
Tim Neutkens e2bcb039cf
Add .jsx extension support (#3376)
* Add .jsx extension

* examples: add create-next-app (#3377)

* examples: add create-next-app

* fix with-typescript readme

* Upgrading with-flow example to the latest flow-bin ver. 0.59.0 (#3337)

For upgrading I used flow-upgrade module by https://yarnpkg.com/en/package/flow-upgrade

* doc'd fs-routing option & added note on `passHref` (#3384)

2 changes:

`passHref` - just added a cautionary note on the importance of `passHref`. We had a few days of no-href links on our site b/c we used a custom component instead of a raw `<a>` tag,  and Google bot wasn't crawling our links (confirmed in Google cache). Hurt our SEO a bit, so I thought it was worth noting.


`useFileSystemPublicRoutes` - this is mentioned in https://github.com/zeit/next.js/pull/914 , but it doesn't appear any doc was actually added. We use `next-routes`, and we were serving all the files in `/pages/` in addition to their route patterns (ie duplicate content), which can be a pain w/ SEO and duplicate content.

* fix typo in readme.md (#3385)

* Upgrade styled-jsx to v2.2.1 (#3358)

* Pulled encoding to top of head (#3214)

* Remove next.d.ts to use @types/next (#3297)

* Add with-mobx-state-tree example (#3179)

* Adapt with-mobx example for with-mobx-state-tree

* Remove unnecessary lastUpdate parameter to show off snapshot

* update readme

* make other.js more closely mimic index.js

* Upgrade styled-jsx to v2.2.1

Includes some bug fixes.

* Fix linting

* Make sure import that doesn’t end in .jsx works

* Move tests

* Show error when .js and .jsx both exist

* Remove .jsx when importing from ‘path.jsx’

* Fixes

* Get .jsx resolver back

* Revert "Get .jsx resolver back"

This reverts commit 6f76712caa400e6f41a6a32ff80189a95b194cce.

* Revert "Revert "Get .jsx resolver back""

This reverts commit 69e592e86e53f28d0e1f78009196b76f2f831866.

* Add remove .jsx to preset

* Remove jsx resolver

* Revert "Remove jsx resolver"

This reverts commit 5e3ef1aca134de47657d91485809cd801e13329f.

* Revert "Revert "Remove jsx resolver""

This reverts commit 8248e5066cff1c7e33dac2e5a88ffe6856e3fc4e.

* Revert "Revert "Revert "Remove jsx resolver"""

This reverts commit 2a6d418a227ea4e59874b0374628ef497e527c52.

* Make 1 component not use .jsx
2017-12-05 15:46:06 -08:00
Arunoda Susiripala 820e3ff716
Always load pages with ".js" extension (#3393)
* Always fetch pages with '.js' extention from client side.

* Load error page always from _error.js rather _error/index.js

* Load pages from page.js instead of page/index.js from the client for static exports.

* Update index.js

* Simplify the path re-write logic in the webpack pages-plugin.
2017-12-05 04:49:53 +05:30
Giuseppe 5daafa4f87 Upgrade styled-jsx to v2.2.1 (#3358)
* Pulled encoding to top of head (#3214)

* Remove next.d.ts to use @types/next (#3297)

* Add with-mobx-state-tree example (#3179)

* Adapt with-mobx example for with-mobx-state-tree

* Remove unnecessary lastUpdate parameter to show off snapshot

* update readme

* make other.js more closely mimic index.js

* Upgrade styled-jsx to v2.2.1

Includes some bug fixes.

* Fix linting
2017-12-04 08:15:30 -08:00
Tim Neutkens 36f6179a52 Check if tmpdir is writeable. Not full path 2017-12-02 09:52:34 -08:00
Tim Neutkens 8cd6bd3fc3
Add check for writeable directory (#3370)
* Add check for writeable directory

Followup of https://github.com/zeit/now-cli/issues/175

* Add link to docs
2017-12-02 18:13:39 +01:00
Roman Vanesyan 01f05d8cbc Another round of removing extra <div> (#3373) 2017-12-02 18:00:40 +01:00
Adam Stankiewicz eefab8fb3e Disable comparisons to fix mapbox-gl bundling (#3346) 2017-11-28 14:19:14 +01:00
Roman Vanesyan 7a08e1b5f8 Remove extra div (#3327)
* Replace extra div with React fragment.

* Fix linter

* Replace extra div with React fragment.

* Fix linter

* fix script tag, backport nonce attribute
2017-11-23 22:12:52 +01:00
Saro Vindigni 8eb8034236 remove relative path to babel-runtime (#3119) 2017-11-23 14:02:09 +01:00
yashha a0e0f851c2 Pulled encoding to top of head (#3214) 2017-11-16 11:54:36 +01:00
Jess Telford 80a1603189 Use uglify-es for minification (#3150) 2017-11-13 12:19:51 +01:00
Isaac Ellmen dc07cd1b19 Set Cache-Control max-age to a year (#3247) 2017-11-09 21:27:01 +01:00
Mattias Hällkvist 3eac0bc35d Make pages glob pattern overridable (#3195) 2017-11-05 22:27:31 +01:00
Tim Neutkens 1424b84c98
Allow overriding Content-Type (#3242)
* Allow overriding Content-Type

* Mock getHeader
2017-11-05 20:17:03 +01:00
Sam Gluck 828dac7d61 Use fs.realpath to get actual project directory (#3243)
* resolve base dir symlink

* fix method name
2017-11-05 20:05:15 +01:00
Tim Neutkens 18f8ab392a Merge branch 'master' into canary
# Conflicts:
#	examples/with-apollo/lib/initApollo.js
#	examples/with-apollo/package.json
#	examples/with-react-with-styles/package.json
#	examples/with-static-export/package.json
#	package.json
2017-11-05 11:01:59 +01:00
Li Weinan 190853b4ff Support de-deduping head tags by setting key (#3170)
* Support de-deduping head tags by setting key

* move dedupe logic to `unique` function

* fix head tag deduping logic

* remove console.log

* use `toContain` assertions

* update de-duping head tags section in README
2017-10-31 22:52:51 +01:00
Kevin Decker 6e44cdef5f Expose mechanism to monitor render events (#2655)
* Allow custom clientBootstrap entrypoint

This allows for customization of the client global bootstrap.

* Expose render event emitter to client

* Include client entry point in npm package
2017-10-30 16:01:40 +01:00
Kevin Decker 53a2c5a7fc Combine source maps (#3178)
* Propagate source maps through combine assets step

* Use constant development build id

* Move combine assets step before uglify step

This ensures that uglify will catch these changes.

* Move dynamic chunks step before uglify step

This ensures that uglify will catch these changes.

* Use chunk templates for page and dynamic chunks

This is a little more in line with how webpack generates its bootstrap and should have better compatibility with other plugins and source map generation.

* Register combined source map with chunks

This ensures that a sourcemap is fully generated.

* Do not minimize combined map inputs
2017-10-30 15:57:35 +01:00
Kevin Decker 1e15105837 Output webpack build stats as webpack-stats.json (#2828) 2017-10-30 15:55:44 +01:00
Tim Neutkens 03324880a8 Add asPath on the server (#3149)
* Add asPath on the server

* Make sure we don’t include `?` when there is no query
2017-10-22 12:00:31 -07:00
Tim Neutkens 8e55adf4ec Render error as errorHtml (#3142) 2017-10-21 16:47:55 -07:00
Tim Neutkens 1cc3dbe35b Revert "Sourcemap and Breakpoint Fixes (#3121)"
This reverts commit 964f229f98.
2017-10-20 08:02:04 +02:00
Kevin Decker 964f229f98 Sourcemap and Breakpoint Fixes (#3121)
* Propagate source maps through combine assets step

* Use constant development build id
2017-10-19 22:11:37 +02:00
Dylan Staley f1f83507db Use nonce attribute for inline script if provided (#3129) 2017-10-19 21:30:34 +02:00
Tim Neutkens e9d14613d4 Make styled-jsx configurable (#3050)
* Make styled-jsx configurable

* Add styled-jsx-plugin-postcss example

* Add styled-jsx 2.1.0 with plugins support

* Move examples around and add description

* Add link to new example
2017-10-15 19:54:57 +02:00
Arunoda Susiripala 0c8dca6f97 Warn and exit if React 15 used inside the project. (#3061)
This usually helps when upgrading Next.js.
2017-10-09 13:25:12 -07:00
Tom MacWright 559c25253e Configurable opts for babel-preset-env + babel-plugin-transform-runtime (#2991)
* Configurable opts for babel-preset-env + babel-plugin-transform-runtime

This adds `preset-env` and `transform-runtime` options to the
`next/babel` Babel preset, which are then passed through to those
presets and transforms. This allows configuration to keep next.js
from the default 'maximum' transform, and instead use built-in
implementations of globals, classes, async, and other commonly-supported
features.

Fixes #2989

* Use spread notation instead of Object.assign
2017-10-07 08:38:59 +02:00
Jesse Ditson a79357f2a4 Allow use of filenames in exportPathMap (#2973)
* allow use of filenames in exportPathMap

* add link test and handling for file paths when flattening links for export

* add note about exporting file paths to readme.md
2017-10-05 20:33:10 +02:00
AugustinLF 36436122f2 Keep some buffered pages, that won't be disposed. Fix #1939 (#2592)
* Keep some buffered pages, that won't be disposed. Fix #1939

* With reworked buffer
2017-09-28 14:51:03 +02:00
Craig Mulligan a50e440cf1 Pass conf to export function (#2962)
* Pass conf to export function

* conf -> configuration
2017-09-27 20:48:46 +02:00
Marc MacLeod ddd30787ef expose buildId to custom webpack configs (#3001)
* expose buildId to custom webpack configs

* update readme to include buildId in option object
2017-09-27 08:03:29 +02:00
Mic Wehrle 27f517d27d Fix error messages in server/export.js (#2933) 2017-09-10 13:13:48 +02:00
Kevin Decker 5c67fd6811 Do not mutate browser source map object (#2900)
Fixes regression caused by #2478
2017-09-04 20:27:19 +02:00
Arunoda Susiripala 8f874f050c [WIP] Use buildId in chunk urls as well (#2873)
Use buildId in chunk urls as well
2017-08-31 05:47:06 +05:30
Kevin Decker d600957aeb Add node trace source map handling in dev mode (#2816)
* Add node trace source map handling in dev mode

Fixes #2285

* Fix typo in comment
2017-08-30 16:19:40 +05:30
Tim Neutkens eba9ebef5f Merge v3-beta into master (#2809)
* Add examples/with-redux-code-splitting. (#2721)

* #1757 Relay Modern Example (#2696)

* Add ReasonML example (#2640)

* Add ReasonML example

* Add a gitignore specifically for the reasonml example

* Allow custom className for <Main /> (#2802)

* 3.0.2

* Remove beta information from the README.

* 3.0.3

* Remove unnecessary lookup in example with emotion (#2731)

* Document SCSS/Less (#2742)

* Document SCSS/Less

* Add missing word

* Add docs for examples dir

* Add extra example

* uppercase J

* Add with pkg example (#2751)

* Add custom server micro example (#2750)

* Ease running multiple examples at the same time with process.env.PORT (#2753)

* Add line-height rule for error page h2 (#2761)

* Add support for fetching multiple translation files (#2743)

* Add support for fetching multiple translation files

* Cleanup

* Clear missed interval (#2611)

* clear missed interval

* remove trailing whitespace

* Relay Modern Example (#1757) (#2773)

* Simplification of Relay Modern Example (#1757) (#2776)

* Use deterministic names for dynamic import (#2788)

* Always use the same name for the same dynamic import.

* Add unit tests for the modulePath generation.

* Allow tests to run correctly on Windows.

* Make the chunk name a bit pretty.

* Fix tests to run on Windows.

* 3.0.4

* Revert "Make the chunk name a bit pretty." (#2792)

This reverts commit 0c9e8cf2271955e74ab9f752b5869b98c1dc60f9.

* 3.0.5

* Use _ as the divider for dynamic import name splitter. (#2793)

Using - gives us some weird webpack errors.

* 3.0.6

* next/dynamic Error Message Tweaks (#2798)

* Fixed issue (#2804)

https://github.com/zeit/next.js/issues/2800

* docs(material-ui): move the source code to Material-UI repository (#2808)
2017-08-27 22:13:35 +02:00
Tim Neutkens 75a43f5a71 Make sure we do not expose stacktraces in production (#2843) 2017-08-25 02:47:38 +05:30
Jay Cheroske 9c18c548bb Pass an HOC to renderPage() (#2010)
* Added passing an HOC to renderPage()

* Remove gitignore
2017-08-21 23:15:14 +02:00
Arunoda Susiripala a730b04df7 Use _ as the divider for dynamic import name splitter. (#2793)
Using - gives us some weird webpack errors.
2017-08-17 02:25:27 +05:30
Arunoda Susiripala ddff22c0d3 Revert "Make the chunk name a bit pretty." (#2792)
This reverts commit 0c9e8cf2271955e74ab9f752b5869b98c1dc60f9.
2017-08-17 00:28:30 +05:30
Arunoda Susiripala 68738d1c90 Use deterministic names for dynamic import (#2788)
* Always use the same name for the same dynamic import.

* Add unit tests for the modulePath generation.

* Allow tests to run correctly on Windows.

* Make the chunk name a bit pretty.

* Fix tests to run on Windows.
2017-08-16 22:44:00 +05:30
Arunoda Susiripala 6477492f62 Move NPM modules out of the commons chunk in dev mode. (#2716)
This is only a dev feature and it removes an error in HMR.
Otherwise it'll throw an error with undefined error in the webpack core.
2017-08-07 12:36:24 +05:30
崔宁 67697afa44 Remove the extra plugin (#2670) 2017-07-28 10:45:04 +05:30
Arunoda Susiripala 10241fe610 Fix the route redirect error when we've multiple path params. (#2652)
For an example, with a URL like: /static/data/hello.txt
2017-07-26 22:31:49 +05:30
Arunoda Susiripala 564dbdd237 Add a test case to prevent issue #2617 to happen again. 2017-07-24 11:43:45 +05:30
Arunoda Susiripala 7965cb299d Merge master into v3-beta. 2017-07-24 10:10:29 +05:30
Arunoda Susiripala c03c86ee5e Make sure /static/ and /_next/ are valid internal urls. (#2631) 2017-07-24 10:04:06 +05:30
Tim Neutkens 2c7d0ec47a Uppercase location for consistency (#2622) 2017-07-23 19:50:48 +02:00
Arunoda Susiripala 2f7e459210 Make dynamic import spec compliant. (#2612)
* Make dynamic import spec compliant.
Now we simply return the whole module incl. default field
In 'next/dynamic' we pick the default field if there is.
Since modules with default is mostly used next/dynamic, for the enduser, this change has no effect.

* Rename module into m
Using module could be confusing.
2017-07-20 23:21:04 +05:30
Arunoda Susiripala c97aca50e5 Show webpack errors in all pages. (#2588)
* Show webpack errors in all pages.
When there's a webpack error that means HMR failed too.
So, showing other pages won't makes sense since user
can't edit them and get changes via HMR.
That's why now we show the error on all pages.

* Remove exact propType checks from the error component.
When there's an error, something this check shows in the console.
That means it could accept more props.
Also this is not a public API. So, we don't want to do propType checks.
2017-07-18 12:30:23 +05:30
Arunoda Susiripala d831e6d39c Webpack's ModuleConcatenationPlugin plugin doesn't work well with HMR. (#2584)
So, now we only use it for production.
2017-07-17 22:16:39 +05:30
Arunoda Susiripala af7b875a18 Make sure module.context exist always (#2580)
Fixes #2578
2017-07-17 11:11:37 +05:30
Arunoda Susiripala b1b0b88945 Move react-dom into commons.js always. (#2572) 2017-07-16 15:48:21 +05:30
Arunoda Susiripala f25055c9f7 Load the hot-reloader when only needed. (#2566)
This reduce the server boot-up time a lot.
With a 2015 MacBook Pro, it went down from 1000ms to 200ms
2017-07-15 18:29:10 +08:00
Kevin Decker bd24e74a98 Support webpack harmony modules in self accept (#2510) 2017-07-10 10:10:32 +05:30
Arunoda Susiripala 783ecdefd2 Merge branch 'master' into v3-beta 2017-07-09 09:57:56 +05:30
fridays 9cc8d26a68 fix regex for pages that end with index (#2505) 2017-07-09 09:50:30 +05:30
Arunoda Susiripala 4563f68ad5 Revert "Emit ES6 code for module source in emit file load" (#2501)
* Revert "Update emotion example to use css instead of fragment (#2497)"

This reverts commit 5bd3a5f1d1.

* Revert "Fix "Deploy to now" link (#2489)"

This reverts commit df1cd7ebf3.

* Revert "Emit ES6 code for module source in emit file load (#2478)"

This reverts commit 3f50abcb51.
2017-07-08 11:07:17 +05:30
Kevin Decker 3f50abcb51 Emit ES6 code for module source in emit file load (#2478)
Previously the commonjs modules were being passed into webpack dependency layer, preventing tree shaking.
2017-07-07 09:48:00 +05:30
Arunoda Susiripala 1c7b2603d4 Block special pages from the public. (#2479)
Otherwise, users could invoke 500 errors.
2017-07-06 17:59:25 +05:30
Arunoda Susiripala c5c270c576 Merge master into v3-beta. 2017-07-06 12:24:31 +05:30
Kyle Kelley 5a840cc39e allow cleaning from non-cwd (#2451) 2017-07-05 10:49:35 +05:30
Arunoda Susiripala 9395718ee1 Consider using distDir config for dynamic chunks. (#2436) 2017-07-02 11:23:15 +05:30
Tim Neutkens c8e8cb5e52 Check if parsedUrl is an object (#2066) 2017-07-02 11:22:39 +05:30
Arunoda Susiripala 304225d9ea Optimize the bundle size of Next.js core (#2422)
* Try to the slim the webpack output.

* Remove react-hot-loader completely from production.
2017-07-01 12:54:16 +05:30
Ian Mitchell ac3c59b9f4 Removes Windows Webpack Polling (#2359) 2017-06-30 12:20:18 +05:30
Arunoda Susiripala 247dd98cf3 Add a better filename to the dynamic import chunk. (#2397)
With this we can see the import name in the filename.
This helps a lot in debugging and analyzing the webpack
bundle.
2017-06-29 05:55:13 +05:30
Arunoda Susiripala 655018c0e7 Merge master into v3-beta 2017-06-29 00:51:05 +05:30
Arunoda Susiripala 23c2f02f56 Make it easy and meaningful to analyze the bundle. (#2393) 2017-06-29 00:46:21 +05:30
Xuezheng Ma 4eb86dc5f8 Added proper error for running next start on dev build (#2337)
* Added proper error for running `next start` on dev build

* Check if build exist before usage

* Move BUILD_ID check from bin/next-start to server/index.js

* Check env before checking build
2017-06-26 22:18:56 +02:00
Dan Zajdband 87e01f681b Fix #2353 - server render parameters (#2356) 2017-06-24 04:38:05 +05:30
C. T. Lin 213d7a82d1 update webpack to v3 (#2349)
* update webpack to v3

* Use exact versions.
2017-06-23 10:44:40 +05:30
Felix-Antoine Paradis d2149da54d Add the ability to pass next configuration to production builds (#2345) 2017-06-23 09:18:06 +05:30
Sasha Aickin 9c2db29166 Fixed an issue where two-page sites didn't split code. (#2329) 2017-06-21 09:57:24 +05:30
Arunoda Susiripala fe77397f26 Make sure internal url always has 200 status code. (#2299)
Even the user set it to something else via custom server api.
2017-06-19 12:57:35 +05:30
Arunoda Susiripala 0c4362e440 Load chunks in SSR mode only if they exists in the filesystem (#2196)
* Always check with the fs when gettings chunks.

* Add a new set of test cases for dynamic imports in dev.

* Add dynamic import test cases for production.

* Add availableChunks support for static exports.
2017-06-08 19:41:22 +02:00
Henrik 9c1898f2c8 Allow custom head attributes (#2189)
* fix(package): update babel-preset-env to version 1.5.2

* Allow Custom head attributes

This PR allows to add static attributes to the `document/head
2017-06-08 19:27:54 +02:00
David Corwin ca9146c421 support custom build directory in next export (#2135)
* use custom build directory instead of .next if specified, helpful log messages.

* Remove some unwanted newlines.
2017-06-08 07:09:45 +05:30
Arunoda Susiripala 13a51e0a75 Merge master into v3-beta. 2017-06-07 11:43:05 +05:30
Arunoda Susiripala 7cd2bb69ea Squashed commit of the following:
commit ced48c3fcfd1880016b08590e1b50827247b7cfb
Author: Arunoda Susiripala <arunoda.susiripala@gmail.com>
Date:   Wed Jun 7 11:28:43 2017 +0530

    Make sure XSS fix doesn't break our 404 support.

commit d40c833aa16660d547df785bb52e69ecf9a717f2
Author: Arunoda Susiripala <arunoda.susiripala@gmail.com>
Date:   Wed Jun 7 09:08:41 2017 +0530

    Prevent url path based XSS attacks.
2017-06-07 11:37:28 +05:30
Arunoda Susiripala 8cb3e89455 Merge master into v3-beta. 2017-06-07 04:24:36 +05:30
Arunoda Susiripala 937d0e2bb6 [WIP] Reload webpack if needed (#2076)
* Reload webpack via hot-reloader when needed.
We need to do this specially we removed a previosly
built page from the filesystem.

* Make sure reloading is happen only once

* Reload only if there's a missing page error.

* Remove debug logs.

* 2.4.2

* Refactor the codebase a bit.

* Move some commonly used regexp to a utils module.

* Handle the reloading well when there's a custom error page.

* Add a HMR test case.

* Close the browser in the test case.
2017-06-06 15:32:02 -07:00
Arunoda Susiripala 0191d2eb1b Merge branch 'master' into v3-beta 2017-06-05 20:39:07 +05:30
Arunoda Susiripala 24f511f343 When detecting changed pages in hot-reloader use only pages. (#2171) 2017-06-05 20:37:20 +05:30
Arunoda Susiripala f342624f14 Merge master with v3-beta 2017-06-05 15:19:33 +05:30
Arunoda Susiripala 443abba94a Fix HMR http request timeout issue under node 8. (#2166)
The fix is to add a heartbeat less than 5 secs.
2017-06-05 11:02:13 +02:00
Guillermo Rauch 850a931e88 Merge branch 'master' into v3-beta 2017-06-01 18:30:57 -07:00
Arunoda Susiripala 43c447edd0 Implement the fix. 2017-06-01 05:46:32 +05:30
Felix-Antoine Paradis 442c611d49 Add next configuration as an option for custom servers (#2058)
* Add a configuration parameter to custom server startup

* Adding related documentation

* Do not access filesystem if configuration is supplied

* Make the configuration log clearer

* Make the conf default value to `null`
2017-05-31 13:36:07 +05:30
George Pantazis 2953a01c43 Make file-system based routes optional for custom servers (#914) 2017-05-27 21:10:15 +05:30
Arunoda Susiripala 9121a9d22e Never cache assets and HTML in the dev mode. (#2045)
* Never cache assets and HTML in the dev mode.

* Move etags test to the production.

Now it won't work in dev because of no-cache settings.
2017-05-25 18:28:08 +02:00
Arunoda Susiripala 3c95f21d8c Do not try to server unnessesary files in either dev or prod. (#2048) 2017-05-23 10:30:14 -07:00
Xuezheng Ma d36118ab02 Check if _document.js returns a react element before using (#2013)
* Check if _document.js returns a react element before using

* Use capital letter R in 'React'
2017-05-20 00:02:01 +02:00