bun-webview2 0.4.1 → 0.4.2
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.
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/window.ts +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.2 — 2026-10-15
|
|
4
|
+
|
|
5
|
+
### 0.4.2 hotfix (same tag)
|
|
6
|
+
|
|
7
|
+
- The second-window dataDir guard compares resolved paths (`resolve(opts.dataDir) !== activeDataDir`): passing the same relative dataDir to multiple windows no longer throws a spurious "different data folder" error.
|
|
8
|
+
|
|
9
|
+
- Relative `dataDir` now resolves against the app's working directory. Previously a relative path reached the WebView2 loader unresolved, which placed browser data inside the package's `native/` directory instead of where the app author pointed it.
|
|
10
|
+
|
|
3
11
|
## 0.4.1 — 2026-10-15
|
|
4
12
|
|
|
5
13
|
- Release tooling: `.gitlab-ci.yml` — on version tags, the pipeline validates the tag against `package.json`, dry-runs the pack, and runs `npm stage publish` authenticated via GitLab OIDC trusted publishing (no npm tokens in CI).
|
package/package.json
CHANGED
package/src/window.ts
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* works in both wedged and healthy states.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import { resolve } from "node:path";
|
|
25
26
|
import { CdpConnection, pickFreePort, waitForPageTarget, type CdpTargetInfo } from "./cdp.ts";
|
|
26
27
|
import { buildHardeningScript, buildIpcBridgeScript, buildPageEventsScript, type HardeningOptions } from "./inject.ts";
|
|
27
28
|
|
|
@@ -268,13 +269,16 @@ export class Webview2Window {
|
|
|
268
269
|
static async create(opts: Webview2WindowOptions = {}): Promise<Webview2Window> {
|
|
269
270
|
if (activePort === undefined) {
|
|
270
271
|
const port = opts.port ?? (await pickFreePort());
|
|
271
|
-
|
|
272
|
+
// relative dataDir must resolve against the APP's cwd: the WebView2
|
|
273
|
+
// loader resolves relative paths in the env var against the runner
|
|
274
|
+
// exe's location (node_modules/.../native/), not the working directory
|
|
275
|
+
activeDataDir = resolve(opts.dataDir ?? defaultDataDir());
|
|
272
276
|
activePort = port;
|
|
273
277
|
} else if (opts.port !== undefined && opts.port !== activePort) {
|
|
274
278
|
throw new Error(
|
|
275
279
|
`bun-webview2: port ${opts.port} requested, but this app already drives its WebView2 browser on ${activePort}. All windows share one port.`,
|
|
276
280
|
);
|
|
277
|
-
} else if (opts.dataDir !== undefined && opts.dataDir !== activeDataDir) {
|
|
281
|
+
} else if (opts.dataDir !== undefined && resolve(opts.dataDir) !== activeDataDir) {
|
|
278
282
|
throw new Error(
|
|
279
283
|
`bun-webview2: dataDir ${opts.dataDir} requested, but this app already uses ${activeDataDir}. All windows share one data folder.`,
|
|
280
284
|
);
|