diff --git a/packages/svelte/package.json b/packages/svelte/package.json index 4dd788fd9139..580b26c3851a 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -139,7 +139,7 @@ "acorn-typescript": "^1.4.13", "aria-query": "^5.3.1", "axobject-query": "^4.1.0", - "esm-env": "^1.0.0", + "esm-env": "^1.1.1", "esrap": "^1.2.2", "is-reference": "^3.0.2", "locate-character": "^3.0.0", diff --git a/packages/svelte/src/internal/client/timing.js b/packages/svelte/src/internal/client/timing.js index dc7d2ce4edf0..adc1aa213ebe 100644 --- a/packages/svelte/src/internal/client/timing.js +++ b/packages/svelte/src/internal/client/timing.js @@ -1,9 +1,10 @@ /** @import { Raf } from '#client' */ import { noop } from '../shared/utils.js'; -import { BROWSER } from 'esm-env'; +import { BROWSER, NODE } from 'esm-env'; -const request_animation_frame = BROWSER ? requestAnimationFrame : noop; +// we check both conditions here to allow running browser code in Node for testing +const request_animation_frame = BROWSER && !NODE ? requestAnimationFrame : noop; const now = BROWSER ? () => performance.now() : () => Date.now(); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 90a2bf2e6797..d4cb2bed5233 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -84,8 +84,8 @@ importers: specifier: ^4.1.0 version: 4.1.0 esm-env: - specifier: ^1.0.0 - version: 1.0.0 + specifier: ^1.1.1 + version: 1.1.1 esrap: specifier: ^1.2.2 version: 1.2.2 @@ -230,7 +230,7 @@ importers: version: 6.0.1(@lezer/common@1.2.1) esm-env: specifier: ^1.0.0 - version: 1.0.0 + version: 1.1.1 marked: specifier: ^7.0.2 version: 7.0.5 @@ -1445,8 +1445,8 @@ packages: jiti: optional: true - esm-env@1.0.0: - resolution: {integrity: sha512-Cf6VksWPsTuW01vU9Mk/3vRue91Zevka5SjyNf3nEpokFRuqt/KjUQoGAwq9qMmhpLTHmXzSIrFRw8zxWzmFBA==} + esm-env@1.1.1: + resolution: {integrity: sha512-5HLucDhz5yhDlMHqEedMyD4XjyV7+4vZhUS7zXNiBdSXFrViQCIeRmf7Gcs33USDcX0aGdCH+C6ZWbxzXy3ZGg==} espree@10.1.0: resolution: {integrity: sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==} @@ -3560,7 +3560,7 @@ snapshots: '@types/cookie': 0.6.0 cookie: 0.6.0 devalue: 5.0.0 - esm-env: 1.0.0 + esm-env: 1.1.1 import-meta-resolve: 4.1.0 kleur: 4.1.5 magic-string: 0.30.11 @@ -3575,7 +3575,7 @@ snapshots: '@sveltejs/site-kit@6.0.0-next.64(@sveltejs/kit@2.5.24(@sveltejs/vite-plugin-svelte@4.0.0-next.6(svelte@packages+svelte)(vite@5.4.6(@types/node@20.12.7)(lightningcss@1.23.0)(sass@1.70.0)(terser@5.27.0)))(svelte@packages+svelte)(vite@5.4.6(@types/node@20.12.7)(lightningcss@1.23.0)(sass@1.70.0)(terser@5.27.0)))(svelte@packages+svelte)': dependencies: '@sveltejs/kit': 2.5.24(@sveltejs/vite-plugin-svelte@4.0.0-next.6(svelte@packages+svelte)(vite@5.4.6(@types/node@20.12.7)(lightningcss@1.23.0)(sass@1.70.0)(terser@5.27.0)))(svelte@packages+svelte)(vite@5.4.6(@types/node@20.12.7)(lightningcss@1.23.0)(sass@1.70.0)(terser@5.27.0)) - esm-env: 1.0.0 + esm-env: 1.1.1 svelte: link:packages/svelte svelte-persisted-store: 0.9.2(svelte@packages+svelte) @@ -4223,7 +4223,7 @@ snapshots: transitivePeerDependencies: - supports-color - esm-env@1.0.0: {} + esm-env@1.1.1: {} espree@10.1.0: dependencies: