@arcgis/node-toolkit 6.0.0-next.40 → 6.0.0-next.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,13 +8,13 @@ function vitePresetPlugin({ externalize, bundleIn, isApplication } = { externali
8
8
  return [
9
9
  {
10
10
  name: "vite-preset-config",
11
- config(config, env) {
11
+ async config(config, env) {
12
12
  const { rollupOptions, ssr, target } = config.build ?? {};
13
13
  const isBrowserApplication = isApplication && !ssr && !env.isSsrBuild;
14
14
  const output = rollupOptions?.output;
15
15
  const hashlessOutput = Array.isArray(output) ? output.map((entry) => ({ ...hashlessOutputNames, ...entry })) : { ...hashlessOutputNames, ...output };
16
16
  return {
17
- ...configureTestTimezone(config, env),
17
+ ...await configureTestTimezone(config, env),
18
18
  build: {
19
19
  // REFACTOR: get this from tsconfig
20
20
  // It's a best practice to let the final bundler down-level as needed.
@@ -1,5 +1,5 @@
1
1
  import type { ConfigEnv, Plugin, UserConfig } from "vite";
2
- export declare function configureTestTimezone(config: UserConfig, env: ConfigEnv): UserConfig | undefined;
2
+ export declare function configureTestTimezone(config: UserConfig, env: ConfigEnv): Promise<UserConfig | undefined>;
3
3
  /**
4
4
  * Apply the repository's timezone policy to Vitest processes and Playwright contexts.
5
5
  *
@@ -1,14 +1,16 @@
1
1
  import { testTimezone } from "../testTimezone.js";
2
- function configureTestTimezone(config, env) {
2
+ async function configureTestTimezone(config, env) {
3
3
  if (env.command !== "serve" || process.env.VITEST !== "true") {
4
4
  return void 0;
5
5
  }
6
6
  const timezone = config.test?.env?.TZ ?? testTimezone;
7
7
  process.env.TZ = timezone;
8
8
  const browser = config.test?.browser;
9
- configurePlaywrightTimezone(browser?.provider, timezone);
10
- for (const instance of browser?.instances ?? []) {
11
- configurePlaywrightTimezone(instance.provider, timezone);
9
+ if (browser) {
10
+ browser.provider = await configurePlaywrightTimezone(browser.provider, timezone);
11
+ for (const instance of browser.instances ?? []) {
12
+ instance.provider = await configurePlaywrightTimezone(instance.provider, timezone);
13
+ }
12
14
  }
13
15
  return { test: { env: { TZ: timezone } } };
14
16
  }
@@ -19,12 +21,18 @@ function testTimezonePlugin() {
19
21
  config: configureTestTimezone
20
22
  };
21
23
  }
22
- function configurePlaywrightTimezone(provider, timezone) {
24
+ async function configurePlaywrightTimezone(provider, timezone) {
23
25
  if (!isPlaywrightProvider(provider)) {
24
- return;
26
+ return provider;
25
27
  }
26
- provider.options.contextOptions ??= {};
27
- provider.options.contextOptions.timezoneId ??= timezone;
28
+ const { playwright } = await import("@vitest/browser-playwright");
29
+ return playwright({
30
+ ...provider.options,
31
+ contextOptions: {
32
+ ...provider.options.contextOptions,
33
+ timezoneId: provider.options.contextOptions?.timezoneId ?? timezone
34
+ }
35
+ });
28
36
  }
29
37
  function isPlaywrightProvider(provider) {
30
38
  return provider?.name === "playwright";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/node-toolkit",
3
- "version": "6.0.0-next.40",
3
+ "version": "6.0.0-next.42",
4
4
  "description": "Collection of common internal build-time patterns and utilities for ArcGIS Maps SDK for JavaScript components.",
5
5
  "homepage": "https://developers.arcgis.com/javascript/latest/",
6
6
  "type": "module",
@@ -32,5 +32,13 @@
32
32
  "tslib": "^2.8.1",
33
33
  "typescript": "~6.0.3",
34
34
  "vite": "^7.3.2"
35
+ },
36
+ "peerDependencies": {
37
+ "@vitest/browser-playwright": "^5.1.0"
38
+ },
39
+ "peerDependenciesMeta": {
40
+ "@vitest/browser-playwright": {
41
+ "optional": true
42
+ }
35
43
  }
36
44
  }