Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(server-store): Alias imports for getting request details to @redwoodjs/web/request #10904

Merged
merged 7 commits into from
Jul 6, 2024
Merged
6 changes: 6 additions & 0 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
"types": "./dist/components/ServerInject.d.ts",
"default": "./dist/components/ServerInject.js"
},
"./request": {
"require": "./dist/cjs/server/request.js",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this so that typescript doesn't complain in projects, but in reality the CJS version should never be used.

"import": "./dist/server/request.js",
"types": "./dist/server/request.d.ts"
},
"./dist/components/*": {
"require": "./dist/cjs/components/*.js",
"import": "./dist/components/*.js"
Expand Down Expand Up @@ -96,6 +101,7 @@
"@apollo/client": "3.9.9",
"@babel/runtime-corejs3": "7.24.5",
"@redwoodjs/auth": "workspace:*",
"@redwoodjs/server-store": "workspace:*",
"core-js": "3.37.1",
"graphql": "16.8.1",
"graphql-sse": "2.5.3",
Expand Down
13 changes: 13 additions & 0 deletions packages/web/src/server/request.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This just proxies the `@redwoodjs/server-store` package.
// Our builds are specifically configured _not_ to bundle server-store

// This is mainly so that the import looks clean to the user e.g.
// import { getRequestCookies } from '@redwoodjs/web/request'
// server store doesn't make sense outside the framework

export {
getRequestCookies,
getRequestHeaders,
getLocation,
getAuthState,
} from '@redwoodjs/server-store'
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8751,6 +8751,7 @@ __metadata:
"@babel/runtime-corejs3": "npm:7.24.5"
"@redwoodjs/auth": "workspace:*"
"@redwoodjs/framework-tools": "workspace:*"
"@redwoodjs/server-store": "workspace:*"
"@rollup/plugin-babel": "npm:6.0.4"
"@testing-library/jest-dom": "npm:6.4.6"
"@testing-library/react": "npm:14.3.1"
Expand Down
Loading