From e66e2b88fb262d54dcbdd7f38003773e74237965 Mon Sep 17 00:00:00 2001 From: Pedro Cattori Date: Mon, 24 Jun 2024 21:28:51 -0400 Subject: [PATCH] test: upgrade vite-env-only --- .../helpers/vite-template/package.json | 2 +- integration/helpers/vite.ts | 4 +- integration/vite-dot-server-test.ts | 6 +- package.json | 2 +- pnpm-lock.yaml | 65 +++++++------------ 5 files changed, 30 insertions(+), 49 deletions(-) diff --git a/integration/helpers/vite-template/package.json b/integration/helpers/vite-template/package.json index 66c3c7d5b1..711f634b6b 100644 --- a/integration/helpers/vite-template/package.json +++ b/integration/helpers/vite-template/package.json @@ -30,7 +30,7 @@ "eslint": "^8.38.0", "typescript": "^5.1.6", "vite": "^5.1.0", - "vite-env-only": "^2.0.0", + "vite-env-only": "^3.0.1", "vite-tsconfig-paths": "^4.2.1" }, "engines": { diff --git a/integration/helpers/vite.ts b/integration/helpers/vite.ts index f41852c1a2..4b485384de 100644 --- a/integration/helpers/vite.ts +++ b/integration/helpers/vite.ts @@ -44,14 +44,14 @@ export const viteConfig = { return dedent` import { vitePlugin as reactRouter } from "@react-router/dev"; - import envOnly from "vite-env-only"; + import { envOnlyMacros } from "vite-env-only"; import tsconfigPaths from "vite-tsconfig-paths"; export default { ${await viteConfig.server(args)} plugins: [ reactRouter(${JSON.stringify(pluginOptions)}), - envOnly(), + envOnlyMacros(), tsconfigPaths() ], }; diff --git a/integration/vite-dot-server-test.ts b/integration/vite-dot-server-test.ts index db26c4bab9..81262f70af 100644 --- a/integration/vite-dot-server-test.ts +++ b/integration/vite-dot-server-test.ts @@ -218,18 +218,18 @@ test.describe("Vite / server-only escape hatch", async () => { let files: Files = async ({ port }) => ({ "vite.config.ts": dedent` import { vitePlugin as reactRouter } from "@react-router/dev"; - import envOnly from "vite-env-only"; + import { envOnlyMacros } from "vite-env-only"; import tsconfigPaths from "vite-tsconfig-paths"; export default { ${await viteConfig.server({ port })} - plugins: [reactRouter(), envOnly(), tsconfigPaths()], + plugins: [reactRouter(), envOnlyMacros(), tsconfigPaths()], } `, "app/utils.server.ts": serverOnlyModule, "app/.server/utils.ts": serverOnlyModule, "app/routes/_index.tsx": ` - import { serverOnly$ } from "vite-env-only"; + import { serverOnly$ } from "vite-env-only/macros"; import { serverOnly as serverOnlyFile } from "~/utils.server"; import serverOnlyDir from "~/.server/utils"; diff --git a/package.json b/package.json index e2a990649e..49e32c14f8 100644 --- a/package.json +++ b/package.json @@ -120,7 +120,7 @@ "unified": "^10.1.2", "unist-util-remove": "^3.1.0", "vite": "^5.1.0", - "vite-env-only": "^2.0.0", + "vite-env-only": "^3.0.1", "vite-tsconfig-paths": "^4.2.2", "wait-on": "^7.0.1" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 250e06d703..1c27d8de0f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -257,10 +257,10 @@ importers: version: 3.1.1 vite: specifier: ^5.1.0 - version: 5.1.3 + version: 5.1.3(@types/node@18.19.26) vite-env-only: - specifier: ^2.0.0 - version: 2.2.1 + specifier: ^3.0.1 + version: 3.0.1(vite@5.1.3) vite-tsconfig-paths: specifier: ^4.2.2 version: 4.3.2(typescript@5.4.5)(vite@5.1.3) @@ -477,8 +477,8 @@ importers: specifier: ^5.1.0 version: 5.1.3(@types/node@18.19.26) vite-env-only: - specifier: ^2.0.0 - version: 2.2.1 + specifier: ^3.0.1 + version: 3.0.1(vite@5.1.3) vite-tsconfig-paths: specifier: ^4.2.1 version: 4.3.2(typescript@5.1.6)(vite@5.1.3) @@ -6074,6 +6074,16 @@ packages: dequal: 2.0.3 dev: false + /babel-dead-code-elimination@1.0.1: + resolution: {integrity: sha512-QD6IAGZU/Qd7qJJPptnPVGRl9SnK9IdowcIjOcxVKbfB70chvCXRaV2BOgxpVckQud3CppYoI6QA+/cfdBGAMA==} + dependencies: + '@babel/core': 7.24.3 + '@babel/parser': 7.24.1 + '@babel/traverse': 7.24.1 + '@babel/types': 7.24.0 + transitivePeerDependencies: + - supports-color + /babel-jest@29.7.0(@babel/core@7.22.9): resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -13325,14 +13335,19 @@ packages: vfile-message: 4.0.2 dev: false - /vite-env-only@2.2.1: - resolution: {integrity: sha512-yXNRBNf+XiJeebR/pTEjf0wGd9foJ7WbmFpUg8DtwIuTfEB/nyqZDJWJDt3VRNOUYvzgOGGMLB0VyNjBM8evXw==} + /vite-env-only@3.0.1(vite@5.1.3): + resolution: {integrity: sha512-sOfgbVoVJdcZacuQC1+vsXyp3uBB/j9NgO22357KHsbFiBZuUeG/zqyk8Anl1aqfaSQcqp5qAqnLoyBBHTVsJg==} + peerDependencies: + vite: '*' dependencies: '@babel/core': 7.24.3 '@babel/generator': 7.24.1 '@babel/parser': 7.24.1 '@babel/traverse': 7.24.1 '@babel/types': 7.24.0 + babel-dead-code-elimination: 1.0.1 + micromatch: 4.0.5 + vite: 5.1.3(@types/node@18.19.26) transitivePeerDependencies: - supports-color @@ -13383,45 +13398,11 @@ packages: debug: 4.3.4 globrex: 0.1.2 tsconfck: 3.0.3(typescript@5.4.5) - vite: 5.1.3 + vite: 5.1.3(@types/node@18.19.26) transitivePeerDependencies: - supports-color - typescript - /vite@5.1.3: - resolution: {integrity: sha512-UfmUD36DKkqhi/F75RrxvPpry+9+tTkrXfMNZD+SboZqBCMsxKtO52XeGzzuh7ioz+Eo/SYDBbdb0Z7vgcDJew==} - engines: {node: ^18.0.0 || >=20.0.0} - hasBin: true - peerDependencies: - '@types/node': ^18.0.0 || >=20.0.0 - less: '*' - lightningcss: ^1.21.0 - sass: '*' - stylus: '*' - sugarss: '*' - terser: ^5.4.0 - peerDependenciesMeta: - '@types/node': - optional: true - less: - optional: true - lightningcss: - optional: true - sass: - optional: true - stylus: - optional: true - sugarss: - optional: true - terser: - optional: true - dependencies: - esbuild: 0.19.12 - postcss: 8.4.38 - rollup: 4.13.1 - optionalDependencies: - fsevents: 2.3.3 - /vite@5.1.3(@types/node@18.19.26): resolution: {integrity: sha512-UfmUD36DKkqhi/F75RrxvPpry+9+tTkrXfMNZD+SboZqBCMsxKtO52XeGzzuh7ioz+Eo/SYDBbdb0Z7vgcDJew==} engines: {node: ^18.0.0 || >=20.0.0}