Commit graph

199 commits

Author SHA1 Message Date
Luan Devecchi
23ce41e2bc
Preserve next-env.d.ts line ending (#28100)
* Preserve `next-env.d.ts` line ending

Prevent next from changing already existing line ending on
`next-env.d.ts` for no good reason

* Update comparison

Co-authored-by: Steven <steven@ceriously.com>

* Update checks and add tests

* update test

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-09-19 22:55:46 -05:00
JJ Kasper
a92a5caec2
Update test set-up to leverage playwright when able to (#28634)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-13 14:36:25 +02:00
Houssein Djirdeh
d0563127c6
[ESLint Plugin] Updates no-document-import-in-page rule to use path separators (#28768)
Context: https://github.com/vercel/next.js/pull/28745/files#r701418932
2021-09-03 18:51:21 +00:00
Steven
9bbba98c01
Fix next lint no-document-import-in-page on Windows (#28745)
Fixes #28596
2021-09-02 20:51:22 +00:00
Prateek Bhatnagar
7c29a262e1
Bug fix for lint rule (#28677) 2021-09-02 10:45:27 +02:00
Rahul Gaba
c21cbdf899
Fix for next-script-for-ga ESLint rule crashing when a method is used in dangerouslySetInnerHTML (#28675)
Fixes #28635



## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2021-08-31 20:23:21 +00:00
Houssein Djirdeh
9442925f50
handle edge case for no-import-document rule (#28261)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-08-25 13:30:49 -05:00
JJ Kasper
005b13f1ac
Move unit tests to one folder and migrate them to TypeScript (#28427)
* Move unit tests to one folder

* Migrate unit tests to TypeScript

* add test types to lint

* Ensure ts(x) tests are run with util

* Add tsx extension to jest config

* bump
2021-08-24 07:52:45 -05:00
Jiachi Liu
d14da39fd6
Support suspense in next dynamic (#27611)
### Changes
#### Feature
* Adopt `React.lazy` into `next/dynamic`, enable it when `options.suspense` is `true`
* Support `next/dynamic` with `suspense=true` in SSR and SSG

#### Tests

| Scenario | Case | Behavior |
|:----:|:----:|:----:|
| basics | react 17 or 18 by default | dev/build error or pass |
| blocking rendering | `reactRoot: true` + `concurrentFeatures: false` | dev/build pass |
| concurrent rendering | `reactRoot: true` + `concurrentFeatures: true` | dev/build pass | 


## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`
2021-08-13 21:08:45 +00:00
Gerald Monaco
79e30f9cb6
More React 17 clean up (#26775)
Remove unnecessary `React.Suspense` checks, as the minimum supported version is `react@>=17.0.1`. Also removes some files from the `react-18` integration test that are no longer necessary as of #26664.
2021-08-02 19:14:31 +00:00
Maia Teegarden
4172a4c0a6
Add initial next swc package with first transform (#27355)
* Set up next-swc package with no custom transforms

* Add hook_optimizer transform

* Fix lint

* Build next-swc on CI

* Add toolchain in rust action

* Build binaries in manual workflow

* Commit from GitHub Actions (Build next-swc native binaries)

* Update dependencies

* Update swc and use stable rust

* Build next-swc binaries

* Test compiled code

* Dedupe @node-rs/helper

* Add workflow to check next-swc binaries

* Fix check native

* PR feedback

* PR feedback

* Pr feedback

* Build next-swc binaries

* Combine native workflows

* Add docs for contributors on less common platforms

* PR feedback

* Compare JsWord instead of converting to string

* Fix workflow formatting

* Add docs for building binaries for CI

* Build next-swc binaries

* Fix workflow if syntax

* Add license info to copied code

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-07-27 17:07:28 +02:00
Artur Muller
c88898be12
Clarify error message in isSerializableProps (#22856)
I recently received the "Props must be returned as a plain object" error when I accidentally dropped an array directly inside `props`. This is a trivial error to fix once you know what you did, but I spent good 30 minutes looking in all the wrong places. I hope that this slight clarification in the error message would save someone from wasting their time if they make a similar mistake like myself.
2021-07-25 06:08:30 +00:00
Tim Neutkens
5b9ad8da90
Move next-server directory files to server directory (#26756)
* Move next-server directory files to server directory

* Update tests

* Update paths in other places
2021-06-30 13:44:40 +02:00
Tim Neutkens
136b754396
Move code shared between server/client to "shared" folder (#26734) 2021-06-30 11:43:31 +02:00
Jiachi Liu
c5751fa6c3
fix: next dynamic with jest (#26614)
Fixes #19862

Avoid executing `webpack` property on `loadableGenerated` of loadable component compiled from `next/dynamic` when `require.resolveWeak` is unavailable due to jest runtime missing `require.resolveWeak`.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] unit tests added
2021-06-28 13:23:14 +00:00
Gerald Monaco
1f09a78eba
Fix react@next and react@experimental tests (#26088) 2021-06-14 14:40:15 -05:00
Tim Neutkens
c1528e4f3d
Remove experimental-modern-preset option (#25100) 2021-05-14 15:55:24 +02:00
JJ Kasper
9d25194e7d
Ensure next/dynamic transpiles for tests (#24751)
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2021-05-07 19:21:54 +02:00
Joe Haddad
079c629165
experimental: remove legacy plugin system (#20759)
* chore: remove old plugins implementation

* chore: remove `onErrorMiddleware`

* Reduce allowed middleware

* remove collect plugins file

* remove old tests

* remove old demo packages
2021-04-22 14:03:13 -05:00
Tim Neutkens
b34a0c98fa
Update err.sh links to use nextjs.org/docs/messages instead (#23353) 2021-03-29 10:25:00 +02:00
Bruno Crosier
48dd9954d8
Add fallback for <Image /> component when JavaScript is disabled in browser (#19052)
The current `<Image />` component does not fallback gracefully when JavaScript is disabled in the client / browser.

You can test this with the [official Next/Image example](https://csb-4k0kr-p8ya8f304.vercel.app/), by disabling JavaScript in the browser's DevTools. Video demo: https://streamable.com/frkvw9

This PR aims to fix this behaviour by using `<noscript></noscript>` tags to conditionally display a standard `<img>` element using the `props` passed to `<Image />` when JavaScript is disabled.

For browser sessions where JavaScript is enabled, this will not cause an increase in network requests, so there should be no downside.

One area where this PR is a bit "hacky" is that it uses a negative `margin-top` to counteract `sizerStyle.paddingTop`. From what I can tell, `sizerStyle.paddingTop` is generated on the server side, where we can not know ahead of time whether JavaScript is enabled in the browser - hence why I've opted for this solution. 

Fixes #19223
Fixes #21214
2021-03-23 19:25:00 +00:00
Joe Haddad
5f41abda9a
fix(link): cancel idle callback on unmount (#22072)
Co-authored-by: mAAdhaTTah <jamesorodig@gmail.com>
2021-02-11 13:51:41 -05:00
Jaon
e1fe28c849
Fix and add test filterModuleRules for next-plugin-storybook (#17306)
I tried the preset provided at `packages/next-plugin-storybook` but it was raising error due to an [unsafe negation](https://eslint.org/docs/rules/no-unsafe-negation) in the `preset.js` file.

I added a test to show the error:
```
● next-plugin-storybook filterModuleRules › should filter module rules correctly

    TypeError: rule.test.test is not a function

      48 |       if (!rule.test instanceof RegExp) return true
      49 |       // use Next.js' built-in CSS
    > 50 |       if (rule.test.test('hello.css')) {
         |                     ^
      51 |         return false
      52 |       }
      53 |       // use next-babel-loader instead of storybook's babel-loader

      at filter (../packages/next-plugin-storybook/preset.js:50:21)
          at Array.filter (<anonymous>)
      at Object.filterModuleRules (../packages/next-plugin-storybook/preset.js:46:28)
      at Object.<anonymous> (unit/webpack-config-overrides.test.js:12:36)
```
2021-01-26 19:28:41 +00:00
Joe Haddad
58ea3bb479
fix(next/babel): read env from caller, not process (#20679)
This PR fixes a bug where `next/babel` would accidentally enable development transforms for a production build (`next build`).

This is tested by the two updated unit tests (which removed a workaround for this bug, and one now properly enables dev transforms).

---

Fixes #18929
Fixes #19001
x-ref #19046
x-ref #17032
2021-01-02 00:36:16 +00:00
Tim Neutkens
5c5108fe0d
Add profiling to webpack loaders (#20392)
Follow-up to #20357 with additional tracers.
2020-12-29 21:21:35 +00:00
Joe Haddad
61e7dea918
deps: upgrade various deps (mainly babel) (#20586)
Fixes #20585
Closes #20406 as it duplicates Babel dependencies
Closes #18926 as it's outdated
2020-12-29 20:10:08 +00:00
Guy Bedford
9dd5ff2baa
fix: Revert #18921 and inline absolute babel runtime only for YarnPnp (#19542)
This reverts #18921 and ensures that the Babel runtime is only inlined as an absolute path when using PnP as before, but then including the correction this resolution as implemented by @merceyz only in the PnP cases, while keeping the diff to a minimum.
2020-11-25 22:28:39 +00:00
Joe Haddad
30c2dfdc47
Remove old modern mode experiment (#19275)
This PR removes the modern mode experiment because:

- It does not yield meaningful bundle size wins when compared to other initiatives we've taken
- It's not compatible with webpack 5 (which we're upgrading to)
- It's currently broken and causes most apps to malfunction
- There's no champion currently owning the experiment

We can re-introduce this in the future when we'd like to make it a default for all Next.js apps.

Note: **Next.js still supports Differential Loading (`nomodule`) and does it by default.** This PR strictly removes the experimental modern _syntax_, and does not disable our existing modern/legacy polyfilling.

---

Fixes #19200
Fixes #18960
Fixes #14707
Fixes #14465
2020-11-18 18:30:00 +00:00
Joe Haddad
415d7fd75e
Respect next/babel user provided runtime option (#19136) 2020-11-13 02:41:54 -05:00
Steven
5562daf7a1
Fallback to default config to enable testing Image component (#19107)
Fixes #18415 by using the default config as fallback.

Users who wish to use their `next.config.js` values will still need the workaround from https://github.com/vercel/next.js/issues/18415#issuecomment-718180659
2020-11-12 19:24:08 +00:00
Anton Rieder
62633b1af5
Fix grammar in isSerializableProps (#19072)
I believe this should read ["altogether"](https://www.merriam-webster.com/dictionary/altogether) not "all together".
2020-11-12 16:07:14 +00:00
Kristoffer K
d40d7d6562
fix(next): resolve absolute path to @babel/runtime (#18921)
**What's the problem this PR addresses?**

https://github.com/vercel/next.js/pull/18768 started to ncc `@babel/plugin-transform-runtime` which broke its Yarn PnP support since the version of `resolve` it uses can't be patched by Yarn.

Fixes https://github.com/yarnpkg/berry/runs/1359235077?check_suite_focus=true#step:5:79

cc @guybedford

**How did you fix it?**

Resolve the absolute path to `@babel/runtime` so it doesn't have to go through `resolve`

---

Fixes https://github.com/vercel/next.js/issues/19026
2020-11-11 15:18:33 +00:00
JJ Kasper
18494fe3fb
Break-up unit tests to separate step (#18992) 2020-11-10 12:25:50 -05:00
tolfino
bbde18f120
Fix false positive in isSerializable with shared references in arrays (#18232)
This replaces the seen set with a newly instantiated map of refs per
value in the array. This corrects the behavior that the refs map passed
into isSerializable contains only values along the path to the current
value: previously, because the refs map was shared among all values in
the array, this would trigger on instances such as:

```js
    const x = [];
    isSerializableProps('/', 'test', { arr: [x, [x]] });
```

... where the reference is shared but there is no cycle formed, as the
presence of elements is disjoint.

Fixes #18228.
2020-11-09 14:25:41 +00:00
Cowboy Ho
28e12876b8
Fix router not working on some protocol (#16650)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-11-03 16:18:02 -05:00
Markus Lautenbach
76e86e0fba
Remove false positive in circular structure detection (#16380)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-09-12 02:36:29 -04:00
Joe Haddad
754ec6642a
Run Fast Refresh Loader in Babel Loader (#15851)
Next.js plugins like `@next/mdx` inject additional webpack loaders to compile files, but they omit the necessary loader for Fast Refresh to work.

Instead of making these files deopt out of Fast Refresh, we can automatically detect and inject the loader in these cases.

Fixes #13574
2020-08-04 21:24:56 +00:00
JJ Kasper
86ba29f654
Make sure link can render without router (#15604)
This ensures rendering `next/link` doesn't fail without being nested under the router context.

Closes: https://github.com/vercel/next.js/issues/15543
2020-07-29 06:56:33 +00:00
Necmettin Karakaya
c2f38f2af0
[Fix] common misspelling errors (#15288)
For reference: https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
2020-07-19 04:38:20 +00:00
Joe Haddad
ea1f45a388
Add no-anon-default-export Babel lint rule (#14519)
Fixes #12291 

![image](https://user-images.githubusercontent.com/616428/85499698-176b4900-b5b0-11ea-8a5d-a7f0b4c20307.png)
2020-06-30 13:05:29 +00:00
JJ Kasper
5bb081f13f
Handle rendering next/head outside of Next.js (#14511)
This ensures `next/head` doesn't fail to render when being rendered during tests or outside of Next.js' tree

Closes: https://github.com/vercel/next.js/issues/14425
2020-06-23 20:46:40 +00:00
JJ Kasper
08d7755e68
Update routeKeys to handle non-word characters (#12801)
This updates the named regexes output in the `routes-manifest` and the associated `routeKeys` to not use any non-word characters as this breaks the named regexes e.g. `"Invalid regular expression: "^/(?<data\-provider\-id>[^/]+?)(?:/)?$"`

x-ref: https://github.com/zeit/now/pull/4355
2020-06-16 13:49:13 +00:00
Todor Totev
1c91a46c3c
Fix message on getStaticPaths conflict with getServerSideProps (#13874)
* initial

* Update tests

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-06-08 10:25:37 -04:00
Joe Haddad
a7ae54d7cc
refactor(typescript): extract preflight functions (#13510)
This pull request refactors our TypeScript preflight check in preparation for dropping the `fork-ts-checker-webpack-plugin` plugin.

This will make reviewing the subsequent PR much easier.

---

There is no behavior change, so the existing test should cover this adequately.
2020-05-28 23:39:46 +00:00
Joe Haddad
b7e17e09e5
Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
Joe Haddad
74d7e3585c
Eliminate array destructuring assignment (#13151)
While we're at it, we should fix this too.

x-ref: #13144
2020-05-20 17:13:31 +00:00
Joe Haddad
92a159d939
Correctly eliminate destructuring assignment (#13144)
This eliminates code referenced via destructuring assignment, as reported by @styfle.
2020-05-20 15:57:18 +00:00
Joe Haddad
86160a5190
Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
Jan Potoms
714747957a
Add eslint-plugin-jest (#13003) 2020-05-18 13:16:07 -04:00
Mario Pareja
5af38f1727
fix crash when NODE_OPTIONS includes --inspect-port (#12555) 2020-05-18 13:14:41 -04:00
Jan Potoms
f8125c9ed7
[Experimental] Implement optional catch all routes (#12887) 2020-05-18 09:47:13 -04:00
Joe Haddad
73eb9cede5
Convert test to be inline (#13022) 2020-05-17 18:30:30 -04:00
Jan Potoms
32057c849d
Use the jest-circus test runner (#12974) 2020-05-16 16:56:06 -04:00
Joe Haddad
202ea6fbd9
Support eliminating memoized functions (#12953) 2020-05-15 17:14:46 -04:00
Joe Haddad
7edc815a38
Elimination has to run before other plugins (#12949) 2020-05-15 16:51:29 -04:00
Simon Knott
be02fe183f
Allow @babel/preset-typescript to be configured (#11840)
* Allow `@babel/preset-typescript` to be configured

Some usages, e.g. [getting parameter decorators to work properly](https://github.com/WarnerHooh/babel-plugin-parameter-decorator/pull/19), require configuring `@babel/preset-typescript`.

This commit adds that functionality to `next/babel`.

* Add unit test for babel/preset allowing to pass options to @babel/preset-typescript

* Add integration test for onlyRemoveTypeImports

* Update babel dependencies

* Update to compatible typescript version and fix types

* Fix linting and run pre-nccing

* Update size-limit test

* Add additional tests

* Re-Apply delta to be calculated using -262

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-05-09 17:12:02 +02:00
Fonger
5248e182fe
fix(export): fallback to empty string for basePath (#11880)
* fix(next-server): fallback to empty string for basePath

* Revert extra change and add unit test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-04-14 19:12:02 -04:00
Joe Haddad
1e53a4961a
Correctly Count Object References (#10903)
* Correctly Count Object References

* Make error message better

* add more tests
2020-03-09 14:58:51 -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
Joe Haddad
f1d0e577e6
Add Test Case for SSG Full Re-Export (#10864) 2020-03-06 01:35:31 -05: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
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
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
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
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
Shu Uesugi
e1083f0e3a docs: remove --save from npm install; avoid system-ui (#10252)
* Minor edits for CSS doc

* Remove unnecessary --save from npm install

* Different font family

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-27 08:35:12 -05:00
Joe Haddad
2d76c4a9bb
Replace __NEXT_SPR with __N_SSG Identifier (#10090) 2020-01-14 14:40:20 -05:00
Joe Haddad
e68e50d6e6
Add More Configuration File Options (#9713) 2019-12-11 16:56:47 -05: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
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
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
05ba91d3ba
Add Additional SSG Transform Test 2019-12-05 18:08:44 -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
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
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
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
Tim Neutkens
10066aac9a Exclude cache from being deleted in dev (#9448)
* Exclude cache from being deleted in dev

* Exclude cache directory from delete

* Fix clean regex and update tests

* Remove extra param comment
2019-11-19 10:40:13 -06:00
JJ Kasper
dd990506c0 Fix recursive copy failing if more folders than concurrency (#9429)
* Fix recursive-copy function failing with more
folders than concurrency

* Make default concurrency 32 for recursive-copy
2019-11-15 13:53:59 -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
Joe Haddad
be31c707a7
Test segment-level exacts are preferred (#9408)
* Test segment-level exacts are preferred

* Add exa post check
2019-11-13 17:10:28 -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
Slobodan Mišković
8ee536df09 Fix canonical rel link generation (#9357) 2019-11-10 12:44:15 -08: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
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
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
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
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
Natalie Marleny
b8aee7af77 fix: Add error message for duplicate route param name (#8047)
* Add error message for duplicate slug name within a dynamic path

* Update based on feedback

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>

* WIP - committed with no-verify - progress

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>

* Remove old test placeholder

* Add test for re-used names
2019-07-30 16:21:36 -05:00
JJ Kasper
80b46c1d28 Update to have default pageProps of {} instead of null (#7734)
* Update to have default pageProps of {} instead of null

* Update test

* Test for empty object
2019-07-05 11:00:23 -04:00
Joe Haddad
6c625703ed
Dynamic Routes: Change impl from $param to [param] (#7623)
* Dynamic Routes: Change impl from $param to [param]

* Update expected test snapshot

* Update test to use new syntax

* Update test file

* Test more behavior

* Update route sorter for new param syntax

* Update dynamic routing tests

* Update danging test file

* Tweak test

* Fix dev and update tests
2019-06-20 18:27:04 -04:00