1
0
mirror of synced 2026-02-04 03:01:17 -05:00

Compare commits

...

31 Commits

Author SHA1 Message Date
github-actions[bot]
831a493ab6 Version Packages (beta) (#4159)
* Version Packages (beta)

* updat pnpm lock

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Siddharth Suresh <siddh.suresh@gmail.com>
2023-06-14 18:12:23 +00:00
Siddharth Suresh
b6b9a1c5a4 (fix) Next-Auth integration (#4153)
* fix next-auth integration

* Create small-monkeys-battle.md

* Update .changeset/small-monkeys-battle.md

* add a postinstall script for good measure

* add a postinstall script for good measure

* fix lock file

* upgrade pnpm

* fix version

* fix build error

* suggessions

* fix pnpm lock

* fix pnpm lock

* Update main.yml

* Update apps/toolkit-app/next.config.js

* next-auth working again

* Update apps/toolkit-app/.env

* Update packages/blitz-auth/src/server/auth-sessions.ts

* Update packages/blitz-auth/src/server/auth-sessions.ts
2023-06-14 22:54:48 +05:30
Siddharth Suresh
61888d1a30 fix: blitz logging formatting (#4158)
* fix blitz logging setup

* changeset

* Update packages/blitz/src/logging.ts
2023-06-13 13:04:23 +00:00
Sakamoto, Kazunori
7aef610d85 fix(@blitzjs/generator): make Next.js version pinning to 13.4.5 (#4150)
* fix: make Next.js version stick to 13.3.4

* fix: upgrade Next.js from 13.3.4 to 13.4.5

---------

Co-authored-by: Siddharth Suresh <siddh.suresh@gmail.com>
2023-06-12 15:12:40 +05:30
Siddharth Suresh
b266254247 Revert "fix log showing path"
This reverts commit 67e00d9108.
2023-06-12 12:44:45 +05:30
Siddharth Suresh
67e00d9108 fix log showing path 2023-06-12 12:40:54 +05:30
github-actions[bot]
d25c965bc8 Version Packages (beta) (#4144)
* Version Packages (beta)

* pnpm lock

* fix worlfow pnpm version

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Siddharth Suresh <siddh.suresh@gmail.com>
2023-06-09 23:54:35 +05:30
Siddharth Suresh
1bb3a65566 (fix): Stop exporting useAuthenticatedBlitzContext from @blitzjs/auth (#4157)
* Remove unnecessary exports from @blitzjs/auth

* add changeset

* allow exporting getBlitzContext as we need it for blitz rpc

* Update .changeset/moody-crews-travel.md

---------

Co-authored-by: Brandon Bayer <b@bayer.ws>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-06-09 17:01:55 +00:00
Blitz.js Bot
28b0ffeb5f (meta) added @jayu as contributor 2023-06-09 12:52:10 -04:00
Jakub Mazurek
c7ac86b857 fix: enormous memory consumption of the dev server (#4148)
* fix: enormous dev server memory consumption

* chore: add changeset file

* add resolversDynamicImport configuration

* make vercel default to true

* imporve the changelog

* Update .changeset/good-oranges-pretend.md

* make code cleaner

* a fix and refactor

* fix build

---------

Co-authored-by: Siddharth Suresh <siddh.suresh@gmail.com>
Co-authored-by: Brandon Bayer <b@bayer.ws>
2023-06-09 16:52:04 +00:00
Siddharth Suresh
5166e5e037 (feat) upgrade tslog (#4154)
* upgrade tslog

* Create big-turtles-tease.md

* pnpm lock

* fix build issue

* upgrade pnpm in the lock file to v8

* try again

* Update main.yml

* fix build

* fix

* again

* fix spacing
2023-06-05 21:11:34 +05:30
Siddharth Suresh
2533caf484 (fix): Fix the Type error in RpcServerPlugin (#4152)
* fix type error

* changeset
2023-06-05 19:31:27 +05:30
Blitz.js Bot
85a71ffef9 (meta) added @nikola-wd as contributor 2023-05-31 11:36:16 -04:00
Blitz.js Bot
803f533a3d (meta) added @nerixim as contributor 2023-05-31 11:21:39 -04:00
Blitz.js Bot
63ee9423a9 (meta) added @GHKEN as contributor 2023-05-11 12:06:35 -04:00
Tetsuya Fukuda
89446b3656 support both directory style in tailwind recipe (#4137)
Co-authored-by: Siddharth Suresh <siddh.suresh@gmail.com>
2023-05-11 21:36:30 +05:30
github-actions[bot]
5a64f1c39c Version Packages (beta) (#4135)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Siddharth Suresh <siddh.suresh@gmail.com>
2023-05-01 23:33:32 +05:30
Blitz.js Bot
fa30de4599 (meta) added @gjmoed as contributor 2023-05-01 13:39:26 -04:00
G.J. Moed
3d004dc415 Adjust codegen logic for suspense patch (#4138)
Co-authored-by: Brandon Bayer <b@bayer.ws>
Co-authored-by: Siddharth Suresh <siddh.suresh@gmail.com>
2023-05-01 23:09:20 +05:30
Blitz.js Bot
08fbede75e (meta) added @dbrxnds as contributor 2023-05-01 12:30:21 -04:00
David
eda14fa8aa Add formatError property to Blitz server- & rpchandler setup (#4124)
Co-authored-by: Siddharth Suresh <siddh.suresh@gmail.com>
2023-05-01 22:00:15 +05:30
Blitz.js Bot
7e0e0f984c (meta) added @nelsonmestevao as contributor 2023-04-19 14:27:42 -04:00
Nelson Estevão
d814c2d2d8 fix: add missing key prop to LabelSelectField (#4122)
Co-authored-by: Siddharth Suresh <siddh.suresh@gmail.com>
2023-04-19 23:57:37 +05:30
Siddharth Suresh
29c2b029ac Fix: Add missing entry to expose next-auth adapter (#4133) 2023-04-19 23:45:39 +05:30
Siddharth Suresh
ed22706e5f fix (minor): Replace console.log with debug (#4132) 2023-04-19 23:44:46 +05:30
github-actions[bot]
3e8f04ed03 Version Packages (beta) (#4121)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Siddharth Suresh <siddh.suresh@gmail.com>
2023-04-10 19:24:42 +05:30
Siddharth Suresh
e82a79be50 Update the version of next in the new template from 13.2 to 13.3.0 (#4120)
Co-authored-by: Brandon Bayer <b@bayer.ws>
2023-04-10 18:45:54 +05:30
Blitz.js Bot
b1fdb63470 (meta) added @vitaliemiron as contributor 2023-04-07 12:46:27 -04:00
Vitalie
38d945a3fb fix: new app generated by blitz new causes Error: DYNAMIC_SERVER_USAGE (#4113)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-07 16:46:22 +00:00
Blitz.js Bot
ac587b6ac3 (meta) added @maotora as contributor 2023-04-07 12:38:51 -04:00
Maotora ᕙ(⇀‸↼‶)ᕗ
c07a13eefb Fix blitz recipe paths (#3997)
Co-authored-by: Tobias <t@tobiasjordans.de>
Co-authored-by: Siddharth Suresh <siddh.suresh@gmail.com>
2023-04-07 12:38:46 -04:00
120 changed files with 5756 additions and 4499 deletions

View File

@@ -3866,6 +3866,95 @@
"doc",
"code"
]
},
{
"login": "maotora",
"name": "Maotora ᕙ(⇀‸↼‶)ᕗ",
"avatar_url": "https://avatars.githubusercontent.com/u/5174884?v=4",
"profile": "https://maotoramm.com",
"contributions": [
"doc",
"code"
]
},
{
"login": "vitaliemiron",
"name": "Vitalie",
"avatar_url": "https://avatars.githubusercontent.com/u/45145592?v=4",
"profile": "https://github.com/vitaliemiron",
"contributions": [
"doc",
"code"
]
},
{
"login": "nelsonmestevao",
"name": "Nelson Estevão",
"avatar_url": "https://avatars.githubusercontent.com/u/19409687?v=4",
"profile": "https://estevao.org",
"contributions": [
"doc",
"code"
]
},
{
"login": "dbrxnds",
"name": "David",
"avatar_url": "https://avatars.githubusercontent.com/u/32268383?v=4",
"profile": "https://github.com/dbrxnds",
"contributions": [
"doc",
"code",
"test"
]
},
{
"login": "gjmoed",
"name": "G.J. Moed",
"avatar_url": "https://avatars.githubusercontent.com/u/4458993?v=4",
"profile": "https://github.com/gjmoed",
"contributions": [
"doc",
"code"
]
},
{
"login": "GHKEN",
"name": "Tetsuya Fukuda",
"avatar_url": "https://avatars.githubusercontent.com/u/5304351?v=4",
"profile": "https://ghken.com",
"contributions": [
"doc",
"code"
]
},
{
"login": "nerixim",
"name": "Nikita Kamaev",
"avatar_url": "https://avatars.githubusercontent.com/u/26106502?v=4",
"profile": "https://github.com/nerixim",
"contributions": [
"doc"
]
},
{
"login": "nikola-wd",
"name": "Nikola Ivanov",
"avatar_url": "https://avatars.githubusercontent.com/u/11588823?v=4",
"profile": "https://webredone.com/",
"contributions": [
"doc"
]
},
{
"login": "jayu",
"name": "Jakub Mazurek",
"avatar_url": "https://avatars.githubusercontent.com/u/11561585?v=4",
"profile": "jayu.dev",
"contributions": [
"doc",
"code"
]
}
],
"contributorsPerLine": 7,

View File

@@ -0,0 +1,9 @@
---
"@blitzjs/auth": patch
"@blitzjs/next": patch
"@blitzjs/rpc": patch
"blitz": patch
"@blitzjs/generator": patch
---
(feat) upgrade tslog to v4.8.2

View File

@@ -0,0 +1,6 @@
---
"@blitzjs/next": minor
"@blitzjs/rpc": minor
---
Add ability to format the error on the server before returning it to the client.

View File

@@ -0,0 +1,5 @@
---
"@blitzjs/rpc": patch
---
Fix return type of `requestMiddlewares` in `RpcServerPlugin`

View File

@@ -0,0 +1,5 @@
---
"@blitzjs/next": minor
---
Fix the DYNAMIC_SERVER_USAGE error for Next.js 13.3.1+

View File

@@ -0,0 +1,26 @@
---
"@blitzjs/rpc": patch
---
Fixes enormous memory consumption of the dev server by changing the default import strategy to "require" instead of "import" which in webpack causes multiple chunks to be created for each import.
## Blitz Configuration
To configure this behaviour, you can add the following to your next.config.js:
```js
/**
* @type {import('@blitzjs/next').BlitzConfig}
**/
const config = {
blitz: {
resolversDynamicImport: true,
},
}
```
When `resolversDynamicImport` is set to `true`, the import strategy will be "import" instead of "require".
### On Vercel
If you are using Vercel, `resolversDynamicImport` will be set to `true` by default, since it is better for the separate chunks to be create for serverless lambdas.

View File

@@ -0,0 +1,5 @@
---
"@blitzjs/generator": patch
---
Make Next.js version stick to 13.4.5 when generating a new app

View File

@@ -0,0 +1,7 @@
---
"@blitzjs/recipe-chakra-ui": patch
"@blitzjs/recipe-next-ui": patch
"@blitzjs/recipe-tailwind": patch
---
This change reflects the directory change from app/pages to src/pages for the receipts chakra-ui, next-ui, tailwind. It checks for which directories exists and is compatible with either versions.

View File

@@ -0,0 +1,5 @@
---
"@blitzjs/auth": minor
---
Stop exporting `useAuthenticatedBlitzContext` from `@blitzjs/auth` this must be imported from `app/blitz-server.ts` file in order to work correctly

View File

@@ -0,0 +1,5 @@
---
"@blitzjs/generator": patch
---
fix: add missing key prop to LabelSelectField

View File

@@ -0,0 +1,9 @@
---
"@blitzjs/auth": patch
"@blitzjs/next": patch
"@blitzjs/rpc": patch
"blitz": patch
"@blitzjs/generator": patch
---
Update the version of next in the new template from 13.2 to 13.3.0

View File

@@ -0,0 +1,5 @@
---
"blitz": patch
---
The issue is that the version provided, "13.2", is not a valid SemVer version. A valid SemVer version must have three components: major, minor, and patch (e.g., "13.2.0").

View File

@@ -55,6 +55,7 @@
"afraid-ears-repair",
"big-boats-lay",
"big-phones-bow",
"big-turtles-tease",
"blue-flowers-peel",
"blue-pigs-tan",
"brave-zebras-deny",
@@ -70,6 +71,7 @@
"calm-papayas-protect",
"calm-tomatoes-drive",
"chatty-fireants-leave",
"chatty-gifts-whisper",
"chilled-carrots-own",
"chilly-candles-care",
"chilly-nails-nail",
@@ -108,6 +110,7 @@
"fast-toys-wash",
"fast-trainers-kneel",
"few-dogs-fetch",
"few-elephants-approve",
"few-hounds-worry",
"few-shrimps-leave",
"flat-bees-approve",
@@ -119,6 +122,7 @@
"four-meals-fry",
"four-radios-tickle",
"four-sheep-judge",
"fresh-crews-chew",
"funny-cups-pay",
"fuzzy-bees-warn",
"fuzzy-dots-cross",
@@ -131,6 +135,7 @@
"gold-horses-punch",
"good-apes-drum",
"good-insects-wink",
"good-oranges-pretend",
"gorgeous-birds-warn",
"gorgeous-buses-scream",
"gorgeous-games-obey",
@@ -160,6 +165,7 @@
"khaki-ducks-cheer",
"khaki-pens-rest",
"kind-walls-suffer",
"large-hairs-battle",
"late-steaks-give",
"lazy-maps-sort",
"lemon-games-press",
@@ -178,12 +184,14 @@
"lucky-cows-try",
"lucky-months-guess",
"lucky-years-turn",
"many-fans-fetch",
"mean-ears-speak",
"mean-gorillas-reply",
"modern-cameras-pull",
"modern-games-dream",
"modern-ligers-behave",
"moody-bags-walk",
"moody-crews-travel",
"moody-spoons-rhyme",
"moody-squids-cheer",
"nasty-suns-wash",
@@ -194,10 +202,12 @@
"nice-boxes-travel",
"nice-deers-dream",
"nice-starfishes-live",
"nine-bags-rhyme",
"nine-birds-confess",
"nine-onions-admire",
"ninety-lies-press",
"ninety-pets-heal",
"ninety-pots-learn",
"ninety-rice-tickle",
"odd-bears-run",
"olive-bees-buy",
@@ -211,6 +221,7 @@
"perfect-eyes-repeat",
"perfect-trains-double",
"plenty-bottles-swim",
"plenty-gifts-provide",
"plenty-kiwis-greet",
"polite-lizards-love",
"poor-peas-lick",
@@ -253,6 +264,7 @@
"slow-impalas-tap",
"slow-walls-camp",
"slow-walls-poke",
"small-monkeys-battle",
"small-socks-confess",
"smooth-planets-admire",
"smooth-rice-clap",
@@ -282,6 +294,7 @@
"tall-radios-clean",
"tame-keys-reply",
"tame-pumpkins-nail",
"tame-rocks-unite",
"tasty-maps-fetch",
"tasty-news-collect",
"tasty-squids-sin",
@@ -319,7 +332,9 @@
"wicked-rings-walk",
"wise-eels-visit",
"wise-frogs-give",
"wise-lies-relate",
"wise-rabbits-complain",
"yellow-numbers-serve",
"young-birds-talk"
]
}

View File

@@ -0,0 +1,6 @@
---
"@blitzjs/auth": patch
"blitz": patch
---
Fix Next-Auth integration: `Unable to use next-auth with provider: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]`

View File

@@ -0,0 +1,5 @@
---
"blitz": patch
---
Fix log formatting to not show the path of blitz rpc

View File

@@ -0,0 +1,5 @@
---
"@blitzjs/auth": patch
---
Fix: Add missing entry to expose next-auth adapter in Blitz Auth

View File

@@ -0,0 +1,5 @@
---
"@blitzjs/recipe-tailwind": minor
---
support both directory style in tailwind recipe

View File

@@ -7,8 +7,8 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
jobs:
@@ -17,9 +17,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
- uses: pnpm/action-setup@v2.2.4
with:
version: 7.11.0
version: 7.33.0
- name: Setup node
uses: actions/setup-node@v2
with:
@@ -38,9 +38,9 @@ jobs:
name: Build
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
- uses: pnpm/action-setup@v2.2.4
with:
version: 7.11.0
version: 7.33.0
- name: Setup node
uses: actions/setup-node@v2
with:
@@ -68,9 +68,9 @@ jobs:
uses: actions/checkout@v3
- name: Setup PNPM
uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
uses: pnpm/action-setup@v2.2.4
with:
version: 7.11.0
version: 7.33.0
- name: Setup node@16
uses: actions/setup-node@v2
@@ -127,9 +127,9 @@ jobs:
uses: actions/checkout@v3
- name: Setup PNPM
uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
uses: pnpm/action-setup@v2.2.4
with:
version: 7.11.0
version: 7.33.0
- name: Setup node@${{ matrix.NODE_VERSION }}
uses: actions/setup-node@v2
@@ -143,7 +143,7 @@ jobs:
- name: Install playwright
run: |
pnpx playwright@1.28.0 install --with-deps
pnpx playwright@1.28.0 install --with-deps
shell: bash
- name: Build

View File

@@ -2,5 +2,5 @@
. "$(dirname "$0")/_/husky.sh"
pnpm manypkg check
pnpm lint
# pnpm lint
pnpm pretty-quick --staged

View File

@@ -6,7 +6,7 @@
<img alt="" src="https://img.shields.io/badge/Join%20our%20community-6700EB.svg?style=for-the-badge&labelColor=000000&logoWidth=20&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAQ9SURBVHgB7d3dVdtAEIbhcSpICUoH0IEogQqSVBBSAU4FSSpIOoAORAfQgSghHXzZ1U/YcMD4R9rZmf2ec3y448LyiNf27iLiGIAmPLrweC9Un3DhrzG6EarLNP09nlwJ1SOZ/lQr5N80/S/p2QMVCBf5N17XCfm1Y/rBHqjAG9PPHvBsz+mf9WAP+HLA9M/YA14cOP2payH7jpj+VCtk1wnTP+vj7xCy6cTpn7EHLMLp059iD1iD8eveJbVCNsSLheX1YA/YgOWnf8YeKB3Wmf7Ud6Fy4f/FHmtpxbl3YlC4MJ/Cj0bWdwPnPbARg+L0S54XQHS32WwuxClzd4CM0z9rPfeAuTtA5ulPXYQ7wZ04Y+oOoDD9KZc9YOoOoDj9s4dwFzgXR6w1wIPoOvPWA9buAHEJ173o3gWiy3AnuBUHLEbgmYwvAk1/wuM8vAgexThzbwPDkx7/DHwVXfFOxP2GmsKd4Ab6zPeAyU8CI7AHFmH2BRCBPXAyk18GzUrqAXCTiR4ssyj0VFw/oCU8+e+RZ33AWz6KMaYbIIWxB+JSLs1bsbkeMN0AqakHvoku9oA2sAfqBvbAQdw0QArsgb25aYBUQT3QgT2gB+yBuqGcHij2UCqXDZACe2Anlw2QYg/QAOyBuoE98CL3DZDCuK4/rh/Q7oGL6U+TOvcNkJoijN8X1C48+T+g75eQDrAH/qmqAVJgDwyqaoAUe4AGYA/UDZX3QLUNkEIZPRCd5+6BahsgVUgPROwBTSijB7jpVAvGHriHvmw9wAZ4BpX1ABvgmakHtPcbRuwBTWAPULgAV9D/jKDY9YRvwvgEaurD44uQHvAol7qBW7WKluVtIHiUS7GyvA0s6CiXDnxrpQfsgbqBS7GKk/2jYHCrVlGyfxTMrVo0ALdq1Q3sgSKofh0M9oA61a+D2QM0AHugbmAPqClmSRjK2apVVQ8UsySsoK1aHdgDesCtWnUDeyCrIpeFg1u3sylyWTi3btMA7IG6gT2wuuK3hoE9sKrit4YVslWLPaAN7IG6ocKt2zmY2h4O9sDiTG0PZw/QANy6XTewBxZj9ogYVHy025LMHhEz9cBn0We6B0yfERReBLfhx0/R1YQHPx/QBPbA0VwcEwf2wNFcHBPHHjiem3MC2QPHcXdSaJjA+KfgTPQ8hhfjBzHC40mhlzJ+Xq9lK4a4PCs43AVaGTed5mZq+iOXZwWHi3AnOj2wFWNcnxYe7gTxLtBKHuamP/J+Wnh8a5irB7ZC5Yk9gPX1QuXC+usHWqGyhYvUYR0a7zboUOFCNVhnk0krZAOW7wFOvzXhom2xnEbIHizTA1wEYhWW6YFGyC6c1gOcfg9wfA80Qj7g8B7g9HuCww+haIR8wf49wOn3Cvv9k8tGyC/s7gFOv3fY3QONkH+v9MBWqB7PeqDn9FcIT//kcitUn6kHOu/T/xfWzlQy3dEHhwAAAABJRU5ErkJggg==">
</a>
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<a aria-label="All Contributors" href="#contributors-"><img alt="" src="https://img.shields.io/badge/all_contributors-408-17BB8A.svg?style=for-the-badge&labelColor=000000"></a>
<a aria-label="All Contributors" href="#contributors-"><img alt="" src="https://img.shields.io/badge/all_contributors-417-17BB8A.svg?style=for-the-badge&labelColor=000000"></a>
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<a aria-label="License" href="https://github.com/blitz-js/blitz/blob/main/LICENSE">
<img alt="" src="https://img.shields.io/npm/l/blitz.svg?style=for-the-badge&labelColor=000000&color=blue">
@@ -721,6 +721,17 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
<tr>
<td align="center"><a href="https://github.com/jeliasson"><img src="https://avatars.githubusercontent.com/u/865493?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Johan Eliasson</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=jeliasson" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/jafarlihi"><img src="https://avatars.githubusercontent.com/u/43515211?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hikmat Jafarli</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=jafarlihi" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=jafarlihi" title="Code">💻</a></td>
<td align="center"><a href="https://maotoramm.com"><img src="https://avatars.githubusercontent.com/u/5174884?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Maotora ᕙ(⇀‸↼‶)ᕗ</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=maotora" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=maotora" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/vitaliemiron"><img src="https://avatars.githubusercontent.com/u/45145592?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vitalie</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=vitaliemiron" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=vitaliemiron" title="Code">💻</a></td>
<td align="center"><a href="https://estevao.org"><img src="https://avatars.githubusercontent.com/u/19409687?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nelson Estevão</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=nelsonmestevao" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=nelsonmestevao" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/dbrxnds"><img src="https://avatars.githubusercontent.com/u/32268383?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=dbrxnds" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=dbrxnds" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=dbrxnds" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/gjmoed"><img src="https://avatars.githubusercontent.com/u/4458993?v=4?s=100" width="100px;" alt=""/><br /><sub><b>G.J. Moed</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=gjmoed" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=gjmoed" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://ghken.com"><img src="https://avatars.githubusercontent.com/u/5304351?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tetsuya Fukuda</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=GHKEN" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=GHKEN" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/nerixim"><img src="https://avatars.githubusercontent.com/u/26106502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nikita Kamaev</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=nerixim" title="Documentation">📖</a></td>
<td align="center"><a href="https://webredone.com/"><img src="https://avatars.githubusercontent.com/u/11588823?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nikola Ivanov</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=nikola-wd" title="Documentation">📖</a></td>
<td align="center"><a href="jayu.dev"><img src="https://avatars.githubusercontent.com/u/11561585?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jakub Mazurek</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=jayu" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=jayu" title="Code">💻</a></td>
</tr>
</table>

View File

@@ -1,5 +1,56 @@
# next-blitz-auth
## 0.1.1-beta.5
### Patch Changes
- Updated dependencies [b6b9a1c5a]
- Updated dependencies [61888d1a3]
- @blitzjs/auth@2.0.0-beta.29
- blitz@2.0.0-beta.29
- @blitzjs/rpc@2.0.0-beta.29
- @blitzjs/next@2.0.0-beta.29
- @blitzjs/config@2.0.0-beta.29
## 0.1.1-beta.4
### Patch Changes
- Updated dependencies [5166e5e03]
- Updated dependencies [2533caf48]
- Updated dependencies [c7ac86b85]
- Updated dependencies [1bb3a6556]
- @blitzjs/auth@2.0.0-beta.28
- @blitzjs/next@2.0.0-beta.28
- @blitzjs/rpc@2.0.0-beta.28
- blitz@2.0.0-beta.28
- @blitzjs/config@2.0.0-beta.28
## 0.1.1-beta.3
### Patch Changes
- Updated dependencies [eda14fa8a]
- Updated dependencies [3d004dc41]
- Updated dependencies [29c2b029a]
- @blitzjs/next@2.0.0-beta.27
- @blitzjs/rpc@2.0.0-beta.27
- @blitzjs/auth@2.0.0-beta.27
- blitz@2.0.0-beta.27
- @blitzjs/config@2.0.0-beta.27
## 0.1.1-beta.2
### Patch Changes
- Updated dependencies [e82a79be5]
- Updated dependencies [38d945a3f]
- @blitzjs/auth@2.0.0-beta.26
- @blitzjs/next@2.0.0-beta.26
- @blitzjs/rpc@2.0.0-beta.26
- blitz@2.0.0-beta.26
- @blitzjs/config@2.0.0-beta.26
## 0.1.1-beta.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "next-blitz-auth",
"version": "0.1.1-beta.1",
"version": "0.1.1-beta.5",
"private": true,
"scripts": {
"blitz:dev": "next dev",
@@ -19,7 +19,7 @@
"@tanstack/react-query": "4.0.10",
"blitz": "workspace:*",
"flatted": "3.2.7",
"next": "13.2.4",
"next": "13.3.0",
"prisma": "^4.5.0",
"react": "18.2.0",
"react-dom": "18.2.0",

View File

@@ -30,8 +30,8 @@
"@hookform/error-message": "2.0.0",
"@hookform/resolvers": "2.9.10",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.25",
"next": "13.2.4",
"blitz": "workspace:2.0.0-beta.29",
"next": "13.3.0",
"openid-client": "5.2.1",
"prisma": "4.6.1",
"react": "18.2.0",

View File

@@ -1,11 +1,14 @@
const { withNextAuthAdapter } = require("@blitzjs/auth/next-auth")
const { withNextAuthAdapter } = require("@blitzjs/auth")
const { withBlitz } = require("@blitzjs/next")
/**
* @type {import('@blitzjs/next').BlitzConfig}
* @type {import('next').NextConfig}
**/
const config = {
reactStrictMode: true,
blitz: {
resolversDynamicImport: true,
},
}
module.exports = withBlitz(withNextAuthAdapter(config))

View File

@@ -31,8 +31,8 @@
"@hookform/error-message": "2.0.0",
"@hookform/resolvers": "2.9.10",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.25",
"next": "13.2.4",
"blitz": "workspace:2.0.0-beta.29",
"next": "13.3.0",
"next-auth": "4.18.7",
"prisma": "4.6.1",
"react": "18.2.0",

View File

@@ -10,6 +10,7 @@ type SignupFormProps = {
export const SignupForm = (props: SignupFormProps) => {
const [signupMutation] = useMutation(signup)
return (
<div>
<h1>Create an Account</h1>

View File

@@ -1,5 +1,4 @@
import db from "db"
import { SecurePassword } from "@blitzjs/auth/secure-password"
import { Role } from "types"
export default async function signup(input, ctx) {

View File

@@ -1,9 +1,8 @@
import type { BlitzCliConfig } from "blitz"
import { setupBlitzServer } from "@blitzjs/next"
import { AuthServerPlugin, PrismaStorage } from "@blitzjs/auth"
import db from "db"
import { simpleRolesIsAuthorized } from "@blitzjs/auth"
import { BlitzLogger } from "blitz"
import { setupBlitzServer } from "@blitzjs/next"
import { AuthServerPlugin, PrismaStorage, simpleRolesIsAuthorized } from "@blitzjs/auth"
import db from "db"
export const cliConfig: BlitzCliConfig = {
customTemplates: "src/templates",
@@ -27,6 +26,9 @@ const { gSSP, gSP, api } = setupBlitzServer({
isAuthorized: simpleRolesIsAuthorized,
}),
],
formatError: (error) => {
return new Error("Formatted error" + error.message)
},
logger: BlitzLogger({}),
})

View File

@@ -1,4 +1,12 @@
import { rpcHandler } from "@blitzjs/rpc"
import { api } from "src/blitz-server"
export default api(rpcHandler({ onError: console.log }))
export default api(
rpcHandler({
onError: console.log,
formatError: (error) => {
error.message = `FormatError handler: ${error.message}`
return error
},
})
)

View File

@@ -38,13 +38,13 @@ const UserInfo = () => {
} else {
return (
<>
<Link href={Routes.SignupPage()} className={styles.button}>
<Link href={"/signup"} className={styles.button}>
<strong>Sign Up</strong>
</Link>
<Link href={Routes.LoginPage()} className={styles.loginButton}>
<Link href={"/login"} className={styles.loginButton}>
<strong>Login</strong>
</Link>
<Link href="/api/auth/github/login" passHref>
<Link href="/api/auth/github/login" passHref legacyBehavior>
<a className="button small">
<strong>Sign in with GitHub</strong>
</a>

View File

@@ -26,7 +26,7 @@
"blitz": "workspace:*",
"jest": "29.3.0",
"jest-environment-jsdom": "29.3.0",
"next": "13.2.4",
"next": "13.3.0",
"passport-mock-strategy": "2.0.0",
"passport-twitter": "1.0.4",
"prisma": "4.6.1",

View File

@@ -13,7 +13,6 @@ const {gSSP, gSP, api} = setupBlitzServer({
}),
],
logger: BlitzLogger({
colorizePrettyLogs: true,
prefix: ["[blitz]>>>>>"],
}),
})

View File

@@ -17,16 +17,16 @@
"prisma:studio": "prisma studio"
},
"dependencies": {
"@blitzjs/auth": "workspace:2.0.0-beta.25",
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/next": "workspace:2.0.0-beta.25",
"@blitzjs/rpc": "workspace:2.0.0-beta.25",
"@blitzjs/auth": "workspace:2.0.0-beta.29",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@blitzjs/next": "workspace:2.0.0-beta.29",
"@blitzjs/rpc": "workspace:2.0.0-beta.29",
"@hookform/error-message": "2.0.0",
"@hookform/resolvers": "2.9.10",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.25",
"blitz": "workspace:2.0.0-beta.29",
"delay": "5.0.0",
"next": "13.2.4",
"next": "13.3.0",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",

View File

@@ -1,11 +1,11 @@
import {describe, it, expect, beforeAll, afterAll} from "vitest"
import {afterAll, beforeAll, describe, expect, it} from "vitest"
import {
killApp,
findPort,
runBlitzCommand,
blitzLaunchApp,
blitzBuild,
blitzLaunchApp,
blitzStart,
findPort,
killApp,
runBlitzCommand,
waitFor,
} from "../../utils/next-test-utils"
import webdriver from "../../utils/next-webdriver"
@@ -15,7 +15,8 @@ let appPort: number
const runTests = () => {
describe("Auth", () => {
describe("custom plugin", () => {
/* TODO - Add a non flaky Integration Test for custom plugin
describe("custom plugin", () => {
it("custom plugin - events", async () => {
const browser = await webdriver(appPort, "/custom-plugin")
let text = await browser.elementByCss("#page").text()
@@ -34,7 +35,7 @@ const runTests = () => {
await waitFor(100)
let text = await browser.elementByCss("#before-req").text()
expect(text).toBe("customHeaderValue")
await waitFor(1000)
await waitFor(2000)
text = await browser.elementByCss("#before-res").text()
expect(text).toBe("55")
if (browser) {
@@ -42,6 +43,7 @@ const runTests = () => {
}
})
})
*/
describe("unauthenticated", () => {
it("should render result for open query", async () => {
const browser = await webdriver(appPort, "/noauth-query")

View File

@@ -17,13 +17,13 @@
"prisma:studio": "prisma studio"
},
"dependencies": {
"@blitzjs/auth": "workspace:2.0.0-beta.25",
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/next": "workspace:2.0.0-beta.25",
"@blitzjs/auth": "workspace:2.0.0-beta.29",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@blitzjs/next": "workspace:2.0.0-beta.29",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.25",
"blitz": "workspace:2.0.0-beta.29",
"lowdb": "3.0.0",
"next": "13.2.4",
"next": "13.3.0",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",

View File

@@ -16,19 +16,19 @@
"schema": "db/schema.prisma"
},
"dependencies": {
"@blitzjs/auth": "workspace:2.0.0-beta.25",
"@blitzjs/next": "workspace:2.0.0-beta.25",
"@blitzjs/rpc": "workspace:2.0.0-beta.25",
"@blitzjs/auth": "workspace:2.0.0-beta.29",
"@blitzjs/next": "workspace:2.0.0-beta.29",
"@blitzjs/rpc": "workspace:2.0.0-beta.29",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.25",
"blitz": "workspace:2.0.0-beta.29",
"lowdb": "3.0.0",
"next": "13.2.4",
"next": "13.3.0",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@next/bundle-analyzer": "12.0.8",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",

View File

@@ -11,11 +11,11 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next"
},
"dependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/next": "workspace:2.0.0-beta.25",
"@blitzjs/rpc": "workspace:2.0.0-beta.25",
"blitz": "workspace:2.0.0-beta.25",
"next": "13.2.4",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@blitzjs/next": "workspace:2.0.0-beta.29",
"@blitzjs/rpc": "workspace:2.0.0-beta.29",
"blitz": "workspace:2.0.0-beta.29",
"next": "13.3.0",
"react": "18.2.0",
"react-dom": "18.2.0"
},

View File

@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

View File

@@ -17,14 +17,14 @@
"prisma:studio": "prisma studio"
},
"dependencies": {
"@blitzjs/auth": "workspace:2.0.0-beta.25",
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/next": "workspace:2.0.0-beta.25",
"@blitzjs/rpc": "workspace:2.0.0-beta.25",
"@blitzjs/auth": "workspace:2.0.0-beta.29",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@blitzjs/next": "workspace:2.0.0-beta.29",
"@blitzjs/rpc": "workspace:2.0.0-beta.29",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.25",
"blitz": "workspace:2.0.0-beta.29",
"lowdb": "3.0.0",
"next": "13.2.4",
"next": "13.3.0",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",

View File

@@ -1,13 +1,6 @@
import {describe, it, expect, beforeAll, afterAll} from "vitest"
import {afterAll, beforeAll, describe, expect, it} from "vitest"
import waitPort from "wait-port"
import {
killApp,
findPort,
runBlitzCommand,
blitzLaunchApp,
blitzBuild,
blitzStart,
} from "../../utils/next-test-utils"
import {blitzLaunchApp, findPort, killApp, runBlitzCommand} from "../../utils/next-test-utils"
import webdriver from "../../utils/next-webdriver"
import fetch from "node-fetch"
@@ -43,7 +36,7 @@ const runTests = (mode?: string) => {
const browser = await webdriver(appPort, "/authenticated-client")
let errorMsg = await browser.elementById(`error`).text()
expect(errorMsg).toMatch(/Error: You are not authenticated/)
if (browser) browser.close()
if (browser) await browser.close()
},
5000 * 60 * 2,
)
@@ -55,7 +48,7 @@ const runTests = (mode?: string) => {
const browser = await webdriver(appPort, "/authenticated-server")
let errorMsg = await browser.elementById(`error`).text()
expect(errorMsg).toMatch(/Error: You are not authenticated/)
if (browser) browser.close()
if (browser) await browser.close()
},
5000 * 60 * 2,
)

View File

@@ -9,7 +9,8 @@
{
"name": "next"
}
]
],
"strictNullChecks": true
},
"exclude": ["node_modules"],
"baseUrl": "."

View File

@@ -16,19 +16,19 @@
"prisma:studio": "prisma studio"
},
"dependencies": {
"@blitzjs/auth": "workspace:2.0.0-beta.25",
"@blitzjs/next": "workspace:2.0.0-beta.25",
"@blitzjs/rpc": "workspace:2.0.0-beta.25",
"@blitzjs/auth": "workspace:2.0.0-beta.29",
"@blitzjs/next": "workspace:2.0.0-beta.29",
"@blitzjs/rpc": "workspace:2.0.0-beta.29",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.25",
"blitz": "workspace:2.0.0-beta.29",
"lowdb": "3.0.0",
"next": "13.2.4",
"next": "13.3.0",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@next/bundle-analyzer": "12.0.8",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",

View File

@@ -8,14 +8,14 @@
"clean": "rm -rf .turbo && rm -rf node_modules"
},
"dependencies": {
"@blitzjs/auth": "workspace:2.0.0-beta.25",
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/next": "workspace:2.0.0-beta.25",
"@blitzjs/rpc": "workspace:2.0.0-beta.25",
"@blitzjs/auth": "workspace:2.0.0-beta.29",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@blitzjs/next": "workspace:2.0.0-beta.29",
"@blitzjs/rpc": "workspace:2.0.0-beta.29",
"@prisma/client": "4.6.1",
"@tanstack/react-query": "4.0.10",
"blitz": "workspace:2.0.0-beta.25",
"next": "13.2.4",
"blitz": "workspace:2.0.0-beta.29",
"next": "13.3.0",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"

View File

@@ -16,18 +16,18 @@
"schema": "db/schema.prisma"
},
"dependencies": {
"@blitzjs/next": "workspace:2.0.0-beta.25",
"@blitzjs/rpc": "workspace:2.0.0-beta.25",
"@blitzjs/next": "workspace:2.0.0-beta.29",
"@blitzjs/rpc": "workspace:2.0.0-beta.29",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.25",
"blitz": "workspace:2.0.0-beta.29",
"lowdb": "3.0.0",
"next": "13.2.4",
"next": "13.3.0",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@next/bundle-analyzer": "12.0.8",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",

View File

@@ -7,11 +7,11 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next"
},
"dependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/next": "workspace:2.0.0-beta.25",
"@blitzjs/rpc": "workspace:2.0.0-beta.25",
"blitz": "workspace:2.0.0-beta.25",
"next": "13.2.4",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@blitzjs/next": "workspace:2.0.0-beta.29",
"@blitzjs/rpc": "workspace:2.0.0-beta.29",
"blitz": "workspace:2.0.0-beta.29",
"next": "13.3.0",
"react": "18.2.0",
"react-dom": "18.2.0"
},

View File

@@ -0,0 +1,12 @@
class ErrorWithStatusCode extends Error {
statusCode
constructor(message, statusCode) {
super(message)
this.statusCode = statusCode
}
}
export default async function getCustomStatusCodeFailure() {
throw new ErrorWithStatusCode("Error with custom status code for test", 418)
}

View File

@@ -7,11 +7,11 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next"
},
"dependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/next": "workspace:2.0.0-beta.25",
"@blitzjs/rpc": "workspace:2.0.0-beta.25",
"blitz": "workspace:2.0.0-beta.25",
"next": "13.2.4",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@blitzjs/next": "workspace:2.0.0-beta.29",
"@blitzjs/rpc": "workspace:2.0.0-beta.29",
"blitz": "workspace:2.0.0-beta.29",
"next": "13.3.0",
"react": "18.2.0",
"react-dom": "18.2.0"
},

View File

@@ -1,14 +1,13 @@
import {describe, it, expect, beforeAll, afterAll} from "vitest"
import fs from "fs-extra"
import {afterAll, beforeAll, describe, expect, it} from "vitest"
import {join} from "path"
import {
killApp,
findPort,
launchApp,
fetchViaHTTP,
findPort,
killApp,
launchApp,
nextBuild,
nextStart,
nextExport,
nextStart,
} from "../../utils/next-test-utils"
// jest.setTimeout(1000 * 60 * 2)

View File

@@ -16,19 +16,19 @@
"schema": "db/schema.prisma"
},
"dependencies": {
"@blitzjs/auth": "workspace:2.0.0-beta.25",
"@blitzjs/next": "workspace:2.0.0-beta.25",
"@blitzjs/rpc": "workspace:2.0.0-beta.25",
"@blitzjs/auth": "workspace:2.0.0-beta.29",
"@blitzjs/next": "workspace:2.0.0-beta.29",
"@blitzjs/rpc": "workspace:2.0.0-beta.29",
"@prisma/client": "4.6.1",
"blitz": "workspace:2.0.0-beta.25",
"blitz": "workspace:2.0.0-beta.29",
"lowdb": "3.0.0",
"next": "13.2.4",
"next": "13.3.0",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@next/bundle-analyzer": "12.0.8",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",

View File

@@ -29,7 +29,7 @@
"husky": "8.0.2",
"jsdom": "^19.0.0",
"lint-staged": "13.0.3",
"next": "13.2.4",
"next": "13.3.0",
"only-allow": "1.1.0",
"prettier": "^2.7.1",
"prettier-plugin-prisma": "4.4.0",

View File

@@ -1,5 +1,42 @@
# @blitzjs/auth
## 2.0.0-beta.29
### Patch Changes
- b6b9a1c5a: Fix Next-Auth integration: `Unable to use next-auth with provider: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]`
- Updated dependencies [b6b9a1c5a]
- Updated dependencies [61888d1a3]
- blitz@2.0.0-beta.29
## 2.0.0-beta.28
### Minor Changes
- 1bb3a6556: Stop exporting `useAuthenticatedBlitzContext` from `@blitzjs/auth` this must be imported from `app/blitz-server.ts` file in order to work correctly
### Patch Changes
- 5166e5e03: (feat) upgrade tslog to v4.8.2
- Updated dependencies [5166e5e03]
- blitz@2.0.0-beta.28
## 2.0.0-beta.27
### Patch Changes
- 29c2b029a: Fix: Add missing entry to expose next-auth adapter in Blitz Auth
- blitz@2.0.0-beta.27
## 2.0.0-beta.26
### Patch Changes
- e82a79be5: Update the version of next in the new template from 13.2 to 13.3.0
- Updated dependencies [e82a79be5]
- Updated dependencies [38d945a3f]
- blitz@2.0.0-beta.26
## 2.0.0-beta.25
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/auth",
"version": "2.0.0-beta.25",
"version": "2.0.0-beta.29",
"homepage": "https://blitzjs.com/",
"repository": {
"type": "git",
@@ -23,7 +23,8 @@
"license": "MIT",
"files": [
"dist/**",
"secure-password.*"
"secure-password.*",
"next-auth.*"
],
"dependencies": {
"@types/b64-lite": "1.3.0",
@@ -36,6 +37,7 @@
"cookie": "0.4.1",
"cookie-session": "2.0.0",
"debug": "4.3.3",
"find-up": "4.1.0",
"http": "0.0.1-security",
"jsonwebtoken": "9.0.0",
"nanoid": "3.2.0",
@@ -43,11 +45,12 @@
"openid-client": "5.2.1",
"passport": "0.6.0",
"path": "0.12.7",
"resolve-from": "5.0.0",
"supports-color": "8.1.1",
"url": "0.11.0"
},
"peerDependencies": {
"blitz": "2.0.0-beta.25",
"blitz": "2.0.0-beta.29",
"next": "*",
"next-auth": "*",
"secure-password": "4.0.0"
@@ -64,7 +67,7 @@
}
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@testing-library/react": "13.4.0",
"@testing-library/react-hooks": "8.0.1",
"@types/cookie": "0.4.1",
@@ -72,8 +75,8 @@
"@types/jsonwebtoken": "8.5.8",
"@types/react": "18.0.25",
"@types/react-dom": "17.0.14",
"blitz": "2.0.0-beta.25",
"next": "13.2.4",
"blitz": "2.0.0-beta.29",
"next": "13.3.0",
"next-auth": "4.18.7",
"react": "18.2.0",
"react-dom": "18.2.0",

View File

@@ -1 +1,2 @@
export * from "./passport/adapter"
export * from "./next-auth/webpack"

View File

@@ -1,3 +1,2 @@
export * from "./next-auth/adapter"
export * from "./next-auth/types"
export * from "./next-auth/webpack"

View File

@@ -27,7 +27,9 @@ import type {
} from "./types"
import {Provider} from "next-auth/providers"
export {withNextAuthAdapter} from "./webpack"
import {init} from "next-auth/core/init"
import getAuthorizationUrl from "next-auth/core/lib/oauth/authorization-url"
import oAuthCallback from "next-auth/core/lib/oauth/callback"
const INTERNAL_REDIRECT_URL_KEY = "_redirectUrl"
@@ -102,7 +104,6 @@ export function NextAuthAdapter<P extends Provider[]>(
if (providerId?.includes("?")) {
providerId = providerId.split("?")[0]
}
const {init} = await import("next-auth/core/init").then((m) => m)
const {options, cookies} = await init({
// @ts-ignore
url: new URL(
@@ -158,9 +159,6 @@ async function AuthHandler<P extends Provider[]>(
if (action === "login") {
middleware.push(async (req, res, next) => {
try {
const getAuthorizationUrl = await import("next-auth/core/lib/oauth/authorization-url").then(
(m) => m.default,
)
const _signin = await getAuthorizationUrl({options: options, query: req.query})
if (_signin.cookies) cookies.push(..._signin.cookies)
const session = res.blitzCtx.session as SessionContext
@@ -191,9 +189,6 @@ async function AuthHandler<P extends Provider[]>(
middleware.push(
// eslint-disable-next-line no-shadow
connectMiddleware(async (req, res, next) => {
const oAuthCallback = await import("next-auth/core/lib/oauth/callback").then(
(m) => m.default,
)
try {
const {profile, account, OAuthProfile} = await oAuthCallback({
query: internalRequest.query,

View File

@@ -1,15 +1,27 @@
//@ts-nocheck
import fs from "fs-extra"
import path from "path"
export function withNextAuthAdapter(nextConfig) {
const config = Object.assign({}, nextConfig)
config.webpack = (config) => {
//add a required resolve alias
config.resolve.alias["next-auth/core/lib/oauth/callback"] =
process.cwd() + "/node_modules/next-auth/core/lib/oauth/callback.js"
config.resolve.alias["next-auth/core/lib/oauth/authorization-url"] =
process.cwd() + "/node_modules/next-auth/core/lib/oauth/authorization-url.js"
config.resolve.alias["next-auth/core/init"] =
process.cwd() + "/node_modules/next-auth/core/init.js"
const nextAuthPath = path.dirname(require.resolve("next-auth"))
const webpack = (config) => {
config.resolve.alias = {
...config.resolve.alias,
"next-auth/core/lib/oauth/callback": path.join(nextAuthPath, "core/lib/oauth/callback.js"),
"next-auth/core/lib/oauth/authorization-url": path.join(
nextAuthPath,
"core/lib/oauth/authorization-url.js",
),
"next-auth/core/init": path.join(nextAuthPath, "core/init.js"),
}
return config
}
if (typeof nextConfig.webpack === "function") {
config.webpack = (config, options) => {
return nextConfig.webpack(webpack(config), options)
}
}
config.webpack = webpack
return config
}

View File

@@ -220,7 +220,7 @@ export async function useAuthenticatedBlitzContext({
redirectAuthenticatedTo?: string | RouteUrlObject | ((ctx: Ctx) => string | RouteUrlObject)
role?: string | string[]
}): Promise<void> {
const log = baseLogger().getChildLogger()
const log = baseLogger().getSubLogger({name: "useAuthenticatedBlitzContext"})
const customChalk = new chalk.Instance({
level: log.settings.type === "json" ? 0 : chalk.level,
})

View File

@@ -1,4 +1,16 @@
export * from "./auth-sessions"
export * from "./auth-utils"
export * from "./auth-plugin"
export * from "./adapters"
export {
SessionContextClass,
getAllSessionHandlesForUser,
getCookieParser,
getSession,
isLocalhost,
setPublicDataForUser,
setCookie,
simpleRolesIsAuthorized,
getBlitzContext,
} from "./auth-sessions"
export type {AnonymousSessionPayload, SimpleRolesIsAuthorized} from "./auth-sessions"

View File

@@ -1,5 +1,48 @@
# @blitzjs/next
## 2.0.0-beta.29
### Patch Changes
- Updated dependencies [b6b9a1c5a]
- Updated dependencies [61888d1a3]
- blitz@2.0.0-beta.29
- @blitzjs/rpc@2.0.0-beta.29
## 2.0.0-beta.28
### Patch Changes
- 5166e5e03: (feat) upgrade tslog to v4.8.2
- Updated dependencies [5166e5e03]
- Updated dependencies [2533caf48]
- Updated dependencies [c7ac86b85]
- @blitzjs/rpc@2.0.0-beta.28
- blitz@2.0.0-beta.28
## 2.0.0-beta.27
### Minor Changes
- eda14fa8a: Add ability to format the error on the server before returning it to the client.
- 3d004dc41: Fix the DYNAMIC_SERVER_USAGE error for Next.js 13.3.1+
### Patch Changes
- Updated dependencies [eda14fa8a]
- @blitzjs/rpc@2.0.0-beta.27
- blitz@2.0.0-beta.27
## 2.0.0-beta.26
### Patch Changes
- e82a79be5: Update the version of next in the new template from 13.2 to 13.3.0
- Updated dependencies [e82a79be5]
- Updated dependencies [38d945a3f]
- @blitzjs/rpc@2.0.0-beta.26
- blitz@2.0.0-beta.26
## 2.0.0-beta.25
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/next",
"version": "2.0.0-beta.25",
"version": "2.0.0-beta.29",
"homepage": "https://blitzjs.com/",
"repository": {
"type": "git",
@@ -29,7 +29,7 @@
"eslint.js"
],
"dependencies": {
"@blitzjs/rpc": "2.0.0-beta.25",
"@blitzjs/rpc": "2.0.0-beta.29",
"@types/hoist-non-react-statics": "3.3.1",
"debug": "4.3.3",
"fs-extra": "10.0.1",
@@ -38,30 +38,33 @@
"supports-color": "8.1.1"
},
"peerDependencies": {
"blitz": "2.0.0-beta.25",
"blitz": "2.0.0-beta.29",
"next": "*",
"react": "*"
"react": "*",
"tslog": "*"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@testing-library/dom": "8.13.0",
"@testing-library/jest-dom": "5.16.3",
"@testing-library/react": "13.4.0",
"@testing-library/react-hooks": "8.0.1",
"@testing-library/user-event": "13.5.0",
"@types/debug": "4.1.7",
"@types/node": "18.11.9",
"@types/react": "18.0.25",
"@types/react-dom": "17.0.14",
"@types/testing-library__react-hooks": "4.0.0",
"blitz": "2.0.0-beta.25",
"blitz": "2.0.0-beta.29",
"cross-spawn": "7.0.3",
"find-up": "4.1.0",
"next": "13.2.4",
"next": "13.3.0",
"next-router-mock": "0.9.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"resolve-from": "5.0.0",
"ts-jest": "27.1.4",
"tslog": "4.8.2",
"typescript": "^4.8.4",
"unbuild": "0.7.6",
"watch": "1.0.2"

View File

@@ -211,8 +211,9 @@ test("withErrorBoundary HOC", () => {
expect(cleanStack(onErrorComponentStack)).toMatchInlineSnapshot(`
{
"componentStack": "
at ErrorBoundaryRoot
at withRouter
at __vite_ssr_import_4__.withErrorBoundary.FallbackComponent
at ErrorBoundaryRoot
at WithRouterWrapper
at withErrorBoundary",
}
`)

View File

@@ -3,6 +3,7 @@ import {NextRouter, withRouter} from "next/router"
import * as React from "react"
import {RouterContext} from "./router-context"
import _debug from "debug"
import {ExcludeRouterProps} from "next/dist/client/with-router"
const debug = _debug("blitz:errorboundary")
@@ -72,7 +73,9 @@ type ErrorBoundaryState = {error: Error | null}
const initialState: ErrorBoundaryState = {error: null}
const ErrorBoundary = withRouter(
const ErrorBoundary: React.ComponentType<
ExcludeRouterProps<React.PropsWithChildren<ErrorBoundaryProps>>
> = withRouter(
class ErrorBoundaryRoot extends React.Component<
React.PropsWithRef<React.PropsWithChildren<ErrorBoundaryProps>>,
ErrorBoundaryState

View File

@@ -1,41 +1,43 @@
import type {
NextConfig,
GetServerSideProps,
GetServerSidePropsResult,
GetStaticProps,
GetStaticPropsResult,
NextApiRequest,
NextApiResponse,
NextConfig,
} from "next"
import {
AddParameters,
AsyncFunc,
BlitzLogger,
BlitzServerPlugin,
Ctx as BlitzCtx,
FirstParam,
RequestMiddleware,
MiddlewareResponse,
BlitzLogger,
handleRequestWithMiddleware,
initializeLogger,
Simplify,
UnionToIntersection,
isRouteUrlObject,
MiddlewareResponse,
reduceBlitzServerPlugins,
RouteUrlObject,
startWatcher,
stopWatcher,
} from "blitz"
import {handleRequestWithMiddleware, startWatcher, stopWatcher} from "blitz"
import {installWebpackConfig, InstallWebpackConfigOptions, ResolverPathOptions} from "@blitzjs/rpc"
import {
DefaultOptions,
QueryClient,
getQueryKey,
getInfiniteQueryKey,
dehydrate,
getInfiniteQueryKey,
getQueryKey,
installWebpackConfig,
InstallWebpackConfigOptions,
QueryClient,
ResolverPathOptions,
} from "@blitzjs/rpc"
import {IncomingMessage, ServerResponse} from "http"
import {withSuperJsonProps} from "./superjson"
import {ParsedUrlQuery} from "querystring"
import {PreviewData} from "next/types"
import {resolveHref} from "next/dist/shared/lib/router/utils/resolve-href"
import {RouteUrlObject, isRouteUrlObject} from "blitz"
export * from "./index-browser"
@@ -130,10 +132,12 @@ export const setupBlitzServer = <TPlugins extends readonly BlitzServerPlugin<obj
plugins,
onError,
logger,
formatError,
}: {
plugins: TPlugins
onError?: (err: Error) => void
logger?: ReturnType<typeof BlitzLogger>
formatError?: (err: Error) => Error
}) => {
initializeLogger(logger ?? BlitzLogger())
@@ -168,9 +172,9 @@ export const setupBlitzServer = <TPlugins extends readonly BlitzServerPlugin<obj
getClient(),
),
)
} catch (err: any) {
onError?.(err)
throw err
} catch (error: any) {
onError?.(error)
throw formatError?.(error) ?? error
}
}
@@ -197,9 +201,9 @@ export const setupBlitzServer = <TPlugins extends readonly BlitzServerPlugin<obj
getClient(),
),
)
} catch (err: any) {
onError?.(err)
throw err
} catch (error: any) {
onError?.(error)
throw formatError?.(error) ?? error
}
}
@@ -215,7 +219,8 @@ export const setupBlitzServer = <TPlugins extends readonly BlitzServerPlugin<obj
])
} catch (error: any) {
onError?.(error)
return res.status(400).send(error)
const formattedError = formatError?.(error) ?? error
return res.status(400).send(formattedError)
}
}
@@ -225,6 +230,7 @@ export const setupBlitzServer = <TPlugins extends readonly BlitzServerPlugin<obj
export interface BlitzConfig extends NextConfig {
blitz?: {
resolverPath?: ResolverPathOptions
resolversDynamicImport?: boolean
includeRPCFolders?: string[]
customServer?: {
hotReload?: boolean
@@ -256,6 +262,8 @@ export function withBlitz(nextConfig: BlitzConfig = {}): NextConfig {
webpackConfig: config,
webpackRuleOptions: {
resolverPath: nextConfig.blitz?.resolverPath,
resolversDynamicImport:
nextConfig.blitz?.resolversDynamicImport ?? Boolean(process.env.VERCEL),
includeRPCFolders: nextConfig.blitz?.includeRPCFolders,
},
})

View File

@@ -1,5 +1,64 @@
# @blitzjs/rpc
## 2.0.0-beta.29
### Patch Changes
- Updated dependencies [b6b9a1c5a]
- Updated dependencies [61888d1a3]
- blitz@2.0.0-beta.29
## 2.0.0-beta.28
### Patch Changes
- 5166e5e03: (feat) upgrade tslog to v4.8.2
- 2533caf48: Fix return type of `requestMiddlewares` in `RpcServerPlugin`
- c7ac86b85: Fixes enormous memory consumption of the dev server by changing the default import strategy to "require" instead of "import" which in webpack causes multiple chunks to be created for each import.
## Blitz Configuration
To configure this behaviour, you can add the following to your next.config.js:
```js
/**
* @type {import('@blitzjs/next').BlitzConfig}
**/
const config = {
blitz: {
resolversDynamicImport: true,
},
}
```
When `resolversDynamicImport` is set to `true`, the import strategy will be "import" instead of "require".
### On Vercel
If you are using Vercel, `resolversDynamicImport` will be set to `true` by default, since it is better for the separate chunks to be create for serverless lambdas.
- Updated dependencies [5166e5e03]
- blitz@2.0.0-beta.28
## 2.0.0-beta.27
### Minor Changes
- eda14fa8a: Add ability to format the error on the server before returning it to the client.
### Patch Changes
- blitz@2.0.0-beta.27
## 2.0.0-beta.26
### Patch Changes
- e82a79be5: Update the version of next in the new template from 13.2 to 13.3.0
- Updated dependencies [e82a79be5]
- Updated dependencies [38d945a3f]
- blitz@2.0.0-beta.26
## 2.0.0-beta.25
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/rpc",
"version": "2.0.0-beta.25",
"version": "2.0.0-beta.29",
"homepage": "https://blitzjs.com/",
"repository": {
"type": "git",
@@ -37,19 +37,19 @@
},
"peerDependencies": {
"@tanstack/query-core": "4.24.4",
"blitz": "2.0.0-beta.25",
"blitz": "2.0.0-beta.29",
"next": "*",
"react": "*"
},
"devDependencies": {
"@blitzjs/auth": "2.0.0-beta.25",
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/auth": "2.0.0-beta.29",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@tanstack/query-core": "4.24.4",
"@types/debug": "4.1.7",
"@types/react": "18.0.25",
"@types/react-dom": "17.0.14",
"blitz": "2.0.0-beta.25",
"next": "13.2.4",
"blitz": "2.0.0-beta.29",
"next": "13.3.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "^4.8.4",

View File

@@ -1,8 +1,9 @@
import {assert, baseLogger, Ctx, newLine, prettyMs, ResolverConfig} from "blitz"
import {NextApiRequest, NextApiResponse} from "next"
import {deserialize, serialize as superjsonSerialize, parse} from "superjson"
import {deserialize, parse, serialize as superjsonSerialize} from "superjson"
import {resolve} from "path"
import chalk from "chalk"
import {LoaderOptions} from "./server/loader/utils/loader-utils"
// TODO - optimize end user server bundles by not exporting all client stuff here
export * from "./index-browser"
@@ -60,16 +61,11 @@ const loaderClient = resolve(dir, "./loader-client.cjs")
const loaderServer = resolve(dir, "./loader-server.cjs")
const loaderServerResolvers = resolve(dir, "./loader-server-resolvers.cjs")
interface WebpackRuleOptions {
resolverPath: ResolverPathOptions | undefined
includeRPCFolders: string[] | undefined
}
interface WebpackRule {
test: RegExp
use: Array<{
loader: string
options: WebpackRuleOptions
options: LoaderOptions
}>
}
@@ -84,7 +80,7 @@ export interface InstallWebpackConfigOptions {
rules: WebpackRule[]
}
}
webpackRuleOptions: WebpackRuleOptions
webpackRuleOptions: LoaderOptions
}
export function installWebpackConfig({
@@ -149,6 +145,7 @@ async function getResolverMap(): Promise<ResolverFiles | null | undefined> {
interface RpcConfig {
onError?: (error: Error) => void
formatError?: (error: Error) => Error
}
export function rpcHandler(config: RpcConfig) {
@@ -163,7 +160,8 @@ export function rpcHandler(config: RpcConfig) {
const relativeRoutePath = (req.query.blitz as string[])?.join("/")
const routePath = "/" + relativeRoutePath
const log = baseLogger().getChildLogger({
const log = baseLogger().getSubLogger({
name: "blitz-rpc",
prefix: [routePath.replace(/(\/api\/rpc)?\//, "") + "()"],
})
const customChalk = new chalk.Instance({
@@ -219,7 +217,7 @@ export function rpcHandler(config: RpcConfig) {
const startTime = Date.now()
const result = await resolver(data, (res as any).blitzCtx)
const resolverDuration = Date.now() - startTime
log.debug(customChalk.dim("Result:"), result ? result : JSON.stringify(result))
log.info(customChalk.dim("Result:"), result ? result : JSON.stringify(result))
const serializerStartTime = Date.now()
const serializedResult = superjsonSerialize(result)
@@ -241,7 +239,7 @@ export function rpcHandler(config: RpcConfig) {
const serializerDuration = Date.now() - serializerStartTime
const duration = Date.now() - startTime
log.info(
log.debug(
customChalk.dim(
`Finished: resolver:${prettyMs(resolverDuration)} serializer:${prettyMs(
serializerDuration,
@@ -265,7 +263,8 @@ export function rpcHandler(config: RpcConfig) {
error.statusCode = 500
}
const serializedError = superjsonSerialize(error)
const formattedError = config.formatError?.(error) ?? error
const serializedError = superjsonSerialize(formattedError)
res.json({
result: null,

View File

@@ -64,12 +64,14 @@ export async function transformBlitzRpcServer(
extraRpcBasePaths: options?.includeRPCFolders,
})
code += `__internal_addBlitzRpcResolver('${routePath}',() => import('${slash(
const importStrategy = options?.resolversDynamicImport ? "import" : "require"
code += `__internal_addBlitzRpcResolver('${routePath}',() => ${importStrategy}('${slash(
resolverFilePath,
)}'));`
code += "\n"
}
// console.log("NEW CODE", code)
return code
}

View File

@@ -3,8 +3,9 @@ import {posix, sep, win32, join, normalize} from "path"
import {ResolverPathOptions} from "../../../index-server"
export interface LoaderOptions {
resolverPath: ResolverPathOptions
resolverPath?: ResolverPathOptions
includeRPCFolders?: string[]
resolversDynamicImport?: boolean
}
export interface Loader {

View File

@@ -1,9 +1,9 @@
import {createServerPlugin} from "blitz"
import {RequestMiddleware, createServerPlugin} from "blitz"
import {invoke} from "../client/invoke"
export const RpcServerPlugin = createServerPlugin(() => {
return {
requestMiddlewares: [],
requestMiddlewares: [] as RequestMiddleware<any, any, void | Promise<void>>[],
exports: () => ({
invoke,
}),

View File

@@ -1,5 +1,38 @@
# blitz
## 2.0.0-beta.29
### Patch Changes
- b6b9a1c5a: Fix Next-Auth integration: `Unable to use next-auth with provider: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]`
- 61888d1a3: Fix log formatting to not show the path of blitz rpc
- Updated dependencies [7aef610d8]
- @blitzjs/generator@2.0.0-beta.29
## 2.0.0-beta.28
### Patch Changes
- 5166e5e03: (feat) upgrade tslog to v4.8.2
- Updated dependencies [5166e5e03]
- @blitzjs/generator@2.0.0-beta.28
## 2.0.0-beta.27
### Patch Changes
- Updated dependencies [d814c2d2d]
- @blitzjs/generator@2.0.0-beta.27
## 2.0.0-beta.26
### Patch Changes
- e82a79be5: Update the version of next in the new template from 13.2 to 13.3.0
- 38d945a3f: The issue is that the version provided, "13.2", is not a valid SemVer version. A valid SemVer version must have three components: major, minor, and patch (e.g., "13.2.0").
- Updated dependencies [e82a79be5]
- @blitzjs/generator@2.0.0-beta.26
## 2.0.0-beta.25
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "blitz",
"version": "2.0.0-beta.25",
"version": "2.0.0-beta.29",
"homepage": "https://blitzjs.com/",
"repository": {
"type": "git",
@@ -30,7 +30,7 @@
"blitz": "bin/blitz"
},
"dependencies": {
"@blitzjs/generator": "2.0.0-beta.25",
"@blitzjs/generator": "2.0.0-beta.29",
"@mrleebo/prisma-ast": "0.2.6",
"@types/global-agent": "2.1.1",
"arg": "5.0.1",
@@ -76,11 +76,11 @@
"tar": "6.1.11",
"ts-node": "10.9.1",
"tsconfig-paths": "4.0.0",
"tslog": "3.3.4",
"tslog": "4.8.2",
"watchpack": "2.1.1"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.25",
"@blitzjs/config": "workspace:2.0.0-beta.29",
"@types/cookie": "0.4.1",
"@types/cross-spawn": "6.0.2",
"@types/debug": "4.1.7",

View File

@@ -45,7 +45,7 @@ const pipeline = promisify(Stream.pipeline)
const got = async (url: string) => {
return require("got")(url).catch((e: any) => {
if (e.response.statusCode === 403) {
baseLogger({displayDateTime: false}).error(e.response.body)
baseLogger().error(e.response.body)
} else {
return e
}
@@ -264,7 +264,7 @@ const install: CliCommand = async () => {
if (!(await isUrlValid(packageJsonPath))) {
debug("Url is invalid for ", packageJsonPath)
baseLogger({displayDateTime: false}).error(`Could not find recipe "${args._[1]}"\n`)
baseLogger().error(`Could not find recipe "${args._[1]}"\n`)
console.log(`${chalk.bold("Please provide one of the following:")}
1. The name of a recipe to install (e.g. "tailwind")

View File

@@ -16,9 +16,11 @@ export const codegenTasks = async () => {
*/
const nextDir = await resolveCwd("next")
const nextClientIndex = join(nextDir, "../..", "client", "index.js")
console.log(nextClientIndex)
const readFile = await fs.readFile(nextClientIndex)
const packageJson = await getPackageJson()
const nextVersion = packageJson.dependencies.next
const version = packageJson.dependencies.next
const nextVersion = semver.clean(version, {loose: true}) || semver.valid(semver.coerce(version))
if (nextVersion && /^([~^])?12/.test(nextVersion)) {
const updatedFile = readFile
@@ -38,15 +40,24 @@ export const codegenTasks = async () => {
)
await fs.writeFile(nextClientIndex, updatedFile)
log.success("Next.js was successfully patched with a React Suspense fix")
} else if (nextVersion && semver.satisfies(nextVersion, ">=13.2")) {
} else if (nextVersion && semver.satisfies(nextVersion, "13.1 - 13.3.0")) {
const updatedFile = readFile
.toString()
.replace(
/_onRecoverableError\.default/,
/_onRecoverableError\.default$/gm,
`(err) => (err.toString().includes("DYNAMIC_SERVER_USAGE") || err.toString().includes("could not finish this Suspense boundary") || err.toString().includes("Minified React error #419")) ? null : _onRecoverableError.default(err)`,
)
await fs.writeFile(nextClientIndex, updatedFile)
log.success("Next.js was successfully patched with a React Suspense fix")
} else if (nextVersion && semver.satisfies(nextVersion, ">=13.3.1")) {
const updatedFile = readFile
.toString()
.replace(
/_onrecoverableerror\.default$/gm,
`(err) => (err.toString().includes("DYNAMIC_SERVER_USAGE") || err.toString().includes("could not finish this Suspense boundary") || err.toString().includes("Minified React error #419")) ? null : _onrecoverableerror.default(err)`,
)
await fs.writeFile(nextClientIndex, updatedFile)
log.success("Next.js was successfully patched with a React Suspense fix")
}
} catch (err) {
log.error(JSON.stringify(err, null, 2))

View File

@@ -1,13 +1,11 @@
import {join, dirname} from "path"
import {join} from "path"
import os from "os"
import {promises} from "fs"
const readFile = promises.readFile
import {outputFile, readdir} from "fs-extra"
import findUp from "find-up"
import resolveFrom from "resolve-from"
import {outputFile, readdir, readFile} from "fs-extra"
import Watchpack from "watchpack"
import {isInternalBlitzMonorepoDevelopment} from "./helpers"
import {findNodeModulesRoot} from "./find-node-modules"
const debug = require("debug")("blitz")
export const CONFIG_FILE = ".blitz.config.compiled.js"
export const NEXT_CONFIG_FILE = "next.config.js"
export const PHASE_PRODUCTION_SERVER = "phase-production-server"
@@ -160,7 +158,7 @@ export const loadConfig = (pagesDir: string) => {
// eslint-disable-next-line no-eval -- block webpack from following this module path
userConfigModule = eval("require")(path)
} catch {
console.log("Did not find custom config file")
debug("Did not find custom config file")
// In case user does not have custom config
userConfigModule = {}
}

View File

@@ -41,11 +41,9 @@ export class RecipeExecutor<Options extends RecipeMeta> {
{exitOnCtrlC: false},
)
await waitUntilExit()
baseLogger({displayDateTime: false, displayLogLevel: false}).info(
`\n🎉 The ${this.options.name} recipe has been installed!\n`,
)
baseLogger().info(`\n🎉 The ${this.options.name} recipe has been installed!\n`)
} catch (e) {
baseLogger({displayDateTime: false}).error(e as any)
baseLogger().error(e as any)
return
}
}

View File

@@ -18,14 +18,28 @@ function getBlitzPath(type: string) {
}
}
function getAppSourceDir() {
const srcPath = "src/pages"
const srcDir = fs.existsSync(path.resolve(srcPath))
if (srcDir) {
return "src"
} else {
return "app"
}
}
function findPageDir() {
const srcPagePath = `src/pages`
const srcPage = fs.existsSync(path.resolve(srcPagePath))
const srcPage = getAppSourceDir()
if (srcPage) {
return srcPagePath
} else {
return `pages`
switch (srcPage) {
case "src": {
return srcPagePath
}
default: {
return `pages`
}
}
}
@@ -36,6 +50,9 @@ export const paths = {
app() {
return `${findPageDir()}/_app${ext(true)}`
},
appSrcDirectory() {
return getAppSourceDir()
},
blitzServer() {
return getBlitzPath("server")
},

View File

@@ -1,18 +1,18 @@
import {ISettingsParam, Logger, TLogLevelName} from "tslog"
import {ILogObj, ISettingsParam, Logger, IMeta} from "tslog"
import c from "chalk"
import {Table} from "console-table-printer"
import ora from "ora"
import readline from "readline"
export type BlitzLoggerSettings = ISettingsParam
export type BlitzLogLevel = TLogLevelName
export type BlitzLoggerSettings = ISettingsParam<ILogObj>
export type BlitzLogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal"
declare namespace globalThis {
let _blitz_baseLogger: Logger
let _blitz_baseLogger: Logger<ILogObj>
let _blitz_logLevel: BlitzLogLevel
}
export const baseLogger = (options: BlitzLoggerSettings = {}): Logger => {
export const baseLogger = (options: BlitzLoggerSettings = {}): Logger<ILogObj> => {
if (globalThis._blitz_baseLogger) return globalThis._blitz_baseLogger
globalThis._blitz_baseLogger = BlitzLogger(options)
@@ -22,34 +22,18 @@ export const baseLogger = (options: BlitzLoggerSettings = {}): Logger => {
export const BlitzLogger = (settings: BlitzLoggerSettings = {}) => {
const baseLogger = new Logger({
minLevel: "info",
type: "pretty",
dateTimePattern:
process.env.NODE_ENV === "production"
? "year-month-day hour:minute:second.millisecond"
: "hour:minute:second.millisecond",
displayFunctionName: false,
displayFilePath: "hidden",
displayRequestId: false,
dateTimeTimezone:
process.env.NODE_ENV === "production"
? "utc"
: Intl.DateTimeFormat().resolvedOptions().timeZone,
prettyInspectHighlightStyles: {
name: "yellow",
number: "blue",
bigint: "blue",
boolean: "blue",
},
prettyLogTimeZone: process.env.NODE_ENV === "production" ? "UTC" : "local",
maskValuesOfKeys: ["password", "passwordConfirmation", "currentPassword"],
exposeErrorCodeFrame: process.env.NODE_ENV !== "production",
type: process.env.NODE_ENV === "production" ? "json" : "pretty",
prettyLogTemplate:
"{{yyyy}}.{{mm}}.{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}\t{{logLevelName}}\t[{{name}}]\t",
...settings,
})
return baseLogger
}
export const initializeLogger = (logger: Logger) => {
export const initializeLogger = (logger: Logger<ILogObj>) => {
globalThis._blitz_baseLogger = logger
}

View File

@@ -1,5 +1,5 @@
import {IncomingMessage, ServerResponse} from "http"
import {compose, Ctx, RequestMiddleware, MiddlewareNext, MiddlewareResponse} from "./index-server"
import {compose, Ctx, MiddlewareNext, MiddlewareResponse, RequestMiddleware} from "./index-server"
export async function handleRequestWithMiddleware<
Req extends IncomingMessage = IncomingMessage,

View File

@@ -1,5 +1,40 @@
# @blitzjs/codemod
## 2.0.0-beta.29
### Patch Changes
- Updated dependencies [7aef610d8]
- Updated dependencies [b6b9a1c5a]
- Updated dependencies [61888d1a3]
- @blitzjs/generator@2.0.0-beta.29
- blitz@2.0.0-beta.29
## 2.0.0-beta.28
### Patch Changes
- Updated dependencies [5166e5e03]
- blitz@2.0.0-beta.28
- @blitzjs/generator@2.0.0-beta.28
## 2.0.0-beta.27
### Patch Changes
- Updated dependencies [d814c2d2d]
- @blitzjs/generator@2.0.0-beta.27
- blitz@2.0.0-beta.27
## 2.0.0-beta.26
### Patch Changes
- Updated dependencies [e82a79be5]
- Updated dependencies [38d945a3f]
- blitz@2.0.0-beta.26
- @blitzjs/generator@2.0.0-beta.26
## 2.0.0-beta.25
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/codemod",
"version": "2.0.0-beta.25",
"version": "2.0.0-beta.29",
"scripts": {
"build": "unbuild",
"dev": "watch unbuild src --wait=0.2",
@@ -25,9 +25,9 @@
"@babel/plugin-proposal-class-properties": "7.17.12",
"@babel/plugin-syntax-jsx": "7.17.12",
"@babel/plugin-syntax-typescript": "7.17.12",
"@blitzjs/generator": "2.0.0-beta.25",
"@blitzjs/generator": "2.0.0-beta.29",
"arg": "5.0.1",
"blitz": "2.0.0-beta.25",
"blitz": "2.0.0-beta.29",
"chalk": "^4.1.0",
"cross-spawn": "7.0.3",
"debug": "4.3.3",

View File

@@ -1,5 +1,13 @@
# @blitzjs/config
## 2.0.0-beta.29
## 2.0.0-beta.28
## 2.0.0-beta.27
## 2.0.0-beta.26
## 2.0.0-beta.25
## 2.0.0-beta.24

View File

@@ -1,7 +1,7 @@
{
"name": "@blitzjs/config",
"private": true,
"version": "2.0.0-beta.25",
"version": "2.0.0-beta.29",
"license": "MIT",
"dependencies": {
"@typescript-eslint/eslint-plugin": "5.42.1",

View File

@@ -1,5 +1,29 @@
# @blitzjs/generator
## 2.0.0-beta.29
### Patch Changes
- 7aef610d8: Make Next.js version stick to 13.4.5 when generating a new app
## 2.0.0-beta.28
### Patch Changes
- 5166e5e03: (feat) upgrade tslog to v4.8.2
## 2.0.0-beta.27
### Patch Changes
- d814c2d2d: fix: add missing key prop to LabelSelectField
## 2.0.0-beta.26
### Patch Changes
- e82a79be5: Update the version of next in the new template from 13.2 to 13.3.0
## 2.0.0-beta.25
## 2.0.0-beta.24

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/generator",
"version": "2.0.0-beta.25",
"version": "2.0.0-beta.29",
"homepage": "https://blitzjs.com/",
"repository": {
"type": "git",
@@ -48,13 +48,13 @@
"prettier": "^2.7.1",
"recast": "0.20.5",
"supports-color": "8.1.1",
"tslog": "3.3.4",
"tslog": "4.8.2",
"username": "5.1.0",
"vinyl": "2.2.1",
"zod": "3.20.2"
},
"devDependencies": {
"@blitzjs/config": "2.0.0-beta.25",
"@blitzjs/config": "2.0.0-beta.29",
"@juanm04/cpx": "2.0.1",
"@types/babel__core": "7.1.19",
"@types/diff": "5.0.2",

View File

@@ -90,8 +90,8 @@ export class AppGenerator extends Generator<AppGeneratorOptions> {
gitInitSuccessful = initResult.status === 0
if (!gitInitSuccessful) {
baseLogger({displayDateTime: false}).warn("Failed to run git init.")
baseLogger({displayDateTime: false}).warn(
baseLogger().warn("Failed to run git init.")
baseLogger().warn(
"Find out more about how to install git here: https://git-scm.com/downloads.",
)
}

View File

@@ -1,4 +1,4 @@
import {ISettingsParam, Logger} from "tslog"
import {ILogObj, ISettingsParam, Logger} from "tslog"
import c from "chalk"
import {Table} from "console-table-printer"
import ora from "ora"
@@ -8,7 +8,7 @@ import {defaultConfig} from "./default-config"
// eslint-disable-next-line
declare module globalThis {
let _blitz_baseLogger: Logger
let _blitz_baseLogger: Logger<ILogObj>
let _blitz_logLevel: LogLevel
}
@@ -103,7 +103,7 @@ export const newline = () => {
}
}
export const baseLogger = (options?: ISettingsParam): Logger => {
export const baseLogger = (options?: ISettingsParam<ILogObj>): Logger<ILogObj> => {
if (globalThis._blitz_baseLogger) return globalThis._blitz_baseLogger
let config
@@ -114,28 +114,14 @@ export const baseLogger = (options?: ISettingsParam): Logger => {
}
globalThis._blitz_baseLogger = new Logger({
minLevel: config.log?.level || "info",
minLevel: config.log?.level || 3,
type: config.log?.type || "pretty",
dateTimePattern:
prettyLogTemplate:
process.env.NODE_ENV === "production"
? "year-month-day hour:minute:second.millisecond"
: "hour:minute:second.millisecond",
displayFunctionName: false,
displayFilePath: "hidden",
displayRequestId: false,
dateTimeTimezone:
process.env.NODE_ENV === "production"
? "utc"
: Intl.DateTimeFormat().resolvedOptions().timeZone,
prettyInspectHighlightStyles: {
name: "yellow",
number: "blue",
bigint: "blue",
boolean: "blue",
},
colorizePrettyLogs: process.env.FORCE_COLOR === "0" ? false : true,
maskValuesOfKeys: ["password", "passwordConfirmation"],
exposeErrorCodeFrame: process.env.NODE_ENV !== "production",
? "{{yyyy}}-{{mm}}-{{dd}} {{hh}}:{{MM}}:{{ss}}:{{ms}}"
: "{{hh}}:{{MM}}:{{ss}}:{{ms}}",
prettyLogTimeZone: process.env.NODE_ENV === "production" ? "UTC" : "local",
maskValuesOfKeys: ["password", "passwordConfirmation", "currentPassword"],
...options,
})

View File

@@ -27,7 +27,7 @@ export const LabeledSelectField = forwardRef<HTMLSelectElement, LabeledSelectFie
<label>
{label}
<select {...input} disabled={submitting} {...props} ref={ref}>
{options && options.map((value) => <option value={value.id}>{value[name]}</option>)}
{options && options.map((value) => <option key={value.id} value={value.id}>{value[name]}</option>)}
</select>
</label>
@@ -57,4 +57,4 @@ export const LabeledSelectField = forwardRef<HTMLSelectElement, LabeledSelectFie
}
)
export default LabeledSelectField
export default LabeledSelectField

View File

@@ -27,7 +27,7 @@
"@blitzjs/rpc": "latest",
"@prisma/client": "4.6.1",
"blitz": "latest",
"next": "13.2",
"next": "13.4.5",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",

View File

@@ -27,7 +27,7 @@
"@blitzjs/rpc": "latest",
"@prisma/client": "4.6.1",
"blitz": "latest",
"next": "13.2",
"next": "13.4.5",
"prisma": "4.6.1",
"react": "18.2.0",
"react-dom": "18.2.0",

View File

@@ -20,7 +20,7 @@
"dependencies": {
"@blitzjs/next": "latest",
"blitz": "latest",
"next": "13.2",
"next": "13.4.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"ts-node": "10.9.1"

View File

@@ -20,7 +20,7 @@
"dependencies": {
"@blitzjs/next": "latest",
"blitz": "latest",
"next": "13.2",
"next": "13.4.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"ts-node": "10.9.1"

View File

@@ -25,7 +25,7 @@
"@typescript-eslint/parser": "5.9.1"
},
"devDependencies": {
"@blitzjs/config": "2.0.0-beta.25",
"@blitzjs/config": "2.0.0-beta.29",
"@types/react": "18.0.25",
"@types/react-dom": "17.0.14",
"react": "18.2.0",

9057
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -23,7 +23,7 @@
},
"homepage": "https://github.com/blitz-js/blitz#readme",
"dependencies": {
"blitz": "2.0.0-beta.25",
"blitz": "2.0.0-beta.29",
"jscodeshift": "0.13.0"
},
"devDependencies": {

View File

@@ -22,7 +22,7 @@
},
"homepage": "https://github.com/blitz-js/blitz#readme",
"dependencies": {
"blitz": "2.0.0-beta.25",
"blitz": "2.0.0-beta.29",
"jscodeshift": "0.13.0"
},
"devDependencies": {

View File

@@ -1,5 +1,4 @@
import {addImport, paths, Program, RecipeBuilder} from "blitz/installer"
import type {NodePath} from "ast-types/lib/node-path"
import j from "jscodeshift"
function wrapComponentWithBumbagProvider(program: Program) {

View File

@@ -24,7 +24,7 @@
},
"homepage": "https://github.com/blitz-js/blitz#readme",
"dependencies": {
"blitz": "2.0.0-beta.25",
"blitz": "2.0.0-beta.29",
"jscodeshift": "0.13.0"
},
"devDependencies": {

View File

@@ -139,7 +139,7 @@ export default RecipeBuilder()
stepId: "updateLabeledTextField",
stepName: "Update the `LabeledTextField` with Chakra UI's `Input` component",
explanation: `The LabeledTextField component uses Chakra UI's input component`,
singleFileSearch: "src/core/components/LabeledTextField.tsx",
singleFileSearch: `${paths.appSrcDirectory()}/core/components/LabeledTextField.tsx`,
transform(program) {
// Add ComponentPropsWithoutRef import
program.find(j.ImportDeclaration, {source: {value: "react"}}).forEach((path) => {

View File

@@ -24,7 +24,7 @@
},
"homepage": "https://github.com/blitz-js/blitz#readme",
"dependencies": {
"blitz": "2.0.0-beta.25",
"blitz": "2.0.0-beta.29",
"jscodeshift": "0.13.0"
},
"devDependencies": {

View File

@@ -22,7 +22,7 @@
},
"homepage": "https://github.com/blitz-js/blitz#readme",
"dependencies": {
"blitz": "2.0.0-beta.25",
"blitz": "2.0.0-beta.29",
"jscodeshift": "0.13.0"
},
"devDependencies": {

Some files were not shown because too many files have changed in this diff Show More