rsnext/packages/next/server
Gal Schlezinger e69500462d
middlewares: limit process.env to inferred usage (#33186)
Production middlewares will only expose env vars that are statically analyzable, as mentioned here: https://nextjs.org/docs/api-reference/next/server#how-do-i-access-environment-variables

This creates some incompatibility with `next dev` and `next start`, where all `process.env` data is shared and can lead to unexpected behavior in runtime.

This PR fixes it by limiting the data in `process.env` with the inferred env vars from the code usage. I believe the test speaks for itself 🕺 

<!--
## 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 `yarn lint`
-->
2022-01-12 13:09:24 +00:00
..
dev Add util for normalizing errors (#33159) 2022-01-11 14:40:03 -06:00
lib Pre-compile more dependencies continued (#32679) 2021-12-21 16:13:45 +01:00
web middlewares: limit process.env to inferred usage (#33186) 2022-01-12 13:09:24 +00:00
accept-header.ts Implement Middleware RFC (#30081) 2021-10-20 17:52:11 +00:00
api-utils.ts Pre-compile more dependencies (#32627) 2021-12-20 14:01:35 +01:00
base-server.ts middlewares: limit process.env to inferred usage (#33186) 2022-01-12 13:09:24 +00:00
config-shared.ts Remove future.strictPostcssConfiguration config (#32098) 2021-12-03 13:25:05 -06:00
config-utils.ts Remove webpack 4 support (#29660) 2021-10-06 17:40:01 +02:00
config.ts Don't swallow test failures caused by POSIX signals (#32688) 2021-12-21 12:52:07 -06:00
crypto-utils.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
denormalize-page-path.ts Fix dynamic routes with pages under index folder (#32440) 2021-12-13 20:36:31 +00:00
font-utils.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
get-page-files.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
get-route-from-entrypoint.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
htmlescape.ts Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
image-config.ts Change AVIF to opt-in via configuration (#30180) 2021-10-22 21:08:03 +00:00
image-optimizer.ts Pre-compile more dependencies continued (#32679) 2021-12-21 16:13:45 +01:00
incremental-cache.ts Move fs API for inc cache to node server (#32604) 2021-12-17 22:56:26 +00:00
load-components.ts Add new target for middleware (#30299) 2021-10-26 18:50:56 +02:00
next-server.ts Move fs API for inc cache to node server (#32604) 2021-12-17 22:56:26 +00:00
next.ts Add port and hostname options to Next Server (#31858) 2021-11-28 16:48:43 +00:00
node-polyfill-fetch.js Add next.config.js option to override default keepAlive (#27709) 2021-08-03 00:38:42 +00:00
normalize-page-path.ts Fix dynamic routes with pages under index folder (#32440) 2021-12-13 20:36:31 +00:00
optimize-amp.ts Move next-server directory files to server directory (#26756) 2021-06-30 13:44:40 +02:00
render-result.ts Add new target for middleware (#30299) 2021-10-26 18:50:56 +02:00
render.tsx Bust cache for RSC in each render (#32710) 2021-12-21 23:37:23 +00:00
request-meta.ts Fix middleware i18n rewrites (#31174) 2021-11-09 01:28:39 +00:00
require.ts middlewares: limit process.env to inferred usage (#33186) 2022-01-12 13:09:24 +00:00
response-cache.ts fix: ensure revalidation error is logged from response-cache (#32657) 2022-01-05 19:40:04 +00:00
router.ts Fix basePath replacing server-side and normalizeLocalePath() when path is empty string (#30978) 2021-11-15 17:33:21 +00:00
send-payload.ts Pre-compile more dependencies (#32627) 2021-12-20 14:01:35 +01:00
serve-static.ts Add support for AVIF to next/image (#29683) 2021-10-11 23:17:47 +00:00
utils.ts Add detection for Google-PageRenderer bot (#31521) 2021-11-17 03:49:37 +00:00