Skip to content

Commit eced707

Browse files
committed
refactor(core): move internal browser host subpaths under ./internal
Rename @rstest/core's `./browser` and `./browser-runtime` exports to `./internal/browser` and `./internal/browser-runtime`. Both subpaths are consumed only by first-party packages (@rstest/browser, @rstest/browser-ui) and are JSDoc-marked "not part of the public API"; the `internal/` prefix makes the path name match that non-public reality. The two paths stay separate: `./internal/browser` carries Node-only deps while `./internal/browser-runtime` is browser-safe. Also retarget core's ambient module declaration for the browser host entries from `@rstest/browser` to `@rstest/browser/internal`, matching the subpath the runtime actually loads via browserLoader.
1 parent eb0e3c1 commit eced707

20 files changed

Lines changed: 30 additions & 28 deletions

knip.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"packages/core": {
3434
"entry": [
35-
// Package export: "./browser-runtime" (separate rslib env targeting web)
35+
// Package export: "./internal/browser-runtime" (separate rslib env targeting web)
3636
"src/browserRuntime.ts",
3737
// Worker entries bundled by rslib
3838
"src/runtime/worker/index.ts",

packages/browser-ui/src/core/caseMap.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from '@rstest/core';
2-
import type { TestInfo } from '@rstest/core/browser-runtime';
2+
import type { TestInfo } from '@rstest/core/internal/browser-runtime';
33
import type { CaseInfo } from '../utils/constants';
44
import { buildCollectedCaseMap, upsertRunningCase } from './caseMap';
55

packages/browser-ui/src/core/caseMap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { TestInfo } from '@rstest/core/browser-runtime';
1+
import type { TestInfo } from '@rstest/core/internal/browser-runtime';
22
import type { CaseInfo } from '../utils/constants';
33

44
type CollectedCaseInfo = Extract<TestInfo, { type: 'case' }>;

packages/browser-ui/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type {
1212
TestFileResult,
1313
TestInfo,
1414
TestResult,
15-
} from '@rstest/core/browser-runtime';
15+
} from '@rstest/core/internal/browser-runtime';
1616

1717
/**
1818
* Browser UI types

packages/browser-ui/src/utils/viewportPresets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
BROWSER_VIEWPORT_PRESET_DIMENSIONS,
33
BROWSER_VIEWPORT_PRESET_IDS,
44
} from '@rstest/browser/viewport-presets';
5-
import type { DevicePreset } from '@rstest/core/browser';
5+
import type { DevicePreset } from '@rstest/core/internal/browser';
66

77
export type { DevicePreset };
88

packages/browser/AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pnpm --filter @rstest/browser typecheck
105105

106106
## Dependencies
107107

108-
This package requires `@rstest/core` as a peer dependency. The browser client code uses internal APIs from `@rstest/core/browser`:
108+
This package requires `@rstest/core` as a peer dependency. The browser client code uses internal APIs from `@rstest/core/internal/browser`:
109109

110110
- `createRstestRuntime` - Creates test runtime
111111
- `setRealTimers` - Preserves real timer references

packages/browser/rslib.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default defineConfig({
3030
externals: {
3131
// Keep @rstest/core as external
3232
'@rstest/core': '@rstest/core',
33-
'@rstest/core/browser': '@rstest/core/browser',
33+
'@rstest/core/internal/browser': '@rstest/core/internal/browser',
3434
// Keep @rsbuild/core as external (provided by @rstest/core)
3535
'@rsbuild/core': '@rsbuild/core',
3636
},

packages/browser/src/client/entry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import type {
1212
RunnerHooks,
1313
RuntimeConfig,
1414
WorkerState,
15-
} from '@rstest/core/browser-runtime';
15+
} from '@rstest/core/internal/browser-runtime';
1616
import {
1717
createBrowserTaskContext,
1818
createRstestRuntime,
1919
globalApis,
2020
setRealTimers,
21-
} from '@rstest/core/browser-runtime';
21+
} from '@rstest/core/internal/browser-runtime';
2222
import { normalize } from 'pathe';
2323
import type {
2424
BrowserClientMessage,
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
2-
* Re-export runtime API from @rstest/core/browser-runtime for browser use.
2+
* Re-export runtime API from @rstest/core/internal/browser-runtime for browser use.
33
* This file is used as an alias target for '@rstest/core' in browser mode.
44
*
5-
* Uses @rstest/core/browser-runtime which only exports the test APIs
5+
* Uses @rstest/core/internal/browser-runtime which only exports the test APIs
66
* (describe, it, expect, etc.) without any Node.js dependencies.
77
*/
88

99
// Re-export types from @rstest/core (these are compile-time only)
1010
export type { Assertion, Mock } from '@rstest/core';
1111
// Re-export all public test APIs
12-
export * from '@rstest/core/browser-runtime';
12+
export * from '@rstest/core/internal/browser-runtime';

packages/browser/src/client/sourceMapSupport.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const preloadTestFileSourceMap = async (
102102
* Preload source map for the runner.js file.
103103
*
104104
* This is essential for inline snapshot support because the snapshot code
105-
* runs in runner.js (which contains @rstest/core/browser-runtime).
105+
* runs in runner.js (which contains @rstest/core/internal/browser-runtime).
106106
* Without this, stack traces from inline snapshots cannot be mapped back
107107
* to the original source files.
108108
*/

0 commit comments

Comments
 (0)