Commit graph

163 commits

Author SHA1 Message Date
JJ Kasper
0c58621796
v12.2.6-canary.12 2022-09-07 17:02:46 -07:00
JJ Kasper
b86bf07563
v12.2.6-canary.11 2022-09-07 13:44:58 -07:00
JJ Kasper
a33d502297
v12.2.6-canary.10 2022-09-05 13:42:39 -07:00
Jiachi Liu
391f6a9559
Fix styled-jsx macro imports (#40234)
x-ref: https://github.com/vercel/next.js/runs/8189857484?check_suite_focus=true

run with `test/e2e/swc-warnings/index.test.ts` locally it passed
2022-09-05 18:39:42 +00:00
Jiachi Liu
93830bf04f v12.2.6-canary.9 2022-09-05 14:38:11 +02:00
Donny/강동윤
6356095481
chore: Update swc (#39965)
This PR updates SWC crates to f2a0eef4f1

---


 - Closes #17056

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-09-04 12:13:22 +02:00
Jiachi Liu
b9238ec973
Bump styled-jsx (#40165)
x-ref: https://github.com/vercel/styled-jsx/releases/tag/v5.0.5
2022-09-01 20:08:31 -07:00
Steven
8258c872c4
Bump @vercel/nft@0.22.1 (#40164)
Bump `@vercel/nft` to version [0.22.1](https://github.com/vercel/nft/releases/tag/0.22.1)

- Fixes #40130
2022-09-01 14:46:39 -07:00
JJ Kasper
008da124ed
v12.2.6-canary.8 2022-08-31 17:47:07 -07:00
JJ Kasper
dddc60df15
v12.2.6-canary.7 2022-08-30 12:57:31 -07:00
Jiachi Liu
8668020a54
Upgrade typescript to 4.8.2 (#39979)
Typescript published 4.8.2 today and it fails CI, bump our typescript version to 4.8.2 and tweak some typings to make existing e2e typescript tests work properly

* Bump web-vitals from 3.0.0-beta to 3.0.0 stable for typing fix (there's an undefined type but it wasn't caught by ts 4.7), also force compiled it as CJS for pre-compiled
* Bump ncc to 3.34.0 for ts-loader compatibility for new typescript version, ncc 3.33.x cannot work with ts 4.8
* Update pre-compiled
2022-08-29 16:56:02 +00:00
JJ Kasper
decc00d0d2
v12.2.6-canary.6 2022-08-29 08:53:20 -07:00
Jiachi Liu
b4f74ee1c1
Handle async module for client components (#39953)
### Problem

esm modules imports from client components will be compiled to `m = import('module-name')` when webpack bundles them for server components flight rendering. In this case, they will all become async modules since dyanmic imports will return a promise which react flight cannot handle it then results into module resolving error on server flight rendering.

### Solution

* React flight renderer supports handling async modules in https://github.com/facebook/react/pull/25138
* On next.js side leverage the module proxy change for each client reference, to make sure it always resolve the correct client module

The idea is wrapping each module with a module proxy, and if the module is async and accessed as thenable, it will return a new module reference with `async` label to tell react to handle it as async modules:

exported client reference `*` --> not async module (non thenable) --> original module reference `''`
exported client reference `*` --> it's async module (thenable) --> wrapped module reference `'*'` with `async` label

### Note

Since we need to check if user having incorrect gSSP/gSP specifying in layout client componet, so we still need to parse it and assign those info to the proxy (Does client module containing `ssr`, `ssg` exports). Otherwise the proxy will return the cached module reference
2022-08-29 14:47:06 +00:00
Kiko Beats
8958867d91
build: upgrade edge-runtime (#39898)
https://github.com/vercel/edge-runtime/compare/v1.1.0-beta.27...v1.1.0-beta.31

Related: https://github.com/vercel/next.js/issues/38658
2022-08-24 23:59:12 +00:00
JJ Kasper
bd82f690e5
v12.2.6-canary.5 2022-08-24 15:18:19 -05:00
Steven
b757db4378
Bump @vercel/nft@0.22.0 (#39906)
This PR bumps `@vercel/nft` to version [0.22.0](https://github.com/vercel/nft/releases/tag/0.22.0)
2022-08-24 15:30:25 +00:00
JJ Kasper
34e10f302a
v12.2.6-canary.4 2022-08-23 23:30:54 -05:00
JJ Kasper
1c61eff67d
v12.2.6-canary.3 2022-08-23 19:00:15 -05:00
JJ Kasper
cb430cce90
v12.2.6-canary.2 2022-08-23 09:29:24 -05:00
Kiko Beats
28746520b6
build: upgrade edge-runtime (#39749)
https://github.com/vercel/edge-runtime/compare/v1.1.0-beta.26...v1.1.0-beta.27
2022-08-22 09:28:58 +00:00
JJ Kasper
b24b1d8421
v12.2.6-canary.1 2022-08-17 14:12:52 +01:00
Shu Ding
c79b67cced
Improved server CSS handling (#39664)
Upgrade experimental React, and render link tags directly in the tree during development. The client bundle won't import CSS anymore, and server CSS imports will be transpiled into no-op strings just for HMR to use.

## Follow Ups
- [ ] Flash of unstyled elements when reloading styles
- [ ] Collect client style imports
- [ ] Console warning for duplicated resources
- [ ] Tests

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] 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`
- [ ] 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`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-08-17 10:56:52 +00:00
Steven
53f0e2b31c
Update image tests files from *.js to *.ts (#39663)
Let's utilize typescript for our tests
2022-08-16 23:29:55 +00:00
JJ Kasper
6fd2a7fa31
Remove webpack4 types (#39631)
These types are no longer needed as we are only leveraging webpack 5 so this finishes migrating our types away from webpack 4's types.
2022-08-16 09:55:37 +00:00
JJ Kasper
d8809164ad
v12.2.6-canary.0 2022-08-13 12:27:25 -05:00
Jiachi Liu
3c9ad33c69
Remove precopied styled-jsx (#39520)
follow-up for #39518

* revert `styled-jsx/style` import path to `next/dist/shared/styled-jsx`
* Since `styled-jsx` cannot be resolved through `node_modules/next/node_modules` by external resolving, we forcedly resolve styled-jsx as cjs external in webpack


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-08-12 17:08:38 +00:00
JJ Kasper
911ba233d9
v12.2.5 2022-08-11 20:50:08 -05:00
JJ Kasper
d06fc0f0c4
v12.2.5-canary.7 2022-08-11 19:17:02 -05:00
JJ Kasper
4049cd7cb5
Re-add styled-jsx as a normal dependency (#39518)
This re-adds `styled-jsx` as a normal dependency for now leaving the require hook in place so that we can correctly handle mis-matching versions in the module tree. 

x-ref: [slack thread](https://vercel.slack.com/archives/C02CDC2ALJH/p1660254377444709)

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-08-11 23:54:26 +00:00
JJ Kasper
de1bf3e471
v12.2.5-canary.6 2022-08-11 16:46:44 -05:00
JJ Kasper
a9b415b850
v12.2.5-canary.5 2022-08-11 12:09:48 -05:00
Jiachi Liu
7f54585f8d
Bump styled-jsx and remove manual types creation (#39506) 2022-08-11 10:13:26 -05:00
JJ Kasper
f863ba7193
v12.2.5-canary.4 2022-08-10 23:00:59 -05:00
JJ Kasper
d246257602
v12.2.5-canary.3 2022-08-10 18:18:54 -05:00
JJ Kasper
44eea0c9c9
v12.2.5-canary.2 2022-08-10 15:32:25 -05:00
Gal Schlezinger
b899d01fff
Bump edge-runtime packages (#39450)
This version fixes a bug where [crypto buffers (ArrayBuffer, Uint8Array) not compatible with text decoding](17475e4df7).
2022-08-10 09:19:48 +00:00
JJ Kasper
a6bc38799a
v12.2.5-canary.1 2022-08-09 18:03:15 -05:00
Jiachi Liu
3e19ad5c5f
typing: upgrade styled-jsx to remove workaround in build script (#39408)
Improve styled-jsx types in next.js, previously there's no `declare module` for styled-jsx and there's type name conflicts in `styled-jsx/index.d.ts` and we use a rename hack to avoid the conflicts. Now styled-jsx 5.0.3 fixed those issues.

x-ref: https://github.com/vercel/styled-jsx/pull/805
2022-08-09 17:10:33 +00:00
Jiachi Liu
71f5f258ab
Setup require hook in next-server for styled-jsx resolving (#39305)
* Use require hook and alias to resolve styled-jsx

* re-export styled-jsx types from compiled

* fix lint

* add test for styled-jsx css

* setup require hook in server

* compile import path to styled-jsx/style

* revert require hook

* add test for server styled-jsx resolving

* update test

* pre copy styled-jsx assets

* fix styled-jsx dts

* add npmrc for styled-jsx e2e test

* load require hook directly

* rm legacy test

* fix lint

* fix pnpm install error

* split require hook

* only alias styled-jsx

* make styled-jsx resolving statically analyzable

* update test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-08-08 20:27:42 -05:00
JJ Kasper
b0f590162c
v12.2.5-canary.0 2022-08-08 18:44:10 -05:00
Michael Novotny
ab48f54786
Adds eslint-plugin-eslint-plugin to ensure eslint-plugin-next rules follow ESLint rule best practices along with enforcing some consistency. (#37920)
* Adds eslint-plugin-eslint-plugin and recommended rules.

* Removes `fixable` as none of the rules contain fixers.

* Adds description and url rules.

* Adds message format.

* Removes optional dependencies.

* Lints eslint-plugin-next tests too.

* Removes optional dependencies from pnpm lock file.

* Resets pnpm lock file.

* Resets package.json too.

* Fixes pnpm lockfile.
2022-08-07 23:52:02 -05:00
JJ Kasper
d6cb795fc6
v12.2.4 2022-08-04 12:24:58 -05:00
JJ Kasper
dbc38d607e
v12.2.4-canary.12 2022-08-04 09:29:59 -05:00
JJ Kasper
ad687c9304
v12.2.4-canary.11 2022-08-03 16:15:59 -05:00
Sukka
45ae757ff5
feat(config): implement a human readable ajv errors (#39291) 2022-08-03 15:12:16 -05:00
Jiachi Liu
4d0783d9be
Flush styles effects (#39268)
Use flush effects to custom apply css-in-js solution to app. Re-introduce flush effects to app-render, and remove default support of styled-jsx in `app/`. So that users will choose their own css-in-js solution if they need any customization. styled-jsx won't appear in client bundle if you didn't use it.

For now we have to inject the initial styles before `</head>` to avoid hydration errors. Later on we can remove this once react can handle it.

- [x] inject styles before end of head element
- [x] add tests
2022-08-03 16:21:20 +00:00
JJ Kasper
b7efce6437
v12.2.4-canary.10 2022-08-03 10:54:33 -05:00
Gal Schlezinger
e3181c2d77
Export URLPattern from next/server (#39219)
This commit allows the users to import URLPattern from `next/server`,
by defining a key that uses `global.URLPattern`.

Why is this any good? or: why don't we add URLPattern to the global namespace?

URLPattern is exposed as global on Edge Runtime _only_. This means that if we define a
constructor in global namespace in our TypeScript definitions, people might
have runtime errors in their Node.js functions.

Importing from `next/server` enables users to get the constructor without
risking in runtime errors and wrong type definitions.

Keep in mind, that with the current implementation, we do not check if the
constructor actually exists, but `next/server` shouldn't be imported in
Node.js functions, AFAIK.

## Related

- Fixes #38131

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-08-02 02:04:08 +00:00
JJ Kasper
ad75204b34
v12.2.4-canary.9 2022-08-01 17:51:35 -05:00
Jessica Franco
97ab23fb6f
Add missing @napi-rs/cli devDependency to next-swc (#39164)
Otherwise build-native fails with "napi: command not found.".

Alternatively, this is missing from this package's devDependencies.



## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)

P.S.: local copy fails `pnpm lint` due to the `target` subfolder with intermediate rust build artifacts... should I add a `.prettierignore` update to exclude `/packages/next-swc/target/`?

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-07-30 22:08:50 +00:00