From 0e094ef131cebb823c8636ea7bf904a2727d79b1 Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sat, 3 Feb 2024 18:49:06 +1100 Subject: [PATCH 01/13] bump Jest and Vitest --- package.json | 6 +- pnpm-lock.yaml | 715 ++++++++++++++++++++++++++++++++----------------- 2 files changed, 468 insertions(+), 253 deletions(-) diff --git a/package.json b/package.json index e91b822a..1ae098fe 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "start-site": "pnpm --filter=site start", "build-site": "pnpm --filter=site build", "test:unit": "pnpm test:jest && pnpm test:vitest", - "test:jest": "jest", + "test:jest": "NODE_OPTIONS=--experimental-vm-modules jest", "test:vitest": "vitest --watch=false", "test:playwright": "NODE_OPTIONS=--no-experimental-fetch playwright test", "format": "prettier --write .", @@ -42,7 +42,7 @@ "@vanilla-extract/jest-transform": "*", "babel-jest": "^27.3.1", "fast-glob": "^3.2.7", - "jest": "^29.3.1", + "jest": "^29.7.0", "jest-environment-jsdom": "^29.3.1", "prettier": "^2.8.8", "resolve.exports": "^1.1.0", @@ -51,7 +51,7 @@ "rollup-plugin-node-externals": "^5.0.0", "ts-node": "^10.0.0", "typescript": "^4.9.4", - "vitest": "^1.1.0" + "vitest": "^1.2.2" }, "preconstruct": { "___experimentalFlags_WILL_CHANGE_IN_PATCH": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3e1f679d..b95ce383 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -65,8 +65,8 @@ importers: specifier: ^3.2.7 version: 3.3.2 jest: - specifier: ^29.3.1 - version: 29.4.3(@types/node@20.9.5)(ts-node@10.9.1) + specifier: ^29.7.0 + version: 29.7.0(@types/node@20.9.5)(ts-node@10.9.1) jest-environment-jsdom: specifier: ^29.3.1 version: 29.4.3 @@ -92,8 +92,8 @@ importers: specifier: ^4.9.4 version: 4.9.4 vitest: - specifier: ^1.1.0 - version: 1.1.0(@types/node@20.9.5) + specifier: ^1.2.2 + version: 1.2.2(@types/node@20.9.5) examples/next: dependencies: @@ -142,7 +142,7 @@ importers: version: 9.1.3(@babel/core@7.20.7)(webpack@5.90.0) css-loader: specifier: ^6.9.1 - version: 6.9.1(webpack@5.90.0) + version: 6.10.0(webpack@5.90.0) html-webpack-plugin: specifier: ^5.3.1 version: 5.5.0(webpack@5.90.0) @@ -615,7 +615,7 @@ importers: version: 8.1.1(webpack@5.90.0) css-loader: specifier: ^6.9.1 - version: 6.9.1(webpack@5.90.0) + version: 6.10.0(webpack@5.90.0) csstype: specifier: ^3.0.7 version: 3.0.10 @@ -732,7 +732,7 @@ importers: version: 9.1.3(@babel/core@7.20.7)(webpack@5.90.0) css-loader: specifier: ^6.9.1 - version: 6.9.1(webpack@5.90.0) + version: 6.10.0(webpack@5.90.0) cssnano: specifier: ^5.1.15 version: 5.1.15(postcss@8.4.33) @@ -2731,20 +2731,20 @@ packages: resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} engines: {node: '>=8'} - /@jest/console@29.4.3: - resolution: {integrity: sha512-W/o/34+wQuXlgqlPYTansOSiBnuxrTv61dEVkA6HNmpcgHLUjfaUbdqt6oVvOzaawwo9IdW9QOtMgQ1ScSZC4A==} + /@jest/console@29.7.0: + resolution: {integrity: sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@jest/types': 29.4.3 + '@jest/types': 29.6.3 '@types/node': 20.9.5 chalk: 4.1.2 - jest-message-util: 29.4.3 - jest-util: 29.4.3 + jest-message-util: 29.7.0 + jest-util: 29.7.0 slash: 3.0.0 dev: false - /@jest/core@29.4.3(ts-node@10.9.1): - resolution: {integrity: sha512-56QvBq60fS4SPZCuM7T+7scNrkGIe7Mr6PVIXUpu48ouvRaWOFqRPV91eifvFM0ay2HmfswXiGf97NGUN5KofQ==} + /@jest/core@29.7.0(ts-node@10.9.1): + resolution: {integrity: sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 @@ -2752,35 +2752,36 @@ packages: node-notifier: optional: true dependencies: - '@jest/console': 29.4.3 - '@jest/reporters': 29.4.3 - '@jest/test-result': 29.4.3 - '@jest/transform': 29.4.3 - '@jest/types': 29.4.3 + '@jest/console': 29.7.0 + '@jest/reporters': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 '@types/node': 20.9.5 ansi-escapes: 4.3.2 chalk: 4.1.2 ci-info: 3.9.0 exit: 0.1.2 graceful-fs: 4.2.10 - jest-changed-files: 29.4.3 - jest-config: 29.4.3(@types/node@20.9.5)(ts-node@10.9.1) - jest-haste-map: 29.4.3 - jest-message-util: 29.4.3 - jest-regex-util: 29.4.3 - jest-resolve: 29.4.3 - jest-resolve-dependencies: 29.4.3 - jest-runner: 29.4.3 - jest-runtime: 29.4.3 - jest-snapshot: 29.4.3 - jest-util: 29.4.3 - jest-validate: 29.4.3 - jest-watcher: 29.4.3 + jest-changed-files: 29.7.0 + jest-config: 29.7.0(@types/node@20.9.5)(ts-node@10.9.1) + jest-haste-map: 29.7.0 + jest-message-util: 29.7.0 + jest-regex-util: 29.6.3 + jest-resolve: 29.7.0 + jest-resolve-dependencies: 29.7.0 + jest-runner: 29.7.0 + jest-runtime: 29.7.0 + jest-snapshot: 29.7.0 + jest-util: 29.7.0 + jest-validate: 29.7.0 + jest-watcher: 29.7.0 micromatch: 4.0.5 pretty-format: 29.7.0 slash: 3.0.0 strip-ansi: 6.0.1 transitivePeerDependencies: + - babel-plugin-macros - supports-color - ts-node dev: false @@ -2795,6 +2796,16 @@ packages: jest-mock: 29.4.3 dev: false + /@jest/environment@29.7.0: + resolution: {integrity: sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@jest/fake-timers': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 20.9.5 + jest-mock: 29.7.0 + dev: false + /@jest/expect-utils@29.4.3: resolution: {integrity: sha512-/6JWbkxHOP8EoS8jeeTd9dTfc9Uawi+43oLKHfp6zzux3U2hqOOVnV3ai4RpDYHOccL6g+5nrxpoc8DmJxtXVQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -2802,12 +2813,19 @@ packages: jest-get-type: 29.4.3 dev: false - /@jest/expect@29.4.3: - resolution: {integrity: sha512-iktRU/YsxEtumI9zsPctYUk7ptpC+AVLLk1Ax3AsA4g1C+8OOnKDkIQBDHtD5hA/+VtgMd5AWI5gNlcAlt2vxQ==} + /@jest/expect-utils@29.7.0: + resolution: {integrity: sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - expect: 29.4.3 - jest-snapshot: 29.4.3 + jest-get-type: 29.6.3 + dev: false + + /@jest/expect@29.7.0: + resolution: {integrity: sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + expect: 29.7.0 + jest-snapshot: 29.7.0 transitivePeerDependencies: - supports-color dev: false @@ -2824,20 +2842,32 @@ packages: jest-util: 29.4.3 dev: false - /@jest/globals@29.4.3: - resolution: {integrity: sha512-8BQ/5EzfOLG7AaMcDh7yFCbfRLtsc+09E1RQmRBI4D6QQk4m6NSK/MXo+3bJrBN0yU8A2/VIcqhvsOLFmziioA==} + /@jest/fake-timers@29.7.0: + resolution: {integrity: sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@jest/environment': 29.4.3 - '@jest/expect': 29.4.3 - '@jest/types': 29.4.3 - jest-mock: 29.4.3 + '@jest/types': 29.6.3 + '@sinonjs/fake-timers': 10.0.2 + '@types/node': 20.9.5 + jest-message-util: 29.7.0 + jest-mock: 29.7.0 + jest-util: 29.7.0 + dev: false + + /@jest/globals@29.7.0: + resolution: {integrity: sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@jest/environment': 29.7.0 + '@jest/expect': 29.7.0 + '@jest/types': 29.6.3 + jest-mock: 29.7.0 transitivePeerDependencies: - supports-color dev: false - /@jest/reporters@29.4.3: - resolution: {integrity: sha512-sr2I7BmOjJhyqj9ANC6CTLsL4emMoka7HkQpcoMRlhCbQJjz2zsRzw0BDPiPyEFDXAbxKgGFYuQZiSJ1Y6YoTg==} + /@jest/reporters@29.7.0: + resolution: {integrity: sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 @@ -2846,10 +2876,10 @@ packages: optional: true dependencies: '@bcoe/v8-coverage': 0.2.3 - '@jest/console': 29.4.3 - '@jest/test-result': 29.4.3 - '@jest/transform': 29.4.3 - '@jest/types': 29.4.3 + '@jest/console': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.22 '@types/node': 20.9.5 chalk: 4.1.2 @@ -2858,13 +2888,13 @@ packages: glob: 7.2.0 graceful-fs: 4.2.10 istanbul-lib-coverage: 3.2.0 - istanbul-lib-instrument: 5.1.0 + istanbul-lib-instrument: 6.0.1 istanbul-lib-report: 3.0.0 istanbul-lib-source-maps: 4.0.1 istanbul-reports: 3.1.5 - jest-message-util: 29.4.3 - jest-util: 29.4.3 - jest-worker: 29.4.3 + jest-message-util: 29.7.0 + jest-util: 29.7.0 + jest-worker: 29.7.0 slash: 3.0.0 string-length: 4.0.2 strip-ansi: 6.0.1 @@ -2879,8 +2909,8 @@ packages: dependencies: '@sinclair/typebox': 0.27.8 - /@jest/source-map@29.4.3: - resolution: {integrity: sha512-qyt/mb6rLyd9j1jUts4EQncvS6Yy3PM9HghnNv86QBlV+zdL2inCdK1tuVlL+J+lpiw2BI67qXOrX3UurBqQ1w==} + /@jest/source-map@29.6.3: + resolution: {integrity: sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jridgewell/trace-mapping': 0.3.22 @@ -2888,23 +2918,23 @@ packages: graceful-fs: 4.2.10 dev: false - /@jest/test-result@29.4.3: - resolution: {integrity: sha512-Oi4u9NfBolMq9MASPwuWTlC5WvmNRwI4S8YrQg5R5Gi47DYlBe3sh7ILTqi/LGrK1XUE4XY9KZcQJTH1WJCLLA==} + /@jest/test-result@29.7.0: + resolution: {integrity: sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@jest/console': 29.4.3 - '@jest/types': 29.4.3 + '@jest/console': 29.7.0 + '@jest/types': 29.6.3 '@types/istanbul-lib-coverage': 2.0.3 collect-v8-coverage: 1.0.1 dev: false - /@jest/test-sequencer@29.4.3: - resolution: {integrity: sha512-yi/t2nES4GB4G0mjLc0RInCq/cNr9dNwJxcGg8sslajua5Kb4kmozAc+qPLzplhBgfw1vLItbjyHzUN92UXicw==} + /@jest/test-sequencer@29.7.0: + resolution: {integrity: sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@jest/test-result': 29.4.3 + '@jest/test-result': 29.7.0 graceful-fs: 4.2.10 - jest-haste-map: 29.4.3 + jest-haste-map: 29.7.0 slash: 3.0.0 dev: false @@ -2952,6 +2982,30 @@ packages: write-file-atomic: 4.0.2 transitivePeerDependencies: - supports-color + dev: true + + /@jest/transform@29.7.0: + resolution: {integrity: sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@babel/core': 7.20.7 + '@jest/types': 29.6.3 + '@jridgewell/trace-mapping': 0.3.22 + babel-plugin-istanbul: 6.1.1 + chalk: 4.1.2 + convert-source-map: 2.0.0 + fast-json-stable-stringify: 2.1.0 + graceful-fs: 4.2.10 + jest-haste-map: 29.7.0 + jest-regex-util: 29.6.3 + jest-util: 29.7.0 + micromatch: 4.0.5 + pirates: 4.0.5 + slash: 3.0.0 + write-file-atomic: 4.0.2 + transitivePeerDependencies: + - supports-color + dev: false /@jest/types@25.5.0: resolution: {integrity: sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==} @@ -2995,6 +3049,18 @@ packages: '@types/yargs': 17.0.12 chalk: 4.1.2 + /@jest/types@29.6.3: + resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@jest/schemas': 29.6.3 + '@types/istanbul-lib-coverage': 2.0.3 + '@types/istanbul-reports': 3.0.1 + '@types/node': 20.9.5 + '@types/yargs': 17.0.12 + chalk: 4.1.2 + dev: false + /@jridgewell/gen-mapping@0.1.1: resolution: {integrity: sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==} engines: {node: '>=6.0.0'} @@ -5566,6 +5632,7 @@ packages: /@types/prettier@2.4.2: resolution: {integrity: sha512-ekoj4qOQYp7CvjX8ZDBgN86w3MqQhLE1hczEJbEIjgFEumDy+na/4AJAbLXfgEWFNB2pKadM5rPFtuSGMWK7xA==} + dev: true /@types/prop-types@15.7.4: resolution: {integrity: sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==} @@ -5817,40 +5884,41 @@ packages: - supports-color dev: true - /@vitest/expect@1.1.0: - resolution: {integrity: sha512-9IE2WWkcJo2BR9eqtY5MIo3TPmS50Pnwpm66A6neb2hvk/QSLfPXBz2qdiwUOQkwyFuuXEUj5380CbwfzW4+/w==} + /@vitest/expect@1.2.2: + resolution: {integrity: sha512-3jpcdPAD7LwHUUiT2pZTj2U82I2Tcgg2oVPvKxhn6mDI2On6tfvPQTjAI4628GUGDZrCm4Zna9iQHm5cEexOAg==} dependencies: - '@vitest/spy': 1.1.0 - '@vitest/utils': 1.1.0 + '@vitest/spy': 1.2.2 + '@vitest/utils': 1.2.2 chai: 4.3.10 dev: false - /@vitest/runner@1.1.0: - resolution: {integrity: sha512-zdNLJ00pm5z/uhbWF6aeIJCGMSyTyWImy3Fcp9piRGvueERFlQFbUwCpzVce79OLm2UHk9iwaMSOaU9jVHgNVw==} + /@vitest/runner@1.2.2: + resolution: {integrity: sha512-JctG7QZ4LSDXr5CsUweFgcpEvrcxOV1Gft7uHrvkQ+fsAVylmWQvnaAr/HDp3LAH1fztGMQZugIheTWjaGzYIg==} dependencies: - '@vitest/utils': 1.1.0 + '@vitest/utils': 1.2.2 p-limit: 5.0.0 pathe: 1.1.1 dev: false - /@vitest/snapshot@1.1.0: - resolution: {integrity: sha512-5O/wyZg09V5qmNmAlUgCBqflvn2ylgsWJRRuPrnHEfDNT6tQpQ8O1isNGgo+VxofISHqz961SG3iVvt3SPK/QQ==} + /@vitest/snapshot@1.2.2: + resolution: {integrity: sha512-SmGY4saEw1+bwE1th6S/cZmPxz/Q4JWsl7LvbQIky2tKE35US4gd0Mjzqfr84/4OD0tikGWaWdMja/nWL5NIPA==} dependencies: magic-string: 0.30.5 pathe: 1.1.1 pretty-format: 29.7.0 dev: false - /@vitest/spy@1.1.0: - resolution: {integrity: sha512-sNOVSU/GE+7+P76qYo+VXdXhXffzWZcYIPQfmkiRxaNCSPiLANvQx5Mx6ZURJ/ndtEkUJEpvKLXqAYTKEY+lTg==} + /@vitest/spy@1.2.2: + resolution: {integrity: sha512-k9Gcahssw8d7X3pSLq3e3XEu/0L78mUkCjivUqCQeXJm9clfXR/Td8+AP+VC1O6fKPIDLcHDTAmBOINVuv6+7g==} dependencies: tinyspy: 2.2.0 dev: false - /@vitest/utils@1.1.0: - resolution: {integrity: sha512-z+s510fKmYz4Y41XhNs3vcuFTFhcij2YF7F8VQfMEYAAUfqQh0Zfg7+w9xdgFGhPf3tX3TicAe+8BDITk6ampQ==} + /@vitest/utils@1.2.2: + resolution: {integrity: sha512-WKITBHLsBHlpjnDQahr+XK6RE7MiAsgrIkr0pGhQ9ygoxBfUeG0lUG5iLlzqjmKSlBv3+j5EGsriBzh+C3Tq9g==} dependencies: diff-sequences: 29.6.3 + estree-walker: 3.0.3 loupe: 2.3.7 pretty-format: 29.7.0 dev: false @@ -6036,6 +6104,11 @@ packages: resolution: {integrity: sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==} engines: {node: '>=0.4.0'} + /acorn-walk@8.3.2: + resolution: {integrity: sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==} + engines: {node: '>=0.4.0'} + dev: false + /acorn@7.4.1: resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==} engines: {node: '>=0.4.0'} @@ -6507,17 +6580,17 @@ packages: - supports-color dev: false - /babel-jest@29.4.3(@babel/core@7.20.7): - resolution: {integrity: sha512-o45Wyn32svZE+LnMVWv/Z4x0SwtLbh4FyGcYtR20kIWd+rdrDZ9Fzq8Ml3MYLD+mZvEdzCjZsCnYZ2jpJyQ+Nw==} + /babel-jest@29.7.0(@babel/core@7.20.7): + resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: '@babel/core': ^7.8.0 dependencies: '@babel/core': 7.20.7 - '@jest/transform': 29.4.3 + '@jest/transform': 29.7.0 '@types/babel__core': 7.1.20 babel-plugin-istanbul: 6.1.1 - babel-preset-jest: 29.4.3(@babel/core@7.20.7) + babel-preset-jest: 29.6.3(@babel/core@7.20.7) chalk: 4.1.2 graceful-fs: 4.2.10 slash: 3.0.0 @@ -6575,8 +6648,8 @@ packages: '@types/babel__traverse': 7.14.2 dev: false - /babel-plugin-jest-hoist@29.4.3: - resolution: {integrity: sha512-mB6q2q3oahKphy5V7CpnNqZOCkxxZ9aokf1eh82Dy3jQmg4xvM1tGrh5y6BQUJh4a3Pj9+eLfwvAZ7VNKg7H8Q==} + /babel-plugin-jest-hoist@29.6.3: + resolution: {integrity: sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@babel/template': 7.20.7 @@ -6649,14 +6722,14 @@ packages: babel-preset-current-node-syntax: 1.0.1(@babel/core@7.20.7) dev: false - /babel-preset-jest@29.4.3(@babel/core@7.20.7): - resolution: {integrity: sha512-gWx6COtSuma6n9bw+8/F+2PCXrIgxV/D1TJFnp6OyBK2cxPWg0K9p/sriNYeifKjpUkMViWQ09DSWtzJQRETsw==} + /babel-preset-jest@29.6.3(@babel/core@7.20.7): + resolution: {integrity: sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.20.7 - babel-plugin-jest-hoist: 29.4.3 + babel-plugin-jest-hoist: 29.6.3 babel-preset-current-node-syntax: 1.0.1(@babel/core@7.20.7) dev: false @@ -7682,6 +7755,25 @@ packages: readable-stream: 3.6.0 dev: true + /create-jest@29.7.0(@types/node@20.9.5)(ts-node@10.9.1): + resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + hasBin: true + dependencies: + '@jest/types': 29.6.3 + chalk: 4.1.2 + exit: 0.1.2 + graceful-fs: 4.2.10 + jest-config: 29.7.0(@types/node@20.9.5)(ts-node@10.9.1) + jest-util: 29.7.0 + prompts: 2.4.2 + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - supports-color + - ts-node + dev: false + /create-require@1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} @@ -7725,11 +7817,17 @@ packages: postcss: 8.4.33 dev: false - /css-loader@6.9.1(webpack@5.90.0): - resolution: {integrity: sha512-OzABOh0+26JKFdMzlK6PY1u5Zx8+Ck7CVRlcGNZoY9qwJjdfu2VWFuprTIpPW+Av5TZTVViYWcFQaEEQURLknQ==} + /css-loader@6.10.0(webpack@5.90.0): + resolution: {integrity: sha512-LTSA/jWbwdMlk+rhmElbDR2vbtQoTBPr7fkJE+mxrHj+7ru0hUmHafDRzWIjIHTwpitWVaqY2/UWGRca3yUgRw==} engines: {node: '>= 12.13.0'} peerDependencies: + '@rspack/core': 0.x || 1.x webpack: ^5.0.0 + peerDependenciesMeta: + '@rspack/core': + optional: true + webpack: + optional: true dependencies: icss-utils: 5.1.0(postcss@8.4.33) postcss: 8.4.33 @@ -8079,8 +8177,13 @@ packages: strip-dirs: 2.1.0 dev: true - /dedent@0.7.0: - resolution: {integrity: sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==} + /dedent@1.5.1: + resolution: {integrity: sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==} + peerDependencies: + babel-plugin-macros: ^3.1.0 + peerDependenciesMeta: + babel-plugin-macros: + optional: true dev: false /deep-eql@4.1.3: @@ -8798,6 +8901,12 @@ packages: /estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + /estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + dependencies: + '@types/estree': 1.0.5 + dev: false + /esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} @@ -8901,6 +9010,17 @@ packages: jest-util: 29.4.3 dev: false + /expect@29.7.0: + resolution: {integrity: sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@jest/expect-utils': 29.7.0 + jest-get-type: 29.6.3 + jest-matcher-utils: 29.7.0 + jest-message-util: 29.7.0 + jest-util: 29.7.0 + dev: false + /express-logging@1.1.1: resolution: {integrity: sha512-1KboYwxxCG5kwkJHR5LjFDTD1Mgl8n4PIMcCuhhd/1OqaxlC68P3QKbvvAbZVUtVgtlxEdTgSUwf6yxwzRCuuA==} engines: {node: '>= 0.10.26'} @@ -11100,6 +11220,19 @@ packages: transitivePeerDependencies: - supports-color + /istanbul-lib-instrument@6.0.1: + resolution: {integrity: sha512-EAMEJBsYuyyztxMxW3g7ugGPkrZsV57v0Hmv3mm1uQsmB+QnZuepg731CRaIgeUVSdmsTngOkSnauNF8p7FIhA==} + engines: {node: '>=10'} + dependencies: + '@babel/core': 7.20.7 + '@babel/parser': 7.20.7 + '@istanbuljs/schema': 0.1.3 + istanbul-lib-coverage: 3.2.0 + semver: 7.5.4 + transitivePeerDependencies: + - supports-color + dev: false + /istanbul-lib-report@3.0.0: resolution: {integrity: sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==} engines: {node: '>=8'} @@ -11140,43 +11273,46 @@ packages: resolution: {integrity: sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==} dev: false - /jest-changed-files@29.4.3: - resolution: {integrity: sha512-Vn5cLuWuwmi2GNNbokPOEcvrXGSGrqVnPEZV7rC6P7ck07Dyw9RFnvWglnupSh+hGys0ajGtw/bc2ZgweljQoQ==} + /jest-changed-files@29.7.0: + resolution: {integrity: sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: execa: 5.1.1 + jest-util: 29.7.0 p-limit: 3.1.0 dev: false - /jest-circus@29.4.3: - resolution: {integrity: sha512-Vw/bVvcexmdJ7MLmgdT3ZjkJ3LKu8IlpefYokxiqoZy6OCQ2VAm6Vk3t/qHiAGUXbdbJKJWnc8gH3ypTbB/OBw==} + /jest-circus@29.7.0: + resolution: {integrity: sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@jest/environment': 29.4.3 - '@jest/expect': 29.4.3 - '@jest/test-result': 29.4.3 - '@jest/types': 29.4.3 + '@jest/environment': 29.7.0 + '@jest/expect': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/types': 29.6.3 '@types/node': 20.9.5 chalk: 4.1.2 co: 4.6.0 - dedent: 0.7.0 + dedent: 1.5.1 is-generator-fn: 2.1.0 - jest-each: 29.4.3 - jest-matcher-utils: 29.4.3 - jest-message-util: 29.4.3 - jest-runtime: 29.4.3 - jest-snapshot: 29.4.3 - jest-util: 29.4.3 + jest-each: 29.7.0 + jest-matcher-utils: 29.7.0 + jest-message-util: 29.7.0 + jest-runtime: 29.7.0 + jest-snapshot: 29.7.0 + jest-util: 29.7.0 p-limit: 3.1.0 pretty-format: 29.7.0 + pure-rand: 6.0.4 slash: 3.0.0 stack-utils: 2.0.5 transitivePeerDependencies: + - babel-plugin-macros - supports-color dev: false - /jest-cli@29.4.3(@types/node@20.9.5)(ts-node@10.9.1): - resolution: {integrity: sha512-PiiAPuFNfWWolCE6t3ZrDXQc6OsAuM3/tVW0u27UWc1KE+n/HSn5dSE6B2juqN7WP+PP0jAcnKtGmI4u8GMYCg==} + /jest-cli@29.7.0(@types/node@20.9.5)(ts-node@10.9.1): + resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true peerDependencies: @@ -11185,26 +11321,26 @@ packages: node-notifier: optional: true dependencies: - '@jest/core': 29.4.3(ts-node@10.9.1) - '@jest/test-result': 29.4.3 - '@jest/types': 29.4.3 + '@jest/core': 29.7.0(ts-node@10.9.1) + '@jest/test-result': 29.7.0 + '@jest/types': 29.6.3 chalk: 4.1.2 + create-jest: 29.7.0(@types/node@20.9.5)(ts-node@10.9.1) exit: 0.1.2 - graceful-fs: 4.2.10 import-local: 3.0.3 - jest-config: 29.4.3(@types/node@20.9.5)(ts-node@10.9.1) - jest-util: 29.4.3 - jest-validate: 29.4.3 - prompts: 2.4.2 + jest-config: 29.7.0(@types/node@20.9.5)(ts-node@10.9.1) + jest-util: 29.7.0 + jest-validate: 29.7.0 yargs: 17.7.2 transitivePeerDependencies: - '@types/node' + - babel-plugin-macros - supports-color - ts-node dev: false - /jest-config@29.4.3(@types/node@20.9.5)(ts-node@10.9.1): - resolution: {integrity: sha512-eCIpqhGnIjdUCXGtLhz4gdDoxKSWXKjzNcc5r+0S1GKOp2fwOipx5mRcwa9GB/ArsxJ1jlj2lmlD9bZAsBxaWQ==} + /jest-config@29.7.0(@types/node@20.9.5)(ts-node@10.9.1): + resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} peerDependencies: '@types/node': '*' @@ -11216,23 +11352,23 @@ packages: optional: true dependencies: '@babel/core': 7.20.7 - '@jest/test-sequencer': 29.4.3 - '@jest/types': 29.4.3 + '@jest/test-sequencer': 29.7.0 + '@jest/types': 29.6.3 '@types/node': 20.9.5 - babel-jest: 29.4.3(@babel/core@7.20.7) + babel-jest: 29.7.0(@babel/core@7.20.7) chalk: 4.1.2 ci-info: 3.9.0 deepmerge: 4.2.2 glob: 7.2.0 graceful-fs: 4.2.10 - jest-circus: 29.4.3 - jest-environment-node: 29.4.3 - jest-get-type: 29.4.3 - jest-regex-util: 29.4.3 - jest-resolve: 29.4.3 - jest-runner: 29.4.3 - jest-util: 29.4.3 - jest-validate: 29.4.3 + jest-circus: 29.7.0 + jest-environment-node: 29.7.0 + jest-get-type: 29.6.3 + jest-regex-util: 29.6.3 + jest-resolve: 29.7.0 + jest-runner: 29.7.0 + jest-util: 29.7.0 + jest-validate: 29.7.0 micromatch: 4.0.5 parse-json: 5.2.0 pretty-format: 29.7.0 @@ -11240,6 +11376,7 @@ packages: strip-json-comments: 3.1.1 ts-node: 10.9.1(@swc/core@1.2.112)(@types/node@20.9.5)(typescript@4.9.4) transitivePeerDependencies: + - babel-plugin-macros - supports-color dev: false @@ -11253,21 +11390,31 @@ packages: pretty-format: 29.7.0 dev: false - /jest-docblock@29.4.3: - resolution: {integrity: sha512-fzdTftThczeSD9nZ3fzA/4KkHtnmllawWrXO69vtI+L9WjEIuXWs4AmyME7lN5hU7dB0sHhuPfcKofRsUb/2Fg==} + /jest-diff@29.7.0: + resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + chalk: 4.1.2 + diff-sequences: 29.6.3 + jest-get-type: 29.6.3 + pretty-format: 29.7.0 + dev: false + + /jest-docblock@29.7.0: + resolution: {integrity: sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: detect-newline: 3.1.0 dev: false - /jest-each@29.4.3: - resolution: {integrity: sha512-1ElHNAnKcbJb/b+L+7j0/w7bDvljw4gTv1wL9fYOczeJrbTbkMGQ5iQPFJ3eFQH19VPTx1IyfePdqSpePKss7Q==} + /jest-each@29.7.0: + resolution: {integrity: sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@jest/types': 29.4.3 + '@jest/types': 29.6.3 chalk: 4.1.2 - jest-get-type: 29.4.3 - jest-util: 29.4.3 + jest-get-type: 29.6.3 + jest-util: 29.7.0 pretty-format: 29.7.0 dev: false @@ -11294,16 +11441,16 @@ packages: - utf-8-validate dev: false - /jest-environment-node@29.4.3: - resolution: {integrity: sha512-gAiEnSKF104fsGDXNkwk49jD/0N0Bqu2K9+aMQXA6avzsA9H3Fiv1PW2D+gzbOSR705bWd2wJZRFEFpV0tXISg==} + /jest-environment-node@29.7.0: + resolution: {integrity: sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@jest/environment': 29.4.3 - '@jest/fake-timers': 29.4.3 - '@jest/types': 29.4.3 + '@jest/environment': 29.7.0 + '@jest/fake-timers': 29.7.0 + '@jest/types': 29.6.3 '@types/node': 20.9.5 - jest-mock: 29.4.3 - jest-util: 29.4.3 + jest-mock: 29.7.0 + jest-util: 29.7.0 dev: false /jest-get-type@25.2.6: @@ -11321,6 +11468,11 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dev: false + /jest-get-type@29.6.3: + resolution: {integrity: sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dev: false + /jest-haste-map@27.3.1: resolution: {integrity: sha512-lYfNZIzwPccDJZIyk9Iz5iQMM/MH56NIIcGj7AFU1YyA4ewWFBl8z+YPJuSCRML/ee2cCt2y3W4K3VXPT6Nhzg==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} @@ -11358,12 +11510,32 @@ packages: walker: 1.0.8 optionalDependencies: fsevents: 2.3.3 + dev: true - /jest-leak-detector@29.4.3: - resolution: {integrity: sha512-9yw4VC1v2NspMMeV3daQ1yXPNxMgCzwq9BocCwYrRgXe4uaEJPAN0ZK37nFBhcy3cUwEVstFecFLaTHpF7NiGA==} + /jest-haste-map@29.7.0: + resolution: {integrity: sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - jest-get-type: 29.4.3 + '@jest/types': 29.6.3 + '@types/graceful-fs': 4.1.5 + '@types/node': 20.9.5 + anymatch: 3.1.2 + fb-watchman: 2.0.1 + graceful-fs: 4.2.10 + jest-regex-util: 29.6.3 + jest-util: 29.7.0 + jest-worker: 29.7.0 + micromatch: 4.0.5 + walker: 1.0.8 + optionalDependencies: + fsevents: 2.3.3 + dev: false + + /jest-leak-detector@29.7.0: + resolution: {integrity: sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + jest-get-type: 29.6.3 pretty-format: 29.7.0 dev: false @@ -11377,6 +11549,16 @@ packages: pretty-format: 29.7.0 dev: false + /jest-matcher-utils@29.7.0: + resolution: {integrity: sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + chalk: 4.1.2 + jest-diff: 29.7.0 + jest-get-type: 29.6.3 + pretty-format: 29.7.0 + dev: false + /jest-message-util@29.4.3: resolution: {integrity: sha512-1Y8Zd4ZCN7o/QnWdMmT76If8LuDv23Z1DRovBj/vcSFNlGCJGoO8D1nJDw1AdyAGUk0myDLFGN5RbNeJyCRGCw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -11392,6 +11574,21 @@ packages: stack-utils: 2.0.5 dev: false + /jest-message-util@29.7.0: + resolution: {integrity: sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@babel/code-frame': 7.18.6 + '@jest/types': 29.6.3 + '@types/stack-utils': 2.0.1 + chalk: 4.1.2 + graceful-fs: 4.2.10 + micromatch: 4.0.5 + pretty-format: 29.7.0 + slash: 3.0.0 + stack-utils: 2.0.5 + dev: false + /jest-mock@29.4.3: resolution: {integrity: sha512-LjFgMg+xed9BdkPMyIJh+r3KeHt1klXPJYBULXVVAkbTaaKjPX1o1uVCAZADMEp/kOxGTwy/Ot8XbvgItOrHEg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -11401,7 +11598,16 @@ packages: jest-util: 29.4.3 dev: false - /jest-pnp-resolver@1.2.2(jest-resolve@29.4.3): + /jest-mock@29.7.0: + resolution: {integrity: sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@jest/types': 29.6.3 + '@types/node': 20.9.5 + jest-util: 29.7.0 + dev: false + + /jest-pnp-resolver@1.2.2(jest-resolve@29.7.0): resolution: {integrity: sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==} engines: {node: '>=6'} peerDependencies: @@ -11410,7 +11616,7 @@ packages: jest-resolve: optional: true dependencies: - jest-resolve: 29.4.3 + jest-resolve: 29.7.0 dev: false /jest-regex-util@27.0.6: @@ -11421,85 +11627,91 @@ packages: /jest-regex-util@29.4.3: resolution: {integrity: sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dev: true + + /jest-regex-util@29.6.3: + resolution: {integrity: sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dev: false - /jest-resolve-dependencies@29.4.3: - resolution: {integrity: sha512-uvKMZAQ3nmXLH7O8WAOhS5l0iWyT3WmnJBdmIHiV5tBbdaDZ1wqtNX04FONGoaFvSOSHBJxnwAVnSn1WHdGVaw==} + /jest-resolve-dependencies@29.7.0: + resolution: {integrity: sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - jest-regex-util: 29.4.3 - jest-snapshot: 29.4.3 + jest-regex-util: 29.6.3 + jest-snapshot: 29.7.0 transitivePeerDependencies: - supports-color dev: false - /jest-resolve@29.4.3: - resolution: {integrity: sha512-GPokE1tzguRyT7dkxBim4wSx6E45S3bOQ7ZdKEG+Qj0Oac9+6AwJPCk0TZh5Vu0xzeX4afpb+eDmgbmZFFwpOw==} + /jest-resolve@29.7.0: + resolution: {integrity: sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: chalk: 4.1.2 graceful-fs: 4.2.10 - jest-haste-map: 29.4.3 - jest-pnp-resolver: 1.2.2(jest-resolve@29.4.3) - jest-util: 29.4.3 - jest-validate: 29.4.3 + jest-haste-map: 29.7.0 + jest-pnp-resolver: 1.2.2(jest-resolve@29.7.0) + jest-util: 29.7.0 + jest-validate: 29.7.0 resolve: 1.22.8 resolve.exports: 2.0.0 slash: 3.0.0 dev: false - /jest-runner@29.4.3: - resolution: {integrity: sha512-GWPTEiGmtHZv1KKeWlTX9SIFuK19uLXlRQU43ceOQ2hIfA5yPEJC7AMkvFKpdCHx6pNEdOD+2+8zbniEi3v3gA==} + /jest-runner@29.7.0: + resolution: {integrity: sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@jest/console': 29.4.3 - '@jest/environment': 29.4.3 - '@jest/test-result': 29.4.3 - '@jest/transform': 29.4.3 - '@jest/types': 29.4.3 + '@jest/console': 29.7.0 + '@jest/environment': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 '@types/node': 20.9.5 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.10 - jest-docblock: 29.4.3 - jest-environment-node: 29.4.3 - jest-haste-map: 29.4.3 - jest-leak-detector: 29.4.3 - jest-message-util: 29.4.3 - jest-resolve: 29.4.3 - jest-runtime: 29.4.3 - jest-util: 29.4.3 - jest-watcher: 29.4.3 - jest-worker: 29.4.3 + jest-docblock: 29.7.0 + jest-environment-node: 29.7.0 + jest-haste-map: 29.7.0 + jest-leak-detector: 29.7.0 + jest-message-util: 29.7.0 + jest-resolve: 29.7.0 + jest-runtime: 29.7.0 + jest-util: 29.7.0 + jest-watcher: 29.7.0 + jest-worker: 29.7.0 p-limit: 3.1.0 source-map-support: 0.5.13 transitivePeerDependencies: - supports-color dev: false - /jest-runtime@29.4.3: - resolution: {integrity: sha512-F5bHvxSH+LvLV24vVB3L8K467dt3y3dio6V3W89dUz9nzvTpqd/HcT9zfYKL2aZPvD63vQFgLvaUX/UpUhrP6Q==} + /jest-runtime@29.7.0: + resolution: {integrity: sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@jest/environment': 29.4.3 - '@jest/fake-timers': 29.4.3 - '@jest/globals': 29.4.3 - '@jest/source-map': 29.4.3 - '@jest/test-result': 29.4.3 - '@jest/transform': 29.4.3 - '@jest/types': 29.4.3 + '@jest/environment': 29.7.0 + '@jest/fake-timers': 29.7.0 + '@jest/globals': 29.7.0 + '@jest/source-map': 29.6.3 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 '@types/node': 20.9.5 chalk: 4.1.2 cjs-module-lexer: 1.2.2 collect-v8-coverage: 1.0.1 glob: 7.2.0 graceful-fs: 4.2.10 - jest-haste-map: 29.4.3 - jest-message-util: 29.4.3 - jest-mock: 29.4.3 - jest-regex-util: 29.4.3 - jest-resolve: 29.4.3 - jest-snapshot: 29.4.3 - jest-util: 29.4.3 + jest-haste-map: 29.7.0 + jest-message-util: 29.7.0 + jest-mock: 29.7.0 + jest-regex-util: 29.6.3 + jest-resolve: 29.7.0 + jest-snapshot: 29.7.0 + jest-util: 29.7.0 slash: 3.0.0 strip-bom: 4.0.0 transitivePeerDependencies: @@ -11514,31 +11726,27 @@ packages: graceful-fs: 4.2.10 dev: false - /jest-snapshot@29.4.3: - resolution: {integrity: sha512-NGlsqL0jLPDW91dz304QTM/SNO99lpcSYYAjNiX0Ou+sSGgkanKBcSjCfp/pqmiiO1nQaOyLp6XQddAzRcx3Xw==} + /jest-snapshot@29.7.0: + resolution: {integrity: sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@babel/core': 7.20.7 '@babel/generator': 7.20.7 '@babel/plugin-syntax-jsx': 7.18.6(@babel/core@7.20.7) '@babel/plugin-syntax-typescript': 7.20.0(@babel/core@7.20.7) - '@babel/traverse': 7.20.10 '@babel/types': 7.20.7 - '@jest/expect-utils': 29.4.3 - '@jest/transform': 29.4.3 - '@jest/types': 29.4.3 - '@types/babel__traverse': 7.14.2 - '@types/prettier': 2.4.2 + '@jest/expect-utils': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 babel-preset-current-node-syntax: 1.0.1(@babel/core@7.20.7) chalk: 4.1.2 - expect: 29.4.3 + expect: 29.7.0 graceful-fs: 4.2.10 - jest-diff: 29.4.3 - jest-get-type: 29.4.3 - jest-haste-map: 29.4.3 - jest-matcher-utils: 29.4.3 - jest-message-util: 29.4.3 - jest-util: 29.4.3 + jest-diff: 29.7.0 + jest-get-type: 29.6.3 + jest-matcher-utils: 29.7.0 + jest-message-util: 29.7.0 + jest-util: 29.7.0 natural-compare: 1.4.0 pretty-format: 29.7.0 semver: 7.5.4 @@ -11569,6 +11777,18 @@ packages: graceful-fs: 4.2.10 picomatch: 2.3.1 + /jest-util@29.7.0: + resolution: {integrity: sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@jest/types': 29.6.3 + '@types/node': 20.9.5 + chalk: 4.1.2 + ci-info: 3.9.0 + graceful-fs: 4.2.10 + picomatch: 2.3.1 + dev: false + /jest-validate@25.5.0: resolution: {integrity: sha512-okUFKqhZIpo3jDdtUXUZ2LxGUZJIlfdYBvZb1aczzxrlyMlqdnnws9MOxezoLGhSaFc2XYaHNReNQfj5zPIWyQ==} engines: {node: '>= 8.3'} @@ -11593,29 +11813,29 @@ packages: pretty-format: 27.5.1 dev: true - /jest-validate@29.4.3: - resolution: {integrity: sha512-J3u5v7aPQoXPzaar6GndAVhdQcZr/3osWSgTeKg5v574I9ybX/dTyH0AJFb5XgXIB7faVhf+rS7t4p3lL9qFaw==} + /jest-validate@29.7.0: + resolution: {integrity: sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@jest/types': 29.4.3 + '@jest/types': 29.6.3 camelcase: 6.2.1 chalk: 4.1.2 - jest-get-type: 29.4.3 + jest-get-type: 29.6.3 leven: 3.1.0 pretty-format: 29.7.0 dev: false - /jest-watcher@29.4.3: - resolution: {integrity: sha512-zwlXH3DN3iksoIZNk73etl1HzKyi5FuQdYLnkQKm5BW4n8HpoG59xSwpVdFrnh60iRRaRBGw0gcymIxjJENPcA==} + /jest-watcher@29.7.0: + resolution: {integrity: sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@jest/test-result': 29.4.3 - '@jest/types': 29.4.3 + '@jest/test-result': 29.7.0 + '@jest/types': 29.6.3 '@types/node': 20.9.5 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 - jest-util: 29.4.3 + jest-util: 29.7.0 string-length: 4.0.2 dev: false @@ -11644,9 +11864,20 @@ packages: jest-util: 29.4.3 merge-stream: 2.0.0 supports-color: 8.1.1 + dev: true + + /jest-worker@29.7.0: + resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@types/node': 20.9.5 + jest-util: 29.7.0 + merge-stream: 2.0.0 + supports-color: 8.1.1 + dev: false - /jest@29.4.3(@types/node@20.9.5)(ts-node@10.9.1): - resolution: {integrity: sha512-XvK65feuEFGZT8OO0fB/QAQS+LGHvQpaadkH5p47/j3Ocqq3xf2pK9R+G0GzgfuhXVxEv76qCOOcMb5efLk6PA==} + /jest@29.7.0(@types/node@20.9.5)(ts-node@10.9.1): + resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true peerDependencies: @@ -11655,12 +11886,13 @@ packages: node-notifier: optional: true dependencies: - '@jest/core': 29.4.3(ts-node@10.9.1) - '@jest/types': 29.4.3 + '@jest/core': 29.7.0(ts-node@10.9.1) + '@jest/types': 29.6.3 import-local: 3.0.3 - jest-cli: 29.4.3(@types/node@20.9.5)(ts-node@10.9.1) + jest-cli: 29.7.0(@types/node@20.9.5)(ts-node@10.9.1) transitivePeerDependencies: - '@types/node' + - babel-plugin-macros - supports-color - ts-node dev: false @@ -14717,6 +14949,10 @@ packages: escape-goat: 2.1.1 dev: true + /pure-rand@6.0.4: + resolution: {integrity: sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA==} + dev: false + /purgecss@4.0.3: resolution: {integrity: sha512-PYOIn5ibRIP34PBU9zohUcCI09c7drPJJtTDAc0Q6QlRz2/CHQ8ywGLdE7ZhxU2VTqB7p5wkvj5Qcm05Rz3Jmw==} hasBin: true @@ -16661,8 +16897,8 @@ packages: resolution: {integrity: sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==} dev: false - /tinypool@0.8.1: - resolution: {integrity: sha512-zBTCK0cCgRROxvs9c0CGK838sPkeokNGdQVUUwHAbynHFlmyJYj825f/oRs528HaIJ97lo0pLIlDUzwN+IorWg==} + /tinypool@0.8.2: + resolution: {integrity: sha512-SUszKYe5wgsxnNOVlBYO6IC+8VGWdVGZWAqUxp3UErNBtptZvWbwyUOyzNL59zigz2rCA92QiL3wvG+JDSdJdQ==} engines: {node: '>=14.0.0'} dev: false @@ -17477,27 +17713,6 @@ packages: vfile-message: 2.0.4 dev: true - /vite-node@1.1.0(@types/node@20.9.5): - resolution: {integrity: sha512-jV48DDUxGLEBdHCQvxL1mEh7+naVy+nhUUUaPAZLd3FJgXuxQiewHcfeZebbJ6onDqNGkP4r3MhQ342PRlG81Q==} - engines: {node: ^18.0.0 || >=20.0.0} - hasBin: true - dependencies: - cac: 6.7.14 - debug: 4.3.4(supports-color@9.2.3) - pathe: 1.1.1 - picocolors: 1.0.0 - vite: 5.0.12(@types/node@20.9.5) - transitivePeerDependencies: - - '@types/node' - - less - - lightningcss - - sass - - stylus - - sugarss - - supports-color - - terser - dev: false - /vite-node@1.2.2(@types/node@20.9.5): resolution: {integrity: sha512-1as4rDTgVWJO3n1uHmUYqq7nsFgINQ9u+mRcXpjeOMJUmviqNKjcZB7UfRZrlM7MjYXMKpuWp5oGkjaFLnjawg==} engines: {node: ^18.0.0 || >=20.0.0} @@ -17579,8 +17794,8 @@ packages: optionalDependencies: fsevents: 2.3.3 - /vitest@1.1.0(@types/node@20.9.5): - resolution: {integrity: sha512-oDFiCrw7dd3Jf06HoMtSRARivvyjHJaTxikFxuqJjO76U436PqlVw1uLn7a8OSPrhSfMGVaRakKpA2lePdw79A==} + /vitest@1.2.2(@types/node@20.9.5): + resolution: {integrity: sha512-d5Ouvrnms3GD9USIK36KG8OZ5bEvKEkITFtnGv56HFaSlbItJuYr7hv2Lkn903+AvRAgSixiamozUVfORUekjw==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -17605,12 +17820,12 @@ packages: optional: true dependencies: '@types/node': 20.9.5 - '@vitest/expect': 1.1.0 - '@vitest/runner': 1.1.0 - '@vitest/snapshot': 1.1.0 - '@vitest/spy': 1.1.0 - '@vitest/utils': 1.1.0 - acorn-walk: 8.3.1 + '@vitest/expect': 1.2.2 + '@vitest/runner': 1.2.2 + '@vitest/snapshot': 1.2.2 + '@vitest/spy': 1.2.2 + '@vitest/utils': 1.2.2 + acorn-walk: 8.3.2 cac: 6.7.14 chai: 4.3.10 debug: 4.3.4(supports-color@9.2.3) @@ -17622,9 +17837,9 @@ packages: std-env: 3.7.0 strip-literal: 1.3.0 tinybench: 2.5.1 - tinypool: 0.8.1 + tinypool: 0.8.2 vite: 5.0.12(@types/node@20.9.5) - vite-node: 1.1.0(@types/node@20.9.5) + vite-node: 1.2.2(@types/node@20.9.5) why-is-node-running: 2.2.2 transitivePeerDependencies: - less From 615240d166a9b0576aabd83249a153992c1518cf Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sat, 3 Feb 2024 18:48:55 +1100 Subject: [PATCH 02/13] run integration tests for vite-node compiler with Jest --- ...mpiler.vitest.test.ts => compiler.test.ts} | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) rename tests/compiler/{compiler.vitest.test.ts => compiler.test.ts} (93%) diff --git a/tests/compiler/compiler.vitest.test.ts b/tests/compiler/compiler.test.ts similarity index 93% rename from tests/compiler/compiler.vitest.test.ts rename to tests/compiler/compiler.test.ts index 3de0d327..f18bf941 100644 --- a/tests/compiler/compiler.vitest.test.ts +++ b/tests/compiler/compiler.test.ts @@ -1,5 +1,4 @@ import path from 'path'; -import { describe, beforeAll, afterAll, test, expect } from 'vitest'; import { createCompiler, normalizePath } from '@vanilla-extract/integration'; function getLocalFiles(files: Set) { @@ -87,6 +86,7 @@ describe('compiler', () => { import 'fixtures/class-composition/styles.css.ts.vanilla.css'; export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920';" `); + const localWatchFiles = getLocalFiles(output.watchFiles); expect(localWatchFiles).toMatchInlineSnapshot(` [ @@ -95,29 +95,29 @@ describe('compiler', () => { ] `); - await (async () => { + { const { css, filePath } = compiler.getCssForFile(cssPath); expect(css).toMatchInlineSnapshot(` ".styles_className__q7x3ow0 { color: red; }" `); - expect(normalizePath(filePath)).toBe( - 'fixtures/class-composition/styles.css.ts', + expect(normalizePath(filePath)).toMatchInlineSnapshot( + `"fixtures/class-composition/styles.css.ts"`, ); - })(); + } - await (async () => { + { const { css, filePath } = compiler.getCssForFile(sharedCssPath); expect(css).toMatchInlineSnapshot(` ".shared_shared__16bmd920 { background: blue; }" `); - expect(normalizePath(filePath)).toBe( - 'fixtures/class-composition/shared.css.ts', + expect(normalizePath(filePath)).toMatchInlineSnapshot( + `"fixtures/class-composition/shared.css.ts"`, ); - })(); + } }); test('root relative paths', async () => { @@ -141,29 +141,29 @@ describe('compiler', () => { ] `); - await (async () => { + { const { css, filePath } = compiler.getCssForFile(cssPath); expect(css).toMatchInlineSnapshot(` ".styles_className__q7x3ow0 { color: red; }" `); - expect(normalizePath(filePath)).toBe( - 'fixtures/class-composition/styles.css.ts', + expect(normalizePath(filePath)).toMatchInlineSnapshot( + `"fixtures/class-composition/styles.css.ts"`, ); - })(); + } - await (async () => { + { const { css, filePath } = compiler.getCssForFile(sharedCssPath); expect(css).toMatchInlineSnapshot(` ".shared_shared__16bmd920 { background: blue; }" `); - expect(normalizePath(filePath)).toBe( - 'fixtures/class-composition/shared.css.ts', + expect(normalizePath(filePath)).toMatchInlineSnapshot( + `"fixtures/class-composition/shared.css.ts"`, ); - })(); + } }); test('root relative paths starting with dot', async () => { @@ -187,29 +187,29 @@ describe('compiler', () => { ] `); - await (async () => { + { const { css, filePath } = compiler.getCssForFile(cssPath); expect(css).toMatchInlineSnapshot(` ".styles_className__q7x3ow0 { color: red; }" `); - expect(normalizePath(filePath)).toBe( - 'fixtures/class-composition/styles.css.ts', + expect(normalizePath(filePath)).toMatchInlineSnapshot( + `"fixtures/class-composition/styles.css.ts"`, ); - })(); + } - await (async () => { + { const { css, filePath } = compiler.getCssForFile(sharedCssPath); expect(css).toMatchInlineSnapshot(` ".shared_shared__16bmd920 { background: blue; }" `); - expect(normalizePath(filePath)).toBe( - 'fixtures/class-composition/shared.css.ts', + expect(normalizePath(filePath)).toMatchInlineSnapshot( + `"fixtures/class-composition/shared.css.ts"`, ); - })(); + } }); test('throws on getCssForFile when file does not exist', async () => { From 780f5d9671cdc8f0e90cba42983840cb31435815 Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sat, 3 Feb 2024 18:58:22 +1100 Subject: [PATCH 03/13] add basic tests running in Vitest for vite-node compiler --- tests/compiler/compiler.vitest.test.ts | 113 +++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 tests/compiler/compiler.vitest.test.ts diff --git a/tests/compiler/compiler.vitest.test.ts b/tests/compiler/compiler.vitest.test.ts new file mode 100644 index 00000000..1ce8276a --- /dev/null +++ b/tests/compiler/compiler.vitest.test.ts @@ -0,0 +1,113 @@ +import path from 'path'; +import { describe, beforeAll, afterAll, test, expect } from 'vitest'; +import { createCompiler } from '@vanilla-extract/integration'; + +describe('compiler running in Vitest', () => { + let compilers: Record< + 'default' | 'vitePlugins' | 'viteResolve', + ReturnType + >; + + beforeAll(async () => { + compilers = { + default: createCompiler({ + root: __dirname, + }), + vitePlugins: createCompiler({ + root: __dirname, + vitePlugins: [ + { + name: 'test-plugin', + resolveId(id) { + if (id === '~/vars') { + return '\0resolved-vars'; + } + }, + load: (id) => { + if (id === '\0resolved-vars') { + return `export const color = "green"`; + } + }, + }, + ], + }), + viteResolve: createCompiler({ + root: __dirname, + viteResolve: { + alias: { + '@util': path.resolve(__dirname, 'fixtures/vite-config/util'), + }, + }, + }), + }; + }); + + afterAll(async () => { + await Promise.allSettled( + Object.values(compilers).map((compiler) => compiler.close()), + ); + }); + + test('with no plugins', async () => { + const compiler = compilers.default; + + const cssPath = path.join( + __dirname, + 'fixtures/class-composition/styles.css.ts', + ); + + const { source } = await compiler.processVanillaFile(cssPath); + expect(source).toMatchInlineSnapshot(` + "import 'fixtures/class-composition/shared.css.ts.vanilla.css'; + import 'fixtures/class-composition/styles.css.ts.vanilla.css'; + export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920';" + `); + + const { css } = compiler.getCssForFile(cssPath); + expect(css).toMatchInlineSnapshot(` + ".styles_className__q7x3ow0 { + color: red; + }" + `); + }); + + test('with Vite plugins', async () => { + const compiler = compilers.vitePlugins; + + const cssPath = path.join(__dirname, 'fixtures/vite-config/plugin.css.ts'); + + const { source } = await compiler.processVanillaFile(cssPath); + expect(source).toMatchInlineSnapshot(` + "import 'fixtures/vite-config/plugin.css.ts.vanilla.css'; + export var root = 'plugin_root__1e902gk0';" + `); + + const { css } = compiler.getCssForFile(cssPath); + expect(css).toMatchInlineSnapshot(` + ".plugin_root__1e902gk0 { + color: green; + }" + `); + }); + + test('with Vite resolve', async () => { + const compiler = compilers.viteResolve; + + const cssPath = path.join(__dirname, 'fixtures/vite-config/alias.css.ts'); + + const { source } = await compiler.processVanillaFile(cssPath); + expect(source).toMatchInlineSnapshot(` + "import 'fixtures/vite-config/util/vars.css.ts.vanilla.css'; + import 'fixtures/vite-config/alias.css.ts.vanilla.css'; + export var root = 'alias_root__ez4dr20';" + `); + + const { css } = compiler.getCssForFile(cssPath); + expect(css).toMatchInlineSnapshot(` + ".alias_root__ez4dr20 { + --border__13z1r1g0: 1px solid black; + border: var(--border__13z1r1g0); + }" + `); + }); +}); From ca926c5b1aeadb0258483f07ae4d9cb31297735f Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sat, 3 Feb 2024 19:14:31 +1100 Subject: [PATCH 04/13] remove wrapping quotes around snapshots --- tests/compiler/compiler.test.ts | 123 +++++++++++++------------ tests/compiler/compiler.vitest.test.ts | 10 ++ 2 files changed, 74 insertions(+), 59 deletions(-) diff --git a/tests/compiler/compiler.test.ts b/tests/compiler/compiler.test.ts index f18bf941..2ce70e8b 100644 --- a/tests/compiler/compiler.test.ts +++ b/tests/compiler/compiler.test.ts @@ -1,6 +1,11 @@ import path from 'path'; import { createCompiler, normalizePath } from '@vanilla-extract/integration'; +expect.addSnapshotSerializer({ + test: (val) => typeof val === 'string', + print: (val) => (val as string).replaceAll(__dirname, '{{__dirname}}'), +}); + function getLocalFiles(files: Set) { const posixDirname = normalizePath(__dirname); @@ -82,40 +87,40 @@ describe('compiler', () => { const output = await compiler.processVanillaFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - "import 'fixtures/class-composition/shared.css.ts.vanilla.css'; + import 'fixtures/class-composition/shared.css.ts.vanilla.css'; import 'fixtures/class-composition/styles.css.ts.vanilla.css'; - export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920';" + export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920'; `); const localWatchFiles = getLocalFiles(output.watchFiles); expect(localWatchFiles).toMatchInlineSnapshot(` [ - "/fixtures/class-composition/styles.css.ts", - "/fixtures/class-composition/shared.css.ts", + /fixtures/class-composition/styles.css.ts, + /fixtures/class-composition/shared.css.ts, ] `); { const { css, filePath } = compiler.getCssForFile(cssPath); expect(css).toMatchInlineSnapshot(` - ".styles_className__q7x3ow0 { + .styles_className__q7x3ow0 { color: red; - }" + } `); expect(normalizePath(filePath)).toMatchInlineSnapshot( - `"fixtures/class-composition/styles.css.ts"`, + `fixtures/class-composition/styles.css.ts`, ); } { const { css, filePath } = compiler.getCssForFile(sharedCssPath); expect(css).toMatchInlineSnapshot(` - ".shared_shared__16bmd920 { + .shared_shared__16bmd920 { background: blue; - }" + } `); expect(normalizePath(filePath)).toMatchInlineSnapshot( - `"fixtures/class-composition/shared.css.ts"`, + `fixtures/class-composition/shared.css.ts`, ); } }); @@ -128,40 +133,40 @@ describe('compiler', () => { const output = await compiler.processVanillaFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - "import 'fixtures/class-composition/shared.css.ts.vanilla.css'; + import 'fixtures/class-composition/shared.css.ts.vanilla.css'; import 'fixtures/class-composition/styles.css.ts.vanilla.css'; - export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920';" + export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920'; `); const localWatchFiles = getLocalFiles(output.watchFiles); expect(localWatchFiles).toMatchInlineSnapshot(` [ - "/fixtures/class-composition/styles.css.ts", - "/fixtures/class-composition/shared.css.ts", + /fixtures/class-composition/styles.css.ts, + /fixtures/class-composition/shared.css.ts, ] `); { const { css, filePath } = compiler.getCssForFile(cssPath); expect(css).toMatchInlineSnapshot(` - ".styles_className__q7x3ow0 { + .styles_className__q7x3ow0 { color: red; - }" + } `); expect(normalizePath(filePath)).toMatchInlineSnapshot( - `"fixtures/class-composition/styles.css.ts"`, + `fixtures/class-composition/styles.css.ts`, ); } { const { css, filePath } = compiler.getCssForFile(sharedCssPath); expect(css).toMatchInlineSnapshot(` - ".shared_shared__16bmd920 { + .shared_shared__16bmd920 { background: blue; - }" + } `); expect(normalizePath(filePath)).toMatchInlineSnapshot( - `"fixtures/class-composition/shared.css.ts"`, + `fixtures/class-composition/shared.css.ts`, ); } }); @@ -174,40 +179,40 @@ describe('compiler', () => { const output = await compiler.processVanillaFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - "import 'fixtures/class-composition/shared.css.ts.vanilla.css'; + import 'fixtures/class-composition/shared.css.ts.vanilla.css'; import 'fixtures/class-composition/styles.css.ts.vanilla.css'; - export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920';" + export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920'; `); const localWatchFiles = getLocalFiles(output.watchFiles); expect(localWatchFiles).toMatchInlineSnapshot(` [ - "/fixtures/class-composition/styles.css.ts", - "/fixtures/class-composition/shared.css.ts", + /fixtures/class-composition/styles.css.ts, + /fixtures/class-composition/shared.css.ts, ] `); { const { css, filePath } = compiler.getCssForFile(cssPath); expect(css).toMatchInlineSnapshot(` - ".styles_className__q7x3ow0 { + .styles_className__q7x3ow0 { color: red; - }" + } `); expect(normalizePath(filePath)).toMatchInlineSnapshot( - `"fixtures/class-composition/styles.css.ts"`, + `fixtures/class-composition/styles.css.ts`, ); } { const { css, filePath } = compiler.getCssForFile(sharedCssPath); expect(css).toMatchInlineSnapshot(` - ".shared_shared__16bmd920 { + .shared_shared__16bmd920 { background: blue; - }" + } `); expect(normalizePath(filePath)).toMatchInlineSnapshot( - `"fixtures/class-composition/shared.css.ts"`, + `fixtures/class-composition/shared.css.ts`, ); } }); @@ -226,7 +231,7 @@ describe('compiler', () => { // We know `error.message` is defined, and we want make the snapshot consistent across machines normalizePath(error!.message!.replace(__dirname, '{{__dirname}}')), ).toMatchInlineSnapshot( - `"No CSS for file: {{__dirname}}/does-not-exist.css.ts"`, + `No CSS for file: {{__dirname}}/does-not-exist.css.ts`, ); }); @@ -239,15 +244,15 @@ describe('compiler', () => { ); const output = await compiler.processVanillaFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - "import 'fixtures/class-composition/shared.css.ts.vanilla.css'; + import 'fixtures/class-composition/shared.css.ts.vanilla.css'; import 'fixtures/class-composition/styles.css.ts.vanilla.css'; - export var className = 'q7x3ow0 _16bmd920';" + export var className = 'q7x3ow0 _16bmd920'; `); const { css } = compiler.getCssForFile(cssPath); expect(css).toMatchInlineSnapshot(` - ".q7x3ow0 { + .q7x3ow0 { color: red; - }" + } `); }); @@ -260,9 +265,9 @@ describe('compiler', () => { ); const output = await compiler.processVanillaFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - "import 'fixtures/class-composition/shared.css.ts.custom-extension.css'; + import 'fixtures/class-composition/shared.css.ts.custom-extension.css'; import 'fixtures/class-composition/styles.css.ts.custom-extension.css'; - export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920';" + export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920'; `); }); @@ -279,8 +284,8 @@ describe('compiler', () => { // The `root` className string should be a composition of multiple classes: expect(outputA.source).toMatchInlineSnapshot(` - "import 'fixtures/unused-compositions/shared.css.ts.vanilla.css'; - export var root = 'styles_a_root__mh4uy80 shared_shared__5i7sy00';" + import 'fixtures/unused-compositions/shared.css.ts.vanilla.css'; + export var root = 'styles_a_root__mh4uy80 shared_shared__5i7sy00'; `); // Process the file multiple times with different args to test caching @@ -289,16 +294,16 @@ describe('compiler', () => { // The `root` className string should be a composition of multiple classes: expect(outputB.source).toMatchInlineSnapshot(` - "import 'fixtures/unused-compositions/shared.css.ts.vanilla.css'; - export var root = 'styles_b_root__1k6843p0 shared_shared__5i7sy00';" + import 'fixtures/unused-compositions/shared.css.ts.vanilla.css'; + export var root = 'styles_b_root__1k6843p0 shared_shared__5i7sy00'; `); const { css } = compiler.getCssForFile(sharedCssPath); expect(css).toMatchInlineSnapshot(` - ".shared_shared__5i7sy00 { + .shared_shared__5i7sy00 { padding: 20px; background: peachpuff; - }" + } `); }); @@ -310,13 +315,13 @@ describe('compiler', () => { const { css } = compiler.getCssForFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - "import 'fixtures/selectors/getter.css.ts.vanilla.css'; + import 'fixtures/selectors/getter.css.ts.vanilla.css'; export var child = 'getter_child__ux95kn0'; - export var parent = 'getter_parent__ux95kn1';" + export var parent = 'getter_parent__ux95kn1'; `); expect(css).toMatchInlineSnapshot(` - ".getter_child__ux95kn0 { + .getter_child__ux95kn0 { background: blue; } .getter_parent__ux95kn1 .getter_child__ux95kn0 { @@ -327,7 +332,7 @@ describe('compiler', () => { } .getter_parent__ux95kn1:has(.getter_child__ux95kn0) { padding: 10px; - }" + } `); }); @@ -342,13 +347,13 @@ describe('compiler', () => { const { css } = compiler.getCssForFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - "import 'fixtures/recipes/recipeClassNames.css.ts.vanilla.css'; + import 'fixtures/recipes/recipeClassNames.css.ts.vanilla.css'; import { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn'; - export var recipeWithReferences = _7a468({defaultClassName:'recipeClassNames_recipeWithReferences__129pj258',variantClassNames:{first:{true:'recipeClassNames_recipeWithReferences_first_true__129pj259'}},defaultVariants:{},compoundVariants:[]});" + export var recipeWithReferences = _7a468({defaultClassName:'recipeClassNames_recipeWithReferences__129pj258',variantClassNames:{first:{true:'recipeClassNames_recipeWithReferences_first_true__129pj259'}},defaultVariants:{},compoundVariants:[]}); `); expect(css).toMatchInlineSnapshot(` - ".recipeClassNames_basic_rounded_true__129pj257 { + .recipeClassNames_basic_rounded_true__129pj257 { border-radius: 999px; } .recipeClassNames_recipeWithReferences__129pj258 { @@ -368,7 +373,7 @@ describe('compiler', () => { } .recipeClassNames_basic_spaceWithDefault_large__129pj252.recipeClassNames_basic_rounded_true__129pj257 .recipeClassNames_recipeWithReferences_first_true__129pj259 { color: white; - }" + } `); }); @@ -380,14 +385,14 @@ describe('compiler', () => { const { css } = compiler.getCssForFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - "import 'fixtures/vite-config/plugin.css.ts.vanilla.css'; - export var root = 'plugin_root__1e902gk0';" + import 'fixtures/vite-config/plugin.css.ts.vanilla.css'; + export var root = 'plugin_root__1e902gk0'; `); expect(css).toMatchInlineSnapshot(` - ".plugin_root__1e902gk0 { + .plugin_root__1e902gk0 { color: green; - }" + } `); }); @@ -399,16 +404,16 @@ describe('compiler', () => { const { css } = compiler.getCssForFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - "import 'fixtures/vite-config/util/vars.css.ts.vanilla.css'; + import 'fixtures/vite-config/util/vars.css.ts.vanilla.css'; import 'fixtures/vite-config/alias.css.ts.vanilla.css'; - export var root = 'alias_root__ez4dr20';" + export var root = 'alias_root__ez4dr20'; `); expect(css).toMatchInlineSnapshot(` - ".alias_root__ez4dr20 { + .alias_root__ez4dr20 { --border__13z1r1g0: 1px solid black; border: var(--border__13z1r1g0); - }" + } `); }); }); diff --git a/tests/compiler/compiler.vitest.test.ts b/tests/compiler/compiler.vitest.test.ts index 1ce8276a..ff53fa58 100644 --- a/tests/compiler/compiler.vitest.test.ts +++ b/tests/compiler/compiler.vitest.test.ts @@ -2,6 +2,16 @@ import path from 'path'; import { describe, beforeAll, afterAll, test, expect } from 'vitest'; import { createCompiler } from '@vanilla-extract/integration'; +// Vitest has trouble with snapshots that don't contain wrapping quotes. See this regex and the functions above/below it: +// https://github.com/vitest-dev/vitest/blob/ae73f2737607a878ba589d548aa6f8ba639dc07c/packages/snapshot/src/port/inlineSnapshot.ts#L96 +// We want to replace __dirname in strings, so we need to add a snapshot serializer for strings. +// But we also need to add quotes around the string to make sure Vitest doesn't get confused. +// In fact, just updating the snapshot from now on will mangle the test file ¯\_(ツ)_/¯ +expect.addSnapshotSerializer({ + test: (val) => typeof val === 'string', + print: (val) => `"${(val as string).replaceAll(__dirname, '{{__dirname}}')}"`, +}); + describe('compiler running in Vitest', () => { let compilers: Record< 'default' | 'vitePlugins' | 'viteResolve', From 6a775f82be4bf432f7ca2ab069554fb87cc7f8a8 Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sat, 3 Feb 2024 19:29:50 +1100 Subject: [PATCH 05/13] make the vite-node compiler return absolute paths --- packages/esbuild-plugin-next/src/index.ts | 4 +- packages/integration/src/compiler.ts | 22 ++++---- tests/compiler/compiler.test.ts | 61 +++++++++++------------ tests/compiler/compiler.vitest.test.ts | 10 ++-- 4 files changed, 46 insertions(+), 51 deletions(-) diff --git a/packages/esbuild-plugin-next/src/index.ts b/packages/esbuild-plugin-next/src/index.ts index 1d0f9bdb..ad896d43 100644 --- a/packages/esbuild-plugin-next/src/index.ts +++ b/packages/esbuild-plugin-next/src/index.ts @@ -53,9 +53,9 @@ export function vanillaExtractPlugin({ build.onLoad( { filter: /.*/, namespace: vanillaCssNamespace }, async ({ path }) => { - const [rootRelativePath] = path.split('.vanilla.css'); + const [vanillaModulePath] = path.split('.vanilla.css'); - let { css, filePath } = compiler.getCssForFile(rootRelativePath); + let { css, filePath } = compiler.getCssForFile(vanillaModulePath); if (typeof processCss === 'function') { css = await processCss(css); diff --git a/packages/integration/src/compiler.ts b/packages/integration/src/compiler.ts index 511c65fe..33a87ac8 100644 --- a/packages/integration/src/compiler.ts +++ b/packages/integration/src/compiler.ts @@ -1,4 +1,4 @@ -import { join, relative, isAbsolute } from 'path'; +import { join, isAbsolute } from 'path'; import type { Adapter } from '@vanilla-extract/css'; import { transformCss } from '@vanilla-extract/css/transformCss'; import type { ModuleNode, InlineConfig as ViteConfig } from 'vite'; @@ -16,20 +16,18 @@ type Composition = Parameters[0]; const globalAdapterIdentifier = '__vanilla_globalCssAdapter__'; -const scanModule = (entryModule: ModuleNode, root: string) => { +const scanModule = (entryModule: ModuleNode) => { const queue = new Set([entryModule]); const cssDeps = new Set(); const watchFiles = new Set(); for (const moduleNode of queue) { - if (moduleNode.id?.includes('@vanilla-extract/')) { + if (!moduleNode.id || moduleNode.id.includes('@vanilla-extract/')) { continue; } - const relativePath = moduleNode.id && relative(root, moduleNode.id); - - if (relativePath && cssFileFilter.test(relativePath)) { - cssDeps.add(relativePath); + if (cssFileFilter.test(moduleNode.id)) { + cssDeps.add(moduleNode.id); } if (moduleNode.file) { watchFiles.add(moduleNode.file); @@ -151,7 +149,7 @@ class NormalizedMap extends Map { #normalizePath(filePath: string) { return normalizePath( - isAbsolute(filePath) ? relative(this.root, filePath) : filePath, + isAbsolute(filePath) ? filePath : join(this.root, filePath), ); } @@ -319,7 +317,7 @@ export const createCompiler = ({ const cssImports = []; - const { cssDeps, watchFiles } = scanModule(moduleNode, root); + const { cssDeps, watchFiles } = scanModule(moduleNode); for (const cssDep of cssDeps) { const cssDepModuleId = normalizePath(cssDep); @@ -388,9 +386,7 @@ export const createCompiler = ({ }, getCssForFile(filePath: string) { filePath = isAbsolute(filePath) ? filePath : join(root, filePath); - const rootRelativePath = relative(root, filePath); - - const moduleId = normalizePath(rootRelativePath); + const moduleId = normalizePath(filePath); const result = cssCache.get(moduleId); if (!result) { @@ -399,7 +395,7 @@ export const createCompiler = ({ return { css: result.css, - filePath: rootRelativePath, + filePath: filePath, resolveDir: root, }; }, diff --git a/tests/compiler/compiler.test.ts b/tests/compiler/compiler.test.ts index 2ce70e8b..726e1d06 100644 --- a/tests/compiler/compiler.test.ts +++ b/tests/compiler/compiler.test.ts @@ -11,8 +11,7 @@ function getLocalFiles(files: Set) { return [...files] .map(normalizePath) - .filter((file) => file.startsWith(posixDirname)) - .map((file) => file.replace(posixDirname, '')); + .filter((file) => file.startsWith(posixDirname)); } describe('compiler', () => { @@ -87,16 +86,16 @@ describe('compiler', () => { const output = await compiler.processVanillaFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - import 'fixtures/class-composition/shared.css.ts.vanilla.css'; - import 'fixtures/class-composition/styles.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/class-composition/shared.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/class-composition/styles.css.ts.vanilla.css'; export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920'; `); const localWatchFiles = getLocalFiles(output.watchFiles); expect(localWatchFiles).toMatchInlineSnapshot(` [ - /fixtures/class-composition/styles.css.ts, - /fixtures/class-composition/shared.css.ts, + {{__dirname}}/fixtures/class-composition/styles.css.ts, + {{__dirname}}/fixtures/class-composition/shared.css.ts, ] `); @@ -108,7 +107,7 @@ describe('compiler', () => { } `); expect(normalizePath(filePath)).toMatchInlineSnapshot( - `fixtures/class-composition/styles.css.ts`, + `{{__dirname}}/fixtures/class-composition/styles.css.ts`, ); } @@ -120,7 +119,7 @@ describe('compiler', () => { } `); expect(normalizePath(filePath)).toMatchInlineSnapshot( - `fixtures/class-composition/shared.css.ts`, + `{{__dirname}}/fixtures/class-composition/shared.css.ts`, ); } }); @@ -133,16 +132,16 @@ describe('compiler', () => { const output = await compiler.processVanillaFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - import 'fixtures/class-composition/shared.css.ts.vanilla.css'; - import 'fixtures/class-composition/styles.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/class-composition/shared.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/class-composition/styles.css.ts.vanilla.css'; export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920'; `); const localWatchFiles = getLocalFiles(output.watchFiles); expect(localWatchFiles).toMatchInlineSnapshot(` [ - /fixtures/class-composition/styles.css.ts, - /fixtures/class-composition/shared.css.ts, + {{__dirname}}/fixtures/class-composition/styles.css.ts, + {{__dirname}}/fixtures/class-composition/shared.css.ts, ] `); @@ -154,7 +153,7 @@ describe('compiler', () => { } `); expect(normalizePath(filePath)).toMatchInlineSnapshot( - `fixtures/class-composition/styles.css.ts`, + `{{__dirname}}/fixtures/class-composition/styles.css.ts`, ); } @@ -166,7 +165,7 @@ describe('compiler', () => { } `); expect(normalizePath(filePath)).toMatchInlineSnapshot( - `fixtures/class-composition/shared.css.ts`, + `{{__dirname}}/fixtures/class-composition/shared.css.ts`, ); } }); @@ -179,16 +178,16 @@ describe('compiler', () => { const output = await compiler.processVanillaFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - import 'fixtures/class-composition/shared.css.ts.vanilla.css'; - import 'fixtures/class-composition/styles.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/class-composition/shared.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/class-composition/styles.css.ts.vanilla.css'; export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920'; `); const localWatchFiles = getLocalFiles(output.watchFiles); expect(localWatchFiles).toMatchInlineSnapshot(` [ - /fixtures/class-composition/styles.css.ts, - /fixtures/class-composition/shared.css.ts, + {{__dirname}}/fixtures/class-composition/styles.css.ts, + {{__dirname}}/fixtures/class-composition/shared.css.ts, ] `); @@ -200,7 +199,7 @@ describe('compiler', () => { } `); expect(normalizePath(filePath)).toMatchInlineSnapshot( - `fixtures/class-composition/styles.css.ts`, + `{{__dirname}}/fixtures/class-composition/styles.css.ts`, ); } @@ -212,7 +211,7 @@ describe('compiler', () => { } `); expect(normalizePath(filePath)).toMatchInlineSnapshot( - `fixtures/class-composition/shared.css.ts`, + `{{__dirname}}/fixtures/class-composition/shared.css.ts`, ); } }); @@ -244,8 +243,8 @@ describe('compiler', () => { ); const output = await compiler.processVanillaFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - import 'fixtures/class-composition/shared.css.ts.vanilla.css'; - import 'fixtures/class-composition/styles.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/class-composition/shared.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/class-composition/styles.css.ts.vanilla.css'; export var className = 'q7x3ow0 _16bmd920'; `); const { css } = compiler.getCssForFile(cssPath); @@ -265,8 +264,8 @@ describe('compiler', () => { ); const output = await compiler.processVanillaFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - import 'fixtures/class-composition/shared.css.ts.custom-extension.css'; - import 'fixtures/class-composition/styles.css.ts.custom-extension.css'; + import '{{__dirname}}/fixtures/class-composition/shared.css.ts.custom-extension.css'; + import '{{__dirname}}/fixtures/class-composition/styles.css.ts.custom-extension.css'; export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920'; `); }); @@ -284,7 +283,7 @@ describe('compiler', () => { // The `root` className string should be a composition of multiple classes: expect(outputA.source).toMatchInlineSnapshot(` - import 'fixtures/unused-compositions/shared.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/unused-compositions/shared.css.ts.vanilla.css'; export var root = 'styles_a_root__mh4uy80 shared_shared__5i7sy00'; `); @@ -294,7 +293,7 @@ describe('compiler', () => { // The `root` className string should be a composition of multiple classes: expect(outputB.source).toMatchInlineSnapshot(` - import 'fixtures/unused-compositions/shared.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/unused-compositions/shared.css.ts.vanilla.css'; export var root = 'styles_b_root__1k6843p0 shared_shared__5i7sy00'; `); @@ -315,7 +314,7 @@ describe('compiler', () => { const { css } = compiler.getCssForFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - import 'fixtures/selectors/getter.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/selectors/getter.css.ts.vanilla.css'; export var child = 'getter_child__ux95kn0'; export var parent = 'getter_parent__ux95kn1'; `); @@ -347,7 +346,7 @@ describe('compiler', () => { const { css } = compiler.getCssForFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - import 'fixtures/recipes/recipeClassNames.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/recipes/recipeClassNames.css.ts.vanilla.css'; import { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn'; export var recipeWithReferences = _7a468({defaultClassName:'recipeClassNames_recipeWithReferences__129pj258',variantClassNames:{first:{true:'recipeClassNames_recipeWithReferences_first_true__129pj259'}},defaultVariants:{},compoundVariants:[]}); `); @@ -385,7 +384,7 @@ describe('compiler', () => { const { css } = compiler.getCssForFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - import 'fixtures/vite-config/plugin.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/vite-config/plugin.css.ts.vanilla.css'; export var root = 'plugin_root__1e902gk0'; `); @@ -404,8 +403,8 @@ describe('compiler', () => { const { css } = compiler.getCssForFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - import 'fixtures/vite-config/util/vars.css.ts.vanilla.css'; - import 'fixtures/vite-config/alias.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/vite-config/util/vars.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/vite-config/alias.css.ts.vanilla.css'; export var root = 'alias_root__ez4dr20'; `); diff --git a/tests/compiler/compiler.vitest.test.ts b/tests/compiler/compiler.vitest.test.ts index ff53fa58..00231c14 100644 --- a/tests/compiler/compiler.vitest.test.ts +++ b/tests/compiler/compiler.vitest.test.ts @@ -68,8 +68,8 @@ describe('compiler running in Vitest', () => { const { source } = await compiler.processVanillaFile(cssPath); expect(source).toMatchInlineSnapshot(` - "import 'fixtures/class-composition/shared.css.ts.vanilla.css'; - import 'fixtures/class-composition/styles.css.ts.vanilla.css'; + "import '{{__dirname}}/fixtures/class-composition/shared.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/class-composition/styles.css.ts.vanilla.css'; export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920';" `); @@ -88,7 +88,7 @@ describe('compiler running in Vitest', () => { const { source } = await compiler.processVanillaFile(cssPath); expect(source).toMatchInlineSnapshot(` - "import 'fixtures/vite-config/plugin.css.ts.vanilla.css'; + "import '{{__dirname}}/fixtures/vite-config/plugin.css.ts.vanilla.css'; export var root = 'plugin_root__1e902gk0';" `); @@ -107,8 +107,8 @@ describe('compiler running in Vitest', () => { const { source } = await compiler.processVanillaFile(cssPath); expect(source).toMatchInlineSnapshot(` - "import 'fixtures/vite-config/util/vars.css.ts.vanilla.css'; - import 'fixtures/vite-config/alias.css.ts.vanilla.css'; + "import '{{__dirname}}/fixtures/vite-config/util/vars.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/vite-config/alias.css.ts.vanilla.css'; export var root = 'alias_root__ez4dr20';" `); From 135ac04ddddd41eb757bc0cff1a233a28d559679 Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sat, 3 Feb 2024 19:58:10 +1100 Subject: [PATCH 06/13] bump TypeScript to v5.3.3 in the monorepo --- package.json | 2 +- pnpm-lock.yaml | 26 +++++++++++++++---------- tests/sprinkles/sprinkles-type-tests.ts | 11 ++--------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 1ae098fe..124c2f94 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "rollup-plugin-dts": "^4.2.2", "rollup-plugin-node-externals": "^5.0.0", "ts-node": "^10.0.0", - "typescript": "^4.9.4", + "typescript": "^5.3.3", "vitest": "^1.2.2" }, "preconstruct": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b95ce383..c595f6a9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -81,16 +81,16 @@ importers: version: 2.79.1 rollup-plugin-dts: specifier: ^4.2.2 - version: 4.2.2(rollup@2.79.1)(typescript@4.9.4) + version: 4.2.2(rollup@2.79.1)(typescript@5.3.3) rollup-plugin-node-externals: specifier: ^5.0.0 version: 5.0.0(rollup@2.79.1) ts-node: specifier: ^10.0.0 - version: 10.9.1(@swc/core@1.2.112)(@types/node@20.9.5)(typescript@4.9.4) + version: 10.9.1(@swc/core@1.2.112)(@types/node@20.9.5)(typescript@5.3.3) typescript: - specifier: ^4.9.4 - version: 4.9.4 + specifier: ^5.3.3 + version: 5.3.3 vitest: specifier: ^1.2.2 version: 1.2.2(@types/node@20.9.5) @@ -11374,7 +11374,7 @@ packages: pretty-format: 29.7.0 slash: 3.0.0 strip-json-comments: 3.1.1 - ts-node: 10.9.1(@swc/core@1.2.112)(@types/node@20.9.5)(typescript@4.9.4) + ts-node: 10.9.1(@swc/core@1.2.112)(@types/node@20.9.5)(typescript@5.3.3) transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -14429,7 +14429,7 @@ packages: dependencies: import-cwd: 3.0.0 lilconfig: 2.1.0 - ts-node: 10.9.1(@swc/core@1.2.112)(@types/node@20.9.5)(typescript@4.9.4) + ts-node: 10.9.1(@swc/core@1.2.112)(@types/node@20.9.5)(typescript@5.3.3) yaml: 1.10.2 /postcss-merge-longhand@5.1.7(postcss@8.4.33): @@ -15610,7 +15610,7 @@ packages: dependencies: glob: 7.2.0 - /rollup-plugin-dts@4.2.2(rollup@2.79.1)(typescript@4.9.4): + /rollup-plugin-dts@4.2.2(rollup@2.79.1)(typescript@5.3.3): resolution: {integrity: sha512-A3g6Rogyko/PXeKoUlkjxkP++8UDVpgA7C+Tdl77Xj4fgEaIjPSnxRmR53EzvoYy97VMVwLAOcWJudaVAuxneQ==} engines: {node: '>=v12.22.11'} peerDependencies: @@ -15619,7 +15619,7 @@ packages: dependencies: magic-string: 0.26.4 rollup: 2.79.1 - typescript: 4.9.4 + typescript: 5.3.3 optionalDependencies: '@babel/code-frame': 7.18.6 dev: false @@ -17090,7 +17090,7 @@ packages: yn: 3.1.1 dev: true - /ts-node@10.9.1(@swc/core@1.2.112)(@types/node@20.9.5)(typescript@4.9.4): + /ts-node@10.9.1(@swc/core@1.2.112)(@types/node@20.9.5)(typescript@5.3.3): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -17117,7 +17117,7 @@ packages: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.9.4 + typescript: 5.3.3 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 @@ -17258,6 +17258,12 @@ packages: resolution: {integrity: sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==} engines: {node: '>=4.2.0'} hasBin: true + dev: true + + /typescript@5.3.3: + resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} + engines: {node: '>=14.17'} + hasBin: true /typographic-apostrophes-for-possessive-plurals@1.0.5: resolution: {integrity: sha512-sBUA/sFTAFFjd/ey9Xtld1cq2fXCZJ0tQHmlDovttMC9D1WJDOt2f49b9DxA0Yk2iK3yoDFm0HQAs/mKO24sDg==} diff --git a/tests/sprinkles/sprinkles-type-tests.ts b/tests/sprinkles/sprinkles-type-tests.ts index f7fe450d..386d0c99 100644 --- a/tests/sprinkles/sprinkles-type-tests.ts +++ b/tests/sprinkles/sprinkles-type-tests.ts @@ -214,15 +214,8 @@ const noop = (...args: Array) => {}; responsiveValue = ['NOPE']; // @ts-expect-error responsiveValue = [123]; - responsiveValue = [ - 'row', - 'row', - 'row', - // @ts-expect-error - 'your', - // @ts-expect-error - 'boat', - ]; + // @ts-expect-error + responsiveValue = ['row', 'row', 'row', 'your', 'boat']; // @ts-expect-error responsiveValue = { mobile: 'nope' }; // @ts-expect-error From fef6e66d5052a2e7861256552bb2c33d1f265fc0 Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sat, 3 Feb 2024 20:01:41 +1100 Subject: [PATCH 07/13] add a fixture with reproduction for #1302 --- pnpm-lock.yaml | 36 +++++++++++ tests/compiler/compiler.test.ts | 62 ++++++++++++++----- tests/compiler/compiler.vitest.test.ts | 9 ++- .../fixtures/tsconfig-paths/src/main.css.ts | 7 +++ .../fixtures/tsconfig-paths/src/main.tsx | 5 ++ .../fixtures/tsconfig-paths/tsconfig.json | 8 +++ tests/package.json | 3 +- tsconfig.json | 6 +- 8 files changed, 115 insertions(+), 21 deletions(-) create mode 100644 tests/compiler/fixtures/tsconfig-paths/src/main.css.ts create mode 100644 tests/compiler/fixtures/tsconfig-paths/src/main.tsx create mode 100644 tests/compiler/fixtures/tsconfig-paths/tsconfig.json diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c595f6a9..7e87ef66 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -827,6 +827,9 @@ importers: '@vanilla-extract/sprinkles': specifier: '*' version: link:../packages/sprinkles + vite-tsconfig-paths: + specifier: ^4.3.1 + version: 4.3.1(typescript@5.3.3) packages: @@ -9866,6 +9869,10 @@ packages: transitivePeerDependencies: - supports-color + /globrex@0.1.2: + resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} + dev: false + /gonzales-pe@4.3.0: resolution: {integrity: sha512-otgSPpUmdWJ43VXyiNgEYE4luzHCL2pz4wQ0OnDluC6Eg4Ko3Vexy/SrSynglw/eR+OhkzmqFCZa/OFa/RgAOQ==} engines: {node: '>=0.6.0'} @@ -17121,6 +17128,19 @@ packages: v8-compile-cache-lib: 3.0.1 yn: 3.1.1 + /tsconfck@3.0.1(typescript@5.3.3): + resolution: {integrity: sha512-7ppiBlF3UEddCLeI1JRx5m2Ryq+xk4JrZuq4EuYXykipebaq1dV0Fhgr1hb7CkmHt32QSgOZlcqVLEtHBG4/mg==} + engines: {node: ^18 || >=20} + hasBin: true + peerDependencies: + typescript: ^5.0.0 + peerDependenciesMeta: + typescript: + optional: true + dependencies: + typescript: 5.3.3 + dev: false + /tslib@1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} dev: true @@ -17765,6 +17785,22 @@ packages: - supports-color dev: false + /vite-tsconfig-paths@4.3.1(typescript@5.3.3): + resolution: {integrity: sha512-cfgJwcGOsIxXOLU/nELPny2/LUD/lcf1IbfyeKTv2bsupVbTH/xpFtdQlBmIP1GEK2CjjLxYhFfB+QODFAx5aw==} + peerDependencies: + vite: '*' + peerDependenciesMeta: + vite: + optional: true + dependencies: + debug: 4.3.4(supports-color@9.2.3) + globrex: 0.1.2 + tsconfck: 3.0.1(typescript@5.3.3) + transitivePeerDependencies: + - supports-color + - typescript + dev: false + /vite@5.0.12(@types/node@20.9.5): resolution: {integrity: sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==} engines: {node: ^18.0.0 || >=20.0.0} diff --git a/tests/compiler/compiler.test.ts b/tests/compiler/compiler.test.ts index 726e1d06..a78076fc 100644 --- a/tests/compiler/compiler.test.ts +++ b/tests/compiler/compiler.test.ts @@ -1,5 +1,6 @@ import path from 'path'; import { createCompiler, normalizePath } from '@vanilla-extract/integration'; +import tsconfigPaths from 'vite-tsconfig-paths'; expect.addSnapshotSerializer({ test: (val) => typeof val === 'string', @@ -19,8 +20,9 @@ describe('compiler', () => { | 'default' | 'cssImportSpecifier' | 'shortIdentifiers' + | 'viteResolve' | 'vitePlugins' - | 'viteResolve', + | 'tsconfigPaths', ReturnType >; @@ -37,6 +39,14 @@ describe('compiler', () => { root: __dirname, identifiers: 'short', }), + viteResolve: createCompiler({ + root: __dirname, + viteResolve: { + alias: { + '@util': path.resolve(__dirname, 'fixtures/vite-config/util'), + }, + }, + }), vitePlugins: createCompiler({ root: __dirname, vitePlugins: [ @@ -55,13 +65,9 @@ describe('compiler', () => { }, ], }), - viteResolve: createCompiler({ + tsconfigPaths: createCompiler({ root: __dirname, - viteResolve: { - alias: { - '@util': path.resolve(__dirname, 'fixtures/vite-config/util'), - }, - }, + vitePlugins: [tsconfigPaths()], }), }; }); @@ -376,6 +382,27 @@ describe('compiler', () => { `); }); + test('Vite resolve', async () => { + const compiler = compilers.viteResolve; + + const cssPath = path.join(__dirname, 'fixtures/vite-config/alias.css.ts'); + const output = await compiler.processVanillaFile(cssPath); + const { css } = compiler.getCssForFile(cssPath); + + expect(output.source).toMatchInlineSnapshot(` + import '{{__dirname}}/fixtures/vite-config/util/vars.css.ts.vanilla.css'; + import '{{__dirname}}/fixtures/vite-config/alias.css.ts.vanilla.css'; + export var root = 'alias_root__ez4dr20'; + `); + + expect(css).toMatchInlineSnapshot(` + .alias_root__ez4dr20 { + --border__13z1r1g0: 1px solid black; + border: var(--border__13z1r1g0); + } + `); + }); + test('Vite plugins', async () => { const compiler = compilers.vitePlugins; @@ -395,23 +422,26 @@ describe('compiler', () => { `); }); - test('Vite resolve', async () => { - const compiler = compilers.viteResolve; + test('vite-tsconfig-paths', async () => { + const compiler = compilers.tsconfigPaths; - const cssPath = path.join(__dirname, 'fixtures/vite-config/alias.css.ts'); + const cssPath = path.join( + __dirname, + 'fixtures/tsconfig-paths/src/main.css.ts', + ); const output = await compiler.processVanillaFile(cssPath); const { css } = compiler.getCssForFile(cssPath); expect(output.source).toMatchInlineSnapshot(` - import '{{__dirname}}/fixtures/vite-config/util/vars.css.ts.vanilla.css'; - import '{{__dirname}}/fixtures/vite-config/alias.css.ts.vanilla.css'; - export var root = 'alias_root__ez4dr20'; + import '{{__dirname}}/fixtures/tsconfig-paths/src/main.css.ts.vanilla.css'; + export var box = 'main_box__1tm7bbb0'; `); expect(css).toMatchInlineSnapshot(` - .alias_root__ez4dr20 { - --border__13z1r1g0: 1px solid black; - border: var(--border__13z1r1g0); + .main_box__1tm7bbb0 { + box-sizing: border-box; + margin: 0; + padding: 0; } `); }); diff --git a/tests/compiler/compiler.vitest.test.ts b/tests/compiler/compiler.vitest.test.ts index 00231c14..f852e903 100644 --- a/tests/compiler/compiler.vitest.test.ts +++ b/tests/compiler/compiler.vitest.test.ts @@ -67,13 +67,14 @@ describe('compiler running in Vitest', () => { ); const { source } = await compiler.processVanillaFile(cssPath); + const { css } = compiler.getCssForFile(cssPath); + expect(source).toMatchInlineSnapshot(` "import '{{__dirname}}/fixtures/class-composition/shared.css.ts.vanilla.css'; import '{{__dirname}}/fixtures/class-composition/styles.css.ts.vanilla.css'; export var className = 'styles_className__q7x3ow0 shared_shared__16bmd920';" `); - const { css } = compiler.getCssForFile(cssPath); expect(css).toMatchInlineSnapshot(` ".styles_className__q7x3ow0 { color: red; @@ -87,12 +88,13 @@ describe('compiler running in Vitest', () => { const cssPath = path.join(__dirname, 'fixtures/vite-config/plugin.css.ts'); const { source } = await compiler.processVanillaFile(cssPath); + const { css } = compiler.getCssForFile(cssPath); + expect(source).toMatchInlineSnapshot(` "import '{{__dirname}}/fixtures/vite-config/plugin.css.ts.vanilla.css'; export var root = 'plugin_root__1e902gk0';" `); - const { css } = compiler.getCssForFile(cssPath); expect(css).toMatchInlineSnapshot(` ".plugin_root__1e902gk0 { color: green; @@ -106,13 +108,14 @@ describe('compiler running in Vitest', () => { const cssPath = path.join(__dirname, 'fixtures/vite-config/alias.css.ts'); const { source } = await compiler.processVanillaFile(cssPath); + const { css } = compiler.getCssForFile(cssPath); + expect(source).toMatchInlineSnapshot(` "import '{{__dirname}}/fixtures/vite-config/util/vars.css.ts.vanilla.css'; import '{{__dirname}}/fixtures/vite-config/alias.css.ts.vanilla.css'; export var root = 'alias_root__ez4dr20';" `); - const { css } = compiler.getCssForFile(cssPath); expect(css).toMatchInlineSnapshot(` ".alias_root__ez4dr20 { --border__13z1r1g0: 1px solid black; diff --git a/tests/compiler/fixtures/tsconfig-paths/src/main.css.ts b/tests/compiler/fixtures/tsconfig-paths/src/main.css.ts new file mode 100644 index 00000000..016d1cdd --- /dev/null +++ b/tests/compiler/fixtures/tsconfig-paths/src/main.css.ts @@ -0,0 +1,7 @@ +import { style } from '@vanilla-extract/css'; + +export const box = style({ + boxSizing: 'border-box', + margin: 0, + padding: 0, +}); diff --git a/tests/compiler/fixtures/tsconfig-paths/src/main.tsx b/tests/compiler/fixtures/tsconfig-paths/src/main.tsx new file mode 100644 index 00000000..d37e3782 --- /dev/null +++ b/tests/compiler/fixtures/tsconfig-paths/src/main.tsx @@ -0,0 +1,5 @@ +import { box } from 'main.css'; + +document.getElementById('root')!.innerHTML = ` +
hello world
+`; diff --git a/tests/compiler/fixtures/tsconfig-paths/tsconfig.json b/tests/compiler/fixtures/tsconfig-paths/tsconfig.json new file mode 100644 index 00000000..0de0d4d7 --- /dev/null +++ b/tests/compiler/fixtures/tsconfig-paths/tsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "isolatedModules": true, + "module": "ESNext", + "moduleResolution": "Bundler", + "baseUrl": "./src" + } +} diff --git a/tests/package.json b/tests/package.json index 58e7688b..82906365 100644 --- a/tests/package.json +++ b/tests/package.json @@ -13,6 +13,7 @@ "@vanilla-extract/dynamic": "*", "@vanilla-extract/integration": "*", "@vanilla-extract/recipes": "*", - "@vanilla-extract/sprinkles": "*" + "@vanilla-extract/sprinkles": "*", + "vite-tsconfig-paths": "^4.3.1" } } diff --git a/tsconfig.json b/tsconfig.json index a3a82483..04f590d3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,7 +18,11 @@ "isolatedModules": true, "downlevelIteration": true }, - "exclude": ["node_modules", "**/dist/**"], + "exclude": [ + "node_modules", + "**/dist/**", + "tests/compiler/fixtures/tsconfig-paths/**" + ], "include": [ "@types/testing-library__jest-dom", "./jest.setup.ts", From ac4d070d07ceaa16745012a1b5c8ba682789b617 Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sat, 3 Feb 2024 20:15:18 +1100 Subject: [PATCH 08/13] add changesets --- .changeset/integration.md | 5 +++++ .changeset/plugins.md | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 .changeset/integration.md create mode 100644 .changeset/plugins.md diff --git a/.changeset/integration.md b/.changeset/integration.md new file mode 100644 index 00000000..527ce6d5 --- /dev/null +++ b/.changeset/integration.md @@ -0,0 +1,5 @@ +--- +'@vanilla-extract/integration': major +--- + +Use absolute paths internally to make sure Vite resolves modules correctly diff --git a/.changeset/plugins.md b/.changeset/plugins.md new file mode 100644 index 00000000..23079c93 --- /dev/null +++ b/.changeset/plugins.md @@ -0,0 +1,5 @@ +--- +'@vanilla-extract/vite-plugin': patch +--- + +Correctly resolve module paths when using Vite plugins that affect module resolution, such as [`vite-tsconfig-paths`](https://github.com/aleclarson/vite-tsconfig-paths) From f204123fb36597e72bcdfa6b435930c8910ed18c Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sat, 3 Feb 2024 21:23:51 +1100 Subject: [PATCH 09/13] set env vars with `cross-env` --- package.json | 3 ++- pnpm-lock.yaml | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 124c2f94..14a3c274 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "start-site": "pnpm --filter=site start", "build-site": "pnpm --filter=site build", "test:unit": "pnpm test:jest && pnpm test:vitest", - "test:jest": "NODE_OPTIONS=--experimental-vm-modules jest", + "test:jest": "cross-env NODE_OPTIONS=--experimental-vm-modules jest", "test:vitest": "vitest --watch=false", "test:playwright": "NODE_OPTIONS=--no-experimental-fetch playwright test", "format": "prettier --write .", @@ -41,6 +41,7 @@ "@types/testing-library__jest-dom": "^5.14.5", "@vanilla-extract/jest-transform": "*", "babel-jest": "^27.3.1", + "cross-env": "^7.0.3", "fast-glob": "^3.2.7", "jest": "^29.7.0", "jest-environment-jsdom": "^29.3.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7e87ef66..7e8aa8f5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -61,6 +61,9 @@ importers: babel-jest: specifier: ^27.3.1 version: 27.3.1(@babel/core@7.20.7) + cross-env: + specifier: ^7.0.3 + version: 7.0.3 fast-glob: specifier: ^3.2.7 version: 3.3.2 @@ -7787,6 +7790,14 @@ packages: luxon: 3.0.4 dev: true + /cross-env@7.0.3: + resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} + engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} + hasBin: true + dependencies: + cross-spawn: 7.0.3 + dev: false + /cross-spawn@5.1.0: resolution: {integrity: sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==} dependencies: From 4f7ea542e241affe574269c710bdf380e19cbd95 Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sat, 3 Feb 2024 21:32:40 +1100 Subject: [PATCH 10/13] normalize __dirname when doing string replacement --- tests/compiler/compiler.test.ts | 3 ++- tests/compiler/compiler.vitest.test.ts | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/compiler/compiler.test.ts b/tests/compiler/compiler.test.ts index a78076fc..dab72690 100644 --- a/tests/compiler/compiler.test.ts +++ b/tests/compiler/compiler.test.ts @@ -4,7 +4,8 @@ import tsconfigPaths from 'vite-tsconfig-paths'; expect.addSnapshotSerializer({ test: (val) => typeof val === 'string', - print: (val) => (val as string).replaceAll(__dirname, '{{__dirname}}'), + print: (val) => + (val as string).replaceAll(normalizePath(__dirname), '{{__dirname}}'), }); function getLocalFiles(files: Set) { diff --git a/tests/compiler/compiler.vitest.test.ts b/tests/compiler/compiler.vitest.test.ts index f852e903..60ad4d09 100644 --- a/tests/compiler/compiler.vitest.test.ts +++ b/tests/compiler/compiler.vitest.test.ts @@ -1,6 +1,6 @@ import path from 'path'; import { describe, beforeAll, afterAll, test, expect } from 'vitest'; -import { createCompiler } from '@vanilla-extract/integration'; +import { createCompiler, normalizePath } from '@vanilla-extract/integration'; // Vitest has trouble with snapshots that don't contain wrapping quotes. See this regex and the functions above/below it: // https://github.com/vitest-dev/vitest/blob/ae73f2737607a878ba589d548aa6f8ba639dc07c/packages/snapshot/src/port/inlineSnapshot.ts#L96 @@ -9,7 +9,10 @@ import { createCompiler } from '@vanilla-extract/integration'; // In fact, just updating the snapshot from now on will mangle the test file ¯\_(ツ)_/¯ expect.addSnapshotSerializer({ test: (val) => typeof val === 'string', - print: (val) => `"${(val as string).replaceAll(__dirname, '{{__dirname}}')}"`, + print: (val) => + '"' + + (val as string).replaceAll(normalizePath(__dirname), '{{__dirname}}') + + '"', }); describe('compiler running in Vitest', () => { From 8898a3f6b85e19de60478c7c1a67269fcd9511af Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sun, 4 Feb 2024 13:48:11 +1100 Subject: [PATCH 11/13] dedupe lockfile --- pnpm-lock.yaml | 207 +++---------------------------------------------- 1 file changed, 12 insertions(+), 195 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7e8aa8f5..a9e6559b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -408,7 +408,7 @@ importers: devDependencies: '@jest/transform': specifier: ^29.0.3 - version: 29.4.3 + version: 29.7.0 packages/next-plugin: dependencies: @@ -2792,16 +2792,6 @@ packages: - ts-node dev: false - /@jest/environment@29.4.3: - resolution: {integrity: sha512-dq5S6408IxIa+lr54zeqce+QgI+CJT4nmmA+1yzFgtcsGK8c/EyiUb9XQOgz3BMKrRDfKseeOaxj2eO8LlD3lA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/fake-timers': 29.4.3 - '@jest/types': 29.4.3 - '@types/node': 20.9.5 - jest-mock: 29.4.3 - dev: false - /@jest/environment@29.7.0: resolution: {integrity: sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -2812,13 +2802,6 @@ packages: jest-mock: 29.7.0 dev: false - /@jest/expect-utils@29.4.3: - resolution: {integrity: sha512-/6JWbkxHOP8EoS8jeeTd9dTfc9Uawi+43oLKHfp6zzux3U2hqOOVnV3ai4RpDYHOccL6g+5nrxpoc8DmJxtXVQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - jest-get-type: 29.4.3 - dev: false - /@jest/expect-utils@29.7.0: resolution: {integrity: sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -2836,18 +2819,6 @@ packages: - supports-color dev: false - /@jest/fake-timers@29.4.3: - resolution: {integrity: sha512-4Hote2MGcCTWSD2gwl0dwbCpBRHhE6olYEuTj8FMowdg3oQWNKr2YuxenPQYZ7+PfqPY1k98wKDU4Z+Hvd4Tiw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/types': 29.4.3 - '@sinonjs/fake-timers': 10.0.2 - '@types/node': 20.9.5 - jest-message-util: 29.4.3 - jest-mock: 29.4.3 - jest-util: 29.4.3 - dev: false - /@jest/fake-timers@29.7.0: resolution: {integrity: sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -2967,29 +2938,6 @@ packages: - supports-color dev: false - /@jest/transform@29.4.3: - resolution: {integrity: sha512-8u0+fBGWolDshsFgPQJESkDa72da/EVwvL+II0trN2DR66wMwiQ9/CihaGfHdlLGFzbBZwMykFtxuwFdZqlKwg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@babel/core': 7.20.7 - '@jest/types': 29.4.3 - '@jridgewell/trace-mapping': 0.3.22 - babel-plugin-istanbul: 6.1.1 - chalk: 4.1.2 - convert-source-map: 2.0.0 - fast-json-stable-stringify: 2.1.0 - graceful-fs: 4.2.10 - jest-haste-map: 29.4.3 - jest-regex-util: 29.4.3 - jest-util: 29.4.3 - micromatch: 4.0.5 - pirates: 4.0.5 - slash: 3.0.0 - write-file-atomic: 4.0.2 - transitivePeerDependencies: - - supports-color - dev: true - /@jest/transform@29.7.0: resolution: {integrity: sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -3011,7 +2959,6 @@ packages: write-file-atomic: 4.0.2 transitivePeerDependencies: - supports-color - dev: false /@jest/types@25.5.0: resolution: {integrity: sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==} @@ -3044,17 +2991,6 @@ packages: '@types/yargs': 16.0.4 chalk: 4.1.2 - /@jest/types@29.4.3: - resolution: {integrity: sha512-bPYfw8V65v17m2Od1cv44FH+SiKW7w2Xu7trhcdTLUmSv85rfKsP+qXSjO4KGJr4dtPSzl/gvslZBXctf1qGEA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/schemas': 29.6.3 - '@types/istanbul-lib-coverage': 2.0.3 - '@types/istanbul-reports': 3.0.1 - '@types/node': 20.9.5 - '@types/yargs': 17.0.12 - chalk: 4.1.2 - /@jest/types@29.6.3: resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -3065,7 +3001,6 @@ packages: '@types/node': 20.9.5 '@types/yargs': 17.0.12 chalk: 4.1.2 - dev: false /@jridgewell/gen-mapping@0.1.1: resolution: {integrity: sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==} @@ -4813,12 +4748,8 @@ packages: playwright: 1.40.1 dev: false - /@polka/url@1.0.0-next.21: - resolution: {integrity: sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==} - /@polka/url@1.0.0-next.24: resolution: {integrity: sha512-2LuNTFBIO0m7kKIQvvPHN6UE63VjpmL9rnEEaOOaiSPbZK+zUOYIzBAWcED+3XYzhYsd/0mD57VdxAEqqV52CQ==} - dev: false /@preconstruct/cli@2.8.2: resolution: {integrity: sha512-/nra7Arq622kVCfvQi4nhrZN+0m1OVq0PAuUcMLKNUR8O/JHOmesultWpeTGB17HzYEx8qYWO11QaTF7oz1yAQ==} @@ -5539,7 +5470,7 @@ packages: /@types/jest@29.2.5: resolution: {integrity: sha512-H2cSxkKgVmqNHXP7TC2L/WUorrZu8ZigyRywfVzv6EyBlxj39n4C00hjXYQWsbwqgElaj/CiAeSRmk5GoaKTgw==} dependencies: - expect: 29.4.3 + expect: 29.7.0 pretty-format: 29.7.0 dev: false @@ -6085,7 +6016,7 @@ packages: resolution: {integrity: sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==} dependencies: acorn: 8.11.2 - acorn-walk: 8.3.1 + acorn-walk: 8.3.2 dev: false /acorn-import-assertions@1.9.0(acorn@8.11.2): @@ -6106,14 +6037,9 @@ packages: resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==} engines: {node: '>=0.4.0'} - /acorn-walk@8.3.1: - resolution: {integrity: sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==} - engines: {node: '>=0.4.0'} - /acorn-walk@8.3.2: resolution: {integrity: sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==} engines: {node: '>=0.4.0'} - dev: false /acorn@7.4.1: resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==} @@ -9013,17 +8939,6 @@ packages: transitivePeerDependencies: - supports-color - /expect@29.4.3: - resolution: {integrity: sha512-uC05+Q7eXECFpgDrHdXA4k2rpMyStAYPItEDLyQDo5Ta7fVkJnNA/4zh/OIVkVVNZ1oOK1PipQoyNjuZ6sz6Dg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/expect-utils': 29.4.3 - jest-get-type: 29.4.3 - jest-matcher-utils: 29.4.3 - jest-message-util: 29.4.3 - jest-util: 29.4.3 - dev: false - /expect@29.7.0: resolution: {integrity: sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -11398,16 +11313,6 @@ packages: - supports-color dev: false - /jest-diff@29.4.3: - resolution: {integrity: sha512-YB+ocenx7FZ3T5O9lMVMeLYV4265socJKtkwgk/6YUz/VsEzYDkiMuMhWzZmxm3wDRQvayJu/PjkjjSkjoHsCA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - chalk: 4.1.2 - diff-sequences: 29.6.3 - jest-get-type: 29.4.3 - pretty-format: 29.7.0 - dev: false - /jest-diff@29.7.0: resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -11445,13 +11350,13 @@ packages: canvas: optional: true dependencies: - '@jest/environment': 29.4.3 - '@jest/fake-timers': 29.4.3 - '@jest/types': 29.4.3 + '@jest/environment': 29.7.0 + '@jest/fake-timers': 29.7.0 + '@jest/types': 29.6.3 '@types/jsdom': 20.0.1 '@types/node': 20.9.5 - jest-mock: 29.4.3 - jest-util: 29.4.3 + jest-mock: 29.7.0 + jest-util: 29.7.0 jsdom: 20.0.3 transitivePeerDependencies: - bufferutil @@ -11481,11 +11386,6 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dev: true - /jest-get-type@29.4.3: - resolution: {integrity: sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dev: false - /jest-get-type@29.6.3: resolution: {integrity: sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -11511,25 +11411,6 @@ packages: fsevents: 2.3.3 dev: false - /jest-haste-map@29.4.3: - resolution: {integrity: sha512-eZIgAS8tvm5IZMtKlR8Y+feEOMfo2pSQkmNbufdbMzMSn9nitgGxF1waM/+LbryO3OkMcKS98SUb+j/cQxp/vQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/types': 29.4.3 - '@types/graceful-fs': 4.1.5 - '@types/node': 20.9.5 - anymatch: 3.1.2 - fb-watchman: 2.0.1 - graceful-fs: 4.2.10 - jest-regex-util: 29.4.3 - jest-util: 29.4.3 - jest-worker: 29.4.3 - micromatch: 4.0.5 - walker: 1.0.8 - optionalDependencies: - fsevents: 2.3.3 - dev: true - /jest-haste-map@29.7.0: resolution: {integrity: sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -11547,7 +11428,6 @@ packages: walker: 1.0.8 optionalDependencies: fsevents: 2.3.3 - dev: false /jest-leak-detector@29.7.0: resolution: {integrity: sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==} @@ -11557,16 +11437,6 @@ packages: pretty-format: 29.7.0 dev: false - /jest-matcher-utils@29.4.3: - resolution: {integrity: sha512-TTciiXEONycZ03h6R6pYiZlSkvYgT0l8aa49z/DLSGYjex4orMUcafuLXYyyEDWB1RKglq00jzwY00Ei7yFNVg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - chalk: 4.1.2 - jest-diff: 29.4.3 - jest-get-type: 29.4.3 - pretty-format: 29.7.0 - dev: false - /jest-matcher-utils@29.7.0: resolution: {integrity: sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -11577,21 +11447,6 @@ packages: pretty-format: 29.7.0 dev: false - /jest-message-util@29.4.3: - resolution: {integrity: sha512-1Y8Zd4ZCN7o/QnWdMmT76If8LuDv23Z1DRovBj/vcSFNlGCJGoO8D1nJDw1AdyAGUk0myDLFGN5RbNeJyCRGCw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@babel/code-frame': 7.18.6 - '@jest/types': 29.4.3 - '@types/stack-utils': 2.0.1 - chalk: 4.1.2 - graceful-fs: 4.2.10 - micromatch: 4.0.5 - pretty-format: 29.7.0 - slash: 3.0.0 - stack-utils: 2.0.5 - dev: false - /jest-message-util@29.7.0: resolution: {integrity: sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -11607,15 +11462,6 @@ packages: stack-utils: 2.0.5 dev: false - /jest-mock@29.4.3: - resolution: {integrity: sha512-LjFgMg+xed9BdkPMyIJh+r3KeHt1klXPJYBULXVVAkbTaaKjPX1o1uVCAZADMEp/kOxGTwy/Ot8XbvgItOrHEg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/types': 29.4.3 - '@types/node': 20.9.5 - jest-util: 29.4.3 - dev: false - /jest-mock@29.7.0: resolution: {integrity: sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -11642,15 +11488,9 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dev: false - /jest-regex-util@29.4.3: - resolution: {integrity: sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dev: true - /jest-regex-util@29.6.3: resolution: {integrity: sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dev: false /jest-resolve-dependencies@29.7.0: resolution: {integrity: sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==} @@ -11784,17 +11624,6 @@ packages: picomatch: 2.3.1 dev: false - /jest-util@29.4.3: - resolution: {integrity: sha512-ToSGORAz4SSSoqxDSylWX8JzkOQR7zoBtNRsA7e+1WUX5F8jrOwaNpuh1YfJHJKDHXLHmObv5eOjejUd+/Ws+Q==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/types': 29.4.3 - '@types/node': 20.9.5 - chalk: 4.1.2 - ci-info: 3.9.0 - graceful-fs: 4.2.10 - picomatch: 2.3.1 - /jest-util@29.7.0: resolution: {integrity: sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -11805,7 +11634,6 @@ packages: ci-info: 3.9.0 graceful-fs: 4.2.10 picomatch: 2.3.1 - dev: false /jest-validate@25.5.0: resolution: {integrity: sha512-okUFKqhZIpo3jDdtUXUZ2LxGUZJIlfdYBvZb1aczzxrlyMlqdnnws9MOxezoLGhSaFc2XYaHNReNQfj5zPIWyQ==} @@ -11874,16 +11702,6 @@ packages: merge-stream: 2.0.0 supports-color: 8.1.1 - /jest-worker@29.4.3: - resolution: {integrity: sha512-GLHN/GTAAMEy5BFdvpUfzr9Dr80zQqBrh0fz1mtRMe05hqP45+HfQltu7oTBfduD0UeZs09d+maFtFYAXFWvAA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@types/node': 20.9.5 - jest-util: 29.4.3 - merge-stream: 2.0.0 - supports-color: 8.1.1 - dev: true - /jest-worker@29.7.0: resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -11892,7 +11710,6 @@ packages: jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 - dev: false /jest@29.7.0(@types/node@20.9.5)(ts-node@10.9.1): resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==} @@ -16024,7 +15841,7 @@ packages: resolution: {integrity: sha512-f2AOPogZmXgJ9Ma2M22ZEhc1dNtRIzcEkiflMFeVTRq+OViOZMvH1IPMVOwrKaxpSaHioBJiDR0SluRqGa7atA==} engines: {node: '>= 10'} dependencies: - '@polka/url': 1.0.0-next.21 + '@polka/url': 1.0.0-next.24 mime: 2.6.0 totalist: 1.1.0 @@ -17098,7 +16915,7 @@ packages: '@tsconfig/node16': 1.0.2 '@types/node': 16.11.10 acorn: 8.11.2 - acorn-walk: 8.3.1 + acorn-walk: 8.3.2 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 @@ -17130,7 +16947,7 @@ packages: '@tsconfig/node16': 1.0.2 '@types/node': 20.9.5 acorn: 8.11.2 - acorn-walk: 8.3.1 + acorn-walk: 8.3.2 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 @@ -17972,7 +17789,7 @@ packages: hasBin: true dependencies: acorn: 8.11.2 - acorn-walk: 8.3.1 + acorn-walk: 8.3.2 chalk: 4.1.2 commander: 7.2.0 gzip-size: 6.0.0 From b73747de9408a19d2fd0018b7213a0711ca84b4c Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sun, 4 Feb 2024 13:48:20 +1100 Subject: [PATCH 12/13] update changesets --- .changeset/integration.md | 2 ++ .changeset/plugins.md | 1 + 2 files changed, 3 insertions(+) diff --git a/.changeset/integration.md b/.changeset/integration.md index 527ce6d5..a5d39a61 100644 --- a/.changeset/integration.md +++ b/.changeset/integration.md @@ -3,3 +3,5 @@ --- Use absolute paths internally to make sure Vite resolves modules correctly + +This change only affects integrations that use the vite-node compiler, which is currently the esbuild (next) and Vite plugins diff --git a/.changeset/plugins.md b/.changeset/plugins.md index 23079c93..ffe0fb7a 100644 --- a/.changeset/plugins.md +++ b/.changeset/plugins.md @@ -1,5 +1,6 @@ --- '@vanilla-extract/vite-plugin': patch +'@vanilla-extract/esbuild-plugin-next': patch --- Correctly resolve module paths when using Vite plugins that affect module resolution, such as [`vite-tsconfig-paths`](https://github.com/aleclarson/vite-tsconfig-paths) From dbf178dd0f6882425646d78812ce8c0d32da31c3 Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sun, 4 Feb 2024 13:55:40 +1100 Subject: [PATCH 13/13] code review feedback --- packages/integration/src/compiler.ts | 4 ++-- tests/compiler/compiler.test.ts | 6 +++--- tests/compiler/compiler.vitest.test.ts | 2 ++ tests/compiler/fixtures/tsconfig-paths/src/main.tsx | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/integration/src/compiler.ts b/packages/integration/src/compiler.ts index 33a87ac8..c2137571 100644 --- a/packages/integration/src/compiler.ts +++ b/packages/integration/src/compiler.ts @@ -22,11 +22,11 @@ const scanModule = (entryModule: ModuleNode) => { const watchFiles = new Set(); for (const moduleNode of queue) { - if (!moduleNode.id || moduleNode.id.includes('@vanilla-extract/')) { + if (moduleNode.id?.includes('@vanilla-extract/')) { continue; } - if (cssFileFilter.test(moduleNode.id)) { + if (moduleNode.id && cssFileFilter.test(moduleNode.id)) { cssDeps.add(moduleNode.id); } if (moduleNode.file) { diff --git a/tests/compiler/compiler.test.ts b/tests/compiler/compiler.test.ts index dab72690..1cd70474 100644 --- a/tests/compiler/compiler.test.ts +++ b/tests/compiler/compiler.test.ts @@ -225,7 +225,7 @@ describe('compiler', () => { test('throws on getCssForFile when file does not exist', async () => { const compiler = compilers.default; - let error: Error | undefined; + let error: Error; try { compiler.getCssForFile('does-not-exist.css.ts'); @@ -234,8 +234,8 @@ describe('compiler', () => { } expect( - // We know `error.message` is defined, and we want make the snapshot consistent across machines - normalizePath(error!.message!.replace(__dirname, '{{__dirname}}')), + // We know `error.message` is defined here + normalizePath(error!.message), ).toMatchInlineSnapshot( `No CSS for file: {{__dirname}}/does-not-exist.css.ts`, ); diff --git a/tests/compiler/compiler.vitest.test.ts b/tests/compiler/compiler.vitest.test.ts index 60ad4d09..a8529fdd 100644 --- a/tests/compiler/compiler.vitest.test.ts +++ b/tests/compiler/compiler.vitest.test.ts @@ -15,6 +15,8 @@ expect.addSnapshotSerializer({ '"', }); +// ! These tests are to ensure that the compiler works correctly in Vitest. +// ! Please add tests to `compiler.test.ts` going forward. describe('compiler running in Vitest', () => { let compilers: Record< 'default' | 'vitePlugins' | 'viteResolve', diff --git a/tests/compiler/fixtures/tsconfig-paths/src/main.tsx b/tests/compiler/fixtures/tsconfig-paths/src/main.tsx index d37e3782..3f304bd1 100644 --- a/tests/compiler/fixtures/tsconfig-paths/src/main.tsx +++ b/tests/compiler/fixtures/tsconfig-paths/src/main.tsx @@ -1,5 +1,5 @@ import { box } from 'main.css'; document.getElementById('root')!.innerHTML = ` -
hello world
+
hello world
`;